< prev index next >

src/hotspot/share/runtime/stackValue.cpp

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   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 #if INCLUDE_ZGC
  33 #include "gc/z/zBarrier.inline.hpp"
  34 #endif
  35 #if INCLUDE_SHENANDOAHGC
  36 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
  37 #endif
  38 
  39 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
  40   if (sv->is_location()) {
  41     // Stack or register value
  42     Location loc = ((LocationValue *)sv)->location();
  43 
  44 #ifdef SPARC
  45     // %%%%% Callee-save floats will NOT be working on a Sparc until we
  46     // handle the case of a 2 floats in a single double register.
  47     assert( !(loc.is_register() && loc.type() == Location::float_in_dbl), "Sparc does not handle callee-save floats yet" );
  48 #endif // SPARC
  49 
  50     // First find address of value
  51 
  52     address value_addr = loc.is_register()
  53       // Value was in a callee-save register
  54       ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number()))
  55       // Else value was directly saved on the stack. The frame's original stack pointer,
  56       // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used.
  57       : ((address)fr->unextended_sp()) + loc.stack_offset();
  58 
  59     // Then package it right depending on type
  60     // Note: the transfer of the data is thru a union that contains
  61     // an intptr_t. This is because an interpreter stack slot is
  62     // really an intptr_t. The use of a union containing an intptr_t
  63     // ensures that on a 64 bit platform we have proper alignment
  64     // and that we store the value where the interpreter will expect
  65     // to find it (i.e. proper endian). Similarly on a 32bit platform
  66     // using the intptr_t ensures that when a value is larger than
  67     // a stack slot (jlong/jdouble) that we capture the proper part
  68     // of the value for the stack slot in question.


   1 /*
   2  * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   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 #if INCLUDE_ZGC
  33 #include "gc/z/zBarrier.inline.hpp"
  34 #endif
  35 #if INCLUDE_SHENANDOAHGC
  36 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
  37 #endif
  38 
  39 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
  40   if (sv->is_location()) {
  41     // Stack or register value
  42     Location loc = ((LocationValue *)sv)->location();






  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()))
  49       // Else value was directly saved on the stack. The frame's original stack pointer,
  50       // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used.
  51       : ((address)fr->unextended_sp()) + loc.stack_offset();
  52 
  53     // Then package it right depending on type
  54     // Note: the transfer of the data is thru a union that contains
  55     // an intptr_t. This is because an interpreter stack slot is
  56     // really an intptr_t. The use of a union containing an intptr_t
  57     // ensures that on a 64 bit platform we have proper alignment
  58     // and that we store the value where the interpreter will expect
  59     // to find it (i.e. proper endian). Similarly on a 32bit platform
  60     // using the intptr_t ensures that when a value is larger than
  61     // a stack slot (jlong/jdouble) that we capture the proper part
  62     // of the value for the stack slot in question.


< prev index next >