709 break;
710 }
711 }
712
713 // Determine if this node starts a bundle
714 bool Compile::starts_bundle(const Node *n) const {
715 return (_node_bundling_limit > n->_idx &&
716 _node_bundling_base[n->_idx].starts_bundle());
717 }
718
719 //--------------------------Process_OopMap_Node--------------------------------
720 void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
721
722 // Handle special safepoint nodes for synchronization
723 MachSafePointNode *sfn = mach->as_MachSafePoint();
724 MachCallNode *mcall;
725
726 int safepoint_pc_offset = current_offset;
727 bool is_method_handle_invoke = false;
728 bool return_oop = false;
729
730 // Add the safepoint in the DebugInfoRecorder
731 if( !mach->is_MachCall() ) {
732 mcall = NULL;
733 debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
734 } else {
735 mcall = mach->as_MachCall();
736
737 // Is the call a MethodHandle call?
738 if (mcall->is_MachCallJava()) {
739 if (mcall->as_MachCallJava()->_method_handle_invoke) {
740 assert(has_method_handle_invokes(), "must have been set during call generation");
741 is_method_handle_invoke = true;
742 }
743 }
744
745 // Check if a call returns an object.
746 if (mcall->returns_pointer()) {
747 return_oop = true;
748 }
749 safepoint_pc_offset += mcall->ret_addr_offset();
750 debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
751 }
752
753 // Loop over the JVMState list to add scope information
754 // Do not skip safepoints with a NULL method, they need monitor info
755 JVMState* youngest_jvms = sfn->jvms();
756 int max_depth = youngest_jvms->depth();
757
758 // Allocate the object pool for scalar-replaced objects -- the map from
759 // small-integer keys (which can be recorded in the local and ostack
760 // arrays) to descriptions of the object state.
761 GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
762
763 // Visit scopes from oldest to youngest.
764 for (int depth = 1; depth <= max_depth; depth++) {
765 JVMState* jvms = youngest_jvms->of_depth(depth);
766 int idx;
767 ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
768 // Safepoints that do not have method() set only provide oop-map and monitor info
843 bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
844 monarray->append(new MonitorValue(scval, basic_lock, eliminated));
845 }
846
847 // We dump the object pool first, since deoptimization reads it in first.
848 debug_info()->dump_object_pool(objs);
849
850 // Build first class objects to pass to scope
851 DebugToken *locvals = debug_info()->create_scope_values(locarray);
852 DebugToken *expvals = debug_info()->create_scope_values(exparray);
853 DebugToken *monvals = debug_info()->create_monitor_values(monarray);
854
855 // Make method available for all Safepoints
856 ciMethod* scope_method = method ? method : _method;
857 // Describe the scope here
858 assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
859 assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
860 // Now we can describe the scope.
861 methodHandle null_mh;
862 bool rethrow_exception = false;
863 debug_info()->describe_scope(safepoint_pc_offset, null_mh, scope_method, jvms->bci(), jvms->should_reexecute(), rethrow_exception, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
864 } // End jvms loop
865
866 // Mark the end of the scope set.
867 debug_info()->end_safepoint(safepoint_pc_offset);
868 }
869
870
871
872 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
873 class NonSafepointEmitter {
874 Compile* C;
875 JVMState* _pending_jvms;
876 int _pending_offset;
877
878 void emit_non_safepoint();
879
880 public:
881 NonSafepointEmitter(Compile* compile) {
882 this->C = compile;
883 _pending_jvms = NULL;
|
709 break;
710 }
711 }
712
713 // Determine if this node starts a bundle
714 bool Compile::starts_bundle(const Node *n) const {
715 return (_node_bundling_limit > n->_idx &&
716 _node_bundling_base[n->_idx].starts_bundle());
717 }
718
719 //--------------------------Process_OopMap_Node--------------------------------
720 void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
721
722 // Handle special safepoint nodes for synchronization
723 MachSafePointNode *sfn = mach->as_MachSafePoint();
724 MachCallNode *mcall;
725
726 int safepoint_pc_offset = current_offset;
727 bool is_method_handle_invoke = false;
728 bool return_oop = false;
729 bool return_vt = false;
730
731 // Add the safepoint in the DebugInfoRecorder
732 if( !mach->is_MachCall() ) {
733 mcall = NULL;
734 debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
735 } else {
736 mcall = mach->as_MachCall();
737
738 // Is the call a MethodHandle call?
739 if (mcall->is_MachCallJava()) {
740 if (mcall->as_MachCallJava()->_method_handle_invoke) {
741 assert(has_method_handle_invokes(), "must have been set during call generation");
742 is_method_handle_invoke = true;
743 }
744 }
745
746 // Check if a call returns an object.
747 if (mcall->returns_pointer() || mcall->returns_vt()) {
748 return_oop = true;
749 }
750 if (mcall->returns_vt()) {
751 return_vt = true;
752 }
753 safepoint_pc_offset += mcall->ret_addr_offset();
754 debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
755 }
756
757 // Loop over the JVMState list to add scope information
758 // Do not skip safepoints with a NULL method, they need monitor info
759 JVMState* youngest_jvms = sfn->jvms();
760 int max_depth = youngest_jvms->depth();
761
762 // Allocate the object pool for scalar-replaced objects -- the map from
763 // small-integer keys (which can be recorded in the local and ostack
764 // arrays) to descriptions of the object state.
765 GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
766
767 // Visit scopes from oldest to youngest.
768 for (int depth = 1; depth <= max_depth; depth++) {
769 JVMState* jvms = youngest_jvms->of_depth(depth);
770 int idx;
771 ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
772 // Safepoints that do not have method() set only provide oop-map and monitor info
847 bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
848 monarray->append(new MonitorValue(scval, basic_lock, eliminated));
849 }
850
851 // We dump the object pool first, since deoptimization reads it in first.
852 debug_info()->dump_object_pool(objs);
853
854 // Build first class objects to pass to scope
855 DebugToken *locvals = debug_info()->create_scope_values(locarray);
856 DebugToken *expvals = debug_info()->create_scope_values(exparray);
857 DebugToken *monvals = debug_info()->create_monitor_values(monarray);
858
859 // Make method available for all Safepoints
860 ciMethod* scope_method = method ? method : _method;
861 // Describe the scope here
862 assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
863 assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
864 // Now we can describe the scope.
865 methodHandle null_mh;
866 bool rethrow_exception = false;
867 debug_info()->describe_scope(safepoint_pc_offset, null_mh, scope_method, jvms->bci(), jvms->should_reexecute(), rethrow_exception, is_method_handle_invoke, return_oop, return_vt, locvals, expvals, monvals);
868 } // End jvms loop
869
870 // Mark the end of the scope set.
871 debug_info()->end_safepoint(safepoint_pc_offset);
872 }
873
874
875
876 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
877 class NonSafepointEmitter {
878 Compile* C;
879 JVMState* _pending_jvms;
880 int _pending_offset;
881
882 void emit_non_safepoint();
883
884 public:
885 NonSafepointEmitter(Compile* compile) {
886 this->C = compile;
887 _pending_jvms = NULL;
|