/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "code/debugInfo.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/stackValue.hpp"
StackValue* StackValue::create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv) {
if (sv->is_location()) {
// Stack or register value
#ifdef SPARC
// %%%%% Callee-save floats will NOT be working on a Sparc until we
// handle the case of a 2 floats in a single double register.
assert( !(loc.is_register() && loc.type() == Location::float_in_dbl), "Sparc does not handle callee-save floats yet" );
#endif // SPARC
// First find address of value
// Value was in a callee-save register
// 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.
// 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
// and that we store the value where the interpreter will expect
// to find it (i.e. proper endian). Similarly on a 32bit platform
// using the intptr_t ensures that when a value is larger than
// of the value for the stack slot in question.
//
// The callee has no clue whether the register holds a float,
// double or is unused. He always saves a double. Here we know
// a double was saved, but we only want a float back. Narrow the
// saved double to the float that the JVM wants.
}
// The callee has no clue whether the register holds an int,
// long or is unused. He always saves a long. Here we know
// a long was saved, but we only want an int back. Narrow the
// saved long to the int that the JVM wants.
}
#ifdef _LP64
// Double value in an aligned adjacent pair
// Long value in an aligned adjacent pair
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
// a long was saved, but we only want an int back. Narrow the
// saved long to the int that the JVM wants.
} else {
}
// Decode narrowoop and wrap a handle around the oop
return new StackValue(h);
}
#endif
#ifdef _LP64
// 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.
}
#endif
return new StackValue(h);
}
ShouldNotReachHere(); // both C1 and C2 now inline jsrs
}
// Just copy all other bits straight through
return new StackValue(value.p);
}
return new StackValue();
default:
}
} else if (sv->is_constant_int()) {
// Constant int: treat same as register int.
return new StackValue(value.p);
} else if (sv->is_constant_oop()) {
// constant oop
#ifdef _LP64
} else if (sv->is_constant_double()) {
// Constant double in a single stack slot
return new StackValue(value.p);
} else if (sv->is_constant_long()) {
// Constant long in a single stack slot
return new StackValue(value.p);
#endif
}
// Unknown ScopeValue type
}
// (stack picture)
// high: [ ] word_offset + 1
// low [ ] word_offset
//
// sp-> [ ] 0
// the word_offset is the distance from the stack pointer to the lowest address
// The frame's original stack pointer, before any extension by its callee
// (due to Compiler1 linkage on SPARC), must be used.
}
#ifndef PRODUCT
switch(_type) {
case T_INT:
break;
case T_OBJECT:
break;
case T_CONFLICT:
break;
default:
}
}
#endif