777 }
778
779 // Determine if this node starts a bundle
780 bool Compile::starts_bundle(const Node *n) const {
781 return (_node_bundling_limit > n->_idx &&
782 _node_bundling_base[n->_idx].starts_bundle());
783 }
784
785 //--------------------------Process_OopMap_Node--------------------------------
786 void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
787
788 // Handle special safepoint nodes for synchronization
789 MachSafePointNode *sfn = mach->as_MachSafePoint();
790 MachCallNode *mcall;
791
792 #ifdef ENABLE_ZAP_DEAD_LOCALS
793 assert( is_node_getting_a_safepoint(mach), "logic does not match; false negative");
794 #endif
795
796 int safepoint_pc_offset = current_offset;
797
798 // Add the safepoint in the DebugInfoRecorder
799 if( !mach->is_MachCall() ) {
800 mcall = NULL;
801 debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
802 } else {
803 mcall = mach->as_MachCall();
804 safepoint_pc_offset += mcall->ret_addr_offset();
805 debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
806 }
807
808 // Loop over the JVMState list to add scope information
809 // Do not skip safepoints with a NULL method, they need monitor info
810 JVMState* youngest_jvms = sfn->jvms();
811 int max_depth = youngest_jvms->depth();
812
813 // Allocate the object pool for scalar-replaced objects -- the map from
814 // small-integer keys (which can be recorded in the local and ostack
815 // arrays) to descriptions of the object state.
816 GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
817
818 // Visit scopes from oldest to youngest.
819 for (int depth = 1; depth <= max_depth; depth++) {
820 JVMState* jvms = youngest_jvms->of_depth(depth);
821 int idx;
822 ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
823 // Safepoints that do not have method() set only provide oop-map and monitor info
896 OptoReg::Name box_reg = BoxLockNode::stack_slot(box_node);
897 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg));
898 while( !box_node->is_BoxLock() ) box_node = box_node->in(1);
899 monarray->append(new MonitorValue(scval, basic_lock, box_node->as_BoxLock()->is_eliminated()));
900 }
901
902 // We dump the object pool first, since deoptimization reads it in first.
903 debug_info()->dump_object_pool(objs);
904
905 // Build first class objects to pass to scope
906 DebugToken *locvals = debug_info()->create_scope_values(locarray);
907 DebugToken *expvals = debug_info()->create_scope_values(exparray);
908 DebugToken *monvals = debug_info()->create_monitor_values(monarray);
909
910 // Make method available for all Safepoints
911 ciMethod* scope_method = method ? method : _method;
912 // Describe the scope here
913 assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
914 assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
915 // Now we can describe the scope.
916 bool is_method_handle_invoke = false;
917 debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, locvals, expvals, monvals);
918 } // End jvms loop
919
920 // Mark the end of the scope set.
921 debug_info()->end_safepoint(safepoint_pc_offset);
922 }
923
924
925
926 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
927 class NonSafepointEmitter {
928 Compile* C;
929 JVMState* _pending_jvms;
930 int _pending_offset;
931
932 void emit_non_safepoint();
933
934 public:
935 NonSafepointEmitter(Compile* compile) {
936 this->C = compile;
|
777 }
778
779 // Determine if this node starts a bundle
780 bool Compile::starts_bundle(const Node *n) const {
781 return (_node_bundling_limit > n->_idx &&
782 _node_bundling_base[n->_idx].starts_bundle());
783 }
784
785 //--------------------------Process_OopMap_Node--------------------------------
786 void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
787
788 // Handle special safepoint nodes for synchronization
789 MachSafePointNode *sfn = mach->as_MachSafePoint();
790 MachCallNode *mcall;
791
792 #ifdef ENABLE_ZAP_DEAD_LOCALS
793 assert( is_node_getting_a_safepoint(mach), "logic does not match; false negative");
794 #endif
795
796 int safepoint_pc_offset = current_offset;
797 bool is_method_handle_invoke = false;
798
799 // Add the safepoint in the DebugInfoRecorder
800 if( !mach->is_MachCall() ) {
801 mcall = NULL;
802 debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
803 } else {
804 mcall = mach->as_MachCall();
805
806 // Is the call a MethodHandle call?
807 if (mcall->is_MachCallJava())
808 is_method_handle_invoke = mcall->as_MachCallJava()->_method_handle_invoke;
809
810 safepoint_pc_offset += mcall->ret_addr_offset();
811 debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
812 }
813
814 // Loop over the JVMState list to add scope information
815 // Do not skip safepoints with a NULL method, they need monitor info
816 JVMState* youngest_jvms = sfn->jvms();
817 int max_depth = youngest_jvms->depth();
818
819 // Allocate the object pool for scalar-replaced objects -- the map from
820 // small-integer keys (which can be recorded in the local and ostack
821 // arrays) to descriptions of the object state.
822 GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
823
824 // Visit scopes from oldest to youngest.
825 for (int depth = 1; depth <= max_depth; depth++) {
826 JVMState* jvms = youngest_jvms->of_depth(depth);
827 int idx;
828 ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
829 // Safepoints that do not have method() set only provide oop-map and monitor info
902 OptoReg::Name box_reg = BoxLockNode::stack_slot(box_node);
903 Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg));
904 while( !box_node->is_BoxLock() ) box_node = box_node->in(1);
905 monarray->append(new MonitorValue(scval, basic_lock, box_node->as_BoxLock()->is_eliminated()));
906 }
907
908 // We dump the object pool first, since deoptimization reads it in first.
909 debug_info()->dump_object_pool(objs);
910
911 // Build first class objects to pass to scope
912 DebugToken *locvals = debug_info()->create_scope_values(locarray);
913 DebugToken *expvals = debug_info()->create_scope_values(exparray);
914 DebugToken *monvals = debug_info()->create_monitor_values(monarray);
915
916 // Make method available for all Safepoints
917 ciMethod* scope_method = method ? method : _method;
918 // Describe the scope here
919 assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
920 assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
921 // Now we can describe the scope.
922 debug_info()->describe_scope(safepoint_pc_offset, scope_method, jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, locvals, expvals, monvals);
923 } // End jvms loop
924
925 // Mark the end of the scope set.
926 debug_info()->end_safepoint(safepoint_pc_offset);
927 }
928
929
930
931 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
932 class NonSafepointEmitter {
933 Compile* C;
934 JVMState* _pending_jvms;
935 int _pending_offset;
936
937 void emit_non_safepoint();
938
939 public:
940 NonSafepointEmitter(Compile* compile) {
941 this->C = compile;
|