src/share/vm/runtime/vframe.cpp

Print this page
rev 6212 : 8038624: interpretedVFrame::expressions() must respect InterpreterOopMap for liveness
Reviewed-by:

@@ -320,27 +320,36 @@
     }
   }
 }
 
 StackValueCollection*  interpretedVFrame::expressions() const {
-  int length = fr().interpreter_frame_expression_stack_size();
-  if (method()->is_native()) {
-    // If the method is native, there is no expression stack
-    length = 0;
-  }
-
-  int nof_locals = method()->max_locals();
-  StackValueCollection* result = new StackValueCollection(length);
 
   InterpreterOopMap oop_mask;
+
+  if (!method()->is_native()) {
   // Get oopmap describing oops and int for current bci
   if (TraceDeoptimization && Verbose) {
     methodHandle m_h(method());
     OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
   } else {
     method()->mask_for(bci(), &oop_mask);
   }
+  }
+
+  int length = oop_mask.expression_stack_size();
+
+  assert(fr().interpreter_frame_expression_stack_size() >= length,
+    "error in expression stack!");
+
+  StackValueCollection* result = new StackValueCollection(length);
+
+  if (0 == length) {
+    return result;
+  }
+
+  int nof_locals = method()->max_locals();
+
   // handle expressions
   for(int i=0; i < length; i++) {
     // Find stack location
     intptr_t *addr = fr().interpreter_frame_expression_stack_at(i);