< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page
@@ -20,38 +20,36 @@
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   *
   */
  
+ #include "oops/access.hpp"
  #include "precompiled.hpp"
  #include "code/debugInfo.hpp"
  #include "oops/compressedOops.inline.hpp"
  #include "oops/oop.hpp"
  #include "runtime/frame.inline.hpp"
+ #include "runtime/globals.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/stackValue.hpp"
  #if INCLUDE_ZGC
  #include "gc/z/zBarrier.inline.hpp"
  #endif
  #if INCLUDE_SHENANDOAHGC
  #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
  #endif
  
- StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
+ 
+ template StackValue* StackValue::create_stack_value(ScopeValue*, address, const RegisterMap*);
+ template StackValue* StackValue::create_stack_value(ScopeValue*, address, const SmallRegisterMap*);
+ 
+ template<typename RegisterMapT>
+ StackValue* StackValue::create_stack_value(ScopeValue* sv, address value_addr, const RegisterMapT* reg_map) {
    if (sv->is_location()) {
      // Stack or register value
      Location loc = ((LocationValue *)sv)->location();
  
-     // First find address of value
- 
-     address 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();
- 
      // Then package it right depending on type
      // Note: the transfer of the data is thru a union that contains
      // an intptr_t. This is because an interpreter stack slot is
      // really an intptr_t. The use of a union containing an intptr_t
      // ensures that on a 64 bit platform we have proper alignment

@@ -90,10 +88,11 @@
        return new StackValue(*(intptr_t*)value_addr);
      case Location::lng:
        // Long   value in an aligned adjacent pair
        return new StackValue(*(intptr_t*)value_addr);
      case Location::narrowoop: {
+       assert (UseCompressedOops, "");
        union { intptr_t p; narrowOop noop;} value;
        value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
        if (loc.is_register()) {
          // The callee has no clue whether the register holds an int,
          // long or is unused.  He always saves a long.  Here we know

@@ -108,37 +107,37 @@
          value.noop = *(narrowOop*) value_addr;
        }
        // Decode narrowoop
        oop val = CompressedOops::decode(value.noop);
        // Deoptimization must make sure all oops have passed load barriers
- #if INCLUDE_SHENANDOAHGC
-       if (UseShenandoahGC) {
-         val = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(val);
-       }
- #endif
+       // TODO: Erik: remove after integration with concurrent stack scanning
+       // TODO: HeapAccess when in_cont?
+       val = NativeAccess<>::oop_load(&val);
        Handle h(Thread::current(), val); // Wrap a handle around the oop
        return new StackValue(h);
      }
  #endif
      case Location::oop: {
-       oop val = *(oop *)value_addr;
+       oop val;
+       if (reg_map->in_cont() && reg_map->stack_chunk()->has_bitmap() && UseCompressedOops) {
+         val = CompressedOops::decode(*(narrowOop*)value_addr);
+       } else {
+         val = *(oop *)value_addr;
+       }
  #ifdef _LP64
        if (CompressedOops::is_base(val)) {
           // Compiled code may produce decoded oop = narrow_oop_base
           // when a narrow oop implicit null check is used.
           // The narrow_oop_base could be NULL or be the address
           // of the page below heap. Use NULL value for both cases.
           val = (oop)NULL;
        }
  #endif
        // Deoptimization must make sure all oops have passed load barriers
- #if INCLUDE_SHENANDOAHGC
-       if (UseShenandoahGC) {
-         val = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(val);
-       }
- #endif
-       assert(oopDesc::is_oop_or_null(val, false), "bad oop found");
+       // TODO: Erik: remove after integration with concurrent stack scanning
+       val = NativeAccess<>::oop_load(&val);
+       assert(oopDesc::is_oop_or_null(val), "bad oop found at " INTPTR_FORMAT, p2i(value_addr));
        Handle h(Thread::current(), val); // Wrap a handle around the oop
        return new StackValue(h);
      }
      case Location::addr: {
        loc.print_on(tty);
< prev index next >