< prev index next >

src/share/vm/opto/output.cpp

Print this page

        

@@ -982,49 +982,56 @@
 
 // A simplified version of Process_OopMap_Node, to handle non-safepoints.
 class NonSafepointEmitter {
   Compile*  C;
   JVMState* _pending_jvms;
-  int       _pending_offset;
+  int       _pending_begin_offset;
+  int       _pending_end_offset;
 
   void emit_non_safepoint();
 
  public:
   NonSafepointEmitter(Compile* compile) {
     this->C = compile;
     _pending_jvms = NULL;
-    _pending_offset = 0;
+    _pending_begin_offset = 0;
+    _pending_end_offset = 0;
   }
 
   void observe_instruction(Node* n, int pc_offset) {
     if (!C->debug_info()->recording_non_safepoints())  return;
 
     Node_Notes* nn = C->node_notes_at(n->_idx);
     if (nn == NULL || nn->jvms() == NULL)  return;
     if (_pending_jvms != NULL &&
         _pending_jvms->same_calls_as(nn->jvms())) {
       // Repeated JVMS?  Stretch it up here.
-      _pending_offset = pc_offset;
+      _pending_end_offset = pc_offset;
     } else {
-      if (_pending_jvms != NULL &&
-          _pending_offset < pc_offset) {
+      if (_pending_jvms != NULL) {
+        if (_pending_end_offset < pc_offset) {
         emit_non_safepoint();
+        } else if (_pending_begin_offset < pc_offset) {
+          // stretch as far as possible before the conflict
+          _pending_end_offset = pc_offset - 1;
+          emit_non_safepoint();
+        }
       }
       _pending_jvms = NULL;
       if (pc_offset > C->debug_info()->last_pc_offset()) {
         // This is the only way _pending_jvms can become non-NULL:
         _pending_jvms = nn->jvms();
-        _pending_offset = pc_offset;
+        _pending_begin_offset = _pending_end_offset = pc_offset;
       }
     }
   }
 
   // Stay out of the way of real safepoints:
   void observe_safepoint(JVMState* jvms, int pc_offset) {
     if (_pending_jvms != NULL &&
         !_pending_jvms->same_calls_as(jvms) &&
-        _pending_offset < pc_offset) {
+        _pending_end_offset < pc_offset) {
       emit_non_safepoint();
     }
     _pending_jvms = NULL;
   }
 

@@ -1036,11 +1043,11 @@
   }
 };
 
 void NonSafepointEmitter::emit_non_safepoint() {
   JVMState* youngest_jvms = _pending_jvms;
-  int       pc_offset     = _pending_offset;
+  int       pc_offset     = _pending_end_offset;
 
   // Clear it now:
   _pending_jvms = NULL;
 
   DebugInformationRecorder* debug_info = C->debug_info();
< prev index next >