6953477: Increase portability and flexibility of building Hotspot

A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail.

Reviewed-by: phh, never, coleenp, dholmes
This commit is contained in:
Bob Vandette 2010-08-03 08:13:38 -04:00
parent c45761e2a8
commit b95c7e9523
113 changed files with 1669 additions and 559 deletions

View File

@ -253,7 +253,11 @@ static bool read_lib_info(struct ps_prochandle* ph) {
if (nwords > 5 && find_lib(ph, word[5]) == false) {
intptr_t base;
lib_info* lib;
#ifdef _LP64
sscanf(word[0], "%lx", &base);
#else
sscanf(word[0], "%x", &base);
#endif
if ((lib = add_lib_info(ph, word[5], (uintptr_t)base)) == NULL)
continue; // ignore, add_lib_info prints error

View File

@ -90,9 +90,15 @@ ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero
JDK_DIRS=bin include jre lib demo
all: all_product all_fastdebug
ifndef BUILD_CLIENT_ONLY
all_product: product product1 productkernel docs export_product
all_fastdebug: fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
all_debug: jvmg jvmg1 jvmgkernel docs export_debug
else
all_product: product1 docs export_product
all_fastdebug: fastdebug1 docs export_fastdebug
all_debug: jvmg1 docs export_debug
endif
all_optimized: optimized optimized1 optimizedkernel docs export_optimized
allzero: all_productzero all_fastdebugzero
@ -295,6 +301,8 @@ $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so
$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so
$(install-file)
else
$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C1_DIR)/%.so
$(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so
$(install-file)
$(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so

View File

@ -192,13 +192,16 @@ ifneq ($(OSNAME),windows)
# Use uname output for SRCARCH, but deal with platform differences. If ARCH
# is not explicitly listed below, it is treated as x86.
SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 zero,$(ARCH)))
SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 arm ppc zero,$(ARCH)))
ARCH/ = x86
ARCH/sparc = sparc
ARCH/sparc64= sparc
ARCH/ia64 = ia64
ARCH/amd64 = x86
ARCH/x86_64 = x86
ARCH/ppc64 = ppc
ARCH/ppc = ppc
ARCH/arm = arm
ARCH/zero = zero
# BUILDARCH is usually the same as SRCARCH, except for sparcv9
@ -223,6 +226,9 @@ ifneq ($(OSNAME),windows)
LIBARCH/sparc = sparc
LIBARCH/sparcv9 = sparcv9
LIBARCH/ia64 = ia64
LIBARCH/ppc64 = ppc
LIBARCH/ppc = ppc
LIBARCH/arm = arm
LIBARCH/zero = $(ZERO_LIBARCH)
LP64_ARCH = sparcv9 amd64 ia64 zero

View File

@ -1,5 +1,12 @@
#!/bin/sh
nm --defined-only $* | awk '
# If we're cross compiling use that path for nm
if [ "$ALT_COMPILER_PATH" != "" ]; then
NM=$ALT_COMPILER_PATH/nm
else
NM=nm
fi
$NM --defined-only $* | awk '
{ if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" }
'

View File

@ -339,12 +339,16 @@ JAVA_FLAG/64 = -d64
WRONG_DATA_MODE_MSG = \
echo "JAVA_HOME must point to $(DATA_MODE)bit JDK."
CROSS_COMPILING_MSG = \
echo "Cross compiling for ARCH $(CROSS_COMPILE_ARCH), skipping gamma run."
test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java
@echo Creating $@ ...
$(QUIETLY) ( \
echo '#!/bin/sh'; \
$(BUILDTREE_COMMENT); \
echo '. ./env.sh'; \
echo "if [ \"$(CROSS_COMPILE_ARCH)\" != \"\" ]; then { $(CROSS_COMPILING_MSG); exit 0; }; fi"; \
echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \
echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>&1 > /dev/null"; \
echo "then"; \

View File

@ -98,6 +98,22 @@ ifeq ($(ARCH), i686)
HS_ARCH = x86
endif
# ARM
ifeq ($(ARCH), arm)
ARCH_DATA_MODEL = 32
PLATFORM = linux-arm
VM_PLATFORM = linux_arm
HS_ARCH = arm
endif
# PPC
ifeq ($(ARCH), ppc)
ARCH_DATA_MODEL = 32
PLATFORM = linux-ppc
VM_PLATFORM = linux_ppc
HS_ARCH = ppc
endif
JDK_INCLUDE_SUBDIR=linux
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms
@ -107,22 +123,32 @@ EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
# client and server subdirectories have symbolic links to ../libjsig.so
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
ifndef BUILD_CLIENT_ONLY
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
endif
ifneq ($(ZERO_BUILD), true)
ifeq ($(ARCH_DATA_MODEL), 32)
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
else
ifeq ($(ARCH),ia64)
else
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
endif
endif
endif
# Serviceability Binaries
# No SA Support for PPC, IA64, ARM or zero
ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
$(EXPORT_LIB_DIR)/sa-jdi.jar
ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
$(EXPORT_LIB_DIR)/sa-jdi.jar
ADD_SA_BINARIES/ppc =
ADD_SA_BINARIES/ia64 =
ADD_SA_BINARIES/arm =
ADD_SA_BINARIES/zero =
EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))

View File

@ -25,8 +25,14 @@
#------------------------------------------------------------------------
# CC, CPP & AS
ifdef ALT_COMPILER_PATH
CPP = $(ALT_COMPILER_PATH)/g++
CC = $(ALT_COMPILER_PATH)/gcc
else
CPP = g++
CC = gcc
endif
AS = $(CC) -c
# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
@ -67,18 +73,31 @@ ARCHFLAG/amd64 = -m64
ARCHFLAG/ia64 =
ARCHFLAG/sparc = -m32 -mcpu=v9
ARCHFLAG/sparcv9 = -m64 -mcpu=v9
ARCHFLAG/arm = -fsigned-char
ARCHFLAG/zero = $(ZERO_ARCHFLAG)
ifndef E500V2
ARCHFLAG/ppc = -mcpu=powerpc
endif
CFLAGS += $(ARCHFLAG)
AOUT_FLAGS += $(ARCHFLAG)
LFLAGS += $(ARCHFLAG)
ASFLAGS += $(ARCHFLAG)
ifdef E500V2
CFLAGS += -DE500V2
endif
# Use C++ Interpreter
ifdef CC_INTERP
CFLAGS += -DCC_INTERP
endif
# Build for embedded targets
ifdef JAVASE_EMBEDDED
CFLAGS += -DJAVASE_EMBEDDED
endif
# Keep temporary files (.ii, .s)
ifdef NEED_ASM
CFLAGS += -save-temps
@ -171,6 +190,8 @@ AOUT_FLAGS += -export-dynamic
# Note: The Itanium gcc compiler crashes when using -gstabs.
DEBUG_CFLAGS/ia64 = -g
DEBUG_CFLAGS/amd64 = -g
DEBUG_CFLAGS/arm = -g
DEBUG_CFLAGS/ppc = -g
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
DEBUG_CFLAGS += -gstabs
@ -181,3 +202,15 @@ ifeq ($(DEBUG_BINARIES), true)
DEBUG_CFLAGS = -g
CFLAGS += $(DEBUG_CFLAGS)
endif
# If we are building HEADLESS, pass on to VM
# so it can set the java.awt.headless property
ifdef HEADLESS
CFLAGS += -DHEADLESS
endif
# We are building Embedded for a small device
# favor code space over speed
ifdef MINIMIZE_RAM_USAGE
CFLAGS += -DMINIMIZE_RAM_USAGE
endif

View File

@ -46,7 +46,11 @@ VERSION = optimized
# use -g to strip library as -x will discard its symbol table; -x is fine for
# executables.
STRIP = strip
ifdef CROSS_COMPILE_ARCH
STRIP = $(ALT_COMPILER_PATH)/strip
else
STRIP = strip
endif
STRIP_LIBJVM = $(STRIP) -g $@ || exit 1;
STRIP_AOUT = $(STRIP) -x $@ || exit 1;

View File

@ -55,10 +55,13 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE
SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
# if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium or zero.
# also, we don't build SA on Itanium, PowerPC, ARM or zero.
all:
if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
-a "$(SRCARCH)" != "arm" \
-a "$(SRCARCH)" != "ppc" \
-a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
fi

View File

@ -53,10 +53,10 @@ ifeq ($(DEBUG_BINARIES), true)
endif
# if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium or zero.
# also, we don't build SA on Itanium, PPC, ARM or zero.
checkAndBuildSA:
$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "arm" -a "$(SRCARCH)" != "ppc" -a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f vm.make $(LIBSAPROC); \
fi

View File

@ -98,6 +98,7 @@ CFLAGS += $(CFLAGS/NOEX)
# Extra flags from gnumake's invocation or environment
CFLAGS += $(EXTRA_CFLAGS)
LFLAGS += $(EXTRA_CFLAGS)
LIBS += -lm -ldl -lpthread
@ -210,15 +211,17 @@ $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
$(LINK_LIB.CC/POST_HOOK) \
rm -f $@.1; ln -s $@ $@.1; \
[ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
if [ -x /usr/sbin/selinuxenabled ] ; then \
/usr/sbin/selinuxenabled; \
if [ $$? = 0 ] ; then \
/usr/bin/chcon -t textrel_shlib_t $@; \
if [ $$? != 0 ]; then \
echo "ERROR: Cannot chcon $@"; \
fi \
fi \
fi \
if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \
if [ -x /usr/sbin/selinuxenabled ] ; then \
/usr/sbin/selinuxenabled; \
if [ $$? = 0 ] ; then \
/usr/bin/chcon -t textrel_shlib_t $@; \
if [ $$? != 0 ]; then \
echo "ERROR: Cannot chcon $@"; \
fi \
fi \
fi \
fi \
}
DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)

View File

@ -70,20 +70,24 @@ EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
ifneq ($(BUILD_CLIENT_ONLY),true)
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.so
endif
ifeq ($(ARCH_DATA_MODEL), 32)
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.so
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.so
ifneq ($(BUILD_CLIENT_ONLY), true)
EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so
endif
endif
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so

View File

@ -236,19 +236,19 @@ inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
}
inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
return op1 << op2;
return op1 << (op2 & 0x1f);
}
inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
return op1 >> op2; // QQ op2 & 0x1f??
return op1 >> (op2 & 0x1f);
}
inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
return op1 - op2;
}
inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
return ((juint) op1) >> op2; // QQ op2 & 0x1f??
inline juint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
return ((juint) op1) >> (op2 & 0x1f);
}
inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {

View File

@ -409,7 +409,7 @@ void LIRGenerator::do_MonitorExit(MonitorExit* x) {
LIR_Opr lock = FrameMap::G1_opr;
LIR_Opr hdr = FrameMap::G3_opr;
LIR_Opr obj_temp = FrameMap::G4_opr;
monitor_exit(obj_temp, lock, hdr, x->monitor_no());
monitor_exit(obj_temp, lock, hdr, LIR_OprFact::illegalOpr, x->monitor_no());
}

View File

@ -1031,3 +1031,7 @@ void Runtime1::generate_handle_exception(StubAssembler* sasm, OopMapSet* oop_map
#undef __
#define __ masm->
const char *Runtime1::pd_name_for_address(address entry) {
return "<unknown function>";
}

View File

@ -56,14 +56,18 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
}
#ifdef _LP64
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
Argument jni_arg(jni_offset(), false);
#ifdef _LP64
FloatRegister Rtmp = F0;
__ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
__ store_float_argument(Rtmp, jni_arg);
}
#else
Register Rtmp = O0;
__ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
__ store_argument(Rtmp, jni_arg);
#endif
}
void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
@ -185,6 +189,13 @@ class SlowSignatureHandler: public NativeSignatureIterator {
_from -= 2*Interpreter::stackElementSize;
add_signature( non_float );
}
virtual void pass_float() {
*_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
_from -= Interpreter::stackElementSize;
add_signature( non_float );
}
#endif // _LP64
virtual void add_signature( intptr_t sig_type ) {

View File

@ -76,6 +76,8 @@ public:
void set_last_Java_sp(intptr_t* sp) { _last_Java_sp = sp; }
address last_Java_pc(void) { return _last_Java_pc; }
// These are only used by friends
private:

View File

@ -3236,12 +3236,14 @@ void TemplateTable::_new() {
__ get_2_byte_integer_at_bcp(1, Rscratch, Roffset, InterpreterMacroAssembler::Unsigned);
__ get_cpool_and_tags(Rscratch, G3_scratch);
// make sure the class we're about to instantiate has been resolved
// This is done before loading instanceKlass to be consistent with the order
// how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
__ add(G3_scratch, typeArrayOopDesc::header_size(T_BYTE) * wordSize, G3_scratch);
__ ldub(G3_scratch, Roffset, G3_scratch);
__ cmp(G3_scratch, JVM_CONSTANT_Class);
__ br(Assembler::notEqual, false, Assembler::pn, slow_case);
__ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
// get instanceKlass
//__ sll(Roffset, LogBytesPerWord, Roffset); // executed in delay slot
__ add(Roffset, sizeof(constantPoolOopDesc), Roffset);
__ ld_ptr(Rscratch, Roffset, RinstanceKlass);

View File

@ -236,11 +236,11 @@ inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
}
inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
return op1 << op2;
return op1 << op2;
}
inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
return op1 >> op2; // QQ op2 & 0x1f??
return op1 >> (op2 & 0x1f);
}
inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
@ -248,7 +248,7 @@ inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
}
inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
return ((juint) op1) >> op2; // QQ op2 & 0x1f??
return ((juint) op1) >> (op2 & 0x1f);
}
inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {

View File

@ -349,7 +349,7 @@ void LIRGenerator::do_MonitorExit(MonitorExit* x) {
LIR_Opr lock = new_register(T_INT);
LIR_Opr obj_temp = new_register(T_INT);
set_no_result(x);
monitor_exit(obj_temp, lock, syncTempOpr(), x->monitor_no());
monitor_exit(obj_temp, lock, syncTempOpr(), LIR_OprFact::illegalOpr, x->monitor_no());
}

View File

@ -1779,3 +1779,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
}
#undef __
const char *Runtime1::pd_name_for_address(address entry) {
return "<unknown function>";
}

View File

@ -575,8 +575,8 @@ bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
#ifdef CC_INTERP
// Needed for JVMTI. The result should always be in the interpreterState object
assert(false, "NYI");
// Needed for JVMTI. The result should always be in the
// interpreterState object
interpreterState istate = get_interpreterState();
#endif // CC_INTERP
assert(is_interpreted_frame(), "interpreted frame expected");

View File

@ -34,6 +34,10 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
move(offset(), jni_offset() + 1);
}
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
move(offset(), jni_offset() + 1);
}
void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
move(offset(), jni_offset() + 2);
move(offset() + 1, jni_offset() + 1);
@ -91,6 +95,11 @@ class SlowSignatureHandler: public NativeSignatureIterator {
_from -= Interpreter::stackElementSize;
}
virtual void pass_float() {
*_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
_from -= Interpreter::stackElementSize;
}
virtual void pass_long() {
_to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
_to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));

View File

@ -66,6 +66,8 @@ public:
intptr_t* last_Java_sp(void) const { return _last_Java_sp; }
address last_Java_pc(void) { return _last_Java_pc; }
private:
static ByteSize last_Java_fp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_fp); }

View File

@ -3112,22 +3112,25 @@ void TemplateTable::_new() {
transition(vtos, atos);
__ get_unsigned_2_byte_index_at_bcp(rdx, 1);
Label slow_case;
Label slow_case_no_pop;
Label done;
Label initialize_header;
Label initialize_object; // including clearing the fields
Label allocate_shared;
__ get_cpool_and_tags(rcx, rax);
// Make sure the class we're about to instantiate has been resolved.
// This is done before loading instanceKlass to be consistent with the order
// how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
__ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
__ jcc(Assembler::notEqual, slow_case_no_pop);
// get instanceKlass
__ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(constantPoolOopDesc)));
__ push(rcx); // save the contexts of klass for initializing the header
// make sure the class we're about to instantiate has been resolved.
// Note: slow_case does a pop of stack, which is why we loaded class/pushed above
const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
__ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
__ jcc(Assembler::notEqual, slow_case);
// make sure klass is initialized & doesn't have finalizer
// make sure klass is fully initialized
__ cmpl(Address(rcx, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized);
@ -3255,6 +3258,7 @@ void TemplateTable::_new() {
// slow case
__ bind(slow_case);
__ pop(rcx); // restore stack pointer to what it was when we came in.
__ bind(slow_case_no_pop);
__ get_constant_pool(rax);
__ get_unsigned_2_byte_index_at_bcp(rdx, 1);
call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), rax, rdx);

View File

@ -3126,18 +3126,18 @@ void TemplateTable::_new() {
Label allocate_shared;
__ get_cpool_and_tags(rsi, rax);
// get instanceKlass
__ movptr(rsi, Address(rsi, rdx,
Address::times_8, sizeof(constantPoolOopDesc)));
// make sure the class we're about to instantiate has been
// resolved. Note: slow_case does a pop of stack, which is why we
// loaded class/pushed above
// Make sure the class we're about to instantiate has been resolved.
// This is done before loading instanceKlass to be consistent with the order
// how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
__ cmpb(Address(rax, rdx, Address::times_1, tags_offset),
JVM_CONSTANT_Class);
__ jcc(Assembler::notEqual, slow_case);
// get instanceKlass
__ movptr(rsi, Address(rsi, rdx,
Address::times_8, sizeof(constantPoolOopDesc)));
// make sure klass is initialized & doesn't have finalizer
// make sure klass is fully initialized
__ cmpl(Address(rsi,

View File

@ -79,6 +79,10 @@
# define ARCH "i386"
# elif defined(__sparc)
# define ARCH "sparc"
# elif defined(arm)
# define ARCH "arm"
# elif defined(PPC)
# define ARCH "ppc"
# endif
#endif /* _LP64 */

View File

@ -30,6 +30,8 @@
// put OS-includes here
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
# include <sys/select.h>
# include <pthread.h>
# include <signal.h>
# include <errno.h>
@ -188,6 +190,10 @@ static char cpu_arch[] = "ia64";
static char cpu_arch[] = "i386";
#elif defined(AMD64)
static char cpu_arch[] = "amd64";
#elif defined(ARM)
static char cpu_arch[] = "arm";
#elif defined(PPC)
static char cpu_arch[] = "ppc";
#elif defined(SPARC)
# ifdef _LP64
static char cpu_arch[] = "sparcv9";
@ -1137,8 +1143,8 @@ void os::Linux::capture_initial_stack(size_t max_size) {
long it_real;
uintptr_t start;
uintptr_t vsize;
uintptr_t rss;
unsigned long rsslim;
intptr_t rss;
uintptr_t rsslim;
uintptr_t scodes;
uintptr_t ecode;
int i;
@ -1168,12 +1174,12 @@ void os::Linux::capture_initial_stack(size_t max_size) {
// Skip blank chars
do s++; while (isspace(*s));
/* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */
/* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */
i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld "
UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT
" %lu "
UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT,
#define _UFM UINTX_FORMAT
#define _DFM INTX_FORMAT
/* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */
/* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */
i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM,
&state, /* 3 %c */
&ppid, /* 4 %d */
&pgrp, /* 5 %d */
@ -1193,15 +1199,18 @@ void os::Linux::capture_initial_stack(size_t max_size) {
&nice, /* 19 %ld */
&junk, /* 20 %ld */
&it_real, /* 21 %ld */
&start, /* 22 UINTX_FORMAT */
&vsize, /* 23 UINTX_FORMAT */
&rss, /* 24 UINTX_FORMAT */
&rsslim, /* 25 %lu */
&scodes, /* 26 UINTX_FORMAT */
&ecode, /* 27 UINTX_FORMAT */
&stack_start); /* 28 UINTX_FORMAT */
&start, /* 22 UINTX_FORMAT */
&vsize, /* 23 UINTX_FORMAT */
&rss, /* 24 INTX_FORMAT */
&rsslim, /* 25 UINTX_FORMAT */
&scodes, /* 26 UINTX_FORMAT */
&ecode, /* 27 UINTX_FORMAT */
&stack_start); /* 28 UINTX_FORMAT */
}
#undef _UFM
#undef _DFM
if (i != 28 - 2) {
assert(false, "Bad conversion from /proc/self/stat");
// product mode - assume we are the initial thread, good luck in the
@ -1336,13 +1345,15 @@ void os::Linux::clock_init() {
#if defined(IA32) || defined(AMD64)
#define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229)
#else
#error Value of SYS_clock_getres not known on this platform
#endif
#endif
#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
#else
#warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time"
#define sys_clock_getres(x,y) -1
#endif
#else
#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
#endif
void os::Linux::fast_thread_clock_init() {
if (!UseLinuxPosixThreadCPUClocks) {
@ -1905,7 +1916,9 @@ void os::print_os_info(outputStream* st) {
!_print_ascii_file("/etc/SuSE-release", st) &&
!_print_ascii_file("/etc/turbolinux-release", st) &&
!_print_ascii_file("/etc/gentoo-release", st) &&
!_print_ascii_file("/etc/debian_version", st)) {
!_print_ascii_file("/etc/debian_version", st) &&
!_print_ascii_file("/etc/ltib-release", st) &&
!_print_ascii_file("/etc/angstrom-version", st)) {
st->print("Linux");
}
st->cr();
@ -1971,6 +1984,11 @@ void os::print_os_info(outputStream* st) {
os::loadavg(loadavg, 3);
st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
st->cr();
// meminfo
st->print("\n/proc/meminfo:\n");
_print_ascii_file("/proc/meminfo", st);
st->cr();
}
void os::print_memory_info(outputStream* st) {
@ -2097,7 +2115,8 @@ void os::jvm_path(char *buf, jint buflen) {
CAST_FROM_FN_PTR(address, os::jvm_path),
dli_fname, sizeof(dli_fname), NULL);
assert(ret != 0, "cannot locate libjvm");
if (realpath(dli_fname, buf) == NULL)
char *rp = realpath(dli_fname, buf);
if (rp == NULL)
return;
if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
@ -2125,7 +2144,8 @@ void os::jvm_path(char *buf, jint buflen) {
assert(strstr(p, "/libjvm") == p, "invalid library name");
p = strstr(p, "_g") ? "_g" : "";
if (realpath(java_home_var, buf) == NULL)
rp = realpath(java_home_var, buf);
if (rp == NULL)
return;
// determine if this is a legacy image or modules image
@ -2147,7 +2167,8 @@ void os::jvm_path(char *buf, jint buflen) {
snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
} else {
// Go back to path of .so
if (realpath(dli_fname, buf) == NULL)
rp = realpath(dli_fname, buf);
if (rp == NULL)
return;
}
}
@ -2508,9 +2529,9 @@ os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory;
unsigned long* os::Linux::_numa_all_nodes;
bool os::uncommit_memory(char* addr, size_t size) {
return ::mmap(addr, size, PROT_NONE,
MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0)
!= MAP_FAILED;
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
}
// Linux uses a growable mapping for the stack, and if the mapping for
@ -2718,7 +2739,8 @@ bool os::large_page_init() {
// the processor.
#ifndef ZERO
_large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M);
_large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M)
ARM_ONLY(2 * M) PPC_ONLY(4 * M);
#endif // ZERO
FILE *fp = fopen("/proc/meminfo", "r");
@ -3981,6 +4003,9 @@ jint os::init_2(void)
return JNI_OK;
}
// this is called at the end of vm_initialization
void os::init_3(void) { }
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if( !guard_memory((char*)_polling_page, Linux::page_size()) )
@ -4061,7 +4086,6 @@ int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mute
////////////////////////////////////////////////////////////////////////////////
// debug support
#ifndef PRODUCT
static address same_page(address x, address y) {
int page_bits = -os::vm_page_size();
if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
@ -4072,26 +4096,26 @@ static address same_page(address x, address y) {
return (address)(intptr_t(y) & page_bits);
}
bool os::find(address addr) {
bool os::find(address addr, outputStream* st) {
Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo));
if (dladdr(addr, &dlinfo)) {
tty->print(PTR_FORMAT ": ", addr);
st->print(PTR_FORMAT ": ", addr);
if (dlinfo.dli_sname != NULL) {
tty->print("%s+%#x", dlinfo.dli_sname,
st->print("%s+%#x", dlinfo.dli_sname,
addr - (intptr_t)dlinfo.dli_saddr);
} else if (dlinfo.dli_fname) {
tty->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
} else {
tty->print("<absolute address>");
st->print("<absolute address>");
}
if (dlinfo.dli_fname) {
tty->print(" in %s", dlinfo.dli_fname);
st->print(" in %s", dlinfo.dli_fname);
}
if (dlinfo.dli_fbase) {
tty->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
}
tty->cr();
st->cr();
if (Verbose) {
// decode some bytes around the PC
@ -4104,15 +4128,13 @@ bool os::find(address addr) {
if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
end = (address) dlinfo2.dli_saddr;
Disassembler::decode(begin, end);
Disassembler::decode(begin, end, st);
}
return true;
}
return false;
}
#endif
////////////////////////////////////////////////////////////////////////////////
// misc
@ -4321,6 +4343,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
int count;
long sys_time, user_time;
char string[64];
char cdummy;
int idummy;
long ldummy;
FILE *fp;
@ -4381,11 +4404,11 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
// Skip blank chars
do s++; while (isspace(*s));
count = sscanf(s,"%*c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
&idummy, &idummy, &idummy, &idummy, &idummy,
count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
&cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
&ldummy, &ldummy, &ldummy, &ldummy, &ldummy,
&user_time, &sys_time);
if ( count != 12 ) return -1;
if ( count != 13 ) return -1;
if (user_sys_cpu_time) {
return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
} else {
@ -4980,3 +5003,43 @@ int os::fork_and_exec(char* cmd) {
}
}
}
// is_headless_jre()
//
// Test for the existence of libmawt in motif21 or xawt directories
// in order to report if we are running in a headless jre
//
bool os::is_headless_jre() {
struct stat statbuf;
char buf[MAXPATHLEN];
char libmawtpath[MAXPATHLEN];
const char *xawtstr = "/xawt/libmawt.so";
const char *motifstr = "/motif21/libmawt.so";
char *p;
// Get path to libjvm.so
os::jvm_path(buf, sizeof(buf));
// Get rid of libjvm.so
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
// Get rid of client or server
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
// check xawt/libmawt.so
strcpy(libmawtpath, buf);
strcat(libmawtpath, xawtstr);
if (::stat(libmawtpath, &statbuf) == 0) return false;
// check motif21/libmawt.so
strcpy(libmawtpath, buf);
strcat(libmawtpath, motifstr);
if (::stat(libmawtpath, &statbuf) == 0) return false;
return true;
}

View File

@ -1839,8 +1839,8 @@ void os::dll_build_name(char* buffer, size_t buflen,
// Quietly truncate on buffer overflow. Should be an error.
if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
*buffer = '\0';
return;
*buffer = '\0';
return;
}
if (pnamelen == 0) {
@ -2051,7 +2051,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{EM_SPARC32PLUS, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},
{EM_SPARCV9, EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"},
{EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"},
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"}
{EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"},
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM 32"}
};
#if (defined IA32)
@ -2068,9 +2069,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
static Elf32_Half running_arch_code=EM_PPC64;
#elif (defined __powerpc__)
static Elf32_Half running_arch_code=EM_PPC;
#elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM;
#else
#error Method os::dll_load requires that one of following is defined:\
IA32, AMD64, IA64, __sparc, __powerpc__
IA32, AMD64, IA64, __sparc, __powerpc__, ARM, ARM
#endif
// Identify compatability class for VM's architecture and library's architecture
@ -3149,7 +3152,8 @@ bool os::Solaris::ism_sanity_check(bool warn, size_t * page_size) {
// ISM is only recommended on old Solaris where there is no MPSS support.
// Simply choose a conservative value as default.
*page_size = LargePageSizeInBytes ? LargePageSizeInBytes :
SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M);
SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M)
ARM_ONLY(2 * M);
// ISM is available on all supported Solaris versions
return true;
@ -5007,6 +5011,9 @@ jint os::init_2(void) {
return JNI_OK;
}
void os::init_3(void) {
return;
}
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
@ -5412,7 +5419,6 @@ int os::loadavg(double loadavg[], int nelem) {
}
//---------------------------------------------------------------------------------
#ifndef PRODUCT
static address same_page(address x, address y) {
intptr_t page_bits = -os::vm_page_size();
@ -5424,28 +5430,28 @@ static address same_page(address x, address y) {
return (address)(intptr_t(y) & page_bits);
}
bool os::find(address addr) {
bool os::find(address addr, outputStream* st) {
Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo));
if (dladdr(addr, &dlinfo)) {
#ifdef _LP64
tty->print("0x%016lx: ", addr);
st->print("0x%016lx: ", addr);
#else
tty->print("0x%08x: ", addr);
st->print("0x%08x: ", addr);
#endif
if (dlinfo.dli_sname != NULL)
tty->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
else if (dlinfo.dli_fname)
tty->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
else
tty->print("<absolute address>");
if (dlinfo.dli_fname) tty->print(" in %s", dlinfo.dli_fname);
st->print("<absolute address>");
if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname);
#ifdef _LP64
if (dlinfo.dli_fbase) tty->print(" at 0x%016lx", dlinfo.dli_fbase);
if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase);
#else
if (dlinfo.dli_fbase) tty->print(" at 0x%08x", dlinfo.dli_fbase);
if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase);
#endif
tty->cr();
st->cr();
if (Verbose) {
// decode some bytes around the PC
@ -5458,16 +5464,13 @@ bool os::find(address addr) {
if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
end = (address) dlinfo2.dli_saddr;
Disassembler::decode(begin, end);
Disassembler::decode(begin, end, st);
}
return true;
}
return false;
}
#endif
// Following function has been added to support HotSparc's libjvm.so running
// under Solaris production JDK 1.2.2 / 1.3.0. These came from
// src/solaris/hpi/native_threads in the EVM codebase.
@ -5910,7 +5913,6 @@ void Parker::park(bool isAbsolute, jlong time) {
if (jt->handle_special_suspend_equivalent_condition()) {
jt->java_suspend_self();
}
OrderAccess::fence();
}
@ -5997,3 +5999,44 @@ int os::fork_and_exec(char* cmd) {
}
}
}
// is_headless_jre()
//
// Test for the existence of libmawt in motif21 or xawt directories
// in order to report if we are running in a headless jre
//
bool os::is_headless_jre() {
struct stat statbuf;
char buf[MAXPATHLEN];
char libmawtpath[MAXPATHLEN];
const char *xawtstr = "/xawt/libmawt.so";
const char *motifstr = "/motif21/libmawt.so";
char *p;
// Get path to libjvm.so
os::jvm_path(buf, sizeof(buf));
// Get rid of libjvm.so
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
// Get rid of client or server
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
// check xawt/libmawt.so
strcpy(libmawtpath, buf);
strcat(libmawtpath, xawtstr);
if (::stat(libmawtpath, &statbuf) == 0) return false;
// check motif21/libmawt.so
strcpy(libmawtpath, buf);
strcat(libmawtpath, motifstr);
if (::stat(libmawtpath, &statbuf) == 0) return false;
return true;
}

View File

@ -3444,6 +3444,9 @@ jint os::init_2(void) {
return JNI_OK;
}
void os::init_3(void) {
return;
}
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
@ -4105,12 +4108,10 @@ bool os::check_heap(bool force) {
}
#ifndef PRODUCT
bool os::find(address addr) {
bool os::find(address addr, outputStream* st) {
// Nothing yet
return false;
}
#endif
LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
DWORD exception_code = e->ExceptionRecord->ExceptionCode;
@ -4164,3 +4165,8 @@ static int getLastErrorString(char *buf, size_t len)
}
return 0;
}
// We don't build a headless jre for Windows
bool os::is_headless_jre() { return false; }

View File

@ -105,3 +105,6 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
// nothing else to try
return false;
}
void JavaThread::cache_global_variables() { }

View File

@ -718,6 +718,11 @@ void os::print_context(outputStream *st, void *context) {
ucontext_t *uc = (ucontext_t*)context;
st->print_cr("Registers:");
// this is horrendously verbose but the layout of the registers in the
// context does not match how we defined our abstract Register set, so
// we can't just iterate through the gregs area
#ifdef AMD64
st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
@ -745,6 +750,63 @@ void os::print_context(outputStream *st, void *context) {
st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]);
st->cr();
st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
st->cr();
st->print_cr("RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
st->cr();
st->print_cr("RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
st->cr();
st->print_cr("RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
st->cr();
st->print_cr("RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
st->cr();
st->print_cr("RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
print_location(st, uc->uc_mcontext.gregs[REG_RBP]);
st->cr();
st->print_cr("RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
st->cr();
st->print_cr("RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
st->cr();
st->print_cr("R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
print_location(st, uc->uc_mcontext.gregs[REG_R8]);
st->cr();
st->print_cr("R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
print_location(st, uc->uc_mcontext.gregs[REG_R9]);
st->cr();
st->print_cr("R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
print_location(st, uc->uc_mcontext.gregs[REG_R10]);
st->cr();
st->print_cr("R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
print_location(st, uc->uc_mcontext.gregs[REG_R11]);
st->cr();
st->print_cr("R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
print_location(st, uc->uc_mcontext.gregs[REG_R12]);
st->cr();
st->print_cr("R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
print_location(st, uc->uc_mcontext.gregs[REG_R13]);
st->cr();
st->print_cr("R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
print_location(st, uc->uc_mcontext.gregs[REG_R14]);
st->cr();
st->print_cr("R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
print_location(st, uc->uc_mcontext.gregs[REG_R15]);
#else
st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
@ -759,6 +821,39 @@ void os::print_context(outputStream *st, void *context) {
st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]);
st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
print_location(st, uc->uc_mcontext.gregs[REG_EAX]);
st->cr();
st->print_cr("EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
print_location(st, uc->uc_mcontext.gregs[REG_EBX]);
st->cr();
st->print_cr("ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]);
print_location(st, uc->uc_mcontext.gregs[REG_ECX]);
st->cr();
st->print_cr("EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]);
print_location(st, uc->uc_mcontext.gregs[REG_EDX]);
st->cr();
st->print_cr("ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESP]);
print_location(st, uc->uc_mcontext.gregs[REG_ESP]);
st->cr();
st->print_cr("EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]);
print_location(st, uc->uc_mcontext.gregs[REG_EBP]);
st->cr();
st->print_cr("ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]);
print_location(st, uc->uc_mcontext.gregs[REG_ESI]);
st->cr();
st->print_cr("EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]);
print_location(st, uc->uc_mcontext.gregs[REG_EDI]);
#endif // AMD64
st->cr();
st->cr();

View File

@ -79,3 +79,6 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
// nothing else to try
return false;
}
void JavaThread::cache_global_variables() { }

View File

@ -24,3 +24,5 @@
*/
// This file is intentionally empty
void JavaThread::cache_global_variables() { }

View File

@ -587,6 +587,61 @@ void os::print_context(outputStream *st, void *context) {
st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
uc->uc_mcontext.gregs[REG_PC],
uc->uc_mcontext.gregs[REG_nPC]);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("O0=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O0]);
print_location(st, uc->uc_mcontext.gregs[REG_O0]);
st->cr();
st->print_cr("O1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O1]);
print_location(st, uc->uc_mcontext.gregs[REG_O1]);
st->cr();
st->print_cr("O2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O2]);
print_location(st, uc->uc_mcontext.gregs[REG_O2]);
st->cr();
st->print_cr("O3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O3]);
print_location(st, uc->uc_mcontext.gregs[REG_O3]);
st->cr();
st->print_cr("O4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O4]);
print_location(st, uc->uc_mcontext.gregs[REG_O4]);
st->cr();
st->print_cr("O5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O5]);
print_location(st, uc->uc_mcontext.gregs[REG_O5]);
st->cr();
st->print_cr("O6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O6]);
print_location(st, uc->uc_mcontext.gregs[REG_O6]);
st->cr();
st->print_cr("O7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O7]);
print_location(st, uc->uc_mcontext.gregs[REG_O7]);
st->cr();
st->print_cr("G1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G1]);
print_location(st, uc->uc_mcontext.gregs[REG_G1]);
st->cr();
st->print_cr("G2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G2]);
print_location(st, uc->uc_mcontext.gregs[REG_G2]);
st->cr();
st->print_cr("G3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G3]);
print_location(st, uc->uc_mcontext.gregs[REG_G3]);
st->cr();
st->print_cr("G4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G4]);
print_location(st, uc->uc_mcontext.gregs[REG_G4]);
st->cr();
st->print_cr("G5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G5]);
print_location(st, uc->uc_mcontext.gregs[REG_G5]);
st->cr();
st->print_cr("G6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G6]);
print_location(st, uc->uc_mcontext.gregs[REG_G6]);
st->cr();
st->print_cr("G7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G7]);
print_location(st, uc->uc_mcontext.gregs[REG_G7]);
st->cr();
st->cr();

View File

@ -140,3 +140,6 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
*fr_addr = ret_frame;
return true;
}
void JavaThread::cache_global_variables() { }

View File

@ -719,6 +719,11 @@ void os::print_context(outputStream *st, void *context) {
ucontext_t *uc = (ucontext_t*)context;
st->print_cr("Registers:");
// this is horrendously verbose but the layout of the registers in the
// context does not match how we defined our abstract Register set, so
// we can't just iterate through the gregs area
#ifdef AMD64
st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
@ -742,6 +747,63 @@ void os::print_context(outputStream *st, void *context) {
st->cr();
st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]);
st->print(", RFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RFL]);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
print_location(st, uc->uc_mcontext.gregs[REG_RAX]);
st->cr();
st->print_cr("RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]);
print_location(st, uc->uc_mcontext.gregs[REG_RBX]);
st->cr();
st->print_cr("RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]);
print_location(st, uc->uc_mcontext.gregs[REG_RCX]);
st->cr();
st->print_cr("RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]);
print_location(st, uc->uc_mcontext.gregs[REG_RDX]);
st->cr();
st->print_cr("RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]);
print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
st->cr();
st->print_cr("RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]);
print_location(st, uc->uc_mcontext.gregs[REG_RSP]);
st->cr();
st->print_cr("RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]);
print_location(st, uc->uc_mcontext.gregs[REG_RSI]);
st->cr();
st->print_cr("RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]);
print_location(st, uc->uc_mcontext.gregs[REG_RDI]);
st->cr();
st->print_cr("R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]);
print_location(st, uc->uc_mcontext.gregs[REG_R8]);
st->cr();
st->print_cr("R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]);
print_location(st, uc->uc_mcontext.gregs[REG_R9]);
st->cr();
st->print_cr("R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]);
print_location(st, uc->uc_mcontext.gregs[REG_R10]);
st->cr();
st->print_cr("R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]);
print_location(st, uc->uc_mcontext.gregs[REG_R11]);
st->cr();
st->print_cr("R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]);
print_location(st, uc->uc_mcontext.gregs[REG_R12]);
st->cr();
st->print_cr("R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]);
print_location(st, uc->uc_mcontext.gregs[REG_R13]);
st->cr();
st->print_cr("R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]);
print_location(st, uc->uc_mcontext.gregs[REG_R14]);
st->cr();
st->print_cr("R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]);
print_location(st, uc->uc_mcontext.gregs[REG_R15]);
#else
st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EAX]);
st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBX]);
@ -755,6 +817,39 @@ void os::print_context(outputStream *st, void *context) {
st->cr();
st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EIP]);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EFL]);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EAX]);
print_location(st, uc->uc_mcontext.gregs[EAX]);
st->cr();
st->print_cr("EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBX]);
print_location(st, uc->uc_mcontext.gregs[EBX]);
st->cr();
st->print_cr("ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[ECX]);
print_location(st, uc->uc_mcontext.gregs[ECX]);
st->cr();
st->print_cr("EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EDX]);
print_location(st, uc->uc_mcontext.gregs[EDX]);
st->cr();
st->print_cr("ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[UESP]);
print_location(st, uc->uc_mcontext.gregs[UESP]);
st->cr();
st->print_cr("EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EBP]);
print_location(st, uc->uc_mcontext.gregs[EBP]);
st->cr();
st->print_cr("ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[ESI]);
print_location(st, uc->uc_mcontext.gregs[ESI]);
st->cr();
st->print_cr("EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[EDI]);
print_location(st, uc->uc_mcontext.gregs[EDI]);
#endif // AMD64
st->cr();
st->cr();
@ -773,6 +868,7 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 16, pc + 16, sizeof(char));
}
#ifdef AMD64
void os::Solaris::init_thread_fpu_state(void) {
// Nothing to do

View File

@ -82,3 +82,6 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
return true;
}
void JavaThread::cache_global_variables() { }

View File

@ -377,18 +377,84 @@ void os::print_context(outputStream *st, void *context) {
st->print_cr("Registers:");
#ifdef AMD64
st->print( "EAX=" INTPTR_FORMAT, uc->Rax);
st->print(", EBX=" INTPTR_FORMAT, uc->Rbx);
st->print(", ECX=" INTPTR_FORMAT, uc->Rcx);
st->print(", EDX=" INTPTR_FORMAT, uc->Rdx);
st->print( "RAX=" INTPTR_FORMAT, uc->Rax);
st->print(", RBX=" INTPTR_FORMAT, uc->Rbx);
st->print(", RCX=" INTPTR_FORMAT, uc->Rcx);
st->print(", RDX=" INTPTR_FORMAT, uc->Rdx);
st->cr();
st->print( "ESP=" INTPTR_FORMAT, uc->Rsp);
st->print(", EBP=" INTPTR_FORMAT, uc->Rbp);
st->print(", ESI=" INTPTR_FORMAT, uc->Rsi);
st->print(", EDI=" INTPTR_FORMAT, uc->Rdi);
st->print( "RSP=" INTPTR_FORMAT, uc->Rsp);
st->print(", RBP=" INTPTR_FORMAT, uc->Rbp);
st->print(", RSI=" INTPTR_FORMAT, uc->Rsi);
st->print(", RDI=" INTPTR_FORMAT, uc->Rdi);
st->cr();
st->print( "EIP=" INTPTR_FORMAT, uc->Rip);
st->print( "R8=" INTPTR_FORMAT, uc->R8);
st->print(", R9=" INTPTR_FORMAT, uc->R9);
st->print(", R10=" INTPTR_FORMAT, uc->R10);
st->print(", R11=" INTPTR_FORMAT, uc->R11);
st->cr();
st->print( "R12=" INTPTR_FORMAT, uc->R12);
st->print(", R13=" INTPTR_FORMAT, uc->R13);
st->print(", R14=" INTPTR_FORMAT, uc->R14);
st->print(", R15=" INTPTR_FORMAT, uc->R15);
st->cr();
st->print( "RIP=" INTPTR_FORMAT, uc->Rip);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("RAX=" INTPTR_FORMAT, uc->Rax);
print_location(st, uc->Rax);
st->cr();
st->print_cr("RBX=" INTPTR_FORMAT, uc->Rbx);
print_location(st, uc->Rbx);
st->cr();
st->print_cr("RCX=" INTPTR_FORMAT, uc->Rcx);
print_location(st, uc->Rcx);
st->cr();
st->print_cr("RDX=" INTPTR_FORMAT, uc->Rdx);
print_location(st, uc->Rdx);
st->cr();
st->print_cr("RSP=" INTPTR_FORMAT, uc->Rsp);
print_location(st, uc->Rsp);
st->cr();
st->print_cr("RBP=" INTPTR_FORMAT, uc->Rbp);
print_location(st, uc->Rbp);
st->cr();
st->print_cr("RSI=" INTPTR_FORMAT, uc->Rsi);
print_location(st, uc->Rsi);
st->cr();
st->print_cr("RDI=" INTPTR_FORMAT, uc->Rdi);
print_location(st, uc->Rdi);
st->cr();
st->print_cr("R8 =" INTPTR_FORMAT, uc->R8);
print_location(st, uc->R8);
st->cr();
st->print_cr("R9 =" INTPTR_FORMAT, uc->R9);
print_location(st, uc->R9);
st->cr();
st->print_cr("R10=" INTPTR_FORMAT, uc->R10);
print_location(st, uc->R10);
st->cr();
st->print_cr("R11=" INTPTR_FORMAT, uc->R11);
print_location(st, uc->R11);
st->cr();
st->print_cr("R12=" INTPTR_FORMAT, uc->R12);
print_location(st, uc->R12);
st->cr();
st->print_cr("R13=" INTPTR_FORMAT, uc->R13);
print_location(st, uc->R13);
st->cr();
st->print_cr("R14=" INTPTR_FORMAT, uc->R14);
print_location(st, uc->R14);
st->cr();
st->print_cr("R15=" INTPTR_FORMAT, uc->R15);
print_location(st, uc->R15);
#else
st->print( "EAX=" INTPTR_FORMAT, uc->Eax);
st->print(", EBX=" INTPTR_FORMAT, uc->Ebx);
@ -402,6 +468,38 @@ void os::print_context(outputStream *st, void *context) {
st->cr();
st->print( "EIP=" INTPTR_FORMAT, uc->Eip);
st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
st->cr();
st->cr();
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
st->print_cr("EAX=" INTPTR_FORMAT, uc->Eax);
print_location(st, uc->Eax);
st->cr();
st->print_cr("EBX=" INTPTR_FORMAT, uc->Ebx);
print_location(st, uc->Ebx);
st->cr();
st->print_cr("ECX=" INTPTR_FORMAT, uc->Ecx);
print_location(st, uc->Ecx);
st->cr();
st->print_cr("EDX=" INTPTR_FORMAT, uc->Edx);
print_location(st, uc->Edx);
st->cr();
st->print_cr("ESP=" INTPTR_FORMAT, uc->Esp);
print_location(st, uc->Esp);
st->cr();
st->print_cr("EBP=" INTPTR_FORMAT, uc->Ebp);
print_location(st, uc->Ebp);
st->cr();
st->print_cr("ESI=" INTPTR_FORMAT, uc->Esi);
print_location(st, uc->Esi);
st->cr();
st->print_cr("EDI=" INTPTR_FORMAT, uc->Edi);
print_location(st, uc->Edi);
#endif // AMD64
st->cr();
st->cr();

View File

@ -84,3 +84,6 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
// nothing else to try
return false;
}
void JavaThread::cache_global_variables() { }

View File

@ -102,7 +102,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
_locs_point = NULL;
_locs_own = false;
_frozen = false;
debug_only(_index = -1);
debug_only(_index = (char)-1);
debug_only(_outer = (CodeBuffer*)badAddress);
}

View File

@ -448,6 +448,10 @@ class SimpleExceptionStub: public CodeStub {
_obj(obj), _info(info), _stub(stub) {
}
void set_obj(LIR_Opr obj) {
_obj = obj;
}
virtual void emit_code(LIR_Assembler* e);
virtual CodeEmitInfo* info() const { return _info; }
virtual bool is_exception_throw_stub() const { return true; }

View File

@ -168,10 +168,19 @@ class Compilation: public StackObj {
const char* bailout_msg() const { return _bailout_msg; }
static int desired_max_code_buffer_size() {
#ifndef PPC
return (int) NMethodSizeLimit; // default 256K or 512K
#else
// conditional branches on PPC are restricted to 16 bit signed
return MAX2((unsigned int)NMethodSizeLimit,32*K);
#endif
}
static int desired_max_constant_size() {
#ifndef PPC
return (int) NMethodSizeLimit / 10; // about 25K
#else
return (MAX2((unsigned int)NMethodSizeLimit, 32*K)) / 10;
#endif
}
static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate);

View File

@ -90,7 +90,7 @@ CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signa
if (outgoing) {
// update the space reserved for arguments.
update_reserved_argument_area_size(out_preserve);
update_reserved_argument_area_size(out_preserve * BytesPerWord);
}
return new CallingConvention(args, out_preserve);
}
@ -138,7 +138,7 @@ CallingConvention* FrameMap::c_calling_convention(const BasicTypeArray* signatur
}
assert(args->length() == signature->length(), "size mismatch");
out_preserve += SharedRuntime::out_preserve_stack_slots();
update_reserved_argument_area_size(out_preserve);
update_reserved_argument_area_size(out_preserve * BytesPerWord);
return new CallingConvention(args, out_preserve);
}

View File

@ -154,7 +154,6 @@ class FrameMap : public CompilationResourceObj {
static LIR_Opr method_handle_invoke_SP_save_opr();
static BasicTypeArray* signature_type_array_for(const ciMethod* method);
static BasicTypeArray* signature_type_array_for(const char * signature);
// for outgoing calls, these also update the reserved area to
// include space for arguments and any ABI area.

View File

@ -50,8 +50,7 @@ XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
#endif // X86
#ifdef SPARC
#if defined(SPARC) || defined(PPC)
FloatRegister LIR_OprDesc::as_float_reg() const {
return FrameMap::nr2floatreg(fpu_regnr());
@ -63,6 +62,19 @@ FloatRegister LIR_OprDesc::as_double_reg() const {
#endif
#ifdef ARM
FloatRegister LIR_OprDesc::as_float_reg() const {
return as_FloatRegister(fpu_regnr());
}
FloatRegister LIR_OprDesc::as_double_reg() const {
return as_FloatRegister(fpu_regnrLo());
}
#endif
LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal();
LIR_Opr LIR_OprFact::value_type(ValueType* type) {
@ -119,10 +131,14 @@ LIR_Address::Scale LIR_Address::scale(BasicType type) {
#ifndef PRODUCT
void LIR_Address::verify() const {
#ifdef SPARC
assert(scale() == times_1, "Scaled addressing mode not available on SPARC and should not be used");
#if defined(SPARC) || defined(PPC)
assert(scale() == times_1, "Scaled addressing mode not available on SPARC/PPC and should not be used");
assert(disp() == 0 || index()->is_illegal(), "can't have both");
#endif
#ifdef ARM
assert(disp() == 0 || index()->is_illegal(), "can't have both");
assert(-4096 < disp() && disp() < 4096, "architecture constraint");
#endif
#ifdef _LP64
assert(base()->is_cpu_register(), "wrong base operand");
assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
@ -173,13 +189,22 @@ void LIR_OprDesc::validate_type() const {
if (!is_pointer() && !is_illegal()) {
switch (as_BasicType(type_field())) {
case T_LONG:
assert((kind_field() == cpu_register || kind_field() == stack_value) && size_field() == double_size, "must match");
assert((kind_field() == cpu_register || kind_field() == stack_value) &&
size_field() == double_size, "must match");
break;
case T_FLOAT:
assert((kind_field() == fpu_register || kind_field() == stack_value) && size_field() == single_size, "must match");
// FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
assert((kind_field() == fpu_register || kind_field() == stack_value
ARM_ONLY(|| kind_field() == cpu_register)
PPC_ONLY(|| kind_field() == cpu_register) ) &&
size_field() == single_size, "must match");
break;
case T_DOUBLE:
assert((kind_field() == fpu_register || kind_field() == stack_value) && size_field() == double_size, "must match");
// FP return values can be also in CPU registers on ARM and PPC (softfp ABI)
assert((kind_field() == fpu_register || kind_field() == stack_value
ARM_ONLY(|| kind_field() == cpu_register)
PPC_ONLY(|| kind_field() == cpu_register) ) &&
size_field() == double_size, "must match");
break;
case T_BOOLEAN:
case T_CHAR:
@ -188,7 +213,8 @@ void LIR_OprDesc::validate_type() const {
case T_INT:
case T_OBJECT:
case T_ARRAY:
assert((kind_field() == cpu_register || kind_field() == stack_value) && size_field() == single_size, "must match");
assert((kind_field() == cpu_register || kind_field() == stack_value) &&
size_field() == single_size, "must match");
break;
case T_ILLEGAL:
@ -503,6 +529,10 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(opConvert->_info == NULL, "must be");
if (opConvert->_opr->is_valid()) do_input(opConvert->_opr);
if (opConvert->_result->is_valid()) do_output(opConvert->_result);
#ifdef PPC
if (opConvert->_tmp1->is_valid()) do_temp(opConvert->_tmp1);
if (opConvert->_tmp2->is_valid()) do_temp(opConvert->_tmp2);
#endif
do_stub(opConvert->_stub);
break;
@ -530,7 +560,9 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
LIR_OpAllocObj* opAllocObj = (LIR_OpAllocObj*)op;
if (opAllocObj->_info) do_info(opAllocObj->_info);
if (opAllocObj->_opr->is_valid()) do_input(opAllocObj->_opr);
if (opAllocObj->_opr->is_valid()) { do_input(opAllocObj->_opr);
do_temp(opAllocObj->_opr);
}
if (opAllocObj->_tmp1->is_valid()) do_temp(opAllocObj->_tmp1);
if (opAllocObj->_tmp2->is_valid()) do_temp(opAllocObj->_tmp2);
if (opAllocObj->_tmp3->is_valid()) do_temp(opAllocObj->_tmp3);
@ -826,10 +858,16 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(op->as_OpCompareAndSwap() != NULL, "must be");
LIR_OpCompareAndSwap* opCompareAndSwap = (LIR_OpCompareAndSwap*)op;
assert(opCompareAndSwap->_addr->is_valid(), "used");
assert(opCompareAndSwap->_cmp_value->is_valid(), "used");
assert(opCompareAndSwap->_new_value->is_valid(), "used");
if (opCompareAndSwap->_info) do_info(opCompareAndSwap->_info);
if (opCompareAndSwap->_addr->is_valid()) do_input(opCompareAndSwap->_addr);
if (opCompareAndSwap->_cmp_value->is_valid()) do_input(opCompareAndSwap->_cmp_value);
if (opCompareAndSwap->_new_value->is_valid()) do_input(opCompareAndSwap->_new_value);
do_input(opCompareAndSwap->_addr);
do_temp(opCompareAndSwap->_addr);
do_input(opCompareAndSwap->_cmp_value);
do_temp(opCompareAndSwap->_cmp_value);
do_input(opCompareAndSwap->_new_value);
do_temp(opCompareAndSwap->_new_value);
if (opCompareAndSwap->_tmp1->is_valid()) do_temp(opCompareAndSwap->_tmp1);
if (opCompareAndSwap->_tmp2->is_valid()) do_temp(opCompareAndSwap->_tmp2);
if (opCompareAndSwap->_result->is_valid()) do_output(opCompareAndSwap->_result);
@ -1303,13 +1341,13 @@ void LIR_List::lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scrat
info));
}
void LIR_List::unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, CodeStub* stub) {
void LIR_List::unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub) {
append(new LIR_OpLock(
lir_unlock,
hdr,
obj,
lock,
LIR_OprFact::illegalOpr,
scratch,
stub,
NULL));
}
@ -1342,22 +1380,19 @@ void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr
}
void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
// Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
// implying successful swap of new_value into addr
append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2));
void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
append(new LIR_OpCompareAndSwap(lir_cas_long, addr, cmp_value, new_value, t1, t2, result));
}
void LIR_List::cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
// Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
// implying successful swap of new_value into addr
append(new LIR_OpCompareAndSwap(lir_cas_obj, addr, cmp_value, new_value, t1, t2));
void LIR_List::cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
append(new LIR_OpCompareAndSwap(lir_cas_obj, addr, cmp_value, new_value, t1, t2, result));
}
void LIR_List::cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2) {
// Compare and swap produces condition code "zero" if contents_of(addr) == cmp_value,
// implying successful swap of new_value into addr
append(new LIR_OpCompareAndSwap(lir_cas_int, addr, cmp_value, new_value, t1, t2));
void LIR_List::cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
append(new LIR_OpCompareAndSwap(lir_cas_int, addr, cmp_value, new_value, t1, t2, result));
}
@ -1400,6 +1435,11 @@ void LIR_OprDesc::print(outputStream* out) const {
out->print("fpu%d", fpu_regnr());
} else if (is_double_fpu()) {
out->print("fpu%d", fpu_regnrLo());
#elif defined(ARM)
} else if (is_single_fpu()) {
out->print("s%d", fpu_regnr());
} else if (is_double_fpu()) {
out->print("d%d", fpu_regnrLo() >> 1);
#else
} else if (is_single_fpu()) {
out->print(as_float_reg()->name());
@ -1756,6 +1796,12 @@ void LIR_OpConvert::print_instr(outputStream* out) const {
print_bytecode(out, bytecode());
in_opr()->print(out); out->print(" ");
result_opr()->print(out); out->print(" ");
#ifdef PPC
if(tmp1()->is_valid()) {
tmp1()->print(out); out->print(" ");
tmp2()->print(out); out->print(" ");
}
#endif
}
void LIR_OpConvert::print_bytecode(outputStream* out, Bytecodes::Code code) {

View File

@ -432,8 +432,7 @@ class LIR_OprDesc: public CompilationResourceObj {
// for compatibility with RInfo
int fpu () const { return lo_reg_half(); }
#endif // X86
#ifdef SPARC
#if defined(SPARC) || defined(ARM) || defined(PPC)
FloatRegister as_float_reg () const;
FloatRegister as_double_reg () const;
#endif
@ -519,14 +518,14 @@ class LIR_Address: public LIR_OprPtr {
, _type(type)
, _disp(0) { verify(); }
#ifdef X86
#if defined(X86) || defined(ARM)
LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type):
_base(base)
, _index(index)
, _scale(scale)
, _type(type)
, _disp(disp) { verify(); }
#endif // X86
#endif // X86 || ARM
LIR_Opr base() const { return _base; }
LIR_Opr index() const { return _index; }
@ -566,7 +565,11 @@ class LIR_OprFact: public AllStatic {
LIR_OprDesc::float_type |
LIR_OprDesc::fpu_register |
LIR_OprDesc::single_size); }
#if defined(ARM)
static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); }
static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) | LIR_OprDesc::float_type | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); }
static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); }
#endif
#ifdef SPARC
static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
(reg2 << LIR_OprDesc::reg2_shift) |
@ -593,7 +596,22 @@ class LIR_OprFact: public AllStatic {
LIR_OprDesc::double_size |
LIR_OprDesc::is_xmm_mask); }
#endif // X86
#ifdef PPC
static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
(reg << LIR_OprDesc::reg2_shift) |
LIR_OprDesc::double_type |
LIR_OprDesc::fpu_register |
LIR_OprDesc::double_size); }
static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) |
LIR_OprDesc::float_type |
LIR_OprDesc::cpu_register |
LIR_OprDesc::single_size); }
static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg2 << LIR_OprDesc::reg1_shift) |
(reg1 << LIR_OprDesc::reg2_shift) |
LIR_OprDesc::double_type |
LIR_OprDesc::cpu_register |
LIR_OprDesc::double_size); }
#endif // PPC
static LIR_Opr virtual_register(int index, BasicType type) {
LIR_Opr res;
@ -623,6 +641,22 @@ class LIR_OprFact: public AllStatic {
LIR_OprDesc::virtual_mask);
break;
#ifdef __SOFTFP__
case T_FLOAT:
res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
LIR_OprDesc::float_type |
LIR_OprDesc::cpu_register |
LIR_OprDesc::single_size |
LIR_OprDesc::virtual_mask);
break;
case T_DOUBLE:
res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
LIR_OprDesc::double_type |
LIR_OprDesc::cpu_register |
LIR_OprDesc::double_size |
LIR_OprDesc::virtual_mask);
break;
#else // __SOFTFP__
case T_FLOAT:
res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
LIR_OprDesc::float_type |
@ -638,7 +672,7 @@ class LIR_OprFact: public AllStatic {
LIR_OprDesc::double_size |
LIR_OprDesc::virtual_mask);
break;
#endif // __SOFTFP__
default: ShouldNotReachHere(); res = illegalOpr;
}
@ -650,11 +684,18 @@ class LIR_OprFact: public AllStatic {
// old-style calculation; check if old and new method are equal
LIR_OprDesc::OprType t = as_OprType(type);
#ifdef __SOFTFP__
LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
t |
LIR_OprDesc::cpu_register |
LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
#else // __SOFTFP__
LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
((type == T_FLOAT || type == T_DOUBLE) ? LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
assert(res == old_res, "old and new method not equal");
#endif
#endif // __SOFTFP__
#endif // ASSERT
return res;
}
@ -1306,15 +1347,37 @@ class LIR_OpConvert: public LIR_Op1 {
private:
Bytecodes::Code _bytecode;
ConversionStub* _stub;
#ifdef PPC
LIR_Opr _tmp1;
LIR_Opr _tmp2;
#endif
public:
LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub)
: LIR_Op1(lir_convert, opr, result)
, _stub(stub)
#ifdef PPC
, _tmp1(LIR_OprDesc::illegalOpr())
, _tmp2(LIR_OprDesc::illegalOpr())
#endif
, _bytecode(code) {}
#ifdef PPC
LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub
,LIR_Opr tmp1, LIR_Opr tmp2)
: LIR_Op1(lir_convert, opr, result)
, _stub(stub)
, _tmp1(tmp1)
, _tmp2(tmp2)
, _bytecode(code) {}
#endif
Bytecodes::Code bytecode() const { return _bytecode; }
ConversionStub* stub() const { return _stub; }
#ifdef PPC
LIR_Opr tmp1() const { return _tmp1; }
LIR_Opr tmp2() const { return _tmp2; }
#endif
virtual void emit_code(LIR_Assembler* masm);
virtual LIR_OpConvert* as_OpConvert() { return this; }
@ -1502,6 +1565,9 @@ class LIR_Op2: public LIR_Op {
LIR_Condition condition() const {
assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); return _condition;
}
void set_condition(LIR_Condition condition) {
assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); _condition = condition;
}
void set_fpu_stack_size(int size) { _fpu_stack_size = size; }
int fpu_stack_size() const { return _fpu_stack_size; }
@ -1650,8 +1716,9 @@ class LIR_OpCompareAndSwap : public LIR_Op {
LIR_Opr _tmp2;
public:
LIR_OpCompareAndSwap(LIR_Code code, LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2)
: LIR_Op(code, LIR_OprFact::illegalOpr, NULL) // no result, no info
LIR_OpCompareAndSwap(LIR_Code code, LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result)
: LIR_Op(code, result, NULL) // no result, no info
, _addr(addr)
, _cmp_value(cmp_value)
, _new_value(new_value)
@ -1832,6 +1899,9 @@ class LIR_List: public CompilationResourceObj {
void safepoint(LIR_Opr tmp, CodeEmitInfo* info) { append(new LIR_Op1(lir_safepoint, tmp, info)); }
#ifdef PPC
void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); }
#endif
void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); }
void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and, left, right, dst)); }
@ -1867,9 +1937,12 @@ class LIR_List: public CompilationResourceObj {
append(new LIR_Op2(lir_cmove, condition, src1, src2, dst));
}
void cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
void cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, LIR_Opr t1, LIR_Opr t2);
void cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
void cas_obj(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
void cas_int(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr);
void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_abs , from, tmp, to)); }
void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_sqrt, from, tmp, to)); }
@ -1950,7 +2023,7 @@ class LIR_List: public CompilationResourceObj {
}
void load_stack_address_monitor(int monitor_ix, LIR_Opr dst) { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, CodeStub* stub);
void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info);
void set_24bit_fpu() { append(new LIR_Op0(lir_24bit_FPU )); }

View File

@ -31,6 +31,12 @@
#define __ gen()->lir()->
#endif
// TODO: ARM - Use some recognizable constant which still fits architectural constraints
#ifdef ARM
#define PATCHED_ADDR (204)
#else
#define PATCHED_ADDR (max_jint)
#endif
void PhiResolverState::reset(int max_vregs) {
// Initialize array sizes
@ -225,13 +231,13 @@ void LIRItem::load_for_store(BasicType type) {
void LIRItem::load_item_force(LIR_Opr reg) {
LIR_Opr r = result();
if (r != reg) {
#if !defined(ARM) && !defined(E500V2)
if (r->type() != reg->type()) {
// moves between different types need an intervening spill slot
LIR_Opr tmp = _gen->force_to_spill(r, reg->type());
__ move(tmp, reg);
} else {
__ move(r, reg);
r = _gen->force_to_spill(r, reg->type());
}
#endif
__ move(r, reg);
_result = reg;
}
}
@ -628,14 +634,14 @@ void LIRGenerator::monitor_enter(LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_
}
void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, int monitor_no) {
void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, LIR_Opr scratch, int monitor_no) {
if (!GenerateSynchronizationCode) return;
// setup registers
LIR_Opr hdr = lock;
lock = new_hdr;
CodeStub* slow_path = new MonitorExitStub(lock, UseFastLocking, monitor_no);
__ load_stack_address_monitor(monitor_no, lock);
__ unlock_object(hdr, object, lock, slow_path);
__ unlock_object(hdr, object, lock, scratch, slow_path);
}
@ -1400,6 +1406,25 @@ void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc*
}
assert(addr->is_register(), "must be a register at this point");
#ifdef ARM
// TODO: ARM - move to platform-dependent code
LIR_Opr tmp = FrameMap::R14_opr;
if (VM_Version::supports_movw()) {
__ move((LIR_Opr)card_table_base, tmp);
} else {
__ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
}
CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
if(((int)ct->byte_map_base & 0xff) == 0) {
__ move(tmp, card_addr);
} else {
LIR_Opr tmp_zero = new_register(T_INT);
__ move(LIR_OprFact::intConst(0), tmp_zero);
__ move(tmp_zero, card_addr);
}
#else // ARM
LIR_Opr tmp = new_pointer_register();
if (TwoOperandLIRForm) {
__ move(addr, tmp);
@ -1415,6 +1440,7 @@ void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc*
new LIR_Address(tmp, load_constant(card_table_base),
T_BYTE));
}
#endif // ARM
}
@ -1507,7 +1533,7 @@ void LIRGenerator::do_StoreField(StoreField* x) {
// generate_address to try to be smart about emitting the -1.
// Otherwise the patching code won't know how to find the
// instruction to patch.
address = new LIR_Address(object.result(), max_jint, field_type);
address = new LIR_Address(object.result(), PATCHED_ADDR, field_type);
} else {
address = generate_address(object.result(), x->offset(), field_type);
}
@ -1584,7 +1610,7 @@ void LIRGenerator::do_LoadField(LoadField* x) {
// generate_address to try to be smart about emitting the -1.
// Otherwise the patching code won't know how to find the
// instruction to patch.
address = new LIR_Address(object.result(), max_jint, field_type);
address = new LIR_Address(object.result(), PATCHED_ADDR, field_type);
} else {
address = generate_address(object.result(), x->offset(), field_type);
}
@ -1844,6 +1870,8 @@ void LIRGenerator::do_UnsafeGetRaw(UnsafeGetRaw* x) {
}
#endif
addr = new LIR_Address(base_op, index_op, LIR_Address::Scale(log2_scale), 0, dst_type);
#elif defined(ARM)
addr = generate_address(base_op, index_op, log2_scale, 0, dst_type);
#else
if (index_op->is_illegal() || log2_scale == 0) {
#ifdef _LP64
@ -1916,6 +1944,7 @@ void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) {
__ convert(Bytecodes::_i2l, idx.result(), index_op);
} else {
#endif
// TODO: ARM also allows embedded shift in the address
__ move(idx.result(), index_op);
#ifdef _LP64
}
@ -2204,7 +2233,10 @@ void LIRGenerator::do_Base(Base* x) {
// Assign new location to Local instruction for this local
Local* local = x->state()->local_at(java_index)->as_Local();
assert(local != NULL, "Locals for incoming arguments must have been created");
#ifndef __SOFTFP__
// The java calling convention passes double as long and float as int.
assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
#endif // __SOFTFP__
local->set_operand(dest);
_instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
java_index += type2size[t];

View File

@ -314,7 +314,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right);
void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);
void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, int monitor_no);
void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);
void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info);
@ -338,6 +338,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
}
LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark);
// the helper for generate_address
void add_large_constant(LIR_Opr src, int c, LIR_Opr dest);
// machine preferences and characteristics
bool can_inline_as_constant(Value i) const;
bool can_inline_as_constant(LIR_Const* c) const;
@ -393,6 +396,10 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
return l;
}
#ifdef __SOFTFP__
void do_soft_float_compare(If *x);
#endif // __SOFTFP__
void init();
SwitchRangeArray* create_lookup_ranges(TableSwitch* x);
@ -444,6 +451,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
static LIR_Opr remOutOpr();
static LIR_Opr shiftCountOpr();
LIR_Opr syncTempOpr();
LIR_Opr atomicLockOpr();
// returns a register suitable for saving the thread in a
// call_runtime_leaf if one is needed.

View File

@ -169,7 +169,11 @@ bool LinearScan::is_precolored_cpu_interval(const Interval* i) {
}
bool LinearScan::is_virtual_cpu_interval(const Interval* i) {
#if defined(__SOFTFP__) || defined(E500V2)
return i->reg_num() >= LIR_OprDesc::vreg_base;
#else
return i->reg_num() >= LIR_OprDesc::vreg_base && (i->type() != T_FLOAT && i->type() != T_DOUBLE);
#endif // __SOFTFP__ or E500V2
}
bool LinearScan::is_precolored_fpu_interval(const Interval* i) {
@ -177,7 +181,11 @@ bool LinearScan::is_precolored_fpu_interval(const Interval* i) {
}
bool LinearScan::is_virtual_fpu_interval(const Interval* i) {
#if defined(__SOFTFP__) || defined(E500V2)
return false;
#else
return i->reg_num() >= LIR_OprDesc::vreg_base && (i->type() == T_FLOAT || i->type() == T_DOUBLE);
#endif // __SOFTFP__ or E500V2
}
bool LinearScan::is_in_fpu_register(const Interval* i) {
@ -2010,12 +2018,18 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) {
return LIR_OprFact::single_cpu_oop(assigned_reg);
}
#ifdef __SOFTFP__
case T_FLOAT: // fall through
#endif // __SOFTFP__
case T_INT: {
assert(assigned_reg >= pd_first_cpu_reg && assigned_reg <= pd_last_cpu_reg, "no cpu register");
assert(interval->assigned_regHi() == any_reg, "must not have hi register");
return LIR_OprFact::single_cpu(assigned_reg);
}
#ifdef __SOFTFP__
case T_DOUBLE: // fall through
#endif // __SOFTFP__
case T_LONG: {
int assigned_regHi = interval->assigned_regHi();
assert(assigned_reg >= pd_first_cpu_reg && assigned_reg <= pd_last_cpu_reg, "no cpu register");
@ -2033,7 +2047,7 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) {
#ifdef _LP64
return LIR_OprFact::double_cpu(assigned_reg, assigned_reg);
#else
#ifdef SPARC
#if defined(SPARC) || defined(PPC)
return LIR_OprFact::double_cpu(assigned_regHi, assigned_reg);
#else
return LIR_OprFact::double_cpu(assigned_reg, assigned_regHi);
@ -2041,6 +2055,7 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) {
#endif // LP64
}
#ifndef __SOFTFP__
case T_FLOAT: {
#ifdef X86
if (UseSSE >= 1) {
@ -2069,6 +2084,11 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) {
assert(interval->assigned_regHi() >= pd_first_fpu_reg && interval->assigned_regHi() <= pd_last_fpu_reg, "no fpu register");
assert(assigned_reg % 2 == 0 && assigned_reg + 1 == interval->assigned_regHi(), "must be sequential and even");
LIR_Opr result = LIR_OprFact::double_fpu(interval->assigned_regHi() - pd_first_fpu_reg, assigned_reg - pd_first_fpu_reg);
#elif defined(ARM)
assert(assigned_reg >= pd_first_fpu_reg && assigned_reg <= pd_last_fpu_reg, "no fpu register");
assert(interval->assigned_regHi() >= pd_first_fpu_reg && interval->assigned_regHi() <= pd_last_fpu_reg, "no fpu register");
assert(assigned_reg % 2 == 0 && assigned_reg + 1 == interval->assigned_regHi(), "must be sequential and even");
LIR_Opr result = LIR_OprFact::double_fpu(assigned_reg - pd_first_fpu_reg, interval->assigned_regHi() - pd_first_fpu_reg);
#else
assert(assigned_reg >= pd_first_fpu_reg && assigned_reg <= pd_last_fpu_reg, "no fpu register");
assert(interval->assigned_regHi() == any_reg, "must not have hi register (double fpu values are stored in one register on Intel)");
@ -2076,6 +2096,7 @@ LIR_Opr LinearScan::calc_operand_for_interval(const Interval* interval) {
#endif
return result;
}
#endif // __SOFTFP__
default: {
ShouldNotReachHere();
@ -2638,6 +2659,12 @@ int LinearScan::append_scope_value_for_operand(LIR_Opr opr, GrowableArray<ScopeV
#ifdef SPARC
assert(opr->fpu_regnrLo() == opr->fpu_regnrHi() + 1, "assumed in calculation (only fpu_regnrHi is used)");
#endif
#ifdef ARM
assert(opr->fpu_regnrHi() == opr->fpu_regnrLo() + 1, "assumed in calculation (only fpu_regnrLo is used)");
#endif
#ifdef PPC
assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation (only fpu_regnrHi is used)");
#endif
VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi());
#ifdef _LP64
@ -6135,6 +6162,17 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
assert(prev_op->as_OpBranch() != NULL, "branch must be of type LIR_OpBranch");
LIR_OpBranch* prev_branch = (LIR_OpBranch*)prev_op;
LIR_Op2* prev_cmp = NULL;
for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) {
prev_op = instructions->at(j);
if(prev_op->code() == lir_cmp) {
assert(prev_op->as_Op2() != NULL, "branch must be of type LIR_Op2");
prev_cmp = (LIR_Op2*)prev_op;
assert(prev_branch->cond() == prev_cmp->condition(), "should be the same");
}
}
assert(prev_cmp != NULL, "should have found comp instruction for branch");
if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) {
TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id()));
@ -6142,6 +6180,7 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
// eliminate a conditional branch to the immediate successor
prev_branch->change_block(last_branch->block());
prev_branch->negate_cond();
prev_cmp->set_condition(prev_branch->cond());
instructions->truncate(instructions->length() - 1);
}
}

View File

@ -144,7 +144,7 @@ void Runtime1::generate_blob_for(BufferBlob* buffer_blob, StubID id) {
#ifndef TIERED
case counter_overflow_id: // Not generated outside the tiered world
#endif
#ifdef SPARC
#if defined(SPARC) || defined(PPC)
case handle_exception_nofpu_id: // Unused on sparc
#endif
break;
@ -240,7 +240,8 @@ const char* Runtime1::name_for_address(address entry) {
#undef FUNCTION_CASE
return "<unknown function>";
// Soft float adds more runtime names.
return pd_name_for_address(entry);
}
@ -896,7 +897,10 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
} else {
// patch the instruction <move reg, klass>
NativeMovConstReg* n_copy = nativeMovConstReg_at(copy_buff);
assert(n_copy->data() == 0, "illegal init value");
assert(n_copy->data() == 0 ||
n_copy->data() == (int)Universe::non_oop_word(),
"illegal init value");
assert(load_klass() != NULL, "klass not set");
n_copy->set_data((intx) (load_klass()));
@ -904,7 +908,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
}
#ifdef SPARC
#if defined(SPARC) || defined(PPC)
// Update the oop location in the nmethod with the proper
// oop. When the code was generated, a NULL was stuffed
// in the oop table and that table needs to be update to
@ -934,6 +938,14 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
if (do_patch) {
// replace instructions
// first replace the tail, then the call
#ifdef ARM
if(stub_id == Runtime1::load_klass_patching_id && !VM_Version::supports_movw()) {
copy_buff -= *byte_count;
NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
n_copy2->set_data((intx) (load_klass()), instr_pc);
}
#endif
for (int i = NativeCall::instruction_size; i < *byte_count; i++) {
address ptr = copy_buff + i;
int a_byte = (*ptr) & 0xFF;
@ -960,6 +972,12 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1);
relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2,
relocInfo::none, relocInfo::oop_type);
#endif
#ifdef PPC
{ address instr_pc2 = instr_pc + NativeMovConstReg::lo_offset;
RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1);
relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2, relocInfo::none, relocInfo::oop_type);
}
#endif
}

View File

@ -159,6 +159,9 @@ class Runtime1: public AllStatic {
static const char* name_for (StubID id);
static const char* name_for_address(address entry);
// platform might add runtime names.
static const char* pd_name_for_address(address entry);
// method tracing
static void trace_block_entry(jint block_id);

View File

@ -564,72 +564,53 @@ void CodeBlob::verify() {
ShouldNotReachHere();
}
#ifndef PRODUCT
void CodeBlob::print() const {
tty->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
tty->print_cr("Framesize: %d", _frame_size);
void CodeBlob::print_on(outputStream* st) const {
st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
st->print_cr("Framesize: %d", _frame_size);
}
void CodeBlob::print_value_on(outputStream* st) const {
st->print_cr("[CodeBlob]");
}
#endif
void BufferBlob::verify() {
// unimplemented
}
#ifndef PRODUCT
void BufferBlob::print() const {
CodeBlob::print();
print_value_on(tty);
void BufferBlob::print_on(outputStream* st) const {
CodeBlob::print_on(st);
print_value_on(st);
}
void BufferBlob::print_value_on(outputStream* st) const {
st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", this, name());
}
#endif
void RuntimeStub::verify() {
// unimplemented
}
#ifndef PRODUCT
void RuntimeStub::print() const {
CodeBlob::print();
tty->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
tty->print_cr(name());
Disassembler::decode((CodeBlob*)this);
void RuntimeStub::print_on(outputStream* st) const {
CodeBlob::print_on(st);
st->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
st->print_cr(name());
Disassembler::decode((CodeBlob*)this, st);
}
void RuntimeStub::print_value_on(outputStream* st) const {
st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name());
}
#endif
void SingletonBlob::verify() {
// unimplemented
}
#ifndef PRODUCT
void SingletonBlob::print() const {
CodeBlob::print();
tty->print_cr(name());
Disassembler::decode((CodeBlob*)this);
void SingletonBlob::print_on(outputStream* st) const {
CodeBlob::print_on(st);
st->print_cr(name());
Disassembler::decode((CodeBlob*)this, st);
}
void SingletonBlob::print_value_on(outputStream* st) const {
st->print_cr(name());
}
@ -637,5 +618,3 @@ void SingletonBlob::print_value_on(outputStream* st) const {
void DeoptimizationBlob::print_value_on(outputStream* st) const {
st->print_cr("Deoptimization (frame not available)");
}
#endif // PRODUCT

View File

@ -163,8 +163,9 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
// Debugging
virtual void verify();
virtual void print() const PRODUCT_RETURN;
virtual void print_value_on(outputStream* st) const PRODUCT_RETURN;
void print() const { print_on(tty); }
virtual void print_on(outputStream* st) const;
virtual void print_value_on(outputStream* st) const;
// Print the comment associated with offset on stream, if there is one
virtual void print_block_comment(outputStream* stream, address block_begin) {
@ -209,8 +210,8 @@ class BufferBlob: public CodeBlob {
bool is_alive() const { return true; }
void verify();
void print() const PRODUCT_RETURN;
void print_value_on(outputStream* st) const PRODUCT_RETURN;
void print_on(outputStream* st) const;
void print_value_on(outputStream* st) const;
};
@ -292,8 +293,8 @@ class RuntimeStub: public CodeBlob {
bool is_alive() const { return true; }
void verify();
void print() const PRODUCT_RETURN;
void print_value_on(outputStream* st) const PRODUCT_RETURN;
void print_on(outputStream* st) const;
void print_value_on(outputStream* st) const;
};
@ -317,8 +318,8 @@ class SingletonBlob: public CodeBlob {
bool is_alive() const { return true; }
void verify(); // does nothing
void print() const PRODUCT_RETURN;
void print_value_on(outputStream* st) const PRODUCT_RETURN;
void print_on(outputStream* st) const;
void print_value_on(outputStream* st) const;
};
@ -373,7 +374,7 @@ class DeoptimizationBlob: public SingletonBlob {
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
// Printing
void print_value_on(outputStream* st) const PRODUCT_RETURN;
void print_value_on(outputStream* st) const;
address unpack() const { return instructions_begin() + _unpack_offset; }
address unpack_with_exception() const { return instructions_begin() + _unpack_with_exception; }

View File

@ -606,6 +606,8 @@ public:
void print_nul_chk_table() PRODUCT_RETURN;
void print_nmethod(bool print_code);
// need to re-define this from CodeBlob else the overload hides it
virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
void print_on(outputStream* st, const char* title) const;
// Logging

View File

@ -67,8 +67,8 @@ void* VtableStub::operator new(size_t size, int code_size) {
}
void VtableStub::print() {
tty->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
void VtableStub::print_on(outputStream* st) const {
st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
index(), receiver_location(), code_begin(), code_end());
}

View File

@ -86,7 +86,9 @@ class VtableStub {
bool is_abstract_method_error(address epc) { return epc == code_begin()+_ame_offset; }
bool is_null_pointer_exception(address epc) { return epc == code_begin()+_npe_offset; }
void print();
void print_on(outputStream* st) const;
void print() const { print_on(tty); }
};

View File

@ -371,7 +371,7 @@ static int printf_to_env(void* env_pv, const char* format, ...) {
address decode_env::decode_instructions(address start, address end) {
_start = start; _end = end;
assert((((intptr_t)start | (intptr_t)end) % Disassembler::pd_instruction_alignment() == 0), "misaligned insn addr");
assert(((((intptr_t)start | (intptr_t)end) % Disassembler::pd_instruction_alignment()) == 0), "misaligned insn addr");
const int show_bytes = false; // for disassembler debugging

View File

@ -252,6 +252,7 @@ c1_LIRGenerator.cpp ciCPCache.hpp
c1_LIRGenerator.cpp ciInstance.hpp
c1_LIRGenerator.cpp heapRegion.hpp
c1_LIRGenerator.cpp sharedRuntime.hpp
c1_LIRGenerator.cpp stubRoutines.hpp
c1_LIRGenerator.hpp c1_Instruction.hpp
c1_LIRGenerator.hpp c1_LIR.hpp
@ -270,6 +271,8 @@ c1_LIRGenerator_<arch>.cpp ciObjArrayKlass.hpp
c1_LIRGenerator_<arch>.cpp ciTypeArrayKlass.hpp
c1_LIRGenerator_<arch>.cpp sharedRuntime.hpp
c1_LIRGenerator_<arch>.cpp vmreg_<arch>.inline.hpp
c1_LIRGenerator_<arch>.cpp stubRoutines.hpp
c1_LinearScan.cpp bitMap.inline.hpp
c1_LinearScan.cpp c1_CFGPrinter.hpp
@ -413,6 +416,7 @@ codeBlob.cpp c1_Runtime1.hpp
compileBroker.cpp c1_Compiler.hpp
frame_<arch>.cpp c1_Runtime1.hpp
frame_<arch>.cpp vframeArray.hpp
globals.cpp c1_globals.hpp

View File

@ -284,6 +284,7 @@ atomic.hpp allocation.hpp
atomic_<os_arch>.inline.hpp atomic.hpp
atomic_<os_arch>.inline.hpp os.hpp
atomic_<os_arch>.inline.hpp vm_version_<arch>.hpp
atomic_<os_arch>.inline.hpp orderAccess_<os_arch>.inline.hpp
// attachListener is jck optional, put cpp deps in includeDB_features
@ -1734,6 +1735,7 @@ genCollectedHeap.cpp sharedHeap.hpp
genCollectedHeap.cpp space.hpp
genCollectedHeap.cpp symbolTable.hpp
genCollectedHeap.cpp systemDictionary.hpp
genCollectedHeap.cpp vmError.hpp
genCollectedHeap.cpp vmGCOperations.hpp
genCollectedHeap.cpp vmSymbols.hpp
genCollectedHeap.cpp vmThread.hpp
@ -3230,6 +3232,7 @@ os.cpp defaultStream.hpp
os.cpp events.hpp
os.cpp frame.inline.hpp
os.cpp hpi.hpp
os.cpp icBuffer.hpp
os.cpp interfaceSupport.hpp
os.cpp interpreter.hpp
os.cpp java.hpp
@ -3241,6 +3244,7 @@ os.cpp mutexLocker.hpp
os.cpp oop.inline.hpp
os.cpp os.hpp
os.cpp os_<os_family>.inline.hpp
os.cpp privilegedStack.hpp
os.cpp stubRoutines.hpp
os.cpp systemDictionary.hpp
os.cpp threadService.hpp

View File

@ -339,7 +339,8 @@
#define CHECK_NULL(obj_) \
if ((obj_) == NULL) { \
VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), ""); \
}
} \
VERIFY_OOP(obj_)
#define VMdoubleConstZero() 0.0
#define VMdoubleConstOne() 1.0
@ -509,7 +510,7 @@ BytecodeInterpreter::run(interpreterState istate) {
/* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic,
/* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial,
/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,NULL, &&opc_new,
/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_default, &&opc_new,
/* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow,
/* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit,
@ -539,6 +540,7 @@ BytecodeInterpreter::run(interpreterState istate) {
// this will trigger a VERIFY_OOP on entry
if (istate->msg() != initialize && ! METHOD->is_static()) {
oop rcvr = LOCALS_OBJECT(0);
VERIFY_OOP(rcvr);
}
#endif
// #define HACK
@ -547,7 +549,7 @@ BytecodeInterpreter::run(interpreterState istate) {
#endif // HACK
/* QQQ this should be a stack method so we don't know actual direction */
assert(istate->msg() == initialize ||
guarantee(istate->msg() == initialize ||
topOfStack >= istate->stack_limit() &&
topOfStack < istate->stack_base(),
"Stack top out of range");
@ -613,6 +615,7 @@ BytecodeInterpreter::run(interpreterState istate) {
rcvr = METHOD->constants()->pool_holder()->klass_part()->java_mirror();
} else {
rcvr = LOCALS_OBJECT(0);
VERIFY_OOP(rcvr);
}
// The initial monitor is ours for the taking
BasicObjectLock* mon = &istate->monitor_base()[-1];
@ -735,6 +738,7 @@ BytecodeInterpreter::run(interpreterState istate) {
case popping_frame: {
// returned from a java call to pop the frame, restart the call
// clear the message so we don't confuse ourselves later
ShouldNotReachHere(); // we don't return this.
assert(THREAD->pop_frame_in_process(), "wrong frame pop state");
istate->set_msg(no_request);
THREAD->clr_pop_frame_in_process();
@ -801,6 +805,7 @@ BytecodeInterpreter::run(interpreterState istate) {
// continue locking now that we have a monitor to use
// we expect to find newly allocated monitor at the "top" of the monitor stack.
oop lockee = STACK_OBJECT(-1);
VERIFY_OOP(lockee);
// derefing's lockee ought to provoke implicit null check
// find a free monitor
BasicObjectLock* entry = (BasicObjectLock*) istate->stack_base();
@ -911,6 +916,7 @@ run:
/* load from local variable */
CASE(_aload):
VERIFY_OOP(LOCALS_OBJECT(pc[1]));
SET_STACK_OBJECT(LOCALS_OBJECT(pc[1]), 0);
UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1);
@ -930,6 +936,7 @@ run:
#undef OPC_LOAD_n
#define OPC_LOAD_n(num) \
CASE(_aload_##num): \
VERIFY_OOP(LOCALS_OBJECT(num)); \
SET_STACK_OBJECT(LOCALS_OBJECT(num), 0); \
UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); \
\
@ -975,6 +982,7 @@ run:
opcode = pc[1];
switch(opcode) {
case Bytecodes::_aload:
VERIFY_OOP(LOCALS_OBJECT(reg));
SET_STACK_OBJECT(LOCALS_OBJECT(reg), 0);
UPDATE_PC_AND_TOS_AND_CONTINUE(4, 1);
@ -1099,7 +1107,7 @@ run:
CASE(_i##opcname): \
if (test && (STACK_INT(-1) == 0)) { \
VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
"/ by int zero"); \
"/ by zero"); \
} \
SET_STACK_INT(VMint##opname(STACK_INT(-2), \
STACK_INT(-1)), \
@ -1277,7 +1285,12 @@ run:
jfloat f;
jdouble r;
f = STACK_FLOAT(-1);
#ifdef IA64
// IA64 gcc bug
r = ( f == 0.0f ) ? (jdouble) f : (jdouble) f + ia64_double_zero;
#else
r = (jdouble) f;
#endif
MORE_STACK(-1); // POP
SET_STACK_DOUBLE(r, 1);
UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2);
@ -1471,6 +1484,7 @@ run:
CASE(_return_register_finalizer): {
oop rcvr = LOCALS_OBJECT(0);
VERIFY_OOP(rcvr);
if (rcvr->klass()->klass_part()->has_finalizer()) {
CALL_VM(InterpreterRuntime::register_finalizer(THREAD, rcvr), handle_exception);
}
@ -1561,6 +1575,7 @@ run:
*/
CASE(_aastore): {
oop rhsObject = STACK_OBJECT(-1);
VERIFY_OOP(rhsObject);
ARRAY_INTRO( -3);
// arrObj, index are set
if (rhsObject != NULL) {
@ -1703,6 +1718,7 @@ run:
obj = (oop)NULL;
} else {
obj = (oop) STACK_OBJECT(-1);
VERIFY_OOP(obj);
}
CALL_VM(InterpreterRuntime::post_field_access(THREAD,
obj,
@ -1728,6 +1744,7 @@ run:
int field_offset = cache->f2();
if (cache->is_volatile()) {
if (tos_type == atos) {
VERIFY_OOP(obj->obj_field_acquire(field_offset));
SET_STACK_OBJECT(obj->obj_field_acquire(field_offset), -1);
} else if (tos_type == itos) {
SET_STACK_INT(obj->int_field_acquire(field_offset), -1);
@ -1748,6 +1765,7 @@ run:
}
} else {
if (tos_type == atos) {
VERIFY_OOP(obj->obj_field(field_offset));
SET_STACK_OBJECT(obj->obj_field(field_offset), -1);
} else if (tos_type == itos) {
SET_STACK_INT(obj->int_field(field_offset), -1);
@ -1799,6 +1817,7 @@ run:
} else {
obj = (oop) STACK_OBJECT(-2);
}
VERIFY_OOP(obj);
}
CALL_VM(InterpreterRuntime::post_field_modification(THREAD,
@ -1837,6 +1856,7 @@ run:
if (tos_type == itos) {
obj->release_int_field_put(field_offset, STACK_INT(-1));
} else if (tos_type == atos) {
VERIFY_OOP(STACK_OBJECT(-1));
obj->release_obj_field_put(field_offset, STACK_OBJECT(-1));
OrderAccess::release_store(&BYTE_MAP_BASE[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
} else if (tos_type == btos) {
@ -1857,6 +1877,7 @@ run:
if (tos_type == itos) {
obj->int_field_put(field_offset, STACK_INT(-1));
} else if (tos_type == atos) {
VERIFY_OOP(STACK_OBJECT(-1));
obj->obj_field_put(field_offset, STACK_OBJECT(-1));
OrderAccess::release_store(&BYTE_MAP_BASE[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
} else if (tos_type == btos) {
@ -1961,6 +1982,7 @@ run:
}
CASE(_checkcast):
if (STACK_OBJECT(-1) != NULL) {
VERIFY_OOP(STACK_OBJECT(-1));
u2 index = Bytes::get_Java_u2(pc+1);
if (ProfileInterpreter) {
// needs Profile_checkcast QQQ
@ -1999,6 +2021,7 @@ run:
if (STACK_OBJECT(-1) == NULL) {
SET_STACK_INT(0, -1);
} else {
VERIFY_OOP(STACK_OBJECT(-1));
u2 index = Bytes::get_Java_u2(pc+1);
// Constant pool may have actual klass or unresolved klass. If it is
// unresolved we must resolve it
@ -2044,10 +2067,12 @@ run:
break;
case JVM_CONSTANT_String:
VERIFY_OOP(constants->resolved_string_at(index));
SET_STACK_OBJECT(constants->resolved_string_at(index), 0);
break;
case JVM_CONSTANT_Class:
VERIFY_OOP(constants->resolved_klass_at(index)->klass_part()->java_mirror());
SET_STACK_OBJECT(constants->resolved_klass_at(index)->klass_part()->java_mirror(), 0);
break;
@ -2059,17 +2084,6 @@ run:
THREAD->set_vm_result(NULL);
break;
#if 0
CASE(_fast_igetfield):
CASE(_fastagetfield):
CASE(_fast_aload_0):
CASE(_fast_iaccess_0):
CASE(__fast_aaccess_0):
CASE(_fast_linearswitch):
CASE(_fast_binaryswitch):
fatal("unsupported fast bytecode");
#endif
default: ShouldNotReachHere();
}
UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
@ -2122,6 +2136,7 @@ run:
// get receiver
int parms = cache->parameter_size();
// Same comments as invokevirtual apply here
VERIFY_OOP(STACK_OBJECT(-parms));
instanceKlass* rcvrKlass = (instanceKlass*)
STACK_OBJECT(-parms)->klass()->klass_part();
callee = (methodOop) rcvrKlass->start_of_vtable()[ cache->f2()];
@ -2205,6 +2220,7 @@ run:
// this fails with an assert
// instanceKlass* rcvrKlass = instanceKlass::cast(STACK_OBJECT(-parms)->klass());
// but this works
VERIFY_OOP(STACK_OBJECT(-parms));
instanceKlass* rcvrKlass = (instanceKlass*) STACK_OBJECT(-parms)->klass()->klass_part();
/*
Executing this code in java.lang.String:
@ -2651,14 +2667,14 @@ handle_return:
LOCALS_SLOT(METHOD->size_of_parameters() - 1));
THREAD->set_popframe_condition_bit(JavaThread::popframe_force_deopt_reexecution_bit);
}
UPDATE_PC_AND_RETURN(1);
} else {
// Normal return
// Advance the pc and return to frame manager
istate->set_msg(return_from_method);
istate->set_return_kind((Bytecodes::Code)opcode);
UPDATE_PC_AND_RETURN(1);
THREAD->clr_pop_frame_in_process();
}
// Normal return
// Advance the pc and return to frame manager
istate->set_msg(return_from_method);
istate->set_return_kind((Bytecodes::Code)opcode);
UPDATE_PC_AND_RETURN(1);
} /* handle_return: */
// This is really a fatal error return

View File

@ -440,7 +440,7 @@ static jint VMintXor(jint op1, jint op2);
* iushr, ishl, and ishr bytecodes, respectively.
*/
static jint VMintUshr(jint op, jint num);
static juint VMintUshr(jint op, jint num);
static jint VMintShl (jint op, jint num);
static jint VMintShr (jint op, jint num);

View File

@ -27,14 +27,11 @@
#ifdef CC_INTERP
#ifdef ASSERT
extern "C" { typedef void (*verify_oop_fn_t)(oop, const char *);};
#define VERIFY_OOP(o) \
/*{ verify_oop_fn_t verify_oop_entry = \
*StubRoutines::verify_oop_subroutine_entry_address(); \
if (verify_oop_entry) { \
(*verify_oop_entry)((o), "Not an oop!"); \
} \
}*/
#define VERIFY_OOP(o_) \
if (VerifyOops) { \
assert((oop(o_))->is_oop_or_null(), "Not an oop!"); \
StubRoutines::_verify_oop_count++; \
}
#else
#define VERIFY_OOP(o)
#endif

View File

@ -41,20 +41,20 @@ void InterpreterCodelet::verify() {
}
void InterpreterCodelet::print() {
void InterpreterCodelet::print_on(outputStream* st) const {
if (PrintInterpreter) {
tty->cr();
tty->print_cr("----------------------------------------------------------------------");
st->cr();
st->print_cr("----------------------------------------------------------------------");
}
if (description() != NULL) tty->print("%s ", description());
if (bytecode() >= 0 ) tty->print("%d %s ", bytecode(), Bytecodes::name(bytecode()));
tty->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes",
if (description() != NULL) st->print("%s ", description());
if (bytecode() >= 0 ) st->print("%d %s ", bytecode(), Bytecodes::name(bytecode()));
st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes",
code_begin(), code_end(), code_size());
if (PrintInterpreter) {
tty->cr();
Disassembler::decode(code_begin(), code_end(), tty);
st->cr();
Disassembler::decode(code_begin(), code_end(), st);
}
}

View File

@ -52,7 +52,8 @@ class InterpreterCodelet: public Stub {
// Debugging
void verify();
void print();
void print_on(outputStream* st) const;
void print() const { print_on(tty); }
// Interpreter-specific initialization
void initialize(const char* description, Bytecodes::Code bytecode);

View File

@ -281,9 +281,7 @@ class MaskFillerForNative: public NativeSignatureIterator {
public:
void pass_int() { /* ignore */ }
void pass_long() { /* ignore */ }
#if defined(_LP64) || defined(ZERO)
void pass_float() { /* ignore */ }
#endif
void pass_double() { /* ignore */ }
void pass_object() { set_one(offset()); }

View File

@ -166,32 +166,40 @@ class ChunkPool {
_medium_pool = new ChunkPool(Chunk::medium_size + Chunk::aligned_overhead_size());
_small_pool = new ChunkPool(Chunk::init_size + Chunk::aligned_overhead_size());
}
static void clean() {
enum { BlocksToKeep = 5 };
_small_pool->free_all_but(BlocksToKeep);
_medium_pool->free_all_but(BlocksToKeep);
_large_pool->free_all_but(BlocksToKeep);
}
};
ChunkPool* ChunkPool::_large_pool = NULL;
ChunkPool* ChunkPool::_medium_pool = NULL;
ChunkPool* ChunkPool::_small_pool = NULL;
void chunkpool_init() {
ChunkPool::initialize();
}
void
Chunk::clean_chunk_pool() {
ChunkPool::clean();
}
//--------------------------------------------------------------------------------------
// ChunkPoolCleaner implementation
//
class ChunkPoolCleaner : public PeriodicTask {
enum { CleaningInterval = 5000, // cleaning interval in ms
BlocksToKeep = 5 // # of extra blocks to keep
};
enum { CleaningInterval = 5000 }; // cleaning interval in ms
public:
ChunkPoolCleaner() : PeriodicTask(CleaningInterval) {}
void task() {
ChunkPool::small_pool()->free_all_but(BlocksToKeep);
ChunkPool::medium_pool()->free_all_but(BlocksToKeep);
ChunkPool::large_pool()->free_all_but(BlocksToKeep);
ChunkPool::clean();
}
};

View File

@ -174,8 +174,9 @@ class Chunk: public CHeapObj {
// Start the chunk_pool cleaner task
static void start_chunk_pool_cleaner_task();
};
static void clean_chunk_pool();
};
//------------------------------Arena------------------------------------------
// Fast allocation of memory

View File

@ -941,7 +941,9 @@ bool GenCollectedHeap::is_in(const void* p) const {
VerifyBeforeExit ||
PrintAssembly ||
tty->count() != 0 || // already printing
VerifyAfterGC, "too expensive");
VerifyAfterGC ||
VMError::fatal_error_in_progress(), "too expensive");
#endif
// This might be sped up with a cache of the last generation that
// answered yes.

View File

@ -131,7 +131,9 @@ class Generation: public CHeapObj {
enum SomePublicConstants {
// Generations are GenGrain-aligned and have size that are multiples of
// GenGrain.
LogOfGenGrain = 16,
// Note: on ARM we add 1 bit for card_table_base to be properly aligned
// (we expect its low byte to be zero - see implementation of post_barrier)
LogOfGenGrain = 16 ARM_ONLY(+1),
GenGrain = 1 << LogOfGenGrain
};

View File

@ -179,8 +179,6 @@ jint arrayKlass::jvmti_class_status() const {
return JVMTI_CLASS_STATUS_ARRAY;
}
#ifndef PRODUCT
// Printing
void arrayKlass::oop_print_on(oop obj, outputStream* st) {
@ -189,8 +187,6 @@ void arrayKlass::oop_print_on(oop obj, outputStream* st) {
st->print_cr(" - length: %d", arrayOop(obj)->length());
}
#endif
// Verification
void arrayKlass::oop_verify_on(oop obj, outputStream* st) {

View File

@ -115,20 +115,15 @@ class arrayKlass: public Klass {
// Return a handle.
static void complete_create_array_klass(arrayKlassHandle k, KlassHandle super_klass, TRAPS);
public:
// jvm support
jint compute_modifier_flags(TRAPS) const;
// jvm support
jint compute_modifier_flags(TRAPS) const;
public:
// JVMTI support
jint jvmti_class_status() const;
// JVMTI support
jint jvmti_class_status() const;
#ifndef PRODUCT
public:
// Printing
void oop_print_on(oop obj, outputStream* st);
#endif
public:
// Verification
void oop_verify_on(oop obj, outputStream* st);
};

View File

@ -151,15 +151,12 @@ arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
}
#endif // SERIALGC
#ifndef PRODUCT
// Printing
void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass");
klassKlass::oop_print_on(obj, st);
}
#endif //PRODUCT
void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass");

View File

@ -55,12 +55,9 @@ class arrayKlassKlass : public klassKlass {
int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif //PRODUCT
// Verification
const char* internal_name() const;

View File

@ -154,8 +154,6 @@ int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
}
#endif // SERIALGC
#ifndef PRODUCT
// Printing
void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
@ -166,8 +164,6 @@ void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
st->print(" - klass: "); c->holder_klass()->print_value_on(st); st->cr();
}
#endif //PRODUCT
void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
Klass::oop_print_value_on(obj, st);

View File

@ -68,12 +68,9 @@ class compiledICHolderKlass : public Klass {
int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
// Verification
const char* internal_name() const;

View File

@ -197,8 +197,6 @@ int constMethodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
}
#endif // SERIALGC
#ifndef PRODUCT
// Printing
void constMethodKlass::oop_print_on(oop obj, outputStream* st) {
@ -216,8 +214,6 @@ void constMethodKlass::oop_print_on(oop obj, outputStream* st) {
}
}
#endif //PRODUCT
// Short version of printing constMethodOop - just print the name of the
// method it belongs to.
void constMethodKlass::oop_print_value_on(oop obj, outputStream* st) {

View File

@ -77,12 +77,9 @@ public:
int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
// Verify operations
const char* internal_name() const;

View File

@ -299,8 +299,6 @@ void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
}
#endif // SERIALGC
#ifndef PRODUCT
// Printing
void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
@ -392,8 +390,6 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
st->cr();
}
#endif
void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_constantPool(), "must be constantPool");
constantPoolOop cp = constantPoolOop(obj);

View File

@ -61,18 +61,13 @@ class constantPoolKlass : public Klass {
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
// Allocation profiling support
// no idea why this is pure virtual and not in Klass ???
juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; }
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif
public:
// Verification
const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st);

View File

@ -248,8 +248,6 @@ constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
}
#endif // SERIALGC
#ifndef PRODUCT
void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
constantPoolCacheOop cache = (constantPoolCacheOop)obj;
@ -259,8 +257,6 @@ void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i);
}
#endif
void constantPoolCacheKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
constantPoolCacheOop cache = (constantPoolCacheOop)obj;

View File

@ -61,14 +61,10 @@ class constantPoolCacheKlass: public Klass {
juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; }
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif
public:
// Verification
const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st);

View File

@ -2111,7 +2111,13 @@ void GenerateOopMap::verify_error(const char *format, ...) {
// We do not distinguish between different types of errors for verification
// errors. Let the verifier give a better message.
const char *msg = "Illegal class file encountered. Try running with -Xverify:all";
error_work(msg, NULL);
_got_error = true;
// Append method name
char msg_buffer2[512];
jio_snprintf(msg_buffer2, sizeof(msg_buffer2), "%s in method %s", msg,
method()->name()->as_C_string());
_exception = Exceptions::new_exception(Thread::current(),
vmSymbols::java_lang_LinkageError(), msg_buffer2);
}
//

View File

@ -520,8 +520,6 @@ jint Klass::jvmti_class_status() const {
return 0;
}
#ifndef PRODUCT
// Printing
void Klass::oop_print_on(oop obj, outputStream* st) {
@ -541,8 +539,6 @@ void Klass::oop_print_on(oop obj, outputStream* st) {
st->cr();
}
#endif //PRODUCT
void Klass::oop_print_value_on(oop obj, outputStream* st) {
// print title
ResourceMark rm; // Cannot print in debug mode without this

View File

@ -772,16 +772,12 @@ class Klass : public Klass_vtbl {
// jvm support
virtual jint compute_modifier_flags(TRAPS) const;
public:
// JVMTI support
virtual jint jvmti_class_status() const;
public:
// Printing
virtual void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
virtual void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
// Verification
virtual const char* internal_name() const = 0;

View File

@ -194,16 +194,12 @@ int klassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
#endif // SERIALGC
#ifndef PRODUCT
// Printing
void klassKlass::oop_print_on(oop obj, outputStream* st) {
Klass::oop_print_on(obj, st);
}
#endif //PRODUCT
void klassKlass::oop_print_value_on(oop obj, outputStream* st) {
Klass::oop_print_value_on(obj, st);
}

View File

@ -67,12 +67,9 @@ class klassKlass: public Klass {
juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; }
public:
// Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
// Verification
const char* internal_name() const;

View File

@ -29,15 +29,6 @@ bool always_do_update_barrier = false;
BarrierSet* oopDesc::_bs = NULL;
#ifdef PRODUCT
void oopDesc::print_on(outputStream* st) const {}
void oopDesc::print_address_on(outputStream* st) const {}
char* oopDesc::print_string() { return NULL; }
void oopDesc::print() {}
void oopDesc::print_address() {}
#else //PRODUCT
void oopDesc::print_on(outputStream* st) const {
if (this == NULL) {
st->print_cr("NULL");
@ -62,10 +53,6 @@ char* oopDesc::print_string() {
return st.as_string();
}
#endif // PRODUCT
// The print_value functions are present in all builds, to support the disassembler.
void oopDesc::print_value() {
print_value_on(tty);
}
@ -83,9 +70,7 @@ void oopDesc::print_value_on(outputStream* st) const {
st->print("NULL");
} else if (java_lang_String::is_instance(obj)) {
java_lang_String::print(obj, st);
#ifndef PRODUCT
if (PrintOopAddress) print_address_on(st);
#endif //PRODUCT
#ifdef ASSERT
} else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
st->print("### BAD OOP %p ###", (address)obj);

View File

@ -3414,6 +3414,8 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae
thread->initialize_tlab();
thread->cache_global_variables();
// Crucial that we do not have a safepoint check for this thread, since it has
// not been added to the Thread list yet.
{ Threads_lock->lock_without_safepoint_check();

View File

@ -24,6 +24,8 @@
#ifndef _JAVA_JVMTIENVTHREADSTATE_H_
#define _JAVA_JVMTIENVTHREADSTATE_H_
class JvmtiEnv;
///////////////////////////////////////////////////////////////
//
// class JvmtiFramePop

View File

@ -2665,6 +2665,28 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req
}
#endif
// If we are running in a headless jre, force java.awt.headless property
// to be true unless the property has already been set.
// Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
if (os::is_headless_jre()) {
const char* headless = Arguments::get_property("java.awt.headless");
if (headless == NULL) {
char envbuffer[128];
if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) {
if (!add_property("java.awt.headless=true")) {
return JNI_ENOMEM;
}
} else {
char buffer[256];
strcpy(buffer, "java.awt.headless=");
strcat(buffer, envbuffer);
if (!add_property(buffer)) {
return JNI_ENOMEM;
}
}
}
}
if (!check_vm_args_consistency()) {
return JNI_ERR;
}
@ -2985,6 +3007,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
CommandLineFlags::printFlags();
}
// Apply CPU specific policy for the BiasedLocking
if (UseBiasedLocking) {
if (!VM_Version::use_biased_locking() &&
!(FLAG_IS_CMDLINE(UseBiasedLocking))) {
UseBiasedLocking = false;
}
}
return JNI_OK;
}

View File

@ -876,6 +876,7 @@ void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool quer
#endif /* CC_INTERP */
#ifndef PPC
if (m->is_native()) {
#ifdef CC_INTERP
f->do_oop((oop*)&istate->_oop_temp);
@ -883,6 +884,11 @@ void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool quer
f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset ));
#endif /* CC_INTERP */
}
#else // PPC
if (m->is_native() && m->is_static()) {
f->do_oop(interpreter_frame_mirror_addr());
}
#endif // PPC
int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();

View File

@ -25,6 +25,7 @@
typedef class BytecodeInterpreter* interpreterState;
class CodeBlob;
class vframeArray;
// A frame represents a physical stack frame (an activation). Frames
@ -296,6 +297,9 @@ class frame VALUE_OBJ_CLASS_SPEC {
void interpreter_frame_set_method(methodOop method);
methodOop* interpreter_frame_method_addr() const;
constantPoolCacheOop* interpreter_frame_cache_addr() const;
#ifdef PPC
oop* interpreter_frame_mirror_addr() const;
#endif
public:
// Entry frames

View File

@ -607,7 +607,7 @@ class CommandLineFlags {
notproduct(bool, PrintMallocFree, false, \
"Trace calls to C heap malloc/free allocation") \
\
notproduct(bool, PrintOopAddress, false, \
product(bool, PrintOopAddress, false, \
"Always print the location of the oop") \
\
notproduct(bool, VerifyCodeCacheOften, false, \
@ -3554,7 +3554,6 @@ class CommandLineFlags {
"EINTR for I/O operations results in OS_INTRPT. The default value"\
" of this flag is true for JDK 6 and earliers")
/*
* Macros for factoring of globals
*/

View File

@ -378,7 +378,8 @@ void before_exit(JavaThread * thread) {
}
// Terminate watcher thread - must before disenrolling any periodic task
WatcherThread::stop();
if (PeriodicTask::num_tasks() > 0)
WatcherThread::stop();
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {

View File

@ -76,7 +76,6 @@ public:
JavaFrameAnchor() { clear(); }
JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); }
address last_Java_pc(void) { return _last_Java_pc; }
void set_last_Java_pc(address pc) { _last_Java_pc = pc; }
// Assembly stub generation helpers

View File

@ -735,6 +735,152 @@ void os::print_date_and_time(outputStream *st) {
st->print_cr("elapsed time: %d seconds", (int)t);
}
// moved from debug.cpp (used to be find()) but still called from there
// The print_pc parameter is only set by the debug code in one case
void os::print_location(outputStream* st, intptr_t x, bool print_pc) {
address addr = (address)x;
CodeBlob* b = CodeCache::find_blob_unsafe(addr);
if (b != NULL) {
if (b->is_buffer_blob()) {
// the interpreter is generated into a buffer blob
InterpreterCodelet* i = Interpreter::codelet_containing(addr);
if (i != NULL) {
i->print_on(st);
return;
}
if (Interpreter::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
" (not bytecode specific)", addr);
return;
}
//
if (AdapterHandlerLibrary::contains(b)) {
st->print_cr("Printing AdapterHandler");
AdapterHandlerLibrary::print_handler_on(st, b);
}
// the stubroutines are generated into a buffer blob
StubCodeDesc* d = StubCodeDesc::desc_for(addr);
if (d != NULL) {
d->print_on(st);
if (print_pc) st->cr();
return;
}
if (StubRoutines::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) "
"stub routine", addr);
return;
}
// the InlineCacheBuffer is using stubs generated into a buffer blob
if (InlineCacheBuffer::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr);
return;
}
VtableStub* v = VtableStubs::stub_containing(addr);
if (v != NULL) {
v->print_on(st);
return;
}
}
if (print_pc && b->is_nmethod()) {
ResourceMark rm;
st->print("%#p: Compiled ", addr);
((nmethod*)b)->method()->print_value_on(st);
st->print(" = (CodeBlob*)" INTPTR_FORMAT, b);
st->cr();
return;
}
if ( b->is_nmethod()) {
if (b->is_zombie()) {
st->print_cr(INTPTR_FORMAT " is zombie nmethod", b);
} else if (b->is_not_entrant()) {
st->print_cr(INTPTR_FORMAT " is non-entrant nmethod", b);
}
}
b->print_on(st);
return;
}
if (Universe::heap()->is_in(addr)) {
HeapWord* p = Universe::heap()->block_start(addr);
bool print = false;
// If we couldn't find it it just may mean that heap wasn't parseable
// See if we were just given an oop directly
if (p != NULL && Universe::heap()->block_is_obj(p)) {
print = true;
} else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
p = (HeapWord*) addr;
print = true;
}
if (print) {
oop(p)->print_on(st);
if (p != (HeapWord*)x && oop(p)->is_constMethod() &&
constMethodOop(p)->contains(addr)) {
Thread *thread = Thread::current();
HandleMark hm(thread);
methodHandle mh (thread, constMethodOop(p)->method());
if (!mh->is_native()) {
st->print_cr("bci_from(%p) = %d; print_codes():",
addr, mh->bci_from(address(x)));
mh->print_codes_on(st);
}
}
return;
}
} else {
if (Universe::heap()->is_in_reserved(addr)) {
st->print_cr(INTPTR_FORMAT " is an unallocated location "
"in the heap", addr);
return;
}
}
if (JNIHandles::is_global_handle((jobject) addr)) {
st->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
return;
}
if (JNIHandles::is_weak_global_handle((jobject) addr)) {
st->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
return;
}
#ifndef PRODUCT
// we don't keep the block list in product mode
if (JNIHandleBlock::any_contains((jobject) addr)) {
st->print_cr(INTPTR_FORMAT " is a local jni handle", addr);
return;
}
#endif
for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
// Check for privilege stack
if (thread->privileged_stack_top() != NULL &&
thread->privileged_stack_top()->contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack "
"for thread: " INTPTR_FORMAT, addr, thread);
thread->print_on(st);
return;
}
// If the addr is a java thread print information about that.
if (addr == (address)thread) {
thread->print_on(st);
return;
}
// If the addr is in the stack region for this thread then report that
// and print thread info
if (thread->stack_base() >= addr &&
addr > (thread->stack_base() - thread->stack_size())) {
st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: "
INTPTR_FORMAT, addr, thread);
thread->print_on(st);
return;
}
}
// Try an OS specific find
if (os::find(addr, st)) {
return;
}
st->print_cr(INTPTR_FORMAT " is pointing to unknown location", addr);
}
// Looks like all platforms except IA64 can use the same function to check
// if C stack is walkable beyond current frame. The check for fp() is not

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,8 +78,10 @@ class os: AllStatic {
}
public:
static void init(void); // Called before command line parsing
static jint init_2(void); // Called after command line parsing
static void init(void); // Called before command line parsing
static jint init_2(void); // Called after command line parsing
static void init_3(void); // Called at the end of vm init
// File names are case-insensitive on windows only
// Override me as needed
@ -322,7 +324,8 @@ class os: AllStatic {
pgc_thread, // Parallel GC thread
java_thread,
compiler_thread,
watcher_thread
watcher_thread,
os_thread
};
static bool create_thread(Thread* thread,
@ -451,6 +454,8 @@ class os: AllStatic {
static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
static void print_date_and_time(outputStream* st);
static void print_location(outputStream* st, intptr_t x, bool print_pc = false);
// The following two functions are used by fatal error handler to trace
// native (C) frames. They are not part of frame.hpp/frame.cpp because
// frame.hpp/cpp assume thread is JavaThread, and also because different
@ -480,6 +485,9 @@ class os: AllStatic {
// Fills in path to jvm.dll/libjvm.so (this info used to find hpi).
static void jvm_path(char *buf, jint buflen);
// Returns true if we are running in a headless jre.
static bool is_headless_jre();
// JNI names
static void print_jni_name_prefix_on(outputStream* st, int args_size);
static void print_jni_name_suffix_on(outputStream* st, int args_size);
@ -580,8 +588,8 @@ class os: AllStatic {
// Platform dependent stuff
#include "incls/_os_pd.hpp.incl"
// debugging support (mostly used by debug.cpp)
static bool find(address pc) PRODUCT_RETURN0; // OS specific function to make sense out of an address
// debugging support (mostly used by debug.cpp but also fatal error handler)
static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address
static bool dont_yield(); // when true, JVM_Yield() is nop
static void print_statistics();

View File

@ -191,6 +191,121 @@ JRT_LEAF(jdouble, SharedRuntime::drem(jdouble x, jdouble y))
return ((jdouble)fmod((double)x,(double)y));
JRT_END
#ifdef __SOFTFP__
JRT_LEAF(jfloat, SharedRuntime::fadd(jfloat x, jfloat y))
return x + y;
JRT_END
JRT_LEAF(jfloat, SharedRuntime::fsub(jfloat x, jfloat y))
return x - y;
JRT_END
JRT_LEAF(jfloat, SharedRuntime::fmul(jfloat x, jfloat y))
return x * y;
JRT_END
JRT_LEAF(jfloat, SharedRuntime::fdiv(jfloat x, jfloat y))
return x / y;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::dadd(jdouble x, jdouble y))
return x + y;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::dsub(jdouble x, jdouble y))
return x - y;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::dmul(jdouble x, jdouble y))
return x * y;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::ddiv(jdouble x, jdouble y))
return x / y;
JRT_END
JRT_LEAF(jfloat, SharedRuntime::i2f(jint x))
return (jfloat)x;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::i2d(jint x))
return (jdouble)x;
JRT_END
JRT_LEAF(jdouble, SharedRuntime::f2d(jfloat x))
return (jdouble)x;
JRT_END
JRT_LEAF(int, SharedRuntime::fcmpl(float x, float y))
return x>y ? 1 : (x==y ? 0 : -1); /* x<y or is_nan*/
JRT_END
JRT_LEAF(int, SharedRuntime::fcmpg(float x, float y))
return x<y ? -1 : (x==y ? 0 : 1); /* x>y or is_nan */
JRT_END
JRT_LEAF(int, SharedRuntime::dcmpl(double x, double y))
return x>y ? 1 : (x==y ? 0 : -1); /* x<y or is_nan */
JRT_END
JRT_LEAF(int, SharedRuntime::dcmpg(double x, double y))
return x<y ? -1 : (x==y ? 0 : 1); /* x>y or is_nan */
JRT_END
// Functions to return the opposite of the aeabi functions for nan.
JRT_LEAF(int, SharedRuntime::unordered_fcmplt(float x, float y))
return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_dcmplt(double x, double y))
return (x < y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_fcmple(float x, float y))
return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_dcmple(double x, double y))
return (x <= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_fcmpge(float x, float y))
return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_dcmpge(double x, double y))
return (x >= y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_fcmpgt(float x, float y))
return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
JRT_LEAF(int, SharedRuntime::unordered_dcmpgt(double x, double y))
return (x > y) ? 1 : ((g_isnan(x) || g_isnan(y)) ? 1 : 0);
JRT_END
// Intrinsics make gcc generate code for these.
float SharedRuntime::fneg(float f) {
return -f;
}
double SharedRuntime::dneg(double f) {
return -f;
}
#endif // __SOFTFP__
#if defined(__SOFTFP__) || defined(E500V2)
// Intrinsics make gcc generate code for these.
double SharedRuntime::dabs(double f) {
return (f <= (double)0.0) ? (double)0.0 - f : f;
}
double SharedRuntime::dsqrt(double f) {
return sqrt(f);
}
#endif
JRT_LEAF(jint, SharedRuntime::f2i(jfloat x))
if (g_isnan(x))
@ -2046,6 +2161,8 @@ int AdapterHandlerTable::_equals;
int AdapterHandlerTable::_hits;
int AdapterHandlerTable::_compact;
#endif
class AdapterHandlerTableIterator : public StackObj {
private:
AdapterHandlerTable* _table;
@ -2081,7 +2198,6 @@ class AdapterHandlerTableIterator : public StackObj {
}
}
};
#endif
// ---------------------------------------------------------------------------
@ -2619,7 +2735,6 @@ JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
FREE_C_HEAP_ARRAY(intptr_t,buf);
JRT_END
#ifndef PRODUCT
bool AdapterHandlerLibrary::contains(CodeBlob* b) {
AdapterHandlerTableIterator iter(_adapters);
while (iter.has_next()) {
@ -2629,21 +2744,24 @@ bool AdapterHandlerLibrary::contains(CodeBlob* b) {
return false;
}
void AdapterHandlerLibrary::print_handler(CodeBlob* b) {
void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {
AdapterHandlerTableIterator iter(_adapters);
while (iter.has_next()) {
AdapterHandlerEntry* a = iter.next();
if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) {
tty->print("Adapter for signature: ");
tty->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT,
a->fingerprint()->as_string(),
a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry());
st->print("Adapter for signature: ");
st->print_cr("%s i2c: " INTPTR_FORMAT " c2i: " INTPTR_FORMAT " c2iUV: " INTPTR_FORMAT,
a->fingerprint()->as_string(),
a->get_i2c_entry(), a->get_c2i_entry(), a->get_c2i_unverified_entry());
return;
}
}
assert(false, "Should have found handler");
}
#ifndef PRODUCT
void AdapterHandlerLibrary::print_statistics() {
_adapters->print_statistics();
}

View File

@ -78,6 +78,18 @@ class SharedRuntime: AllStatic {
static jfloat frem(jfloat x, jfloat y);
static jdouble drem(jdouble x, jdouble y);
#ifdef __SOFTFP__
static jfloat fadd(jfloat x, jfloat y);
static jfloat fsub(jfloat x, jfloat y);
static jfloat fmul(jfloat x, jfloat y);
static jfloat fdiv(jfloat x, jfloat y);
static jdouble dadd(jdouble x, jdouble y);
static jdouble dsub(jdouble x, jdouble y);
static jdouble dmul(jdouble x, jdouble y);
static jdouble ddiv(jdouble x, jdouble y);
#endif // __SOFTFP__
// float conversion (needs to set appropriate rounding mode)
static jint f2i (jfloat x);
static jlong f2l (jfloat x);
@ -87,6 +99,12 @@ class SharedRuntime: AllStatic {
static jfloat l2f (jlong x);
static jdouble l2d (jlong x);
#ifdef __SOFTFP__
static jfloat i2f (jint x);
static jdouble i2d (jint x);
static jdouble f2d (jfloat x);
#endif // __SOFTFP__
// double trigonometrics and transcendentals
static jdouble dsin(jdouble x);
static jdouble dcos(jdouble x);
@ -96,6 +114,32 @@ class SharedRuntime: AllStatic {
static jdouble dexp(jdouble x);
static jdouble dpow(jdouble x, jdouble y);
#if defined(__SOFTFP__) || defined(E500V2)
static double dabs(double f);
static double dsqrt(double f);
#endif
#ifdef __SOFTFP__
// C++ compiler generates soft float instructions as well as passing
// float and double in registers.
static int fcmpl(float x, float y);
static int fcmpg(float x, float y);
static int dcmpl(double x, double y);
static int dcmpg(double x, double y);
static int unordered_fcmplt(float x, float y);
static int unordered_dcmplt(double x, double y);
static int unordered_fcmple(float x, float y);
static int unordered_dcmple(double x, double y);
static int unordered_fcmpge(float x, float y);
static int unordered_dcmpge(double x, double y);
static int unordered_fcmpgt(float x, float y);
static int unordered_dcmpgt(double x, double y);
static float fneg(float f);
static double dneg(double f);
#endif
// exception handling across interpreter/compiler boundaries
static address raw_exception_handler_for_return_address(JavaThread* thread, address return_address);
static address exception_handler_for_return_address(JavaThread* thread, address return_address);
@ -585,9 +629,7 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt);
#endif
#ifndef PRODUCT
void print();
#endif /* PRODUCT */
};
class AdapterHandlerLibrary: public AllStatic {
@ -609,9 +651,10 @@ class AdapterHandlerLibrary: public AllStatic {
static nmethod* create_dtrace_nmethod (methodHandle method);
#endif // HAVE_DTRACE_H
#ifndef PRODUCT
static void print_handler(CodeBlob* b);
static void print_handler(CodeBlob* b) { print_handler_on(tty, b); }
static void print_handler_on(outputStream* st, CodeBlob* b);
static bool contains(CodeBlob* b);
#ifndef PRODUCT
static void print_statistics();
#endif /* PRODUCT */

Some files were not shown because too many files have changed in this diff Show More