提交 8a4ec7fd 编写于 作者: N never

Merge

^build/ ^build/
^dist/ ^dist/
^nbproject/private/ ^nbproject/private/
^src/share/tools/hsdis/bin/ ^src/share/tools/hsdis/build/
^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/ ^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
^src/share/tools/IdealGraphVisualizer/build/ ^src/share/tools/IdealGraphVisualizer/build/
^src/share/tools/IdealGraphVisualizer/dist/ ^src/share/tools/IdealGraphVisualizer/dist/
...@@ -46,7 +46,7 @@ C_COMPILER_REV := \ ...@@ -46,7 +46,7 @@ C_COMPILER_REV := \
$(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') $(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p')
# Pick which compiler is validated # Pick which compiler is validated
ifeq ($(JDK_MINOR_VERSION),6) ifeq ($(JRE_RELEASE_VER),1.6.0)
# Validated compiler for JDK6 is SS11 (5.8) # Validated compiler for JDK6 is SS11 (5.8)
VALIDATED_COMPILER_REV := 5.8 VALIDATED_COMPILER_REV := 5.8
VALIDATED_C_COMPILER_REV := 5.8 VALIDATED_C_COMPILER_REV := 5.8
...@@ -101,18 +101,9 @@ CFLAGS += ${SOLARIS_7_OR_LATER} ...@@ -101,18 +101,9 @@ CFLAGS += ${SOLARIS_7_OR_LATER}
# New architecture options started in SS12 (5.9), we need both styles to build. # New architecture options started in SS12 (5.9), we need both styles to build.
# The older arch options for SS11 (5.8) or older and also for /usr/ccs/bin/as. # The older arch options for SS11 (5.8) or older and also for /usr/ccs/bin/as.
# Note: SS12 default for 32bit sparc is now the same as v8plus, so the # Note: default for 32bit sparc is now the same as v8plus, so the
# settings below have changed all SS12 32bit sparc builds to be v8plus. # settings below have changed all 32bit sparc builds to be v8plus.
# The older SS11 (5.8) settings have remained as they always have been. ARCHFLAG_OLD/sparc = -xarch=v8plus
ifeq ($(TYPE),COMPILER2)
ARCHFLAG_OLD/sparc = -xarch=v8plus
else
ifeq ($(TYPE),TIERED)
ARCHFLAG_OLD/sparc = -xarch=v8plus
else
ARCHFLAG_OLD/sparc = -xarch=v8
endif
endif
ARCHFLAG_NEW/sparc = -m32 -xarch=sparc ARCHFLAG_NEW/sparc = -m32 -xarch=sparc
ARCHFLAG_OLD/sparcv9 = -xarch=v9 ARCHFLAG_OLD/sparcv9 = -xarch=v9
ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc
......
...@@ -55,10 +55,16 @@ CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER2" ...@@ -55,10 +55,16 @@ CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER2"
CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER1" /D "COMPILER2" CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER1" /D "COMPILER2"
!endif !endif
!if "$(BUILDARCH)" == "i486"
HOTSPOT_LIB_ARCH=i386
!else
HOTSPOT_LIB_ARCH=$(BUILDARCH)
!endif
# The following variables are defined in the generated local.make file. # The following variables are defined in the generated local.make file.
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\"" CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\""
CPP_FLAGS=$(CPP_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\"" CPP_FLAGS=$(CPP_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(BUILDARCH)\"" CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\"" CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\"" CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\"" CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
......
...@@ -39,7 +39,7 @@ define_pd_global(uintx, JVMInvokeMethodSlack, 8*K); ...@@ -39,7 +39,7 @@ define_pd_global(uintx, JVMInvokeMethodSlack, 8*K);
// ThreadStackSize 320 allows TaggedStackInterpreter and a couple of test cases // ThreadStackSize 320 allows TaggedStackInterpreter and a couple of test cases
// to run while keeping the number of threads that can be created high. // to run while keeping the number of threads that can be created high.
define_pd_global(intx, ThreadStackSize, 320); define_pd_global(intx, ThreadStackSize, 320);
define_pd_global(intx, VMThreadStackSize, 256); define_pd_global(intx, VMThreadStackSize, 512);
define_pd_global(intx, SurvivorRatio, 8); define_pd_global(intx, SurvivorRatio, 8);
define_pd_global(uintx, JVMInvokeMethodSlack, 10*K); define_pd_global(uintx, JVMInvokeMethodSlack, 10*K);
#endif // AMD64 #endif // AMD64
......
...@@ -247,7 +247,7 @@ class BuildConfig { ...@@ -247,7 +247,7 @@ class BuildConfig {
sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name")); sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\""); sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
sysDefines.add("_JNI_IMPLEMENTATION_"); sysDefines.add("_JNI_IMPLEMENTATION_");
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i486\\\""); sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
sysDefines.addAll(defines); sysDefines.addAll(defines);
......
...@@ -22,61 +22,75 @@ ...@@ -22,61 +22,75 @@
# #
# #
# Single gnu makefile for solaris, linux and windows (windows requires mks or # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
# cygwin).
ifeq ($(BINUTILS),)
# Pop all the way out of the workspace to look for binutils.
# ...You probably want to override this setting.
BINUTILS = $(shell cd ../../../../..;pwd)/binutils-2.17-$(LIBARCH)
endif
# Default arch; it is changed below as needed. # Default arch; it is changed below as needed.
ARCH = i386 ARCH = i386
OS = $(shell uname) OS = $(shell uname)
CPPFLAGS += -I$(BINUTILS)/include -I$(BINUTILS)/bfd
CPPFLAGS += -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -DLIBARCH_$(LIBARCH)
CPPFLAGS += -DHOTSPOT_OS=\"$(OS)\" -DOS_$(OS)
## OS = SunOS ## ## OS = SunOS ##
ifeq ($(OS),SunOS) ifeq ($(OS),SunOS)
ARCH = $(shell uname -p) CPU = $(shell uname -p)
ARCH1=$(CPU:i586=i386)
ARCH=$(ARCH1:i686=i386)
OS = solaris OS = solaris
CC = cc CC = cc
CCFLAGS += -Kpic -g CFLAGS += -KPIC
CCFLAGS/amd64 += -xarch=amd64 ifdef LP64
CCFLAGS/sparcv9 += -xarch=v9 ifeq ($(ARCH),sparc)
CCFLAGS += $(CCFLAGS/$(LIBARCH)) ARCH = sparcv9
endif
ifeq ($(ARCH),i386)
ARCH = amd64
endif
endif
CFLAGS/sparcv9 += -xarch=v9
CFLAGS/amd64 += -m64
CFLAGS += $(CFLAGS/$(ARCH))
DLDFLAGS += -G DLDFLAGS += -G
LDFLAGS += -ldl
OUTFLAGS += -o $@ OUTFLAGS += -o $@
LIB_EXT = .so LIB_EXT = .so
else else
## OS = Linux ## ## OS = Linux ##
ifeq ($(OS),Linux) ifeq ($(OS),Linux)
CPU = $(shell uname -m) ifneq ($(MINGW),)
ifeq ($(CPU),ia64) LIB_EXT = .dll
ARCH = ia64 CPPFLAGS += -I$(TARGET_DIR)/include
LDFLAGS += -L$(TARGET_DIR)/lib
OS=windows
ifneq ($(findstring x86_64-,$(MINGW)),)
ARCH=amd64
else
ARCH=i386
endif
CC = $(MINGW)-gcc
CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
else else
ifeq ($(CPU),x86_64) CPU = $(shell uname -m)
CCFLAGS += -fPIC ARCH1=$(CPU:x86_64=amd64)
endif # x86_64 ARCH=$(ARCH1:i686=i386)
endif # ia64 CFLAGS/i386 += -m32
CFLAGS/sparc += -m32
CFLAGS/sparcv9 += -m64
CFLAGS/amd64 += -m64
CFLAGS += $(CFLAGS/$(ARCH))
CFLAGS += -fPIC
OS = linux OS = linux
LIB_EXT = .so
CC = gcc CC = gcc
CCFLAGS += -O endif
CFLAGS += -O
DLDFLAGS += -shared DLDFLAGS += -shared
LDFLAGS += -ldl
OUTFLAGS += -o $@ OUTFLAGS += -o $@
LIB_EXT = .so
CPPFLAGS += -Iinclude -Iinclude/$(OS)_$(ARCH)/
## OS = Windows ## ## OS = Windows ##
else # !SunOS, !Linux => Windows else # !SunOS, !Linux => Windows
OS = win OS = windows
CC = cl CC = gcc
#CPPFLAGS += /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG" #CPPFLAGS += /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG"
CCFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi- CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
CCFLAGS += -Iinclude -Iinclude/gnu -Iinclude/$(OS)_$(ARCH) CFLAGS += LIBARCH=\"$(LIBARCH)\""
CCFLAGS += /D"HOTSPOT_LIB_ARCH=\"$(LIBARCH)\""
DLDFLAGS += /dll /subsystem:windows /incremental:no \ DLDFLAGS += /dll /subsystem:windows /incremental:no \
/export:decode_instruction /export:decode_instruction
OUTFLAGS += /link /out:$@ OUTFLAGS += /link /out:$@
...@@ -94,21 +108,34 @@ LIBARCH = $(LIBARCH64) ...@@ -94,21 +108,34 @@ LIBARCH = $(LIBARCH64)
endif # LIBARCH64/$(ARCH) endif # LIBARCH64/$(ARCH)
endif # LP64 endif # LP64
TARGET_DIR = bin/$(OS) JDKARCH=$(LIBARCH:i386=i586)
ifeq ($(BINUTILS),)
# Pop all the way out of the workspace to look for binutils.
# ...You probably want to override this setting.
BINUTILSDIR = $(shell cd build/binutils;pwd)
else
BINUTILSDIR = $(shell cd $(BINUTILS);pwd)
endif
CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd
CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
TARGET_DIR = build/$(OS)-$(JDKARCH)
TARGET = $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT) TARGET = $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
SOURCE = hsdis.c SOURCE = hsdis.c
LIBRARIES = $(BINUTILS)/bfd/libbfd.a \ LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
$(BINUTILS)/opcodes/libopcodes.a \ $(TARGET_DIR)/opcodes/libopcodes.a \
$(BINUTILS)/libiberty/libiberty.a $(TARGET_DIR)/libiberty/libiberty.a
DEMO_TARGET = $(TARGET_DIR)/hsdis-demo-$(LIBARCH) DEMO_TARGET = $(TARGET_DIR)/hsdis-demo
DEMO_SOURCE = hsdis-demo.c DEMO_SOURCE = hsdis-demo.c
.PHONY: all clean demo both .PHONY: all clean demo both
all: $(TARGET) demo all: $(TARGET)
both: all all64 both: all all64
...@@ -117,16 +144,17 @@ both: all all64 ...@@ -117,16 +144,17 @@ both: all all64
demo: $(TARGET) $(DEMO_TARGET) demo: $(TARGET) $(DEMO_TARGET)
$(LIBRARIES): $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
@echo "*** Please build binutils first; see ./README: ***" if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
@sed < ./README '1,/__________/d' | head -20
@echo "..."; exit 1 $(TARGET_DIR)/Makefile:
(cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR) $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
$(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR) $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(DEMO_SOURCE) $(LDFLAGS) $(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
$(TARGET_DIR): $(TARGET_DIR):
[ -d $@ ] || mkdir -p $@ [ -d $@ ] || mkdir -p $@
......
...@@ -32,61 +32,55 @@ you do not have a version that is new enough. ...@@ -32,61 +32,55 @@ you do not have a version that is new enough.
* Building * Building
To build this project you need a build of Gnu binutils to link against. To build this project you a copy of GNU binutils to build against. It
It is known to work with binutils 2.17. is known to work with binutils 2.17 and binutils 2.19.1. Download a
copy of the software from http://directory.fsf.org/project/binutils or
The makefile looks for this build in $BINUTILS, or (if that is not set), one of it's mirrors. Builds targetting windows should use at least
in .../binutils-2.17-$LIBARCH, where LIBARCH (as in HotSpot) is one of 2.19 and currently requires the use of a cross compiler.
the jre subdirectory keywords i386, amd64, sparc, sparcv9, etc.
The makefile looks for the sources in build/binutils or you can
To build Gnu binutils, first download a copy of the software: specify it's location to the makefile using BINTUILS=path. It will
http://directory.fsf.org/project/binutils/ configure binutils and build it first and then build and link the
disasembly adapter. Make all will build the default target for your
Unpack the binutils tarball into an empty directory: platform. If you platform support both 32 and 64 simultaneously then
chdir ../../../../.. "make both" will build them both at once. "make all64" will
tar -xzf - < ../binutils-2.17.tar.gz explicitly build the 64 bit version. By default this will build the
mv binutils-2.17 binutils-2.17-i386 #or binutils-2.17-sparc disassembler library only. If you build demo it will build a demo
cd binutils-2.17-i386 program that attempts to exercise the library.
From inside that directory, run configure and make: Windows
( export CFLAGS='-fPIC'
./configure i386-pc-elf ) In theory this should be buildable on Windows but getting a working
gnumake GNU build environment on Windows has proven difficult. MINGW should
be able to do it but at the time of this writing I was unable to get
(Leave out or change the argument to configure if not on an i386 system.) this working. Instead you can use the mingw cross compiler on linux
to produce the windows binaries. For 32-bit windows you can install
Next, untar again into another empty directory for the LP64 version: mingw32 using your package manager and it will be added to your path
chdir .. automatically. For 64-bit you need to download the 64 bit mingw from
tar -xzf - < ../binutils-2.17.tar.gz http://sourceforge.net/projects/mingw-w64. Grab a copy of the
mv binutils-2.17 binutils-2.17-amd64 #or binutils-2.17-sparcv9 complete toolchain and unpack it somewhere. Put the bin directory of
cd binutils-2.17-amd64 the toolchain in your path. The mingw installs contain cross compile
versions of gcc that are named with a prefix to indicate what they are
From inside that directory, run configure for LP64 and make: targetting and you must tell the Makefile which one to use. This
( export ac_cv_c_bigendian=no CFLAGS='-m64 -fPIC' LDFLAGS=-m64 should either be i586-mingw32msvc or x86_64-pc-mingw32 depending on
./configure amd64-pc-elf ) which on you are targetting and there should be a version of gcc in
gnumake your path named i586-mingw32msvc-gcc or x86_64-pc-mingw32-gcc. Tell
the makefile what prefix to use to find the mingw tools by using
The -fPIC option is needed because the generated code will be MINGW=. For example:
linked into the hsdid-$LIBARCH.so binary. If you miss the
option, the JVM will fail to load the disassembler. make MINGW=i586-mingw32msvc BINTUILS=build/binutils-2.19.1
You probably want two builds, one for 32 and one for 64 bits. will build the Win32 cross compiled version of hsdis based on 2.19.1.
To build the 64-bit variation of a platforn, add LP64=1 to
the make command line for hsdis.
So, go back to the hsdis project and build:
chdir .../hsdis
gnumake
gnumake LP64=1
* Installing * Installing
Products are named like bin/$OS/hsdis-$LIBARCH.so. Products are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You can
You can install them on your LD_LIBRARY_PATH, install them on your LD_LIBRARY_PATH, or inside of your JRE next to
or inside of your JRE next to $LIBARCH/libjvm.so. $LIBARCH/libjvm.so.
Now test: Now test:
export LD_LIBRARY_PATH .../hsdis/bin/solaris:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH .../hsdis/build/$OS-$LIBARCH:$LD_LIBRARY_PATH
dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly' dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly'
dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes' dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes'
java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld
......
...@@ -53,7 +53,7 @@ int main(int ac, char** av) { ...@@ -53,7 +53,7 @@ int main(int ac, char** av) {
else if (!strncmp(arg, "-options=", 9)) else if (!strncmp(arg, "-options=", 9))
options = arg+9; options = arg+9;
else else
{ printf("Usage: %s [-xml] [name...]\n"); exit(2); } { printf("Usage: %s [-xml] [name...]\n", av[0]); exit(2); }
continue; continue;
} }
greet(arg); greet(arg);
...@@ -76,26 +76,14 @@ void end_of_file() { } ...@@ -76,26 +76,14 @@ void end_of_file() { }
#include "dlfcn.h" #include "dlfcn.h"
#ifdef HOTSPOT_LIB_ARCH
#define LIBARCH HOTSPOT_LIB_ARCH
#endif
#ifdef HOTSPOT_OS
#define OS HOTSPOT_OS
#endif
#define DECODE_INSTRUCTIONS_NAME "decode_instructions" #define DECODE_INSTRUCTIONS_NAME "decode_instructions"
#define HSDIS_NAME "hsdis" #define HSDIS_NAME "hsdis"
static void* decode_instructions_pv = 0; static void* decode_instructions_pv = 0;
static const char* hsdis_path[] = { static const char* hsdis_path[] = {
HSDIS_NAME".so", HSDIS_NAME"-"LIBARCH LIB_EXT,
#ifdef OS "./" HSDIS_NAME"-"LIBARCH LIB_EXT,
"bin/"OS"/"HSDIS_NAME".so", #ifdef TARGET_DIR
#endif TARGET_DIR"/"HSDIS_NAME"-"LIBARCH LIB_EXT,
#ifdef LIBARCH
HSDIS_NAME"-"LIBARCH".so",
#ifdef OS
"bin/"OS"/"HSDIS_NAME"-"LIBARCH".so",
#endif
#endif #endif
NULL NULL
}; };
...@@ -112,7 +100,7 @@ static const char* load_decode_instructions() { ...@@ -112,7 +100,7 @@ static const char* load_decode_instructions() {
for (dllib = NULL; dllib == NULL; ) { for (dllib = NULL; dllib == NULL; ) {
const char* next_lib = (*next_in_path++); const char* next_lib = (*next_in_path++);
if (next_lib == NULL) if (next_lib == NULL)
return "cannot find plugin "HSDIS_NAME".so"; return "cannot find plugin "HSDIS_NAME LIB_EXT;
dllib = dlopen(next_lib, RTLD_LAZY); dllib = dlopen(next_lib, RTLD_LAZY);
} }
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <libiberty.h> #include <libiberty.h>
#include <bfd.h> #include <bfd.h>
#include <dis-asm.h> #include <dis-asm.h>
#include <inttypes.h>
#ifndef bool #ifndef bool
#define bool int #define bool int
...@@ -404,21 +405,21 @@ static const bfd_arch_info_type* find_arch_info(const char* arch_name) { ...@@ -404,21 +405,21 @@ static const bfd_arch_info_type* find_arch_info(const char* arch_name) {
} }
static const char* native_arch_name() { static const char* native_arch_name() {
const char* res = HOTSPOT_LIB_ARCH; const char* res = NULL;
#ifdef LIBARCH_i386
res = "i386";
#endif
#ifdef LIBARCH_amd64 #ifdef LIBARCH_amd64
res = "i386:x86-64"; res = "i386:x86-64";
#endif #endif
#ifdef LIBARCH_sparc #ifdef LIBARCH_sparc
res = "sparc:v8plusb"; res = "sparc:v8plusb";
#endif #endif
#ifdef LIBARCH_sparc
res = "sparc:v8plusb";
#endif
#ifdef LIBARCH_sparcv9 #ifdef LIBARCH_sparcv9
res = "sparc:v9b"; res = "sparc:v9b";
#endif #endif
if (res == NULL) if (res == NULL)
res = "HOTSPOT_LIB_ARCH is not set in Makefile!"; res = "architecture not set in Makefile!";
return res; return res;
} }
......
...@@ -2956,9 +2956,11 @@ void LinearScan::do_linear_scan() { ...@@ -2956,9 +2956,11 @@ void LinearScan::do_linear_scan() {
NOT_PRODUCT(print_intervals("After Register Allocation")); NOT_PRODUCT(print_intervals("After Register Allocation"));
NOT_PRODUCT(print_lir(2, "LIR after register allocation:")); NOT_PRODUCT(print_lir(2, "LIR after register allocation:"));
DEBUG_ONLY(verify());
sort_intervals_after_allocation(); sort_intervals_after_allocation();
DEBUG_ONLY(verify());
eliminate_spill_moves(); eliminate_spill_moves();
assign_reg_num(); assign_reg_num();
CHECK_BAILOUT(); CHECK_BAILOUT();
...@@ -3147,6 +3149,16 @@ void LinearScan::verify_intervals() { ...@@ -3147,6 +3149,16 @@ void LinearScan::verify_intervals() {
void LinearScan::verify_no_oops_in_fixed_intervals() { void LinearScan::verify_no_oops_in_fixed_intervals() {
Interval* fixed_intervals;
Interval* other_intervals;
create_unhandled_lists(&fixed_intervals, &other_intervals, is_precolored_cpu_interval, NULL);
// to ensure a walking until the last instruction id, add a dummy interval
// with a high operation id
other_intervals = new Interval(any_reg);
other_intervals->add_range(max_jint - 2, max_jint - 1);
IntervalWalker* iw = new IntervalWalker(this, fixed_intervals, other_intervals);
LIR_OpVisitState visitor; LIR_OpVisitState visitor;
for (int i = 0; i < block_count(); i++) { for (int i = 0; i < block_count(); i++) {
BlockBegin* block = block_at(i); BlockBegin* block = block_at(i);
...@@ -3159,6 +3171,54 @@ void LinearScan::verify_no_oops_in_fixed_intervals() { ...@@ -3159,6 +3171,54 @@ void LinearScan::verify_no_oops_in_fixed_intervals() {
visitor.visit(op); visitor.visit(op);
if (visitor.info_count() > 0) {
iw->walk_before(op->id());
bool check_live = true;
if (op->code() == lir_move) {
LIR_Op1* move = (LIR_Op1*)op;
check_live = (move->patch_code() == lir_patch_none);
}
LIR_OpBranch* branch = op->as_OpBranch();
if (branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) {
// Don't bother checking the stub in this case since the
// exception stub will never return to normal control flow.
check_live = false;
}
// Make sure none of the fixed registers is live across an
// oopmap since we can't handle that correctly.
if (check_live) {
for (Interval* interval = iw->active_first(fixedKind);
interval != Interval::end();
interval = interval->next()) {
if (interval->current_to() > op->id() + 1) {
// This interval is live out of this op so make sure
// that this interval represents some value that's
// referenced by this op either as an input or output.
bool ok = false;
for_each_visitor_mode(mode) {
int n = visitor.opr_count(mode);
for (int k = 0; k < n; k++) {
LIR_Opr opr = visitor.opr_at(mode, k);
if (opr->is_fixed_cpu()) {
if (interval_at(reg_num(opr)) == interval) {
ok = true;
break;
}
int hi = reg_numHi(opr);
if (hi != -1 && interval_at(hi) == interval) {
ok = true;
break;
}
}
}
}
assert(ok, "fixed intervals should never be live across an oopmap point");
}
}
}
}
// oop-maps at calls do not contain registers, so check is not needed // oop-maps at calls do not contain registers, so check is not needed
if (!visitor.has_call()) { if (!visitor.has_call()) {
......
...@@ -1217,31 +1217,34 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1217,31 +1217,34 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
// valid class file. The class loader will check everything else. // valid class file. The class loader will check everything else.
if (strchr(buffer, '.') == NULL) { if (strchr(buffer, '.') == NULL) {
_compile_the_world_counter++; _compile_the_world_counter++;
if (_compile_the_world_counter >= CompileTheWorldStartAt && _compile_the_world_counter <= CompileTheWorldStopAt) { if (_compile_the_world_counter > CompileTheWorldStopAt) return;
// Construct name without extension
symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK); // Construct name without extension
// Use loader to load and initialize class symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK);
klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD); // Use loader to load and initialize class
instanceKlassHandle k (THREAD, ik); klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
if (k.not_null() && !HAS_PENDING_EXCEPTION) { instanceKlassHandle k (THREAD, ik);
k->initialize(THREAD); if (k.not_null() && !HAS_PENDING_EXCEPTION) {
k->initialize(THREAD);
}
bool exception_occurred = HAS_PENDING_EXCEPTION;
CLEAR_PENDING_EXCEPTION;
if (CompileTheWorldPreloadClasses && k.not_null()) {
constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
if (HAS_PENDING_EXCEPTION) {
// If something went wrong in preloading we just ignore it
CLEAR_PENDING_EXCEPTION;
tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
} }
bool exception_occurred = HAS_PENDING_EXCEPTION; }
CLEAR_PENDING_EXCEPTION;
if (_compile_the_world_counter >= CompileTheWorldStartAt) {
if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) { if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) {
// If something went wrong (e.g. ExceptionInInitializerError) we skip this class // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer); tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
} else { } else {
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer); tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
// Preload all classes to get around uncommon traps // Preload all classes to get around uncommon traps
if (CompileTheWorldPreloadClasses) {
constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
if (HAS_PENDING_EXCEPTION) {
// If something went wrong in preloading we just ignore it
CLEAR_PENDING_EXCEPTION;
tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
}
}
// Iterate over all methods in class // Iterate over all methods in class
for (int n = 0; n < k->methods()->length(); n++) { for (int n = 0; n < k->methods()->length(); n++) {
methodHandle m (THREAD, methodOop(k->methods()->obj_at(n))); methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
...@@ -1253,16 +1256,28 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1253,16 +1256,28 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
} }
if (TieredCompilation) { if (TieredCompilation) {
// Clobber the first compile and force second tier compilation // Clobber the first compile and force second tier compilation
m->clear_code(); nmethod* nm = m->code();
CompileBroker::compile_method(m, InvocationEntryBci, if (nm != NULL) {
methodHandle(), 0, "CTW", THREAD); // Throw out the code so that the code cache doesn't fill up
if (HAS_PENDING_EXCEPTION) { nm->make_not_entrant();
CLEAR_PENDING_EXCEPTION; m->clear_code();
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); }
CompileBroker::compile_method(m, InvocationEntryBci,
methodHandle(), 0, "CTW", THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
}
} }
} }
nmethod* nm = m->code();
if (nm != NULL) {
// Throw out the code so that the code cache doesn't fill up
nm->make_not_entrant();
m->clear_code();
} }
} }
} }
......
...@@ -270,6 +270,7 @@ c1_LIRGenerator_<arch>.cpp vmreg_<arch>.inline.hpp ...@@ -270,6 +270,7 @@ c1_LIRGenerator_<arch>.cpp vmreg_<arch>.inline.hpp
c1_LinearScan.cpp bitMap.inline.hpp c1_LinearScan.cpp bitMap.inline.hpp
c1_LinearScan.cpp c1_CFGPrinter.hpp c1_LinearScan.cpp c1_CFGPrinter.hpp
c1_LinearScan.cpp c1_CodeStubs.hpp
c1_LinearScan.cpp c1_Compilation.hpp c1_LinearScan.cpp c1_Compilation.hpp
c1_LinearScan.cpp c1_FrameMap.hpp c1_LinearScan.cpp c1_FrameMap.hpp
c1_LinearScan.cpp c1_IR.hpp c1_LinearScan.cpp c1_IR.hpp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册