< prev index next >

src/hotspot/share/runtime/stackValue.hpp

Print this page

        

@@ -23,16 +23,16 @@
  */
 
 #ifndef SHARE_RUNTIME_STACKVALUE_HPP
 #define SHARE_RUNTIME_STACKVALUE_HPP
 
+#include "code/debugInfo.hpp"
 #include "code/location.hpp"
 #include "runtime/handles.hpp"
 
 class BasicLock;
 class RegisterMap;
-class ScopeValue;
 
 class StackValue : public ResourceObj {
  private:
   BasicType _type;
   intptr_t  _integer_value; // Blank java stack slot value

@@ -105,16 +105,51 @@
       // [phh] compare only low addressed portions of intptr_t slots
       return (*(int *)&_integer_value == *(int *)&value->_integer_value);
     }
   }
 
-  static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
   static BasicLock*  resolve_monitor_lock(const frame* fr, Location location);
 
+  template<typename RegisterMapT>
+  static StackValue* create_stack_value(const frame* fr, const RegisterMapT* reg_map, ScopeValue* sv) {
+    return create_stack_value(sv, stack_value_address(fr, reg_map, sv), reg_map->in_cont());
+  }
+
+  template<typename RegisterMapT>
+  static address stack_value_address(const frame* fr, const RegisterMapT* reg_map, ScopeValue* sv) {
+    if (!sv->is_location())
+      return NULL;
+    Location loc = ((LocationValue *)sv)->location();
+    if (loc.type() == Location::invalid)
+      return NULL;
+    
+    address value_addr;
+    if (!reg_map->in_cont()) {
+      value_addr = loc.is_register()
+          // Value was in a callee-save register
+          ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()))
+          // Else value was directly saved on the stack. The frame's original stack pointer,
+          // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used.
+          : ((address)fr->unextended_sp()) + loc.stack_offset();
+
+      assert(value_addr == NULL || reg_map->thread()->is_in_usable_stack(value_addr), INTPTR_FORMAT, p2i(value_addr));
+    } else {
+      value_addr = loc.is_register()
+          ? Continuation::reg_to_location(*fr, reg_map->as_RegisterMap(), VMRegImpl::as_VMReg(loc.register_number()), loc.type() == Location::oop || loc.type() == Location::narrowoop)
+          : Continuation::usp_offset_to_location(*fr, reg_map->as_RegisterMap(), loc.stack_offset(), loc.type() == Location::oop || loc.type() == Location::narrowoop);
+        
+      assert(value_addr == NULL || Continuation::is_in_usable_stack(value_addr, reg_map->as_RegisterMap()), INTPTR_FORMAT, p2i(value_addr));
+    }
+    return value_addr;
+  }
+
 #ifndef PRODUCT
  public:
   // Printing
   void print_on(outputStream* st) const;
 #endif
+
+private:
+  static StackValue* create_stack_value(ScopeValue* sv, address value_addr, bool in_cont);
 };
 
 #endif // SHARE_RUNTIME_STACKVALUE_HPP
< prev index next >