< prev index next >

src/hotspot/share/opto/output.cpp

Print this page
rev 60137 : 8227745: Enable Escape Analysis for Better Performance in the Presence of JVMTI Agents
Reviewed-by: mdoerr, goetz


 916       ShouldNotReachHere();
 917       break;
 918   }
 919 }
 920 
 921 // Determine if this node starts a bundle
 922 bool PhaseOutput::starts_bundle(const Node *n) const {
 923   return (_node_bundling_limit > n->_idx &&
 924           _node_bundling_base[n->_idx].starts_bundle());
 925 }
 926 
 927 //--------------------------Process_OopMap_Node--------------------------------
 928 void PhaseOutput::Process_OopMap_Node(MachNode *mach, int current_offset) {
 929   // Handle special safepoint nodes for synchronization
 930   MachSafePointNode *sfn   = mach->as_MachSafePoint();
 931   MachCallNode      *mcall;
 932 
 933   int safepoint_pc_offset = current_offset;
 934   bool is_method_handle_invoke = false;
 935   bool return_oop = false;


 936 
 937   // Add the safepoint in the DebugInfoRecorder
 938   if( !mach->is_MachCall() ) {
 939     mcall = NULL;
 940     C->debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
 941   } else {
 942     mcall = mach->as_MachCall();
 943 
 944     // Is the call a MethodHandle call?
 945     if (mcall->is_MachCallJava()) {
 946       if (mcall->as_MachCallJava()->_method_handle_invoke) {
 947         assert(C->has_method_handle_invokes(), "must have been set during call generation");
 948         is_method_handle_invoke = true;
 949       }

 950     }
 951 
 952     // Check if a call returns an object.
 953     if (mcall->returns_pointer()) {
 954       return_oop = true;
 955     }
 956     safepoint_pc_offset += mcall->ret_addr_offset();
 957     C->debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
 958   }
 959 
 960   // Loop over the JVMState list to add scope information
 961   // Do not skip safepoints with a NULL method, they need monitor info
 962   JVMState* youngest_jvms = sfn->jvms();
 963   int max_depth = youngest_jvms->depth();
 964 
 965   // Allocate the object pool for scalar-replaced objects -- the map from
 966   // small-integer keys (which can be recorded in the local and ostack
 967   // arrays) to descriptions of the object state.
 968   GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
 969 


1050       bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
1051       monarray->append(new MonitorValue(scval, basic_lock, eliminated));
1052     }
1053 
1054     // We dump the object pool first, since deoptimization reads it in first.
1055     C->debug_info()->dump_object_pool(objs);
1056 
1057     // Build first class objects to pass to scope
1058     DebugToken *locvals = C->debug_info()->create_scope_values(locarray);
1059     DebugToken *expvals = C->debug_info()->create_scope_values(exparray);
1060     DebugToken *monvals = C->debug_info()->create_monitor_values(monarray);
1061 
1062     // Make method available for all Safepoints
1063     ciMethod* scope_method = method ? method : C->method();
1064     // Describe the scope here
1065     assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
1066     assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
1067     // Now we can describe the scope.
1068     methodHandle null_mh;
1069     bool rethrow_exception = false;
1070     C->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);


1071   } // End jvms loop
1072 
1073   // Mark the end of the scope set.
1074   C->debug_info()->end_safepoint(safepoint_pc_offset);
1075 }
1076 
1077 
1078 
1079 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
1080 class NonSafepointEmitter {
1081     Compile*  C;
1082     JVMState* _pending_jvms;
1083     int       _pending_offset;
1084 
1085     void emit_non_safepoint();
1086 
1087  public:
1088     NonSafepointEmitter(Compile* compile) {
1089       this->C = compile;
1090       _pending_jvms = NULL;




 916       ShouldNotReachHere();
 917       break;
 918   }
 919 }
 920 
 921 // Determine if this node starts a bundle
 922 bool PhaseOutput::starts_bundle(const Node *n) const {
 923   return (_node_bundling_limit > n->_idx &&
 924           _node_bundling_base[n->_idx].starts_bundle());
 925 }
 926 
 927 //--------------------------Process_OopMap_Node--------------------------------
 928 void PhaseOutput::Process_OopMap_Node(MachNode *mach, int current_offset) {
 929   // Handle special safepoint nodes for synchronization
 930   MachSafePointNode *sfn   = mach->as_MachSafePoint();
 931   MachCallNode      *mcall;
 932 
 933   int safepoint_pc_offset = current_offset;
 934   bool is_method_handle_invoke = false;
 935   bool return_oop = false;
 936   bool not_global_escape_in_scope = sfn->_not_global_escape_in_scope;
 937   bool arg_escape = false;
 938 
 939   // Add the safepoint in the DebugInfoRecorder
 940   if( !mach->is_MachCall() ) {
 941     mcall = NULL;
 942     C->debug_info()->add_safepoint(safepoint_pc_offset, sfn->_oop_map);
 943   } else {
 944     mcall = mach->as_MachCall();
 945 
 946     // Is the call a MethodHandle call?
 947     if (mcall->is_MachCallJava()) {
 948       if (mcall->as_MachCallJava()->_method_handle_invoke) {
 949         assert(C->has_method_handle_invokes(), "must have been set during call generation");
 950         is_method_handle_invoke = true;
 951       }
 952       arg_escape = mcall->as_MachCallJava()->_arg_escape;
 953     }
 954 
 955     // Check if a call returns an object.
 956     if (mcall->returns_pointer()) {
 957       return_oop = true;
 958     }
 959     safepoint_pc_offset += mcall->ret_addr_offset();
 960     C->debug_info()->add_safepoint(safepoint_pc_offset, mcall->_oop_map);
 961   }
 962 
 963   // Loop over the JVMState list to add scope information
 964   // Do not skip safepoints with a NULL method, they need monitor info
 965   JVMState* youngest_jvms = sfn->jvms();
 966   int max_depth = youngest_jvms->depth();
 967 
 968   // Allocate the object pool for scalar-replaced objects -- the map from
 969   // small-integer keys (which can be recorded in the local and ostack
 970   // arrays) to descriptions of the object state.
 971   GrowableArray<ScopeValue*> *objs = new GrowableArray<ScopeValue*>();
 972 


1053       bool eliminated = (box_node->is_BoxLock() && box_node->as_BoxLock()->is_eliminated());
1054       monarray->append(new MonitorValue(scval, basic_lock, eliminated));
1055     }
1056 
1057     // We dump the object pool first, since deoptimization reads it in first.
1058     C->debug_info()->dump_object_pool(objs);
1059 
1060     // Build first class objects to pass to scope
1061     DebugToken *locvals = C->debug_info()->create_scope_values(locarray);
1062     DebugToken *expvals = C->debug_info()->create_scope_values(exparray);
1063     DebugToken *monvals = C->debug_info()->create_monitor_values(monarray);
1064 
1065     // Make method available for all Safepoints
1066     ciMethod* scope_method = method ? method : C->method();
1067     // Describe the scope here
1068     assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
1069     assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
1070     // Now we can describe the scope.
1071     methodHandle null_mh;
1072     bool rethrow_exception = false;
1073     C->debug_info()->describe_scope(safepoint_pc_offset, null_mh, scope_method, jvms->bci(), jvms->should_reexecute(), rethrow_exception, is_method_handle_invoke, return_oop,
1074                                     not_global_escape_in_scope, arg_escape,
1075                                     locvals, expvals, monvals);
1076   } // End jvms loop
1077 
1078   // Mark the end of the scope set.
1079   C->debug_info()->end_safepoint(safepoint_pc_offset);
1080 }
1081 
1082 
1083 
1084 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
1085 class NonSafepointEmitter {
1086     Compile*  C;
1087     JVMState* _pending_jvms;
1088     int       _pending_offset;
1089 
1090     void emit_non_safepoint();
1091 
1092  public:
1093     NonSafepointEmitter(Compile* compile) {
1094       this->C = compile;
1095       _pending_jvms = NULL;


< prev index next >