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())) 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(); 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 } 128 case Location::normal: { 129 // Just copy all other bits straight through 130 union { intptr_t p; jint ji;} value; 131 value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF); 132 value.ji = *(jint*)value_addr; 133 return new StackValue(value.p); 134 } 135 case Location::invalid: 136 return new StackValue(); 137 default: 138 ShouldNotReachHere(); 139 } 140 141 } else if (sv->is_constant_int()) { | 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 36 StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) { 37 if (sv->is_location()) { 38 // Stack or register value 39 Location loc = ((LocationValue *)sv)->location(); 40 41 #ifdef SPARC 42 // %%%%% Callee-save floats will NOT be working on a Sparc until we 43 // handle the case of a 2 floats in a single double register. 44 assert( !(loc.is_register() && loc.type() == Location::float_in_dbl), "Sparc does not handle callee-save floats yet" ); 45 #endif // SPARC 46 47 // First find address of value 48 49 address value_addr = loc.is_register() 50 // Value was in a callee-save register 51 ? reg_map->location(VMRegImpl::as_VMReg(loc.register_number())) 52 // Else value was directly saved on the stack. The frame's original stack pointer, 53 // before any extension by its callee (due to Compiler1 linkage on SPARC), must be used. 54 : ((address)fr->unextended_sp()) + loc.stack_offset(); 105 value.noop = (narrowOop) *(julong*) value_addr; 106 } else { 107 value.noop = *(narrowOop*) value_addr; 108 } 109 // Decode narrowoop and wrap a handle around the oop 110 Handle h(Thread::current(), CompressedOops::decode(value.noop)); 111 return new StackValue(h); 112 } 113 #endif 114 case Location::oop: { 115 oop val = *(oop *)value_addr; 116 #ifdef _LP64 117 if (Universe::is_narrow_oop_base(val)) { 118 // Compiled code may produce decoded oop = narrow_oop_base 119 // when a narrow oop implicit null check is used. 120 // The narrow_oop_base could be NULL or be the address 121 // of the page below heap. Use NULL value for both cases. 122 val = (oop)NULL; 123 } 124 #endif 125 #if INCLUDE_ZGC 126 // Deoptimization must make sure all oop have passed load barrier 127 if (UseZGC) { 128 val = ZBarrier::load_barrier_on_oop_field_preloaded((oop*)value_addr, val); 129 } 130 #endif 131 132 Handle h(Thread::current(), val); // Wrap a handle around the oop 133 return new StackValue(h); 134 } 135 case Location::addr: { 136 ShouldNotReachHere(); // both C1 and C2 now inline jsrs 137 } 138 case Location::normal: { 139 // Just copy all other bits straight through 140 union { intptr_t p; jint ji;} value; 141 value.p = (intptr_t) CONST64(0xDEADDEAFDEADDEAF); 142 value.ji = *(jint*)value_addr; 143 return new StackValue(value.p); 144 } 145 case Location::invalid: 146 return new StackValue(); 147 default: 148 ShouldNotReachHere(); 149 } 150 151 } else if (sv->is_constant_int()) { |