Mercurial > hg > graal-jvmci-8
comparison src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 22721:510846133438
8139589: [JVMCI] Using fthrow when throwing JVMCIError.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 03 Nov 2015 16:55:51 +0100 |
parents | 3c0753fbb592 |
children | 0229a2ca608b |
comparison
equal
deleted
inserted
replaced
22720:48fde4d03767 | 22721:510846133438 |
---|---|
78 jint number = code_Register::number(reg); | 78 jint number = code_Register::number(reg); |
79 VMReg vmReg = CodeInstaller::get_hotspot_reg(number, CHECK_NULL); | 79 VMReg vmReg = CodeInstaller::get_hotspot_reg(number, CHECK_NULL); |
80 if (offset % 4 == 0) { | 80 if (offset % 4 == 0) { |
81 return vmReg->next(offset / 4); | 81 return vmReg->next(offset / 4); |
82 } else { | 82 } else { |
83 JVMCI_ERROR_NULL(err_msg("unaligned subregister offset %d in oop map", offset)); | 83 JVMCI_ERROR_NULL("unaligned subregister offset %d in oop map", offset); |
84 } | 84 } |
85 } else { | 85 } else { |
86 // stack slot | 86 // stack slot |
87 if (offset % 4 == 0) { | 87 if (offset % 4 == 0) { |
88 return VMRegImpl::stack2reg(offset / 4); | 88 return VMRegImpl::stack2reg(offset / 4); |
89 } else { | 89 } else { |
90 JVMCI_ERROR_NULL(err_msg("unaligned stack offset %d in oop map", offset)); | 90 JVMCI_ERROR_NULL("unaligned stack offset %d in oop map", offset); |
91 } | 91 } |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo | 95 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo |
116 if (bytes == 4) { | 116 if (bytes == 4) { |
117 #endif | 117 #endif |
118 VMReg baseReg = getVMRegFromLocation(baseLocation, _total_frame_size, CHECK_NULL); | 118 VMReg baseReg = getVMRegFromLocation(baseLocation, _total_frame_size, CHECK_NULL); |
119 map->set_derived_oop(vmReg, baseReg); | 119 map->set_derived_oop(vmReg, baseReg); |
120 } else { | 120 } else { |
121 JVMCI_ERROR_NULL(err_msg("invalid derived oop size in ReferenceMap: %d", bytes)); | 121 JVMCI_ERROR_NULL("invalid derived oop size in ReferenceMap: %d", bytes); |
122 } | 122 } |
123 #ifdef _LP64 | 123 #ifdef _LP64 |
124 } else if (bytes == 8) { | 124 } else if (bytes == 8) { |
125 // wide oop | 125 // wide oop |
126 map->set_oop(vmReg); | 126 map->set_oop(vmReg); |
130 #else | 130 #else |
131 } else if (bytes == 4) { | 131 } else if (bytes == 4) { |
132 map->set_oop(vmReg); | 132 map->set_oop(vmReg); |
133 #endif | 133 #endif |
134 } else { | 134 } else { |
135 JVMCI_ERROR_NULL(err_msg("invalid oop size in ReferenceMap: %d", bytes)); | 135 JVMCI_ERROR_NULL("invalid oop size in ReferenceMap: %d", bytes); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 Handle callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info); | 139 Handle callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info); |
140 if (callee_save_info.not_null()) { | 140 if (callee_save_info.not_null()) { |
172 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method))); | 172 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method))); |
173 int index = _oop_recorder->find_index(method); | 173 int index = _oop_recorder->find_index(method); |
174 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string()); | 174 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string()); |
175 return method; | 175 return method; |
176 } else { | 176 } else { |
177 JVMCI_ERROR_NULL(err_msg("unexpected metadata reference for constant of type %s", obj->klass()->signature_name())); | 177 JVMCI_ERROR_NULL("unexpected metadata reference for constant of type %s", obj->klass()->signature_name()); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 #ifdef _LP64 | 181 #ifdef _LP64 |
182 narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRAPS) { | 182 narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRAPS) { |
183 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); | 183 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); |
184 assert(HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected uncompressed pointer")); | 184 assert(HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected uncompressed pointer")); |
185 | 185 |
186 if (!obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { | 186 if (!obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { |
187 JVMCI_ERROR_0(err_msg("unexpected compressed pointer of type %s", obj->klass()->signature_name())); | 187 JVMCI_ERROR_0("unexpected compressed pointer of type %s", obj->klass()->signature_name()); |
188 } | 188 } |
189 | 189 |
190 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); | 190 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); |
191 int index = _oop_recorder->find_index(klass); | 191 int index = _oop_recorder->find_index(klass); |
192 TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); | 192 TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); |
208 | 208 |
209 ScopeValue* CodeInstaller::get_scope_value(Handle value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, TRAPS) { | 209 ScopeValue* CodeInstaller::get_scope_value(Handle value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, TRAPS) { |
210 second = NULL; | 210 second = NULL; |
211 if (value == Value::ILLEGAL()) { | 211 if (value == Value::ILLEGAL()) { |
212 if (type != T_ILLEGAL) { | 212 if (type != T_ILLEGAL) { |
213 JVMCI_ERROR_NULL(err_msg("unexpected illegal value, expected %s", basictype_to_str(type))); | 213 JVMCI_ERROR_NULL("unexpected illegal value, expected %s", basictype_to_str(type)); |
214 } | 214 } |
215 return _illegal_value; | 215 return _illegal_value; |
216 } else if (value->is_a(RegisterValue::klass())) { | 216 } else if (value->is_a(RegisterValue::klass())) { |
217 Handle reg = RegisterValue::reg(value); | 217 Handle reg = RegisterValue::reg(value); |
218 jint number = code_Register::number(reg); | 218 jint number = code_Register::number(reg); |
224 } else if (type == T_LONG) { | 224 } else if (type == T_LONG) { |
225 locationType = Location::lng; | 225 locationType = Location::lng; |
226 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { | 226 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { |
227 locationType = Location::int_in_long; | 227 locationType = Location::int_in_long; |
228 } else { | 228 } else { |
229 JVMCI_ERROR_NULL(err_msg("unexpected type %s in cpu register", basictype_to_str(type))); | 229 JVMCI_ERROR_NULL("unexpected type %s in cpu register", basictype_to_str(type)); |
230 } | 230 } |
231 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); | 231 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); |
232 if (type == T_LONG) { | 232 if (type == T_LONG) { |
233 second = value; | 233 second = value; |
234 } | 234 } |
239 // this seems weird, but the same value is used in c1_LinearScan | 239 // this seems weird, but the same value is used in c1_LinearScan |
240 locationType = Location::normal; | 240 locationType = Location::normal; |
241 } else if (type == T_DOUBLE) { | 241 } else if (type == T_DOUBLE) { |
242 locationType = Location::dbl; | 242 locationType = Location::dbl; |
243 } else { | 243 } else { |
244 JVMCI_ERROR_NULL(err_msg("unexpected type %s in floating point register", basictype_to_str(type))); | 244 JVMCI_ERROR_NULL("unexpected type %s in floating point register", basictype_to_str(type)); |
245 } | 245 } |
246 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); | 246 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); |
247 if (type == T_DOUBLE) { | 247 if (type == T_DOUBLE) { |
248 second = value; | 248 second = value; |
249 } | 249 } |
263 } else if (type == T_DOUBLE) { | 263 } else if (type == T_DOUBLE) { |
264 locationType = Location::dbl; | 264 locationType = Location::dbl; |
265 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { | 265 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { |
266 locationType = Location::normal; | 266 locationType = Location::normal; |
267 } else { | 267 } else { |
268 JVMCI_ERROR_NULL(err_msg("unexpected type %s in stack slot", basictype_to_str(type))); | 268 JVMCI_ERROR_NULL("unexpected type %s in stack slot", basictype_to_str(type)); |
269 } | 269 } |
270 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); | 270 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); |
271 if (type == T_DOUBLE || type == T_LONG) { | 271 if (type == T_DOUBLE || type == T_LONG) { |
272 second = value; | 272 second = value; |
273 } | 273 } |
278 jlong prim = PrimitiveConstant::primitive(value); | 278 jlong prim = PrimitiveConstant::primitive(value); |
279 return new ConstantLongValue(prim); | 279 return new ConstantLongValue(prim); |
280 } else { | 280 } else { |
281 BasicType constantType = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(PrimitiveConstant::kind(value))); | 281 BasicType constantType = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(PrimitiveConstant::kind(value))); |
282 if (type != constantType) { | 282 if (type != constantType) { |
283 JVMCI_ERROR_NULL(err_msg("primitive constant type doesn't match, expected %s but got %s", basictype_to_str(type), basictype_to_str(constantType))); | 283 JVMCI_ERROR_NULL("primitive constant type doesn't match, expected %s but got %s", basictype_to_str(type), basictype_to_str(constantType)); |
284 } | 284 } |
285 if (type == T_INT || type == T_FLOAT) { | 285 if (type == T_INT || type == T_FLOAT) { |
286 jint prim = (jint)PrimitiveConstant::primitive(value); | 286 jint prim = (jint)PrimitiveConstant::primitive(value); |
287 switch (prim) { | 287 switch (prim) { |
288 case -1: return _int_m1_scope_value; | 288 case -1: return _int_m1_scope_value; |
294 } else if (type == T_LONG || type == T_DOUBLE) { | 294 } else if (type == T_LONG || type == T_DOUBLE) { |
295 jlong prim = PrimitiveConstant::primitive(value); | 295 jlong prim = PrimitiveConstant::primitive(value); |
296 second = _int_1_scope_value; | 296 second = _int_1_scope_value; |
297 return new ConstantLongValue(prim); | 297 return new ConstantLongValue(prim); |
298 } else { | 298 } else { |
299 JVMCI_ERROR_NULL(err_msg("unexpected primitive constant type %s", basictype_to_str(type))); | 299 JVMCI_ERROR_NULL("unexpected primitive constant type %s", basictype_to_str(type)); |
300 } | 300 } |
301 } | 301 } |
302 } else if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) { | 302 } else if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) { |
303 if (type == T_OBJECT) { | 303 if (type == T_OBJECT) { |
304 return _oop_null_scope_value; | 304 return _oop_null_scope_value; |
305 } else { | 305 } else { |
306 JVMCI_ERROR_NULL(err_msg("unexpected null constant, expected %s", basictype_to_str(type))); | 306 JVMCI_ERROR_NULL("unexpected null constant, expected %s", basictype_to_str(type)); |
307 } | 307 } |
308 } else if (value->is_a(HotSpotObjectConstantImpl::klass())) { | 308 } else if (value->is_a(HotSpotObjectConstantImpl::klass())) { |
309 if (type == T_OBJECT) { | 309 if (type == T_OBJECT) { |
310 oop obj = HotSpotObjectConstantImpl::object(value); | 310 oop obj = HotSpotObjectConstantImpl::object(value); |
311 if (obj == NULL) { | 311 if (obj == NULL) { |
312 JVMCI_ERROR_NULL("null value must be in NullConstant"); | 312 JVMCI_ERROR_NULL("null value must be in NullConstant"); |
313 } | 313 } |
314 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); | 314 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); |
315 } else { | 315 } else { |
316 JVMCI_ERROR_NULL(err_msg("unexpected object constant, expected %s", basictype_to_str(type))); | 316 JVMCI_ERROR_NULL("unexpected object constant, expected %s", basictype_to_str(type)); |
317 } | 317 } |
318 } | 318 } |
319 } else if (value->is_a(VirtualObject::klass())) { | 319 } else if (value->is_a(VirtualObject::klass())) { |
320 if (type == T_OBJECT) { | 320 if (type == T_OBJECT) { |
321 int id = VirtualObject::id(value); | 321 int id = VirtualObject::id(value); |
323 ScopeValue* object = objects->at(id); | 323 ScopeValue* object = objects->at(id); |
324 if (object != NULL) { | 324 if (object != NULL) { |
325 return object; | 325 return object; |
326 } | 326 } |
327 } | 327 } |
328 JVMCI_ERROR_NULL(err_msg("unknown virtual object id %d", id)); | 328 JVMCI_ERROR_NULL("unknown virtual object id %d", id); |
329 } else { | 329 } else { |
330 JVMCI_ERROR_NULL(err_msg("unexpected virtual object, expected %s", basictype_to_str(type))); | 330 JVMCI_ERROR_NULL("unexpected virtual object, expected %s", basictype_to_str(type)); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 JVMCI_ERROR_NULL(err_msg("unexpected value in scope: %s", value->klass()->signature_name())) | 334 JVMCI_ERROR_NULL("unexpected value in scope: %s", value->klass()->signature_name()) |
335 } | 335 } |
336 | 336 |
337 void CodeInstaller::record_object_value(ObjectValue* sv, Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { | 337 void CodeInstaller::record_object_value(ObjectValue* sv, Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { |
338 Handle type = VirtualObject::type(value); | 338 Handle type = VirtualObject::type(value); |
339 int id = VirtualObject::id(value); | 339 int id = VirtualObject::id(value); |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 MonitorValue* CodeInstaller::get_monitor_value(Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { | 366 MonitorValue* CodeInstaller::get_monitor_value(Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) { |
367 if (!value->is_a(StackLockValue::klass())) { | 367 if (!value->is_a(StackLockValue::klass())) { |
368 JVMCI_ERROR_NULL(err_msg("Monitors must be of type StackLockValue, got %s", value->klass()->signature_name())); | 368 JVMCI_ERROR_NULL("Monitors must be of type StackLockValue, got %s", value->klass()->signature_name()); |
369 } | 369 } |
370 | 370 |
371 ScopeValue* second = NULL; | 371 ScopeValue* second = NULL; |
372 ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second, CHECK_NULL); | 372 ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second, CHECK_NULL); |
373 assert(second == NULL, "monitor cannot occupy two stack slots"); | 373 assert(second == NULL, "monitor cannot occupy two stack slots"); |
405 } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) { | 405 } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) { |
406 assumption_ConcreteMethod(assumption); | 406 assumption_ConcreteMethod(assumption); |
407 } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) { | 407 } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) { |
408 assumption_CallSiteTargetValue(assumption); | 408 assumption_CallSiteTargetValue(assumption); |
409 } else { | 409 } else { |
410 JVMCI_ERROR(err_msg("unexpected Assumption subclass %s", assumption->klass()->signature_name())); | 410 JVMCI_ERROR("unexpected Assumption subclass %s", assumption->klass()->signature_name()); |
411 } | 411 } |
412 } | 412 } |
413 } | 413 } |
414 } | 414 } |
415 if (JvmtiExport::can_hotswap_or_post_breakpoint()) { | 415 if (JvmtiExport::can_hotswap_or_post_breakpoint()) { |
499 _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code); | 499 _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code); |
500 | 500 |
501 // Pre-calculate the constants section size. This is required for PC-relative addressing. | 501 // Pre-calculate the constants section size. This is required for PC-relative addressing. |
502 _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code)); | 502 _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code)); |
503 if ((_constants->alignment() % HotSpotCompiledCode::dataSectionAlignment(compiled_code)) != 0) { | 503 if ((_constants->alignment() % HotSpotCompiledCode::dataSectionAlignment(compiled_code)) != 0) { |
504 JVMCI_ERROR(err_msg("invalid data section alignment: %d", HotSpotCompiledCode::dataSectionAlignment(compiled_code))); | 504 JVMCI_ERROR("invalid data section alignment: %d", HotSpotCompiledCode::dataSectionAlignment(compiled_code)); |
505 } | 505 } |
506 _constants_size = data_section()->length(); | 506 _constants_size = data_section()->length(); |
507 | 507 |
508 _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code)); | 508 _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code)); |
509 | 509 |
527 oop site = sites->obj_at(i); | 527 oop site = sites->obj_at(i); |
528 if (site->is_a(CompilationResult_Mark::klass())) { | 528 if (site->is_a(CompilationResult_Mark::klass())) { |
529 oop id_obj = CompilationResult_Mark::id(site); | 529 oop id_obj = CompilationResult_Mark::id(site); |
530 if (id_obj != NULL) { | 530 if (id_obj != NULL) { |
531 if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) { | 531 if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) { |
532 JVMCI_ERROR_0(err_msg("expected Integer id, got %s", id_obj->klass()->signature_name())); | 532 JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name()); |
533 } | 533 } |
534 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); | 534 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); |
535 if (id == INVOKESTATIC || id == INVOKESPECIAL) { | 535 if (id == INVOKESTATIC || id == INVOKESPECIAL) { |
536 static_call_stubs++; | 536 static_call_stubs++; |
537 } | 537 } |
583 | 583 |
584 for (int i = 0; i < data_section_patches()->length(); i++) { | 584 for (int i = 0; i < data_section_patches()->length(); i++) { |
585 Handle patch = data_section_patches()->obj_at(i); | 585 Handle patch = data_section_patches()->obj_at(i); |
586 Handle reference = CompilationResult_DataPatch::reference(patch); | 586 Handle reference = CompilationResult_DataPatch::reference(patch); |
587 if (!reference->is_a(CompilationResult_ConstantReference::klass())) { | 587 if (!reference->is_a(CompilationResult_ConstantReference::klass())) { |
588 JVMCI_ERROR_OK(err_msg("invalid patch in data section: %s", reference->klass()->signature_name())); | 588 JVMCI_ERROR_OK("invalid patch in data section: %s", reference->klass()->signature_name()); |
589 } | 589 } |
590 Handle constant = CompilationResult_ConstantReference::constant(reference); | 590 Handle constant = CompilationResult_ConstantReference::constant(reference); |
591 address dest = _constants->start() + CompilationResult_Site::pcOffset(patch); | 591 address dest = _constants->start() + CompilationResult_Site::pcOffset(patch); |
592 if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { | 592 if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { |
593 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { | 593 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { |
612 #endif | 612 #endif |
613 } else { | 613 } else { |
614 _constants->relocate(dest, oop_Relocation::spec(oop_index)); | 614 _constants->relocate(dest, oop_Relocation::spec(oop_index)); |
615 } | 615 } |
616 } else { | 616 } else { |
617 JVMCI_ERROR_OK(err_msg("invalid constant in data section: %s", constant->klass()->signature_name())); | 617 JVMCI_ERROR_OK("invalid constant in data section: %s", constant->klass()->signature_name()); |
618 } | 618 } |
619 } | 619 } |
620 jint last_pc_offset = -1; | 620 jint last_pc_offset = -1; |
621 for (int i = 0; i < sites->length(); i++) { | 621 for (int i = 0; i < sites->length(); i++) { |
622 Handle site = sites->obj_at(i); | 622 Handle site = sites->obj_at(i); |
632 TRACE_jvmci_4("safepoint at %i", pc_offset); | 632 TRACE_jvmci_4("safepoint at %i", pc_offset); |
633 site_Safepoint(buffer, pc_offset, site, CHECK_OK); | 633 site_Safepoint(buffer, pc_offset, site, CHECK_OK); |
634 } else if (InfopointReason::METHOD_START() == reason || InfopointReason::METHOD_END() == reason || InfopointReason::LINE_NUMBER() == reason) { | 634 } else if (InfopointReason::METHOD_START() == reason || InfopointReason::METHOD_END() == reason || InfopointReason::LINE_NUMBER() == reason) { |
635 site_Infopoint(buffer, pc_offset, site, CHECK_OK); | 635 site_Infopoint(buffer, pc_offset, site, CHECK_OK); |
636 } else { | 636 } else { |
637 JVMCI_ERROR_OK(err_msg("unknown infopoint reason at %i", pc_offset)); | 637 JVMCI_ERROR_OK("unknown infopoint reason at %i", pc_offset); |
638 } | 638 } |
639 } else if (site->is_a(CompilationResult_DataPatch::klass())) { | 639 } else if (site->is_a(CompilationResult_DataPatch::klass())) { |
640 TRACE_jvmci_4("datapatch at %i", pc_offset); | 640 TRACE_jvmci_4("datapatch at %i", pc_offset); |
641 site_DataPatch(buffer, pc_offset, site, CHECK_OK); | 641 site_DataPatch(buffer, pc_offset, site, CHECK_OK); |
642 } else if (site->is_a(CompilationResult_Mark::klass())) { | 642 } else if (site->is_a(CompilationResult_Mark::klass())) { |
643 TRACE_jvmci_4("mark at %i", pc_offset); | 643 TRACE_jvmci_4("mark at %i", pc_offset); |
644 site_Mark(buffer, pc_offset, site, CHECK_OK); | 644 site_Mark(buffer, pc_offset, site, CHECK_OK); |
645 } else { | 645 } else { |
646 JVMCI_ERROR_OK(err_msg("unexpected site subclass: %s", site->klass()->signature_name())); | 646 JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name()); |
647 } | 647 } |
648 last_pc_offset = pc_offset; | 648 last_pc_offset = pc_offset; |
649 | 649 |
650 if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) { | 650 if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) { |
651 // this is a hacky way to force a safepoint check but nothing else was jumping out at me. | 651 // this is a hacky way to force a safepoint check but nothing else was jumping out at me. |
752 int id = VirtualObject::id(value); | 752 int id = VirtualObject::id(value); |
753 Handle type = VirtualObject::type(value); | 753 Handle type = VirtualObject::type(value); |
754 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); | 754 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); |
755 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror))); | 755 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror))); |
756 if (id < 0 || id >= objects->length()) { | 756 if (id < 0 || id >= objects->length()) { |
757 JVMCI_ERROR_NULL(err_msg("virtual object id %d out of bounds", id)); | 757 JVMCI_ERROR_NULL("virtual object id %d out of bounds", id); |
758 } | 758 } |
759 if (objects->at(id) != NULL) { | 759 if (objects->at(id) != NULL) { |
760 JVMCI_ERROR_NULL(err_msg("duplicate virtual object id %d", id)); | 760 JVMCI_ERROR_NULL("duplicate virtual object id %d", id); |
761 } | 761 } |
762 objects->at_put(id, sv); | 762 objects->at_put(id, sv); |
763 } | 763 } |
764 // All the values which could be referenced by the VirtualObjects | 764 // All the values which could be referenced by the VirtualObjects |
765 // exist, so now describe all the VirtualObjects themselves. | 765 // exist, so now describe all the VirtualObjects themselves. |
826 jint monitor_count = BytecodeFrame::numLocks(frame); | 826 jint monitor_count = BytecodeFrame::numLocks(frame); |
827 objArrayHandle values = BytecodeFrame::values(frame); | 827 objArrayHandle values = BytecodeFrame::values(frame); |
828 objArrayHandle slotKinds = BytecodeFrame::slotKinds(frame); | 828 objArrayHandle slotKinds = BytecodeFrame::slotKinds(frame); |
829 | 829 |
830 if (local_count + expression_count + monitor_count != values->length()) { | 830 if (local_count + expression_count + monitor_count != values->length()) { |
831 JVMCI_ERROR(err_msg("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", values->length(), local_count, expression_count, monitor_count)); | 831 JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", values->length(), local_count, expression_count, monitor_count); |
832 } | 832 } |
833 if (local_count + expression_count != slotKinds->length()) { | 833 if (local_count + expression_count != slotKinds->length()) { |
834 JVMCI_ERROR(err_msg("unexpected slotKinds length %d in scope (%d locals, %d expressions)", slotKinds->length(), local_count, expression_count)); | 834 JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", slotKinds->length(), local_count, expression_count); |
835 } | 835 } |
836 | 836 |
837 GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL; | 837 GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL; |
838 GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL; | 838 GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL; |
839 GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL; | 839 GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL; |
882 } | 882 } |
883 | 883 |
884 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { | 884 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
885 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); | 885 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); |
886 if (debug_info.is_null()) { | 886 if (debug_info.is_null()) { |
887 JVMCI_ERROR(err_msg("debug info expected at safepoint at %i", pc_offset)); | 887 JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset); |
888 } | 888 } |
889 | 889 |
890 // address instruction = _instructions->start() + pc_offset; | 890 // address instruction = _instructions->start() + pc_offset; |
891 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); | 891 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); |
892 OopMap *map = create_oop_map(debug_info, CHECK); | 892 OopMap *map = create_oop_map(debug_info, CHECK); |
896 } | 896 } |
897 | 897 |
898 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { | 898 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
899 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); | 899 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); |
900 if (debug_info.is_null()) { | 900 if (debug_info.is_null()) { |
901 JVMCI_ERROR(err_msg("debug info expected at infopoint at %i", pc_offset)); | 901 JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset); |
902 } | 902 } |
903 | 903 |
904 _debug_recorder->add_non_safepoint(pc_offset); | 904 _debug_recorder->add_non_safepoint(pc_offset); |
905 record_scope(pc_offset, debug_info, CHECK); | 905 record_scope(pc_offset, debug_info, CHECK); |
906 _debug_recorder->end_non_safepoint(pc_offset); | 906 _debug_recorder->end_non_safepoint(pc_offset); |
935 if (foreign_call.not_null()) { | 935 if (foreign_call.not_null()) { |
936 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); | 936 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); |
937 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK); | 937 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK); |
938 } else { // method != NULL | 938 } else { // method != NULL |
939 if (debug_info.is_null()) { | 939 if (debug_info.is_null()) { |
940 JVMCI_ERROR(err_msg("debug info expected at call at %i", pc_offset)); | 940 JVMCI_ERROR("debug info expected at call at %i", pc_offset); |
941 } | 941 } |
942 | 942 |
943 TRACE_jvmci_3("method call"); | 943 TRACE_jvmci_3("method call"); |
944 CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK); | 944 CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK); |
945 if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) { | 945 if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) { |
962 if (constant->is_a(HotSpotObjectConstantImpl::klass())) { | 962 if (constant->is_a(HotSpotObjectConstantImpl::klass())) { |
963 pd_patch_OopConstant(pc_offset, constant, CHECK); | 963 pd_patch_OopConstant(pc_offset, constant, CHECK); |
964 } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { | 964 } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { |
965 pd_patch_MetaspaceConstant(pc_offset, constant, CHECK); | 965 pd_patch_MetaspaceConstant(pc_offset, constant, CHECK); |
966 } else { | 966 } else { |
967 JVMCI_ERROR(err_msg("unknown constant type in data patch: %s", constant->klass()->signature_name())); | 967 JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name()); |
968 } | 968 } |
969 } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) { | 969 } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) { |
970 int data_offset = CompilationResult_DataSectionReference::offset(reference); | 970 int data_offset = CompilationResult_DataSectionReference::offset(reference); |
971 if (0 <= data_offset && data_offset < _constants_size) { | 971 if (0 <= data_offset && data_offset < _constants_size) { |
972 pd_patch_DataSectionReference(pc_offset, data_offset); | 972 pd_patch_DataSectionReference(pc_offset, data_offset); |
973 } else { | 973 } else { |
974 JVMCI_ERROR(err_msg("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size)); | 974 JVMCI_ERROR("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size); |
975 } | 975 } |
976 } else { | 976 } else { |
977 JVMCI_ERROR(err_msg("unknown data patch type: %s", reference->klass()->signature_name())); | 977 JVMCI_ERROR("unknown data patch type: %s", reference->klass()->signature_name()); |
978 } | 978 } |
979 } | 979 } |
980 | 980 |
981 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { | 981 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
982 Handle id_obj = CompilationResult_Mark::id(site); | 982 Handle id_obj = CompilationResult_Mark::id(site); |
983 | 983 |
984 if (id_obj.not_null()) { | 984 if (id_obj.not_null()) { |
985 if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) { | 985 if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) { |
986 JVMCI_ERROR(err_msg("expected Integer id, got %s", id_obj->klass()->signature_name())); | 986 JVMCI_ERROR("expected Integer id, got %s", id_obj->klass()->signature_name()); |
987 } | 987 } |
988 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); | 988 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); |
989 | 989 |
990 address pc = _instructions->start() + pc_offset; | 990 address pc = _instructions->start() + pc_offset; |
991 | 991 |
1021 break; | 1021 break; |
1022 case CARD_TABLE_SHIFT: | 1022 case CARD_TABLE_SHIFT: |
1023 case CARD_TABLE_ADDRESS: | 1023 case CARD_TABLE_ADDRESS: |
1024 break; | 1024 break; |
1025 default: | 1025 default: |
1026 JVMCI_ERROR(err_msg("invalid mark id: %d", id)); | 1026 JVMCI_ERROR("invalid mark id: %d", id); |
1027 break; | 1027 break; |
1028 } | 1028 } |
1029 } | 1029 } |
1030 } | 1030 } |
1031 | 1031 |