author | rschatz |
Fri, 05 Feb 2016 11:33:27 +0100 | |
changeset 35827 | 24e567453a33 |
parent 35823 | 59a847ec6ee3 |
child 36063 | 96e86c7f8fec |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
2 |
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
33160 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
#include "precompiled.hpp" |
|
25 |
#include "code/compiledIC.hpp" |
|
26 |
#include "compiler/compileBroker.hpp" |
|
27 |
#include "compiler/disassembler.hpp" |
|
28 |
#include "oops/oop.inline.hpp" |
|
29 |
#include "oops/objArrayOop.inline.hpp" |
|
30 |
#include "runtime/javaCalls.hpp" |
|
31 |
#include "jvmci/jvmciEnv.hpp" |
|
32 |
#include "jvmci/jvmciCompiler.hpp" |
|
33 |
#include "jvmci/jvmciCodeInstaller.hpp" |
|
34 |
#include "jvmci/jvmciJavaClasses.hpp" |
|
35 |
#include "jvmci/jvmciCompilerToVM.hpp" |
|
36 |
#include "jvmci/jvmciRuntime.hpp" |
|
37 |
#include "asm/register.hpp" |
|
38 |
#include "classfile/vmSymbols.hpp" |
|
39 |
#include "code/vmreg.hpp" |
|
40 |
||
41 |
#ifdef TARGET_ARCH_x86 |
|
42 |
# include "vmreg_x86.inline.hpp" |
|
43 |
#endif |
|
44 |
#ifdef TARGET_ARCH_sparc |
|
45 |
# include "vmreg_sparc.inline.hpp" |
|
46 |
#endif |
|
47 |
#ifdef TARGET_ARCH_zero |
|
48 |
# include "vmreg_zero.inline.hpp" |
|
49 |
#endif |
|
50 |
#ifdef TARGET_ARCH_arm |
|
51 |
# include "vmreg_arm.inline.hpp" |
|
52 |
#endif |
|
53 |
#ifdef TARGET_ARCH_ppc |
|
54 |
# include "vmreg_ppc.inline.hpp" |
|
55 |
#endif |
|
56 |
||
57 |
||
58 |
// frequently used constants |
|
59 |
// Allocate them with new so they are never destroyed (otherwise, a |
|
60 |
// forced exit could destroy these objects while they are still in |
|
61 |
// use). |
|
62 |
ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL); |
|
63 |
ConstantIntValue* CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1); |
|
64 |
ConstantIntValue* CodeInstaller::_int_0_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0); |
|
65 |
ConstantIntValue* CodeInstaller::_int_1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1); |
|
66 |
ConstantIntValue* CodeInstaller::_int_2_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2); |
|
67 |
LocationValue* CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location()); |
|
68 |
||
69 |
Method* getMethodFromHotSpotMethod(oop hotspot_method) { |
|
70 |
assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity"); |
|
71 |
return CompilerToVM::asMethod(hotspot_method); |
|
72 |
} |
|
73 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
74 |
VMReg getVMRegFromLocation(Handle location, int total_frame_size, TRAPS) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
75 |
if (location.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
76 |
THROW_NULL(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
77 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
78 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
79 |
Handle reg = code_Location::reg(location); |
33160 | 80 |
jint offset = code_Location::offset(location); |
81 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
82 |
if (reg.not_null()) { |
33160 | 83 |
// register |
84 |
jint number = code_Register::number(reg); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
85 |
VMReg vmReg = CodeInstaller::get_hotspot_reg(number, CHECK_NULL); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
86 |
if (offset % 4 == 0) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
87 |
return vmReg->next(offset / 4); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
88 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
89 |
JVMCI_ERROR_NULL("unaligned subregister offset %d in oop map", offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
90 |
} |
33160 | 91 |
} else { |
92 |
// stack slot |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
93 |
if (offset % 4 == 0) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
94 |
return VMRegImpl::stack2reg(offset / 4); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
95 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
96 |
JVMCI_ERROR_NULL("unaligned stack offset %d in oop map", offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
97 |
} |
33160 | 98 |
} |
99 |
} |
|
100 |
||
101 |
// creates a HotSpot oop map out of the byte arrays provided by DebugInfo |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
102 |
OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
103 |
Handle reference_map = DebugInfo::referenceMap(debug_info); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
104 |
if (reference_map.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
105 |
THROW_NULL(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
106 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
107 |
if (!reference_map->is_a(HotSpotReferenceMap::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
108 |
JVMCI_ERROR_NULL("unknown reference map: %s", reference_map->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
109 |
} |
33160 | 110 |
if (HotSpotReferenceMap::maxRegisterSize(reference_map) > 16) { |
111 |
_has_wide_vector = true; |
|
112 |
} |
|
113 |
OopMap* map = new OopMap(_total_frame_size, _parameter_count); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
114 |
objArrayHandle objects = HotSpotReferenceMap::objects(reference_map); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
115 |
objArrayHandle derivedBase = HotSpotReferenceMap::derivedBase(reference_map); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
116 |
typeArrayHandle sizeInBytes = HotSpotReferenceMap::sizeInBytes(reference_map); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
117 |
if (objects.is_null() || derivedBase.is_null() || sizeInBytes.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
118 |
THROW_NULL(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
119 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
120 |
if (objects->length() != derivedBase->length() || objects->length() != sizeInBytes->length()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
121 |
JVMCI_ERROR_NULL("arrays in reference map have different sizes: %d %d %d", objects->length(), derivedBase->length(), sizeInBytes->length()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
122 |
} |
33160 | 123 |
for (int i = 0; i < objects->length(); i++) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
124 |
Handle location = objects->obj_at(i); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
125 |
Handle baseLocation = derivedBase->obj_at(i); |
33160 | 126 |
int bytes = sizeInBytes->int_at(i); |
127 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
128 |
VMReg vmReg = getVMRegFromLocation(location, _total_frame_size, CHECK_NULL); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
129 |
if (baseLocation.not_null()) { |
33160 | 130 |
// derived oop |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
131 |
#ifdef _LP64 |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
132 |
if (bytes == 8) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
133 |
#else |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
134 |
if (bytes == 4) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
135 |
#endif |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
136 |
VMReg baseReg = getVMRegFromLocation(baseLocation, _total_frame_size, CHECK_NULL); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
137 |
map->set_derived_oop(vmReg, baseReg); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
138 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
139 |
JVMCI_ERROR_NULL("invalid derived oop size in ReferenceMap: %d", bytes); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
140 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
141 |
#ifdef _LP64 |
33160 | 142 |
} else if (bytes == 8) { |
143 |
// wide oop |
|
144 |
map->set_oop(vmReg); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
145 |
} else if (bytes == 4) { |
33160 | 146 |
// narrow oop |
147 |
map->set_narrowoop(vmReg); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
148 |
#else |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
149 |
} else if (bytes == 4) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
150 |
map->set_oop(vmReg); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
151 |
#endif |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
152 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
153 |
JVMCI_ERROR_NULL("invalid oop size in ReferenceMap: %d", bytes); |
33160 | 154 |
} |
155 |
} |
|
156 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
157 |
Handle callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
158 |
if (callee_save_info.not_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
159 |
objArrayHandle registers = RegisterSaveLayout::registers(callee_save_info); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
160 |
typeArrayHandle slots = RegisterSaveLayout::slots(callee_save_info); |
33160 | 161 |
for (jint i = 0; i < slots->length(); i++) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
162 |
Handle jvmci_reg = registers->obj_at(i); |
33160 | 163 |
jint jvmci_reg_number = code_Register::number(jvmci_reg); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
164 |
VMReg hotspot_reg = CodeInstaller::get_hotspot_reg(jvmci_reg_number, CHECK_NULL); |
33160 | 165 |
// HotSpot stack slots are 4 bytes |
166 |
jint jvmci_slot = slots->int_at(i); |
|
167 |
jint hotspot_slot = jvmci_slot * VMRegImpl::slots_per_word; |
|
168 |
VMReg hotspot_slot_as_reg = VMRegImpl::stack2reg(hotspot_slot); |
|
169 |
map->set_callee_saved(hotspot_slot_as_reg, hotspot_reg); |
|
170 |
#ifdef _LP64 |
|
171 |
// (copied from generate_oop_map() in c1_Runtime1_x86.cpp) |
|
172 |
VMReg hotspot_slot_hi_as_reg = VMRegImpl::stack2reg(hotspot_slot + 1); |
|
173 |
map->set_callee_saved(hotspot_slot_hi_as_reg, hotspot_reg->next()); |
|
174 |
#endif |
|
175 |
} |
|
176 |
} |
|
177 |
return map; |
|
178 |
} |
|
179 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
180 |
Metadata* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) { |
33632 | 181 |
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); |
33160 | 182 |
if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { |
183 |
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); |
|
33632 | 184 |
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass)); |
185 |
int index = _oop_recorder->find_index(klass); |
|
186 |
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); |
|
187 |
return klass; |
|
33160 | 188 |
} else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) { |
189 |
Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj); |
|
33632 | 190 |
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method)); |
191 |
int index = _oop_recorder->find_index(method); |
|
192 |
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string()); |
|
193 |
return method; |
|
33160 | 194 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
195 |
JVMCI_ERROR_NULL("unexpected metadata reference for constant of type %s", obj->klass()->signature_name()); |
33160 | 196 |
} |
197 |
} |
|
198 |
||
33632 | 199 |
#ifdef _LP64 |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
200 |
narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRAPS) { |
33632 | 201 |
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); |
202 |
assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer"); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
203 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
204 |
if (!obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
205 |
JVMCI_ERROR_0("unexpected compressed pointer of type %s", obj->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
206 |
} |
33160 | 207 |
|
33632 | 208 |
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); |
209 |
int index = _oop_recorder->find_index(klass); |
|
210 |
TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); |
|
211 |
return Klass::encode_klass(klass); |
|
33160 | 212 |
} |
33632 | 213 |
#endif |
33160 | 214 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
215 |
Location::Type CodeInstaller::get_oop_type(Handle value) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
216 |
Handle lirKind = Value::lirKind(value); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
217 |
Handle platformKind = LIRKind::platformKind(lirKind); |
33160 | 218 |
assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask"); |
219 |
||
220 |
if (platformKind == word_kind()) { |
|
221 |
return Location::oop; |
|
222 |
} else { |
|
223 |
return Location::narrowoop; |
|
224 |
} |
|
225 |
} |
|
226 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
227 |
ScopeValue* CodeInstaller::get_scope_value(Handle value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, TRAPS) { |
33160 | 228 |
second = NULL; |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
229 |
if (value.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
230 |
THROW_NULL(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
231 |
} else if (value == Value::ILLEGAL()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
232 |
if (type != T_ILLEGAL) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
233 |
JVMCI_ERROR_NULL("unexpected illegal value, expected %s", basictype_to_str(type)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
234 |
} |
33160 | 235 |
return _illegal_value; |
236 |
} else if (value->is_a(RegisterValue::klass())) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
237 |
Handle reg = RegisterValue::reg(value); |
33160 | 238 |
jint number = code_Register::number(reg); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
239 |
VMReg hotspotRegister = get_hotspot_reg(number, CHECK_NULL); |
33160 | 240 |
if (is_general_purpose_reg(hotspotRegister)) { |
241 |
Location::Type locationType; |
|
242 |
if (type == T_OBJECT) { |
|
243 |
locationType = get_oop_type(value); |
|
244 |
} else if (type == T_LONG) { |
|
245 |
locationType = Location::lng; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
246 |
} else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
247 |
locationType = Location::int_in_long; |
33160 | 248 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
249 |
JVMCI_ERROR_NULL("unexpected type %s in cpu register", basictype_to_str(type)); |
33160 | 250 |
} |
251 |
ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); |
|
252 |
if (type == T_LONG) { |
|
253 |
second = value; |
|
254 |
} |
|
255 |
return value; |
|
256 |
} else { |
|
257 |
Location::Type locationType; |
|
258 |
if (type == T_FLOAT) { |
|
259 |
// this seems weird, but the same value is used in c1_LinearScan |
|
260 |
locationType = Location::normal; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
261 |
} else if (type == T_DOUBLE) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
262 |
locationType = Location::dbl; |
33160 | 263 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
264 |
JVMCI_ERROR_NULL("unexpected type %s in floating point register", basictype_to_str(type)); |
33160 | 265 |
} |
266 |
ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); |
|
267 |
if (type == T_DOUBLE) { |
|
268 |
second = value; |
|
269 |
} |
|
270 |
return value; |
|
271 |
} |
|
272 |
} else if (value->is_a(StackSlot::klass())) { |
|
273 |
jint offset = StackSlot::offset(value); |
|
274 |
if (StackSlot::addFrameSize(value)) { |
|
275 |
offset += _total_frame_size; |
|
276 |
} |
|
277 |
||
278 |
Location::Type locationType; |
|
279 |
if (type == T_OBJECT) { |
|
280 |
locationType = get_oop_type(value); |
|
281 |
} else if (type == T_LONG) { |
|
282 |
locationType = Location::lng; |
|
283 |
} else if (type == T_DOUBLE) { |
|
284 |
locationType = Location::dbl; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
285 |
} else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
286 |
locationType = Location::normal; |
33160 | 287 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
288 |
JVMCI_ERROR_NULL("unexpected type %s in stack slot", basictype_to_str(type)); |
33160 | 289 |
} |
290 |
ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); |
|
291 |
if (type == T_DOUBLE || type == T_LONG) { |
|
292 |
second = value; |
|
293 |
} |
|
294 |
return value; |
|
295 |
} else if (value->is_a(JavaConstant::klass())) { |
|
296 |
if (value->is_a(PrimitiveConstant::klass())) { |
|
297 |
if (value->is_a(RawConstant::klass())) { |
|
298 |
jlong prim = PrimitiveConstant::primitive(value); |
|
299 |
return new ConstantLongValue(prim); |
|
300 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
301 |
BasicType constantType = JVMCIRuntime::kindToBasicType(PrimitiveConstant::kind(value), CHECK_NULL); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
302 |
if (type != constantType) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
303 |
JVMCI_ERROR_NULL("primitive constant type doesn't match, expected %s but got %s", basictype_to_str(type), basictype_to_str(constantType)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
304 |
} |
33160 | 305 |
if (type == T_INT || type == T_FLOAT) { |
306 |
jint prim = (jint)PrimitiveConstant::primitive(value); |
|
307 |
switch (prim) { |
|
308 |
case -1: return _int_m1_scope_value; |
|
309 |
case 0: return _int_0_scope_value; |
|
310 |
case 1: return _int_1_scope_value; |
|
311 |
case 2: return _int_2_scope_value; |
|
312 |
default: return new ConstantIntValue(prim); |
|
313 |
} |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
314 |
} else if (type == T_LONG || type == T_DOUBLE) { |
33160 | 315 |
jlong prim = PrimitiveConstant::primitive(value); |
316 |
second = _int_1_scope_value; |
|
317 |
return new ConstantLongValue(prim); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
318 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
319 |
JVMCI_ERROR_NULL("unexpected primitive constant type %s", basictype_to_str(type)); |
33160 | 320 |
} |
321 |
} |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
322 |
} else if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
323 |
if (type == T_OBJECT) { |
33160 | 324 |
return _oop_null_scope_value; |
325 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
326 |
JVMCI_ERROR_NULL("unexpected null constant, expected %s", basictype_to_str(type)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
327 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
328 |
} else if (value->is_a(HotSpotObjectConstantImpl::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
329 |
if (type == T_OBJECT) { |
33160 | 330 |
oop obj = HotSpotObjectConstantImpl::object(value); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
331 |
if (obj == NULL) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
332 |
JVMCI_ERROR_NULL("null value must be in NullConstant"); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
333 |
} |
33160 | 334 |
return new ConstantOopWriteValue(JNIHandles::make_local(obj)); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
335 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
336 |
JVMCI_ERROR_NULL("unexpected object constant, expected %s", basictype_to_str(type)); |
33160 | 337 |
} |
338 |
} |
|
339 |
} else if (value->is_a(VirtualObject::klass())) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
340 |
if (type == T_OBJECT) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
341 |
int id = VirtualObject::id(value); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
342 |
if (0 <= id && id < objects->length()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
343 |
ScopeValue* object = objects->at(id); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
344 |
if (object != NULL) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
345 |
return object; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
346 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
347 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
348 |
JVMCI_ERROR_NULL("unknown virtual object id %d", id); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
349 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
350 |
JVMCI_ERROR_NULL("unexpected virtual object, expected %s", basictype_to_str(type)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
351 |
} |
33160 | 352 |
} |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
353 |
|
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
354 |
JVMCI_ERROR_NULL("unexpected value in scope: %s", value->klass()->signature_name()) |
33160 | 355 |
} |
356 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
357 |
void CodeInstaller::record_object_value(ObjectValue* sv, Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
358 |
Handle type = VirtualObject::type(value); |
33160 | 359 |
int id = VirtualObject::id(value); |
360 |
oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); |
|
361 |
Klass* klass = java_lang_Class::as_Klass(javaMirror); |
|
362 |
bool isLongArray = klass == Universe::longArrayKlassObj(); |
|
363 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
364 |
objArrayHandle values = VirtualObject::values(value); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
365 |
objArrayHandle slotKinds = VirtualObject::slotKinds(value); |
33160 | 366 |
for (jint i = 0; i < values->length(); i++) { |
367 |
ScopeValue* cur_second = NULL; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
368 |
Handle object = values->obj_at(i); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
369 |
BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
370 |
ScopeValue* value = get_scope_value(object, type, objects, cur_second, CHECK); |
33160 | 371 |
|
372 |
if (isLongArray && cur_second == NULL) { |
|
373 |
// we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. |
|
374 |
// add an int 0 constant |
|
375 |
cur_second = _int_0_scope_value; |
|
376 |
} |
|
377 |
||
378 |
if (cur_second != NULL) { |
|
379 |
sv->field_values()->append(cur_second); |
|
380 |
} |
|
381 |
assert(value != NULL, "missing value"); |
|
382 |
sv->field_values()->append(value); |
|
383 |
} |
|
384 |
} |
|
385 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
386 |
MonitorValue* CodeInstaller::get_monitor_value(Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
387 |
if (value.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
388 |
THROW_NULL(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
389 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
390 |
if (!value->is_a(StackLockValue::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
391 |
JVMCI_ERROR_NULL("Monitors must be of type StackLockValue, got %s", value->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
392 |
} |
33160 | 393 |
|
394 |
ScopeValue* second = NULL; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
395 |
ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second, CHECK_NULL); |
33160 | 396 |
assert(second == NULL, "monitor cannot occupy two stack slots"); |
397 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
398 |
ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), T_LONG, objects, second, CHECK_NULL); |
33160 | 399 |
assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots"); |
400 |
assert(lock_data_value->is_location(), "invalid monitor location"); |
|
401 |
Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); |
|
402 |
||
403 |
bool eliminated = false; |
|
404 |
if (StackLockValue::eliminated(value)) { |
|
405 |
eliminated = true; |
|
406 |
} |
|
407 |
||
408 |
return new MonitorValue(owner_value, lock_data_loc, eliminated); |
|
409 |
} |
|
410 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
411 |
void CodeInstaller::initialize_dependencies(oop compiled_code, OopRecorder* recorder, TRAPS) { |
33160 | 412 |
JavaThread* thread = JavaThread::current(); |
413 |
CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL; |
|
414 |
_oop_recorder = recorder; |
|
415 |
_dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL); |
|
416 |
objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code); |
|
417 |
if (!assumptions.is_null()) { |
|
418 |
int length = assumptions->length(); |
|
419 |
for (int i = 0; i < length; ++i) { |
|
420 |
Handle assumption = assumptions->obj_at(i); |
|
421 |
if (!assumption.is_null()) { |
|
422 |
if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) { |
|
423 |
assumption_NoFinalizableSubclass(assumption); |
|
424 |
} else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) { |
|
425 |
assumption_ConcreteSubtype(assumption); |
|
426 |
} else if (assumption->klass() == Assumptions_LeafType::klass()) { |
|
427 |
assumption_LeafType(assumption); |
|
428 |
} else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) { |
|
429 |
assumption_ConcreteMethod(assumption); |
|
430 |
} else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) { |
|
431 |
assumption_CallSiteTargetValue(assumption); |
|
432 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
433 |
JVMCI_ERROR("unexpected Assumption subclass %s", assumption->klass()->signature_name()); |
33160 | 434 |
} |
435 |
} |
|
436 |
} |
|
437 |
} |
|
33632 | 438 |
if (JvmtiExport::can_hotswap_or_post_breakpoint()) { |
439 |
objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code); |
|
440 |
if (!methods.is_null()) { |
|
441 |
int length = methods->length(); |
|
442 |
for (int i = 0; i < length; ++i) { |
|
443 |
Handle method_handle = methods->obj_at(i); |
|
444 |
methodHandle method = getMethodFromHotSpotMethod(method_handle()); |
|
445 |
_dependencies->assert_evol_method(method()); |
|
446 |
} |
|
33160 | 447 |
} |
448 |
} |
|
449 |
} |
|
450 |
||
451 |
RelocBuffer::~RelocBuffer() { |
|
452 |
if (_buffer != NULL) { |
|
453 |
FREE_C_HEAP_ARRAY(char, _buffer); |
|
454 |
} |
|
455 |
} |
|
456 |
||
457 |
address RelocBuffer::begin() const { |
|
458 |
if (_buffer != NULL) { |
|
459 |
return (address) _buffer; |
|
460 |
} |
|
461 |
return (address) _static_buffer; |
|
462 |
} |
|
463 |
||
464 |
void RelocBuffer::set_size(size_t bytes) { |
|
465 |
assert(bytes <= _size, "can't grow in size!"); |
|
466 |
_size = bytes; |
|
467 |
} |
|
468 |
||
469 |
void RelocBuffer::ensure_size(size_t bytes) { |
|
470 |
assert(_buffer == NULL, "can only be used once"); |
|
471 |
assert(_size == 0, "can only be used once"); |
|
472 |
if (bytes >= RelocBuffer::stack_size) { |
|
473 |
_buffer = NEW_C_HEAP_ARRAY(char, bytes, mtInternal); |
|
474 |
} |
|
475 |
_size = bytes; |
|
476 |
} |
|
477 |
||
34165 | 478 |
JVMCIEnv::CodeInstallResult CodeInstaller::gather_metadata(Handle target, Handle compiled_code, CodeMetadata& metadata, TRAPS) { |
33160 | 479 |
CodeBuffer buffer("JVMCI Compiler CodeBuffer for Metadata"); |
480 |
jobject compiled_code_obj = JNIHandles::make_local(compiled_code()); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
481 |
initialize_dependencies(JNIHandles::resolve(compiled_code_obj), NULL, CHECK_OK); |
33160 | 482 |
|
483 |
// Get instructions and constants CodeSections early because we need it. |
|
484 |
_instructions = buffer.insts(); |
|
485 |
_constants = buffer.consts(); |
|
486 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
487 |
initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
488 |
JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, CHECK_OK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
489 |
if (result != JVMCIEnv::ok) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
490 |
return result; |
33160 | 491 |
} |
492 |
||
493 |
_debug_recorder->pcs_size(); // ehm, create the sentinel record |
|
494 |
||
495 |
assert(_debug_recorder->pcs_length() >= 2, "must be at least 2"); |
|
496 |
||
497 |
metadata.set_pc_desc(_debug_recorder->pcs(), _debug_recorder->pcs_length()); |
|
498 |
metadata.set_scopes(_debug_recorder->stream()->buffer(), _debug_recorder->data_size()); |
|
499 |
metadata.set_exception_table(&_exception_handler_table); |
|
500 |
||
501 |
RelocBuffer* reloc_buffer = metadata.get_reloc_buffer(); |
|
502 |
||
503 |
reloc_buffer->ensure_size(buffer.total_relocation_size()); |
|
504 |
size_t size = (size_t) buffer.copy_relocations_to(reloc_buffer->begin(), (CodeBuffer::csize_t) reloc_buffer->size(), true); |
|
505 |
reloc_buffer->set_size(size); |
|
506 |
return JVMCIEnv::ok; |
|
507 |
} |
|
508 |
||
509 |
// constructor used to create a method |
|
34165 | 510 |
JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) { |
33160 | 511 |
CodeBuffer buffer("JVMCI Compiler CodeBuffer"); |
512 |
jobject compiled_code_obj = JNIHandles::make_local(compiled_code()); |
|
513 |
OopRecorder* recorder = new OopRecorder(&_arena, true); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
514 |
initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder, CHECK_OK); |
33160 | 515 |
|
516 |
// Get instructions and constants CodeSections early because we need it. |
|
517 |
_instructions = buffer.insts(); |
|
518 |
_constants = buffer.consts(); |
|
519 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
520 |
initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
521 |
JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, CHECK_OK); |
33160 | 522 |
if (result != JVMCIEnv::ok) { |
523 |
return result; |
|
524 |
} |
|
525 |
||
526 |
int stack_slots = _total_frame_size / HeapWordSize; // conversion to words |
|
527 |
||
528 |
if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) { |
|
529 |
oop stubName = HotSpotCompiledCode::name(compiled_code_obj); |
|
530 |
char* name = strdup(java_lang_String::as_utf8_string(stubName)); |
|
531 |
cb = RuntimeStub::new_runtime_stub(name, |
|
532 |
&buffer, |
|
533 |
CodeOffsets::frame_never_safe, |
|
534 |
stack_slots, |
|
535 |
_debug_recorder->_oopmaps, |
|
536 |
false); |
|
537 |
result = JVMCIEnv::ok; |
|
538 |
} else { |
|
539 |
nmethod* nm = NULL; |
|
540 |
methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code)); |
|
541 |
jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code); |
|
542 |
jint id = HotSpotCompiledNmethod::id(compiled_code); |
|
543 |
bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE; |
|
544 |
JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code); |
|
545 |
if (id == -1) { |
|
546 |
// Make sure a valid compile_id is associated with every compile |
|
547 |
id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci); |
|
548 |
} |
|
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
549 |
result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer, |
33160 | 550 |
stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
551 |
compiler, _debug_recorder, _dependencies, env, id, |
|
552 |
has_unsafe_access, _has_wide_vector, installed_code, compiled_code, speculation_log); |
|
553 |
cb = nm; |
|
554 |
} |
|
555 |
||
556 |
if (cb != NULL) { |
|
557 |
// Make sure the pre-calculated constants section size was correct. |
|
33198 | 558 |
guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size); |
33160 | 559 |
} |
560 |
return result; |
|
561 |
} |
|
562 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
563 |
void CodeInstaller::initialize_fields(oop target, oop compiled_code, TRAPS) { |
33160 | 564 |
if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) { |
565 |
Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code); |
|
566 |
methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod()); |
|
567 |
_parameter_count = method->size_of_parameters(); |
|
568 |
TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string()); |
|
569 |
} else { |
|
570 |
// Must be a HotSpotCompiledRuntimeStub. |
|
571 |
// Only used in OopMap constructor for non-product builds |
|
572 |
_parameter_count = 0; |
|
573 |
} |
|
574 |
_sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code)); |
|
575 |
||
576 |
_code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code)); |
|
577 |
_code_size = HotSpotCompiledCode::targetCodeSize(compiled_code); |
|
578 |
_total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code); |
|
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
579 |
|
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
580 |
oop deoptRescueSlot = HotSpotCompiledCode::deoptRescueSlot(compiled_code); |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
581 |
if (deoptRescueSlot == NULL) { |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
582 |
_orig_pc_offset = -1; |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
583 |
} else { |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
584 |
_orig_pc_offset = StackSlot::offset(deoptRescueSlot); |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
585 |
if (StackSlot::addFrameSize(deoptRescueSlot)) { |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
586 |
_orig_pc_offset += _total_frame_size; |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
587 |
} |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
588 |
if (_orig_pc_offset < 0) { |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
589 |
JVMCI_ERROR("invalid deopt rescue slot: %d", _orig_pc_offset); |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
590 |
} |
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
591 |
} |
33160 | 592 |
|
593 |
// Pre-calculate the constants section size. This is required for PC-relative addressing. |
|
594 |
_data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code)); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
595 |
if ((_constants->alignment() % HotSpotCompiledCode::dataSectionAlignment(compiled_code)) != 0) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
596 |
JVMCI_ERROR("invalid data section alignment: %d", HotSpotCompiledCode::dataSectionAlignment(compiled_code)); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
597 |
} |
33160 | 598 |
_constants_size = data_section()->length(); |
599 |
||
600 |
_data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code)); |
|
601 |
||
602 |
#ifndef PRODUCT |
|
603 |
_comments_handle = JNIHandles::make_local(HotSpotCompiledCode::comments(compiled_code)); |
|
604 |
#endif |
|
605 |
||
606 |
_next_call_type = INVOKE_INVALID; |
|
607 |
||
608 |
_has_wide_vector = false; |
|
609 |
||
610 |
oop arch = TargetDescription::arch(target); |
|
611 |
_word_kind_handle = JNIHandles::make_local(Architecture::wordKind(arch)); |
|
612 |
} |
|
613 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
614 |
int CodeInstaller::estimate_stubs_size(TRAPS) { |
33632 | 615 |
// Estimate the number of static call stubs that might be emitted. |
33160 | 616 |
int static_call_stubs = 0; |
617 |
objArrayOop sites = this->sites(); |
|
618 |
for (int i = 0; i < sites->length(); i++) { |
|
619 |
oop site = sites->obj_at(i); |
|
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
620 |
if (site != NULL && site->is_a(site_Mark::klass())) { |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
621 |
oop id_obj = site_Mark::id(site); |
33160 | 622 |
if (id_obj != NULL) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
623 |
if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
624 |
JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
625 |
} |
33160 | 626 |
jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); |
627 |
if (id == INVOKESTATIC || id == INVOKESPECIAL) { |
|
628 |
static_call_stubs++; |
|
629 |
} |
|
630 |
} |
|
631 |
} |
|
632 |
} |
|
633 |
return static_call_stubs * CompiledStaticCall::to_interp_stub_size(); |
|
634 |
} |
|
635 |
||
636 |
// perform data and call relocation on the CodeBuffer |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
637 |
JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, TRAPS) { |
33632 | 638 |
HandleMark hm; |
33160 | 639 |
objArrayHandle sites = this->sites(); |
640 |
int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo)); |
|
641 |
||
642 |
// Allocate enough space in the stub section for the static call |
|
643 |
// stubs. Stubs have extra relocs but they are managed by the stub |
|
644 |
// section itself so they don't need to be accounted for in the |
|
645 |
// locs_buffer above. |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
646 |
int stubs_size = estimate_stubs_size(CHECK_OK); |
33160 | 647 |
int total_size = round_to(_code_size, buffer.insts()->alignment()) + round_to(_constants_size, buffer.consts()->alignment()) + round_to(stubs_size, buffer.stubs()->alignment()); |
648 |
||
649 |
if (total_size > JVMCINMethodSizeLimit) { |
|
650 |
return JVMCIEnv::code_too_large; |
|
651 |
} |
|
652 |
||
653 |
buffer.initialize(total_size, locs_buffer_size); |
|
654 |
if (buffer.blob() == NULL) { |
|
655 |
return JVMCIEnv::cache_full; |
|
656 |
} |
|
657 |
buffer.initialize_stubs_size(stubs_size); |
|
658 |
buffer.initialize_consts_size(_constants_size); |
|
659 |
||
660 |
_debug_recorder = new DebugInformationRecorder(_oop_recorder); |
|
661 |
_debug_recorder->set_oopmaps(new OopMapSet()); |
|
662 |
||
663 |
buffer.initialize_oop_recorder(_oop_recorder); |
|
664 |
||
665 |
// copy the constant data into the newly created CodeBuffer |
|
666 |
address end_data = _constants->start() + _constants_size; |
|
667 |
memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size); |
|
668 |
_constants->set_end(end_data); |
|
669 |
||
670 |
// copy the code into the newly created CodeBuffer |
|
671 |
address end_pc = _instructions->start() + _code_size; |
|
672 |
guarantee(_instructions->allocates2(end_pc), "initialize should have reserved enough space for all the code"); |
|
673 |
memcpy(_instructions->start(), code()->base(T_BYTE), _code_size); |
|
674 |
_instructions->set_end(end_pc); |
|
675 |
||
676 |
for (int i = 0; i < data_section_patches()->length(); i++) { |
|
677 |
Handle patch = data_section_patches()->obj_at(i); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
678 |
if (patch.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
679 |
THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
680 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
681 |
Handle reference = site_DataPatch::reference(patch); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
682 |
if (reference.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
683 |
THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
684 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
685 |
if (!reference->is_a(site_ConstantReference::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
686 |
JVMCI_ERROR_OK("invalid patch in data section: %s", reference->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
687 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
688 |
Handle constant = site_ConstantReference::constant(reference); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
689 |
if (constant.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
690 |
THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
691 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
692 |
address dest = _constants->start() + site_Site::pcOffset(patch); |
33160 | 693 |
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { |
33632 | 694 |
if (HotSpotMetaspaceConstantImpl::compressed(constant)) { |
695 |
#ifdef _LP64 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
696 |
*((narrowKlass*) dest) = record_narrow_metadata_reference(constant, CHECK_OK); |
33632 | 697 |
#else |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
698 |
JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode"); |
33632 | 699 |
#endif |
700 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
701 |
*((Metadata**) dest) = record_metadata_reference(constant, CHECK_OK); |
33632 | 702 |
} |
33160 | 703 |
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { |
704 |
Handle obj = HotSpotObjectConstantImpl::object(constant); |
|
705 |
jobject value = JNIHandles::make_local(obj()); |
|
706 |
int oop_index = _oop_recorder->find_index(value); |
|
707 |
||
708 |
if (HotSpotObjectConstantImpl::compressed(constant)) { |
|
709 |
#ifdef _LP64 |
|
710 |
_constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const); |
|
711 |
#else |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
712 |
JVMCI_ERROR_OK("unexpected compressed oop in 32-bit mode"); |
33160 | 713 |
#endif |
714 |
} else { |
|
715 |
_constants->relocate(dest, oop_Relocation::spec(oop_index)); |
|
716 |
} |
|
717 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
718 |
JVMCI_ERROR_OK("invalid constant in data section: %s", constant->klass()->signature_name()); |
33160 | 719 |
} |
720 |
} |
|
721 |
jint last_pc_offset = -1; |
|
722 |
for (int i = 0; i < sites->length(); i++) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
723 |
Handle site = sites->obj_at(i); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
724 |
if (site.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
725 |
THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
726 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
727 |
|
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
728 |
jint pc_offset = site_Site::pcOffset(site); |
33160 | 729 |
|
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
730 |
if (site->is_a(site_Call::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
731 |
TRACE_jvmci_4("call at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
732 |
site_Call(buffer, pc_offset, site, CHECK_OK); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
733 |
} else if (site->is_a(site_Infopoint::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
734 |
// three reasons for infopoints denote actual safepoints |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
735 |
oop reason = site_Infopoint::reason(site); |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
736 |
if (site_InfopointReason::SAFEPOINT() == reason || site_InfopointReason::CALL() == reason || site_InfopointReason::IMPLICIT_EXCEPTION() == reason) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
737 |
TRACE_jvmci_4("safepoint at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
738 |
site_Safepoint(buffer, pc_offset, site, CHECK_OK); |
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
739 |
if (_orig_pc_offset < 0) { |
35827 | 740 |
JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot"); |
35823
59a847ec6ee3
8146608: [JVMCI] DebugInfo Tests on DeoptimizeALot runs fails in assert(_pc == *pc_addr || pc == *pc_addr) frame::patch_pc() /frame_x86.cpp:285
rschatz
parents:
35582
diff
changeset
|
741 |
} |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
742 |
} else { |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
743 |
TRACE_jvmci_4("infopoint at %i", pc_offset); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
744 |
site_Infopoint(buffer, pc_offset, site, CHECK_OK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
745 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
746 |
} else if (site->is_a(site_DataPatch::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
747 |
TRACE_jvmci_4("datapatch at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
748 |
site_DataPatch(buffer, pc_offset, site, CHECK_OK); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
749 |
} else if (site->is_a(site_Mark::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
750 |
TRACE_jvmci_4("mark at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
751 |
site_Mark(buffer, pc_offset, site, CHECK_OK); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
752 |
} else if (site->is_a(site_ExceptionHandler::klass())) { |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
753 |
TRACE_jvmci_4("exceptionhandler at %i", pc_offset); |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
754 |
site_ExceptionHandler(pc_offset, site); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
755 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
756 |
JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name()); |
33160 | 757 |
} |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
758 |
last_pc_offset = pc_offset; |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
759 |
|
33160 | 760 |
if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) { |
761 |
// this is a hacky way to force a safepoint check but nothing else was jumping out at me. |
|
762 |
ThreadToNativeFromVM ttnfv(JavaThread::current()); |
|
763 |
} |
|
764 |
} |
|
765 |
||
766 |
#ifndef PRODUCT |
|
767 |
if (comments() != NULL) { |
|
768 |
for (int i = 0; i < comments()->length(); i++) { |
|
769 |
oop comment = comments()->obj_at(i); |
|
770 |
assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce"); |
|
771 |
jint offset = HotSpotCompiledCode_Comment::pcOffset(comment); |
|
772 |
char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment)); |
|
773 |
buffer.block_comment(offset, text); |
|
774 |
} |
|
775 |
} |
|
776 |
#endif |
|
777 |
return JVMCIEnv::ok; |
|
778 |
} |
|
779 |
||
780 |
void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) { |
|
781 |
Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption()); |
|
782 |
Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle)); |
|
783 |
_dependencies->assert_has_no_finalizable_subclasses(receiverType); |
|
784 |
} |
|
785 |
||
786 |
void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) { |
|
787 |
Handle context_handle = Assumptions_ConcreteSubtype::context(assumption()); |
|
788 |
Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption()); |
|
789 |
Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); |
|
790 |
Klass* subtype = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(subtype_handle)); |
|
791 |
||
792 |
assert(context->is_abstract(), ""); |
|
793 |
_dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype); |
|
794 |
} |
|
795 |
||
796 |
void CodeInstaller::assumption_LeafType(Handle assumption) { |
|
797 |
Handle context_handle = Assumptions_LeafType::context(assumption()); |
|
798 |
Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); |
|
799 |
||
800 |
_dependencies->assert_leaf_type(context); |
|
801 |
} |
|
802 |
||
803 |
void CodeInstaller::assumption_ConcreteMethod(Handle assumption) { |
|
804 |
Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption()); |
|
805 |
Handle context_handle = Assumptions_ConcreteMethod::context(assumption()); |
|
806 |
||
807 |
methodHandle impl = getMethodFromHotSpotMethod(impl_handle()); |
|
808 |
Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); |
|
809 |
||
810 |
_dependencies->assert_unique_concrete_method(context, impl()); |
|
811 |
} |
|
812 |
||
813 |
void CodeInstaller::assumption_CallSiteTargetValue(Handle assumption) { |
|
814 |
Handle callSite = Assumptions_CallSiteTargetValue::callSite(assumption()); |
|
815 |
Handle methodHandle = Assumptions_CallSiteTargetValue::methodHandle(assumption()); |
|
816 |
||
817 |
_dependencies->assert_call_site_target_value(callSite(), methodHandle()); |
|
818 |
} |
|
819 |
||
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
820 |
void CodeInstaller::site_ExceptionHandler(jint pc_offset, Handle exc) { |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
821 |
jint handler_offset = site_ExceptionHandler::handlerPos(exc); |
33160 | 822 |
|
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
823 |
// Subtable header |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
824 |
_exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); |
33160 | 825 |
|
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
826 |
// Subtable entry |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
827 |
_exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0)); |
33160 | 828 |
} |
829 |
||
830 |
// If deoptimization happens, the interpreter should reexecute these bytecodes. |
|
831 |
// This function mainly helps the compilers to set up the reexecute bit. |
|
832 |
static bool bytecode_should_reexecute(Bytecodes::Code code) { |
|
833 |
switch (code) { |
|
834 |
case Bytecodes::_invokedynamic: |
|
835 |
case Bytecodes::_invokevirtual: |
|
836 |
case Bytecodes::_invokeinterface: |
|
837 |
case Bytecodes::_invokespecial: |
|
838 |
case Bytecodes::_invokestatic: |
|
839 |
return false; |
|
840 |
default: |
|
841 |
return true; |
|
842 |
} |
|
843 |
return true; |
|
844 |
} |
|
845 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
846 |
GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(Handle debug_info, TRAPS) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
847 |
objArrayHandle virtualObjects = DebugInfo::virtualObjectMapping(debug_info); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
848 |
if (virtualObjects.is_null()) { |
33160 | 849 |
return NULL; |
850 |
} |
|
851 |
GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(virtualObjects->length(), virtualObjects->length(), NULL); |
|
852 |
// Create the unique ObjectValues |
|
853 |
for (int i = 0; i < virtualObjects->length(); i++) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
854 |
Handle value = virtualObjects->obj_at(i); |
33160 | 855 |
int id = VirtualObject::id(value); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
856 |
Handle type = VirtualObject::type(value); |
33160 | 857 |
oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); |
858 |
ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror))); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
859 |
if (id < 0 || id >= objects->length()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
860 |
JVMCI_ERROR_NULL("virtual object id %d out of bounds", id); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
861 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
862 |
if (objects->at(id) != NULL) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
863 |
JVMCI_ERROR_NULL("duplicate virtual object id %d", id); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
864 |
} |
33160 | 865 |
objects->at_put(id, sv); |
866 |
} |
|
867 |
// All the values which could be referenced by the VirtualObjects |
|
868 |
// exist, so now describe all the VirtualObjects themselves. |
|
869 |
for (int i = 0; i < virtualObjects->length(); i++) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
870 |
Handle value = virtualObjects->obj_at(i); |
33160 | 871 |
int id = VirtualObject::id(value); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
872 |
record_object_value(objects->at(id)->as_ObjectValue(), value, objects, CHECK_NULL); |
33160 | 873 |
} |
874 |
_debug_recorder->dump_object_pool(objects); |
|
875 |
return objects; |
|
876 |
} |
|
877 |
||
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
878 |
void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, ScopeMode scope_mode, TRAPS) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
879 |
Handle position = DebugInfo::bytecodePosition(debug_info); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
880 |
if (position.is_null()) { |
33160 | 881 |
// Stubs do not record scope info, just oop maps |
882 |
return; |
|
883 |
} |
|
884 |
||
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
885 |
GrowableArray<ScopeValue*>* objectMapping; |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
886 |
if (scope_mode == CodeInstaller::FullFrame) { |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
887 |
objectMapping = record_virtual_objects(debug_info, CHECK); |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
888 |
} else { |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
889 |
objectMapping = NULL; |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
890 |
} |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
891 |
record_scope(pc_offset, position, scope_mode, objectMapping, CHECK); |
33160 | 892 |
} |
893 |
||
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
894 |
void CodeInstaller::record_scope(jint pc_offset, Handle position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, TRAPS) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
895 |
Handle frame; |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
896 |
if (scope_mode == CodeInstaller::FullFrame) { |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
897 |
if (!position->is_a(BytecodeFrame::klass())) { |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
898 |
JVMCI_ERROR("Full frame expected for debug info at %i", pc_offset); |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
899 |
} |
33160 | 900 |
frame = position; |
901 |
} |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
902 |
Handle caller_frame = BytecodePosition::caller(position); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
903 |
if (caller_frame.not_null()) { |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
904 |
record_scope(pc_offset, caller_frame, scope_mode, objects, CHECK); |
33160 | 905 |
} |
906 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
907 |
Handle hotspot_method = BytecodePosition::method(position); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
908 |
Method* method = getMethodFromHotSpotMethod(hotspot_method()); |
33160 | 909 |
jint bci = BytecodePosition::bci(position); |
910 |
if (bci == BytecodeFrame::BEFORE_BCI()) { |
|
911 |
bci = SynchronizationEntryBCI; |
|
912 |
} |
|
913 |
||
914 |
TRACE_jvmci_2("Recording scope pc_offset=%d bci=%d method=%s", pc_offset, bci, method->name_and_sig_as_C_string()); |
|
915 |
||
916 |
bool reexecute = false; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
917 |
if (frame.not_null()) { |
33160 | 918 |
if (bci == SynchronizationEntryBCI){ |
919 |
reexecute = false; |
|
920 |
} else { |
|
921 |
Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci)); |
|
922 |
reexecute = bytecode_should_reexecute(code); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
923 |
if (frame.not_null()) { |
33160 | 924 |
reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE); |
925 |
} |
|
926 |
} |
|
927 |
} |
|
928 |
||
929 |
DebugToken* locals_token = NULL; |
|
930 |
DebugToken* expressions_token = NULL; |
|
931 |
DebugToken* monitors_token = NULL; |
|
932 |
bool throw_exception = false; |
|
933 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
934 |
if (frame.not_null()) { |
33160 | 935 |
jint local_count = BytecodeFrame::numLocals(frame); |
936 |
jint expression_count = BytecodeFrame::numStack(frame); |
|
937 |
jint monitor_count = BytecodeFrame::numLocks(frame); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
938 |
objArrayHandle values = BytecodeFrame::values(frame); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
939 |
objArrayHandle slotKinds = BytecodeFrame::slotKinds(frame); |
33160 | 940 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
941 |
if (values.is_null() || slotKinds.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
942 |
THROW(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
943 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
944 |
if (local_count + expression_count + monitor_count != values->length()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
945 |
JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", values->length(), local_count, expression_count, monitor_count); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
946 |
} |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
947 |
if (local_count + expression_count != slotKinds->length()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
948 |
JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", slotKinds->length(), local_count, expression_count); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
949 |
} |
33160 | 950 |
|
951 |
GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL; |
|
952 |
GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL; |
|
953 |
GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL; |
|
954 |
||
955 |
TRACE_jvmci_2("Scope at bci %d with %d values", bci, values->length()); |
|
956 |
TRACE_jvmci_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); |
|
957 |
||
958 |
for (jint i = 0; i < values->length(); i++) { |
|
959 |
ScopeValue* second = NULL; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
960 |
Handle value = values->obj_at(i); |
33160 | 961 |
if (i < local_count) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
962 |
BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
963 |
ScopeValue* first = get_scope_value(value, type, objects, second, CHECK); |
33160 | 964 |
if (second != NULL) { |
965 |
locals->append(second); |
|
966 |
} |
|
967 |
locals->append(first); |
|
968 |
} else if (i < local_count + expression_count) { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
969 |
BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
970 |
ScopeValue* first = get_scope_value(value, type, objects, second, CHECK); |
33160 | 971 |
if (second != NULL) { |
972 |
expressions->append(second); |
|
973 |
} |
|
974 |
expressions->append(first); |
|
975 |
} else { |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
976 |
MonitorValue *monitor = get_monitor_value(value, objects, CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
977 |
monitors->append(monitor); |
33160 | 978 |
} |
979 |
if (second != NULL) { |
|
980 |
i++; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
981 |
if (i >= values->length() || values->obj_at(i) != Value::ILLEGAL()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
982 |
JVMCI_ERROR("double-slot value not followed by Value.ILLEGAL"); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
983 |
} |
33160 | 984 |
} |
985 |
} |
|
986 |
||
987 |
locals_token = _debug_recorder->create_scope_values(locals); |
|
988 |
expressions_token = _debug_recorder->create_scope_values(expressions); |
|
989 |
monitors_token = _debug_recorder->create_monitor_values(monitors); |
|
990 |
||
991 |
throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE; |
|
992 |
} |
|
993 |
||
994 |
_debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, |
|
995 |
locals_token, expressions_token, monitors_token); |
|
996 |
} |
|
997 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
998 |
void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
999 |
Handle debug_info = site_Infopoint::debugInfo(site); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1000 |
if (debug_info.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1001 |
JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1002 |
} |
33160 | 1003 |
|
1004 |
// address instruction = _instructions->start() + pc_offset; |
|
1005 |
// jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1006 |
OopMap *map = create_oop_map(debug_info, CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1007 |
_debug_recorder->add_safepoint(pc_offset, map); |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1008 |
record_scope(pc_offset, debug_info, CodeInstaller::FullFrame, CHECK); |
33160 | 1009 |
_debug_recorder->end_safepoint(pc_offset); |
1010 |
} |
|
1011 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1012 |
void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1013 |
Handle debug_info = site_Infopoint::debugInfo(site); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1014 |
if (debug_info.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1015 |
JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1016 |
} |
33160 | 1017 |
|
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1018 |
// We'd like to check that pc_offset is greater than the |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1019 |
// last pc recorded with _debug_recorder (raising an exception if not) |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1020 |
// but DebugInformationRecorder doesn't have sufficient public API. |
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1021 |
|
33160 | 1022 |
_debug_recorder->add_non_safepoint(pc_offset); |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1023 |
record_scope(pc_offset, debug_info, CodeInstaller::BytecodePosition, CHECK); |
33160 | 1024 |
_debug_recorder->end_non_safepoint(pc_offset); |
1025 |
} |
|
1026 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1027 |
void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1028 |
Handle target = site_Call::target(site); |
33160 | 1029 |
InstanceKlass* target_klass = InstanceKlass::cast(target->klass()); |
1030 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1031 |
Handle hotspot_method; // JavaMethod |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1032 |
Handle foreign_call; |
33160 | 1033 |
|
1034 |
if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) { |
|
1035 |
foreign_call = target; |
|
1036 |
} else { |
|
1037 |
hotspot_method = target; |
|
1038 |
} |
|
1039 |
||
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1040 |
Handle debug_info = site_Call::debugInfo(site); |
33160 | 1041 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1042 |
assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type"); |
33160 | 1043 |
|
1044 |
NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1045 |
jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK); |
33160 | 1046 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1047 |
if (debug_info.not_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1048 |
OopMap *map = create_oop_map(debug_info, CHECK); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1049 |
_debug_recorder->add_safepoint(next_pc_offset, map); |
34502
1cfcb971cb17
8143730: [JVMCI] infopoint recording is too restrictive
dnsimon
parents:
34165
diff
changeset
|
1050 |
record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, CHECK); |
33160 | 1051 |
} |
1052 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1053 |
if (foreign_call.not_null()) { |
33160 | 1054 |
jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1055 |
CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK); |
33160 | 1056 |
} else { // method != NULL |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1057 |
if (debug_info.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1058 |
JVMCI_ERROR("debug info expected at call at %i", pc_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1059 |
} |
33160 | 1060 |
|
1061 |
TRACE_jvmci_3("method call"); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1062 |
CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK); |
33160 | 1063 |
if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) { |
1064 |
// Need a static call stub for transitions from compiled to interpreted. |
|
1065 |
CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset); |
|
1066 |
} |
|
1067 |
} |
|
1068 |
||
1069 |
_next_call_type = INVOKE_INVALID; |
|
1070 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1071 |
if (debug_info.not_null()) { |
33160 | 1072 |
_debug_recorder->end_safepoint(next_pc_offset); |
1073 |
} |
|
1074 |
} |
|
1075 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1076 |
void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1077 |
Handle reference = site_DataPatch::reference(site); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1078 |
if (reference.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1079 |
THROW(vmSymbols::java_lang_NullPointerException()); |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1080 |
} else if (reference->is_a(site_ConstantReference::klass())) { |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1081 |
Handle constant = site_ConstantReference::constant(reference); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1082 |
if (constant.is_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1083 |
THROW(vmSymbols::java_lang_NullPointerException()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1084 |
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1085 |
pd_patch_OopConstant(pc_offset, constant, CHECK); |
33160 | 1086 |
} else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1087 |
pd_patch_MetaspaceConstant(pc_offset, constant, CHECK); |
33160 | 1088 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1089 |
JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name()); |
33160 | 1090 |
} |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1091 |
} else if (reference->is_a(site_DataSectionReference::klass())) { |
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1092 |
int data_offset = site_DataSectionReference::offset(reference); |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1093 |
if (0 <= data_offset && data_offset < _constants_size) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1094 |
pd_patch_DataSectionReference(pc_offset, data_offset); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1095 |
} else { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1096 |
JVMCI_ERROR("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1097 |
} |
33160 | 1098 |
} else { |
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1099 |
JVMCI_ERROR("unknown data patch type: %s", reference->klass()->signature_name()); |
33160 | 1100 |
} |
1101 |
} |
|
1102 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1103 |
void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
35582
c32a0cc19877
8147599: [JVMCI] simplify code installation interface
rschatz
parents:
34502
diff
changeset
|
1104 |
Handle id_obj = site_Mark::id(site); |
33160 | 1105 |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1106 |
if (id_obj.not_null()) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1107 |
if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) { |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1108 |
JVMCI_ERROR("expected Integer id, got %s", id_obj->klass()->signature_name()); |
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1109 |
} |
33160 | 1110 |
jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); |
1111 |
||
1112 |
address pc = _instructions->start() + pc_offset; |
|
1113 |
||
1114 |
switch (id) { |
|
1115 |
case UNVERIFIED_ENTRY: |
|
1116 |
_offsets.set_value(CodeOffsets::Entry, pc_offset); |
|
1117 |
break; |
|
1118 |
case VERIFIED_ENTRY: |
|
1119 |
_offsets.set_value(CodeOffsets::Verified_Entry, pc_offset); |
|
1120 |
break; |
|
1121 |
case OSR_ENTRY: |
|
1122 |
_offsets.set_value(CodeOffsets::OSR_Entry, pc_offset); |
|
1123 |
break; |
|
1124 |
case EXCEPTION_HANDLER_ENTRY: |
|
1125 |
_offsets.set_value(CodeOffsets::Exceptions, pc_offset); |
|
1126 |
break; |
|
1127 |
case DEOPT_HANDLER_ENTRY: |
|
1128 |
_offsets.set_value(CodeOffsets::Deopt, pc_offset); |
|
1129 |
break; |
|
1130 |
case INVOKEVIRTUAL: |
|
1131 |
case INVOKEINTERFACE: |
|
1132 |
case INLINE_INVOKE: |
|
1133 |
case INVOKESTATIC: |
|
1134 |
case INVOKESPECIAL: |
|
1135 |
_next_call_type = (MarkId) id; |
|
1136 |
_invoke_mark_pc = pc; |
|
1137 |
break; |
|
1138 |
case POLL_NEAR: |
|
1139 |
case POLL_FAR: |
|
1140 |
case POLL_RETURN_NEAR: |
|
1141 |
case POLL_RETURN_FAR: |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1142 |
pd_relocate_poll(pc, id, CHECK); |
33160 | 1143 |
break; |
33632 | 1144 |
case CARD_TABLE_SHIFT: |
33160 | 1145 |
case CARD_TABLE_ADDRESS: |
1146 |
case HEAP_TOP_ADDRESS: |
|
1147 |
case HEAP_END_ADDRESS: |
|
1148 |
case NARROW_KLASS_BASE_ADDRESS: |
|
1149 |
case CRC_TABLE_ADDRESS: |
|
1150 |
break; |
|
1151 |
default: |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1152 |
JVMCI_ERROR("invalid mark id: %d", id); |
33160 | 1153 |
break; |
1154 |
} |
|
1155 |
} |
|
1156 |
} |
|
1157 |