# HG changeset patch # User bobv # Date 1280837618 14400 # Node ID 4d9030fe341ff0e734bb7f513dd3c0af5bcf75f0 # Parent 86dbf3cacaccd2a1a888ad08db9d5cd01acf2669 6953477: Increase portability and flexibility of building Hotspot Summary: 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/agent/src/os/linux/ps_proc.c --- a/hotspot/agent/src/os/linux/ps_proc.c Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/agent/src/os/linux/ps_proc.c Tue Aug 03 08:13:38 2010 -0400 @@ -253,7 +253,11 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/Makefile --- a/hotspot/make/Makefile Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/Makefile Tue Aug 03 08:13:38 2010 -0400 @@ -90,9 +90,15 @@ 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_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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/defs.make --- a/hotspot/make/defs.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/defs.make Tue Aug 03 08:13:38 2010 -0400 @@ -192,13 +192,16 @@ # 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 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/build_vm_def.sh --- a/hotspot/make/linux/makefiles/build_vm_def.sh Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/build_vm_def.sh Tue Aug 03 08:13:38 2010 -0400 @@ -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 ";" } ' diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/buildtree.make --- a/hotspot/make/linux/makefiles/buildtree.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/buildtree.make Tue Aug 03 08:13:38 2010 -0400 @@ -339,12 +339,16 @@ 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"; \ diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/defs.make --- a/hotspot/make/linux/makefiles/defs.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/defs.make Tue Aug 03 08:13:38 2010 -0400 @@ -98,6 +98,22 @@ 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 @@ # 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 -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)) + + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/gcc.make --- a/hotspot/make/linux/makefiles/gcc.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/gcc.make Tue Aug 03 08:13:38 2010 -0400 @@ -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/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 @@ # 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 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/product.make --- a/hotspot/make/linux/makefiles/product.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/product.make Tue Aug 03 08:13:38 2010 -0400 @@ -46,7 +46,11 @@ # 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/sa.make --- a/hotspot/make/linux/makefiles/sa.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/sa.make Tue Aug 03 08:13:38 2010 -0400 @@ -55,10 +55,13 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/saproc.make --- a/hotspot/make/linux/makefiles/saproc.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/saproc.make Tue Aug 03 08:13:38 2010 -0400 @@ -53,10 +53,10 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/linux/makefiles/vm.make --- a/hotspot/make/linux/makefiles/vm.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/linux/makefiles/vm.make Tue Aug 03 08:13:38 2010 -0400 @@ -98,6 +98,7 @@ # Extra flags from gnumake's invocation or environment CFLAGS += $(EXTRA_CFLAGS) +LFLAGS += $(EXTRA_CFLAGS) LIBS += -lm -ldl -lpthread @@ -210,15 +211,17 @@ $(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) diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/make/solaris/makefiles/defs.make --- a/hotspot/make/solaris/makefiles/defs.make Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/make/solaris/makefiles/defs.make Tue Aug 03 08:13:38 2010 -0400 @@ -70,20 +70,24 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp --- a/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/bytecodeInterpreter_sparc.inline.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -236,19 +236,19 @@ } 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) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -409,7 +409,7 @@ 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()); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -1031,3 +1031,7 @@ #undef __ #define __ masm-> + +const char *Runtime1::pd_name_for_address(address entry) { + return ""; +} diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -56,14 +56,18 @@ } -#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 } -#endif void InterpreterRuntime::SignatureHandlerGenerator::pass_double() { @@ -185,6 +189,13 @@ _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 ) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/javaFrameAnchor_sparc.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -76,6 +76,8 @@ 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: diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -3236,12 +3236,14 @@ __ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp --- a/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.inline.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -236,11 +236,11 @@ } 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::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) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -349,7 +349,7 @@ 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()); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -1779,3 +1779,7 @@ } #undef __ + +const char *Runtime1::pd_name_for_address(address entry) { + return ""; +} diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/frame_x86.cpp --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -575,8 +575,8 @@ 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"); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/interpreterRT_x86_32.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -34,6 +34,10 @@ 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 @@ _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)); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp --- a/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -66,6 +66,8 @@ 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); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -3112,22 +3112,25 @@ 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 @@ // 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -3126,18 +3126,18 @@ 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, diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os/linux/launcher/java_md.c --- a/hotspot/src/os/linux/launcher/java_md.c Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os/linux/launcher/java_md.c Tue Aug 03 08:13:38 2010 -0400 @@ -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 */ diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -30,6 +30,8 @@ // put OS-includes here # include # include +# include +# include # include # include # include @@ -188,6 +190,10 @@ 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 @@ 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 @@ // 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 @@ &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,14 +1345,16 @@ #if defined(IA32) || defined(AMD64) #define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229) +#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) #else -#error Value of SYS_clock_getres not known on this platform +#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 -#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) - void os::Linux::fast_thread_clock_init() { if (!UseLinuxPosixThreadCPUClocks) { return; @@ -1905,7 +1916,9 @@ !_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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ //////////////////////////////////////////////////////////////////////////////// // 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 @@ 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("", addr - (intptr_t)dlinfo.dli_fbase); + st->print("", addr - (intptr_t)dlinfo.dli_fbase); } else { - tty->print(""); + st->print(""); } 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 @@ 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 @@ int count; long sys_time, user_time; char string[64]; + char cdummy; int idummy; long ldummy; FILE *fp; @@ -4381,11 +4404,11 @@ // 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 @@ } } } + +// 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; +} + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -1839,8 +1839,8 @@ // 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 @@ {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 @@ 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 @@ // 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 @@ 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 @@ } //--------------------------------------------------------------------------------- -#ifndef PRODUCT static address same_page(address x, address y) { intptr_t page_bits = -os::vm_page_size(); @@ -5424,28 +5430,28 @@ 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("", addr-(intptr_t)dlinfo.dli_fbase); + st->print("", addr-(intptr_t)dlinfo.dli_fbase); else - tty->print(""); - if (dlinfo.dli_fname) tty->print(" in %s", dlinfo.dli_fname); + st->print(""); + 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 @@ 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 @@ if (jt->handle_special_suspend_equivalent_condition()) { jt->java_suspend_self(); } - OrderAccess::fence(); } @@ -5997,3 +5999,44 @@ } } } + +// 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; +} + + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -3444,6 +3444,9 @@ 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 @@ } -#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 @@ } return 0; } + + +// We don't build a headless jre for Windows +bool os::is_headless_jre() { return false; } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp --- a/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -105,3 +105,6 @@ // nothing else to try return false; } + +void JavaThread::cache_global_variables() { } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -718,6 +718,11 @@ 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 @@ 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 @@ 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -79,3 +79,6 @@ // nothing else to try return false; } + +void JavaThread::cache_global_variables() { } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp --- a/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -24,3 +24,5 @@ */ // This file is intentionally empty + +void JavaThread::cache_global_variables() { } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -587,6 +587,61 @@ 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp --- a/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -140,3 +140,6 @@ *fr_addr = ret_frame; return true; } + +void JavaThread::cache_global_variables() { } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -719,6 +719,11 @@ 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 @@ 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 @@ 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 @@ print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); } + #ifdef AMD64 void os::Solaris::init_thread_fpu_state(void) { // Nothing to do diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp --- a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -82,3 +82,6 @@ return true; } + +void JavaThread::cache_global_variables() { } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -377,18 +377,84 @@ 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( "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( "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( "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_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( "EIP=" INTPTR_FORMAT, uc->Rip); - st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); + 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 @@ 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -84,3 +84,6 @@ // nothing else to try return false; } + +void JavaThread::cache_global_variables() { } + diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/asm/codeBuffer.hpp --- a/hotspot/src/share/vm/asm/codeBuffer.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -102,7 +102,7 @@ _locs_point = NULL; _locs_own = false; _frozen = false; - debug_only(_index = -1); + debug_only(_index = (char)-1); debug_only(_outer = (CodeBuffer*)badAddress); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_CodeStubs.hpp --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -448,6 +448,10 @@ _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; } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_Compilation.hpp --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -168,10 +168,19 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_FrameMap.cpp --- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -90,7 +90,7 @@ 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 @@ } 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); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_FrameMap.hpp --- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -154,7 +154,6 @@ 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. diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_LIR.cpp --- a/hotspot/src/share/vm/c1/c1_LIR.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -50,8 +50,7 @@ #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 @@ #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 @@ #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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::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 @@ 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 @@ 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) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_LIR.hpp --- a/hotspot/src/share/vm/c1/c1_LIR.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -432,8 +432,7 @@ // 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 @@ , _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 @@ 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 @@ 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 @@ 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 @@ LIR_OprDesc::double_size | LIR_OprDesc::virtual_mask); break; - +#endif // __SOFTFP__ default: ShouldNotReachHere(); res = illegalOpr; } @@ -650,11 +684,18 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 )); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_LIRGenerator.cpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -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_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_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 @@ } 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 @@ new LIR_Address(tmp, load_constant(card_table_base), T_BYTE)); } +#endif // ARM } @@ -1507,7 +1533,7 @@ // 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 @@ // 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 @@ } #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 @@ __ 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 @@ // 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]; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_LIRGenerator.hpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -314,7 +314,7 @@ 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 @@ } 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 @@ 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 @@ 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. diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_LinearScan.cpp --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -169,7 +169,11 @@ } 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_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 @@ 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 @@ #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 @@ #endif // LP64 } +#ifndef __SOFTFP__ case T_FLOAT: { #ifdef X86 if (UseSSE >= 1) { @@ -2069,6 +2084,11 @@ 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 @@ #endif return result; } +#endif // __SOFTFP__ default: { ShouldNotReachHere(); @@ -2638,6 +2659,12 @@ #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 @@ 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 @@ // 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); } } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_Runtime1.cpp --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -144,7 +144,7 @@ #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 @@ #undef FUNCTION_CASE - return ""; + // Soft float adds more runtime names. + return pd_name_for_address(entry); } @@ -896,7 +897,10 @@ } else { // patch the instruction 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 @@ 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 @@ 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; @@ -961,6 +973,12 @@ 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 } } else { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/c1/c1_Runtime1.hpp --- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -159,6 +159,9 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/code/codeBlob.cpp --- a/hotspot/src/share/vm/code/codeBlob.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/code/codeBlob.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -564,72 +564,53 @@ 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 DeoptimizationBlob::print_value_on(outputStream* st) const { st->print_cr("Deoptimization (frame not available)"); } - -#endif // PRODUCT diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/code/codeBlob.hpp --- a/hotspot/src/share/vm/code/codeBlob.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/code/codeBlob.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -163,8 +163,9 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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; } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/code/nmethod.hpp --- a/hotspot/src/share/vm/code/nmethod.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/code/nmethod.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -606,6 +606,8 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/code/vtableStubs.cpp --- a/hotspot/src/share/vm/code/vtableStubs.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/code/vtableStubs.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -67,8 +67,8 @@ } -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()); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/code/vtableStubs.hpp --- a/hotspot/src/share/vm/code/vtableStubs.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/code/vtableStubs.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -86,7 +86,9 @@ 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); } + }; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/compiler/disassembler.cpp --- a/hotspot/src/share/vm/compiler/disassembler.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/compiler/disassembler.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -371,7 +371,7 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/includeDB_compiler1 --- a/hotspot/src/share/vm/includeDB_compiler1 Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/includeDB_compiler1 Tue Aug 03 08:13:38 2010 -0400 @@ -252,6 +252,7 @@ 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_.cpp ciTypeArrayKlass.hpp c1_LIRGenerator_.cpp sharedRuntime.hpp c1_LIRGenerator_.cpp vmreg_.inline.hpp +c1_LIRGenerator_.cpp stubRoutines.hpp + c1_LinearScan.cpp bitMap.inline.hpp c1_LinearScan.cpp c1_CFGPrinter.hpp @@ -413,6 +416,7 @@ compileBroker.cpp c1_Compiler.hpp frame_.cpp c1_Runtime1.hpp +frame_.cpp vframeArray.hpp globals.cpp c1_globals.hpp diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/includeDB_core --- a/hotspot/src/share/vm/includeDB_core Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/includeDB_core Tue Aug 03 08:13:38 2010 -0400 @@ -284,6 +284,7 @@ atomic_.inline.hpp atomic.hpp atomic_.inline.hpp os.hpp atomic_.inline.hpp vm_version_.hpp +atomic_.inline.hpp orderAccess_.inline.hpp // attachListener is jck optional, put cpp deps in includeDB_features @@ -1734,6 +1735,7 @@ 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 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 oop.inline.hpp os.cpp os.hpp os.cpp os_.inline.hpp +os.cpp privilegedStack.hpp os.cpp stubRoutines.hpp os.cpp systemDictionary.hpp os.cpp threadService.hpp diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -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 @@ /* 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 @@ // 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 @@ #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 @@ 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 @@ 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 @@ // 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 @@ /* 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ */ CASE(_aastore): { oop rhsObject = STACK_OBJECT(-1); + VERIFY_OOP(rhsObject); ARRAY_INTRO( -3); // arrObj, index are set if (rhsObject != NULL) { @@ -1703,6 +1718,7 @@ obj = (oop)NULL; } else { obj = (oop) STACK_OBJECT(-1); + VERIFY_OOP(obj); } CALL_VM(InterpreterRuntime::post_field_access(THREAD, obj, @@ -1728,6 +1744,7 @@ 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 @@ } } 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 @@ } else { obj = (oop) STACK_OBJECT(-2); } + VERIFY_OOP(obj); } CALL_VM(InterpreterRuntime::post_field_modification(THREAD, @@ -1837,6 +1856,7 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -440,7 +440,7 @@ * 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/interpreter.cpp --- a/hotspot/src/share/vm/interpreter/interpreter.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -41,20 +41,20 @@ } -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); } } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/interpreter.hpp --- a/hotspot/src/share/vm/interpreter/interpreter.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/interpreter.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -52,7 +52,8 @@ // 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/interpreter/oopMapCache.cpp --- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -281,9 +281,7 @@ 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()); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/memory/allocation.cpp --- a/hotspot/src/share/vm/memory/allocation.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/memory/allocation.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -166,32 +166,40 @@ _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(); } }; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/memory/allocation.hpp --- a/hotspot/src/share/vm/memory/allocation.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/memory/allocation.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -174,9 +174,10 @@ // Start the chunk_pool cleaner task static void start_chunk_pool_cleaner_task(); + + static void clean_chunk_pool(); }; - //------------------------------Arena------------------------------------------ // Fast allocation of memory class Arena: public CHeapObj { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/memory/genCollectedHeap.cpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -941,7 +941,9 @@ 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. diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/memory/generation.hpp --- a/hotspot/src/share/vm/memory/generation.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/memory/generation.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -131,7 +131,9 @@ 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 }; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/arrayKlass.cpp --- a/hotspot/src/share/vm/oops/arrayKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/arrayKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -179,8 +179,6 @@ return JVMTI_CLASS_STATUS_ARRAY; } -#ifndef PRODUCT - // Printing void arrayKlass::oop_print_on(oop obj, outputStream* st) { @@ -189,8 +187,6 @@ st->print_cr(" - length: %d", arrayOop(obj)->length()); } -#endif - // Verification void arrayKlass::oop_verify_on(oop obj, outputStream* st) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/arrayKlass.hpp --- a/hotspot/src/share/vm/oops/arrayKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/arrayKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -115,20 +115,15 @@ // 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); }; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/arrayKlassKlass.cpp --- a/hotspot/src/share/vm/oops/arrayKlassKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/arrayKlassKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -151,15 +151,12 @@ } #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"); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/arrayKlassKlass.hpp --- a/hotspot/src/share/vm/oops/arrayKlassKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/arrayKlassKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -55,12 +55,9 @@ 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/compiledICHolderKlass.cpp --- a/hotspot/src/share/vm/oops/compiledICHolderKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/compiledICHolderKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -154,8 +154,6 @@ } #endif // SERIALGC -#ifndef PRODUCT - // Printing void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) { @@ -166,8 +164,6 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/compiledICHolderKlass.hpp --- a/hotspot/src/share/vm/oops/compiledICHolderKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/compiledICHolderKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -68,12 +68,9 @@ 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/constMethodKlass.cpp --- a/hotspot/src/share/vm/oops/constMethodKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/constMethodKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -197,8 +197,6 @@ } #endif // SERIALGC -#ifndef PRODUCT - // Printing void constMethodKlass::oop_print_on(oop obj, outputStream* st) { @@ -216,8 +214,6 @@ } } -#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) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/constMethodKlass.hpp --- a/hotspot/src/share/vm/oops/constMethodKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/constMethodKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -77,12 +77,9 @@ 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/constantPoolKlass.cpp --- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -299,8 +299,6 @@ } #endif // SERIALGC -#ifndef PRODUCT - // Printing void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { @@ -392,8 +390,6 @@ st->cr(); } -#endif - void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) { assert(obj->is_constantPool(), "must be constantPool"); constantPoolOop cp = constantPoolOop(obj); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/constantPoolKlass.hpp --- a/hotspot/src/share/vm/oops/constantPoolKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/constantPoolKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -61,18 +61,13 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/cpCacheKlass.cpp --- a/hotspot/src/share/vm/oops/cpCacheKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/cpCacheKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -248,8 +248,6 @@ } #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 @@ 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/cpCacheKlass.hpp --- a/hotspot/src/share/vm/oops/cpCacheKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/cpCacheKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -61,14 +61,10 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/generateOopMap.cpp --- a/hotspot/src/share/vm/oops/generateOopMap.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/generateOopMap.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -2111,7 +2111,13 @@ // 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); } // diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/klass.cpp --- a/hotspot/src/share/vm/oops/klass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/klass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -520,8 +520,6 @@ return 0; } -#ifndef PRODUCT - // Printing void Klass::oop_print_on(oop obj, outputStream* st) { @@ -541,8 +539,6 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/klass.hpp --- a/hotspot/src/share/vm/oops/klass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/klass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -772,16 +772,12 @@ // 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/klassKlass.cpp --- a/hotspot/src/share/vm/oops/klassKlass.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/klassKlass.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -194,16 +194,12 @@ #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); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/klassKlass.hpp --- a/hotspot/src/share/vm/oops/klassKlass.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/klassKlass.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -67,12 +67,9 @@ 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; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/oops/oop.cpp --- a/hotspot/src/share/vm/oops/oop.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/oops/oop.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -29,15 +29,6 @@ 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 @@ 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 @@ 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); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/prims/jni.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -3414,6 +3414,8 @@ 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/prims/jvmtiEnvThreadState.hpp --- a/hotspot/src/share/vm/prims/jvmtiEnvThreadState.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/prims/jvmtiEnvThreadState.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -24,6 +24,8 @@ #ifndef _JAVA_JVMTIENVTHREADSTATE_H_ #define _JAVA_JVMTIENVTHREADSTATE_H_ +class JvmtiEnv; + /////////////////////////////////////////////////////////////// // // class JvmtiFramePop diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -2665,6 +2665,28 @@ } #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 @@ 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; } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/frame.cpp --- a/hotspot/src/share/vm/runtime/frame.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/frame.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -876,6 +876,7 @@ #endif /* CC_INTERP */ +#ifndef PPC if (m->is_native()) { #ifdef CC_INTERP f->do_oop((oop*)&istate->_oop_temp); @@ -883,6 +884,11 @@ 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/frame.hpp --- a/hotspot/src/share/vm/runtime/frame.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/frame.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -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 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -607,7 +607,7 @@ 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 @@ "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 */ diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/java.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -378,7 +378,8 @@ } // 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()) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/javaFrameAnchor.hpp --- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -76,7 +76,6 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/os.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -735,6 +735,152 @@ 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 diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/os.hpp --- a/hotspot/src/share/vm/runtime/os.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/os.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -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 @@ } 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 @@ 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 @@ 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 @@ // 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 @@ // 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(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/sharedRuntime.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -191,6 +191,121 @@ 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); /* xy or is_nan */ +JRT_END + +JRT_LEAF(int, SharedRuntime::dcmpl(double x, double y)) + return x>y ? 1 : (x==y ? 0 : -1); /* xy 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::_hits; int AdapterHandlerTable::_compact; +#endif + class AdapterHandlerTableIterator : public StackObj { private: AdapterHandlerTable* _table; @@ -2081,7 +2198,6 @@ } } }; -#endif // --------------------------------------------------------------------------- @@ -2619,7 +2735,6 @@ 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 @@ 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(); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/sharedRuntime.hpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -78,6 +78,18 @@ 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 @@ 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 @@ 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 @@ 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 @@ static nmethod* create_dtrace_nmethod (methodHandle method); #endif // HAVE_DTRACE_H + 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_handler(CodeBlob* b); - static bool contains(CodeBlob* b); static void print_statistics(); #endif /* PRODUCT */ diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/sharedRuntimeTrans.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntimeTrans.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrans.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -572,7 +572,11 @@ if(hy<0) z = one/z; /* z = (1/|x|) */ if(hx<0) { if(((ix-0x3ff00000)|yisint)==0) { +#ifdef CAN_USE_NAN_DEFINE + z = NAN; +#else z = (z-z)/(z-z); /* (-1)**non-int is NaN */ +#endif } else if(yisint==1) z = -1.0*z; /* (x<0)**odd = -(|x|**odd) */ } @@ -583,7 +587,12 @@ n = (hx>>31)+1; /* (x<0)**(non-int) is NaN */ - if((n|yisint)==0) return (x-x)/(x-x); + if((n|yisint)==0) +#ifdef CAN_USE_NAN_DEFINE + return NAN; +#else + return (x-x)/(x-x); +#endif s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */ diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/signature.hpp --- a/hotspot/src/share/vm/runtime/signature.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/signature.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -275,11 +275,7 @@ void do_bool () { pass_int(); _jni_offset++; _offset++; } void do_char () { pass_int(); _jni_offset++; _offset++; } -#if defined(_LP64) || defined(ZERO) void do_float () { pass_float(); _jni_offset++; _offset++; } -#else - void do_float () { pass_int(); _jni_offset++; _offset++; } -#endif #ifdef _LP64 void do_double() { pass_double(); _jni_offset++; _offset += 2; } #else @@ -306,9 +302,7 @@ virtual void pass_int() = 0; virtual void pass_long() = 0; virtual void pass_object() = 0; -#if defined(_LP64) || defined(ZERO) virtual void pass_float() = 0; -#endif #ifdef _LP64 virtual void pass_double() = 0; #else diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/stubCodeGenerator.cpp --- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -53,15 +53,13 @@ } -void StubCodeDesc::print() { - tty->print(group()); - tty->print("::"); - tty->print(name()); - tty->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes()); +void StubCodeDesc::print_on(outputStream* st) const { + st->print(group()); + st->print("::"); + st->print(name()); + st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes()); } - - // Implementation of StubCodeGenerator StubCodeGenerator::StubCodeGenerator(CodeBuffer* code) { diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/stubCodeGenerator.hpp --- a/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -79,7 +79,8 @@ address end() const { return _end; } int size_in_bytes() const { return _end - _begin; } bool contains(address pc) const { return _begin <= pc && pc < _end; } - void print(); + void print_on(outputStream* st) const; + void print() const { print_on(tty); } }; // The base class for all stub-generating code generators. diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/thread.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -1020,7 +1020,7 @@ // timer interrupts exists on the platform. WatcherThread* WatcherThread::_watcher_thread = NULL; -bool WatcherThread::_should_terminate = false; +volatile bool WatcherThread::_should_terminate = false; WatcherThread::WatcherThread() : Thread() { assert(watcher_thread() == NULL, "we can only allocate one WatcherThread"); @@ -1052,8 +1052,26 @@ // Calculate how long it'll be until the next PeriodicTask work // should be done, and sleep that amount of time. - const size_t time_to_wait = PeriodicTask::time_to_wait(); - os::sleep(this, time_to_wait, false); + size_t time_to_wait = PeriodicTask::time_to_wait(); + + // we expect this to timeout - we only ever get unparked when + // we should terminate + { + OSThreadWaitState osts(this->osthread(), false /* not Object.wait() */); + + jlong prev_time = os::javaTimeNanos(); + for (;;) { + int res= _SleepEvent->park(time_to_wait); + if (res == OS_TIMEOUT || _should_terminate) + break; + // spurious wakeup of some kind + jlong now = os::javaTimeNanos(); + time_to_wait -= (now - prev_time) / 1000000; + if (time_to_wait <= 0) + break; + prev_time = now; + } + } if (is_error_reported()) { // A fatal error has happened, the error handler(VMError::report_and_die) @@ -1115,6 +1133,12 @@ // it is ok to take late safepoints here, if needed MutexLocker mu(Terminator_lock); _should_terminate = true; + OrderAccess::fence(); // ensure WatcherThread sees update in main loop + + Thread* watcher = watcher_thread(); + if (watcher != NULL) + watcher->_SleepEvent->unpark(); + while(watcher_thread() != NULL) { // This wait should make safepoint checks, wait without a timeout, // and wait as a suspend-equivalent condition. @@ -1364,6 +1388,8 @@ this->create_stack_guard_pages(); + this->cache_global_variables(); + // Thread is now sufficient initialized to be handled by the safepoint code as being // in the VM. Change thread state from _thread_new to _thread_in_vm ThreadStateTransition::transition_and_fence(this, _thread_new, _thread_in_vm); @@ -2955,6 +2981,9 @@ return status; } + // Should be done after the heap is fully created + main_thread->cache_global_variables(); + HandleMark hm; { MutexLocker mu(Threads_lock); @@ -3230,6 +3259,9 @@ WatcherThread::start(); } + // Give os specific code one last chance to start + os::init_3(); + create_vm_timer.end(); return JNI_OK; } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/thread.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -410,9 +410,6 @@ // Sweeper support void nmethods_do(CodeBlobClosure* cf); - // Tells if adr belong to this thread. This is used - // for checking if a lock is owned by the running thread. - // Used by fast lock support virtual bool is_lock_owned(address adr) const; @@ -609,7 +606,7 @@ private: static WatcherThread* _watcher_thread; - static bool _should_terminate; + volatile static bool _should_terminate; // updated without holding lock public: enum SomeConstants { delay_interval = 10 // interrupt delay in milliseconds @@ -839,6 +836,10 @@ return (struct JNINativeInterface_ *)_jni_environment.functions; } + // This function is called at thread creation to allow + // platform specific thread variables to be initialized. + void cache_global_variables(); + // Executes Shutdown.shutdown() void invoke_shutdown_hooks(); diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/vm_version.cpp --- a/hotspot/src/share/vm/runtime/vm_version.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/vm_version.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -152,6 +152,8 @@ #define CPU IA32_ONLY("x86") \ IA64_ONLY("ia64") \ AMD64_ONLY("amd64") \ + ARM_ONLY("arm") \ + PPC_ONLY("ppc") \ SPARC_ONLY("sparc") #endif // ZERO diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/runtime/vm_version.hpp --- a/hotspot/src/share/vm/runtime/vm_version.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/runtime/vm_version.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -70,6 +70,9 @@ return _logical_processors_per_package; } + // ARCH specific policy for the BiasedLocking + static bool use_biased_locking() { return true; } + // Number of page sizes efficiently supported by the hardware. Most chips now // support two sizes, thus this default implementation. Processor-specific // subclasses should define new versions to hide this one as needed. Note diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/utilities/debug.cpp --- a/hotspot/src/share/vm/utilities/debug.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/utilities/debug.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, 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 @@ -552,140 +552,6 @@ } } - -static void find(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(); - return; - } - if (Interpreter::contains(addr)) { - tty->print_cr(INTPTR_FORMAT " is pointing into interpreter code (not bytecode specific)", addr); - return; - } - // - if (AdapterHandlerLibrary::contains(b)) { - AdapterHandlerLibrary::print_handler(b); - } - // the stubroutines are generated into a buffer blob - StubCodeDesc* d = StubCodeDesc::desc_for(addr); - if (d != NULL) { - d->print(); - if (print_pc) tty->cr(); - return; - } - if (StubRoutines::contains(addr)) { - tty->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)) { - tty->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr); - return; - } - VtableStub* v = VtableStubs::stub_containing(addr); - if (v != NULL) { - v->print(); - return; - } - } - if (print_pc && b->is_nmethod()) { - ResourceMark rm; - tty->print("%#p: Compiled ", addr); - ((nmethod*)b)->method()->print_value_on(tty); - tty->print(" = (CodeBlob*)" INTPTR_FORMAT, b); - tty->cr(); - return; - } - if ( b->is_nmethod()) { - if (b->is_zombie()) { - tty->print_cr(INTPTR_FORMAT " is zombie nmethod", b); - } else if (b->is_not_entrant()) { - tty->print_cr(INTPTR_FORMAT " is non-entrant nmethod", b); - } - } - b->print(); - 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(); - 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()) { - tty->print_cr("bci_from(%p) = %d; print_codes():", - addr, mh->bci_from(address(x))); - mh->print_codes(); - } - } - return; - } - } else if (Universe::heap()->is_in_reserved(addr)) { - tty->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", addr); - return; - } - - if (JNIHandles::is_global_handle((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT " is a global jni handle", addr); - return; - } - if (JNIHandles::is_weak_global_handle((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr); - return; - } - if (JNIHandleBlock::any_contains((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT " is a local jni handle", addr); - return; - } - - 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)) { - tty->print_cr(INTPTR_FORMAT " is pointing into the privilege stack for thread: " INTPTR_FORMAT, addr, thread); - return; - } - // If the addr is a java thread print information about that. - if (addr == (address)thread) { - thread->print(); - return; - } - } - - // Try an OS specific find - if (os::find(addr)) { - return; - } - - if (print_pc) { - tty->print_cr(INTPTR_FORMAT ": probably in C++ code; check debugger", addr); - Disassembler::decode(same_page(addr-40,addr),same_page(addr+40,addr)); - return; - } - - tty->print_cr(INTPTR_FORMAT " is pointing to unknown location", addr); -} - - class LookForRefInGenClosure : public OopsInGenClosure { public: oop target; @@ -767,7 +633,7 @@ // Can we someday rename the other find to hsfind? extern "C" void hsfind(intptr_t x) { Command c("hsfind"); - find(x, false); + os::print_location(tty, x, false); } @@ -778,13 +644,13 @@ extern "C" void find(intptr_t x) { Command c("find"); - find(x, false); + os::print_location(tty, x, false); } extern "C" void findpc(intptr_t x) { Command c("findpc"); - find(x, true); + os::print_location(tty, x, true); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -216,8 +216,16 @@ #define DEBUG_EXCEPTION ::abort(); +#ifdef ARM +#ifdef SOLARIS +#define BREAKPOINT __asm__ volatile (".long 0xe1200070") +#else +#define BREAKPOINT __asm__ volatile (".long 0xe7f001f0") +#endif +#else extern "C" void breakpoint(); #define BREAKPOINT ::breakpoint() +#endif // checking for nanness #ifdef SOLARIS @@ -235,6 +243,12 @@ #error "missing platform-specific definition here" #endif +// GCC 4.3 does not allow 0.0/0.0 to produce a NAN value +#if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2) +#define CAN_USE_NAN_DEFINE 1 +#endif + + // Checking for finiteness inline int g_isfinite(jfloat f) { return finite(f); } diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/utilities/macros.hpp --- a/hotspot/src/share/vm/utilities/macros.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/utilities/macros.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -188,4 +188,37 @@ #define NOT_SPARC(code) code #endif +#ifdef PPC +#define PPC_ONLY(code) code +#define NOT_PPC(code) +#else +#define PPC_ONLY(code) +#define NOT_PPC(code) code +#endif + +#ifdef E500V2 +#define E500V2_ONLY(code) code +#define NOT_E500V2(code) +#else +#define E500V2_ONLY(code) +#define NOT_E500V2(code) code +#endif + + +#ifdef ARM +#define ARM_ONLY(code) code +#define NOT_ARM(code) +#else +#define ARM_ONLY(code) +#define NOT_ARM(code) code +#endif + +#ifdef JAVASE_EMBEDDED +#define EMBEDDED_ONLY(code) code +#define NOT_EMBEDDED(code) +#else +#define EMBEDDED_ONLY(code) +#define NOT_EMBEDDED(code) code +#endif + #define define_pd_global(type, name, value) const type pd_##name = value; diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Tue Aug 03 08:13:38 2010 -0400 @@ -687,16 +687,13 @@ # undef END } +VMError* volatile VMError::first_error = NULL; +volatile jlong VMError::first_error_tid = -1; void VMError::report_and_die() { // Don't allocate large buffer on stack static char buffer[O_BUFLEN]; - // First error, and its thread id. We must be able to handle native thread, - // so use thread id instead of Thread* to identify thread. - static VMError* first_error; - static jlong first_error_tid; - // An error could happen before tty is initialized or after it has been // destroyed. Here we use a very simple unbuffered fdStream for printing. // Only out.print_raw() and out.print_raw_cr() should be used, as other diff -r 86dbf3cacacc -r 4d9030fe341f hotspot/src/share/vm/utilities/vmError.hpp --- a/hotspot/src/share/vm/utilities/vmError.hpp Wed Jul 28 17:57:43 2010 -0400 +++ b/hotspot/src/share/vm/utilities/vmError.hpp Tue Aug 03 08:13:38 2010 -0400 @@ -57,6 +57,10 @@ int _current_step; const char * _current_step_info; int _verbose; + // First error, and its thread id. We must be able to handle native thread, + // so use thread id instead of Thread* to identify thread. + static VMError* volatile first_error; + static volatile jlong first_error_tid; // used by reporting about OOM size_t _size; @@ -108,4 +112,7 @@ // returns original handler for signal, if it was resetted, or NULL if // signal was not changed by error reporter static address get_resetted_sighandler(int sig); + + // check to see if fatal error reporting is in progress + static bool fatal_error_in_progress() { return first_error != NULL; } };