< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/debugInfo.hpp"
  27 #include "oops/oop.inline.hpp"

  28 #include "runtime/frame.inline.hpp"
  29 #include "runtime/handles.inline.hpp"
  30 #include "runtime/stackValue.hpp"
  31 
  32 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
  33   if (sv->is_location()) {
  34     // Stack or register value
  35     Location loc = ((LocationValue *)sv)->location();
  36 
  37 #ifdef SPARC
  38     // %%%%% Callee-save floats will NOT be working on a Sparc until we
  39     // handle the case of a 2 floats in a single double register.
  40     assert( !(loc.is_register() && loc.type() == Location::float_in_dbl), "Sparc does not handle callee-save floats yet" );
  41 #endif // SPARC
  42 
  43     // First find address of value
  44 
  45     address value_addr = loc.is_register()
  46       // Value was in a callee-save register
  47       ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()))


  86 #ifdef _LP64
  87     case Location::dbl:
  88       // Double value in an aligned adjacent pair
  89       return new StackValue(*(intptr_t*)value_addr);
  90     case Location::lng:
  91       // Long   value in an aligned adjacent pair
  92       return new StackValue(*(intptr_t*)value_addr);
  93     case Location::narrowoop: {
  94       union { intptr_t p; narrowOop noop;} value;
  95       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
  96       if (loc.is_register()) {
  97         // The callee has no clue whether the register holds an int,
  98         // long or is unused.  He always saves a long.  Here we know
  99         // a long was saved, but we only want an int back.  Narrow the
 100         // saved long to the int that the JVM wants.
 101         value.noop =  (narrowOop) *(julong*) value_addr;
 102       } else {
 103         value.noop = *(narrowOop*) value_addr;
 104       }
 105       // Decode narrowoop and wrap a handle around the oop
 106       Handle h(Thread::current(), oopDesc::decode_heap_oop(value.noop));
 107       return new StackValue(h);
 108     }
 109 #endif
 110     case Location::oop: {
 111       oop val = *(oop *)value_addr;
 112 #ifdef _LP64
 113       if (Universe::is_narrow_oop_base(val)) {
 114          // Compiled code may produce decoded oop = narrow_oop_base
 115          // when a narrow oop implicit null check is used.
 116          // The narrow_oop_base could be NULL or be the address
 117          // of the page below heap. Use NULL value for both cases.
 118          val = (oop)NULL;
 119       }
 120 #endif
 121       Handle h(Thread::current(), val); // Wrap a handle around the oop
 122       return new StackValue(h);
 123     }
 124     case Location::addr: {
 125       ShouldNotReachHere(); // both C1 and C2 now inline jsrs
 126     }




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/debugInfo.hpp"
  27 #include "oops/compressedOops.inline.hpp"
  28 #include "oops/oop.hpp"
  29 #include "runtime/frame.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/stackValue.hpp"
  32 
  33 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
  34   if (sv->is_location()) {
  35     // Stack or register value
  36     Location loc = ((LocationValue *)sv)->location();
  37 
  38 #ifdef SPARC
  39     // %%%%% Callee-save floats will NOT be working on a Sparc until we
  40     // handle the case of a 2 floats in a single double register.
  41     assert( !(loc.is_register() && loc.type() == Location::float_in_dbl), "Sparc does not handle callee-save floats yet" );
  42 #endif // SPARC
  43 
  44     // First find address of value
  45 
  46     address value_addr = loc.is_register()
  47       // Value was in a callee-save register
  48       ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()))


  87 #ifdef _LP64
  88     case Location::dbl:
  89       // Double value in an aligned adjacent pair
  90       return new StackValue(*(intptr_t*)value_addr);
  91     case Location::lng:
  92       // Long   value in an aligned adjacent pair
  93       return new StackValue(*(intptr_t*)value_addr);
  94     case Location::narrowoop: {
  95       union { intptr_t p; narrowOop noop;} value;
  96       value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF);
  97       if (loc.is_register()) {
  98         // The callee has no clue whether the register holds an int,
  99         // long or is unused.  He always saves a long.  Here we know
 100         // a long was saved, but we only want an int back.  Narrow the
 101         // saved long to the int that the JVM wants.
 102         value.noop =  (narrowOop) *(julong*) value_addr;
 103       } else {
 104         value.noop = *(narrowOop*) value_addr;
 105       }
 106       // Decode narrowoop and wrap a handle around the oop
 107       Handle h(Thread::current(), CompressedOops::decode(value.noop));
 108       return new StackValue(h);
 109     }
 110 #endif
 111     case Location::oop: {
 112       oop val = *(oop *)value_addr;
 113 #ifdef _LP64
 114       if (Universe::is_narrow_oop_base(val)) {
 115          // Compiled code may produce decoded oop = narrow_oop_base
 116          // when a narrow oop implicit null check is used.
 117          // The narrow_oop_base could be NULL or be the address
 118          // of the page below heap. Use NULL value for both cases.
 119          val = (oop)NULL;
 120       }
 121 #endif
 122       Handle h(Thread::current(), val); // Wrap a handle around the oop
 123       return new StackValue(h);
 124     }
 125     case Location::addr: {
 126       ShouldNotReachHere(); // both C1 and C2 now inline jsrs
 127     }


< prev index next >