Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 8613:cd9e8dd9f488
Merge.
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Thu, 28 Mar 2013 12:58:50 +0100 |
parents | 6c4db417385a 8a526d8b4604 |
children | 7ef66078d837 |
comparison
equal
deleted
inserted
replaced
8612:02ef91b94656 | 8613:cd9e8dd9f488 |
---|---|
35 #include "graal/graalCompiler.hpp" | 35 #include "graal/graalCompiler.hpp" |
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 | 41 |
41 | 42 |
42 Method* getMethodFromHotSpotMethod(oop hotspot_method) { | 43 Method* getMethodFromHotSpotMethod(oop hotspot_method) { |
43 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity"); | 44 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity"); |
44 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method)); | 45 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method)); |
608 set_boolean("useFastLocking", GraalUseFastLocking); | 609 set_boolean("useFastLocking", GraalUseFastLocking); |
609 set_boolean("useBiasedLocking", UseBiasedLocking); | 610 set_boolean("useBiasedLocking", UseBiasedLocking); |
610 set_boolean("usePopCountInstruction", UsePopCountInstruction); | 611 set_boolean("usePopCountInstruction", UsePopCountInstruction); |
611 set_boolean("useAESIntrinsics", UseAESIntrinsics); | 612 set_boolean("useAESIntrinsics", UseAESIntrinsics); |
612 set_boolean("useTLAB", UseTLAB); | 613 set_boolean("useTLAB", UseTLAB); |
614 set_boolean("useG1GC", UseG1GC); | |
613 set_int("codeEntryAlignment", CodeEntryAlignment); | 615 set_int("codeEntryAlignment", CodeEntryAlignment); |
614 set_int("stackShadowPages", StackShadowPages); | 616 set_int("stackShadowPages", StackShadowPages); |
615 set_int("hubOffset", oopDesc::klass_offset_in_bytes()); | 617 set_int("hubOffset", oopDesc::klass_offset_in_bytes()); |
616 set_int("markOffset", oopDesc::mark_offset_in_bytes()); | 618 set_int("markOffset", oopDesc::mark_offset_in_bytes()); |
617 set_int("prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); | 619 set_int("prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); |
703 set_int("layoutHelperElementTypePrimitiveInPlace", (Klass::_lh_array_tag_type_value & ~Klass::_lh_array_tag_obj_value) << Klass::_lh_array_tag_shift); | 705 set_int("layoutHelperElementTypePrimitiveInPlace", (Klass::_lh_array_tag_type_value & ~Klass::_lh_array_tag_obj_value) << Klass::_lh_array_tag_shift); |
704 set_int("layoutHelperHeaderSizeShift", Klass::_lh_header_size_shift); | 706 set_int("layoutHelperHeaderSizeShift", Klass::_lh_header_size_shift); |
705 set_int("layoutHelperHeaderSizeMask", Klass::_lh_header_size_mask); | 707 set_int("layoutHelperHeaderSizeMask", Klass::_lh_header_size_mask); |
706 set_int("layoutHelperOffset", in_bytes(Klass::layout_helper_offset())); | 708 set_int("layoutHelperOffset", in_bytes(Klass::layout_helper_offset())); |
707 | 709 |
710 | |
711 set_stub("wbPreCallStub", GraalRuntime::entry_for(GraalRuntime::wb_pre_call_id)); | |
712 set_stub("wbPostCallStub", GraalRuntime::entry_for(GraalRuntime::wb_post_call_id)); | |
713 | |
708 set_stub("newInstanceStub", GraalRuntime::entry_for(GraalRuntime::new_instance_id)); | 714 set_stub("newInstanceStub", GraalRuntime::entry_for(GraalRuntime::new_instance_id)); |
709 set_stub("newArrayStub", GraalRuntime::entry_for(GraalRuntime::new_array_id)); | 715 set_stub("newArrayStub", GraalRuntime::entry_for(GraalRuntime::new_array_id)); |
710 set_stub("newMultiArrayStub", GraalRuntime::entry_for(GraalRuntime::new_multi_array_id)); | 716 set_stub("newMultiArrayStub", GraalRuntime::entry_for(GraalRuntime::new_multi_array_id)); |
711 set_stub("identityHashCodeStub", GraalRuntime::entry_for(GraalRuntime::identity_hash_code_id)); | 717 set_stub("identityHashCodeStub", GraalRuntime::entry_for(GraalRuntime::identity_hash_code_id)); |
712 set_stub("threadIsInterruptedStub", GraalRuntime::entry_for(GraalRuntime::thread_is_interrupted_id)); | 718 set_stub("threadIsInterruptedStub", GraalRuntime::entry_for(GraalRuntime::thread_is_interrupted_id)); |
755 set_int("deoptActionNone", Deoptimization::Action_none); | 761 set_int("deoptActionNone", Deoptimization::Action_none); |
756 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile); | 762 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile); |
757 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret); | 763 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret); |
758 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant); | 764 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant); |
759 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable); | 765 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable); |
760 | 766 set_int("g1CardQueueIndexOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index())); |
767 set_int("g1CardQueueBufferOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf())); | |
768 set_int("logOfHRGrainBytes", HeapRegion::LogOfHRGrainBytes); | |
769 set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active())); | |
770 set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index())); | |
771 set_int("g1SATBQueueBufferOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf())); | |
761 | 772 |
762 BarrierSet* bs = Universe::heap()->barrier_set(); | 773 BarrierSet* bs = Universe::heap()->barrier_set(); |
763 switch (bs->kind()) { | 774 switch (bs->kind()) { |
764 case BarrierSet::CardTableModRef: | 775 case BarrierSet::CardTableModRef: |
765 case BarrierSet::CardTableExtension: { | 776 case BarrierSet::CardTableExtension: |
777 case BarrierSet::G1SATBCT: | |
778 case BarrierSet::G1SATBCTLogging:{ | |
766 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base; | 779 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base; |
767 assert(base != 0, "unexpected byte_map_base"); | 780 assert(base != 0, "unexpected byte_map_base"); |
768 set_long("cardtableStartAddress", base); | 781 set_long("cardtableStartAddress", base); |
769 set_int("cardtableShift", CardTableModRefBS::card_shift); | 782 set_int("cardtableShift", CardTableModRefBS::card_shift); |
770 break; | 783 break; |
773 case BarrierSet::Other: | 786 case BarrierSet::Other: |
774 set_long("cardtableStartAddress", 0); | 787 set_long("cardtableStartAddress", 0); |
775 set_int("cardtableShift", 0); | 788 set_int("cardtableShift", 0); |
776 // No post barriers | 789 // No post barriers |
777 break; | 790 break; |
778 #ifndef SERIALGC | |
779 case BarrierSet::G1SATBCT: | |
780 case BarrierSet::G1SATBCTLogging: | |
781 #endif // SERIALGC | |
782 default: | 791 default: |
783 ShouldNotReachHere(); | 792 ShouldNotReachHere(); |
784 break; | 793 break; |
785 } | 794 } |
786 | 795 |
802 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(compResult)); | 811 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(compResult)); |
803 Handle installed_code_handle = JNIHandles::resolve(installed_code); | 812 Handle installed_code_handle = JNIHandles::resolve(installed_code); |
804 Handle triggered_deoptimizations_handle = JNIHandles::resolve(triggered_deoptimizations); | 813 Handle triggered_deoptimizations_handle = JNIHandles::resolve(triggered_deoptimizations); |
805 GraalEnv::CodeInstallResult result; | 814 GraalEnv::CodeInstallResult result; |
806 CodeInstaller installer(compResultHandle, method, result, nm, installed_code_handle, triggered_deoptimizations_handle); | 815 CodeInstaller installer(compResultHandle, method, result, nm, installed_code_handle, triggered_deoptimizations_handle); |
816 | |
817 if (PrintCodeCacheOnCompilation) { | |
818 stringStream s; | |
819 // Dump code cache into a buffer before locking the tty, | |
820 { | |
821 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
822 CodeCache::print_summary(&s, false); | |
823 } | |
824 ttyLocker ttyl; | |
825 tty->print_cr(s.as_string()); | |
826 } | |
807 | 827 |
808 if (result != GraalEnv::ok) { | 828 if (result != GraalEnv::ok) { |
809 assert(nm == NULL, "should be"); | 829 assert(nm == NULL, "should be"); |
810 } else { | 830 } else { |
811 if (!installed_code_handle.is_null()) { | 831 if (!installed_code_handle.is_null()) { |
815 HotSpotInstalledCode::set_start(installed_code_handle, (jlong) nm->code_begin()); | 835 HotSpotInstalledCode::set_start(installed_code_handle, (jlong) nm->code_begin()); |
816 assert(nm == NULL || !installed_code_handle->is_scavengable() || nm->on_scavenge_root_list(), "nm should be scavengable if installed_code is scavengable"); | 836 assert(nm == NULL || !installed_code_handle->is_scavengable() || nm->on_scavenge_root_list(), "nm should be scavengable if installed_code is scavengable"); |
817 } | 837 } |
818 } | 838 } |
819 return result; | 839 return result; |
840 C2V_END | |
841 | |
842 C2V_VMENTRY(void, clearQueuedForCompilation, (JNIEnv *jniEnv, jobject, jobject resolvedMethod)) | |
843 methodHandle method = getMethodFromHotSpotMethod(JNIHandles::resolve(resolvedMethod)); | |
844 method->clear_queued_for_compilation(); | |
820 C2V_END | 845 C2V_END |
821 | 846 |
822 C2V_VMENTRY(jobject, getCode, (JNIEnv *jniEnv, jobject, jlong metaspace_nmethod)) | 847 C2V_VMENTRY(jobject, getCode, (JNIEnv *jniEnv, jobject, jlong metaspace_nmethod)) |
823 ResourceMark rm; | 848 ResourceMark rm; |
824 HandleMark hm; | 849 HandleMark hm; |
1100 {CC"executeCompiledMethodVarargs", CC"("METASPACE_METHOD NMETHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, | 1125 {CC"executeCompiledMethodVarargs", CC"("METASPACE_METHOD NMETHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, |
1101 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, | 1126 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, |
1102 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)}, | 1127 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)}, |
1103 {CC"getLocalVariableTable", CC"("HS_RESOLVED_METHOD")["LOCAL, FN_PTR(getLocalVariableTable)}, | 1128 {CC"getLocalVariableTable", CC"("HS_RESOLVED_METHOD")["LOCAL, FN_PTR(getLocalVariableTable)}, |
1104 {CC"getFileName", CC"("HS_RESOLVED_JAVA_TYPE")"STRING, FN_PTR(getFileName)}, | 1129 {CC"getFileName", CC"("HS_RESOLVED_JAVA_TYPE")"STRING, FN_PTR(getFileName)}, |
1130 {CC"clearQueuedForCompilation", CC"("HS_RESOLVED_METHOD")V", FN_PTR(clearQueuedForCompilation)}, | |
1105 {CC"reprofile", CC"("METASPACE_METHOD")V", FN_PTR(reprofile)}, | 1131 {CC"reprofile", CC"("METASPACE_METHOD")V", FN_PTR(reprofile)}, |
1106 }; | 1132 }; |
1107 | 1133 |
1108 int CompilerToVM_methods_count() { | 1134 int CompilerToVM_methods_count() { |
1109 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod); | 1135 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod); |