Mercurial > hg > graal-jvmci-8
comparison src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 22739:f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 25 Nov 2015 20:41:26 +0100 |
parents | eb2091fcd682 |
children | 9273bb6ba33e |
comparison
equal
deleted
inserted
replaced
22738:eb6d572dfa61 | 22739:f41ed1d87d68 |
---|---|
629 // three reasons for infopoints denote actual safepoints | 629 // three reasons for infopoints denote actual safepoints |
630 oop reason = CompilationResult_Infopoint::reason(site); | 630 oop reason = CompilationResult_Infopoint::reason(site); |
631 if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) { | 631 if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) { |
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 { |
635 TRACE_jvmci_4("infopoint at %i", pc_offset); | |
635 site_Infopoint(buffer, pc_offset, site, CHECK_OK); | 636 site_Infopoint(buffer, pc_offset, site, CHECK_OK); |
636 } else { | |
637 JVMCI_ERROR_OK("unknown infopoint reason at %i", pc_offset); | |
638 } | 637 } |
639 } else if (site->is_a(CompilationResult_DataPatch::klass())) { | 638 } else if (site->is_a(CompilationResult_DataPatch::klass())) { |
640 TRACE_jvmci_4("datapatch at %i", pc_offset); | 639 TRACE_jvmci_4("datapatch at %i", pc_offset); |
641 site_DataPatch(buffer, pc_offset, site, CHECK_OK); | 640 site_DataPatch(buffer, pc_offset, site, CHECK_OK); |
642 } else if (site->is_a(CompilationResult_Mark::klass())) { | 641 } else if (site->is_a(CompilationResult_Mark::klass())) { |
770 } | 769 } |
771 _debug_recorder->dump_object_pool(objects); | 770 _debug_recorder->dump_object_pool(objects); |
772 return objects; | 771 return objects; |
773 } | 772 } |
774 | 773 |
775 void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, TRAPS) { | 774 void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, ScopeMode scope_mode, TRAPS) { |
776 Handle position = DebugInfo::bytecodePosition(debug_info); | 775 Handle position = DebugInfo::bytecodePosition(debug_info); |
777 if (position.is_null()) { | 776 if (position.is_null()) { |
778 // Stubs do not record scope info, just oop maps | 777 // Stubs do not record scope info, just oop maps |
779 return; | 778 return; |
780 } | 779 } |
781 | 780 |
782 GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info, CHECK); | 781 GrowableArray<ScopeValue*>* objectMapping; |
783 record_scope(pc_offset, position, objectMapping, CHECK); | 782 if (scope_mode == CodeInstaller::FullFrame) { |
784 } | 783 objectMapping = record_virtual_objects(debug_info, CHECK); |
785 | 784 } else { |
786 void CodeInstaller::record_scope(jint pc_offset, Handle position, GrowableArray<ScopeValue*>* objects, TRAPS) { | 785 objectMapping = NULL; |
786 } | |
787 record_scope(pc_offset, position, scope_mode, objectMapping, CHECK); | |
788 } | |
789 | |
790 void CodeInstaller::record_scope(jint pc_offset, Handle position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, TRAPS) { | |
787 Handle frame; | 791 Handle frame; |
788 if (position->is_a(BytecodeFrame::klass())) { | 792 if (scope_mode == CodeInstaller::FullFrame) { |
793 if (!position->is_a(BytecodeFrame::klass())) { | |
794 JVMCI_ERROR("Full frame expected for debug info at %i", pc_offset); | |
795 } | |
789 frame = position; | 796 frame = position; |
790 } | 797 } |
791 Handle caller_frame = BytecodePosition::caller(position); | 798 Handle caller_frame = BytecodePosition::caller(position); |
792 if (caller_frame.not_null()) { | 799 if (caller_frame.not_null()) { |
793 record_scope(pc_offset, caller_frame, objects, CHECK); | 800 record_scope(pc_offset, caller_frame, scope_mode, objects, CHECK); |
794 } | 801 } |
795 | 802 |
796 Handle hotspot_method = BytecodePosition::method(position); | 803 Handle hotspot_method = BytecodePosition::method(position); |
797 Method* method = getMethodFromHotSpotMethod(hotspot_method()); | 804 Method* method = getMethodFromHotSpotMethod(hotspot_method()); |
798 jint bci = BytecodePosition::bci(position); | 805 jint bci = BytecodePosition::bci(position); |
889 | 896 |
890 // address instruction = _instructions->start() + pc_offset; | 897 // address instruction = _instructions->start() + pc_offset; |
891 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); | 898 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); |
892 OopMap *map = create_oop_map(debug_info, CHECK); | 899 OopMap *map = create_oop_map(debug_info, CHECK); |
893 _debug_recorder->add_safepoint(pc_offset, map); | 900 _debug_recorder->add_safepoint(pc_offset, map); |
894 record_scope(pc_offset, debug_info, CHECK); | 901 record_scope(pc_offset, debug_info, CodeInstaller::FullFrame, CHECK); |
895 _debug_recorder->end_safepoint(pc_offset); | 902 _debug_recorder->end_safepoint(pc_offset); |
896 } | 903 } |
897 | 904 |
898 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { | 905 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
899 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); | 906 Handle debug_info = CompilationResult_Infopoint::debugInfo(site); |
900 if (debug_info.is_null()) { | 907 if (debug_info.is_null()) { |
901 JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset); | 908 JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset); |
902 } | 909 } |
903 | 910 |
911 // We'd like to check that pc_offset is greater than the | |
912 // last pc recorded with _debug_recorder (raising an exception if not) | |
913 // but DebugInformationRecorder doesn't have sufficient public API. | |
914 | |
904 _debug_recorder->add_non_safepoint(pc_offset); | 915 _debug_recorder->add_non_safepoint(pc_offset); |
905 record_scope(pc_offset, debug_info, CHECK); | 916 record_scope(pc_offset, debug_info, CodeInstaller::BytecodePosition, CHECK); |
906 _debug_recorder->end_non_safepoint(pc_offset); | 917 _debug_recorder->end_non_safepoint(pc_offset); |
907 } | 918 } |
908 | 919 |
909 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { | 920 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { |
910 Handle target = CompilationResult_Call::target(site); | 921 Handle target = CompilationResult_Call::target(site); |
927 jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK); | 938 jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK); |
928 | 939 |
929 if (debug_info.not_null()) { | 940 if (debug_info.not_null()) { |
930 OopMap *map = create_oop_map(debug_info, CHECK); | 941 OopMap *map = create_oop_map(debug_info, CHECK); |
931 _debug_recorder->add_safepoint(next_pc_offset, map); | 942 _debug_recorder->add_safepoint(next_pc_offset, map); |
932 record_scope(next_pc_offset, debug_info, CHECK); | 943 record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, CHECK); |
933 } | 944 } |
934 | 945 |
935 if (foreign_call.not_null()) { | 946 if (foreign_call.not_null()) { |
936 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); | 947 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); |
937 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK); | 948 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK); |