Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 12559:ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
author | twisti |
---|---|
date | Wed, 23 Oct 2013 19:50:14 -0700 |
parents | cee7f686c470 |
children | f6c511451e4a |
comparison
equal
deleted
inserted
replaced
12558:5de6526474bb | 12559:ae412befde21 |
---|---|
36 #include "graal/graalEnv.hpp" | 36 #include "graal/graalEnv.hpp" |
37 #include "graal/graalJavaAccess.hpp" | 37 #include "graal/graalJavaAccess.hpp" |
38 #include "graal/graalCodeInstaller.hpp" | 38 #include "graal/graalCodeInstaller.hpp" |
39 #include "graal/graalVMToCompiler.hpp" | 39 #include "graal/graalVMToCompiler.hpp" |
40 #include "gc_implementation/g1/heapRegion.hpp" | 40 #include "gc_implementation/g1/heapRegion.hpp" |
41 #include "runtime/javaCalls.hpp" | |
42 #include "runtime/vmStructs.hpp" | |
41 | 43 |
42 | 44 |
43 Method* getMethodFromHotSpotMethod(oop hotspot_method) { | 45 Method* getMethodFromHotSpotMethod(oop hotspot_method) { |
44 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity"); | 46 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity"); |
45 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method)); | 47 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method)); |
303 C2V_END | 305 C2V_END |
304 | 306 |
305 C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method)) | 307 C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method)) |
306 nmethod* code = (asMethod(metaspace_method))->code(); | 308 nmethod* code = (asMethod(metaspace_method))->code(); |
307 return code == NULL ? 0 : code->insts_size(); | 309 return code == NULL ? 0 : code->insts_size(); |
308 C2V_END | |
309 | |
310 C2V_VMENTRY(jint, constantPoolLength, (JNIEnv *env, jobject, jobject type)) | |
311 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants(); | |
312 return cp->length(); | |
313 C2V_END | 310 C2V_END |
314 | 311 |
315 C2V_VMENTRY(jobject, lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve)) | 312 C2V_VMENTRY(jobject, lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve)) |
316 ResourceMark rm; | 313 ResourceMark rm; |
317 | 314 |
545 } | 542 } |
546 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL); | 543 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL); |
547 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD)); | 544 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD)); |
548 C2V_END | 545 C2V_END |
549 | 546 |
547 // TODO move to Java | |
550 C2V_VMENTRY(jboolean, isTypeInitialized,(JNIEnv *, jobject, jobject hotspot_klass)) | 548 C2V_VMENTRY(jboolean, isTypeInitialized,(JNIEnv *, jobject, jobject hotspot_klass)) |
551 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass)); | 549 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass)); |
552 assert(klass != NULL, "method must not be called for primitive types"); | 550 assert(klass != NULL, "method must not be called for primitive types"); |
553 return InstanceKlass::cast(klass)->is_initialized(); | 551 return InstanceKlass::cast(klass)->is_initialized(); |
554 C2V_END | 552 C2V_END |
555 | 553 |
554 // TODO move to Java | |
556 C2V_VMENTRY(jboolean, isTypeLinked,(JNIEnv *, jobject, jobject hotspot_klass)) | 555 C2V_VMENTRY(jboolean, isTypeLinked,(JNIEnv *, jobject, jobject hotspot_klass)) |
557 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass)); | 556 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass)); |
558 assert(klass != NULL, "method must not be called for primitive types"); | 557 assert(klass != NULL, "method must not be called for primitive types"); |
559 return InstanceKlass::cast(klass)->is_linked(); | 558 return InstanceKlass::cast(klass)->is_linked(); |
560 C2V_END | 559 C2V_END |
647 method->set_not_c1_compilable(); | 646 method->set_not_c1_compilable(); |
648 method->set_not_c2_compilable(); | 647 method->set_not_c2_compilable(); |
649 method->set_dont_inline(true); | 648 method->set_dont_inline(true); |
650 C2V_END | 649 C2V_END |
651 | 650 |
651 extern "C" { | |
652 extern VMStructEntry* gHotSpotVMStructs; | |
653 extern uint64_t gHotSpotVMStructEntryTypeNameOffset; | |
654 extern uint64_t gHotSpotVMStructEntryFieldNameOffset; | |
655 extern uint64_t gHotSpotVMStructEntryTypeStringOffset; | |
656 extern uint64_t gHotSpotVMStructEntryIsStaticOffset; | |
657 extern uint64_t gHotSpotVMStructEntryOffsetOffset; | |
658 extern uint64_t gHotSpotVMStructEntryAddressOffset; | |
659 extern uint64_t gHotSpotVMStructEntryArrayStride; | |
660 | |
661 extern VMTypeEntry* gHotSpotVMTypes; | |
662 extern uint64_t gHotSpotVMTypeEntryTypeNameOffset; | |
663 extern uint64_t gHotSpotVMTypeEntrySuperclassNameOffset; | |
664 extern uint64_t gHotSpotVMTypeEntryIsOopTypeOffset; | |
665 extern uint64_t gHotSpotVMTypeEntryIsIntegerTypeOffset; | |
666 extern uint64_t gHotSpotVMTypeEntryIsUnsignedOffset; | |
667 extern uint64_t gHotSpotVMTypeEntrySizeOffset; | |
668 extern uint64_t gHotSpotVMTypeEntryArrayStride; | |
669 | |
670 extern VMIntConstantEntry* gHotSpotVMIntConstants; | |
671 extern uint64_t gHotSpotVMIntConstantEntryNameOffset; | |
672 extern uint64_t gHotSpotVMIntConstantEntryValueOffset; | |
673 extern uint64_t gHotSpotVMIntConstantEntryArrayStride; | |
674 | |
675 extern VMLongConstantEntry* gHotSpotVMLongConstants; | |
676 extern uint64_t gHotSpotVMLongConstantEntryNameOffset; | |
677 extern uint64_t gHotSpotVMLongConstantEntryValueOffset; | |
678 extern uint64_t gHotSpotVMLongConstantEntryArrayStride; | |
679 } | |
680 | |
652 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) | 681 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) |
653 | 682 |
654 #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0) | 683 #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0) |
655 #define set_int(name, value) do { env->SetIntField(config, getFieldID(env, config, name, "I"), value); } while (0) | 684 #define set_int(name, value) do { env->SetIntField(config, getFieldID(env, config, name, "I"), value); } while (0) |
656 #define set_long(name, value) do { env->SetLongField(config, getFieldID(env, config, name, "J"), value); } while (0) | 685 #define set_long(name, value) do { env->SetLongField(config, getFieldID(env, config, name, "J"), value); } while (0) |
657 #define set_address(name, value) do { set_long(name, (jlong) value); } while (0) | 686 #define set_address(name, value) do { set_long(name, (jlong) value); } while (0) |
658 #define set_object(name, value) do { env->SetObjectField(config, getFieldID(env, config, name, "Ljava/lang/Object;"), value); } while (0) | |
659 | 687 |
660 guarantee(HeapWordSize == sizeof(char*), "Graal assumption that HeadWordSize == machine word size is wrong"); | 688 guarantee(HeapWordSize == sizeof(char*), "Graal assumption that HeadWordSize == machine word size is wrong"); |
661 | 689 |
662 set_boolean("cAssertions", DEBUG_ONLY(true) NOT_DEBUG(false)); | 690 set_address("gHotSpotVMStructs", gHotSpotVMStructs); |
663 set_int("codeEntryAlignment", CodeEntryAlignment); | 691 set_long("gHotSpotVMStructEntryTypeNameOffset", gHotSpotVMStructEntryTypeNameOffset); |
664 set_int("hubOffset", oopDesc::klass_offset_in_bytes()); | 692 set_long("gHotSpotVMStructEntryFieldNameOffset", gHotSpotVMStructEntryFieldNameOffset); |
665 set_int("markOffset", oopDesc::mark_offset_in_bytes()); | 693 set_long("gHotSpotVMStructEntryTypeStringOffset", gHotSpotVMStructEntryTypeStringOffset); |
666 set_int("prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); | 694 set_long("gHotSpotVMStructEntryIsStaticOffset", gHotSpotVMStructEntryIsStaticOffset); |
667 set_int("superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset())); | 695 set_long("gHotSpotVMStructEntryOffsetOffset", gHotSpotVMStructEntryOffsetOffset); |
668 set_int("secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset())); | 696 set_long("gHotSpotVMStructEntryAddressOffset", gHotSpotVMStructEntryAddressOffset); |
669 set_int("secondarySupersOffset", in_bytes(Klass::secondary_supers_offset())); | 697 set_long("gHotSpotVMStructEntryArrayStride", gHotSpotVMStructEntryArrayStride); |
670 set_int("subklassOffset", in_bytes(Klass::subklass_offset())); | 698 |
671 set_int("nextSiblingOffset", in_bytes(Klass::next_sibling_offset())); | 699 set_address("gHotSpotVMTypes", gHotSpotVMTypes); |
700 set_long("gHotSpotVMTypeEntryTypeNameOffset", gHotSpotVMTypeEntryTypeNameOffset); | |
701 set_long("gHotSpotVMTypeEntrySuperclassNameOffset", gHotSpotVMTypeEntrySuperclassNameOffset); | |
702 set_long("gHotSpotVMTypeEntryIsOopTypeOffset", gHotSpotVMTypeEntryIsOopTypeOffset); | |
703 set_long("gHotSpotVMTypeEntryIsIntegerTypeOffset", gHotSpotVMTypeEntryIsIntegerTypeOffset); | |
704 set_long("gHotSpotVMTypeEntryIsUnsignedOffset", gHotSpotVMTypeEntryIsUnsignedOffset); | |
705 set_long("gHotSpotVMTypeEntrySizeOffset", gHotSpotVMTypeEntrySizeOffset); | |
706 set_long("gHotSpotVMTypeEntryArrayStride", gHotSpotVMTypeEntryArrayStride); | |
707 | |
708 set_address("gHotSpotVMIntConstants", gHotSpotVMIntConstants); | |
709 set_long("gHotSpotVMIntConstantEntryNameOffset", gHotSpotVMIntConstantEntryNameOffset); | |
710 set_long("gHotSpotVMIntConstantEntryValueOffset", gHotSpotVMIntConstantEntryValueOffset); | |
711 set_long("gHotSpotVMIntConstantEntryArrayStride", gHotSpotVMIntConstantEntryArrayStride); | |
712 | |
713 set_address("gHotSpotVMLongConstants", gHotSpotVMLongConstants); | |
714 set_long("gHotSpotVMLongConstantEntryNameOffset", gHotSpotVMLongConstantEntryNameOffset); | |
715 set_long("gHotSpotVMLongConstantEntryValueOffset", gHotSpotVMLongConstantEntryValueOffset); | |
716 set_long("gHotSpotVMLongConstantEntryArrayStride", gHotSpotVMLongConstantEntryArrayStride); | |
717 | |
718 //------------------------------------------------------------------------------------------------ | |
719 | |
672 set_int("arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); | 720 set_int("arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); |
673 set_int("klassStateOffset", in_bytes(InstanceKlass::init_state_offset())); | 721 |
674 set_int("klassStateFullyInitialized", (int)InstanceKlass::fully_initialized); | |
675 set_int("threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); | |
676 set_int("threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset())); | |
677 set_int("threadObjectOffset", in_bytes(JavaThread::threadObj_offset())); | |
678 set_int("threadIsMethodHandleReturnOffset", in_bytes(JavaThread::is_method_handle_return_offset())); | |
679 set_int("osThreadOffset", in_bytes(JavaThread::osthread_offset())); | |
680 set_int("osThreadInterruptedOffset", in_bytes(OSThread::interrupted_offset())); | |
681 set_int("unlockedMask", (int) markOopDesc::unlocked_value); | |
682 set_int("biasedLockMaskInPlace", (int) markOopDesc::biased_lock_mask_in_place); | |
683 set_int("ageMaskInPlace", (int) markOopDesc::age_mask_in_place); | |
684 set_int("epochMaskInPlace", (int) markOopDesc::epoch_mask_in_place); | |
685 set_int("biasedLockPattern", (int) markOopDesc::biased_lock_pattern); | |
686 set_int("methodMaxLocalsOffset", in_bytes(ConstMethod::size_of_locals_offset())); | |
687 set_int("methodConstMethodOffset", in_bytes(Method::const_offset())); | |
688 set_int("constMethodMaxStackOffset", in_bytes(ConstMethod::max_stack_offset())); | |
689 set_int("constMethodConstantsOffset", in_bytes(ConstMethod::constants_offset())); | |
690 set_int("constantPoolHolderOffset", ConstantPool::pool_holder_offset_in_bytes()); | |
691 set_int("extraStackEntries", Method::extra_stack_entries()); | 722 set_int("extraStackEntries", Method::extra_stack_entries()); |
692 set_int("methodAccessFlagsOffset", in_bytes(Method::access_flags_offset())); | |
693 set_int("methodQueuedForCompilationBit", (int) JVM_ACC_QUEUED); | |
694 set_int("methodIntrinsicIdOffset", Method::intrinsic_id_offset_in_bytes()); | |
695 set_int("klassHasFinalizerFlag", JVM_ACC_HAS_FINALIZER); | |
696 set_int("threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); | |
697 set_int("threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); | |
698 set_long("safepointPollingAddress", (jlong)(os::get_polling_page())); | |
699 #ifdef TARGET_ARCH_x86 | |
700 set_boolean("isPollingPageFar", Assembler::is_polling_page_far()); | |
701 set_int("runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes); | |
702 #endif | |
703 set_int("classMirrorOffset", in_bytes(Klass::java_mirror_offset())); | |
704 set_int("klassModifierFlagsOffset", in_bytes(Klass::modifier_flags_offset())); | |
705 set_int("klassAccessFlagsOffset", in_bytes(Klass::access_flags_offset())); | |
706 set_int("klassOffset", java_lang_Class::klass_offset_in_bytes()); | |
707 set_int("arrayKlassOffset", java_lang_Class::array_klass_offset_in_bytes()); | |
708 set_int("graalMirrorInClassOffset", java_lang_Class::graal_mirror_offset_in_bytes()); | |
709 set_int("klassLayoutHelperOffset", in_bytes(Klass::layout_helper_offset())); | |
710 set_int("klassSuperKlassOffset", in_bytes(Klass::super_offset())); | |
711 set_int("methodDataOffset", in_bytes(Method::method_data_offset())); | |
712 set_int("nmethodEntryOffset", nmethod::verified_entry_point_offset()); | |
713 set_int("methodCompiledEntryOffset", in_bytes(Method::from_compiled_offset())); | |
714 set_int("basicLockSize", sizeof(BasicLock)); | |
715 set_int("basicLockDisplacedHeaderOffset", BasicLock::displaced_header_offset_in_bytes()); | |
716 set_int("uninitializedIdentityHashCodeValue", markOopDesc::no_hash); | |
717 set_int("identityHashCodeShift", markOopDesc::hash_shift); | |
718 | |
719 set_int("arrayKlassLayoutHelperIdentifier", 0x80000000); | |
720 assert((Klass::_lh_array_tag_obj_value & Klass::_lh_array_tag_type_value & 0x80000000) != 0, "obj_array and type_array must have first bit set"); | |
721 set_int("arrayKlassComponentMirrorOffset", in_bytes(ArrayKlass::component_mirror_offset())); | |
722 | |
723 | |
724 set_int("pendingExceptionOffset", in_bytes(ThreadShadow::pending_exception_offset())); | |
725 set_int("pendingDeoptimizationOffset", in_bytes(ThreadShadow::pending_deoptimization_offset())); | |
726 | |
727 set_int("metaspaceArrayLengthOffset", Array<Klass*>::length_offset_in_bytes()); | |
728 set_int("metaspaceArrayBaseOffset", Array<Klass*>::base_offset_in_bytes()); | |
729 set_int("methodDataOopDataOffset", in_bytes(MethodData::data_offset())); | |
730 set_int("methodDataOopTrapHistoryOffset", in_bytes(MethodData::trap_history_offset())); | |
731 set_int("dataLayoutHeaderSize", DataLayout::header_size_in_bytes()); | |
732 set_int("dataLayoutTagOffset", in_bytes(DataLayout::tag_offset())); | |
733 set_int("dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset())); | |
734 set_int("dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset())); | |
735 set_int("dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0))); | |
736 set_int("dataLayoutCellSize", DataLayout::cell_size); | |
737 | 723 |
738 set_int("tlabAlignmentReserve", (int32_t)ThreadLocalAllocBuffer::alignment_reserve()); | 724 set_int("tlabAlignmentReserve", (int32_t)ThreadLocalAllocBuffer::alignment_reserve()); |
739 set_long("tlabIntArrayMarkWord", (intptr_t)markOopDesc::prototype()->copy_set_hash(0x2)); | |
740 set_long("heapTopAddress", (jlong)(address) Universe::heap()->top_addr()); | 725 set_long("heapTopAddress", (jlong)(address) Universe::heap()->top_addr()); |
741 set_long("heapEndAddress", (jlong)(address) Universe::heap()->end_addr()); | 726 set_long("heapEndAddress", (jlong)(address) Universe::heap()->end_addr()); |
742 set_int("threadTlabStartOffset", in_bytes(JavaThread::tlab_start_offset())); | 727 |
743 set_int("threadTlabSizeOffset", in_bytes(JavaThread::tlab_size_offset())); | |
744 set_int("threadAllocatedBytesOffset", in_bytes(JavaThread::allocated_bytes_offset())); | |
745 set_int("threadLastJavaSpOffset", in_bytes(JavaThread::last_Java_sp_offset())); | |
746 set_int("threadLastJavaPcOffset", in_bytes(JavaThread::last_Java_pc_offset())); | |
747 #ifdef TARGET_ARCH_x86 | |
748 set_int("threadLastJavaFpOffset", in_bytes(JavaThread::last_Java_fp_offset())); | |
749 #endif | |
750 #ifdef TARGET_ARCH_sparc | |
751 set_int("threadJavaFrameAnchorFlagsOffset", in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::flags_offset())); | |
752 #endif | |
753 set_int("threadObjectResultOffset", in_bytes(JavaThread::vm_result_offset())); | |
754 set_int("tlabSlowAllocationsOffset", in_bytes(JavaThread::tlab_slow_allocations_offset())); | |
755 set_int("tlabFastRefillWasteOffset", in_bytes(JavaThread::tlab_fast_refill_waste_offset())); | |
756 set_int("tlabNumberOfRefillsOffset", in_bytes(JavaThread::tlab_number_of_refills_offset())); | |
757 set_int("tlabRefillWasteLimitOffset", in_bytes(JavaThread::tlab_refill_waste_limit_offset())); | |
758 set_int("tlabRefillWasteIncrement", (int32_t) ThreadLocalAllocBuffer::refill_waste_limit_increment()); | |
759 set_int("klassInstanceSizeOffset", in_bytes(Klass::layout_helper_offset())); | |
760 set_boolean("inlineContiguousAllocationSupported", !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()); | 728 set_boolean("inlineContiguousAllocationSupported", !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()); |
761 | 729 |
762 set_address("nonOopBits", Universe::non_oop_word()); | |
763 set_long("verifyOopCounterAddress", (jlong)(address) StubRoutines::verify_oop_count_addr()); | |
764 set_long("verifyOopMask", Universe::verify_oop_mask()); | 730 set_long("verifyOopMask", Universe::verify_oop_mask()); |
765 set_long("verifyOopBits", Universe::verify_oop_bits()); | 731 set_long("verifyOopBits", Universe::verify_oop_bits()); |
766 | 732 |
767 set_long("arrayPrototypeMarkWord", (intptr_t)markOopDesc::prototype()); | 733 set_int("instanceKlassVtableStartOffset", InstanceKlass::vtable_start_offset() * HeapWordSize); |
768 set_int("layoutHelperLog2ElementSizeShift", Klass::_lh_log2_element_size_shift); | 734 |
769 set_int("layoutHelperLog2ElementSizeMask", Klass::_lh_log2_element_size_mask); | 735 //------------------------------------------------------------------------------------------------ |
770 set_int("layoutHelperElementTypeShift", Klass::_lh_element_type_shift); | 736 |
771 set_int("layoutHelperElementTypeMask", Klass::_lh_element_type_mask); | |
772 // this filters out the bit that differentiates a type array from an object array | |
773 set_int("layoutHelperElementTypePrimitiveInPlace", (Klass::_lh_array_tag_type_value & ~Klass::_lh_array_tag_obj_value) << Klass::_lh_array_tag_shift); | |
774 set_int("layoutHelperHeaderSizeShift", Klass::_lh_header_size_shift); | |
775 set_int("layoutHelperHeaderSizeMask", Klass::_lh_header_size_mask); | |
776 set_int("layoutHelperOffset", in_bytes(Klass::layout_helper_offset())); | |
777 | |
778 set_address("inlineCacheMissStub", SharedRuntime::get_ic_miss_stub()); | |
779 set_address("handleDeoptStub", SharedRuntime::deopt_blob()->unpack()); | 737 set_address("handleDeoptStub", SharedRuntime::deopt_blob()->unpack()); |
780 set_address("aescryptEncryptBlockStub", StubRoutines::aescrypt_encryptBlock()); | 738 set_address("uncommonTrapStub", SharedRuntime::deopt_blob()->uncommon_trap()); |
781 set_address("aescryptDecryptBlockStub", StubRoutines::aescrypt_decryptBlock()); | 739 |
782 set_address("cipherBlockChainingEncryptAESCryptStub", StubRoutines::cipherBlockChaining_encryptAESCrypt()); | 740 set_address("registerFinalizerAddress", SharedRuntime::register_finalizer); |
783 set_address("cipherBlockChainingDecryptAESCryptStub", StubRoutines::cipherBlockChaining_decryptAESCrypt()); | 741 set_address("exceptionHandlerForReturnAddressAddress", SharedRuntime::exception_handler_for_return_address); |
784 set_address("updateBytesCRC32Stub", StubRoutines::updateBytesCRC32()); | 742 set_address("osrMigrationEndAddress", SharedRuntime::OSR_migration_end); |
743 | |
744 set_address("javaTimeMillisAddress", CAST_FROM_FN_PTR(address, os::javaTimeMillis)); | |
745 set_address("javaTimeNanosAddress", CAST_FROM_FN_PTR(address, os::javaTimeNanos)); | |
746 set_address("arithmeticSinAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dsin)); | |
747 set_address("arithmeticCosAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dcos)); | |
748 set_address("arithmeticTanAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dtan)); | |
785 | 749 |
786 set_address("newInstanceAddress", GraalRuntime::new_instance); | 750 set_address("newInstanceAddress", GraalRuntime::new_instance); |
787 set_address("newArrayAddress", GraalRuntime::new_array); | 751 set_address("newArrayAddress", GraalRuntime::new_array); |
788 set_address("newMultiArrayAddress", GraalRuntime::new_multi_array); | 752 set_address("newMultiArrayAddress", GraalRuntime::new_multi_array); |
789 set_address("dynamicNewArrayAddress", GraalRuntime::dynamic_new_array); | 753 set_address("dynamicNewArrayAddress", GraalRuntime::dynamic_new_array); |
790 set_address("registerFinalizerAddress", SharedRuntime::register_finalizer); | |
791 set_address("threadIsInterruptedAddress", GraalRuntime::thread_is_interrupted); | 754 set_address("threadIsInterruptedAddress", GraalRuntime::thread_is_interrupted); |
792 set_address("uncommonTrapStub", SharedRuntime::deopt_blob()->uncommon_trap()); | |
793 set_address("vmMessageAddress", GraalRuntime::vm_message); | 755 set_address("vmMessageAddress", GraalRuntime::vm_message); |
794 set_address("identityHashCodeAddress", GraalRuntime::identity_hash_code); | 756 set_address("identityHashCodeAddress", GraalRuntime::identity_hash_code); |
795 set_address("exceptionHandlerForPcAddress", GraalRuntime::exception_handler_for_pc); | 757 set_address("exceptionHandlerForPcAddress", GraalRuntime::exception_handler_for_pc); |
796 set_address("exceptionHandlerForReturnAddressAddress", SharedRuntime::exception_handler_for_return_address); | |
797 set_address("osrMigrationEndAddress", SharedRuntime::OSR_migration_end); | |
798 set_address("monitorenterAddress", GraalRuntime::monitorenter); | 758 set_address("monitorenterAddress", GraalRuntime::monitorenter); |
799 set_address("monitorexitAddress", GraalRuntime::monitorexit); | 759 set_address("monitorexitAddress", GraalRuntime::monitorexit); |
800 set_address("createNullPointerExceptionAddress", GraalRuntime::create_null_exception); | 760 set_address("createNullPointerExceptionAddress", GraalRuntime::create_null_exception); |
801 set_address("createOutOfBoundsExceptionAddress", GraalRuntime::create_out_of_bounds_exception); | 761 set_address("createOutOfBoundsExceptionAddress", GraalRuntime::create_out_of_bounds_exception); |
802 set_address("logPrimitiveAddress", GraalRuntime::log_primitive); | 762 set_address("logPrimitiveAddress", GraalRuntime::log_primitive); |
803 set_address("logObjectAddress", GraalRuntime::log_object); | 763 set_address("logObjectAddress", GraalRuntime::log_object); |
804 set_address("logPrintfAddress", GraalRuntime::log_printf); | 764 set_address("logPrintfAddress", GraalRuntime::log_printf); |
805 set_address("vmErrorAddress", GraalRuntime::vm_error); | 765 set_address("vmErrorAddress", GraalRuntime::vm_error); |
806 set_address("loadAndClearExceptionAddress", GraalRuntime::load_and_clear_exception); | 766 set_address("loadAndClearExceptionAddress", GraalRuntime::load_and_clear_exception); |
807 set_address("javaTimeMillisAddress", CAST_FROM_FN_PTR(address, os::javaTimeMillis)); | |
808 set_address("javaTimeNanosAddress", CAST_FROM_FN_PTR(address, os::javaTimeNanos)); | |
809 set_address("arithmeticSinAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dsin)); | |
810 set_address("arithmeticCosAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dcos)); | |
811 set_address("arithmeticTanAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dtan)); | |
812 set_address("crcTableAddress", StubRoutines::crc_table_addr()); | |
813 | |
814 set_int("deoptReasonNone", Deoptimization::Reason_none); | |
815 set_int("deoptReasonNullCheck", Deoptimization::Reason_null_check); | |
816 set_int("deoptReasonRangeCheck", Deoptimization::Reason_range_check); | |
817 set_int("deoptReasonClassCheck", Deoptimization::Reason_class_check); | |
818 set_int("deoptReasonArrayCheck", Deoptimization::Reason_array_check); | |
819 set_int("deoptReasonUnreached0", Deoptimization::Reason_unreached0); | |
820 set_int("deoptReasonTypeCheckInlining", Deoptimization::Reason_type_checked_inlining); | |
821 set_int("deoptReasonOptimizedTypeCheck", Deoptimization::Reason_optimized_type_check); | |
822 set_int("deoptReasonNotCompiledExceptionHandler", Deoptimization::Reason_not_compiled_exception_handler); | |
823 set_int("deoptReasonUnresolved", Deoptimization::Reason_unresolved); | |
824 set_int("deoptReasonJsrMismatch", Deoptimization::Reason_jsr_mismatch); | |
825 set_int("deoptReasonDiv0Check", Deoptimization::Reason_div0_check); | |
826 set_int("deoptReasonConstraint", Deoptimization::Reason_constraint); | |
827 set_int("deoptReasonLoopLimitCheck", Deoptimization::Reason_loop_limit_check); | |
828 | |
829 set_int("deoptActionNone", Deoptimization::Action_none); | |
830 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile); | |
831 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret); | |
832 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant); | |
833 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable); | |
834 | |
835 set_int("vmIntrinsicInvokeBasic", vmIntrinsics::_invokeBasic); | |
836 set_int("vmIntrinsicLinkToVirtual", vmIntrinsics::_linkToVirtual); | |
837 set_int("vmIntrinsicLinkToStatic", vmIntrinsics::_linkToStatic); | |
838 set_int("vmIntrinsicLinkToSpecial", vmIntrinsics::_linkToSpecial); | |
839 set_int("vmIntrinsicLinkToInterface", vmIntrinsics::_linkToInterface); | |
840 | |
841 set_address("narrowOopBase", Universe::narrow_oop_base()); | |
842 set_int("narrowOopShift", Universe::narrow_oop_shift()); | |
843 set_address("narrowKlassBase", Universe::narrow_klass_base()); | |
844 set_int("narrowKlassShift", Universe::narrow_klass_shift()); | |
845 set_int("logKlassAlignment", LogKlassAlignmentInBytes); | |
846 | |
847 | |
848 set_int("g1CardQueueIndexOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index())); | |
849 set_int("g1CardQueueBufferOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf())); | |
850 set_int("logOfHRGrainBytes", HeapRegion::LogOfHRGrainBytes); | |
851 set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active())); | |
852 set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index())); | |
853 set_int("g1SATBQueueBufferOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf())); | |
854 set_address("writeBarrierPreAddress", GraalRuntime::write_barrier_pre); | 767 set_address("writeBarrierPreAddress", GraalRuntime::write_barrier_pre); |
855 set_address("writeBarrierPostAddress", GraalRuntime::write_barrier_post); | 768 set_address("writeBarrierPostAddress", GraalRuntime::write_barrier_post); |
856 set_address("gcTotalCollectionsAddress", (jlong)(address)(Universe::heap()->total_collections_address())); | |
857 set_address("validateObject", GraalRuntime::validate_object); | 769 set_address("validateObject", GraalRuntime::validate_object); |
858 | 770 |
859 BarrierSet* bs = Universe::heap()->barrier_set(); | 771 //------------------------------------------------------------------------------------------------ |
860 switch (bs->kind()) { | |
861 case BarrierSet::CardTableModRef: | |
862 case BarrierSet::CardTableExtension: | |
863 case BarrierSet::G1SATBCT: | |
864 case BarrierSet::G1SATBCTLogging:{ | |
865 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base; | |
866 assert(base != 0, "unexpected byte_map_base"); | |
867 set_long("cardtableStartAddress", base); | |
868 set_int("cardtableShift", CardTableModRefBS::card_shift); | |
869 break; | |
870 } | |
871 case BarrierSet::ModRef: | |
872 case BarrierSet::Other: | |
873 set_long("cardtableStartAddress", 0); | |
874 set_int("cardtableShift", 0); | |
875 // No post barriers | |
876 break; | |
877 default: | |
878 ShouldNotReachHere(); | |
879 break; | |
880 } | |
881 | |
882 set_int("arrayClassElementOffset", in_bytes(ObjArrayKlass::element_klass_offset())); | |
883 | 772 |
884 set_int("graalCountersThreadOffset", in_bytes(JavaThread::graal_counters_offset())); | 773 set_int("graalCountersThreadOffset", in_bytes(JavaThread::graal_counters_offset())); |
885 set_int("graalCountersSize", (jint) GRAAL_COUNTERS_SIZE); | 774 set_int("graalCountersSize", (jint) GRAAL_COUNTERS_SIZE); |
886 | 775 |
887 #undef set_boolean | 776 #undef set_boolean |
888 #undef set_int | 777 #undef set_int |
889 #undef set_long | 778 #undef set_long |
890 #undef set_object | |
891 | 779 |
892 C2V_END | 780 C2V_END |
893 | 781 |
894 C2V_VMENTRY(jint, installCode0, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject triggered_deoptimizations)) | 782 C2V_VMENTRY(jint, installCode0, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject triggered_deoptimizations)) |
895 ResourceMark rm; | 783 ResourceMark rm; |
1001 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); | 889 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); |
1002 return JNIHandles::make_local(o); | 890 return JNIHandles::make_local(o); |
1003 } | 891 } |
1004 C2V_END | 892 C2V_END |
1005 | 893 |
1006 C2V_VMENTRY(jint, getVtableEntryOffset, (JNIEnv *, jobject, jlong metaspace_method)) | |
1007 | |
1008 Method* method = asMethod(metaspace_method); | |
1009 assert(!InstanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); | |
1010 assert(InstanceKlass::cast(method->method_holder())->is_linked(), "vtableEntryOffset cannot be called is holder is not linked"); | |
1011 assert(method->vtable_index() >= 0, "vtable entry offset should not be used"); | |
1012 | |
1013 // get entry offset in words | |
1014 int vtable_entry_offset = InstanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size(); | |
1015 // convert to bytes | |
1016 vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); | |
1017 | |
1018 return vtable_entry_offset; | |
1019 C2V_END | |
1020 | |
1021 C2V_VMENTRY(jboolean, hasVtableEntry, (JNIEnv *, jobject, jlong metaspace_method)) | |
1022 Method* method = asMethod(metaspace_method); | |
1023 return method->vtable_index() >= 0; | |
1024 C2V_END | |
1025 | |
1026 C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject)) | 894 C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject)) |
1027 | 895 |
1028 // the contract for this method is as follows: | 896 // the contract for this method is as follows: |
1029 // returning null: no deopted leaf graphs | 897 // returning null: no deopted leaf graphs |
1030 // returning array (size > 0): the ids of the deopted leaf graphs | 898 // returning array (size > 0): the ids of the deopted leaf graphs |
1143 C2V_END | 1011 C2V_END |
1144 | 1012 |
1145 | 1013 |
1146 C2V_VMENTRY(jobject, readUnsafeUncompressedPointer, (JNIEnv *env, jobject, jobject o, jlong offset)) | 1014 C2V_VMENTRY(jobject, readUnsafeUncompressedPointer, (JNIEnv *env, jobject, jobject o, jlong offset)) |
1147 oop resolved_o = JNIHandles::resolve(o); | 1015 oop resolved_o = JNIHandles::resolve(o); |
1148 address addr = offset + (address)resolved_o; | 1016 address addr = ((address)resolved_o) + offset; |
1149 return JNIHandles::make_local(*((oop*)addr)); | 1017 return JNIHandles::make_local(*((oop*)addr)); |
1150 C2V_END | 1018 C2V_END |
1151 | 1019 |
1152 C2V_VMENTRY(jlong, readUnsafeKlassPointer, (JNIEnv *env, jobject, jobject o)) | 1020 C2V_VMENTRY(jlong, readUnsafeKlassPointer, (JNIEnv *env, jobject, jobject o)) |
1153 oop resolved_o = JNIHandles::resolve(o); | 1021 oop resolved_o = JNIHandles::resolve(o); |
1205 {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, | 1073 {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, |
1206 {CC"doNotInlineOrCompile", CC"("METASPACE_METHOD")V", FN_PTR(doNotInlineOrCompile)}, | 1074 {CC"doNotInlineOrCompile", CC"("METASPACE_METHOD")V", FN_PTR(doNotInlineOrCompile)}, |
1207 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, | 1075 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, |
1208 {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, | 1076 {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, |
1209 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, | 1077 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, |
1210 {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)}, | |
1211 {CC"hasVtableEntry", CC"("METASPACE_METHOD")Z", FN_PTR(hasVtableEntry)}, | |
1212 {CC"constantPoolLength", CC"("HS_RESOLVED_TYPE")I", FN_PTR(constantPoolLength)}, | |
1213 {CC"lookupType", CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)}, | 1078 {CC"lookupType", CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)}, |
1214 {CC"lookupConstantInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)}, | 1079 {CC"lookupConstantInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)}, |
1215 {CC"lookupAppendixInPool", CC"("HS_RESOLVED_TYPE"IB)"OBJECT, FN_PTR(lookupAppendixInPool)}, | 1080 {CC"lookupAppendixInPool", CC"("HS_RESOLVED_TYPE"IB)"OBJECT, FN_PTR(lookupAppendixInPool)}, |
1216 {CC"lookupMethodInPool", CC"("HS_RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)}, | 1081 {CC"lookupMethodInPool", CC"("HS_RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)}, |
1217 {CC"lookupTypeInPool", CC"("HS_RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)}, | 1082 {CC"lookupTypeInPool", CC"("HS_RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)}, |