Merge
This commit is contained in:
commit
fd05c28901
@ -1,7 +1,7 @@
|
||||
^build/
|
||||
^dist/
|
||||
^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/build/
|
||||
^src/share/tools/IdealGraphVisualizer/dist/
|
||||
|
@ -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')
|
||||
|
||||
# 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_REV := 5.8
|
||||
VALIDATED_C_COMPILER_REV := 5.8
|
||||
@ -101,18 +101,9 @@ CFLAGS += ${SOLARIS_7_OR_LATER}
|
||||
|
||||
# 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.
|
||||
# Note: SS12 default for 32bit sparc is now the same as v8plus, so the
|
||||
# settings below have changed all SS12 32bit sparc builds to be v8plus.
|
||||
# The older SS11 (5.8) settings have remained as they always have been.
|
||||
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
|
||||
# Note: default for 32bit sparc is now the same as v8plus, so the
|
||||
# settings below have changed all 32bit sparc builds to be v8plus.
|
||||
ARCHFLAG_OLD/sparc = -xarch=v8plus
|
||||
ARCHFLAG_NEW/sparc = -m32 -xarch=sparc
|
||||
ARCHFLAG_OLD/sparcv9 = -xarch=v9
|
||||
ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc
|
||||
|
@ -55,10 +55,16 @@ CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER2"
|
||||
CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER1" /D "COMPILER2"
|
||||
!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.
|
||||
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 "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_USER=\"$(BuildUser)\""
|
||||
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
|
||||
|
@ -39,7 +39,7 @@ define_pd_global(uintx, JVMInvokeMethodSlack, 8*K);
|
||||
// ThreadStackSize 320 allows TaggedStackInterpreter and a couple of test cases
|
||||
// to run while keeping the number of threads that can be created high.
|
||||
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(uintx, JVMInvokeMethodSlack, 10*K);
|
||||
#endif // AMD64
|
||||
|
@ -247,7 +247,7 @@ class BuildConfig {
|
||||
sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
|
||||
sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
|
||||
sysDefines.add("_JNI_IMPLEMENTATION_");
|
||||
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i486\\\"");
|
||||
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
|
||||
|
||||
sysDefines.addAll(defines);
|
||||
|
||||
|
@ -22,61 +22,75 @@
|
||||
#
|
||||
#
|
||||
|
||||
# Single gnu makefile for solaris, linux and windows (windows requires mks or
|
||||
# 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
|
||||
# Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
|
||||
|
||||
# Default arch; it is changed below as needed.
|
||||
ARCH = i386
|
||||
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 ##
|
||||
ifeq ($(OS),SunOS)
|
||||
ARCH = $(shell uname -p)
|
||||
CPU = $(shell uname -p)
|
||||
ARCH1=$(CPU:i586=i386)
|
||||
ARCH=$(ARCH1:i686=i386)
|
||||
OS = solaris
|
||||
CC = cc
|
||||
CCFLAGS += -Kpic -g
|
||||
CCFLAGS/amd64 += -xarch=amd64
|
||||
CCFLAGS/sparcv9 += -xarch=v9
|
||||
CCFLAGS += $(CCFLAGS/$(LIBARCH))
|
||||
CFLAGS += -KPIC
|
||||
ifdef LP64
|
||||
ifeq ($(ARCH),sparc)
|
||||
ARCH = sparcv9
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
ARCH = amd64
|
||||
endif
|
||||
endif
|
||||
CFLAGS/sparcv9 += -xarch=v9
|
||||
CFLAGS/amd64 += -m64
|
||||
CFLAGS += $(CFLAGS/$(ARCH))
|
||||
DLDFLAGS += -G
|
||||
LDFLAGS += -ldl
|
||||
OUTFLAGS += -o $@
|
||||
LIB_EXT = .so
|
||||
else
|
||||
## OS = Linux ##
|
||||
ifeq ($(OS),Linux)
|
||||
CPU = $(shell uname -m)
|
||||
ifeq ($(CPU),ia64)
|
||||
ARCH = ia64
|
||||
ifneq ($(MINGW),)
|
||||
LIB_EXT = .dll
|
||||
CPPFLAGS += -I$(TARGET_DIR)/include
|
||||
LDFLAGS += -L$(TARGET_DIR)/lib
|
||||
OS=windows
|
||||
ifneq ($(findstring x86_64-,$(MINGW)),)
|
||||
ARCH=amd64
|
||||
else
|
||||
ifeq ($(CPU),x86_64)
|
||||
CCFLAGS += -fPIC
|
||||
endif # x86_64
|
||||
endif # ia64
|
||||
ARCH=i386
|
||||
endif
|
||||
CC = $(MINGW)-gcc
|
||||
CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
|
||||
else
|
||||
CPU = $(shell uname -m)
|
||||
ARCH1=$(CPU:x86_64=amd64)
|
||||
ARCH=$(ARCH1:i686=i386)
|
||||
CFLAGS/i386 += -m32
|
||||
CFLAGS/sparc += -m32
|
||||
CFLAGS/sparcv9 += -m64
|
||||
CFLAGS/amd64 += -m64
|
||||
CFLAGS += $(CFLAGS/$(ARCH))
|
||||
CFLAGS += -fPIC
|
||||
OS = linux
|
||||
CC = gcc
|
||||
CCFLAGS += -O
|
||||
DLDFLAGS += -shared
|
||||
OUTFLAGS += -o $@
|
||||
LIB_EXT = .so
|
||||
CPPFLAGS += -Iinclude -Iinclude/$(OS)_$(ARCH)/
|
||||
CC = gcc
|
||||
endif
|
||||
CFLAGS += -O
|
||||
DLDFLAGS += -shared
|
||||
LDFLAGS += -ldl
|
||||
OUTFLAGS += -o $@
|
||||
## OS = Windows ##
|
||||
else # !SunOS, !Linux => Windows
|
||||
OS = win
|
||||
CC = cl
|
||||
OS = windows
|
||||
CC = gcc
|
||||
#CPPFLAGS += /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG"
|
||||
CCFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
|
||||
CCFLAGS += -Iinclude -Iinclude/gnu -Iinclude/$(OS)_$(ARCH)
|
||||
CCFLAGS += /D"HOTSPOT_LIB_ARCH=\"$(LIBARCH)\""
|
||||
CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
|
||||
CFLAGS += LIBARCH=\"$(LIBARCH)\""
|
||||
DLDFLAGS += /dll /subsystem:windows /incremental:no \
|
||||
/export:decode_instruction
|
||||
OUTFLAGS += /link /out:$@
|
||||
@ -94,21 +108,34 @@ LIBARCH = $(LIBARCH64)
|
||||
endif # LIBARCH64/$(ARCH)
|
||||
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)
|
||||
|
||||
SOURCE = hsdis.c
|
||||
|
||||
LIBRARIES = $(BINUTILS)/bfd/libbfd.a \
|
||||
$(BINUTILS)/opcodes/libopcodes.a \
|
||||
$(BINUTILS)/libiberty/libiberty.a
|
||||
LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
|
||||
$(TARGET_DIR)/opcodes/libopcodes.a \
|
||||
$(TARGET_DIR)/libiberty/libiberty.a
|
||||
|
||||
DEMO_TARGET = $(TARGET_DIR)/hsdis-demo-$(LIBARCH)
|
||||
DEMO_TARGET = $(TARGET_DIR)/hsdis-demo
|
||||
DEMO_SOURCE = hsdis-demo.c
|
||||
|
||||
.PHONY: all clean demo both
|
||||
|
||||
all: $(TARGET) demo
|
||||
all: $(TARGET)
|
||||
|
||||
both: all all64
|
||||
|
||||
@ -117,16 +144,17 @@ both: all all64
|
||||
|
||||
demo: $(TARGET) $(DEMO_TARGET)
|
||||
|
||||
$(LIBRARIES):
|
||||
@echo "*** Please build binutils first; see ./README: ***"
|
||||
@sed < ./README '1,/__________/d' | head -20
|
||||
@echo "..."; exit 1
|
||||
$(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
|
||||
if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
|
||||
|
||||
$(TARGET_DIR)/Makefile:
|
||||
(cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
|
||||
|
||||
$(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)
|
||||
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(DEMO_SOURCE) $(LDFLAGS)
|
||||
$(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
|
||||
|
||||
$(TARGET_DIR):
|
||||
[ -d $@ ] || mkdir -p $@
|
||||
|
@ -32,61 +32,55 @@ you do not have a version that is new enough.
|
||||
|
||||
* Building
|
||||
|
||||
To build this project you need a build of Gnu binutils to link against.
|
||||
It is known to work with binutils 2.17.
|
||||
To build this project you a copy of GNU binutils to build against. It
|
||||
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
|
||||
one of it's mirrors. Builds targetting windows should use at least
|
||||
2.19 and currently requires the use of a cross compiler.
|
||||
|
||||
The makefile looks for this build in $BINUTILS, or (if that is not set),
|
||||
in .../binutils-2.17-$LIBARCH, where LIBARCH (as in HotSpot) is one of
|
||||
the jre subdirectory keywords i386, amd64, sparc, sparcv9, etc.
|
||||
The makefile looks for the sources in build/binutils or you can
|
||||
specify it's location to the makefile using BINTUILS=path. It will
|
||||
configure binutils and build it first and then build and link the
|
||||
disasembly adapter. Make all will build the default target for your
|
||||
platform. If you platform support both 32 and 64 simultaneously then
|
||||
"make both" will build them both at once. "make all64" will
|
||||
explicitly build the 64 bit version. By default this will build the
|
||||
disassembler library only. If you build demo it will build a demo
|
||||
program that attempts to exercise the library.
|
||||
|
||||
To build Gnu binutils, first download a copy of the software:
|
||||
http://directory.fsf.org/project/binutils/
|
||||
Windows
|
||||
|
||||
Unpack the binutils tarball into an empty directory:
|
||||
chdir ../../../../..
|
||||
tar -xzf - < ../binutils-2.17.tar.gz
|
||||
mv binutils-2.17 binutils-2.17-i386 #or binutils-2.17-sparc
|
||||
cd binutils-2.17-i386
|
||||
In theory this should be buildable on Windows but getting a working
|
||||
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
|
||||
this working. Instead you can use the mingw cross compiler on linux
|
||||
to produce the windows binaries. For 32-bit windows you can install
|
||||
mingw32 using your package manager and it will be added to your path
|
||||
automatically. For 64-bit you need to download the 64 bit mingw from
|
||||
http://sourceforge.net/projects/mingw-w64. Grab a copy of the
|
||||
complete toolchain and unpack it somewhere. Put the bin directory of
|
||||
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
|
||||
targetting and you must tell the Makefile which one to use. This
|
||||
should either be i586-mingw32msvc or x86_64-pc-mingw32 depending on
|
||||
which on you are targetting and there should be a version of gcc in
|
||||
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
|
||||
MINGW=. For example:
|
||||
|
||||
From inside that directory, run configure and make:
|
||||
( export CFLAGS='-fPIC'
|
||||
./configure i386-pc-elf )
|
||||
gnumake
|
||||
make MINGW=i586-mingw32msvc BINTUILS=build/binutils-2.19.1
|
||||
|
||||
(Leave out or change the argument to configure if not on an i386 system.)
|
||||
|
||||
Next, untar again into another empty directory for the LP64 version:
|
||||
chdir ..
|
||||
tar -xzf - < ../binutils-2.17.tar.gz
|
||||
mv binutils-2.17 binutils-2.17-amd64 #or binutils-2.17-sparcv9
|
||||
cd binutils-2.17-amd64
|
||||
|
||||
From inside that directory, run configure for LP64 and make:
|
||||
( export ac_cv_c_bigendian=no CFLAGS='-m64 -fPIC' LDFLAGS=-m64
|
||||
./configure amd64-pc-elf )
|
||||
gnumake
|
||||
|
||||
The -fPIC option is needed because the generated code will be
|
||||
linked into the hsdid-$LIBARCH.so binary. If you miss the
|
||||
option, the JVM will fail to load the disassembler.
|
||||
|
||||
You probably want two builds, one for 32 and one for 64 bits.
|
||||
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
|
||||
will build the Win32 cross compiled version of hsdis based on 2.19.1.
|
||||
|
||||
* Installing
|
||||
|
||||
Products are named like bin/$OS/hsdis-$LIBARCH.so.
|
||||
You can install them on your LD_LIBRARY_PATH,
|
||||
or inside of your JRE next to $LIBARCH/libjvm.so.
|
||||
Products are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You can
|
||||
install them on your LD_LIBRARY_PATH, or inside of your JRE next to
|
||||
$LIBARCH/libjvm.so.
|
||||
|
||||
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=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes'
|
||||
java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld
|
||||
|
@ -53,7 +53,7 @@ int main(int ac, char** av) {
|
||||
else if (!strncmp(arg, "-options=", 9))
|
||||
options = arg+9;
|
||||
else
|
||||
{ printf("Usage: %s [-xml] [name...]\n"); exit(2); }
|
||||
{ printf("Usage: %s [-xml] [name...]\n", av[0]); exit(2); }
|
||||
continue;
|
||||
}
|
||||
greet(arg);
|
||||
@ -76,26 +76,14 @@ void end_of_file() { }
|
||||
|
||||
#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 HSDIS_NAME "hsdis"
|
||||
static void* decode_instructions_pv = 0;
|
||||
static const char* hsdis_path[] = {
|
||||
HSDIS_NAME".so",
|
||||
#ifdef OS
|
||||
"bin/"OS"/"HSDIS_NAME".so",
|
||||
#endif
|
||||
#ifdef LIBARCH
|
||||
HSDIS_NAME"-"LIBARCH".so",
|
||||
#ifdef OS
|
||||
"bin/"OS"/"HSDIS_NAME"-"LIBARCH".so",
|
||||
#endif
|
||||
HSDIS_NAME"-"LIBARCH LIB_EXT,
|
||||
"./" HSDIS_NAME"-"LIBARCH LIB_EXT,
|
||||
#ifdef TARGET_DIR
|
||||
TARGET_DIR"/"HSDIS_NAME"-"LIBARCH LIB_EXT,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
@ -112,7 +100,7 @@ static const char* load_decode_instructions() {
|
||||
for (dllib = NULL; dllib == NULL; ) {
|
||||
const char* next_lib = (*next_in_path++);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <libiberty.h>
|
||||
#include <bfd.h>
|
||||
#include <dis-asm.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef bool
|
||||
#define bool int
|
||||
@ -404,21 +405,21 @@ static const bfd_arch_info_type* find_arch_info(const char* 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
|
||||
res = "i386:x86-64";
|
||||
#endif
|
||||
#ifdef LIBARCH_sparc
|
||||
res = "sparc:v8plusb";
|
||||
#endif
|
||||
#ifdef LIBARCH_sparc
|
||||
res = "sparc:v8plusb";
|
||||
#endif
|
||||
#ifdef LIBARCH_sparcv9
|
||||
res = "sparc:v9b";
|
||||
#endif
|
||||
if (res == NULL)
|
||||
res = "HOTSPOT_LIB_ARCH is not set in Makefile!";
|
||||
res = "architecture not set in Makefile!";
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -2956,9 +2956,11 @@ void LinearScan::do_linear_scan() {
|
||||
|
||||
NOT_PRODUCT(print_intervals("After Register Allocation"));
|
||||
NOT_PRODUCT(print_lir(2, "LIR after register allocation:"));
|
||||
DEBUG_ONLY(verify());
|
||||
|
||||
sort_intervals_after_allocation();
|
||||
|
||||
DEBUG_ONLY(verify());
|
||||
|
||||
eliminate_spill_moves();
|
||||
assign_reg_num();
|
||||
CHECK_BAILOUT();
|
||||
@ -3147,6 +3149,16 @@ void LinearScan::verify_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;
|
||||
for (int i = 0; i < block_count(); i++) {
|
||||
BlockBegin* block = block_at(i);
|
||||
@ -3159,6 +3171,54 @@ void LinearScan::verify_no_oops_in_fixed_intervals() {
|
||||
|
||||
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
|
||||
if (!visitor.has_call()) {
|
||||
|
||||
|
@ -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.
|
||||
if (strchr(buffer, '.') == NULL) {
|
||||
_compile_the_world_counter++;
|
||||
if (_compile_the_world_counter >= CompileTheWorldStartAt && _compile_the_world_counter <= CompileTheWorldStopAt) {
|
||||
// Construct name without extension
|
||||
symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK);
|
||||
// Use loader to load and initialize class
|
||||
klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
|
||||
instanceKlassHandle k (THREAD, ik);
|
||||
if (k.not_null() && !HAS_PENDING_EXCEPTION) {
|
||||
k->initialize(THREAD);
|
||||
if (_compile_the_world_counter > CompileTheWorldStopAt) return;
|
||||
|
||||
// Construct name without extension
|
||||
symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK);
|
||||
// Use loader to load and initialize class
|
||||
klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
|
||||
instanceKlassHandle k (THREAD, ik);
|
||||
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 something went wrong (e.g. ExceptionInInitializerError) we skip this class
|
||||
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
|
||||
} else {
|
||||
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
|
||||
// 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
|
||||
for (int n = 0; n < k->methods()->length(); 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) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
|
||||
}
|
||||
if (TieredCompilation) {
|
||||
// Clobber the first compile and force second tier compilation
|
||||
m->clear_code();
|
||||
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());
|
||||
if (TieredCompilation) {
|
||||
// Clobber the first compile and force second tier compilation
|
||||
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();
|
||||
}
|
||||
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
|
||||
|
||||
c1_LinearScan.cpp bitMap.inline.hpp
|
||||
c1_LinearScan.cpp c1_CFGPrinter.hpp
|
||||
c1_LinearScan.cpp c1_CodeStubs.hpp
|
||||
c1_LinearScan.cpp c1_Compilation.hpp
|
||||
c1_LinearScan.cpp c1_FrameMap.hpp
|
||||
c1_LinearScan.cpp c1_IR.hpp
|
||||
|
Loading…
Reference in New Issue
Block a user