Mercurial > hg > graal-jvmci-8
annotate src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp @ 24118:3ce198ad35a6
check displacement >= 0 (JDK-8177673)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 03 Apr 2017 14:47:25 +0200 |
parents | 59f53c97a38a |
children |
rev | line source |
---|---|
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
23310
e5b5170606a2
8149689: [JVMCI] CodeInstaller::pd_patch_DataSectionReference should be able to throw exceptions
twisti
parents:
22721
diff
changeset
|
2 * Copyright (c) 2013, 2016, 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 | 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" |
22548
02fc27dc1da7
Rename jvmciJavaAccess.* to jvmciJavaClasses.*
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22204
diff
changeset
|
27 #include "jvmci/jvmciJavaClasses.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 | 29 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
30 jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, Handle method, TRAPS) { |
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 | 33 } else if (inst->is_call_reg()) { |
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 { |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
38 JVMCI_ERROR_0("unsupported type of instruction for call site"); |
10854
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 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
43 void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle constant, TRAPS) { |
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 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
53 JVMCI_ERROR("compressed oop on 32bit"); |
21255
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 | 66 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
67 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22548
diff
changeset
|
68 address pc = _instructions->start() + pc_offset; |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
69 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { |
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
70 #ifdef _LP64 |
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
71 NativeMovConstReg32* move = nativeMovConstReg32_at(pc); |
23767
edf3f2eb3b00
Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23330
diff
changeset
|
72 narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK); |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
73 move->set_data((intptr_t)narrowOop); |
23772
59f53c97a38a
Synchronize with JDK9 printing differences in jvmciCodeInstaller
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23767
diff
changeset
|
74 TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
75 #else |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
76 JVMCI_ERROR("compressed Klass* on 32bit"); |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
77 #endif |
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
78 } else { |
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
79 NativeMovConstReg* move = nativeMovConstReg_at(pc); |
23767
edf3f2eb3b00
Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23330
diff
changeset
|
80 void* reference = record_metadata_reference(_instructions, pc, constant, CHECK); |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
81 move->set_data((intptr_t)reference); |
23772
59f53c97a38a
Synchronize with JDK9 printing differences in jvmciCodeInstaller
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23767
diff
changeset
|
82 TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); |
22690
3da4f19cf93b
Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22684
diff
changeset
|
83 } |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22548
diff
changeset
|
84 } |
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22548
diff
changeset
|
85 |
23310
e5b5170606a2
8149689: [JVMCI] CodeInstaller::pd_patch_DataSectionReference should be able to throw exceptions
twisti
parents:
22721
diff
changeset
|
86 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) { |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13576
diff
changeset
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 _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
|
95 _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
|
96 } |
23772
59f53c97a38a
Synchronize with JDK9 printing differences in jvmciCodeInstaller
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23767
diff
changeset
|
97 TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset); |
22193
a0d0ecbceeb4
[SPARC] Use rdpc for constructing constant table base
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22114
diff
changeset
|
98 }else { |
a0d0ecbceeb4
[SPARC] Use rdpc for constructing constant table base
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22114
diff
changeset
|
99 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
|
100 NativeMovRegMem* load = nativeMovRegMem_at(pc); |
22204
339beb637508
[SPARC] Offset constant table base pointer to leverage full 13 bit address range for constant loads
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22193
diff
changeset
|
101 // 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:
22193
diff
changeset
|
102 load->set_offset(- (const_size - data_offset + Assembler::min_simm13())); |
23772
59f53c97a38a
Synchronize with JDK9 printing differences in jvmciCodeInstaller
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23767
diff
changeset
|
103 TRACE_jvmci_3("relocating ld at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset); |
22114
d9f3acb4a9a1
[SPARC] Implement constant loads from constant table with base register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21559
diff
changeset
|
104 } |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
105 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
106 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
107 void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
108 address pc = (address) inst; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
109 if (inst->is_call()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
110 NativeCall* call = nativeCall_at(pc); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
111 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
|
112 _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
|
113 } else if (inst->is_sethi()) { |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
114 NativeJump* jump = nativeJump_at(pc); |
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
115 jump->set_jump_destination((address) foreign_call_destination); |
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
116 _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
|
117 } else { |
22721
510846133438
8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents:
22711
diff
changeset
|
118 JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc)); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
119 } |
23772
59f53c97a38a
Synchronize with JDK9 printing differences in jvmciCodeInstaller
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23767
diff
changeset
|
120 TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst)); |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
121 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
122 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
123 void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) { |
10684 | 124 #ifdef ASSERT |
125 Method* method = NULL; | |
126 // 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
|
127 if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) { |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
128 method = getMethodFromHotSpotMethod(hotspot_method()); |
10684 | 129 } |
130 #endif | |
131 switch (_next_call_type) { | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
132 case INLINE_INVOKE: |
10684 | 133 break; |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
134 case INVOKEVIRTUAL: |
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
135 case INVOKEINTERFACE: { |
10684 | 136 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); |
137 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
138 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); | |
10792 | 139 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc)); |
10684 | 140 break; |
141 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
142 case INVOKESTATIC: { |
10684 | 143 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); |
144 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
145 call->set_destination(SharedRuntime::get_resolve_static_call_stub()); | |
10792 | 146 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type); |
10684 | 147 break; |
148 } | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
149 case INVOKESPECIAL: { |
10684 | 150 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); |
151 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | |
152 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
|
153 _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type); |
10684 | 154 break; |
155 } | |
156 default: | |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
157 JVMCI_ERROR("invalid _next_call_type value"); |
10684 | 158 break; |
159 } | |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
160 } |
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
161 |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
162 void CodeInstaller::pd_relocate_poll(address pc, jint mark, TRAPS) { |
11799 | 163 switch (mark) { |
15123
7ccd2a1df0fa
made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents:
14574
diff
changeset
|
164 case POLL_NEAR: |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
165 JVMCI_ERROR("unimplemented"); |
15123
7ccd2a1df0fa
made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents:
14574
diff
changeset
|
166 break; |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
167 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
|
168 _instructions->relocate(pc, relocInfo::poll_type); |
11799 | 169 break; |
15123
7ccd2a1df0fa
made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents:
14574
diff
changeset
|
170 case POLL_RETURN_NEAR: |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
171 JVMCI_ERROR("unimplemented"); |
15123
7ccd2a1df0fa
made SPARC compile again; moved graalCodeInstaller_<arch>.hpp to .cpp files
twisti
parents:
14574
diff
changeset
|
172 break; |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14561
diff
changeset
|
173 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
|
174 _instructions->relocate(pc, relocInfo::poll_return_type); |
11799 | 175 break; |
176 default: | |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
177 JVMCI_ERROR("invalid mark value"); |
11799 | 178 break; |
179 } | |
180 } | |
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
|
181 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21255
diff
changeset
|
182 // convert JVMCI register indices (as used in oop maps) to HotSpot registers |
22711
316e768645c0
8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents:
22698
diff
changeset
|
183 VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, TRAPS) { |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
184 // JVMCI Registers are numbered as follows: |
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
185 // 0..31: Thirty-two General Purpose registers (CPU Registers) |
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
186 // 32..63: Thirty-two single precision float registers |
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
187 // 64..95: Thirty-two double precision float registers |
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
188 // 96..111: Sixteen quad precision float registers |
22698
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
189 if (jvmci_reg < 32) { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21255
diff
changeset
|
190 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
|
191 } else { |
22698
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
192 jint floatRegisterNumber; |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
193 if(jvmci_reg < 64) { // Single precision |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
194 floatRegisterNumber = jvmci_reg - 32; |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
195 } else if(jvmci_reg < 96) { |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
196 floatRegisterNumber = 2 * (jvmci_reg - 64); |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
197 } else if(jvmci_reg < 112) { |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
198 floatRegisterNumber = 4 * (jvmci_reg - 96); |
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
199 } else { |
22721
510846133438
8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents:
22711
diff
changeset
|
200 JVMCI_ERROR_NULL("invalid register number: %d", jvmci_reg); |
22698
37505a836aaf
[SPARC] Fix VMReg number caluclation in CodeInstaller::get_hotspot_reg
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22690
diff
changeset
|
201 } |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22590
diff
changeset
|
202 return as_FloatRegister(floatRegisterNumber)->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
|
203 } |
4e2d34d7715b
[SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16631
diff
changeset
|
204 } |
4e2d34d7715b
[SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16631
diff
changeset
|
205 |
4e2d34d7715b
[SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16631
diff
changeset
|
206 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
|
207 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
|
208 } |