508 } |
508 } |
509 } |
509 } |
510 |
510 |
511 #if INCLUDE_AOT |
511 #if INCLUDE_AOT |
512 RelocBuffer::~RelocBuffer() { |
512 RelocBuffer::~RelocBuffer() { |
513 if (_buffer != NULL) { |
513 FREE_C_HEAP_ARRAY(char, _buffer); |
514 FREE_C_HEAP_ARRAY(char, _buffer); |
|
515 } |
|
516 } |
514 } |
517 |
515 |
518 address RelocBuffer::begin() const { |
516 address RelocBuffer::begin() const { |
519 if (_buffer != NULL) { |
517 if (_buffer != NULL) { |
520 return (address) _buffer; |
518 return (address) _buffer; |
560 assert(_debug_recorder->pcs_length() >= 2, "must be at least 2"); |
558 assert(_debug_recorder->pcs_length() >= 2, "must be at least 2"); |
561 |
559 |
562 metadata.set_pc_desc(_debug_recorder->pcs(), _debug_recorder->pcs_length()); |
560 metadata.set_pc_desc(_debug_recorder->pcs(), _debug_recorder->pcs_length()); |
563 metadata.set_scopes(_debug_recorder->stream()->buffer(), _debug_recorder->data_size()); |
561 metadata.set_scopes(_debug_recorder->stream()->buffer(), _debug_recorder->data_size()); |
564 metadata.set_exception_table(&_exception_handler_table); |
562 metadata.set_exception_table(&_exception_handler_table); |
|
563 metadata.set_implicit_exception_table(&_implicit_exception_table); |
565 |
564 |
566 RelocBuffer* reloc_buffer = metadata.get_reloc_buffer(); |
565 RelocBuffer* reloc_buffer = metadata.get_reloc_buffer(); |
567 |
566 |
568 reloc_buffer->ensure_size(buffer.total_relocation_size()); |
567 reloc_buffer->ensure_size(buffer.total_relocation_size()); |
569 size_t size = (size_t) buffer.copy_relocations_to(reloc_buffer->begin(), (CodeBuffer::csize_t) reloc_buffer->size(), true); |
568 size_t size = (size_t) buffer.copy_relocations_to(reloc_buffer->begin(), (CodeBuffer::csize_t) reloc_buffer->size(), true); |
635 } |
634 } |
636 |
635 |
637 JVMCIObject mirror = installed_code; |
636 JVMCIObject mirror = installed_code; |
638 nmethod* nm = NULL; |
637 nmethod* nm = NULL; |
639 result = runtime()->register_method(jvmci_env(), method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer, |
638 result = runtime()->register_method(jvmci_env(), method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer, |
640 stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
639 stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, &_implicit_exception_table, |
641 compiler, _debug_recorder, _dependencies, id, |
640 compiler, _debug_recorder, _dependencies, id, |
642 has_unsafe_access, _has_wide_vector, compiled_code, mirror, |
641 has_unsafe_access, _has_wide_vector, compiled_code, mirror, |
643 failed_speculations, speculations, speculations_len); |
642 failed_speculations, speculations, speculations_len); |
644 cb = nm->as_codeblob_or_null(); |
643 cb = nm->as_codeblob_or_null(); |
645 if (nm != NULL && compile_state == NULL) { |
644 if (nm != NULL && compile_state == NULL) { |
|
645 // This compile didn't come through the CompileBroker so perform the printing here |
646 DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler); |
646 DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler); |
647 bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption; |
647 nm->maybe_print_nmethod(directive); |
648 if (!printnmethods && (PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers)) { |
|
649 nm->print_nmethod(printnmethods); |
|
650 } |
|
651 DirectivesStack::release(directive); |
648 DirectivesStack::release(directive); |
652 } |
649 } |
653 } |
650 } |
654 |
651 |
655 if (cb != NULL) { |
652 if (cb != NULL) { |
868 TRACE_jvmci_4("safepoint at %i", pc_offset); |
865 TRACE_jvmci_4("safepoint at %i", pc_offset); |
869 site_Safepoint(buffer, pc_offset, site, JVMCI_CHECK_OK); |
866 site_Safepoint(buffer, pc_offset, site, JVMCI_CHECK_OK); |
870 if (_orig_pc_offset < 0) { |
867 if (_orig_pc_offset < 0) { |
871 JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot"); |
868 JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot"); |
872 } |
869 } |
|
870 if (JVMCIENV->equals(reason, jvmci_env()->get_site_InfopointReason_IMPLICIT_EXCEPTION())) { |
|
871 TRACE_jvmci_4("implicit exception at %i", pc_offset); |
|
872 _implicit_exception_table.add_deoptimize(pc_offset); |
|
873 } |
873 } else { |
874 } else { |
874 TRACE_jvmci_4("infopoint at %i", pc_offset); |
875 TRACE_jvmci_4("infopoint at %i", pc_offset); |
875 site_Infopoint(buffer, pc_offset, site, JVMCI_CHECK_OK); |
876 site_Infopoint(buffer, pc_offset, site, JVMCI_CHECK_OK); |
876 } |
877 } |
877 } else if (jvmci_env()->isa_site_DataPatch(site)) { |
878 } else if (jvmci_env()->isa_site_DataPatch(site)) { |
986 for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) { |
987 for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) { |
987 // HandleMark hm(THREAD); |
988 // HandleMark hm(THREAD); |
988 JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i); |
989 JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i); |
989 int id = jvmci_env()->get_VirtualObject_id(value); |
990 int id = jvmci_env()->get_VirtualObject_id(value); |
990 JVMCIObject type = jvmci_env()->get_VirtualObject_type(value); |
991 JVMCIObject type = jvmci_env()->get_VirtualObject_type(value); |
|
992 bool is_auto_box = jvmci_env()->get_VirtualObject_isAutoBox(value); |
991 Klass* klass = jvmci_env()->asKlass(type); |
993 Klass* klass = jvmci_env()->asKlass(type); |
992 oop javaMirror = klass->java_mirror(); |
994 oop javaMirror = klass->java_mirror(); |
993 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror))); |
995 ScopeValue *klass_sv = new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)); |
|
996 ObjectValue* sv = is_auto_box ? new AutoBoxObjectValue(id, klass_sv) : new ObjectValue(id, klass_sv); |
994 if (id < 0 || id >= objects->length()) { |
997 if (id < 0 || id >= objects->length()) { |
995 JVMCI_ERROR_NULL("virtual object id %d out of bounds", id); |
998 JVMCI_ERROR_NULL("virtual object id %d out of bounds", id); |
996 } |
999 } |
997 if (objects->at(id) != NULL) { |
1000 if (objects->at(id) != NULL) { |
998 JVMCI_ERROR_NULL("duplicate virtual object id %d", id); |
1001 JVMCI_ERROR_NULL("duplicate virtual object id %d", id); |