annotate src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp @ 22206:339beb637508

[SPARC] Offset constant table base pointer to leverage full 13 bit address range for constant loads
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 13 Jul 2015 11:03:41 +0200
parents a0d0ecbceeb4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
1 /*
21255
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
9934
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
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
23
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
24 #include "jvmci/jvmciCodeInstaller.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
25 #include "jvmci/jvmciRuntime.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
26 #include "jvmci/jvmciCompilerToVM.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
27 #include "jvmci/jvmciJavaAccess.hpp"
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
28 #include "vmreg_sparc.inline.hpp"
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
29
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
30 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
31 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
32 return pc_offset + NativeCall::instruction_size;
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
33 } else if (inst->is_call_reg()) {
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
34 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
35 } else if (inst->is_sethi()) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
36 return pc_offset + NativeFarCall::instruction_size;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
37 } else {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
38 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
39 return 0;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
40 }
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
41 }
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
42
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17024
diff changeset
43 void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
44 address pc = _instructions->start() + pc_offset;
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
45 Handle obj = HotSpotObjectConstantImpl::object(constant);
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
46 jobject value = JNIHandles::make_local(obj());
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
47 if (HotSpotObjectConstantImpl::compressed(constant)) {
21255
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
48 #ifdef _LP64
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
49 int oop_index = _oop_recorder->find_index(value);
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
50 RelocationHolder rspec = oop_Relocation::spec(oop_index);
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
51 _instructions->relocate(pc, rspec, 1);
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
52 #else
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
53 fatal("compressed oop on 32bit");
ccddbb1409d2 [SPARC] Implement Narrow OOPS
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18262
diff changeset
54 #endif
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
55 } else {
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
56 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
57 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
58
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
59 // 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
60 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
61 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
62 _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
63 _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
64 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
65 }
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
66
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 17024
diff changeset
67 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 13576
diff changeset
68 address pc = _instructions->start() + pc_offset;
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
69 NativeInstruction* inst = nativeInstruction_at(pc);
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
70 NativeInstruction* inst1 = nativeInstruction_at(pc + 4);
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
71 if(inst->is_sethi() && inst1->is_nop()) {
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
72 address const_start = _constants->start();
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
73 address dest = _constants->start() + data_offset;
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
74 if(_constants_size > 0) {
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
75 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
76 _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
77 }
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
78 TRACE_jvmci_3("relocating at %p (+%d) with destination at %d", pc, pc_offset, data_offset);
22195
a0d0ecbceeb4 [SPARC] Use rdpc for constructing constant table base
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
79 }else {
a0d0ecbceeb4 [SPARC] Use rdpc for constructing constant table base
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22114
diff changeset
80 int const_size = align_size_up(_constants->end()-_constants->start(), CodeEntryAlignment);
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
81 NativeMovRegMem* load = nativeMovRegMem_at(pc);
22206
339beb637508 [SPARC] Offset constant table base pointer to leverage full 13 bit address range for constant loads
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22195
diff changeset
82 // This offset must match with SPARCLoadConstantTableBaseOp.emitCode
339beb637508 [SPARC] Offset constant table base pointer to leverage full 13 bit address range for constant loads
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22195
diff changeset
83 load->set_offset(- (const_size - data_offset + Assembler::min_simm13()));
22114
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
84 TRACE_jvmci_3("relocating ld at %p (+%d) with destination at %d", pc, pc_offset, data_offset);
d9f3acb4a9a1 [SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21559
diff changeset
85 }
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
86 }
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
87
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
88 void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
89 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
90 }
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
91
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
92 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
93 address pc = (address) inst;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
94 if (inst->is_call()) {
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
95 NativeCall* call = nativeCall_at(pc);
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
96 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
97 _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
98 } else if (inst->is_sethi()) {
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
99 NativeJump* jump = nativeJump_at(pc);
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
100 jump->set_jump_destination((address) foreign_call_destination);
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
101 _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
102 } else {
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
103 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
104 }
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
105 TRACE_jvmci_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
106 }
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
107
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
108 void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) {
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
109 #ifdef ASSERT
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
110 Method* method = NULL;
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
111 // we need to check, this might also be an unresolved method
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18176
diff changeset
112 if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
113 method = getMethodFromHotSpotMethod(hotspot_method);
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
114 }
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
115 #endif
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
116 switch (_next_call_type) {
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
117 case INLINE_INVOKE:
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
118 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
119 case INVOKEVIRTUAL:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
120 case INVOKEINTERFACE: {
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
121 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
122 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
123 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10684
diff changeset
124 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
125 break;
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
126 }
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
127 case INVOKESTATIC: {
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
128 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
129 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
130 call->set_destination(SharedRuntime::get_resolve_static_call_stub());
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10684
diff changeset
131 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
132 break;
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
133 }
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
134 case INVOKESPECIAL: {
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
135 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
136 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
137 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
138 _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
139 break;
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
140 }
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
141 default:
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
142 fatal("invalid _next_call_type value");
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
143 break;
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10411
diff changeset
144 }
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
145 }
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
146
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
147 void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
11799
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
148 switch (mark) {
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
149 case POLL_NEAR:
11799
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
150 fatal("unimplemented");
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
151 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
152 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
153 _instructions->relocate(pc, relocInfo::poll_type);
11799
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
154 break;
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
155 case POLL_RETURN_NEAR:
11799
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
156 fatal("unimplemented");
15123
7ccd2a1df0fa made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents: 14574
diff changeset
157 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14561
diff changeset
158 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
159 _instructions->relocate(pc, relocInfo::poll_return_type);
11799
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
160 break;
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
161 default:
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
162 fatal("invalid mark value");
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
163 break;
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
164 }
4c96ccce3772 SPARC: added CodeInstaller::pd_relocate_poll
twisti
parents: 11760
diff changeset
165 }
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
166
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
167 // convert JVMCI register indices (as used in oop maps) to HotSpot registers
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
168 VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg) {
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
169 if (jvmci_reg < RegisterImpl::number_of_registers) {
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
170 return as_Register(jvmci_reg)->as_VMReg();
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
171 } else {
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21255
diff changeset
172 jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers;
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
173 floatRegisterNumber += MAX2(0, floatRegisterNumber-32); // Beginning with f32, only every second register is going to be addressed
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
174 if (floatRegisterNumber < FloatRegisterImpl::number_of_registers) {
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
175 return as_FloatRegister(floatRegisterNumber)->as_VMReg();
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
176 }
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
177 ShouldNotReachHere();
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
178 return NULL;
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
179 }
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
180 }
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
181
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
182 bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) {
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
183 return !hotspotRegister->is_FloatRegister();
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16631
diff changeset
184 }