Mercurial > hg > graal-jvmci-8
annotate src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp @ 14957:4062efea018b
Remove compiled method call intrinsic.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 03 Apr 2014 17:47:29 +0200 |
parents | 6bab029d6e3a |
children |
rev | line source |
---|---|
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
4 * |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
8 * |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
14 * |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
18 * |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
22 */ |
10684 | 23 |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
24 #ifndef CPU_SPARC_VM_CODEINSTALLER_SPARC_HPP |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
25 #define CPU_SPARC_VM_CODEINSTALLER_SPARC_HPP |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
26 |
10684 | 27 #include "graal/graalCompiler.hpp" |
28 #include "graal/graalCompilerToVM.hpp" | |
29 #include "graal/graalJavaAccess.hpp" | |
30 | |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
31 inline jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
32 if (inst->is_call() || inst->is_jump()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
33 return pc_offset + NativeCall::instruction_size; |
11233 | 34 } else if (inst->is_call_reg()) { |
35 return pc_offset + NativeCallReg::instruction_size; | |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
36 } else if (inst->is_sethi()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
37 return pc_offset + NativeFarCall::instruction_size; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
38 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
39 fatal("unsupported type of instruction for call site"); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
40 return 0; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
41 } |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
42 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
43 |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
44 inline void CodeInstaller::pd_patch_OopData(int pc_offset, oop data) { |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
45 if (OopData::compressed(obj)) { |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
46 fatal("unimplemented: narrow oop relocation"); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
47 } else { |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
48 address pc = _instructions->start() + pc_offset; |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
49 Handle obj = OopData::object(data); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
50 jobject value = JNIHandles::make_local(obj()); |
10684 | 51 |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
52 NativeMovConstReg* move = nativeMovConstReg_at(pc); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
53 move->set_data((intptr_t) value); |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13553
diff
changeset
|
54 |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
55 // We need two relocations: one on the sethi and one on the add. |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
56 int oop_index = _oop_recorder->find_index(value); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
57 RelocationHolder rspec = oop_Relocation::spec(oop_index); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
58 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
59 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
60 } |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
61 } |
11233 | 62 |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
63 inline void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, oop data) { |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
64 address pc = _instructions->start() + pc_offset; |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
65 jint offset = DataSectionReference::offset(data); |
11233 | 66 |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
67 NativeMovRegMem* load = nativeMovRegMem_at(pc); |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
68 int disp = _constants_size + pc_offset - offset - BytesPerInstWord; |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
69 load->set_offset(-disp); |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
70 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
71 |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
72 inline void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) { |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
73 fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp"); |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
74 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
75 |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
76 inline void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
77 address pc = (address) inst; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
78 if (inst->is_call()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
79 NativeCall* call = nativeCall_at(pc); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
80 call->set_destination((address) foreign_call_destination); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
81 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec()); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
82 } else if (inst->is_sethi()) { |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
83 NativeJump* jump = nativeJump_at(pc); |
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
84 jump->set_jump_destination((address) foreign_call_destination); |
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
85 _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec()); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
86 } else { |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
87 fatal(err_msg("unknown call or jump instruction at %p", pc)); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
88 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
89 TRACE_graal_3("relocating (foreign call) at %p", inst); |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
90 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
91 |
10684 | 92 inline void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) { |
93 #ifdef ASSERT | |
94 Method* method = NULL; | |
95 // we need to check, this might also be an unresolved method | |
96 if (hotspot_method->is_a(HotSpotResolvedJavaMethod::klass())) { | |
97 method = getMethodFromHotSpotMethod(hotspot_method); | |
98 } | |
99 #endif | |
100 switch (_next_call_type) { | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
101 case INLINE_INVOKE: |
10684 | 102 break; |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
103 case INVOKEVIRTUAL: |
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
104 case INVOKEINTERFACE: { |
10684 | 105 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); |
106 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
107 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); | |
10792 | 108 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc)); |
10684 | 109 break; |
110 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
111 case INVOKESTATIC: { |
10684 | 112 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); |
113 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
114 call->set_destination(SharedRuntime::get_resolve_static_call_stub()); | |
10792 | 115 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type); |
10684 | 116 break; |
117 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
118 case INVOKESPECIAL: { |
10684 | 119 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); |
120 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
121 call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub()); | |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
122 _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type); |
10684 | 123 break; |
124 } | |
125 default: | |
126 fatal("invalid _next_call_type value"); | |
127 break; | |
128 } | |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
129 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
130 |
11799 | 131 inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) { |
132 switch (mark) { | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
133 case POLL_NEAR: { |
11799 | 134 fatal("unimplemented"); |
135 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
136 case POLL_FAR: |
13553
d49f00604347
removed poll_Relocation::pollingForm type and associated data field and rely solely on format field of safepoint relocation entries when deciding whether or not to relocate the operand of a safepoint poll instruction
Doug Simon <doug.simon@oracle.com>
parents:
13515
diff
changeset
|
137 _instructions->relocate(pc, relocInfo::poll_type); |
11799 | 138 break; |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
139 case POLL_RETURN_NEAR: { |
11799 | 140 fatal("unimplemented"); |
141 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
142 case POLL_RETURN_FAR: |
13553
d49f00604347
removed poll_Relocation::pollingForm type and associated data field and rely solely on format field of safepoint relocation entries when deciding whether or not to relocate the operand of a safepoint poll instruction
Doug Simon <doug.simon@oracle.com>
parents:
13515
diff
changeset
|
143 _instructions->relocate(pc, relocInfo::poll_return_type); |
11799 | 144 break; |
145 default: | |
146 fatal("invalid mark value"); | |
147 break; | |
148 } | |
149 } | |
150 | |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
151 #endif // CPU_SPARC_VM_CODEINSTALLER_SPARC_HPP |