This commit is contained in:
Lana Steuck 2012-05-25 16:32:56 -07:00
commit ff9a1cfde6
304 changed files with 6620 additions and 3168 deletions

View file

@ -160,3 +160,5 @@ f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35
98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36 98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36
b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37
4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38
35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39
6e4e654931b976304bf6e7b4d0d6db8f75bac5d9 jdk8-b40

View file

@ -160,3 +160,5 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21
6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36 6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36
b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37
d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38
8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39
a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40

View file

@ -160,3 +160,5 @@ e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35
a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36
83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37
b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39
56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40

View file

@ -246,3 +246,7 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37
7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09
637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38
73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10
96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39
14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11
ff9decc8235d5af80ea45fda4ecbe643ea252564 jdk8-b40
785573170238f0eae6dc8e22ecf1050fbc9ea055 hs24-b12

View file

@ -572,10 +572,10 @@ public class HotSpotAgent {
if (cpu.equals("x86")) { if (cpu.equals("x86")) {
machDesc = new MachineDescriptionIntelX86(); machDesc = new MachineDescriptionIntelX86();
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
machDesc = new MachineDescriptionAMD64(); machDesc = new MachineDescriptionAMD64();
} else { } else {
throw new DebuggerException("BSD only supported on x86/amd64"); throw new DebuggerException("BSD only supported on x86/x86_64. Current arch: " + cpu);
} }
BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer); BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);

View file

@ -762,10 +762,10 @@ public class BugSpotAgent {
if (cpu.equals("x86")) { if (cpu.equals("x86")) {
machDesc = new MachineDescriptionIntelX86(); machDesc = new MachineDescriptionIntelX86();
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || (cpu.equals("x86_64"))) {
machDesc = new MachineDescriptionAMD64(); machDesc = new MachineDescriptionAMD64();
} else { } else {
throw new DebuggerException("Bsd only supported on x86/amd64"); throw new DebuggerException("Bsd only supported on x86/x86_64. Current arch: " + cpu);
} }
// Note we do not use a cache for the local debugger in server // Note we do not use a cache for the local debugger in server

View file

@ -90,7 +90,7 @@ class BsdCDebugger implements CDebugger {
Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP); Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP);
if (pc == null) return null; if (pc == null) return null;
return new BsdX86CFrame(dbg, ebp, pc); return new BsdX86CFrame(dbg, ebp, pc);
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext();
Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP);
if (rbp == null) return null; if (rbp == null) return null;

View file

@ -33,7 +33,7 @@ class BsdThreadContextFactory {
String cpu = dbg.getCPU(); String cpu = dbg.getCPU();
if (cpu.equals("x86")) { if (cpu.equals("x86")) {
return new BsdX86ThreadContext(dbg); return new BsdX86ThreadContext(dbg);
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
return new BsdAMD64ThreadContext(dbg); return new BsdAMD64ThreadContext(dbg);
} else { } else {
throw new RuntimeException("cpu " + cpu + " is not yet supported"); throw new RuntimeException("cpu " + cpu + " is not yet supported");

View file

@ -81,7 +81,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
pcRegIndex = X86ThreadContext.EIP; pcRegIndex = X86ThreadContext.EIP;
fpRegIndex = X86ThreadContext.EBP; fpRegIndex = X86ThreadContext.EBP;
unalignedAccessesOkay = true; unalignedAccessesOkay = true;
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
threadFactory = new ProcAMD64ThreadFactory(this); threadFactory = new ProcAMD64ThreadFactory(this);
pcRegIndex = AMD64ThreadContext.RIP; pcRegIndex = AMD64ThreadContext.RIP;
fpRegIndex = AMD64ThreadContext.RBP; fpRegIndex = AMD64ThreadContext.RBP;

View file

@ -64,7 +64,7 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
cachePageSize = 4096; cachePageSize = 4096;
cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
unalignedAccessesOkay = true; unalignedAccessesOkay = true;
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
threadFactory = new RemoteAMD64ThreadFactory(this); threadFactory = new RemoteAMD64ThreadFactory(this);
cachePageSize = 4096; cachePageSize = 4096;
cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize); cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);

View file

@ -95,7 +95,7 @@ public class Threads {
} else if (os.equals("bsd")) { } else if (os.equals("bsd")) {
if (cpu.equals("x86")) { if (cpu.equals("x86")) {
access = new BsdX86JavaThreadPDAccess(); access = new BsdX86JavaThreadPDAccess();
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
access = new BsdAMD64JavaThreadPDAccess(); access = new BsdAMD64JavaThreadPDAccess();
} }
} }

View file

@ -199,7 +199,7 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
cpuHelper = new SPARCHelper(); cpuHelper = new SPARCHelper();
} else if (cpu.equals("x86")) { } else if (cpu.equals("x86")) {
cpuHelper = new X86Helper(); cpuHelper = new X86Helper();
} else if (cpu.equals("amd64")) { } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
cpuHelper = new AMD64Helper(); cpuHelper = new AMD64Helper();
} else if (cpu.equals("ia64")) { } else if (cpu.equals("ia64")) {
cpuHelper = new IA64Helper(); cpuHelper = new IA64Helper();

View file

@ -153,7 +153,8 @@ public class JSJavaFrame extends DefaultScriptObject {
List visibleVars = new ArrayList(0); List visibleVars = new ArrayList(0);
for (int i = 0; i < localVars.length; i++) { for (int i = 0; i < localVars.length; i++) {
LocalVariableTableElement cur = localVars[i]; LocalVariableTableElement cur = localVars[i];
if (cur.getStartBCI() >= bci && cur.getLength() > 0) { int startBCI = cur.getStartBCI();
if (startBCI <= bci && bci < startBCI + cur.getLength()) {
visibleVars.add(cur); visibleVars.add(cur);
} }
} }

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -31,11 +31,11 @@
# #
# Don't put quotes (fail windows build). # Don't put quotes (fail windows build).
HOTSPOT_VM_COPYRIGHT=Copyright 2011 HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=24 HS_MAJOR_VER=24
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=10 HS_BUILD_NUMBER=12
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View file

@ -103,8 +103,10 @@ CXXFLAGS = \
vm_version.o: CXXFLAGS += ${JRE_VERSION} vm_version.o: CXXFLAGS += ${JRE_VERSION}
ifndef JAVASE_EMBEDDED ifndef JAVASE_EMBEDDED
ifneq (${ARCH},arm)
CFLAGS += -DINCLUDE_TRACE CFLAGS += -DINCLUDE_TRACE
endif endif
endif
# CFLAGS_WARN holds compiler options to suppress/enable warnings. # CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS += $(CFLAGS_WARN/BYFILE) CFLAGS += $(CFLAGS_WARN/BYFILE)
@ -154,10 +156,12 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
ifndef JAVASE_EMBEDDED ifndef JAVASE_EMBEDDED
ifneq (${ARCH},arm)
SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
find $(HS_ALT_SRC)/share/vm/jfr -type d; \ find $(HS_ALT_SRC)/share/vm/jfr -type d; \
fi) fi)
endif endif
endif
CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
CORE_PATHS+=$(GENERATED)/jvmtifiles CORE_PATHS+=$(GENERATED)/jvmtifiles

View file

@ -0,0 +1,51 @@
#
# Copyright (c) 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Rules to build add_gnu_debuglink, used by vm.make on Solaris
GENERATED = ../generated
ADD_GNU_DEBUGLINK = $(GENERATED)/add_gnu_debuglink
ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink
ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c
ADD_GNU_DEBUGLINK_FLAGS =
LIBS_ADD_GNU_DEBUGLINK += -lelf
ifeq ("${Platform_compiler}", "sparcWorks")
# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to
# compare the built ELF objects.
#
# The -g option makes static data global and the "-W0,-noglobal"
# option tells the compiler to not globalize static data using a unique
# globalization prefix. Instead force the use of a static globalization
# prefix based on the source filepath so the objects from two identical
# compilations are the same.
#
# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
# seem to work. I got "-W0,-noglobal" from Kelly and that works.
#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal
endif # Platform_compiler == sparcWorks
$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC)
$(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)

View file

@ -109,18 +109,12 @@ ifeq ($(JDK6_OR_EARLIER),0)
# overridden in some situations, e.g., a BUILD_FLAVOR != product # overridden in some situations, e.g., a BUILD_FLAVOR != product
# build. # build.
# Disable FULL_DEBUG_SYMBOLS by default because dtrace tests are
# failing in nightly when the debug info files are ZIP'ed. On
# Solaris debug info files need to be ZIP'ed to reduce the impact
# on disk space footprint.
FULL_DEBUG_SYMBOLS ?= 0
ifeq ($(BUILD_FLAVOR), product) ifeq ($(BUILD_FLAVOR), product)
# FULL_DEBUG_SYMBOLS ?= 1 FULL_DEBUG_SYMBOLS ?= 1
ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
else else
# debug variants always get Full Debug Symbols (if available) # debug variants always get Full Debug Symbols (if available)
# ENABLE_FULL_DEBUG_SYMBOLS = 1 ENABLE_FULL_DEBUG_SYMBOLS = 1
ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
endif endif
_JUNK_ := $(shell \ _JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
@ -178,9 +172,7 @@ ifeq ($(JDK6_OR_EARLIER),0)
_JUNK_ := $(shell \ _JUNK_ := $(shell \
echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
# Disable ZIP_DEBUGINFO_FILES by default because dtrace tests are ZIP_DEBUGINFO_FILES ?= 1
# failing in nightly when the debug info files are ZIP'ed.
ZIP_DEBUGINFO_FILES ?= 0
_JUNK_ := $(shell \ _JUNK_ := $(shell \
echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")

View file

@ -144,6 +144,10 @@ JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
# jvm_db & dtrace # jvm_db & dtrace
include $(MAKEFILES_DIR)/dtrace.make include $(MAKEFILES_DIR)/dtrace.make
#----------------------------------------------------------------------
# add_gnu_debuglink tool
include $(MAKEFILES_DIR)/add_gnu_debuglink.make
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# JVM # JVM
@ -276,7 +280,7 @@ else
LINK_VM = $(LINK_LIB.CXX) LINK_VM = $(LINK_LIB.CXX)
endif endif
# making the library: # making the library:
$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LIBJVM): $(ADD_GNU_DEBUGLINK) $(LIBJVM.o) $(LIBJVM_MAPFILE)
ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
@echo Linking vm... @echo Linking vm...
$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
@ -287,7 +291,11 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
$(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1 $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ # $(OBJCOPY) --add-gnu-debuglink=... corrupts the SUNW_dof section
# in libjvm.so. Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY)
# is available.
# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
ifeq ($(STRIP_POLICY),all_strip) ifeq ($(STRIP_POLICY),all_strip)
$(QUIETLY) $(STRIP) $@ $(QUIETLY) $(STRIP) $@
else else

View file

@ -145,7 +145,12 @@ MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# Disable ZIP_DEBUGINFO_FILES by default because various tests are # Disable ZIP_DEBUGINFO_FILES by default because various tests are
# failing in nightly when the debug info files are ZIP'ed. # failing in nightly when the debug info files are ZIP'ed.
ZIP_DEBUGINFO_FILES ?= 0 #ZIP_DEBUGINFO_FILES ?= 0
# The above conditional setting logic is unreliable on Windows for
# unknown reasons. We force ZIP_DEBUGINFO_FILES to be disabled on
# Windows until we figure out why the various tests are failing
# AND why the conditional setting logic is unreliable.
ZIP_DEBUGINFO_FILES=0
else else
ZIP_DEBUGINFO_FILES=0 ZIP_DEBUGINFO_FILES=0
endif endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -238,9 +238,12 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
Register result = dst->as_register(); Register result = dst->as_register();
{ {
// Get a pointer to the first character of string0 in tmp0 and get string0.count in str0 // Get a pointer to the first character of string0 in tmp0
// Get a pointer to the first character of string1 in tmp1 and get string1.count in str1 // and get string0.length() in str0
// Also, get string0.count-string1.count in o7 and get the condition code set // Get a pointer to the first character of string1 in tmp1
// and get string1.length() in str1
// Also, get string0.length()-string1.length() in
// o7 and get the condition code set
// Note: some instructions have been hoisted for better instruction scheduling // Note: some instructions have been hoisted for better instruction scheduling
Register tmp0 = L0; Register tmp0 = L0;
@ -248,18 +251,26 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
Register tmp2 = L2; Register tmp2 = L2;
int value_offset = java_lang_String:: value_offset_in_bytes(); // char array int value_offset = java_lang_String:: value_offset_in_bytes(); // char array
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position
int count_offset = java_lang_String:: count_offset_in_bytes(); int count_offset = java_lang_String:: count_offset_in_bytes();
__ load_heap_oop(str0, value_offset, tmp0); __ load_heap_oop(str0, value_offset, tmp0);
__ ld(str0, offset_offset, tmp2); __ ld(str0, offset_offset, tmp2);
__ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
__ ld(str0, count_offset, str0); __ ld(str0, count_offset, str0);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
} else {
__ load_heap_oop(str0, value_offset, tmp1);
__ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0);
__ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0);
}
// str1 may be null // str1 may be null
add_debug_info_for_null_check_here(info); add_debug_info_for_null_check_here(info);
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position
int count_offset = java_lang_String:: count_offset_in_bytes();
__ load_heap_oop(str1, value_offset, tmp1); __ load_heap_oop(str1, value_offset, tmp1);
__ add(tmp0, tmp2, tmp0); __ add(tmp0, tmp2, tmp0);
@ -267,8 +278,13 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
__ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1);
__ ld(str1, count_offset, str1); __ ld(str1, count_offset, str1);
__ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2);
__ subcc(str0, str1, O7);
__ add(tmp1, tmp2, tmp1); __ add(tmp1, tmp2, tmp1);
} else {
__ load_heap_oop(str1, value_offset, tmp2);
__ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1);
__ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1);
}
__ subcc(str0, str1, O7);
} }
{ {
@ -302,7 +318,7 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst
// Shift base0 and base1 to the end of the arrays, negate limit // Shift base0 and base1 to the end of the arrays, negate limit
__ add(base0, limit, base0); __ add(base0, limit, base0);
__ add(base1, limit, base1); __ add(base1, limit, base1);
__ neg(limit); // limit = -min{string0.count, strin1.count} __ neg(limit); // limit = -min{string0.length(), string1.length()}
__ lduh(base0, limit, chr0); __ lduh(base0, limit, chr0);
__ bind(Lloop); __ bind(Lloop);

View file

@ -738,7 +738,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
case vmIntrinsics::_dlog: // fall through case vmIntrinsics::_dlog: // fall through
case vmIntrinsics::_dsin: // fall through case vmIntrinsics::_dsin: // fall through
case vmIntrinsics::_dtan: // fall through case vmIntrinsics::_dtan: // fall through
case vmIntrinsics::_dcos: { case vmIntrinsics::_dcos: // fall through
case vmIntrinsics::_dexp: {
assert(x->number_of_arguments() == 1, "wrong type"); assert(x->number_of_arguments() == 1, "wrong type");
address runtime_entry = NULL; address runtime_entry = NULL;
@ -758,12 +759,23 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
case vmIntrinsics::_dlog10: case vmIntrinsics::_dlog10:
runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10); runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
break; break;
case vmIntrinsics::_dexp:
runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
break;
default: default:
ShouldNotReachHere(); ShouldNotReachHere();
} }
LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL); LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL);
set_result(x, result); set_result(x, result);
break;
}
case vmIntrinsics::_dpow: {
assert(x->number_of_arguments() == 2, "wrong type");
address runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dpow);
LIR_Opr result = call_runtime(x->argument_at(0), x->argument_at(1), runtime_entry, x->type(), NULL);
set_result(x, result);
break;
} }
} }
} }

View file

@ -403,6 +403,8 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
case Interpreter::java_lang_math_abs : break; case Interpreter::java_lang_math_abs : break;
case Interpreter::java_lang_math_log : break; case Interpreter::java_lang_math_log : break;
case Interpreter::java_lang_math_log10 : break; case Interpreter::java_lang_math_log10 : break;
case Interpreter::java_lang_math_pow : break;
case Interpreter::java_lang_math_exp : break;
case Interpreter::java_lang_ref_reference_get case Interpreter::java_lang_ref_reference_get
: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
default : ShouldNotReachHere(); break; default : ShouldNotReachHere(); break;

View file

@ -3578,6 +3578,21 @@ void Assembler::fyl2x() {
emit_byte(0xF1); emit_byte(0xF1);
} }
void Assembler::frndint() {
emit_byte(0xD9);
emit_byte(0xFC);
}
void Assembler::f2xm1() {
emit_byte(0xD9);
emit_byte(0xF0);
}
void Assembler::fldl2e() {
emit_byte(0xD9);
emit_byte(0xEA);
}
// SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding. // SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding.
static int simd_pre[4] = { 0, 0x66, 0xF3, 0xF2 }; static int simd_pre[4] = { 0, 0x66, 0xF3, 0xF2 };
// SSE opcode second byte values (first is 0x0F) corresponding to VexOpcode encoding. // SSE opcode second byte values (first is 0x0F) corresponding to VexOpcode encoding.
@ -6868,6 +6883,243 @@ void MacroAssembler::fldcw(AddressLiteral src) {
Assembler::fldcw(as_Address(src)); Assembler::fldcw(as_Address(src));
} }
void MacroAssembler::pow_exp_core_encoding() {
// kills rax, rcx, rdx
subptr(rsp,sizeof(jdouble));
// computes 2^X. Stack: X ...
// f2xm1 computes 2^X-1 but only operates on -1<=X<=1. Get int(X) and
// keep it on the thread's stack to compute 2^int(X) later
// then compute 2^(X-int(X)) as (2^(X-int(X)-1+1)
// final result is obtained with: 2^X = 2^int(X) * 2^(X-int(X))
fld_s(0); // Stack: X X ...
frndint(); // Stack: int(X) X ...
fsuba(1); // Stack: int(X) X-int(X) ...
fistp_s(Address(rsp,0)); // move int(X) as integer to thread's stack. Stack: X-int(X) ...
f2xm1(); // Stack: 2^(X-int(X))-1 ...
fld1(); // Stack: 1 2^(X-int(X))-1 ...
faddp(1); // Stack: 2^(X-int(X))
// computes 2^(int(X)): add exponent bias (1023) to int(X), then
// shift int(X)+1023 to exponent position.
// Exponent is limited to 11 bits if int(X)+1023 does not fit in 11
// bits, set result to NaN. 0x000 and 0x7FF are reserved exponent
// values so detect them and set result to NaN.
movl(rax,Address(rsp,0));
movl(rcx, -2048); // 11 bit mask and valid NaN binary encoding
addl(rax, 1023);
movl(rdx,rax);
shll(rax,20);
// Check that 0 < int(X)+1023 < 2047. Otherwise set rax to NaN.
addl(rdx,1);
// Check that 1 < int(X)+1023+1 < 2048
// in 3 steps:
// 1- (int(X)+1023+1)&-2048 == 0 => 0 <= int(X)+1023+1 < 2048
// 2- (int(X)+1023+1)&-2048 != 0
// 3- (int(X)+1023+1)&-2048 != 1
// Do 2- first because addl just updated the flags.
cmov32(Assembler::equal,rax,rcx);
cmpl(rdx,1);
cmov32(Assembler::equal,rax,rcx);
testl(rdx,rcx);
cmov32(Assembler::notEqual,rax,rcx);
movl(Address(rsp,4),rax);
movl(Address(rsp,0),0);
fmul_d(Address(rsp,0)); // Stack: 2^X ...
addptr(rsp,sizeof(jdouble));
}
void MacroAssembler::fast_pow() {
// computes X^Y = 2^(Y * log2(X))
// if fast computation is not possible, result is NaN. Requires
// fallback from user of this macro.
fyl2x(); // Stack: (Y*log2(X)) ...
pow_exp_core_encoding(); // Stack: exp(X) ...
}
void MacroAssembler::fast_exp() {
// computes exp(X) = 2^(X * log2(e))
// if fast computation is not possible, result is NaN. Requires
// fallback from user of this macro.
fldl2e(); // Stack: log2(e) X ...
fmulp(1); // Stack: (X*log2(e)) ...
pow_exp_core_encoding(); // Stack: exp(X) ...
}
void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) {
// kills rax, rcx, rdx
// pow and exp needs 2 extra registers on the fpu stack.
Label slow_case, done;
Register tmp = noreg;
if (!VM_Version::supports_cmov()) {
// fcmp needs a temporary so preserve rdx,
tmp = rdx;
}
Register tmp2 = rax;
Register tmp3 = rcx;
if (is_exp) {
// Stack: X
fld_s(0); // duplicate argument for runtime call. Stack: X X
fast_exp(); // Stack: exp(X) X
fcmp(tmp, 0, false, false); // Stack: exp(X) X
// exp(X) not equal to itself: exp(X) is NaN go to slow case.
jcc(Assembler::parity, slow_case);
// get rid of duplicate argument. Stack: exp(X)
if (num_fpu_regs_in_use > 0) {
fxch();
fpop();
} else {
ffree(1);
}
jmp(done);
} else {
// Stack: X Y
Label x_negative, y_odd;
fldz(); // Stack: 0 X Y
fcmp(tmp, 1, true, false); // Stack: X Y
jcc(Assembler::above, x_negative);
// X >= 0
fld_s(1); // duplicate arguments for runtime call. Stack: Y X Y
fld_s(1); // Stack: X Y X Y
fast_pow(); // Stack: X^Y X Y
fcmp(tmp, 0, false, false); // Stack: X^Y X Y
// X^Y not equal to itself: X^Y is NaN go to slow case.
jcc(Assembler::parity, slow_case);
// get rid of duplicate arguments. Stack: X^Y
if (num_fpu_regs_in_use > 0) {
fxch(); fpop();
fxch(); fpop();
} else {
ffree(2);
ffree(1);
}
jmp(done);
// X <= 0
bind(x_negative);
fld_s(1); // Stack: Y X Y
frndint(); // Stack: int(Y) X Y
fcmp(tmp, 2, false, false); // Stack: int(Y) X Y
jcc(Assembler::notEqual, slow_case);
subptr(rsp, 8);
// For X^Y, when X < 0, Y has to be an integer and the final
// result depends on whether it's odd or even. We just checked
// that int(Y) == Y. We move int(Y) to gp registers as a 64 bit
// integer to test its parity. If int(Y) is huge and doesn't fit
// in the 64 bit integer range, the integer indefinite value will
// end up in the gp registers. Huge numbers are all even, the
// integer indefinite number is even so it's fine.
#ifdef ASSERT
// Let's check we don't end up with an integer indefinite number
// when not expected. First test for huge numbers: check whether
// int(Y)+1 == int(Y) which is true for very large numbers and
// those are all even. A 64 bit integer is guaranteed to not
// overflow for numbers where y+1 != y (when precision is set to
// double precision).
Label y_not_huge;
fld1(); // Stack: 1 int(Y) X Y
fadd(1); // Stack: 1+int(Y) int(Y) X Y
#ifdef _LP64
// trip to memory to force the precision down from double extended
// precision
fstp_d(Address(rsp, 0));
fld_d(Address(rsp, 0));
#endif
fcmp(tmp, 1, true, false); // Stack: int(Y) X Y
#endif
// move int(Y) as 64 bit integer to thread's stack
fistp_d(Address(rsp,0)); // Stack: X Y
#ifdef ASSERT
jcc(Assembler::notEqual, y_not_huge);
// Y is huge so we know it's even. It may not fit in a 64 bit
// integer and we don't want the debug code below to see the
// integer indefinite value so overwrite int(Y) on the thread's
// stack with 0.
movl(Address(rsp, 0), 0);
movl(Address(rsp, 4), 0);
bind(y_not_huge);
#endif
fld_s(1); // duplicate arguments for runtime call. Stack: Y X Y
fld_s(1); // Stack: X Y X Y
fabs(); // Stack: abs(X) Y X Y
fast_pow(); // Stack: abs(X)^Y X Y
fcmp(tmp, 0, false, false); // Stack: abs(X)^Y X Y
// abs(X)^Y not equal to itself: abs(X)^Y is NaN go to slow case.
pop(tmp2);
NOT_LP64(pop(tmp3));
jcc(Assembler::parity, slow_case);
#ifdef ASSERT
// Check that int(Y) is not integer indefinite value (int
// overflow). Shouldn't happen because for values that would
// overflow, 1+int(Y)==Y which was tested earlier.
#ifndef _LP64
{
Label integer;
testl(tmp2, tmp2);
jcc(Assembler::notZero, integer);
cmpl(tmp3, 0x80000000);
jcc(Assembler::notZero, integer);
stop("integer indefinite value shouldn't be seen here");
bind(integer);
}
#else
{
Label integer;
mov(tmp3, tmp2); // preserve tmp2 for parity check below
shlq(tmp3, 1);
jcc(Assembler::carryClear, integer);
jcc(Assembler::notZero, integer);
stop("integer indefinite value shouldn't be seen here");
bind(integer);
}
#endif
#endif
// get rid of duplicate arguments. Stack: X^Y
if (num_fpu_regs_in_use > 0) {
fxch(); fpop();
fxch(); fpop();
} else {
ffree(2);
ffree(1);
}
testl(tmp2, 1);
jcc(Assembler::zero, done); // X <= 0, Y even: X^Y = abs(X)^Y
// X <= 0, Y even: X^Y = -abs(X)^Y
fchs(); // Stack: -abs(X)^Y Y
jmp(done);
}
// slow case: runtime call
bind(slow_case);
fpop(); // pop incorrect result or int(Y)
fp_runtime_fallback(is_exp ? CAST_FROM_FN_PTR(address, SharedRuntime::dexp) : CAST_FROM_FN_PTR(address, SharedRuntime::dpow),
is_exp ? 1 : 2, num_fpu_regs_in_use);
// Come here with result in F-TOS
bind(done);
}
void MacroAssembler::fpop() { void MacroAssembler::fpop() {
ffree(); ffree();
fincstp(); fincstp();
@ -8045,6 +8297,144 @@ void MacroAssembler::incr_allocated_bytes(Register thread,
#endif #endif
} }
void MacroAssembler::fp_runtime_fallback(address runtime_entry, int nb_args, int num_fpu_regs_in_use) {
pusha();
// if we are coming from c1, xmm registers may be live
if (UseSSE >= 1) {
subptr(rsp, sizeof(jdouble)* LP64_ONLY(16) NOT_LP64(8));
}
int off = 0;
if (UseSSE == 1) {
movflt(Address(rsp,off++*sizeof(jdouble)),xmm0);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm1);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm2);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm3);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm4);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm5);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm6);
movflt(Address(rsp,off++*sizeof(jdouble)),xmm7);
} else if (UseSSE >= 2) {
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm0);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm1);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm2);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm3);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm4);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm5);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm6);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm7);
#ifdef _LP64
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm8);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm9);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm10);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm11);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm12);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm13);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm14);
movdbl(Address(rsp,off++*sizeof(jdouble)),xmm15);
#endif
}
// Preserve registers across runtime call
int incoming_argument_and_return_value_offset = -1;
if (num_fpu_regs_in_use > 1) {
// Must preserve all other FPU regs (could alternatively convert
// SharedRuntime::dsin, dcos etc. into assembly routines known not to trash
// FPU state, but can not trust C compiler)
NEEDS_CLEANUP;
// NOTE that in this case we also push the incoming argument(s) to
// the stack and restore it later; we also use this stack slot to
// hold the return value from dsin, dcos etc.
for (int i = 0; i < num_fpu_regs_in_use; i++) {
subptr(rsp, sizeof(jdouble));
fstp_d(Address(rsp, 0));
}
incoming_argument_and_return_value_offset = sizeof(jdouble)*(num_fpu_regs_in_use-1);
for (int i = nb_args-1; i >= 0; i--) {
fld_d(Address(rsp, incoming_argument_and_return_value_offset-i*sizeof(jdouble)));
}
}
subptr(rsp, nb_args*sizeof(jdouble));
for (int i = 0; i < nb_args; i++) {
fstp_d(Address(rsp, i*sizeof(jdouble)));
}
#ifdef _LP64
if (nb_args > 0) {
movdbl(xmm0, Address(rsp, 0));
}
if (nb_args > 1) {
movdbl(xmm1, Address(rsp, sizeof(jdouble)));
}
assert(nb_args <= 2, "unsupported number of args");
#endif // _LP64
// NOTE: we must not use call_VM_leaf here because that requires a
// complete interpreter frame in debug mode -- same bug as 4387334
// MacroAssembler::call_VM_leaf_base is perfectly safe and will
// do proper 64bit abi
NEEDS_CLEANUP;
// Need to add stack banging before this runtime call if it needs to
// be taken; however, there is no generic stack banging routine at
// the MacroAssembler level
MacroAssembler::call_VM_leaf_base(runtime_entry, 0);
#ifdef _LP64
movsd(Address(rsp, 0), xmm0);
fld_d(Address(rsp, 0));
#endif // _LP64
addptr(rsp, sizeof(jdouble) * nb_args);
if (num_fpu_regs_in_use > 1) {
// Must save return value to stack and then restore entire FPU
// stack except incoming arguments
fstp_d(Address(rsp, incoming_argument_and_return_value_offset));
for (int i = 0; i < num_fpu_regs_in_use - nb_args; i++) {
fld_d(Address(rsp, 0));
addptr(rsp, sizeof(jdouble));
}
fld_d(Address(rsp, (nb_args-1)*sizeof(jdouble)));
addptr(rsp, sizeof(jdouble) * nb_args);
}
off = 0;
if (UseSSE == 1) {
movflt(xmm0, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm1, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm2, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm3, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm4, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm5, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm6, Address(rsp,off++*sizeof(jdouble)));
movflt(xmm7, Address(rsp,off++*sizeof(jdouble)));
} else if (UseSSE >= 2) {
movdbl(xmm0, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm1, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm2, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm3, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm4, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm5, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm6, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm7, Address(rsp,off++*sizeof(jdouble)));
#ifdef _LP64
movdbl(xmm8, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm9, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm10, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm11, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm12, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm13, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm14, Address(rsp,off++*sizeof(jdouble)));
movdbl(xmm15, Address(rsp,off++*sizeof(jdouble)));
#endif
}
if (UseSSE >= 1) {
addptr(rsp, sizeof(jdouble)* LP64_ONLY(16) NOT_LP64(8));
}
popa();
}
static const double pi_4 = 0.7853981633974483; static const double pi_4 = 0.7853981633974483;
void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) {
@ -8092,73 +8482,27 @@ void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) {
// slow case: runtime call // slow case: runtime call
bind(slow_case); bind(slow_case);
// Preserve registers across runtime call
pusha();
int incoming_argument_and_return_value_offset = -1;
if (num_fpu_regs_in_use > 1) {
// Must preserve all other FPU regs (could alternatively convert
// SharedRuntime::dsin and dcos into assembly routines known not to trash
// FPU state, but can not trust C compiler)
NEEDS_CLEANUP;
// NOTE that in this case we also push the incoming argument to
// the stack and restore it later; we also use this stack slot to
// hold the return value from dsin or dcos.
for (int i = 0; i < num_fpu_regs_in_use; i++) {
subptr(rsp, sizeof(jdouble));
fstp_d(Address(rsp, 0));
}
incoming_argument_and_return_value_offset = sizeof(jdouble)*(num_fpu_regs_in_use-1);
fld_d(Address(rsp, incoming_argument_and_return_value_offset));
}
subptr(rsp, sizeof(jdouble));
fstp_d(Address(rsp, 0));
#ifdef _LP64
movdbl(xmm0, Address(rsp, 0));
#endif // _LP64
// NOTE: we must not use call_VM_leaf here because that requires a
// complete interpreter frame in debug mode -- same bug as 4387334
// MacroAssembler::call_VM_leaf_base is perfectly safe and will
// do proper 64bit abi
NEEDS_CLEANUP;
// Need to add stack banging before this runtime call if it needs to
// be taken; however, there is no generic stack banging routine at
// the MacroAssembler level
switch(trig) { switch(trig) {
case 's': case 's':
{ {
MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dsin), 0); fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dsin), 1, num_fpu_regs_in_use);
} }
break; break;
case 'c': case 'c':
{ {
MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), 0); fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), 1, num_fpu_regs_in_use);
} }
break; break;
case 't': case 't':
{ {
MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), 0); fp_runtime_fallback(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), 1, num_fpu_regs_in_use);
} }
break; break;
default: default:
assert(false, "bad intrinsic"); assert(false, "bad intrinsic");
break; break;
} }
#ifdef _LP64
movsd(Address(rsp, 0), xmm0);
fld_d(Address(rsp, 0));
#endif // _LP64
addptr(rsp, sizeof(jdouble));
if (num_fpu_regs_in_use > 1) {
// Must save return value to stack and then restore entire FPU stack
fstp_d(Address(rsp, incoming_argument_and_return_value_offset));
for (int i = 0; i < num_fpu_regs_in_use; i++) {
fld_d(Address(rsp, 0));
addptr(rsp, sizeof(jdouble));
}
}
popa();
// Come here with result in F-TOS // Come here with result in F-TOS
bind(done); bind(done);

View file

@ -1148,6 +1148,9 @@ private:
void fxsave(Address dst); void fxsave(Address dst);
void fyl2x(); void fyl2x();
void frndint();
void f2xm1();
void fldl2e();
void hlt(); void hlt();
@ -2387,7 +2390,28 @@ class MacroAssembler: public Assembler {
void ldmxcsr(Address src) { Assembler::ldmxcsr(src); } void ldmxcsr(Address src) { Assembler::ldmxcsr(src); }
void ldmxcsr(AddressLiteral src); void ldmxcsr(AddressLiteral src);
// compute pow(x,y) and exp(x) with x86 instructions. Don't cover
// all corner cases and may result in NaN and require fallback to a
// runtime call.
void fast_pow();
void fast_exp();
// computes exp(x). Fallback to runtime call included.
void exp_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(true, num_fpu_regs_in_use); }
// computes pow(x,y). Fallback to runtime call included.
void pow_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(false, num_fpu_regs_in_use); }
private: private:
// call runtime as a fallback for trig functions and pow/exp.
void fp_runtime_fallback(address runtime_entry, int nb_args, int num_fpu_regs_in_use);
// computes 2^(Ylog2X); Ylog2X in ST(0)
void pow_exp_core_encoding();
// computes pow(x,y) or exp(x). Fallback to runtime call included.
void pow_or_exp(bool is_exp, int num_fpu_regs_in_use);
// these are private because users should be doing movflt/movdbl // these are private because users should be doing movflt/movdbl
void movss(Address dst, XMMRegister src) { Assembler::movss(dst, src); } void movss(Address dst, XMMRegister src) { Assembler::movss(dst, src); }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -505,19 +505,28 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst,
// Get addresses of first characters from both Strings // Get addresses of first characters from both Strings
__ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes()));
if (java_lang_String::has_offset_field()) {
__ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes()));
__ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
__ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
} else {
__ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes()));
__ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
}
// rbx, may be NULL // rbx, may be NULL
add_debug_info_for_null_check_here(info); add_debug_info_for_null_check_here(info);
__ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes()));
if (java_lang_String::has_offset_field()) {
__ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes()));
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
} else {
__ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes()));
__ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
}
// compute minimum length (in rax) and difference of lengths (on top of stack) // compute minimum length (in rax) and difference of lengths (on top of stack)
__ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes()));
__ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes()));
__ mov (rcx, rbx); __ mov (rcx, rbx);
__ subptr(rbx, rax); // subtract lengths __ subptr(rbx, rax); // subtract lengths
__ push (rbx); // result __ push (rbx); // result
@ -2437,6 +2446,12 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, L
// Should consider not saving rbx, if not necessary // Should consider not saving rbx, if not necessary
__ trigfunc('t', op->as_Op2()->fpu_stack_size()); __ trigfunc('t', op->as_Op2()->fpu_stack_size());
break; break;
case lir_exp :
__ exp_with_fallback(op->as_Op2()->fpu_stack_size());
break;
case lir_pow :
__ pow_with_fallback(op->as_Op2()->fpu_stack_size());
break;
default : ShouldNotReachHere(); default : ShouldNotReachHere();
} }
} else { } else {

View file

@ -823,7 +823,7 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
assert(x->number_of_arguments() == 1, "wrong type"); assert(x->number_of_arguments() == 1 || (x->number_of_arguments() == 2 && x->id() == vmIntrinsics::_dpow), "wrong type");
LIRItem value(x->argument_at(0), this); LIRItem value(x->argument_at(0), this);
bool use_fpu = false; bool use_fpu = false;
@ -834,6 +834,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
case vmIntrinsics::_dtan: case vmIntrinsics::_dtan:
case vmIntrinsics::_dlog: case vmIntrinsics::_dlog:
case vmIntrinsics::_dlog10: case vmIntrinsics::_dlog10:
case vmIntrinsics::_dexp:
case vmIntrinsics::_dpow:
use_fpu = true; use_fpu = true;
} }
} else { } else {
@ -843,20 +845,37 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
value.load_item(); value.load_item();
LIR_Opr calc_input = value.result(); LIR_Opr calc_input = value.result();
LIR_Opr calc_input2 = NULL;
if (x->id() == vmIntrinsics::_dpow) {
LIRItem extra_arg(x->argument_at(1), this);
if (UseSSE < 2) {
extra_arg.set_destroys_register();
}
extra_arg.load_item();
calc_input2 = extra_arg.result();
}
LIR_Opr calc_result = rlock_result(x); LIR_Opr calc_result = rlock_result(x);
// sin and cos need two free fpu stack slots, so register two temporary operands // sin, cos, pow and exp need two free fpu stack slots, so register
// two temporary operands
LIR_Opr tmp1 = FrameMap::caller_save_fpu_reg_at(0); LIR_Opr tmp1 = FrameMap::caller_save_fpu_reg_at(0);
LIR_Opr tmp2 = FrameMap::caller_save_fpu_reg_at(1); LIR_Opr tmp2 = FrameMap::caller_save_fpu_reg_at(1);
if (use_fpu) { if (use_fpu) {
LIR_Opr tmp = FrameMap::fpu0_double_opr; LIR_Opr tmp = FrameMap::fpu0_double_opr;
int tmp_start = 1;
if (calc_input2 != NULL) {
__ move(calc_input2, tmp);
tmp_start = 2;
calc_input2 = tmp;
}
__ move(calc_input, tmp); __ move(calc_input, tmp);
calc_input = tmp; calc_input = tmp;
calc_result = tmp; calc_result = tmp;
tmp1 = FrameMap::caller_save_fpu_reg_at(1);
tmp2 = FrameMap::caller_save_fpu_reg_at(2); tmp1 = FrameMap::caller_save_fpu_reg_at(tmp_start);
tmp2 = FrameMap::caller_save_fpu_reg_at(tmp_start + 1);
} }
switch(x->id()) { switch(x->id()) {
@ -867,6 +886,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
case vmIntrinsics::_dtan: __ tan (calc_input, calc_result, tmp1, tmp2); break; case vmIntrinsics::_dtan: __ tan (calc_input, calc_result, tmp1, tmp2); break;
case vmIntrinsics::_dlog: __ log (calc_input, calc_result, tmp1); break; case vmIntrinsics::_dlog: __ log (calc_input, calc_result, tmp1); break;
case vmIntrinsics::_dlog10: __ log10(calc_input, calc_result, tmp1); break; case vmIntrinsics::_dlog10: __ log10(calc_input, calc_result, tmp1); break;
case vmIntrinsics::_dexp: __ exp (calc_input, calc_result, tmp1, tmp2, FrameMap::rax_opr, FrameMap::rcx_opr, FrameMap::rdx_opr); break;
case vmIntrinsics::_dpow: __ pow (calc_input, calc_input2, calc_result, tmp1, tmp2, FrameMap::rax_opr, FrameMap::rcx_opr, FrameMap::rdx_opr); break;
default: ShouldNotReachHere(); default: ShouldNotReachHere();
} }

View file

@ -690,8 +690,8 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) {
case lir_mul_strictfp: case lir_mul_strictfp:
case lir_div_strictfp: { case lir_div_strictfp: {
assert(op2->tmp_opr()->is_fpu_register(), "strict operations need temporary fpu stack slot"); assert(op2->tmp1_opr()->is_fpu_register(), "strict operations need temporary fpu stack slot");
insert_free_if_dead(op2->tmp_opr()); insert_free_if_dead(op2->tmp1_opr());
assert(sim()->stack_size() <= 7, "at least one stack slot must be free"); assert(sim()->stack_size() <= 7, "at least one stack slot must be free");
// fall-through: continue with the normal handling of lir_mul and lir_div // fall-through: continue with the normal handling of lir_mul and lir_div
} }
@ -787,16 +787,17 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) {
case lir_log: case lir_log:
case lir_log10: { case lir_log10: {
// log and log10 needs one temporary fpu stack slot, so there is ontemporary // log and log10 need one temporary fpu stack slot, so
// registers stored in temp of the operation. // there is one temporary registers stored in temp of the
// the stack allocator must guarantee that the stack slots are really free, // operation. the stack allocator must guarantee that the stack
// otherwise there might be a stack overflow. // slots are really free, otherwise there might be a stack
// overflow.
assert(right->is_illegal(), "must be"); assert(right->is_illegal(), "must be");
assert(left->is_fpu_register(), "must be"); assert(left->is_fpu_register(), "must be");
assert(res->is_fpu_register(), "must be"); assert(res->is_fpu_register(), "must be");
assert(op2->tmp_opr()->is_fpu_register(), "must be"); assert(op2->tmp1_opr()->is_fpu_register(), "must be");
insert_free_if_dead(op2->tmp_opr()); insert_free_if_dead(op2->tmp1_opr());
insert_free_if_dead(res, left); insert_free_if_dead(res, left);
insert_exchange(left); insert_exchange(left);
do_rename(left, res); do_rename(left, res);
@ -812,8 +813,9 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) {
case lir_tan: case lir_tan:
case lir_sin: case lir_sin:
case lir_cos: { case lir_cos:
// sin and cos need two temporary fpu stack slots, so there are two temporary case lir_exp: {
// sin, cos and exp need two temporary fpu stack slots, so there are two temporary
// registers (stored in right and temp of the operation). // registers (stored in right and temp of the operation).
// the stack allocator must guarantee that the stack slots are really free, // the stack allocator must guarantee that the stack slots are really free,
// otherwise there might be a stack overflow. // otherwise there might be a stack overflow.
@ -821,11 +823,11 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) {
assert(res->is_fpu_register(), "must be"); assert(res->is_fpu_register(), "must be");
// assert(left->is_last_use(), "old value gets destroyed"); // assert(left->is_last_use(), "old value gets destroyed");
assert(right->is_fpu_register(), "right is used as the first temporary register"); assert(right->is_fpu_register(), "right is used as the first temporary register");
assert(op2->tmp_opr()->is_fpu_register(), "temp is used as the second temporary register"); assert(op2->tmp1_opr()->is_fpu_register(), "temp is used as the second temporary register");
assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp_opr()) && fpu_num(op2->tmp_opr()) != fpu_num(res), "need distinct temp registers"); assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers");
insert_free_if_dead(right); insert_free_if_dead(right);
insert_free_if_dead(op2->tmp_opr()); insert_free_if_dead(op2->tmp1_opr());
insert_free_if_dead(res, left); insert_free_if_dead(res, left);
insert_exchange(left); insert_exchange(left);
@ -839,6 +841,53 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) {
break; break;
} }
case lir_pow: {
// pow needs two temporary fpu stack slots, so there are two temporary
// registers (stored in tmp1 and tmp2 of the operation).
// the stack allocator must guarantee that the stack slots are really free,
// otherwise there might be a stack overflow.
assert(left->is_fpu_register(), "must be");
assert(right->is_fpu_register(), "must be");
assert(res->is_fpu_register(), "must be");
assert(op2->tmp1_opr()->is_fpu_register(), "tmp1 is the first temporary register");
assert(op2->tmp2_opr()->is_fpu_register(), "tmp2 is the second temporary register");
assert(fpu_num(left) != fpu_num(right) && fpu_num(left) != fpu_num(op2->tmp1_opr()) && fpu_num(left) != fpu_num(op2->tmp2_opr()) && fpu_num(left) != fpu_num(res), "need distinct temp registers");
assert(fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(right) != fpu_num(op2->tmp2_opr()) && fpu_num(right) != fpu_num(res), "need distinct temp registers");
assert(fpu_num(op2->tmp1_opr()) != fpu_num(op2->tmp2_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers");
assert(fpu_num(op2->tmp2_opr()) != fpu_num(res), "need distinct temp registers");
insert_free_if_dead(op2->tmp1_opr());
insert_free_if_dead(op2->tmp2_opr());
// Must bring both operands to top of stack with following operand ordering:
// * fpu stack before pow: ... right left
// * fpu stack after pow: ... left
insert_free_if_dead(res, right);
if (tos_offset(right) != 1) {
insert_exchange(right);
insert_exchange(1);
}
insert_exchange(left);
assert(tos_offset(right) == 1, "check");
assert(tos_offset(left) == 0, "check");
new_left = to_fpu_stack_top(left);
new_right = to_fpu_stack(right);
op2->set_fpu_stack_size(sim()->stack_size());
assert(sim()->stack_size() <= 6, "at least two stack slots must be free");
sim()->pop();
do_rename(right, res);
new_res = to_fpu_stack_top(res);
break;
}
default: { default: {
assert(false, "missed a fpu-operation"); assert(false, "missed a fpu-operation");
} }

View file

@ -181,6 +181,19 @@ address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKin
__ push_fTOS(); __ push_fTOS();
__ pop_fTOS(); __ pop_fTOS();
break; break;
case Interpreter::java_lang_math_pow:
__ fld_d(Address(rsp, 3*wordSize)); // second argument
__ pow_with_fallback(0);
// Store to stack to convert 80bit precision back to 64bits
__ push_fTOS();
__ pop_fTOS();
break;
case Interpreter::java_lang_math_exp:
__ exp_with_fallback(0);
// Store to stack to convert 80bit precision back to 64bits
__ push_fTOS();
__ pop_fTOS();
break;
default : default :
ShouldNotReachHere(); ShouldNotReachHere();
} }

View file

@ -271,6 +271,14 @@ address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKin
case Interpreter::java_lang_math_log10: case Interpreter::java_lang_math_log10:
__ flog10(); __ flog10();
break; break;
case Interpreter::java_lang_math_pow:
__ fld_d(Address(rsp, 3*wordSize)); // second argument (one
// empty stack slot)
__ pow_with_fallback(0);
break;
case Interpreter::java_lang_math_exp:
__ exp_with_fallback(0);
break;
default : default :
ShouldNotReachHere(); ShouldNotReachHere();
} }

View file

@ -2136,11 +2136,23 @@ class StubGenerator: public StubCodeGenerator {
__ trigfunc('t'); __ trigfunc('t');
__ ret(0); __ ret(0);
} }
{
StubCodeMark mark(this, "StubRoutines", "exp");
StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc();
// The intrinsic version of these seem to return the same value as __ fld_d(Address(rsp, 4));
// the strict version. __ exp_with_fallback(0);
StubRoutines::_intrinsic_exp = SharedRuntime::dexp; __ ret(0);
StubRoutines::_intrinsic_pow = SharedRuntime::dpow; }
{
StubCodeMark mark(this, "StubRoutines", "pow");
StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc();
__ fld_d(Address(rsp, 12));
__ fld_d(Address(rsp, 4));
__ pow_with_fallback(0);
__ ret(0);
}
} }
public: public:

View file

@ -2928,11 +2928,34 @@ class StubGenerator: public StubCodeGenerator {
__ addq(rsp, 8); __ addq(rsp, 8);
__ ret(0); __ ret(0);
} }
{
StubCodeMark mark(this, "StubRoutines", "exp");
StubRoutines::_intrinsic_exp = (double (*)(double)) __ pc();
// The intrinsic version of these seem to return the same value as __ subq(rsp, 8);
// the strict version. __ movdbl(Address(rsp, 0), xmm0);
StubRoutines::_intrinsic_exp = SharedRuntime::dexp; __ fld_d(Address(rsp, 0));
StubRoutines::_intrinsic_pow = SharedRuntime::dpow; __ exp_with_fallback(0);
__ fstp_d(Address(rsp, 0));
__ movdbl(xmm0, Address(rsp, 0));
__ addq(rsp, 8);
__ ret(0);
}
{
StubCodeMark mark(this, "StubRoutines", "pow");
StubRoutines::_intrinsic_pow = (double (*)(double,double)) __ pc();
__ subq(rsp, 8);
__ movdbl(Address(rsp, 0), xmm1);
__ fld_d(Address(rsp, 0));
__ movdbl(Address(rsp, 0), xmm0);
__ fld_d(Address(rsp, 0));
__ pow_with_fallback(0);
__ fstp_d(Address(rsp, 0));
__ movdbl(xmm0, Address(rsp, 0));
__ addq(rsp, 8);
__ ret(0);
}
} }
#undef __ #undef __

View file

@ -1518,7 +1518,9 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_abs : // fall thru
case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log : // fall thru
case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break;
case Interpreter::java_lang_ref_reference_get case Interpreter::java_lang_ref_reference_get
: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
default : ShouldNotReachHere(); break; default : ShouldNotReachHere(); break;
@ -1540,7 +1542,9 @@ bool AbstractInterpreter::can_be_compiled(methodHandle m) {
case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_abs : // fall thru
case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log : // fall thru
case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
case Interpreter::java_lang_math_exp :
return false; return false;
default: default:
return true; return true;

View file

@ -1534,7 +1534,9 @@ address AbstractInterpreterGenerator::generate_method_entry(
case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_abs : // fall thru
case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log : // fall thru
case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break; case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); break;
case Interpreter::java_lang_ref_reference_get case Interpreter::java_lang_ref_reference_get
: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
default : ShouldNotReachHere(); break; default : ShouldNotReachHere(); break;
@ -1558,7 +1560,9 @@ bool AbstractInterpreter::can_be_compiled(methodHandle m) {
case Interpreter::java_lang_math_abs : // fall thru case Interpreter::java_lang_math_abs : // fall thru
case Interpreter::java_lang_math_log : // fall thru case Interpreter::java_lang_math_log : // fall thru
case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
case Interpreter::java_lang_math_exp :
return false; return false;
default: default:
return true; return true;

View file

@ -2536,45 +2536,6 @@ encode %{
__ fld_d(Address(rsp, 0)); __ fld_d(Address(rsp, 0));
%} %}
// Compute X^Y using Intel's fast hardware instructions, if possible.
// Otherwise return a NaN.
enc_class pow_exp_core_encoding %{
// FPR1 holds Y*ln2(X). Compute FPR1 = 2^(Y*ln2(X))
emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xC0); // fdup = fld st(0) Q Q
emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xFC); // frndint int(Q) Q
emit_opcode(cbuf,0xDC); emit_opcode(cbuf,0xE9); // fsub st(1) -= st(0); int(Q) frac(Q)
emit_opcode(cbuf,0xDB); // FISTP [ESP] frac(Q)
emit_opcode(cbuf,0x1C);
emit_d8(cbuf,0x24);
emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xF0); // f2xm1 2^frac(Q)-1
emit_opcode(cbuf,0xD9); emit_opcode(cbuf,0xE8); // fld1 1 2^frac(Q)-1
emit_opcode(cbuf,0xDE); emit_opcode(cbuf,0xC1); // faddp 2^frac(Q)
emit_opcode(cbuf,0x8B); // mov rax,[esp+0]=int(Q)
encode_RegMem(cbuf, EAX_enc, ESP_enc, 0x4, 0, 0, false);
emit_opcode(cbuf,0xC7); // mov rcx,0xFFFFF800 - overflow mask
emit_rm(cbuf, 0x3, 0x0, ECX_enc);
emit_d32(cbuf,0xFFFFF800);
emit_opcode(cbuf,0x81); // add rax,1023 - the double exponent bias
emit_rm(cbuf, 0x3, 0x0, EAX_enc);
emit_d32(cbuf,1023);
emit_opcode(cbuf,0x8B); // mov rbx,eax
emit_rm(cbuf, 0x3, EBX_enc, EAX_enc);
emit_opcode(cbuf,0xC1); // shl rax,20 - Slide to exponent position
emit_rm(cbuf,0x3,0x4,EAX_enc);
emit_d8(cbuf,20);
emit_opcode(cbuf,0x85); // test rbx,ecx - check for overflow
emit_rm(cbuf, 0x3, EBX_enc, ECX_enc);
emit_opcode(cbuf,0x0F); emit_opcode(cbuf,0x45); // CMOVne rax,ecx - overflow; stuff NAN into EAX
emit_rm(cbuf, 0x3, EAX_enc, ECX_enc);
emit_opcode(cbuf,0x89); // mov [esp+4],eax - Store as part of double word
encode_RegMem(cbuf, EAX_enc, ESP_enc, 0x4, 0, 4, false);
emit_opcode(cbuf,0xC7); // mov [esp+0],0 - [ESP] = (double)(1<<int(Q)) = 2^int(Q)
encode_RegMem(cbuf, 0x0, ESP_enc, 0x4, 0, 0, false);
emit_d32(cbuf,0);
emit_opcode(cbuf,0xDC); // fmul dword st(0),[esp+0]; FPR1 = 2^int(Q)*2^frac(Q) = 2^Q
encode_RegMem(cbuf, 0x1, ESP_enc, 0x4, 0, 0, false);
%}
enc_class Push_Result_Mod_DPR( regDPR src) %{ enc_class Push_Result_Mod_DPR( regDPR src) %{
if ($src$$reg != FPR1L_enc) { if ($src$$reg != FPR1L_enc) {
// fincstp // fincstp
@ -10100,162 +10061,68 @@ instruct sqrtDPR_reg(regDPR dst, regDPR src) %{
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct powDPR_reg(regDPR X, regDPR1 Y, eAXRegI rax, eBXRegI rbx, eCXRegI rcx) %{ instruct powDPR_reg(regDPR X, regDPR1 Y, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{
predicate (UseSSE<=1); predicate (UseSSE<=1);
match(Set Y (PowD X Y)); // Raise X to the Yth power match(Set Y (PowD X Y)); // Raise X to the Yth power
effect(KILL rax, KILL rbx, KILL rcx); effect(KILL rax, KILL rdx, KILL rcx, KILL cr);
format %{ "SUB ESP,8\t\t# Fast-path POW encoding\n\t" format %{ "fast_pow $X $Y -> $Y // KILL $rax, $rcx, $rdx" %}
"FLD_D $X\n\t" ins_encode %{
"FYL2X \t\t\t# Q=Y*ln2(X)\n\t" __ subptr(rsp, 8);
__ fld_s($X$$reg - 1);
"FDUP \t\t\t# Q Q\n\t" __ fast_pow();
"FRNDINT\t\t\t# int(Q) Q\n\t" __ addptr(rsp, 8);
"FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t"
"FISTP dword [ESP]\n\t"
"F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t"
"FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t"
"FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead
"MOV EAX,[ESP]\t# Pick up int(Q)\n\t"
"MOV ECX,0xFFFFF800\t# Overflow mask\n\t"
"ADD EAX,1023\t\t# Double exponent bias\n\t"
"MOV EBX,EAX\t\t# Preshifted biased expo\n\t"
"SHL EAX,20\t\t# Shift exponent into place\n\t"
"TEST EBX,ECX\t\t# Check for overflow\n\t"
"CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t"
"MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t"
"MOV [ESP+0],0\n\t"
"FMUL ST(0),[ESP+0]\t# Scale\n\t"
"ADD ESP,8"
%} %}
ins_encode( push_stack_temp_qword,
Push_Reg_DPR(X),
Opcode(0xD9), Opcode(0xF1), // fyl2x
pow_exp_core_encoding,
pop_stack_temp_qword);
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct powD_reg(regD dst, regD src0, regD src1, regDPR1 tmp1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx ) %{ instruct powD_reg(regD dst, regD src0, regD src1, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{
predicate (UseSSE>=2); predicate (UseSSE>=2);
match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power
effect(KILL tmp1, KILL rax, KILL rbx, KILL rcx ); effect(KILL rax, KILL rdx, KILL rcx, KILL cr);
format %{ "SUB ESP,8\t\t# Fast-path POW encoding\n\t" format %{ "fast_pow $src0 $src1 -> $dst // KILL $rax, $rcx, $rdx" %}
"MOVSD [ESP],$src1\n\t" ins_encode %{
"FLD FPR1,$src1\n\t" __ subptr(rsp, 8);
"MOVSD [ESP],$src0\n\t" __ movdbl(Address(rsp, 0), $src1$$XMMRegister);
"FLD FPR1,$src0\n\t" __ fld_d(Address(rsp, 0));
"FYL2X \t\t\t# Q=Y*ln2(X)\n\t" __ movdbl(Address(rsp, 0), $src0$$XMMRegister);
__ fld_d(Address(rsp, 0));
"FDUP \t\t\t# Q Q\n\t" __ fast_pow();
"FRNDINT\t\t\t# int(Q) Q\n\t" __ fstp_d(Address(rsp, 0));
"FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t" __ movdbl($dst$$XMMRegister, Address(rsp, 0));
"FISTP dword [ESP]\n\t" __ addptr(rsp, 8);
"F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t"
"FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t"
"FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead
"MOV EAX,[ESP]\t# Pick up int(Q)\n\t"
"MOV ECX,0xFFFFF800\t# Overflow mask\n\t"
"ADD EAX,1023\t\t# Double exponent bias\n\t"
"MOV EBX,EAX\t\t# Preshifted biased expo\n\t"
"SHL EAX,20\t\t# Shift exponent into place\n\t"
"TEST EBX,ECX\t\t# Check for overflow\n\t"
"CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t"
"MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t"
"MOV [ESP+0],0\n\t"
"FMUL ST(0),[ESP+0]\t# Scale\n\t"
"FST_D [ESP]\n\t"
"MOVSD $dst,[ESP]\n\t"
"ADD ESP,8"
%} %}
ins_encode( push_stack_temp_qword,
push_xmm_to_fpr1(src1),
push_xmm_to_fpr1(src0),
Opcode(0xD9), Opcode(0xF1), // fyl2x
pow_exp_core_encoding,
Push_ResultD(dst) );
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct expDPR_reg(regDPR1 dpr1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx) %{ instruct expDPR_reg(regDPR1 dpr1, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{
predicate (UseSSE<=1); predicate (UseSSE<=1);
match(Set dpr1 (ExpD dpr1)); match(Set dpr1 (ExpD dpr1));
effect(KILL rax, KILL rbx, KILL rcx); effect(KILL rax, KILL rcx, KILL rdx, KILL cr);
format %{ "SUB ESP,8\t\t# Fast-path EXP encoding" format %{ "fast_exp $dpr1 -> $dpr1 // KILL $rax, $rcx, $rdx" %}
"FLDL2E \t\t\t# Ld log2(e) X\n\t" ins_encode %{
"FMULP \t\t\t# Q=X*log2(e)\n\t" __ fast_exp();
"FDUP \t\t\t# Q Q\n\t"
"FRNDINT\t\t\t# int(Q) Q\n\t"
"FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t"
"FISTP dword [ESP]\n\t"
"F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t"
"FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t"
"FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead
"MOV EAX,[ESP]\t# Pick up int(Q)\n\t"
"MOV ECX,0xFFFFF800\t# Overflow mask\n\t"
"ADD EAX,1023\t\t# Double exponent bias\n\t"
"MOV EBX,EAX\t\t# Preshifted biased expo\n\t"
"SHL EAX,20\t\t# Shift exponent into place\n\t"
"TEST EBX,ECX\t\t# Check for overflow\n\t"
"CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t"
"MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t"
"MOV [ESP+0],0\n\t"
"FMUL ST(0),[ESP+0]\t# Scale\n\t"
"ADD ESP,8"
%} %}
ins_encode( push_stack_temp_qword,
Opcode(0xD9), Opcode(0xEA), // fldl2e
Opcode(0xDE), Opcode(0xC9), // fmulp
pow_exp_core_encoding,
pop_stack_temp_qword);
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct expD_reg(regD dst, regD src, regDPR1 tmp1, eAXRegI rax, eBXRegI rbx, eCXRegI rcx) %{ instruct expD_reg(regD dst, regD src, eAXRegI rax, eDXRegI rdx, eCXRegI rcx, eFlagsReg cr) %{
predicate (UseSSE>=2); predicate (UseSSE>=2);
match(Set dst (ExpD src)); match(Set dst (ExpD src));
effect(KILL tmp1, KILL rax, KILL rbx, KILL rcx); effect(KILL rax, KILL rcx, KILL rdx, KILL cr);
format %{ "SUB ESP,8\t\t# Fast-path EXP encoding\n\t" format %{ "fast_exp $dst -> $src // KILL $rax, $rcx, $rdx" %}
"MOVSD [ESP],$src\n\t" ins_encode %{
"FLDL2E \t\t\t# Ld log2(e) X\n\t" __ subptr(rsp, 8);
"FMULP \t\t\t# Q=X*log2(e) X\n\t" __ movdbl(Address(rsp, 0), $src$$XMMRegister);
__ fld_d(Address(rsp, 0));
"FDUP \t\t\t# Q Q\n\t" __ fast_exp();
"FRNDINT\t\t\t# int(Q) Q\n\t" __ fstp_d(Address(rsp, 0));
"FSUB ST(1),ST(0)\t# int(Q) frac(Q)\n\t" __ movdbl($dst$$XMMRegister, Address(rsp, 0));
"FISTP dword [ESP]\n\t" __ addptr(rsp, 8);
"F2XM1 \t\t\t# 2^frac(Q)-1 int(Q)\n\t"
"FLD1 \t\t\t# 1 2^frac(Q)-1 int(Q)\n\t"
"FADDP \t\t\t# 2^frac(Q) int(Q)\n\t" // could use FADD [1.000] instead
"MOV EAX,[ESP]\t# Pick up int(Q)\n\t"
"MOV ECX,0xFFFFF800\t# Overflow mask\n\t"
"ADD EAX,1023\t\t# Double exponent bias\n\t"
"MOV EBX,EAX\t\t# Preshifted biased expo\n\t"
"SHL EAX,20\t\t# Shift exponent into place\n\t"
"TEST EBX,ECX\t\t# Check for overflow\n\t"
"CMOVne EAX,ECX\t\t# If overflow, stuff NaN into EAX\n\t"
"MOV [ESP+4],EAX\t# Marshal 64-bit scaling double\n\t"
"MOV [ESP+0],0\n\t"
"FMUL ST(0),[ESP+0]\t# Scale\n\t"
"FST_D [ESP]\n\t"
"MOVSD $dst,[ESP]\n\t"
"ADD ESP,8"
%} %}
ins_encode( Push_SrcD(src),
Opcode(0xD9), Opcode(0xEA), // fldl2e
Opcode(0xDE), Opcode(0xC9), // fmulp
pow_exp_core_encoding,
Push_ResultD(dst) );
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct log10DPR_reg(regDPR1 dst, regDPR1 src) %{ instruct log10DPR_reg(regDPR1 dst, regDPR1 src) %{
predicate (UseSSE<=1); predicate (UseSSE<=1);
// The source Double operand on FPU stack // The source Double operand on FPU stack

View file

@ -9823,7 +9823,39 @@ instruct logD_reg(regD dst) %{
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct powD_reg(regD dst, regD src0, regD src1, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{
match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power
effect(KILL rax, KILL rdx, KILL rcx, KILL cr);
format %{ "fast_pow $src0 $src1 -> $dst // KILL $rax, $rcx, $rdx" %}
ins_encode %{
__ subptr(rsp, 8);
__ movdbl(Address(rsp, 0), $src1$$XMMRegister);
__ fld_d(Address(rsp, 0));
__ movdbl(Address(rsp, 0), $src0$$XMMRegister);
__ fld_d(Address(rsp, 0));
__ fast_pow();
__ fstp_d(Address(rsp, 0));
__ movdbl($dst$$XMMRegister, Address(rsp, 0));
__ addptr(rsp, 8);
%}
ins_pipe( pipe_slow );
%}
instruct expD_reg(regD dst, regD src, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{
match(Set dst (ExpD src));
effect(KILL rax, KILL rcx, KILL rdx, KILL cr);
format %{ "fast_exp $dst -> $src // KILL $rax, $rcx, $rdx" %}
ins_encode %{
__ subptr(rsp, 8);
__ movdbl(Address(rsp, 0), $src$$XMMRegister);
__ fld_d(Address(rsp, 0));
__ fast_exp();
__ fstp_d(Address(rsp, 0));
__ movdbl($dst$$XMMRegister, Address(rsp, 0));
__ addptr(rsp, 8);
%}
ins_pipe( pipe_slow );
%}
//----------Arithmetic Conversion Instructions--------------------------------- //----------Arithmetic Conversion Instructions---------------------------------

View file

@ -1026,6 +1026,16 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle); java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
oop arg = VMSLOTS_OBJECT(arg_slot); oop arg = VMSLOTS_OBJECT(arg_slot);
jvalue arg_value; jvalue arg_value;
if (arg == NULL) {
// queue a nullpointer exception for the caller
stack->set_sp(calculate_unwind_sp(stack, method_handle));
CALL_VM_NOCHECK_NOFIX(
throw_exception(
thread, vmSymbols::java_lang_NullPointerException()));
// NB all oops trashed!
assert(HAS_PENDING_EXCEPTION, "should do");
return;
}
BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value); BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
if (arg_type == T_LONG || arg_type == T_DOUBLE) { if (arg_type == T_LONG || arg_type == T_DOUBLE) {
intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle); intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
@ -1112,6 +1122,15 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
case T_SHORT: case T_SHORT:
return; return;
} }
// INT results sometimes need narrowing
case T_BOOLEAN:
case T_CHAR:
case T_BYTE:
case T_SHORT:
switch (src_rtype) {
case T_INT:
return;
}
} }
tty->print_cr("unhandled conversion:"); tty->print_cr("unhandled conversion:");

View file

@ -2340,93 +2340,21 @@ void os::print_dll_info(outputStream *st) {
#endif #endif
} }
void os::print_os_info_brief(outputStream* st) {
st->print("Bsd");
os::Posix::print_uname_info(st);
}
void os::print_os_info(outputStream* st) { void os::print_os_info(outputStream* st) {
st->print("OS:"); st->print("OS:");
// Try to identify popular distros.
// Most Bsd distributions have /etc/XXX-release file, which contains
// the OS version string. Some have more than one /etc/XXX-release file
// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
// so the order is important.
if (!_print_ascii_file("/etc/mandrake-release", st) &&
!_print_ascii_file("/etc/sun-release", st) &&
!_print_ascii_file("/etc/redhat-release", st) &&
!_print_ascii_file("/etc/SuSE-release", st) &&
!_print_ascii_file("/etc/turbobsd-release", st) &&
!_print_ascii_file("/etc/gentoo-release", st) &&
!_print_ascii_file("/etc/debian_version", st) &&
!_print_ascii_file("/etc/ltib-release", st) &&
!_print_ascii_file("/etc/angstrom-version", st)) {
st->print("Bsd"); st->print("Bsd");
}
st->cr();
// kernel os::Posix::print_uname_info(st);
st->print("uname:");
struct utsname name;
uname(&name);
st->print(name.sysname); st->print(" ");
st->print(name.release); st->print(" ");
st->print(name.version); st->print(" ");
st->print(name.machine);
st->cr();
#ifndef _ALLBSD_SOURCE os::Posix::print_rlimit_info(st);
// Print warning if unsafe chroot environment detected
if (unsafe_chroot_detected) {
st->print("WARNING!! ");
st->print_cr(unstable_chroot_error);
}
// libc, pthread os::Posix::print_load_average(st);
st->print("libc:");
st->print(os::Bsd::glibc_version()); st->print(" ");
st->print(os::Bsd::libpthread_version()); st->print(" ");
if (os::Bsd::is_BsdThreads()) {
st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed");
}
st->cr();
#endif
// rlimit
st->print("rlimit:");
struct rlimit rlim;
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", CORE ");
getrlimit(RLIMIT_CORE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", NPROC ");
getrlimit(RLIMIT_NPROC, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
#ifndef _ALLBSD_SOURCE
st->print(", AS ");
getrlimit(RLIMIT_AS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->cr();
// load average
st->print("load average:");
double loadavg[3];
os::loadavg(loadavg, 3);
st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
st->cr();
#endif
} }
void os::pd_print_cpu_info(outputStream* st) { void os::pd_print_cpu_info(outputStream* st) {

View file

@ -2020,15 +2020,43 @@ void os::print_dll_info(outputStream *st) {
} }
} }
void os::print_os_info_brief(outputStream* st) {
os::Linux::print_distro_info(st);
os::Posix::print_uname_info(st);
os::Linux::print_libversion_info(st);
}
void os::print_os_info(outputStream* st) { void os::print_os_info(outputStream* st) {
st->print("OS:"); st->print("OS:");
os::Linux::print_distro_info(st);
os::Posix::print_uname_info(st);
// Print warning if unsafe chroot environment detected
if (unsafe_chroot_detected) {
st->print("WARNING!! ");
st->print_cr(unstable_chroot_error);
}
os::Linux::print_libversion_info(st);
os::Posix::print_rlimit_info(st);
os::Posix::print_load_average(st);
os::Linux::print_full_memory_info(st);
}
// Try to identify popular distros. // Try to identify popular distros.
// Most Linux distributions have /etc/XXX-release file, which contains // Most Linux distributions have /etc/XXX-release file, which contains
// the OS version string. Some have more than one /etc/XXX-release file // the OS version string. Some have more than one /etc/XXX-release file
// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
// so the order is important. // so the order is important.
void os::Linux::print_distro_info(outputStream* st) {
if (!_print_ascii_file("/etc/mandrake-release", st) && if (!_print_ascii_file("/etc/mandrake-release", st) &&
!_print_ascii_file("/etc/sun-release", st) && !_print_ascii_file("/etc/sun-release", st) &&
!_print_ascii_file("/etc/redhat-release", st) && !_print_ascii_file("/etc/redhat-release", st) &&
@ -2041,23 +2069,9 @@ void os::print_os_info(outputStream* st) {
st->print("Linux"); st->print("Linux");
} }
st->cr(); st->cr();
// kernel
st->print("uname:");
struct utsname name;
uname(&name);
st->print(name.sysname); st->print(" ");
st->print(name.release); st->print(" ");
st->print(name.version); st->print(" ");
st->print(name.machine);
st->cr();
// Print warning if unsafe chroot environment detected
if (unsafe_chroot_detected) {
st->print("WARNING!! ");
st->print_cr(unstable_chroot_error);
} }
void os::Linux::print_libversion_info(outputStream* st) {
// libc, pthread // libc, pthread
st->print("libc:"); st->print("libc:");
st->print(os::Linux::glibc_version()); st->print(" "); st->print(os::Linux::glibc_version()); st->print(" ");
@ -2066,58 +2080,14 @@ void os::print_os_info(outputStream* st) {
st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
} }
st->cr(); st->cr();
}
// rlimit void os::Linux::print_full_memory_info(outputStream* st) {
st->print("rlimit:");
struct rlimit rlim;
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", CORE ");
getrlimit(RLIMIT_CORE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", NPROC ");
getrlimit(RLIMIT_NPROC, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
st->print(", AS ");
getrlimit(RLIMIT_AS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->cr();
// load average
st->print("load average:");
double loadavg[3];
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"); st->print("\n/proc/meminfo:\n");
_print_ascii_file("/proc/meminfo", st); _print_ascii_file("/proc/meminfo", st);
st->cr(); st->cr();
} }
void os::pd_print_cpu_info(outputStream* st) {
st->print("\n/proc/cpuinfo:\n");
if (!_print_ascii_file("/proc/cpuinfo", st)) {
st->print(" <Not Available>");
}
st->cr();
}
void os::print_memory_info(outputStream* st) { void os::print_memory_info(outputStream* st) {
st->print("Memory:"); st->print("Memory:");
@ -2138,6 +2108,14 @@ void os::print_memory_info(outputStream* st) {
st->cr(); st->cr();
} }
void os::pd_print_cpu_info(outputStream* st) {
st->print("\n/proc/cpuinfo:\n");
if (!_print_ascii_file("/proc/cpuinfo", st)) {
st->print(" <Not Available>");
}
st->cr();
}
// Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific // Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific
// but they're the same for all the linux arch that we support // but they're the same for all the linux arch that we support
// and they're the same for solaris but there's no common place to put this. // and they're the same for solaris but there's no common place to put this.

View file

@ -89,6 +89,10 @@ class Linux {
static bool hugetlbfs_sanity_check(bool warn, size_t page_size); static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
static void print_full_memory_info(outputStream* st);
static void print_distro_info(outputStream* st);
static void print_libversion_info(outputStream* st);
public: public:
static void init_thread_fpu_state(); static void init_thread_fpu_state();
static int get_fpu_control_word(); static int get_fpu_control_word();

View file

@ -28,6 +28,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/utsname.h>
// Check core dump limit and report possible place where core can be found // Check core dump limit and report possible place where core can be found
void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
@ -72,3 +74,59 @@ void os::wait_for_keypress_at_exit(void) {
// don't do anything on posix platforms // don't do anything on posix platforms
return; return;
} }
void os::Posix::print_load_average(outputStream* st) {
st->print("load average:");
double loadavg[3];
os::loadavg(loadavg, 3);
st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
st->cr();
}
void os::Posix::print_rlimit_info(outputStream* st) {
st->print("rlimit:");
struct rlimit rlim;
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", CORE ");
getrlimit(RLIMIT_CORE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
//Isn't there on solaris
#ifndef TARGET_OS_FAMILY_solaris
st->print(", NPROC ");
getrlimit(RLIMIT_NPROC, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
#endif
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
st->print(", AS ");
getrlimit(RLIMIT_AS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->cr();
}
void os::Posix::print_uname_info(outputStream* st) {
// kernel
st->print("uname:");
struct utsname name;
uname(&name);
st->print(name.sysname); st->print(" ");
st->print(name.release); st->print(" ");
st->print(name.version); st->print(" ");
st->print(name.machine);
st->cr();
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 1999, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef OS_POSIX_VM_OS_POSIX_HPP
#define OS_POSIX_VM_OS_POSIX_HPP
class Posix {
friend class os;
protected:
static void print_distro_info(outputStream* st);
static void print_rlimit_info(outputStream* st);
static void print_uname_info(outputStream* st);
static void print_libversion_info(outputStream* st);
static void print_load_average(outputStream* st);
};
#endif

View file

@ -0,0 +1,285 @@
/*
* Copyright (c) 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* Name: add_gnu_debuglink.c
*
* Description: Add a ".gnu_debuglink" section that refers to the specified
* debug_info_path to the specified ELF object.
*
* This program is adapted from the example program shown on the
* elf(3elf) man page and from code from the Solaris compiler
* driver.
*/
/*
* needed to define SHF_EXCLUDE
*/
#define ELF_TARGET_ALL
#include <fcntl.h>
#include <stdio.h>
#include <libelf.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void failure(void);
static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
size_t len);
void
main(int argc, char ** argv) {
/* new ELF section name */
static char SEC_NAME[] = ".gnu_debuglink";
unsigned char buffer[8 * 1024]; /* I/O buffer */
int buffer_len; /* buffer length */
char * debug_info_path; /* debug info path */
void * ehdr; /* ELF header */
Elf * elf; /* ELF descriptor */
char * elf_ident; /* ELF identity string */
char * elf_obj; /* elf_obj file */
int fd; /* descriptor for files */
unsigned int file_crc = 0; /* CRC for debug info file */
int is_elfclass64; /* is an ELFCLASS64 file? */
Elf_Data * link_dat; /* ELF data for new debug info link */
Elf_Data * name_dat; /* ELF data for new section name */
Elf_Scn * new_scn; /* new ELF section descriptor */
void * new_shdr; /* new ELF section header */
Elf_Scn * scn; /* ELF section descriptor */
void * shdr; /* ELF section header */
if (argc != 3) {
(void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
exit(2);
}
debug_info_path = argv[1]; /* save for later */
if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
(void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
exit(3);
}
(void) printf("Computing CRC for '%s'\n", debug_info_path);
(void) fflush(stdout);
/* compute CRC for the debug info file */
for (;;) {
int len = read(fd, buffer, sizeof buffer);
if (len <= 0) {
break;
}
file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
}
(void) close(fd);
/* open the elf_obj */
elf_obj = argv[2];
if ((fd = open(elf_obj, O_RDWR)) == -1) {
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
exit(4);
}
(void) printf("Opening '%s' for update\n", elf_obj);
(void) fflush(stdout);
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
/* obtain the ELF descriptors from the input file */
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
failure();
}
/* determine if ELFCLASS64 or not? */
elf_ident = elf_getident(elf, NULL);
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
/* get the ELF header */
if (is_elfclass64) {
ehdr = elf64_getehdr(elf);
} else {
ehdr = elf32_getehdr(elf);
}
if (ehdr == NULL) {
failure();
}
/* get the ELF section descriptor */
if (is_elfclass64) {
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
} else {
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
}
if (scn == NULL) {
failure();
}
/* get the section header */
if (is_elfclass64) {
shdr = elf64_getshdr(scn);
} else {
shdr = elf32_getshdr(scn);
}
if (shdr == NULL) {
failure();
}
(void) printf("Adding ELF data for new section name\n");
(void) fflush(stdout);
name_dat = elf_newdata(scn);
name_dat->d_buf = (void *) SEC_NAME;
if (is_elfclass64) {
name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
} else {
name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
}
name_dat->d_align = 1;
name_dat->d_size = strlen(SEC_NAME) + 1;
new_scn = elf_newscn(elf);
if (is_elfclass64) {
new_shdr = elf64_getshdr(new_scn);
((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
} else {
new_shdr = elf32_getshdr(new_scn);
((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
}
(void) printf("Adding ELF data for debug_info_path value\n");
(void) fflush(stdout);
(void) memset(buffer, 0, sizeof buffer);
buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
(void) strncpy((char *) buffer, debug_info_path, buffer_len);
if (buffer_len % 4 != 0) {
/* not on a 4 byte boundary so pad to the next one */
buffer_len += (4 - buffer_len % 4);
}
/* save the CRC */
(void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
buffer_len += sizeof file_crc;
link_dat = elf_newdata(new_scn);
link_dat->d_type = ELF_T_BYTE;
link_dat->d_size = buffer_len;
link_dat->d_buf = buffer;
link_dat->d_align = 1;
(void) printf("Saving updates to '%s'\n", elf_obj);
(void) fflush(stdout);
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
(void) elf_end(elf); /* done with ELF obj */
(void) close(fd);
(void) printf("Done updating '%s'\n", elf_obj);
(void) fflush(stdout);
exit(0);
} /* end main */
static void
failure() {
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
exit(5);
}
/*
* The CRC used in gnu_debuglink, retrieved from
* http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
*/
static unsigned int
gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
static const unsigned int crc32_table[256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
0x2d02ef8d
};
unsigned char *end;
crc = ~crc & 0xffffffff;
for (end = buf + len; buf < end; ++buf) {
crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
}
return ~crc & 0xffffffff;
}

View file

@ -2242,61 +2242,44 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
return true; return true;
} }
void os::print_os_info_brief(outputStream* st) {
os::Solaris::print_distro_info(st);
os::Posix::print_uname_info(st);
os::Solaris::print_libversion_info(st);
}
void os::print_os_info(outputStream* st) { void os::print_os_info(outputStream* st) {
st->print("OS:"); st->print("OS:");
os::Solaris::print_distro_info(st);
os::Posix::print_uname_info(st);
os::Solaris::print_libversion_info(st);
os::Posix::print_rlimit_info(st);
os::Posix::print_load_average(st);
}
void os::Solaris::print_distro_info(outputStream* st) {
if (!_print_ascii_file("/etc/release", st)) { if (!_print_ascii_file("/etc/release", st)) {
st->print("Solaris"); st->print("Solaris");
} }
st->cr(); st->cr();
// kernel
st->print("uname:");
struct utsname name;
uname(&name);
st->print(name.sysname); st->print(" ");
st->print(name.release); st->print(" ");
st->print(name.version); st->print(" ");
st->print(name.machine);
// libthread
if (os::Solaris::T2_libthread()) st->print(" (T2 libthread)");
else st->print(" (T1 libthread)");
st->cr();
// rlimit
st->print("rlimit:");
struct rlimit rlim;
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", CORE ");
getrlimit(RLIMIT_CORE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%d", rlim.rlim_cur);
st->print(", AS ");
getrlimit(RLIMIT_AS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print("%uk", rlim.rlim_cur >> 10);
st->cr();
// load average
st->print("load average:");
double loadavg[3];
os::loadavg(loadavg, 3);
st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
st->cr();
} }
void os::Solaris::print_libversion_info(outputStream* st) {
if (os::Solaris::T2_libthread()) {
st->print(" (T2 libthread)");
}
else {
st->print(" (T1 libthread)");
}
st->cr();
}
static bool check_addr0(outputStream* st) { static bool check_addr0(outputStream* st) {
jboolean status = false; jboolean status = false;

View file

@ -180,6 +180,9 @@ class Solaris {
// proc_t structure (note that this is a system struct). // proc_t structure (note that this is a system struct).
static address _main_stack_base; static address _main_stack_base;
static void print_distro_info(outputStream* st);
static void print_libversion_info(outputStream* st);
public: public:
static void libthread_init(); static void libthread_init();
static void synchronization_init(); static void synchronization_init();

View file

@ -1562,9 +1562,17 @@ void os::print_dll_info(outputStream *st) {
enumerate_modules(pid, _print_module, (void *)st); enumerate_modules(pid, _print_module, (void *)st);
} }
void os::print_os_info_brief(outputStream* st) {
os::print_os_info(st);
}
void os::print_os_info(outputStream* st) { void os::print_os_info(outputStream* st) {
st->print("OS:"); st->print("OS:");
os::win32::print_windows_version(st);
}
void os::win32::print_windows_version(outputStream* st) {
OSVERSIONINFOEX osvi; OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

View file

@ -27,6 +27,7 @@
// Win32_OS defines the interface to windows operating systems // Win32_OS defines the interface to windows operating systems
class win32 { class win32 {
friend class os;
protected: protected:
static int _vm_page_size; static int _vm_page_size;
@ -39,6 +40,8 @@ class win32 {
static bool _is_windows_2003; static bool _is_windows_2003;
static bool _is_windows_server; static bool _is_windows_server;
static void print_windows_version(outputStream* st);
public: public:
// Windows-specific interface: // Windows-specific interface:
static void initialize_system_info(); static void initialize_system_info();

View file

@ -522,11 +522,12 @@ JVM_handle_bsd_signal(int sig,
if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) {
stub = SharedRuntime::get_poll_stub(pc); stub = SharedRuntime::get_poll_stub(pc);
#if defined(__APPLE__) && !defined(AMD64) #if defined(__APPLE__)
// 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions.
// 64-bit Darwin may also use a SIGBUS (seen with compressed oops).
// Catching SIGBUS here prevents the implicit SIGBUS NULL check below from // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from
// being called, so only do so if the implicit NULL check is not necessary. // being called, so only do so if the implicit NULL check is not necessary.
} else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) { } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
#else #else
} else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
#endif #endif

View file

@ -2949,6 +2949,8 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
case vmIntrinsics::_dtan : // fall through case vmIntrinsics::_dtan : // fall through
case vmIntrinsics::_dlog : // fall through case vmIntrinsics::_dlog : // fall through
case vmIntrinsics::_dlog10 : // fall through case vmIntrinsics::_dlog10 : // fall through
case vmIntrinsics::_dexp : // fall through
case vmIntrinsics::_dpow : // fall through
{ {
// Compiles where the root method is an intrinsic need a special // Compiles where the root method is an intrinsic need a special
// compilation environment because the bytecodes for the method // compilation environment because the bytecodes for the method
@ -2969,6 +2971,9 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
_state = start_block->state()->copy_for_parsing(); _state = start_block->state()->copy_for_parsing();
_last = start_block; _last = start_block;
load_local(doubleType, 0); load_local(doubleType, 0);
if (scope->method()->intrinsic_id() == vmIntrinsics::_dpow) {
load_local(doubleType, 2);
}
// Emit the intrinsic node. // Emit the intrinsic node.
bool result = try_inline_intrinsics(scope->method()); bool result = try_inline_intrinsics(scope->method());
@ -3182,6 +3187,8 @@ bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
case vmIntrinsics::_dtan : // fall through case vmIntrinsics::_dtan : // fall through
case vmIntrinsics::_dlog : // fall through case vmIntrinsics::_dlog : // fall through
case vmIntrinsics::_dlog10 : // fall through case vmIntrinsics::_dlog10 : // fall through
case vmIntrinsics::_dexp : // fall through
case vmIntrinsics::_dpow : // fall through
if (!InlineMathNatives) return false; if (!InlineMathNatives) return false;
cantrap = false; cantrap = false;
preserves_state = true; preserves_state = true;

View file

@ -624,11 +624,13 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
{ {
assert(op->as_Op2() != NULL, "must be"); assert(op->as_Op2() != NULL, "must be");
LIR_Op2* op2 = (LIR_Op2*)op; LIR_Op2* op2 = (LIR_Op2*)op;
assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
if (op2->_info) do_info(op2->_info); if (op2->_info) do_info(op2->_info);
if (op2->_opr1->is_valid()) do_input(op2->_opr1); if (op2->_opr1->is_valid()) do_input(op2->_opr1);
if (op2->_opr2->is_valid()) do_input(op2->_opr2); if (op2->_opr2->is_valid()) do_input(op2->_opr2);
if (op2->_tmp->is_valid()) do_temp(op2->_tmp); if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
if (op2->_result->is_valid()) do_output(op2->_result); if (op2->_result->is_valid()) do_output(op2->_result);
break; break;
@ -641,7 +643,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(op->as_Op2() != NULL, "must be"); assert(op->as_Op2() != NULL, "must be");
LIR_Op2* op2 = (LIR_Op2*)op; LIR_Op2* op2 = (LIR_Op2*)op;
assert(op2->_info == NULL && op2->_tmp->is_illegal(), "not used"); assert(op2->_info == NULL && op2->_tmp1->is_illegal() && op2->_tmp2->is_illegal() &&
op2->_tmp3->is_illegal() && op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
assert(op2->_opr1->is_valid() && op2->_opr2->is_valid() && op2->_result->is_valid(), "used"); assert(op2->_opr1->is_valid() && op2->_opr2->is_valid() && op2->_result->is_valid(), "used");
do_input(op2->_opr1); do_input(op2->_opr1);
@ -665,10 +668,12 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
assert(op2->_opr1->is_valid(), "used"); assert(op2->_opr1->is_valid(), "used");
assert(op2->_opr2->is_valid(), "used"); assert(op2->_opr2->is_valid(), "used");
assert(op2->_result->is_valid(), "used"); assert(op2->_result->is_valid(), "used");
assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
do_input(op2->_opr1); do_temp(op2->_opr1); do_input(op2->_opr1); do_temp(op2->_opr1);
do_input(op2->_opr2); do_temp(op2->_opr2); do_input(op2->_opr2); do_temp(op2->_opr2);
if (op2->_tmp->is_valid()) do_temp(op2->_tmp); if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
do_output(op2->_result); do_output(op2->_result);
break; break;
@ -682,6 +687,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
if (op2->_opr1->is_valid()) do_temp(op2->_opr1); if (op2->_opr1->is_valid()) do_temp(op2->_opr1);
if (op2->_opr2->is_valid()) do_input(op2->_opr2); // exception object is input parameter if (op2->_opr2->is_valid()) do_input(op2->_opr2); // exception object is input parameter
assert(op2->_result->is_illegal(), "no result"); assert(op2->_result->is_illegal(), "no result");
assert(op2->_tmp2->is_illegal() && op2->_tmp3->is_illegal() &&
op2->_tmp4->is_illegal() && op2->_tmp5->is_illegal(), "not used");
break; break;
} }
@ -702,7 +709,8 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
case lir_sin: case lir_sin:
case lir_cos: case lir_cos:
case lir_log: case lir_log:
case lir_log10: { case lir_log10:
case lir_exp: {
assert(op->as_Op2() != NULL, "must be"); assert(op->as_Op2() != NULL, "must be");
LIR_Op2* op2 = (LIR_Op2*)op; LIR_Op2* op2 = (LIR_Op2*)op;
@ -711,16 +719,47 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
// Register input operand as temp to guarantee that it doesn't // Register input operand as temp to guarantee that it doesn't
// overlap with the input. // overlap with the input.
assert(op2->_info == NULL, "not used"); assert(op2->_info == NULL, "not used");
assert(op2->_tmp5->is_illegal(), "not used");
assert(op2->_tmp2->is_valid() == (op->code() == lir_exp), "not used");
assert(op2->_tmp3->is_valid() == (op->code() == lir_exp), "not used");
assert(op2->_tmp4->is_valid() == (op->code() == lir_exp), "not used");
assert(op2->_opr1->is_valid(), "used"); assert(op2->_opr1->is_valid(), "used");
do_input(op2->_opr1); do_temp(op2->_opr1); do_input(op2->_opr1); do_temp(op2->_opr1);
if (op2->_opr2->is_valid()) do_temp(op2->_opr2); if (op2->_opr2->is_valid()) do_temp(op2->_opr2);
if (op2->_tmp->is_valid()) do_temp(op2->_tmp); if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1);
if (op2->_tmp2->is_valid()) do_temp(op2->_tmp2);
if (op2->_tmp3->is_valid()) do_temp(op2->_tmp3);
if (op2->_tmp4->is_valid()) do_temp(op2->_tmp4);
if (op2->_result->is_valid()) do_output(op2->_result); if (op2->_result->is_valid()) do_output(op2->_result);
break; break;
} }
case lir_pow: {
assert(op->as_Op2() != NULL, "must be");
LIR_Op2* op2 = (LIR_Op2*)op;
// On x86 pow needs two temporary fpu stack slots: tmp1 and
// tmp2. Register input operands as temps to guarantee that it
// doesn't overlap with the temporary slots.
assert(op2->_info == NULL, "not used");
assert(op2->_opr1->is_valid() && op2->_opr2->is_valid(), "used");
assert(op2->_tmp1->is_valid() && op2->_tmp2->is_valid() && op2->_tmp3->is_valid()
&& op2->_tmp4->is_valid() && op2->_tmp5->is_valid(), "used");
assert(op2->_result->is_valid(), "used");
do_input(op2->_opr1); do_temp(op2->_opr1);
do_input(op2->_opr2); do_temp(op2->_opr2);
do_temp(op2->_tmp1);
do_temp(op2->_tmp2);
do_temp(op2->_tmp3);
do_temp(op2->_tmp4);
do_temp(op2->_tmp5);
do_output(op2->_result);
break;
}
// LIR_Op3 // LIR_Op3
case lir_idiv: case lir_idiv:
@ -1670,6 +1709,8 @@ const char * LIR_Op::name() const {
case lir_tan: s = "tan"; break; case lir_tan: s = "tan"; break;
case lir_log: s = "log"; break; case lir_log: s = "log"; break;
case lir_log10: s = "log10"; break; case lir_log10: s = "log10"; break;
case lir_exp: s = "exp"; break;
case lir_pow: s = "pow"; break;
case lir_logic_and: s = "logic_and"; break; case lir_logic_and: s = "logic_and"; break;
case lir_logic_or: s = "logic_or"; break; case lir_logic_or: s = "logic_or"; break;
case lir_logic_xor: s = "logic_xor"; break; case lir_logic_xor: s = "logic_xor"; break;
@ -1892,7 +1933,11 @@ void LIR_Op2::print_instr(outputStream* out) const {
} }
in_opr1()->print(out); out->print(" "); in_opr1()->print(out); out->print(" ");
in_opr2()->print(out); out->print(" "); in_opr2()->print(out); out->print(" ");
if (tmp_opr()->is_valid()) { tmp_opr()->print(out); out->print(" "); } if (tmp1_opr()->is_valid()) { tmp1_opr()->print(out); out->print(" "); }
if (tmp2_opr()->is_valid()) { tmp2_opr()->print(out); out->print(" "); }
if (tmp3_opr()->is_valid()) { tmp3_opr()->print(out); out->print(" "); }
if (tmp4_opr()->is_valid()) { tmp4_opr()->print(out); out->print(" "); }
if (tmp5_opr()->is_valid()) { tmp5_opr()->print(out); out->print(" "); }
result_opr()->print(out); result_opr()->print(out);
} }

View file

@ -916,6 +916,8 @@ enum LIR_Code {
, lir_tan , lir_tan
, lir_log , lir_log
, lir_log10 , lir_log10
, lir_exp
, lir_pow
, lir_logic_and , lir_logic_and
, lir_logic_or , lir_logic_or
, lir_logic_xor , lir_logic_xor
@ -1560,7 +1562,11 @@ class LIR_Op2: public LIR_Op {
LIR_Opr _opr1; LIR_Opr _opr1;
LIR_Opr _opr2; LIR_Opr _opr2;
BasicType _type; BasicType _type;
LIR_Opr _tmp; LIR_Opr _tmp1;
LIR_Opr _tmp2;
LIR_Opr _tmp3;
LIR_Opr _tmp4;
LIR_Opr _tmp5;
LIR_Condition _condition; LIR_Condition _condition;
void verify() const; void verify() const;
@ -1573,7 +1579,11 @@ class LIR_Op2: public LIR_Op {
, _type(T_ILLEGAL) , _type(T_ILLEGAL)
, _condition(condition) , _condition(condition)
, _fpu_stack_size(0) , _fpu_stack_size(0)
, _tmp(LIR_OprFact::illegalOpr) { , _tmp1(LIR_OprFact::illegalOpr)
, _tmp2(LIR_OprFact::illegalOpr)
, _tmp3(LIR_OprFact::illegalOpr)
, _tmp4(LIR_OprFact::illegalOpr)
, _tmp5(LIR_OprFact::illegalOpr) {
assert(code == lir_cmp, "code check"); assert(code == lir_cmp, "code check");
} }
@ -1584,7 +1594,11 @@ class LIR_Op2: public LIR_Op {
, _type(type) , _type(type)
, _condition(condition) , _condition(condition)
, _fpu_stack_size(0) , _fpu_stack_size(0)
, _tmp(LIR_OprFact::illegalOpr) { , _tmp1(LIR_OprFact::illegalOpr)
, _tmp2(LIR_OprFact::illegalOpr)
, _tmp3(LIR_OprFact::illegalOpr)
, _tmp4(LIR_OprFact::illegalOpr)
, _tmp5(LIR_OprFact::illegalOpr) {
assert(code == lir_cmove, "code check"); assert(code == lir_cmove, "code check");
assert(type != T_ILLEGAL, "cmove should have type"); assert(type != T_ILLEGAL, "cmove should have type");
} }
@ -1597,25 +1611,38 @@ class LIR_Op2: public LIR_Op {
, _type(type) , _type(type)
, _condition(lir_cond_unknown) , _condition(lir_cond_unknown)
, _fpu_stack_size(0) , _fpu_stack_size(0)
, _tmp(LIR_OprFact::illegalOpr) { , _tmp1(LIR_OprFact::illegalOpr)
, _tmp2(LIR_OprFact::illegalOpr)
, _tmp3(LIR_OprFact::illegalOpr)
, _tmp4(LIR_OprFact::illegalOpr)
, _tmp5(LIR_OprFact::illegalOpr) {
assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check"); assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check");
} }
LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp) LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2 = LIR_OprFact::illegalOpr,
LIR_Opr tmp3 = LIR_OprFact::illegalOpr, LIR_Opr tmp4 = LIR_OprFact::illegalOpr, LIR_Opr tmp5 = LIR_OprFact::illegalOpr)
: LIR_Op(code, result, NULL) : LIR_Op(code, result, NULL)
, _opr1(opr1) , _opr1(opr1)
, _opr2(opr2) , _opr2(opr2)
, _type(T_ILLEGAL) , _type(T_ILLEGAL)
, _condition(lir_cond_unknown) , _condition(lir_cond_unknown)
, _fpu_stack_size(0) , _fpu_stack_size(0)
, _tmp(tmp) { , _tmp1(tmp1)
, _tmp2(tmp2)
, _tmp3(tmp3)
, _tmp4(tmp4)
, _tmp5(tmp5) {
assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check"); assert(code != lir_cmp && is_in_range(code, begin_op2, end_op2), "code check");
} }
LIR_Opr in_opr1() const { return _opr1; } LIR_Opr in_opr1() const { return _opr1; }
LIR_Opr in_opr2() const { return _opr2; } LIR_Opr in_opr2() const { return _opr2; }
BasicType type() const { return _type; } BasicType type() const { return _type; }
LIR_Opr tmp_opr() const { return _tmp; } LIR_Opr tmp1_opr() const { return _tmp1; }
LIR_Opr tmp2_opr() const { return _tmp2; }
LIR_Opr tmp3_opr() const { return _tmp3; }
LIR_Opr tmp4_opr() const { return _tmp4; }
LIR_Opr tmp5_opr() const { return _tmp5; }
LIR_Condition condition() const { LIR_Condition condition() const {
assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); return _condition; assert(code() == lir_cmp || code() == lir_cmove, "only valid for cmp and cmove"); return _condition;
} }
@ -2025,6 +2052,8 @@ class LIR_List: public CompilationResourceObj {
void sin (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_sin , from, tmp1, to, tmp2)); } void sin (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_sin , from, tmp1, to, tmp2)); }
void cos (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_cos , from, tmp1, to, tmp2)); } void cos (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_cos , from, tmp1, to, tmp2)); }
void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); } void tan (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_Op2(lir_tan , from, tmp1, to, tmp2)); }
void exp (LIR_Opr from, LIR_Opr to, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, LIR_Opr tmp4, LIR_Opr tmp5) { append(new LIR_Op2(lir_exp , from, tmp1, to, tmp2, tmp3, tmp4, tmp5)); }
void pow (LIR_Opr arg1, LIR_Opr arg2, LIR_Opr res, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, LIR_Opr tmp4, LIR_Opr tmp5) { append(new LIR_Op2(lir_pow, arg1, arg2, res, tmp1, tmp2, tmp3, tmp4, tmp5)); }
void add (LIR_Opr left, LIR_Opr right, LIR_Opr res) { append(new LIR_Op2(lir_add, left, right, res)); } void add (LIR_Opr left, LIR_Opr right, LIR_Opr res) { append(new LIR_Op2(lir_add, left, right, res)); }
void sub (LIR_Opr left, LIR_Opr right, LIR_Opr res, CodeEmitInfo* info = NULL) { append(new LIR_Op2(lir_sub, left, right, res, info)); } void sub (LIR_Opr left, LIR_Opr right, LIR_Opr res, CodeEmitInfo* info = NULL) { append(new LIR_Op2(lir_sub, left, right, res, info)); }

View file

@ -718,7 +718,7 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) {
if (op->in_opr2()->is_constant()) { if (op->in_opr2()->is_constant()) {
shift_op(op->code(), op->in_opr1(), op->in_opr2()->as_constant_ptr()->as_jint(), op->result_opr()); shift_op(op->code(), op->in_opr1(), op->in_opr2()->as_constant_ptr()->as_jint(), op->result_opr());
} else { } else {
shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp_opr()); shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr());
} }
break; break;
@ -746,6 +746,8 @@ void LIR_Assembler::emit_op2(LIR_Op2* op) {
case lir_cos: case lir_cos:
case lir_log: case lir_log:
case lir_log10: case lir_log10:
case lir_exp:
case lir_pow:
intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op); intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);
break; break;

View file

@ -2960,7 +2960,9 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
case vmIntrinsics::_dsqrt: // fall through case vmIntrinsics::_dsqrt: // fall through
case vmIntrinsics::_dtan: // fall through case vmIntrinsics::_dtan: // fall through
case vmIntrinsics::_dsin : // fall through case vmIntrinsics::_dsin : // fall through
case vmIntrinsics::_dcos : do_MathIntrinsic(x); break; case vmIntrinsics::_dcos : // fall through
case vmIntrinsics::_dexp : // fall through
case vmIntrinsics::_dpow : do_MathIntrinsic(x); break;
case vmIntrinsics::_arraycopy: do_ArrayCopy(x); break; case vmIntrinsics::_arraycopy: do_ArrayCopy(x); break;
// java.nio.Buffer.checkIndex // java.nio.Buffer.checkIndex

View file

@ -6579,6 +6579,8 @@ void LinearScanStatistic::collect(LinearScan* allocator) {
case lir_abs: case lir_abs:
case lir_log10: case lir_log10:
case lir_log: case lir_log:
case lir_pow:
case lir_exp:
case lir_logic_and: case lir_logic_and:
case lir_logic_or: case lir_logic_or:
case lir_logic_xor: case lir_logic_xor:

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -143,7 +143,27 @@ compute_optional_offset(int& dest_offset,
} }
int java_lang_String::value_offset = 0;
int java_lang_String::offset_offset = 0;
int java_lang_String::count_offset = 0;
int java_lang_String::hash_offset = 0;
bool java_lang_String::initialized = false;
void java_lang_String::compute_offsets() {
assert(!initialized, "offsets should be initialized only once");
klassOop k = SystemDictionary::String_klass();
compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::char_array_signature());
compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature());
compute_optional_offset(count_offset, k, vmSymbols::count_name(), vmSymbols::int_signature());
compute_optional_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature());
initialized = true;
}
Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) { Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) {
assert(initialized, "Must be initialized");
// Create the String object first, so there's a chance that the String // Create the String object first, so there's a chance that the String
// and the char array it points to end up in the same cache line. // and the char array it points to end up in the same cache line.
oop obj; oop obj;
@ -2837,10 +2857,6 @@ int java_lang_System::err_offset_in_bytes() {
int java_lang_String::value_offset;
int java_lang_String::offset_offset;
int java_lang_String::count_offset;
int java_lang_String::hash_offset;
int java_lang_Class::_klass_offset; int java_lang_Class::_klass_offset;
int java_lang_Class::_array_klass_offset; int java_lang_Class::_array_klass_offset;
int java_lang_Class::_resolved_constructor_offset; int java_lang_Class::_resolved_constructor_offset;
@ -3000,12 +3016,6 @@ void JavaClasses::compute_hard_coded_offsets() {
const int x = heapOopSize; const int x = heapOopSize;
const int header = instanceOopDesc::base_offset_in_bytes(); const int header = instanceOopDesc::base_offset_in_bytes();
// Do the String Class
java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header;
java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header;
java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint);
java_lang_String::hash_offset = java_lang_String::count_offset + sizeof (jint);
// Throwable Class // Throwable Class
java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header; java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header;
java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header;
@ -3200,9 +3210,13 @@ void JavaClasses::check_offsets() {
// java.lang.String // java.lang.String
CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C"); CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C");
if (java_lang_String::has_offset_field()) {
CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I");
CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); CHECK_OFFSET("java/lang/String", java_lang_String, count, "I");
}
if (java_lang_String::has_hash_field()) {
CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I");
}
// java.lang.Class // java.lang.Class

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,26 +52,36 @@
class java_lang_String : AllStatic { class java_lang_String : AllStatic {
private: private:
enum {
hc_value_offset = 0,
hc_offset_offset = 1
//hc_count_offset = 2 -- not a word-scaled offset
//hc_hash_offset = 3 -- not a word-scaled offset
};
static int value_offset; static int value_offset;
static int offset_offset; static int offset_offset;
static int count_offset; static int count_offset;
static int hash_offset; static int hash_offset;
static bool initialized;
static Handle basic_create(int length, bool tenured, TRAPS); static Handle basic_create(int length, bool tenured, TRAPS);
static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS);
static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } static void set_value( oop string, typeArrayOop buffer) {
static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } assert(initialized, "Must be initialized");
static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } string->obj_field_put(value_offset, (oop)buffer);
}
static void set_offset(oop string, int offset) {
assert(initialized, "Must be initialized");
if (offset_offset > 0) {
string->int_field_put(offset_offset, offset);
}
}
static void set_count( oop string, int count) {
assert(initialized, "Must be initialized");
if (count_offset > 0) {
string->int_field_put(count_offset, count);
}
}
public: public:
static void compute_offsets();
// Instance creation // Instance creation
static Handle create_from_unicode(jchar* unicode, int len, TRAPS); static Handle create_from_unicode(jchar* unicode, int len, TRAPS);
static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS);
@ -82,23 +92,61 @@ class java_lang_String : AllStatic {
static Handle create_from_platform_dependent_str(const char* str, TRAPS); static Handle create_from_platform_dependent_str(const char* str, TRAPS);
static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
static int value_offset_in_bytes() { return value_offset; } static bool has_offset_field() {
static int count_offset_in_bytes() { return count_offset; } assert(initialized, "Must be initialized");
static int offset_offset_in_bytes() { return offset_offset; } return (offset_offset > 0);
static int hash_offset_in_bytes() { return hash_offset; } }
static bool has_count_field() {
assert(initialized, "Must be initialized");
return (count_offset > 0);
}
static bool has_hash_field() {
assert(initialized, "Must be initialized");
return (hash_offset > 0);
}
static int value_offset_in_bytes() {
assert(initialized && (value_offset > 0), "Must be initialized");
return value_offset;
}
static int count_offset_in_bytes() {
assert(initialized && (count_offset > 0), "Must be initialized");
return count_offset;
}
static int offset_offset_in_bytes() {
assert(initialized && (offset_offset > 0), "Must be initialized");
return offset_offset;
}
static int hash_offset_in_bytes() {
assert(initialized && (hash_offset > 0), "Must be initialized");
return hash_offset;
}
// Accessors // Accessors
static typeArrayOop value(oop java_string) { static typeArrayOop value(oop java_string) {
assert(initialized && (value_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string"); assert(is_instance(java_string), "must be java_string");
return (typeArrayOop) java_string->obj_field(value_offset); return (typeArrayOop) java_string->obj_field(value_offset);
} }
static int offset(oop java_string) { static int offset(oop java_string) {
assert(initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string"); assert(is_instance(java_string), "must be java_string");
if (offset_offset > 0) {
return java_string->int_field(offset_offset); return java_string->int_field(offset_offset);
} else {
return 0;
}
} }
static int length(oop java_string) { static int length(oop java_string) {
assert(initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string"); assert(is_instance(java_string), "must be java_string");
if (count_offset > 0) {
return java_string->int_field(count_offset); return java_string->int_field(count_offset);
} else {
return ((typeArrayOop)java_string->obj_field(value_offset))->length();
}
} }
static int utf8_length(oop java_string); static int utf8_length(oop java_string);

View file

@ -1971,6 +1971,9 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
// first do Object, String, Class // first do Object, String, Class
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
// Calculate offsets for String and Class classes since they are loaded and
// can be used after this point.
java_lang_String::compute_offsets();
java_lang_Class::compute_offsets(); java_lang_Class::compute_offsets();
// Fixup mirrors for classes loaded before java.lang.Class. // Fixup mirrors for classes loaded before java.lang.Class.

View file

@ -340,6 +340,9 @@
template(park_event_name, "nativeParkEventPointer") \ template(park_event_name, "nativeParkEventPointer") \
template(cache_field_name, "cache") \ template(cache_field_name, "cache") \
template(value_name, "value") \ template(value_name, "value") \
template(offset_name, "offset") \
template(count_name, "count") \
template(hash_name, "hash") \
template(frontCacheEnabled_name, "frontCacheEnabled") \ template(frontCacheEnabled_name, "frontCacheEnabled") \
template(stringCacheEnabled_name, "stringCacheEnabled") \ template(stringCacheEnabled_name, "stringCacheEnabled") \
template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \ template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \

View file

@ -6332,10 +6332,10 @@ void CMSCollector::reset(bool asynch) {
) )
} }
void CMSCollector::do_CMS_operation(CMS_op_type op) { void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t("GC", PrintGC, !PrintGCDetails, gclog_or_tty); TraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
switch (op) { switch (op) {

View file

@ -717,7 +717,7 @@ class CMSCollector: public CHeapObj {
CMS_op_checkpointRootsFinal CMS_op_checkpointRootsFinal
}; };
void do_CMS_operation(CMS_op_type op); void do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause);
bool stop_world_and_do(CMS_op_type op); bool stop_world_and_do(CMS_op_type op);
OopTaskQueueSet* task_queues() { return _task_queues; } OopTaskQueueSet* task_queues() { return _task_queues; }

View file

@ -146,7 +146,7 @@ void VM_CMS_Initial_Mark::doit() {
VM_CMS_Operation::verify_before_gc(); VM_CMS_Operation::verify_before_gc();
IsGCActiveMark x; // stop-world GC active IsGCActiveMark x; // stop-world GC active
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial); _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
VM_CMS_Operation::verify_after_gc(); VM_CMS_Operation::verify_after_gc();
#ifndef USDT2 #ifndef USDT2
@ -178,7 +178,7 @@ void VM_CMS_Final_Remark::doit() {
VM_CMS_Operation::verify_before_gc(); VM_CMS_Operation::verify_before_gc();
IsGCActiveMark x; // stop-world GC active IsGCActiveMark x; // stop-world GC active
_collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal); _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
VM_CMS_Operation::verify_after_gc(); VM_CMS_Operation::verify_after_gc();
#ifndef USDT2 #ifndef USDT2

View file

@ -1252,10 +1252,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
char verbose_str[128]; TraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, gclog_or_tty);
sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause()));
TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty);
TraceCollectorStats tcs(g1mm()->full_collection_counters()); TraceCollectorStats tcs(g1mm()->full_collection_counters());
TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
@ -3600,12 +3597,10 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
char verbose_str[128]; GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
sprintf(verbose_str, "GC pause (%s) (%s)%s", .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
GCCause::to_string(gc_cause()), .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
g1_policy()->gcs_are_young() ? "young" : "mixed", TraceTime t(gc_cause_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty);
TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
@ -5502,7 +5497,7 @@ void G1CollectedHeap::evacuate_collection_set() {
if (evacuation_failed()) { if (evacuation_failed()) {
remove_self_forwarding_pointers(); remove_self_forwarding_pointers();
if (G1Log::finer()) { if (G1Log::finer()) {
gclog_or_tty->print(" (to-space overflow)"); gclog_or_tty->print(" (to-space exhausted)");
} else if (G1Log::fine()) { } else if (G1Log::fine()) {
gclog_or_tty->print("--"); gclog_or_tty->print("--");
} }

View file

@ -886,9 +886,8 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
size_t start_used) { size_t start_used) {
if (G1Log::finer()) { if (G1Log::finer()) {
gclog_or_tty->stamp(PrintGCTimeStamps); gclog_or_tty->stamp(PrintGCTimeStamps);
gclog_or_tty->print("[GC pause (%s) (%s)", gclog_or_tty->print("[%s", (const char*)GCCauseString("GC pause", _g1->gc_cause())
GCCause::to_string(_g1->gc_cause()), .append(gcs_are_young() ? " (young)" : " (mixed)"));
gcs_are_young() ? "young" : "mixed");
} }
// We only need to do this here as the policy will only be applied // We only need to do this here as the policy will only be applied
@ -1010,7 +1009,8 @@ T sum_of(T* sum_arr, int start, int n, int N) {
void G1CollectorPolicy::print_par_stats(int level, void G1CollectorPolicy::print_par_stats(int level,
const char* str, const char* str,
double* data) { double* data,
bool showDecimals) {
double min = data[0], max = data[0]; double min = data[0], max = data[0];
double total = 0.0; double total = 0.0;
LineBuffer buf(level); LineBuffer buf(level);
@ -1023,7 +1023,11 @@ void G1CollectorPolicy::print_par_stats(int level,
max = val; max = val;
total += val; total += val;
if (G1Log::finest()) { if (G1Log::finest()) {
if (showDecimals) {
buf.append(" %.1lf", val); buf.append(" %.1lf", val);
} else {
buf.append(" %d", (int)val);
}
} }
} }
@ -1031,36 +1035,26 @@ void G1CollectorPolicy::print_par_stats(int level,
buf.append_and_print_cr(""); buf.append_and_print_cr("");
} }
double avg = total / (double) no_of_gc_threads(); double avg = total / (double) no_of_gc_threads();
buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]", if (showDecimals) {
avg, min, max, max - min); buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]",
min, avg, max, max - min, total);
} else {
buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]",
(int)min, (int)avg, (int)max, (int)max - (int)min, (int)total);
} }
void G1CollectorPolicy::print_par_sizes(int level,
const char* str,
double* data) {
double min = data[0], max = data[0];
double total = 0.0;
LineBuffer buf(level);
buf.append("[%s :", str);
for (uint i = 0; i < no_of_gc_threads(); ++i) {
double val = data[i];
if (val < min)
min = val;
if (val > max)
max = val;
total += val;
buf.append(" %d", (int) val);
}
buf.append_and_print_cr("");
double avg = total / (double) no_of_gc_threads();
buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]",
(int)total, (int)avg, (int)min, (int)max, (int)max - (int)min);
} }
void G1CollectorPolicy::print_stats(int level, void G1CollectorPolicy::print_stats(int level,
const char* str, const char* str,
double value) { double value) {
LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value); LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
}
void G1CollectorPolicy::print_stats(int level,
const char* str,
double value,
int workers) {
LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers);
} }
void G1CollectorPolicy::print_stats(int level, void G1CollectorPolicy::print_stats(int level,
@ -1373,7 +1367,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms); print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
} }
if (parallel) { if (parallel) {
print_stats(1, "Parallel Time", _cur_collection_par_time_ms); print_stats(1, "Parallel Time", _cur_collection_par_time_ms, no_of_gc_threads);
print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms); print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms);
print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms);
if (print_marking_info) { if (print_marking_info) {
@ -1381,13 +1375,15 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
} }
print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); print_par_stats(2, "Update RS", _par_last_update_rs_times_ms);
if (G1Log::finest()) { if (G1Log::finest()) {
print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers); print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers,
false /* showDecimals */);
} }
print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms);
print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms);
print_par_stats(2, "Termination", _par_last_termination_times_ms); print_par_stats(2, "Termination", _par_last_termination_times_ms);
if (G1Log::finest()) { if (G1Log::finest()) {
print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts); print_par_stats(3, "Termination Attempts", _par_last_termination_attempts,
false /* showDecimals */);
} }
for (int i = 0; i < _parallel_gc_threads; i++) { for (int i = 0; i < _parallel_gc_threads; i++) {
@ -1601,9 +1597,9 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
_collectionSetChooser->verify(); _collectionSetChooser->verify();
} }
#define EXT_SIZE_FORMAT "%d%s" #define EXT_SIZE_FORMAT "%.1f%s"
#define EXT_SIZE_PARAMS(bytes) \ #define EXT_SIZE_PARAMS(bytes) \
byte_size_in_proper_unit((bytes)), \ byte_size_in_proper_unit((double)(bytes)), \
proper_unit_for_byte_size((bytes)) proper_unit_for_byte_size((bytes))
void G1CollectorPolicy::print_heap_transition() { void G1CollectorPolicy::print_heap_transition() {

View file

@ -552,10 +552,10 @@ public:
private: private:
void print_stats(int level, const char* str, double value); void print_stats(int level, const char* str, double value);
void print_stats(int level, const char* str, double value, int workers);
void print_stats(int level, const char* str, int value); void print_stats(int level, const char* str, int value);
void print_par_stats(int level, const char* str, double* data); void print_par_stats(int level, const char* str, double* data, bool showDecimals = true);
void print_par_sizes(int level, const char* str, double* data);
void check_other_times(int level, void check_other_times(int level,
NumberSeq* other_times_ms, NumberSeq* other_times_ms,

View file

@ -42,6 +42,7 @@ VM_G1CollectForAllocation::VM_G1CollectForAllocation(
void VM_G1CollectForAllocation::doit() { void VM_G1CollectForAllocation::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap(); G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
_result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded); _result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded);
assert(_result == NULL || _pause_succeeded, assert(_result == NULL || _pause_succeeded,
"if we get back a result, the pause should have succeeded"); "if we get back a result, the pause should have succeeded");

View file

@ -916,7 +916,7 @@ void ParNewGeneration::collect(bool full,
size_policy->minor_collection_begin(); size_policy->minor_collection_begin();
} }
TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// Capture heap used before collection (for printing). // Capture heap used before collection (for printing).
size_t gch_prev_used = gch->used(); size_t gch_prev_used = gch->used();

View file

@ -160,16 +160,10 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
{ {
HandleMark hm; HandleMark hm;
const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;
// This is useful for debugging but don't change the output the
// the customer sees.
const char* gc_cause_str = "Full GC";
if (is_system_gc && PrintGCDetails) {
gc_cause_str = "Full GC (System)";
}
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);

View file

@ -2047,17 +2047,9 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
gc_task_manager()->task_idle_workers(); gc_task_manager()->task_idle_workers();
heap->set_par_threads(gc_task_manager()->active_workers()); heap->set_par_threads(gc_task_manager()->active_workers());
const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;
// This is useful for debugging but don't change the output the
// the customer sees.
const char* gc_cause_str = "Full GC";
if (is_system_gc && PrintGCDetails) {
gc_cause_str = "Full GC (System)";
}
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
@ -2090,7 +2082,8 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
} }
#endif // #ifndef PRODUCT #endif // #ifndef PRODUCT
bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc; bool max_on_system_gc = UseMaximumCompactionOnSystemGC
&& gc_cause == GCCause::_java_lang_system_gc;
summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));

View file

@ -325,7 +325,7 @@ bool PSScavenge::invoke_no_policy() {
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty); TraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty);
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(false /* not full GC */,gc_cause); TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);

View file

@ -31,9 +31,15 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample,
float average) { float average) {
// We smooth the samples by not using weight() directly until we've // We smooth the samples by not using weight() directly until we've
// had enough data to make it meaningful. We'd like the first weight // had enough data to make it meaningful. We'd like the first weight
// used to be 1, the second to be 1/2, etc until we have 100/weight // used to be 1, the second to be 1/2, etc until we have
// samples. // OLD_THRESHOLD/weight samples.
unsigned count_weight = 100/count(); unsigned count_weight = 0;
// Avoid division by zero if the counter wraps (7158457)
if (!is_old()) {
count_weight = OLD_THRESHOLD/count();
}
unsigned adaptive_weight = (MAX2(weight(), count_weight)); unsigned adaptive_weight = (MAX2(weight(), count_weight));
float new_avg = exp_avg(average, new_sample, adaptive_weight); float new_avg = exp_avg(average, new_sample, adaptive_weight);
@ -43,8 +49,6 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample,
void AdaptiveWeightedAverage::sample(float new_sample) { void AdaptiveWeightedAverage::sample(float new_sample) {
increment_count(); increment_count();
assert(count() != 0,
"Wraparound -- history would be incorrectly discarded");
// Compute the new weighted average // Compute the new weighted average
float new_avg = compute_adaptive_average(new_sample, average()); float new_avg = compute_adaptive_average(new_sample, average());

View file

@ -50,11 +50,20 @@ class AdaptiveWeightedAverage : public CHeapObj {
unsigned _weight; // The weight used to smooth the averages unsigned _weight; // The weight used to smooth the averages
// A higher weight favors the most // A higher weight favors the most
// recent data. // recent data.
bool _is_old; // Has enough historical data
const static unsigned OLD_THRESHOLD = 100;
protected: protected:
float _last_sample; // The last value sampled. float _last_sample; // The last value sampled.
void increment_count() { _sample_count++; } void increment_count() {
_sample_count++;
if (!_is_old && _sample_count > OLD_THRESHOLD) {
_is_old = true;
}
}
void set_average(float avg) { _average = avg; } void set_average(float avg) { _average = avg; }
// Helper function, computes an adaptive weighted average // Helper function, computes an adaptive weighted average
@ -64,13 +73,15 @@ class AdaptiveWeightedAverage : public CHeapObj {
public: public:
// Input weight must be between 0 and 100 // Input weight must be between 0 and 100
AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) : AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) :
_average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) { _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0),
_is_old(false) {
} }
void clear() { void clear() {
_average = 0; _average = 0;
_sample_count = 0; _sample_count = 0;
_last_sample = 0; _last_sample = 0;
_is_old = false;
} }
// Useful for modifying static structures after startup. // Useful for modifying static structures after startup.
@ -85,6 +96,7 @@ class AdaptiveWeightedAverage : public CHeapObj {
unsigned weight() const { return _weight; } unsigned weight() const { return _weight; }
unsigned count() const { return _sample_count; } unsigned count() const { return _sample_count; }
float last_sample() const { return _last_sample; } float last_sample() const { return _last_sample; }
bool is_old() const { return _is_old; }
// Update data with a new sample. // Update data with a new sample.
void sample(float new_sample); void sample(float new_sample);

View file

@ -88,4 +88,36 @@ class GCCause : public AllStatic {
static const char* to_string(GCCause::Cause cause); static const char* to_string(GCCause::Cause cause);
}; };
// Helper class for doing logging that includes the GC Cause
// as a string.
class GCCauseString : StackObj {
private:
static const int _length = 128;
char _buffer[_length];
int _position;
public:
GCCauseString(const char* prefix, GCCause::Cause cause) {
if (PrintGCCause) {
_position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause));
} else {
_position = jio_snprintf(_buffer, _length, "%s", prefix);
}
assert(_position >= 0 && _position <= _length,
err_msg("Need to increase the buffer size in GCCauseString? %d", _position));
}
GCCauseString& append(const char* str) {
int res = jio_snprintf(_buffer + _position, _length - _position, "%s", str);
_position += res;
assert(res >= 0 && _position <= _length,
err_msg("Need to increase the buffer size in GCCauseString? %d", res));
return *this;
}
operator const char*() {
return _buffer;
}
};
#endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP #endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP

View file

@ -107,6 +107,8 @@ class AbstractInterpreter: AllStatic {
java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x) java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x)
java_lang_math_log, // implementation of java.lang.Math.log (x) java_lang_math_log, // implementation of java.lang.Math.log (x)
java_lang_math_log10, // implementation of java.lang.Math.log10 (x) java_lang_math_log10, // implementation of java.lang.Math.log10 (x)
java_lang_math_pow, // implementation of java.lang.Math.pow (x,y)
java_lang_math_exp, // implementation of java.lang.Math.exp (x)
java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get() java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get()
number_of_method_entries, number_of_method_entries,
invalid = -1 invalid = -1

View file

@ -221,6 +221,8 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m)
case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ; case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ;
case vmIntrinsics::_dlog : return java_lang_math_log ; case vmIntrinsics::_dlog : return java_lang_math_log ;
case vmIntrinsics::_dlog10: return java_lang_math_log10; case vmIntrinsics::_dlog10: return java_lang_math_log10;
case vmIntrinsics::_dpow : return java_lang_math_pow ;
case vmIntrinsics::_dexp : return java_lang_math_exp ;
case vmIntrinsics::_Reference_get: case vmIntrinsics::_Reference_get:
return java_lang_ref_reference_get; return java_lang_ref_reference_get;

View file

@ -370,6 +370,8 @@ void TemplateInterpreterGenerator::generate_all() {
method_entry(java_lang_math_sqrt ) method_entry(java_lang_math_sqrt )
method_entry(java_lang_math_log ) method_entry(java_lang_math_log )
method_entry(java_lang_math_log10) method_entry(java_lang_math_log10)
method_entry(java_lang_math_exp )
method_entry(java_lang_math_pow )
method_entry(java_lang_ref_reference_get) method_entry(java_lang_ref_reference_get)
// all native method kinds (must be one contiguous block) // all native method kinds (must be one contiguous block)

View file

@ -548,7 +548,7 @@ void DefNewGeneration::collect(bool full,
init_assuming_no_promotion_failure(); init_assuming_no_promotion_failure();
TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// Capture heap used before collection (for printing). // Capture heap used before collection (for printing).
size_t gch_prev_used = gch->used(); size_t gch_prev_used = gch->used();

View file

@ -78,8 +78,8 @@ public:
void do_oop(oop* p) { void do_oop(oop* p) {
if (p != NULL) { if (p != NULL) {
oop obj = *p; oop obj = *p;
if (obj->klass() == SystemDictionary::String_klass()) { if (obj->klass() == SystemDictionary::String_klass() &&
java_lang_String::has_hash_field()) {
int hash = java_lang_String::hash_string(obj); int hash = java_lang_String::hash_string(obj);
obj->int_field_put(hash_offset, hash); obj->int_field_put(hash_offset, hash);
} }

View file

@ -480,26 +480,15 @@ void GenCollectedHeap::do_collection(bool full,
const size_t perm_prev_used = perm_gen()->used(); const size_t perm_prev_used = perm_gen()->used();
print_heap_before_gc(); print_heap_before_gc();
if (Verbose) {
gclog_or_tty->print_cr("GC Cause: %s", GCCause::to_string(gc_cause()));
}
{ {
FlagSetting fl(_is_gc_active, true); FlagSetting fl(_is_gc_active, true);
bool complete = full && (max_level == (n_gens()-1)); bool complete = full && (max_level == (n_gens()-1));
const char* gc_cause_str = "GC "; const char* gc_cause_prefix = complete ? "Full GC" : "GC";
if (complete) {
GCCause::Cause cause = gc_cause();
if (cause == GCCause::_java_lang_system_gc) {
gc_cause_str = "Full GC (System) ";
} else {
gc_cause_str = "Full GC ";
}
}
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
TraceTime t(gc_cause_str, PrintGCDetails, false, gclog_or_tty); TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty);
gc_prologue(complete); gc_prologue(complete);
increment_total_collections(complete); increment_total_collections(complete);

View file

@ -76,7 +76,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
_ref_processor = rp; _ref_processor = rp;
rp->setup_policy(clear_all_softrefs); rp->setup_policy(clear_all_softrefs);
TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); TraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
// When collecting the permanent generation methodOops may be moving, // When collecting the permanent generation methodOops may be moving,
// so we either have to flush all bcp data or convert it into bci. // so we either have to flush all bcp data or convert it into bci.

View file

@ -780,7 +780,7 @@ void Parse::count_compiled_calls(bool at_method_entry, bool is_inline) {
if( at_method_entry ) { if( at_method_entry ) {
// bump invocation counter if top method (for statistics) // bump invocation counter if top method (for statistics)
if (CountCompiledCalls && depth() == 1) { if (CountCompiledCalls && depth() == 1) {
const TypeInstPtr* addr_type = TypeInstPtr::make(method()); const TypeOopPtr* addr_type = TypeOopPtr::make_from_constant(method());
Node* adr1 = makecon(addr_type); Node* adr1 = makecon(addr_type);
Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(methodOopDesc::compiled_invocation_counter_offset())); Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(methodOopDesc::compiled_invocation_counter_offset()));
increment_counter(adr2); increment_counter(adr2);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -3748,3 +3748,81 @@ void GraphKit::g1_write_barrier_post(Node* oop_store,
final_sync(ideal); final_sync(ideal);
} }
#undef __ #undef __
Node* GraphKit::load_String_offset(Node* ctrl, Node* str) {
if (java_lang_String::has_offset_field()) {
int offset_offset = java_lang_String::offset_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
int offset_field_idx = C->get_alias_index(offset_field_type);
return make_load(ctrl,
basic_plus_adr(str, str, offset_offset),
TypeInt::INT, T_INT, offset_field_idx);
} else {
return intcon(0);
}
}
Node* GraphKit::load_String_length(Node* ctrl, Node* str) {
if (java_lang_String::has_count_field()) {
int count_offset = java_lang_String::count_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* count_field_type = string_type->add_offset(count_offset);
int count_field_idx = C->get_alias_index(count_field_type);
return make_load(ctrl,
basic_plus_adr(str, str, count_offset),
TypeInt::INT, T_INT, count_field_idx);
} else {
return load_array_length(load_String_value(ctrl, str));
}
}
Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
int value_field_idx = C->get_alias_index(value_field_type);
return make_load(ctrl, basic_plus_adr(str, str, value_offset),
value_type, T_OBJECT, value_field_idx);
}
void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
int offset_offset = java_lang_String::offset_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
int offset_field_idx = C->get_alias_index(offset_field_type);
store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
value, T_INT, offset_field_idx);
}
void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
int value_field_idx = C->get_alias_index(value_field_type);
store_to_memory(ctrl, basic_plus_adr(str, value_offset),
value, T_OBJECT, value_field_idx);
}
void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
int count_offset = java_lang_String::count_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* count_field_type = string_type->add_offset(count_offset);
int count_field_idx = C->get_alias_index(count_field_type);
store_to_memory(ctrl, basic_plus_adr(str, count_offset),
value, T_INT, count_field_idx);
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -781,6 +781,14 @@ class GraphKit : public Phase {
Node* new_array(Node* klass_node, Node* count_val, int nargs, Node* new_array(Node* klass_node, Node* count_val, int nargs,
Node* *return_size_val = NULL); Node* *return_size_val = NULL);
// java.lang.String helpers
Node* load_String_offset(Node* ctrl, Node* str);
Node* load_String_length(Node* ctrl, Node* str);
Node* load_String_value(Node* ctrl, Node* str);
void store_String_offset(Node* ctrl, Node* str, Node* value);
void store_String_length(Node* ctrl, Node* str, Node* value);
void store_String_value(Node* ctrl, Node* str, Node* value);
// Handy for making control flow // Handy for making control flow
IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) {
IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's

View file

@ -147,7 +147,8 @@ class LibraryCallKit : public GraphKit {
return generate_method_call(method_id, true, false); return generate_method_call(method_id, true, false);
} }
Node* make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2); Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2);
Node* make_string_method_node(int opcode, Node* str1, Node* str2);
bool inline_string_compareTo(); bool inline_string_compareTo();
bool inline_string_indexOf(); bool inline_string_indexOf();
Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i); Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i);
@ -873,35 +874,63 @@ Node* LibraryCallKit::generate_current_thread(Node* &tls_output) {
//------------------------------make_string_method_node------------------------ //------------------------------make_string_method_node------------------------
// Helper method for String intrinsic finctions. // Helper method for String intrinsic functions. This version is called
Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2) { // with str1 and str2 pointing to String object nodes.
const int value_offset = java_lang_String::value_offset_in_bytes(); //
const int count_offset = java_lang_String::count_offset_in_bytes(); Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2) {
const int offset_offset = java_lang_String::offset_offset_in_bytes();
Node* no_ctrl = NULL; Node* no_ctrl = NULL;
ciInstanceKlass* klass = env()->String_klass(); // Get start addr of string
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); Node* str1_value = load_String_value(no_ctrl, str1);
Node* str1_offset = load_String_offset(no_ctrl, str1);
const TypeAryPtr* value_type =
TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
// Get start addr of string and substring
Node* str1_valuea = basic_plus_adr(str1, str1, value_offset);
Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset));
Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset);
Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR);
Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); // Get length of string 1
Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); Node* str1_len = load_String_length(no_ctrl, str1);
Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset);
Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); Node* str2_value = load_String_value(no_ctrl, str2);
Node* str2_offset = load_String_offset(no_ctrl, str2);
Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR);
Node* str2_len = NULL;
Node* result = NULL;
switch (opcode) {
case Op_StrIndexOf:
// Get length of string 2
str2_len = load_String_length(no_ctrl, str2);
result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str1_len, str2_start, str2_len);
break;
case Op_StrComp:
// Get length of string 2
str2_len = load_String_length(no_ctrl, str2);
result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str1_len, str2_start, str2_len);
break;
case Op_StrEquals:
result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS),
str1_start, str2_start, str1_len);
break;
default:
ShouldNotReachHere();
return NULL;
}
// All these intrinsics have checks.
C->set_has_split_ifs(true); // Has chance for split-if optimization
return _gvn.transform(result);
}
// Helper method for String intrinsic functions. This version is called
// with str1 and str2 pointing to char[] nodes, with cnt1 and cnt2 pointing
// to Int nodes containing the lenghts of str1 and str2.
//
Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2) {
Node* result = NULL; Node* result = NULL;
switch (opcode) { switch (opcode) {
case Op_StrIndexOf: case Op_StrIndexOf:
@ -932,10 +961,6 @@ bool LibraryCallKit::inline_string_compareTo() {
if (!Matcher::has_match_rule(Op_StrComp)) return false; if (!Matcher::has_match_rule(Op_StrComp)) return false;
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
_sp += 2; _sp += 2;
Node *argument = pop(); // pop non-receiver first: it was pushed second Node *argument = pop(); // pop non-receiver first: it was pushed second
Node *receiver = pop(); Node *receiver = pop();
@ -952,18 +977,7 @@ bool LibraryCallKit::inline_string_compareTo() {
return true; return true;
} }
ciInstanceKlass* klass = env()->String_klass(); Node* compare = make_string_method_node(Op_StrComp, receiver, argument);
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
Node* no_ctrl = NULL;
// Get counts for string and argument
Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset);
Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* argument_cnta = basic_plus_adr(argument, argument, count_offset);
Node* argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* compare = make_string_method_node(Op_StrComp, receiver, receiver_cnt, argument, argument_cnt);
push(compare); push(compare);
return true; return true;
} }
@ -973,10 +987,6 @@ bool LibraryCallKit::inline_string_equals() {
if (!Matcher::has_match_rule(Op_StrEquals)) return false; if (!Matcher::has_match_rule(Op_StrEquals)) return false;
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
int nargs = 2; int nargs = 2;
_sp += nargs; _sp += nargs;
Node* argument = pop(); // pop non-receiver first: it was pushed second Node* argument = pop(); // pop non-receiver first: it was pushed second
@ -1030,24 +1040,31 @@ bool LibraryCallKit::inline_string_equals() {
} }
} }
if (!stopped()) {
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
Node* no_ctrl = NULL;
Node* receiver_cnt;
Node* argument_cnt;
if (!stopped()) {
// Properly cast the argument to String // Properly cast the argument to String
argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type));
// This path is taken only when argument's type is String:NotNull. // This path is taken only when argument's type is String:NotNull.
argument = cast_not_null(argument, false); argument = cast_not_null(argument, false);
// Get counts for string and argument Node* no_ctrl = NULL;
Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset);
receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); // Get start addr of receiver
argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); Node* receiver_val = load_String_value(no_ctrl, receiver);
Node* receiver_offset = load_String_offset(no_ctrl, receiver);
Node* receiver_start = array_element_address(receiver_val, receiver_offset, T_CHAR);
// Get length of receiver
Node* receiver_cnt = load_String_length(no_ctrl, receiver);
// Get start addr of argument
Node* argument_val = load_String_value(no_ctrl, argument);
Node* argument_offset = load_String_offset(no_ctrl, argument);
Node* argument_start = array_element_address(argument_val, argument_offset, T_CHAR);
// Get length of argument
Node* argument_cnt = load_String_length(no_ctrl, argument);
// Check for receiver count != argument count // Check for receiver count != argument count
Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) );
@ -1057,15 +1074,15 @@ bool LibraryCallKit::inline_string_equals() {
phi->init_req(4, intcon(0)); phi->init_req(4, intcon(0));
region->init_req(4, if_ne); region->init_req(4, if_ne);
} }
}
// Check for count == 0 is done by mach node StrEquals. // Check for count == 0 is done by assembler code for StrEquals.
if (!stopped()) { if (!stopped()) {
Node* equals = make_string_method_node(Op_StrEquals, receiver, receiver_cnt, argument, argument_cnt); Node* equals = make_string_method_node(Op_StrEquals, receiver_start, receiver_cnt, argument_start, argument_cnt);
phi->init_req(1, equals); phi->init_req(1, equals);
region->init_req(1, control()); region->init_req(1, control());
} }
}
// post merge // post merge
set_control(_gvn.transform(region)); set_control(_gvn.transform(region));
@ -1162,20 +1179,9 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
const int nargs = 2; // number of arguments to push back for uncommon trap in predicate const int nargs = 2; // number of arguments to push back for uncommon trap in predicate
const int value_offset = java_lang_String::value_offset_in_bytes(); Node* source = load_String_value(no_ctrl, string_object);
const int count_offset = java_lang_String::count_offset_in_bytes(); Node* sourceOffset = load_String_offset(no_ctrl, string_object);
const int offset_offset = java_lang_String::offset_offset_in_bytes(); Node* sourceCount = load_String_length(no_ctrl, string_object);
ciInstanceKlass* klass = env()->String_klass();
const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0);
Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset);
Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset);
Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
Node* sourcea = basic_plus_adr(string_object, string_object, value_offset);
Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
jint target_length = target_array->length(); jint target_length = target_array->length();
@ -1243,10 +1249,6 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
//------------------------------inline_string_indexOf------------------------ //------------------------------inline_string_indexOf------------------------
bool LibraryCallKit::inline_string_indexOf() { bool LibraryCallKit::inline_string_indexOf() {
const int value_offset = java_lang_String::value_offset_in_bytes();
const int count_offset = java_lang_String::count_offset_in_bytes();
const int offset_offset = java_lang_String::offset_offset_in_bytes();
_sp += 2; _sp += 2;
Node *argument = pop(); // pop non-receiver first: it was pushed second Node *argument = pop(); // pop non-receiver first: it was pushed second
Node *receiver = pop(); Node *receiver = pop();
@ -1280,12 +1282,21 @@ bool LibraryCallKit::inline_string_indexOf() {
Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT); Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT);
Node* no_ctrl = NULL; Node* no_ctrl = NULL;
// Get counts for string and substr // Get start addr of source string
Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); Node* source = load_String_value(no_ctrl, receiver);
Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); Node* source_offset = load_String_offset(no_ctrl, receiver);
Node* source_start = array_element_address(source, source_offset, T_CHAR);
Node* substr_cnta = basic_plus_adr(argument, argument, count_offset); // Get length of source string
Node* substr_cnt = make_load(no_ctrl, substr_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); Node* source_cnt = load_String_length(no_ctrl, receiver);
// Get start addr of substring
Node* substr = load_String_value(no_ctrl, argument);
Node* substr_offset = load_String_offset(no_ctrl, argument);
Node* substr_start = array_element_address(substr, substr_offset, T_CHAR);
// Get length of source string
Node* substr_cnt = load_String_length(no_ctrl, argument);
// Check for substr count > string count // Check for substr count > string count
Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) ); Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) );
@ -1308,7 +1319,7 @@ bool LibraryCallKit::inline_string_indexOf() {
} }
if (!stopped()) { if (!stopped()) {
result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt); result = make_string_method_node(Op_StrIndexOf, source_start, source_cnt, substr_start, substr_cnt);
result_phi->init_req(1, result); result_phi->init_req(1, result);
result_rgn->init_req(1, control()); result_rgn->init_req(1, control());
} }
@ -1333,11 +1344,19 @@ bool LibraryCallKit::inline_string_indexOf() {
ciInstance* str = str_const->as_instance(); ciInstance* str = str_const->as_instance();
assert(str != NULL, "must be instance"); assert(str != NULL, "must be instance");
ciObject* v = str->field_value_by_offset(value_offset).as_object(); ciObject* v = str->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object();
int o = str->field_value_by_offset(offset_offset).as_int();
int c = str->field_value_by_offset(count_offset).as_int();
ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array
int o;
int c;
if (java_lang_String::has_offset_field()) {
o = str->field_value_by_offset(java_lang_String::offset_offset_in_bytes()).as_int();
c = str->field_value_by_offset(java_lang_String::count_offset_in_bytes()).as_int();
} else {
o = 0;
c = pat->length();
}
// constant strings have no offset and count == length which // constant strings have no offset and count == length which
// simplifies the resulting code somewhat so lets optimize for that. // simplifies the resulting code somewhat so lets optimize for that.
if (o != 0 || c != pat->length()) { if (o != 0 || c != pat->length()) {
@ -1538,9 +1557,6 @@ bool LibraryCallKit::inline_exp(vmIntrinsics::ID id) {
// every again. NaN results requires StrictMath.exp handling. // every again. NaN results requires StrictMath.exp handling.
if (too_many_traps(Deoptimization::Reason_intrinsic)) return false; if (too_many_traps(Deoptimization::Reason_intrinsic)) return false;
// Do not intrinsify on older platforms which lack cmove.
if (ConditionalMoveLimit == 0) return false;
_sp += arg_size(); // restore stack pointer _sp += arg_size(); // restore stack pointer
Node *x = pop_math_arg(); Node *x = pop_math_arg();
Node *result = _gvn.transform(new (C, 2) ExpDNode(0,x)); Node *result = _gvn.transform(new (C, 2) ExpDNode(0,x));
@ -1783,15 +1799,11 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
case vmIntrinsics::_dsqrt: return Matcher::has_match_rule(Op_SqrtD) ? inline_sqrt(id) : false; case vmIntrinsics::_dsqrt: return Matcher::has_match_rule(Op_SqrtD) ? inline_sqrt(id) : false;
case vmIntrinsics::_dabs: return Matcher::has_match_rule(Op_AbsD) ? inline_abs(id) : false; case vmIntrinsics::_dabs: return Matcher::has_match_rule(Op_AbsD) ? inline_abs(id) : false;
// These intrinsics don't work on X86. The ad implementation doesn't
// handle NaN's properly. Instead of returning infinity, the ad
// implementation returns a NaN on overflow. See bug: 6304089
// Once the ad implementations are fixed, change the code below
// to match the intrinsics above
case vmIntrinsics::_dexp: return case vmIntrinsics::_dexp: return
Matcher::has_match_rule(Op_ExpD) ? inline_exp(id) :
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP"); runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
case vmIntrinsics::_dpow: return case vmIntrinsics::_dpow: return
Matcher::has_match_rule(Op_PowD) ? inline_pow(id) :
runtime_math(OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW"); runtime_math(OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
// These intrinsics are not yet correctly implemented // These intrinsics are not yet correctly implemented

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -528,16 +528,6 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*):
} }
// Collect the types needed to talk about the various slices of memory // Collect the types needed to talk about the various slices of memory
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes());
const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes());
const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes());
value_field_idx = C->get_alias_index(value_field_type);
count_field_idx = C->get_alias_index(count_field_type);
offset_field_idx = C->get_alias_index(offset_field_type);
char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS); char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS);
// For each locally allocated StringBuffer see if the usages can be // For each locally allocated StringBuffer see if the usages can be
@ -1174,18 +1164,9 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N
Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) { Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) {
Node* string = str; Node* string = str;
Node* offset = kit.make_load(kit.control(), Node* offset = kit.load_String_offset(kit.control(), string);
kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()), Node* count = kit.load_String_length(kit.control(), string);
TypeInt::INT, T_INT, offset_field_idx); Node* value = kit.load_String_value (kit.control(), string);
Node* count = kit.make_load(kit.control(),
kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()),
TypeInt::INT, T_INT, count_field_idx);
const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
Node* value = kit.make_load(kit.control(),
kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()),
value_type, T_OBJECT, value_field_idx);
// copy the contents // copy the contents
if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) { if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) {
@ -1342,10 +1323,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
arg = phi; arg = phi;
sc->set_argument(argi, arg); sc->set_argument(argi, arg);
} }
// Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset),
// TypeInt::INT, T_INT, offset_field_idx); Node* count = kit.load_String_length(kit.control(), arg);
Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()),
TypeInt::INT, T_INT, count_field_idx);
length = __ AddI(length, count); length = __ AddI(length, count);
string_sizes->init_req(argi, NULL); string_sizes->init_req(argi, NULL);
break; break;
@ -1436,12 +1416,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
} }
// Intialize the string // Intialize the string
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()), if (java_lang_String::has_offset_field()) {
__ intcon(0), T_INT, offset_field_idx); kit.store_String_offset(kit.control(), result, __ intcon(0));
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()), kit.store_String_length(kit.control(), result, length);
length, T_INT, count_field_idx); }
kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()), kit.store_String_value(kit.control(), result, char_array);
char_array, T_OBJECT, value_field_idx);
// hook up the outgoing control and result // hook up the outgoing control and result
kit.replace_call(sc->end(), result); kit.replace_call(sc->end(), result);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,9 +41,6 @@ class PhaseStringOpts : public Phase {
// Memory slices needed for code gen // Memory slices needed for code gen
int char_adr_idx; int char_adr_idx;
int value_field_idx;
int count_field_idx;
int offset_field_idx;
// Integer.sizeTable - used for int to String conversion // Integer.sizeTable - used for int to String conversion
ciField* size_table_field; ciField* size_table_field;

View file

@ -1314,7 +1314,5 @@ const Type *PowDNode::Value( PhaseTransform *phase ) const {
if( t2->base() != Type::DoubleCon ) return Type::DOUBLE; if( t2->base() != Type::DoubleCon ) return Type::DOUBLE;
double d1 = t1->getd(); double d1 = t1->getd();
double d2 = t2->getd(); double d2 = t2->getd();
if( d1 < 0.0 ) return Type::DOUBLE;
if( d2 < 0.0 ) return Type::DOUBLE;
return TypeD::make( StubRoutines::intrinsic_pow( d1, d2 ) ); return TypeD::make( StubRoutines::intrinsic_pow( d1, d2 ) );
} }

View file

@ -3039,7 +3039,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
return result; return result;
} }
#ifdef JAVASE_EMBEDDED #if (defined JAVASE_EMBEDDED || defined ARM)
UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
#endif #endif
@ -3092,6 +3092,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
PrintGC = true; PrintGC = true;
} }
if (!JDK_Version::is_gte_jdk18x_version()) {
// To avoid changing the log format for 7 updates this flag is only
// true by default in JDK8 and above.
if (FLAG_IS_DEFAULT(PrintGCCause)) {
FLAG_SET_DEFAULT(PrintGCCause, false);
}
}
// Set object alignment values. // Set object alignment values.
set_object_alignment(); set_object_alignment();

View file

@ -3902,7 +3902,10 @@ class CommandLineFlags {
" of this flag is true for JDK 6 and earlier") \ " of this flag is true for JDK 6 and earlier") \
\ \
diagnostic(bool, WhiteBoxAPI, false, \ diagnostic(bool, WhiteBoxAPI, false, \
"Enable internal testing APIs") "Enable internal testing APIs") \
\
product(bool, PrintGCCause, true, \
"Include GC cause in GC logging")
/* /*
* Macros for factoring of globals * Macros for factoring of globals

View file

@ -206,6 +206,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
return current().compare_major(7) == 0; return current().compare_major(7) == 0;
} }
static bool is_jdk18x_version() {
return current().compare_major(8) == 0;
}
static bool is_gte_jdk13x_version() { static bool is_gte_jdk13x_version() {
return current().compare_major(3) >= 0; return current().compare_major(3) >= 0;
} }
@ -225,6 +229,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
static bool is_gte_jdk17x_version() { static bool is_gte_jdk17x_version() {
return current().compare_major(7) >= 0; return current().compare_major(7) >= 0;
} }
static bool is_gte_jdk18x_version() {
return current().compare_major(8) >= 0;
}
}; };
#endif // SHARE_VM_RUNTIME_JAVA_HPP #endif // SHARE_VM_RUNTIME_JAVA_HPP

View file

@ -492,6 +492,7 @@ class os: AllStatic {
// Print out system information; they are called by fatal error handler. // Print out system information; they are called by fatal error handler.
// Output format may be different on different platforms. // Output format may be different on different platforms.
static void print_os_info(outputStream* st); static void print_os_info(outputStream* st);
static void print_os_info_brief(outputStream* st);
static void print_cpu_info(outputStream* st); static void print_cpu_info(outputStream* st);
static void pd_print_cpu_info(outputStream* st); static void pd_print_cpu_info(outputStream* st);
static void print_memory_info(outputStream* st); static void print_memory_info(outputStream* st);
@ -685,14 +686,17 @@ class os: AllStatic {
// Platform dependent stuff // Platform dependent stuff
#ifdef TARGET_OS_FAMILY_linux #ifdef TARGET_OS_FAMILY_linux
# include "os_linux.hpp" # include "os_linux.hpp"
# include "os_posix.hpp"
#endif #endif
#ifdef TARGET_OS_FAMILY_solaris #ifdef TARGET_OS_FAMILY_solaris
# include "os_solaris.hpp" # include "os_solaris.hpp"
# include "os_posix.hpp"
#endif #endif
#ifdef TARGET_OS_FAMILY_windows #ifdef TARGET_OS_FAMILY_windows
# include "os_windows.hpp" # include "os_windows.hpp"
#endif #endif
#ifdef TARGET_OS_FAMILY_bsd #ifdef TARGET_OS_FAMILY_bsd
# include "os_posix.hpp"
# include "os_bsd.hpp" # include "os_bsd.hpp"
#endif #endif
#ifdef TARGET_OS_ARCH_linux_x86 #ifdef TARGET_OS_ARCH_linux_x86

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -179,6 +179,11 @@ const jlong NANOSECS_PER_SEC = CONST64(1000000000);
const jint NANOSECS_PER_MILLISEC = 1000000; const jint NANOSECS_PER_MILLISEC = 1000000;
inline const char* proper_unit_for_byte_size(size_t s) { inline const char* proper_unit_for_byte_size(size_t s) {
#ifdef _LP64
if (s >= 10*G) {
return "G";
}
#endif
if (s >= 10*M) { if (s >= 10*M) {
return "M"; return "M";
} else if (s >= 10*K) { } else if (s >= 10*K) {
@ -188,17 +193,22 @@ inline const char* proper_unit_for_byte_size(size_t s) {
} }
} }
inline size_t byte_size_in_proper_unit(size_t s) { template <class T>
inline T byte_size_in_proper_unit(T s) {
#ifdef _LP64
if (s >= 10*G) {
return (T)(s/G);
}
#endif
if (s >= 10*M) { if (s >= 10*M) {
return s/M; return (T)(s/M);
} else if (s >= 10*K) { } else if (s >= 10*K) {
return s/K; return (T)(s/K);
} else { } else {
return s; return s;
} }
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// VM type definitions // VM type definitions

View file

@ -18,8 +18,6 @@ then
exit 1 exit 1
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -27,12 +25,6 @@ case "$OS" in
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
fi
;; ;;
Windows_* ) Windows_* )
NULL=NUL NULL=NUL
@ -50,9 +42,9 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
THIS_DIR=`pwd` THIS_DIR=`pwd`
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -server IsInstanceTest > test.out 2>&1 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} IsInstanceTest > test.out 2>&1
cat test.out cat test.out

View file

@ -30,7 +30,7 @@ then
exit 0 exit 0
fi fi
$JAVA_HOME/bin/java -version > $NULL 2>&1 $JAVA_HOME/bin/java ${TESTVMOPTS} -version > $NULL 2>&1
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Wrong JAVA_HOME? JAVA_HOME: $JAVA_HOME" echo "Wrong JAVA_HOME? JAVA_HOME: $JAVA_HOME"
@ -119,7 +119,7 @@ fi
options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=$gclogsize" options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=$gclogsize"
echo "Test gc log rotation in same file, wait for $tts minutes ...." echo "Test gc log rotation in same file, wait for $tts minutes ...."
$JAVA_HOME/bin/java $options $testname $tts $JAVA_HOME/bin/java ${TESTVMOPTS} $options $testname $tts
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "$msgfail" echo "$msgfail"
exit -1 exit -1
@ -148,7 +148,7 @@ fi
numoffiles=3 numoffiles=3
options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=$numoffiles -XX:GCLogFileSize=$gclogsize" options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=$numoffiles -XX:GCLogFileSize=$gclogsize"
echo "Test gc log rotation in $numoffiles files, wait for $tts minutes ...." echo "Test gc log rotation in $numoffiles files, wait for $tts minutes ...."
$JAVA_HOME/bin/java $options $testname $tts $JAVA_HOME/bin/java ${TESTVMOPTS} $options $testname $tts
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "$msgfail" echo "$msgfail"
exit -1 exit -1

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -46,8 +46,6 @@ then
exit 1 exit 1
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -58,12 +56,6 @@ case "$OS" in
RM=/bin/rm RM=/bin/rm
CP=/bin/cp CP=/bin/cp
MV=/bin/mv MV=/bin/mv
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
fi
;; ;;
Windows_* ) Windows_* )
NULL=NUL NULL=NUL
@ -87,7 +79,7 @@ THIS_DIR=`pwd`
JAVA=${TESTJAVA}${FS}bin${FS}java JAVA=${TESTJAVA}${FS}bin${FS}java
JAVAC=${TESTJAVA}${FS}bin${FS}javac JAVAC=${TESTJAVA}${FS}bin${FS}javac
${JAVA} ${BIT_FLAG} -version ${JAVA} ${TESTVMOPTS} -version
# Current directory is scratch directory, copy all the test source there # Current directory is scratch directory, copy all the test source there
# (for the subsequent moves to work). # (for the subsequent moves to work).
@ -113,7 +105,7 @@ ${MV} many_loader.class many_loader.impl2
${MV} many_loader.impl1 many_loader.class ${MV} many_loader.impl1 many_loader.class
${RM} many_loader.java ${RM} many_loader.java
${JAVA} ${BIT_FLAG} -Xverify -Xint -cp . bug_21227 >test.out 2>&1 ${JAVA} ${TESTVMOPTS} -Xverify -Xint -cp . bug_21227 >test.out 2>&1
grep "loader constraint" test.out grep "loader constraint" test.out
exit $? exit $?

View file

@ -25,8 +25,6 @@ then
exit 1 exit 1
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -34,12 +32,6 @@ case "$OS" in
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
fi
;; ;;
Windows_* ) Windows_* )
NULL=NUL NULL=NUL
@ -57,11 +49,11 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
THIS_DIR=`pwd` THIS_DIR=`pwd`
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass1960_2 > test.out 2>&1 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass1960_2 > test.out 2>&1
if [ -s core -o -s "hs_*.log" ] if [ -s core -o -s "hs_*.log" ]
then then

View file

@ -19,8 +19,6 @@ then
echo "If this is incorrect, try setting the variable manually." echo "If this is incorrect, try setting the variable manually."
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -42,7 +40,19 @@ case "$OS" in
;; ;;
esac esac
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/i386/client:/usr/openwin/lib:/usr/dt/lib:/usr/lib:$LD_LIBRARY_PATH # Choose arch: i386 or amd64 (test is Linux-specific)
# Cannot simply look at TESTVMOPTS as -d64 is not
# passed if there is only a 64-bit JVM available.
${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>1 | grep "64-Bit" >/dev/null
if [ "$?" = "0" ]
then
ARCH=amd64
else
ARCH=i386
fi
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${ARCH}/client:/usr/openwin/lib:/usr/dt/lib:/usr/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH export LD_LIBRARY_PATH
THIS_DIR=`pwd` THIS_DIR=`pwd`
@ -51,10 +61,10 @@ cp ${TESTSRC}${FS}invoke.c ${THIS_DIR}
cp ${TESTSRC}${FS}T.java ${THIS_DIR} cp ${TESTSRC}${FS}T.java ${THIS_DIR}
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
${TESTJAVA}${FS}bin${FS}javac T.java ${TESTJAVA}${FS}bin${FS}javac T.java
gcc -o invoke -I${TESTJAVA}/include -I${TESTJAVA}/include/linux invoke.c ${TESTJAVA}/jre/lib/i386/client/libjvm.so gcc -o invoke -I${TESTJAVA}/include -I${TESTJAVA}/include/linux invoke.c ${TESTJAVA}/jre/lib/${ARCH}/client/libjvm.so
./invoke ./invoke
exit $? exit $?

View file

@ -27,8 +27,6 @@ then
exit 1 exit 1
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -36,12 +34,6 @@ case "$OS" in
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
fi
;; ;;
Windows_* ) Windows_* )
NULL=NUL NULL=NUL
@ -59,11 +51,11 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
THIS_DIR=`pwd` THIS_DIR=`pwd`
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass4000_1 > test.out 2>&1 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass4000_1 > test.out 2>&1
cat test.out cat test.out

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -41,18 +41,10 @@ then
fi fi
BIT_FLAG=""
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux )
FS="/" FS="/"
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
then
BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
fi
;; ;;
Windows_* ) Windows_* )
printf "Not testing libjsig.so on Windows. PASSED.\n " printf "Not testing libjsig.so on Windows. PASSED.\n "
@ -69,20 +61,16 @@ JAVA=${TESTJAVA}${FS}bin${FS}java
# LD_PRELOAD arch needs to match the binary we run, so run the java # LD_PRELOAD arch needs to match the binary we run, so run the java
# 64-bit binary directly if we are testing 64-bit (bin/ARCH/java). # 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
# Check if TESTVMOPS contains -d64, but cannot use
# However JPRT runs: .../solaris_x64_5.10-debug/bin/java # java ${TESTVMOPS} to run "java -d64" with LD_PRELOAD.
# ..which is 32-bit, when it has built the 64-bit version to test.
#
# How does this script know we are meant to run the 64-bit version?
# Can check for the path of the binary containing "x64" on Solaris.
if [ ${OS} -eq "SunOS" ] if [ ${OS} -eq "SunOS" ]
then then
printf "SunOS test JAVA=${JAVA}" printf "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
printf ${JAVA} | grep x64 > /dev/null printf ${TESTVMOPTS} | grep d64 > /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
printf "SunOS x64 test, forcing -d64\n" printf "SunOS 64-bit test\n"
BIT_FLAG=-d64 BIT_FLAG=-d64
fi fi
fi fi
@ -127,20 +115,19 @@ then
printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n" printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
exit 0 exit 0
fi fi
# Use java -version to test, java version info appeas on stderr, # Use java -version to test, java version info appears on stderr,
# the libjsig message we are removing appears on stdout. # the libjsig message we are removing appears on stdout.
# grep returns zero meaning found, non-zero means not found: # grep returns zero meaning found, non-zero means not found:
LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -version 2>&1 | grep "libjsig is activated" LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1 | grep "libjsig is activated"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n" printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
exit 1 exit 1
fi fi
LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated" LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
if [ $? != 0 ]; then if [ $? != 0 ]; then
printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n" printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
exit 1 exit 1

View file

@ -18,8 +18,6 @@ then
exit 1 exit 1
fi fi
BIT_FLAG=""
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
@ -27,12 +25,6 @@ case "$OS" in
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
## for solaris, linux it's HOME
FILE_LOCATION=$HOME
if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" -a `uname -p`='sparc' ]
then
BIT_FLAG="-d64"
fi
;; ;;
Windows_95 | Windows_98 | Windows_ME ) Windows_95 | Windows_98 | Windows_ME )
NULL=NUL NULL=NUL
@ -56,11 +48,11 @@ esac
cp ${TESTSRC}${FS}*.java . cp ${TESTSRC}${FS}*.java .
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -fullversion ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java ${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java
${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 & ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 &
P_PID=$! P_PID=$!

View file

@ -160,3 +160,5 @@ e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35
cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36
90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37
5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38
f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39
9ecfdbd6aed4702674eaede2023b4a19513d6b36 jdk8-b40

View file

@ -160,3 +160,5 @@ e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35
89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36 89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36
b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37
ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38
7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39
09a0ddda03cb36deb6ee9edf789da12aa4674c6b jdk8-b40

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