This commit is contained in:
Lana Steuck 2014-09-25 16:21:54 -07:00
commit e20499314f
140 changed files with 6741 additions and 6577 deletions

View File

@ -107,7 +107,6 @@ public class VM {
private Runtime1 runtime1;
/** These constants come from globalDefinitions.hpp */
private int invocationEntryBCI;
private int invalidOSREntryBCI;
private ReversePtrs revPtrs;
private VMRegImpl vmregImpl;
private int reserveForAllocationPrefetch;
@ -295,7 +294,6 @@ public class VM {
stackBias = db.lookupIntConstant("STACK_BIAS").intValue();
invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue();
invalidOSREntryBCI = db.lookupIntConstant("InvalidOSREntryBci").intValue();
// We infer the presence of C1 or C2 from a couple of fields we
// already have present in the type database
@ -733,11 +731,6 @@ public class VM {
return invocationEntryBCI;
}
/** FIXME: figure out where to stick this */
public int getInvalidOSREntryBCI() {
return invalidOSREntryBCI;
}
// FIXME: figure out where to stick this
public boolean wizardMode() {
return true;

View File

@ -106,7 +106,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
all: $(EXEC)
$(EXEC) : $(OBJECTS)
@echo Making adlc
@echo $(LOG_INFO) Making adlc
$(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)
# Random dependencies:
@ -189,7 +189,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
|| echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes."
$(QUIETLY) rm -rf $(TEMPDIR)
@ -207,14 +207,14 @@ PROCESS_AD_FILES = awk '{ \
print }'
$(OUTDIR)/%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)
# Some object files are given a prefix, to disambiguate
# them from objects of the same name built for the VM.
$(OUTDIR)/adlc-%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)

View File

@ -195,7 +195,7 @@ DATA_MODE/ppc64 = 64
DATA_MODE = $(DATA_MODE/$(BUILDARCH))
flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -282,7 +282,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -290,7 +290,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@
@echo $(LOG_INFO) Creating directory list $@
$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
find $(HS_ALT_SRC)/share/vm/* -prune \
-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
@ -301,7 +301,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
\( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -311,7 +311,7 @@ Makefile: $(BUILDTREE_MAKE)
) > $@
vm.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -322,7 +322,7 @@ vm.make: $(BUILDTREE_MAKE)
) > $@
adlc.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -332,7 +332,7 @@ adlc.make: $(BUILDTREE_MAKE)
) > $@
jvmti.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -342,7 +342,7 @@ jvmti.make: $(BUILDTREE_MAKE)
) > $@
trace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -352,7 +352,7 @@ trace.make: $(BUILDTREE_MAKE)
) > $@
sa.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \

View File

@ -29,6 +29,12 @@
SLASH_JAVA ?= /java
define print_info
ifneq ($$(LOG_LEVEL), warn)
$$(shell echo >&2 "INFO: $1")
endif
endef
# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
#ARCH:=$(shell uname -m)
PATH_SEP = :
@ -122,8 +128,7 @@ ifeq ($(JDK6_OR_EARLIER),0)
# debug variants always get Full Debug Symbols (if available)
ENABLE_FULL_DEBUG_SYMBOLS = 1
endif
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -138,19 +143,16 @@ ifeq ($(JDK6_OR_EARLIER),0)
endif
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
$(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")
$(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY."))
ENABLE_FULL_DEBUG_SYMBOLS=0
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
else
_JUNK_ := $(shell \
echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
$(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files."))
# Library stripping policies for .debuginfo configs:
# all_strip - strips everything from the library
@ -164,13 +166,11 @@ ifeq ($(JDK6_OR_EARLIER),0)
#
STRIP_POLICY ?= min_strip
_JUNK_ := $(shell \
echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
$(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
ZIP_DEBUGINFO_FILES ?= 1
_JUNK_ := $(shell \
echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
$(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
endif
endif # ENABLE_FULL_DEBUG_SYMBOLS=1
endif # BUILD_FLAVOR
@ -227,5 +227,3 @@ ADD_SA_BINARIES/ppc64 =
ADD_SA_BINARIES/zero =
EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))

View File

@ -55,7 +55,7 @@ ifeq ($(DEBUG_BINARIES), true)
endif
$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
@echo Making signal interposition lib...
@echo $(LOG_INFO) Making signal interposition lib...
$(QUIETLY) $(CXX) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl

View File

@ -76,34 +76,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource)
$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti
$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp
$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace
$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass)
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp
$(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp
$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp
$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h
jvmtidocs: $(JvmtiOutDir)/jvmti.html
$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html
# #########################################################################
@ -115,4 +115,3 @@ cleanall :
rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles)
# #########################################################################

View File

@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make
# The non-PIC object files are only generated for 32 bit platforms.
ifdef LP64
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
else
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
$(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
@ -159,18 +159,18 @@ else
endif
%.o: %.s
@echo Assembling $<
@echo $(LOG_INFO) Assembling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
%.s: %.cpp
@echo Generating assembly for $<
@echo $(LOG_INFO) Generating assembly for $<
$(QUIETLY) $(GENASM.CXX) -o $@ $<
$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)
# Intermediate files (for debugging macros)
%.i: %.cpp
@echo Preprocessing $< to $@
@echo $(LOG_INFO) Preprocessing $< to $@
$(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE)
# Override gnumake built-in rules which do sccs get operations badly.

View File

@ -66,7 +66,7 @@ all:
fi
$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) echo "Making $@"
$(QUIETLY) echo $(LOG_INFO) "Making $@"
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \

View File

@ -73,7 +73,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \
fi
@echo Making SA debugger back-end...
@echo $(LOG_INFO) Making SA debugger back-end...
$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
-D_FILE_OFFSET_BITS=64 \
$(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \

View File

@ -81,7 +81,7 @@ endif
all: $(TraceGeneratedFiles)
GENERATE_CODE= \
$(QUIETLY) echo Generating $@; \
$(QUIETLY) echo $(LOG_INFO) Generating $@; \
$(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \
test -f $@
@ -116,5 +116,3 @@ endif
clean cleanall:
rm $(TraceGeneratedFiles)

View File

@ -269,7 +269,7 @@ LFLAGS_VM += -bloadmap:libjvm.loadmap
# rule for building precompiled header
$(PRECOMPILED_HEADER):
$(QUIETLY) echo Generating precompiled header $@
$(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@
$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
@ -300,7 +300,7 @@ endif
# details in bug 6538311.
$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
$(QUIETLY) { \
echo Linking vm...; \
echo $(LOG_INFO) Linking vm...; \
$(LINK_LIB.CXX/PRE_HOOK) \
$(LINK_VM) $(LD_SCRIPT_FLAG) \
$(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \

View File

@ -108,7 +108,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
all: $(EXEC)
$(EXEC) : $(OBJECTS)
@echo Making adlc
@echo $(LOG_INFO) Making adlc
$(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)
# Random dependencies:
@ -191,7 +191,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
|| echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes."
$(QUIETLY) rm -rf $(TEMPDIR)
@ -209,14 +209,14 @@ PROCESS_AD_FILES = awk '{ \
print }'
$(OUTDIR)/%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)
# Some object files are given a prefix, to disambiguate
# them from objects of the same name built for the VM.
$(OUTDIR)/adlc-%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)

View File

@ -201,7 +201,7 @@ DATA_MODE/amd64 = 64
DATA_MODE = $(DATA_MODE/$(BUILDARCH))
flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -286,7 +286,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -294,7 +294,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@
@echo $(LOG_INFO) Creating directory list $@
$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
find $(HS_ALT_SRC)/share/vm/* -prune \
-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
@ -305,7 +305,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
\( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -315,7 +315,7 @@ Makefile: $(BUILDTREE_MAKE)
) > $@
vm.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -326,7 +326,7 @@ vm.make: $(BUILDTREE_MAKE)
) > $@
adlc.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -336,7 +336,7 @@ adlc.make: $(BUILDTREE_MAKE)
) > $@
jvmti.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -346,7 +346,7 @@ jvmti.make: $(BUILDTREE_MAKE)
) > $@
trace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -356,7 +356,7 @@ trace.make: $(BUILDTREE_MAKE)
) > $@
sa.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -366,7 +366,7 @@ sa.make: $(BUILDTREE_MAKE)
) > $@
dtrace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \

View File

@ -28,6 +28,12 @@
SLASH_JAVA ?= /java
define print_info
ifneq ($$(LOG_LEVEL), warn)
$$(shell echo >&2 "INFO: $1")
endif
endef
# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
ARCH:=$(shell uname -m)
PATH_SEP = :
@ -187,8 +193,7 @@ ifeq ($(JDK6_OR_EARLIER),0)
# debug variants always get Full Debug Symbols (if available)
ENABLE_FULL_DEBUG_SYMBOLS = 1
endif
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -209,22 +214,18 @@ ifeq ($(JDK6_OR_EARLIER),0)
endif
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
$(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \
"files. You may need to set ALT_OBJCOPY.")
$(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo" \
"files. You may need to set ALT_OBJCOPY."))
ENABLE_FULL_DEBUG_SYMBOLS=0
_JUNK_ := $(shell \
echo >&2 "INFO:" \
"ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
else
_JUNK_ := $(shell \
echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo" \
"files.")
$(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo" \
"files."))
# Library stripping policies for .debuginfo configs:
# all_strip - strips everything from the library
@ -241,14 +242,12 @@ ifeq ($(JDK6_OR_EARLIER),0)
#
STRIP_POLICY ?= min_strip
_JUNK_ := $(shell \
echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
$(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
ZIP_DEBUGINFO_FILES ?= 1
endif
_JUNK_ := $(shell \
echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
$(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
endif
endif # ENABLE_FULL_DEBUG_SYMBOLS=1
endif # BUILD_FLAVOR

View File

@ -92,7 +92,7 @@ XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc
@ -128,7 +128,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
@ -202,7 +202,7 @@ $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp
$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -231,7 +231,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -296,13 +296,13 @@ CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL)
dtraceCheck:
dtrace_stuff: dtrace_gen_headers
$(QUIETLY) echo "dtrace headers generated"
$(QUIETLY) echo $(LOG_INFO) "dtrace headers generated"
else # manually disabled
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable"
dtrace_stuff:
@ -311,7 +311,7 @@ endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
else # No dtrace program found
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system"
dtrace_stuff:
@ -323,6 +323,6 @@ endif # ifeq ($(OS_VENDOR), Darwin)
else # CORE build
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds"
endif # ifneq ("${TYPE}", "CORE")

View File

@ -60,7 +60,7 @@ ifeq ($(DEBUG_BINARIES), true)
endif
$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
@echo Making signal interposition lib...
@echo $(LOG_INFO) Making signal interposition lib...
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)

View File

@ -75,34 +75,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource)
$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti
$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp
$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace
$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass)
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp
$(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp
$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp
$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h
jvmtidocs: $(JvmtiOutDir)/jvmti.html
$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html
# #########################################################################
@ -114,4 +114,3 @@ cleanall :
rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles)
# #########################################################################

View File

@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make
# The non-PIC object files are only generated for 32 bit platforms.
ifdef LP64
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
else
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
$(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
@ -159,18 +159,18 @@ else
endif
%.o: %.s
@echo Assembling $<
@echo $(LOG_INFO) Assembling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
%.s: %.cpp
@echo Generating assembly for $<
@echo $(LOG_INFO) Generating assembly for $<
$(QUIETLY) $(GENASM.CXX) -o $@ $<
$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)
# Intermediate files (for debugging macros)
%.i: %.cpp
@echo Preprocessing $< to $@
@echo $(LOG_INFO) Preprocessing $< to $@
$(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE)
# Override gnumake built-in rules which do sccs get operations badly.

View File

@ -25,6 +25,12 @@
# This makefile (sa.make) is included from the sa.make in the
# build directories.
define print_info
ifneq ($$(LOG_LEVEL), warn)
$$(shell echo >&2 "INFO: $1")
endif
endef
# This makefile is used to build Serviceability Agent java code
# and generate JNI header file for native methods.
@ -53,7 +59,7 @@ ifeq ($(ALT_SA_CLASSPATH),)
endif
endif
else
_JUNK_ := $(shell echo >&2 "INFO: ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)")
$(eval $(call print_info, "ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)"))
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
@ -80,7 +86,7 @@ all:
fi
$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) echo "Making $@"
$(QUIETLY) echo $(LOG_INFO) "Making $@"
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \

View File

@ -122,7 +122,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \
fi
@echo Making SA debugger back-end...
@echo $(LOG_INFO) Making SA debugger back-end...
$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
$(SA_SYSROOT_FLAGS) \
$(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \

View File

@ -82,7 +82,7 @@ endif
all: $(TraceGeneratedFiles)
GENERATE_CODE= \
$(QUIETLY) echo Generating $@; \
$(QUIETLY) echo $(LOG_INFO) Generating $@; \
$(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \
test -f $@
@ -118,4 +118,3 @@ endif
clean cleanall:
rm $(TraceGeneratedFiles)

View File

@ -291,7 +291,7 @@ endif
# rule for building precompiled header
$(PRECOMPILED_HEADER):
$(QUIETLY) echo Generating precompiled header $@
$(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@
$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
$(QUIETLY) rm -f $@
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
@ -318,7 +318,7 @@ endif
$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
$(QUIETLY) { \
echo Linking vm...; \
echo $(LOG_INFO) Linking vm...; \
$(LINK_LIB.CXX/PRE_HOOK) \
$(LINK_VM) $(LD_SCRIPT_FLAG) \
$(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \

View File

@ -29,6 +29,12 @@ ifneq ($(SPEC),)
include $(SPEC)
endif
ifeq ($(LOG_LEVEL),warn)
LOG_INFO := > /dev/null
else
LOG_INFO :=
endif
# Directory paths and user name
# Unless GAMMADIR is set on the command line, search upward from
# the current directory for a parent directory containing "src/share/vm".

View File

@ -106,7 +106,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
all: $(EXEC)
$(EXEC) : $(OBJECTS)
@echo Making adlc
@echo $(LOG_INFO) Making adlc
$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) -o $(EXEC) $(OBJECTS)
# Random dependencies:
@ -191,7 +191,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
|| echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes."
$(QUIETLY) rm -rf $(TEMPDIR)
@ -209,14 +209,14 @@ PROCESS_AD_FILES = awk '{ \
print }'
$(OUTDIR)/%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)
# Some object files are given a prefix, to disambiguate
# them from objects of the same name built for the VM.
$(OUTDIR)/adlc-%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)

View File

@ -198,7 +198,7 @@ DATA_MODE/ppc64 = 64
DATA_MODE = $(DATA_MODE/$(BUILDARCH))
flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -285,7 +285,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -293,7 +293,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@
@echo $(LOG_INFO) Creating directory list $@
$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
find $(HS_ALT_SRC)/share/vm/* -prune \
-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
@ -304,7 +304,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
\( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -314,7 +314,7 @@ Makefile: $(BUILDTREE_MAKE)
) > $@
vm.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -325,7 +325,7 @@ vm.make: $(BUILDTREE_MAKE)
) > $@
adlc.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -335,7 +335,7 @@ adlc.make: $(BUILDTREE_MAKE)
) > $@
jvmti.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -345,7 +345,7 @@ jvmti.make: $(BUILDTREE_MAKE)
) > $@
trace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -355,7 +355,7 @@ trace.make: $(BUILDTREE_MAKE)
) > $@
sa.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -365,7 +365,7 @@ sa.make: $(BUILDTREE_MAKE)
) > $@
dtrace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \

View File

@ -28,6 +28,12 @@
SLASH_JAVA ?= /java
define print_info
ifneq ($$(LOG_LEVEL), warn)
$$(shell echo >&2 "INFO: $1")
endif
endef
# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
# ARCH can be set explicitly in spec.gmk
@ -185,8 +191,7 @@ ifeq ($(JDK6_OR_EARLIER),0)
# debug variants always get Full Debug Symbols (if available)
ENABLE_FULL_DEBUG_SYMBOLS = 1
endif
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -201,19 +206,16 @@ ifeq ($(JDK6_OR_EARLIER),0)
endif
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
$(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")
$(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY."))
ENABLE_FULL_DEBUG_SYMBOLS=0
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
else
_JUNK_ := $(shell \
echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
$(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files."))
# Library stripping policies for .debuginfo configs:
# all_strip - strips everything from the library
@ -227,13 +229,11 @@ ifeq ($(JDK6_OR_EARLIER),0)
#
STRIP_POLICY ?= min_strip
_JUNK_ := $(shell \
echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
$(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
ZIP_DEBUGINFO_FILES ?= 1
_JUNK_ := $(shell \
echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
$(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
endif
endif # ENABLE_FULL_DEBUG_SYMBOLS=1
endif # BUILD_FLAVOR

View File

@ -78,13 +78,13 @@ CFLAGS += -DDTRACE_ENABLED
dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h
else
dtrace_gen_headers:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)"
$(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)"
endif
# Phony target used in vm.make build target to check whether enabled.
ifeq ($(DTRACE_ENABLED),)
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)"
$(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)"
else
dtraceCheck:
endif

View File

@ -52,7 +52,7 @@ ifeq ($(DEBUG_BINARIES), true)
endif
$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
@echo Making signal interposition lib...
@echo $(LOG_INFO) Making signal interposition lib...
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $< -ldl
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)

View File

@ -75,34 +75,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource)
$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti
$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp
$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace
$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass)
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp
$(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp
$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp
$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h
jvmtidocs: $(JvmtiOutDir)/jvmti.html
$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html
# #########################################################################

View File

@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make
# The non-PIC object files are only generated for 32 bit platforms.
ifdef LP64
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
else
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
$(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
@ -159,18 +159,18 @@ else
endif
%.o: %.s
@echo Assembling $<
@echo $(LOG_INFO) Assembling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
%.s: %.cpp
@echo Generating assembly for $<
@echo $(LOG_INFO) Generating assembly for $<
$(QUIETLY) $(GENASM.CXX) -o $@ $<
$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)
# Intermediate files (for debugging macros)
%.i: %.cpp
@echo Preprocessing $< to $@
@echo $(LOG_INFO) Preprocessing $< to $@
$(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE)
# Override gnumake built-in rules which do sccs get operations badly.

View File

@ -67,7 +67,7 @@ all:
fi
$(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
$(QUIETLY) echo "Making $@"
$(QUIETLY) echo $(LOG_INFO) "Making $@"
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \

View File

@ -80,7 +80,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \
fi
@echo Making SA debugger back-end...
@echo $(LOG_INFO) Making SA debugger back-end...
$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
-D_FILE_OFFSET_BITS=64 \
$(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \

View File

@ -81,7 +81,7 @@ endif
all: $(TraceGeneratedFiles)
GENERATE_CODE= \
$(QUIETLY) echo Generating $@; \
$(QUIETLY) echo $(LOG_INFO) Generating $@; \
$(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \
test -f $@

View File

@ -286,7 +286,7 @@ LINK_VM = $(LINK_LIB.CC)
# rule for building precompiled header
$(PRECOMPILED_HEADER):
$(QUIETLY) echo Generating precompiled header $@
$(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@
$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
$(QUIETLY) rm -f $@
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
@ -318,7 +318,7 @@ endif
# details in bug 6538311.
$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
$(QUIETLY) { \
echo Linking vm...; \
echo $(LOG_INFO) Linking vm...; \
$(LINK_LIB.CXX/PRE_HOOK) \
$(LINK_VM) $(LD_SCRIPT_FLAG) \
$(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \

View File

@ -127,7 +127,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
all: $(EXEC)
$(EXEC) : $(OBJECTS)
@echo Making adlc
@echo $(LOG_INFO) Making adlc
$(QUIETLY) $(LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)
# Random dependencies:
@ -206,7 +206,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
|| echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes."
$(QUIETLY) rm -rf $(TEMPDIR)
@ -224,14 +224,14 @@ PROCESS_AD_FILES = awk '{ \
print }'
$(OUTDIR)/%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE)
# Some object files are given a prefix, to disambiguate
# them from objects of the same name built for the VM.
$(OUTDIR)/adlc-%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE)

View File

@ -190,7 +190,7 @@ DATA_MODE/amd64 = 64
DATA_MODE = $(DATA_MODE/$(BUILDARCH))
flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -272,7 +272,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -280,7 +280,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
) > $@
../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
@echo Creating directory list $@
@echo $(LOG_INFO) Creating directory list $@
$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
find $(HS_ALT_SRC)/share/vm/* -prune \
-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
@ -291,7 +291,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
\( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
Makefile: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -301,7 +301,7 @@ Makefile: $(BUILDTREE_MAKE)
) > $@
vm.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -312,7 +312,7 @@ vm.make: $(BUILDTREE_MAKE)
) > $@
adlc.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -322,7 +322,7 @@ adlc.make: $(BUILDTREE_MAKE)
) > $@
jvmti.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -332,7 +332,7 @@ jvmti.make: $(BUILDTREE_MAKE)
) > $@
trace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -342,7 +342,7 @@ trace.make: $(BUILDTREE_MAKE)
) > $@
sa.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \
@ -352,7 +352,7 @@ sa.make: $(BUILDTREE_MAKE)
) > $@
dtrace.make: $(BUILDTREE_MAKE)
@echo Creating $@ ...
@echo $(LOG_INFO) Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo; \

View File

@ -26,6 +26,12 @@
# Include the top level defs.make under make directory instead of this one.
# This file is included into make/defs.make.
define print_info
ifneq ($$(LOG_LEVEL), warn)
$$(shell echo >&2 "INFO: $1")
endif
endef
# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
SLASH_JAVA ?= /java
ARCH:=$(shell uname -p)
@ -120,8 +126,7 @@ ifeq ($(JDK6_OR_EARLIER),0)
# debug variants always get Full Debug Symbols (if available)
ENABLE_FULL_DEBUG_SYMBOLS = 1
endif
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -129,19 +134,16 @@ ifeq ($(JDK6_OR_EARLIER),0)
DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
ifneq ($(ALT_OBJCOPY),)
_JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
$(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
endif
ifeq ($(OBJCOPY),)
_JUNK_ := $(shell \
echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
$(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files."))
ENABLE_FULL_DEBUG_SYMBOLS=0
_JUNK_ := $(shell \
echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
$(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
else
_JUNK_ := $(shell \
echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
$(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files."))
# Library stripping policies for .debuginfo configs:
# all_strip - strips everything from the library
@ -155,13 +157,11 @@ ifeq ($(JDK6_OR_EARLIER),0)
#
STRIP_POLICY ?= min_strip
_JUNK_ := $(shell \
echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
$(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
ZIP_DEBUGINFO_FILES ?= 1
_JUNK_ := $(shell \
echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
$(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
endif
endif # ENABLE_FULL_DEBUG_SYMBOLS=1
endif # BUILD_FLAVOR

View File

@ -32,7 +32,7 @@ ifneq ("${TYPE}", "CORE")
ifdef USE_GCC
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for gcc builds"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for gcc builds"
else
@ -102,7 +102,7 @@ XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
@ -137,7 +137,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
@ -207,7 +207,7 @@ $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp
$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -232,7 +232,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
endif
$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
@echo $(LOG_INFO) Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@ -286,7 +286,7 @@ DTraced_Files = ciEnv.o \
# Dtrace is available, so we build $(DTRACE.o)
$(DTRACE.o): $(DTRACE).d $(DTraced_Files)
@echo Compiling $(DTRACE).d
@echo $(LOG_INFO) Compiling $(DTRACE).d
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
$(DTraced_Files) ||\
@ -352,7 +352,7 @@ dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(Dt
# The jhelper.d and hotspot probes are separated into two different SUNW_dof sections.
# Now the jhelper.d is built without the -Xlazyload flag.
$(DTRACE_JHELPER.o) : $(DTRACE_JHELPER).d $(JVMOFFS).h $(JVMOFFS)Index.h
@echo Compiling $(DTRACE_JHELPER).d
@echo $(LOG_INFO) Compiling $(DTRACE_JHELPER).d
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE_JHELPER).d
.PHONY: dtraceCheck
@ -391,14 +391,14 @@ dtraceCheck:
else # manually disabled
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable"
endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "")
else # No dtrace program found
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system"
endif # ifneq ("${dtraceFound}", "")
@ -407,6 +407,6 @@ endif # ifdef USE_GCC
else # CORE build
dtraceCheck:
$(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds"
$(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds"
endif # ifneq ("${TYPE}", "CORE")

View File

@ -48,7 +48,7 @@ LFLAGS_JSIG += -mt -xnolib
endif
$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
@echo Making signal interposition lib...
@echo $(LOG_INFO) Making signal interposition lib...
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)

View File

@ -74,34 +74,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource)
$(QUIETLY) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource)
$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti
$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp
$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace
$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass)
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp
$(QUIETLY) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp
$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp
$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h
jvmtidocs: $(JvmtiOutDir)/jvmti.html
$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl
@echo Generating $@
@echo $(LOG_INFO) Generating $@
$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html
# #########################################################################
@ -113,4 +113,3 @@ cleanall :
rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles)
# #########################################################################

View File

@ -138,12 +138,12 @@ include $(GAMMADIR)/make/altsrc.make
# Sun compiler for 64 bit Solaris does not support building non-PIC object files.
ifdef LP64
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
else
%.o: %.cpp
@echo Compiling $<
@echo $(LOG_INFO) Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
$(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
@ -151,18 +151,18 @@ else
endif
%.o: %.s
@echo Assembling $<
@echo $(LOG_INFO) Assembling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE)
%.s: %.cpp
@echo Generating assembly for $<
@echo $(LOG_INFO) Generating assembly for $<
$(QUIETLY) $(GENASM.CXX) -o $@ $<
$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)
# Intermediate files (for debugging macros)
%.i: %.cpp
@echo Preprocessing $< to $@
@echo $(LOG_INFO) Preprocessing $< to $@
$(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE)
# Override gnumake built-in rules which do sccs get operations badly.

View File

@ -58,7 +58,7 @@ all:
fi
$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) echo "Making $@";
$(QUIETLY) echo $(LOG_INFO) "Making $@";
$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \

View File

@ -95,7 +95,7 @@ $(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SA
echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
exit 1; \
fi
@echo Making SA debugger back-end...
@echo $(LOG_INFO) Making SA debugger back-end...
$(QUIETLY) $(CXX) \
$(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-I$(SASRCDIR) \

View File

@ -77,7 +77,7 @@ endif
all: $(TraceGeneratedFiles)
GENERATE_CODE= \
$(QUIETLY) echo Generating $@; \
$(QUIETLY) echo $(LOG_INFO) Generating $@; \
$(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \
test -f $@
@ -112,5 +112,3 @@ endif
clean cleanall:
rm $(TraceGeneratedFiles)

View File

@ -295,7 +295,7 @@ endif
# making the library:
$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE)
ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
@echo Linking vm...
@echo $(LOG_INFO) Linking vm...
$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
$(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM)
$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)

View File

@ -31,12 +31,8 @@
ProjectCreatorSources=\
$(WorkSpace)\src\share\tools\ProjectCreator\ProjectCreator.java \
$(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreator.java \
$(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC7.java \
$(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC10.java \
$(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatform.java \
$(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC7.java \
$(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC8.java \
$(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC9.java \
$(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC10.java \
$(WorkSpace)\src\share\tools\ProjectCreator\Util.java \
$(WorkSpace)\src\share\tools\ProjectCreator\BuildConfig.java \

View File

@ -1166,9 +1166,9 @@ void InterpreterMacroAssembler::test_backedge_count_for_osr(Register backedge_co
beq(CCR0, overflow_with_error);
// Has the nmethod been invalidated already?
lwz(Rtmp, nmethod::entry_bci_offset(), R3_RET);
cmpwi(CCR0, Rtmp, InvalidOSREntryBci);
beq(CCR0, overflow_with_error);
lbz(Rtmp, nmethod::state_offset(), R3_RET);
cmpwi(CCR0, Rtmp, nmethod::in_use);
bne(CCR0, overflow_with_error);
// Migrate the interpreter frame off of the stack.
// We can use all registers because we will not return to interpreter from this point.

View File

@ -1674,9 +1674,9 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ beq(CCR0, Lforward);
// Has the nmethod been invalidated already?
__ lwz(R0, nmethod::entry_bci_offset(), R3_RET);
__ cmpwi(CCR0, R0, InvalidOSREntryBci);
__ beq(CCR0, Lforward);
__ lbz(R0, nmethod::state_offset(), R3_RET);
__ cmpwi(CCR0, R0, nmethod::in_use);
__ bne(CCR0, Lforward);
// Migrate the interpreter frame off of the stack.
// We can use all registers because we will not return to interpreter from this point.

View File

@ -2407,8 +2407,8 @@ void InterpreterMacroAssembler::test_backedge_count_for_osr( Register backedge_c
br_null_short(O0, Assembler::pn, overflow_with_error);
// Has the nmethod been invalidated already?
ld(O0, nmethod::entry_bci_offset(), O2);
cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, overflow_with_error);
ldub(O0, nmethod::state_offset(), O2);
cmp_and_br_short(O2, nmethod::in_use, Assembler::notEqual, Assembler::pn, overflow_with_error);
// migrate the interpreter frame off of the stack

View File

@ -1636,8 +1636,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ br_null_short(O0, Assembler::pn, Lforward);
// Has the nmethod been invalidated already?
__ ld(O0, nmethod::entry_bci_offset(), O2);
__ cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, Lforward);
__ ldub(O0, nmethod::state_offset(), O2);
__ cmp_and_br_short(O2, nmethod::in_use, Assembler::notEqual, Assembler::pn, Lforward);
// migrate the interpreter frame off of the stack

View File

@ -1724,9 +1724,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ testptr(rax, rax); // test result
__ jcc(Assembler::zero, dispatch); // no osr if null
// nmethod may have been invalidated (VM may block upon call_VM return)
__ movl(rcx, Address(rax, nmethod::entry_bci_offset()));
__ cmpl(rcx, InvalidOSREntryBci);
__ jcc(Assembler::equal, dispatch);
__ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use);
__ jcc(Assembler::notEqual, dispatch);
// We have the address of an on stack replacement routine in rax,
// We need to prepare to execute the OSR method. First we must
@ -1734,8 +1733,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ mov(rbx, rax); // save the nmethod
const Register thread = rcx;
__ get_thread(thread);
__ get_thread(rcx);
call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin));
// rax, is OSR buffer, move it to expected parameter location
__ mov(rcx, rax);

View File

@ -1751,9 +1751,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
__ testptr(rax, rax); // test result
__ jcc(Assembler::zero, dispatch); // no osr if null
// nmethod may have been invalidated (VM may block upon call_VM return)
__ movl(rcx, Address(rax, nmethod::entry_bci_offset()));
__ cmpl(rcx, InvalidOSREntryBci);
__ jcc(Assembler::equal, dispatch);
__ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use);
__ jcc(Assembler::notEqual, dispatch);
// We have the address of an on stack replacement routine in eax
// We need to prepare to execute the OSR method. First we must

View File

@ -4002,10 +4002,6 @@ bool os::check_heap(bool force) {
return true;
}
// int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
// return ::vsnprintf(buf, count, format, args);
// }
// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
DIR *dir = NULL;

View File

@ -269,4 +269,8 @@ inline bool os::supports_monotonic_clock() {
return true;
}
inline void os::exit(int num) {
::exit(num);
}
#endif // OS_AIX_VM_OS_AIX_INLINE_HPP

View File

@ -255,6 +255,7 @@ int generateJvmOffsets(GEN_variant gen_variant) {
printf("\n");
GEN_OFFS(nmethod, _method);
GEN_OFFS(nmethod, _dependencies_offset);
GEN_OFFS(nmethod, _oops_offset);
GEN_OFFS(nmethod, _scopes_data_offset);
GEN_OFFS(nmethod, _scopes_pcs_offset);

View File

@ -595,7 +595,7 @@ static int nmethod_info(Nmethod_t *N)
/* scopes_pcs */
err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32);
CHECK_FAIL(err);
err = ps_pread(J->P, nm + OFFSET_nmethod_handler_table_offset, &N->scopes_pcs_end, SZ32);
err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32);
CHECK_FAIL(err);
/* scopes_data */

View File

@ -152,9 +152,9 @@ static bool check_signals = true;
static pid_t _initial_pid = 0;
/* Signal number used to suspend/resume a thread */
// Signal number used to suspend/resume a thread
/* do not use any signal number less than SIGSEGV, see 4355769 */
// do not use any signal number less than SIGSEGV, see 4355769
static int SR_signum = SIGUSR2;
sigset_t SR_sigset;
@ -255,21 +255,19 @@ void os::Bsd::initialize_system_info() {
int cpu_val;
julong mem_val;
/* get processors count via hw.ncpus sysctl */
// get processors count via hw.ncpus sysctl
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
len = sizeof(cpu_val);
if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1 && cpu_val >= 1) {
assert(len == sizeof(cpu_val), "unexpected data size");
set_processor_count(cpu_val);
}
else {
} else {
set_processor_count(1); // fallback
}
/* get physical memory via hw.memsize sysctl (hw.memsize is used
* since it returns a 64 bit value)
*/
// get physical memory via hw.memsize sysctl (hw.memsize is used
// since it returns a 64 bit value)
mib[0] = CTL_HW;
#if defined (HW_MEMSIZE) // Apple
@ -565,11 +563,12 @@ bool os::Bsd::is_sig_ignored(int sig) {
sigaction(sig, (struct sigaction*)NULL, &oact);
void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oact.sa_handler);
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN))
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) {
return true;
else
} else {
return false;
}
}
void os::Bsd::signal_sets_init() {
// Should also have an assertion stating we are still single-threaded.
@ -611,8 +610,9 @@ void os::Bsd::signal_sets_init() {
}
// Fill in signals that are blocked by all but the VM thread.
sigemptyset(&vm_sigs);
if (!ReduceSignalUsage)
if (!ReduceSignalUsage) {
sigaddset(&vm_sigs, BREAK_SIGNAL);
}
debug_only(signal_sets_initialized = true);
}
@ -1176,7 +1176,6 @@ void os::die() {
// from src/solaris/hpi/src/system_md.c
size_t os::lasterror(char *buf, size_t len) {
if (errno == 0) return 0;
const char *s = ::strerror(errno);
@ -1269,9 +1268,9 @@ const char* os::get_temp_directory() {
}
return temp_path;
}
#else /* __APPLE__ */
#else // __APPLE__
const char* os::get_temp_directory() { return "/tmp"; }
#endif /* __APPLE__ */
#endif // __APPLE__
static bool file_exists(const char* filename) {
struct stat statbuf;
@ -1378,8 +1377,7 @@ bool os::dll_address_to_function_name(address addr, char *buf,
// Handle non-dynamic manually:
if (dlinfo.dli_fbase != NULL &&
Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset,
dlinfo.dli_fbase)) {
Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) {
if (!Decoder::demangle(localbuf, buf, buflen)) {
jio_snprintf(buf, buflen, "%s", localbuf);
}
@ -1433,8 +1431,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
return NULL;
}
#else
void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
void * result= ::dlopen(filename, RTLD_LAZY);
if (result != NULL) {
// Successful loading
@ -1608,7 +1605,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
return NULL;
}
#endif /* !__APPLE__ */
#endif // !__APPLE__
void* os::get_default_process_handle() {
#ifdef __APPLE__
@ -1804,8 +1801,9 @@ void os::jvm_path(char *buf, jint buflen) {
if (ret && dli_fname[0] != '\0') {
rp = realpath(dli_fname, buf);
}
if (rp == NULL)
if (rp == NULL) {
return;
}
if (Arguments::sun_java_launcher_is_altjvm()) {
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
@ -1834,8 +1832,9 @@ void os::jvm_path(char *buf, jint buflen) {
assert(strstr(p, "/libjvm") == p, "invalid library name");
rp = realpath(java_home_var, buf);
if (rp == NULL)
if (rp == NULL) {
return;
}
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
@ -1867,12 +1866,13 @@ void os::jvm_path(char *buf, jint buflen) {
} else {
// Fall back to path of current library
rp = realpath(dli_fname, buf);
if (rp == NULL)
if (rp == NULL) {
return;
}
}
}
}
}
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
@ -1890,13 +1890,13 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
static volatile jint sigint_count = 0;
static void
UserHandler(int sig, void *siginfo, void *context) {
static void UserHandler(int sig, void *siginfo, void *context) {
// 4511530 - sem_post is serialized and handled by the manager thread. When
// the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
// don't want to flood the manager thread with sem_post requests.
if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1)
if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
return;
}
// Ctrl-C is pressed during error reporting, likely because the error
// handler fails to abort. Let VM die immediately.
@ -1935,10 +1935,8 @@ void os::signal_raise(int signal_number) {
::raise(signal_number);
}
/*
* The following code is moved from os.cpp for making this
* code platform specific, which it is by its very nature.
*/
// The following code is moved from os.cpp for making this
// code platform specific, which it is by its very nature.
// Will be modified when max signal is changed to be dynamic
int os::sigexitnum_pd() {
@ -1951,12 +1949,14 @@ static volatile jint pending_signals[NSIG+1] = { 0 };
// Bsd(POSIX) specific hand shaking semaphore.
#ifdef __APPLE__
typedef semaphore_t os_semaphore_t;
#define SEM_INIT(sem, value) semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, value)
#define SEM_WAIT(sem) semaphore_wait(sem)
#define SEM_POST(sem) semaphore_signal(sem)
#define SEM_DESTROY(sem) semaphore_destroy(mach_task_self(), sem)
#else
typedef sem_t os_semaphore_t;
#define SEM_INIT(sem, value) sem_init(&sem, 0, value)
#define SEM_WAIT(sem) sem_wait(&sem)
#define SEM_POST(sem) sem_post(&sem)
@ -2099,12 +2099,10 @@ static int check_pending_signals(bool wait) {
// were we externally suspended while we were waiting?
threadIsSuspended = thread->handle_special_suspend_equivalent_condition();
if (threadIsSuspended) {
//
// The semaphore has been incremented, but while we were waiting
// another thread suspended us. We don't want to continue running
// while suspended because that would surprise the thread that
// suspended us.
//
::SEM_POST(sig_sem);
thread->java_suspend_self();
@ -2406,8 +2404,7 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr,
bool warn_on_failure = UseLargePages &&
(!FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes)
);
!FLAG_IS_DEFAULT(LargePageSizeInBytes));
// Create a large shared memory region to attach to based on size.
// Currently, size is the total size of the heap
@ -2585,8 +2582,7 @@ void os::naked_short_sleep(jlong ms) {
req.tv_sec = 0;
if (ms > 0) {
req.tv_nsec = (ms % 1000) * 1000000;
}
else {
} else {
req.tv_nsec = 1;
}
@ -2649,7 +2645,7 @@ int os::java_to_os_priority[CriticalPriority + 1] = {
31 // 11 CriticalPriority
};
#else
/* Using Mach high-level priority assignments */
// Using Mach high-level priority assignments
int os::java_to_os_priority[CriticalPriority + 1] = {
0, // 0 Entry should never be used (MINPRI_USER)
@ -2702,12 +2698,14 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
int policy;
pthread_t self = pthread_self();
if (pthread_getschedparam(self, &policy, &sp) != 0)
if (pthread_getschedparam(self, &policy, &sp) != 0) {
return OS_ERR;
}
sp.sched_priority = newpri;
if (pthread_setschedparam(self, policy, &sp) != 0)
if (pthread_setschedparam(self, policy, &sp) != 0) {
return OS_ERR;
}
return OS_OK;
#else
@ -2763,7 +2761,6 @@ void os::hint_no_preempt() {}
// - sends signal to end the sigsuspend loop in the SR_handler
//
// Note that the SR_lock plays no role in this suspend/resume protocol.
//
static void resume_clear_context(OSThread *osthread) {
osthread->set_ucontext(NULL);
@ -2775,7 +2772,6 @@ static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo, ucontex
osthread->set_siginfo(siginfo);
}
//
// Handler function invoked when a thread's execution is suspended or
// resumed. We have to be careful that only async-safe functions are
// called here (Note: most pthread functions are not async safe and
@ -2847,7 +2843,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
static int SR_initialize() {
struct sigaction act;
char *s;
/* Get signal number to use for suspend/resume */
// Get signal number to use for suspend/resume
if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) {
int sig = ::strtol(s, 0, 10);
if (sig > 0 || sig < NSIG) {
@ -2861,7 +2857,7 @@ static int SR_initialize() {
sigemptyset(&SR_sigset);
sigaddset(&SR_sigset, SR_signum);
/* Set up signal handler for suspend/resume */
// Set up signal handler for suspend/resume
act.sa_flags = SA_RESTART|SA_SIGINFO;
act.sa_handler = (void (*)(int)) SR_handler;
@ -2987,9 +2983,9 @@ static void do_resume(OSThread* osthread) {
// Note that the VM will print warnings if it detects conflicting signal
// handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
//
extern "C" JNIEXPORT int
JVM_handle_bsd_signal(int signo, siginfo_t* siginfo,
void* ucontext, int abort_if_unrecognized);
extern "C" JNIEXPORT int JVM_handle_bsd_signal(int signo, siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
void signalHandler(int sig, siginfo_t* info, void* uc) {
assert(info != NULL && uc != NULL, "it must be old kernel");
@ -3328,8 +3324,11 @@ static void print_signal_handler(outputStream* st, int sig,
#define DO_SIGNAL_CHECK(sig) \
if (!sigismember(&check_signal_done, sig)) \
os::Bsd::check_signal_handler(sig)
do { \
if (!sigismember(&check_signal_done, sig)) { \
os::Bsd::check_signal_handler(sig); \
} \
} while (0)
// This method is a periodic task to check for misbehaving JNI applications
// under CheckJNI, we can add any periodic checks here
@ -3444,7 +3443,8 @@ void os::Bsd::check_signal_handler(int sig) {
}
}
extern void report_error(char* file_name, int line_no, char* title, char* format, ...);
extern void report_error(char* file_name, int line_no, char* title,
char* format, ...);
extern bool signal_name(int signo, char* buf, size_t len);
@ -3462,7 +3462,7 @@ const char* os::exception_name(int exception_code, char* buf, size_t size) {
// this is called _before_ the most of global arguments have been parsed
void os::init(void) {
char dummy; /* used to get a guess on initial stack address */
char dummy; // used to get a guess on initial stack address
// first_hrtime = gethrtime();
// With BsdThreads the JavaMain thread pid (primordial thread)
@ -3515,8 +3515,7 @@ extern "C" {
}
// this is called _after_ the global arguments have been parsed
jint os::init_2(void)
{
jint os::init_2(void) {
// Allocate a single page and mark it as readable for safepoint polling
address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
@ -3524,8 +3523,10 @@ jint os::init_2(void)
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
if (!UseMembar) {
@ -3534,8 +3535,10 @@ jint os::init_2(void)
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
}
@ -3577,8 +3580,9 @@ jint os::init_2(void)
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
@ -3591,11 +3595,12 @@ jint os::init_2(void)
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
}
}
}
// at-exit methods are called in the reverse order of their registration.
// atexit functions are called on return from main or as a result of a
@ -3635,16 +3640,17 @@ void os::init_3(void) { }
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if (!guard_memory((char*)_polling_page, Bsd::page_size()))
if (!guard_memory((char*)_polling_page, Bsd::page_size())) {
fatal("Could not disable polling page");
};
}
}
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if (!bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
fatal("Could not enable polling page");
}
};
}
int os::active_processor_count() {
return _processor_count;
@ -3719,8 +3725,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) {
return fetcher.result();
}
int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
{
int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond,
pthread_mutex_t *_mutex,
const struct timespec *_abstime) {
return pthread_cond_timedwait(_cond, _mutex, _abstime);
}
@ -3757,8 +3764,9 @@ bool os::find(address addr, outputStream* st) {
if (begin < lowest) begin = lowest;
Dl_info dlinfo2;
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) {
end = (address) dlinfo2.dli_saddr;
}
Disassembler::decode(begin, end, st);
}
return true;
@ -3772,9 +3780,9 @@ bool os::find(address addr, outputStream* st) {
// This does not do anything on Bsd. This is basically a hook for being
// able to use structured exception handling (thread-local exception filters)
// on, e.g., Win32.
void
os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method,
JavaCallArguments* args, Thread* thread) {
void os::os_exception_wrapper(java_call_t f, JavaValue* value,
methodHandle* method, JavaCallArguments* args,
Thread* thread) {
f(value, method, args, thread);
}
@ -3814,11 +3822,6 @@ bool os::check_heap(bool force) {
return true;
}
ATTRIBUTE_PRINTF(3, 0)
int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
return ::vsnprintf(buf, count, format, args);
}
// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
DIR *dir = NULL;
@ -3827,7 +3830,7 @@ bool os::dir_is_empty(const char* path) {
dir = opendir(path);
if (dir == NULL) return true;
/* Scan the directory */
// Scan the directory
bool result = true;
char buf[sizeof(struct dirent) + MAX_PATH];
while (result && (ptr = ::readdir(dir)) != NULL) {
@ -3851,7 +3854,6 @@ bool os::dir_is_empty(const char* path) {
// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
int os::open(const char *path, int oflag, int mode) {
if (strlen(path) > MAX_PATH - 1) {
errno = ENAMETOOLONG;
return -1;
@ -3881,34 +3883,34 @@ int os::open(const char *path, int oflag, int mode) {
}
}
/*
* All file descriptors that are opened in the JVM and not
* specifically destined for a subprocess should have the
* close-on-exec flag set. If we don't set it, then careless 3rd
* party native code might fork and exec without closing all
* appropriate file descriptors (e.g. as we do in closeDescriptors in
* UNIXProcess.c), and this in turn might:
*
* - cause end-of-file to fail to be detected on some file
* descriptors, resulting in mysterious hangs, or
*
* - might cause an fopen in the subprocess to fail on a system
* suffering from bug 1085341.
*
* (Yes, the default setting of the close-on-exec flag is a Unix
* design flaw)
*
* See:
* 1085341: 32-bit stdio routines should support file descriptors >255
* 4843136: (process) pipe file descriptor from Runtime.exec not being closed
* 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
*/
// All file descriptors that are opened in the JVM and not
// specifically destined for a subprocess should have the
// close-on-exec flag set. If we don't set it, then careless 3rd
// party native code might fork and exec without closing all
// appropriate file descriptors (e.g. as we do in closeDescriptors in
// UNIXProcess.c), and this in turn might:
//
// - cause end-of-file to fail to be detected on some file
// descriptors, resulting in mysterious hangs, or
//
// - might cause an fopen in the subprocess to fail on a system
// suffering from bug 1085341.
//
// (Yes, the default setting of the close-on-exec flag is a Unix
// design flaw)
//
// See:
// 1085341: 32-bit stdio routines should support file descriptors >255
// 4843136: (process) pipe file descriptor from Runtime.exec not being closed
// 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
//
#ifdef FD_CLOEXEC
{
int flags = ::fcntl(fd, F_GETFD);
if (flags != -1)
if (flags != -1) {
::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
}
}
#endif
if (o_delete != 0) {
@ -3948,11 +3950,9 @@ int os::available(int fd, jlong *bytes) {
if (::fstat(fd, &buf) >= 0) {
mode = buf.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
/*
* XXX: is the following call interruptible? If so, this might
* need to go through the INTERRUPT_IO() wrapper as for other
* blocking, interruptible calls in this file.
*/
// XXX: is the following call interruptible? If so, this might
// need to go through the INTERRUPT_IO() wrapper as for other
// blocking, interruptible calls in this file.
int n;
if (::ioctl(fd, FIONREAD, &n) >= 0) {
*bytes = n;
@ -3972,8 +3972,9 @@ int os::available(int fd, jlong *bytes) {
}
int os::socket_available(int fd, jint *pbytes) {
if (fd < 0)
if (fd < 0) {
return OS_OK;
}
int ret;
@ -4075,8 +4076,9 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
mach_thread = thread->osthread()->thread_id();
kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount);
if (kr != KERN_SUCCESS)
if (kr != KERN_SUCCESS) {
return -1;
}
if (user_sys_cpu_time) {
jlong nanos;
@ -4207,7 +4209,8 @@ void os::pause() {
// abstime will be the absolute timeout time
// TODO: replace compute_abstime() with unpackTime()
static struct timespec* compute_abstime(struct timespec* abstime, jlong millis) {
static struct timespec* compute_abstime(struct timespec* abstime,
jlong millis) {
if (millis < 0) millis = 0;
struct timeval now;
int status = gettimeofday(&now, NULL);
@ -4370,36 +4373,33 @@ void os::PlatformEvent::unpark() {
// JSR166
// -------------------------------------------------------
/*
* The solaris and bsd implementations of park/unpark are fairly
* conservative for now, but can be improved. They currently use a
* mutex/condvar pair, plus a a count.
* Park decrements count if > 0, else does a condvar wait. Unpark
* sets count to 1 and signals condvar. Only one thread ever waits
* on the condvar. Contention seen when trying to park implies that someone
* is unparking you, so don't wait. And spurious returns are fine, so there
* is no need to track notifications.
*/
// The solaris and bsd implementations of park/unpark are fairly
// conservative for now, but can be improved. They currently use a
// mutex/condvar pair, plus a a count.
// Park decrements count if > 0, else does a condvar wait. Unpark
// sets count to 1 and signals condvar. Only one thread ever waits
// on the condvar. Contention seen when trying to park implies that someone
// is unparking you, so don't wait. And spurious returns are fine, so there
// is no need to track notifications.
#define MAX_SECS 100000000
/*
* This code is common to bsd and solaris and will be moved to a
* common place in dolphin.
*
* The passed in time value is either a relative time in nanoseconds
* or an absolute time in milliseconds. Either way it has to be unpacked
* into suitable seconds and nanoseconds components and stored in the
* given timespec structure.
* Given time is a 64-bit value and the time_t used in the timespec is only
* a signed-32-bit value (except on 64-bit Bsd) we have to watch for
* overflow if times way in the future are given. Further on Solaris versions
* prior to 10 there is a restriction (see cond_timedwait) that the specified
* number of seconds, in abstime, is less than current_time + 100,000,000.
* As it will be 28 years before "now + 100000000" will overflow we can
* ignore overflow and just impose a hard-limit on seconds using the value
* of "now + 100,000,000". This places a limit on the timeout of about 3.17
* years from "now".
*/
// This code is common to bsd and solaris and will be moved to a
// common place in dolphin.
//
// The passed in time value is either a relative time in nanoseconds
// or an absolute time in milliseconds. Either way it has to be unpacked
// into suitable seconds and nanoseconds components and stored in the
// given timespec structure.
// Given time is a 64-bit value and the time_t used in the timespec is only
// a signed-32-bit value (except on 64-bit Bsd) we have to watch for
// overflow if times way in the future are given. Further on Solaris versions
// prior to 10 there is a restriction (see cond_timedwait) that the specified
// number of seconds, in abstime, is less than current_time + 100,000,000.
// As it will be 28 years before "now + 100000000" will overflow we can
// ignore overflow and just impose a hard-limit on seconds using the value
// of "now + 100,000,000". This places a limit on the timeout of about 3.17
// years from "now".
static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
assert(time > 0, "convertTime");
@ -4414,19 +4414,16 @@ static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
jlong secs = time / 1000;
if (secs > max_secs) {
absTime->tv_sec = max_secs;
}
else {
} else {
absTime->tv_sec = secs;
}
absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC;
}
else {
} else {
jlong secs = time / NANOSECS_PER_SEC;
if (secs >= MAX_SECS) {
absTime->tv_sec = max_secs;
absTime->tv_nsec = 0;
}
else {
} else {
absTime->tv_sec = now.tv_sec + secs;
absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000;
if (absTime->tv_nsec >= NANOSECS_PER_SEC) {
@ -4562,7 +4559,7 @@ void Parker::unpark() {
}
/* Darwin has no "environ" in a dynamic library. */
// Darwin has no "environ" in a dynamic library.
#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
@ -4661,13 +4658,19 @@ bool os::is_headless_jre() {
// Get rid of libjvm.so
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// Get rid of client or server
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// check xawt/libmawt.so
strcpy(libmawtpath, buf);

View File

@ -30,7 +30,7 @@
// Information about the protection of the page at address '0' on this os.
static bool zero_page_read_protected() { return true; }
/* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */
// pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1
typedef int (*pthread_getattr_func_type)(pthread_t, pthread_attr_t *);
#ifdef __APPLE__

View File

@ -274,4 +274,8 @@ inline bool os::supports_monotonic_clock() {
#endif
}
inline void os::exit(int num) {
::exit(num);
}
#endif // OS_BSD_VM_OS_BSD_INLINE_HPP

View File

@ -150,13 +150,13 @@ static bool check_signals = true;
static pid_t _initial_pid = 0;
/* Signal number used to suspend/resume a thread */
// Signal number used to suspend/resume a thread
/* do not use any signal number less than SIGSEGV, see 4355769 */
// do not use any signal number less than SIGSEGV, see 4355769
static int SR_signum = SIGUSR2;
sigset_t SR_sigset;
/* Used to protect dlsym() calls */
// Used to protect dlsym() calls
static pthread_mutex_t dl_mutex;
// Declarations
@ -469,11 +469,12 @@ bool os::Linux::is_sig_ignored(int sig) {
sigaction(sig, (struct sigaction*)NULL, &oact);
void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oact.sa_handler);
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN))
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) {
return true;
else
} else {
return false;
}
}
void os::Linux::signal_sets_init() {
// Should also have an assertion stating we are still single-threaded.
@ -518,8 +519,9 @@ void os::Linux::signal_sets_init() {
}
// Fill in signals that are blocked by all but the VM thread.
sigemptyset(&vm_sigs);
if (!ReduceSignalUsage)
if (!ReduceSignalUsage) {
sigaddset(&vm_sigs, BREAK_SIGNAL);
}
debug_only(signal_sets_initialized = true);
}
@ -832,7 +834,8 @@ static void *java_start(Thread *thread) {
return 0;
}
bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
bool os::create_thread(Thread* thread, ThreadType thr_type,
size_t stack_size) {
assert(thread->osthread() == NULL, "caller responsible");
// Allocate the OSThread object
@ -1084,9 +1087,11 @@ bool os::Linux::is_initial_thread(void) {
initial_thread_stack_size() != 0,
"os::init did not locate initial thread's stack region");
if ((address)&dummy >= initial_thread_stack_bottom() &&
(address)&dummy < initial_thread_stack_bottom() + initial_thread_stack_size())
(address)&dummy < initial_thread_stack_bottom() + initial_thread_stack_size()) {
return true;
else return false;
} else {
return false;
}
}
// Find the virtual memory area that contains addr
@ -1136,8 +1141,9 @@ void os::Linux::capture_initial_stack(size_t max_size) {
// in case other parts in glibc still assumes 2M max stack size.
// FIXME: alt signal stack is gone, maybe we can relax this constraint?
// Problem still exists RH7.2 (IA64 anyway) but 2MB is a little small
if (stack_size > 2 * K * K IA64_ONLY(*2))
if (stack_size > 2 * K * K IA64_ONLY(*2)) {
stack_size = 2 * K * K IA64_ONLY(*2);
}
// Try to figure out where the stack base (top) is. This is harder.
//
// When an application is started, glibc saves the initial stack pointer in
@ -1221,35 +1227,35 @@ void os::Linux::capture_initial_stack(size_t max_size) {
#define _UFM UINTX_FORMAT
#define _DFM INTX_FORMAT
/* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */
/* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */
// 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
// 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM,
&state, /* 3 %c */
&ppid, /* 4 %d */
&pgrp, /* 5 %d */
&session, /* 6 %d */
&nr, /* 7 %d */
&tpgrp, /* 8 %d */
&flags, /* 9 %lu */
&minflt, /* 10 %lu */
&cminflt, /* 11 %lu */
&majflt, /* 12 %lu */
&cmajflt, /* 13 %lu */
&utime, /* 14 %lu */
&stime, /* 15 %lu */
&cutime, /* 16 %ld */
&cstime, /* 17 %ld */
&prio, /* 18 %ld */
&nice, /* 19 %ld */
&junk, /* 20 %ld */
&it_real, /* 21 %ld */
&start, /* 22 UINTX_FORMAT */
&vsize, /* 23 UINTX_FORMAT */
&rss, /* 24 INTX_FORMAT */
&rsslim, /* 25 UINTX_FORMAT */
&scodes, /* 26 UINTX_FORMAT */
&ecode, /* 27 UINTX_FORMAT */
&stack_start); /* 28 UINTX_FORMAT */
&state, // 3 %c
&ppid, // 4 %d
&pgrp, // 5 %d
&session, // 6 %d
&nr, // 7 %d
&tpgrp, // 8 %d
&flags, // 9 %lu
&minflt, // 10 %lu
&cminflt, // 11 %lu
&majflt, // 12 %lu
&cmajflt, // 13 %lu
&utime, // 14 %lu
&stime, // 15 %lu
&cutime, // 16 %ld
&cstime, // 17 %ld
&prio, // 18 %ld
&nice, // 19 %ld
&junk, // 20 %ld
&it_real, // 21 %ld
&start, // 22 UINTX_FORMAT
&vsize, // 23 UINTX_FORMAT
&rss, // 24 INTX_FORMAT
&rsslim, // 25 UINTX_FORMAT
&scodes, // 26 UINTX_FORMAT
&ecode, // 27 UINTX_FORMAT
&stack_start); // 28 UINTX_FORMAT
}
#undef _UFM
@ -1391,7 +1397,6 @@ void os::Linux::clock_init() {
}
#ifndef SYS_clock_getres
#if defined(IA32) || defined(AMD64)
#define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229)
#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
@ -1399,7 +1404,6 @@ void os::Linux::clock_init() {
#warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time"
#define sys_clock_getres(x,y) -1
#endif
#else
#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
#endif
@ -1425,7 +1429,6 @@ void os::Linux::fast_thread_clock_init() {
if (pthread_getcpuclockid_func &&
pthread_getcpuclockid_func(_main_thread, &clockid) == 0 &&
sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
_supports_fast_thread_cpu_time = true;
_pthread_getcpuclockid = pthread_getcpuclockid_func;
}
@ -1558,7 +1561,6 @@ void os::die() {
// from src/solaris/hpi/src/system_md.c
size_t os::lasterror(char *buf, size_t len) {
if (errno == 0) return 0;
const char *s = ::strerror(errno);
@ -1818,8 +1820,7 @@ class VM_LinuxDllLoad: public VM_Operation {
void* loaded_library() { return _lib; }
};
void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
void * result = NULL;
bool load_attempted = false;
@ -2033,7 +2034,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
return NULL;
}
void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
void * os::Linux::dlopen_helper(const char *filename, char *ebuf,
int ebuflen) {
void * result = ::dlopen(filename, RTLD_LAZY);
if (result == NULL) {
::strncpy(ebuf, ::dlerror(), ebuflen - 1);
@ -2042,7 +2044,8 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
return result;
}
void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, int ebuflen) {
void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf,
int ebuflen) {
void * result = NULL;
if (LoadExecStackDllInVMThread) {
result = dlopen_helper(filename, ebuf, ebuflen);
@ -2074,11 +2077,10 @@ void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, int ebu
return result;
}
/*
* glibc-2.0 libdl is not MT safe. If you are building with any glibc,
* chances are you might want to run the generated bits against glibc-2.0
* libdl.so, so always use locking for any version of glibc.
*/
// glibc-2.0 libdl is not MT safe. If you are building with any glibc,
// chances are you might want to run the generated bits against glibc-2.0
// libdl.so, so always use locking for any version of glibc.
//
void* os::dll_lookup(void* handle, const char* name) {
pthread_mutex_lock(&dl_mutex);
void* res = dlsym(handle, name);
@ -2342,8 +2344,9 @@ void os::jvm_path(char *buf, jint buflen) {
if (ret && dli_fname[0] != '\0') {
rp = realpath(dli_fname, buf);
}
if (rp == NULL)
if (rp == NULL) {
return;
}
if (Arguments::sun_java_launcher_is_altjvm()) {
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
@ -2371,8 +2374,9 @@ void os::jvm_path(char *buf, jint buflen) {
assert(strstr(p, "/libjvm") == p, "invalid library name");
rp = realpath(java_home_var, buf);
if (rp == NULL)
if (rp == NULL) {
return;
}
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
@ -2391,12 +2395,13 @@ void os::jvm_path(char *buf, jint buflen) {
} else {
// Go back to path of .so
rp = realpath(dli_fname, buf);
if (rp == NULL)
if (rp == NULL) {
return;
}
}
}
}
}
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
@ -2414,13 +2419,13 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
static volatile jint sigint_count = 0;
static void
UserHandler(int sig, void *siginfo, void *context) {
static void UserHandler(int sig, void *siginfo, void *context) {
// 4511530 - sem_post is serialized and handled by the manager thread. When
// the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
// don't want to flood the manager thread with sem_post requests.
if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1)
if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
return;
}
// Ctrl-C is pressed during error reporting, likely because the error
// handler fails to abort. Let VM die immediately.
@ -2523,10 +2528,8 @@ void os::signal_raise(int signal_number) {
::raise(signal_number);
}
/*
* The following code is moved from os.cpp for making this
* code platform specific, which it is by its very nature.
*/
// The following code is moved from os.cpp for making this
// code platform specific, which it is by its very nature.
// Will be modified when max signal is changed to be dynamic
int os::sigexitnum_pd() {
@ -2577,12 +2580,10 @@ static int check_pending_signals(bool wait) {
// were we externally suspended while we were waiting?
threadIsSuspended = thread->handle_special_suspend_equivalent_condition();
if (threadIsSuspended) {
//
// The semaphore has been incremented, but while we were waiting
// another thread suspended us. We don't want to continue running
// while suspended because that would surprise the thread that
// suspended us.
//
::sem_post(&sig_sem);
thread->java_suspend_self();
@ -2832,7 +2833,8 @@ bool os::get_page_info(char *start, page_info* info) {
return false;
}
char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
char *os::scan_pages(char *start, char* end, page_info* page_expected,
page_info* page_found) {
return end;
}
@ -2885,8 +2887,10 @@ bool os::Linux::libnuma_init() {
dlsym(RTLD_DEFAULT, "sched_getcpu")));
// If it's not, try a direct syscall.
if (sched_getcpu() == -1)
set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, (void*)&sched_getcpu_syscall));
if (sched_getcpu() == -1) {
set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t,
(void*)&sched_getcpu_syscall));
}
if (sched_getcpu() != -1) { // Does it work?
void *handle = dlopen("libnuma.so.1", RTLD_LAZY);
@ -2978,8 +2982,7 @@ bool os::pd_uncommit_memory(char* addr, size_t size) {
return res != (uintptr_t) MAP_FAILED;
}
static
address get_stack_commited_bottom(address bottom, size_t size) {
static address get_stack_commited_bottom(address bottom, size_t size) {
address nbot = bottom;
address ntop = bottom + size;
@ -3053,7 +3056,6 @@ address get_stack_commited_bottom(address bottom, size_t size) {
// mapping. This only affects the main/initial thread
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
if (os::Linux::is_initial_thread()) {
// As we manually grow stack up to bottom inside create_attached_thread(),
// it's likely that os::Linux::initial_thread_stack_bottom is mapped and
@ -3190,7 +3192,8 @@ bool os::unguard_memory(char* addr, size_t size) {
return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
}
bool os::Linux::transparent_huge_pages_sanity_check(bool warn, size_t page_size) {
bool os::Linux::transparent_huge_pages_sanity_check(bool warn,
size_t page_size) {
bool result = false;
void *p = mmap(NULL, page_size * 2, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE,
@ -3245,20 +3248,19 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
return result;
}
/*
* Set the coredump_filter bits to include largepages in core dump (bit 6)
*
* From the coredump_filter documentation:
*
* - (bit 0) anonymous private memory
* - (bit 1) anonymous shared memory
* - (bit 2) file-backed private memory
* - (bit 3) file-backed shared memory
* - (bit 4) ELF header pages in file-backed private memory areas (it is
* effective only if the bit 2 is cleared)
* - (bit 5) hugetlb private memory
* - (bit 6) hugetlb shared memory
*/
// Set the coredump_filter bits to include largepages in core dump (bit 6)
//
// From the coredump_filter documentation:
//
// - (bit 0) anonymous private memory
// - (bit 1) anonymous shared memory
// - (bit 2) file-backed private memory
// - (bit 3) file-backed shared memory
// - (bit 4) ELF header pages in file-backed private memory areas (it is
// effective only if the bit 2 is cleared)
// - (bit 5) hugetlb private memory
// - (bit 6) hugetlb shared memory
//
static void set_coredump_filter(void) {
FILE *f;
long cdm;
@ -3414,7 +3416,8 @@ void os::large_page_init() {
#define SHM_HUGETLB 04000
#endif
char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec) {
char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment,
char* req_addr, bool exec) {
// "exec" is passed in but not used. Creating the shared image for
// the code cache doesn't have an SHM_X executable permission to check.
assert(UseLargePages && UseSHM, "only for SHM large pages");
@ -3430,8 +3433,7 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char
bool warn_on_failure = UseLargePages &&
(!FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(UseSHM) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes)
);
!FLAG_IS_DEFAULT(LargePageSizeInBytes));
char msg[128];
// Create a large shared memory region to attach to based on size.
@ -3480,7 +3482,8 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char
return addr;
}
static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error) {
static void warn_on_large_pages_failure(char* req_addr, size_t bytes,
int error) {
assert(error == ENOMEM, "Only expect to fail if no memory is available");
bool warn_on_failure = UseLargePages &&
@ -3496,7 +3499,9 @@ static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error)
}
}
char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec) {
char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes,
char* req_addr,
bool exec) {
assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages");
assert(is_size_aligned(bytes, os::large_page_size()), "Unaligned size");
assert(is_ptr_aligned(req_addr, os::large_page_size()), "Unaligned address");
@ -3516,7 +3521,10 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_
return addr;
}
char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec) {
char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes,
size_t alignment,
char* req_addr,
bool exec) {
size_t large_page_size = os::large_page_size();
assert(bytes >= large_page_size, "Shouldn't allocate large pages for small sizes");
@ -3608,7 +3616,10 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t al
return start;
}
char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec) {
char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes,
size_t alignment,
char* req_addr,
bool exec) {
assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages");
assert(is_ptr_aligned(req_addr, alignment), "Must be");
assert(is_power_of_2(alignment), "Must be");
@ -3622,7 +3633,8 @@ char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignmen
}
}
char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, bool exec) {
char* os::reserve_memory_special(size_t bytes, size_t alignment,
char* req_addr, bool exec) {
assert(UseLargePages, "only for large pages");
char* addr;
@ -3792,7 +3804,6 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
//
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
@ -3811,8 +3822,7 @@ void os::naked_short_sleep(jlong ms) {
req.tv_sec = 0;
if (ms > 0) {
req.tv_nsec = (ms % 1000) * 1000000;
}
else {
} else {
req.tv_nsec = 1;
}
@ -3899,7 +3909,8 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
return (ret == 0) ? OS_OK : OS_ERR;
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
OSReturn os::get_native_priority(const Thread* const thread,
int *priority_ptr) {
if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
*priority_ptr = java_to_os_priority[NormPriority];
return OS_OK;
@ -3936,19 +3947,18 @@ void os::hint_no_preempt() {}
// - sends signal to end the sigsuspend loop in the SR_handler
//
// Note that the SR_lock plays no role in this suspend/resume protocol.
//
static void resume_clear_context(OSThread *osthread) {
osthread->set_ucontext(NULL);
osthread->set_siginfo(NULL);
}
static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo, ucontext_t* context) {
static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo,
ucontext_t* context) {
osthread->set_ucontext(context);
osthread->set_siginfo(siginfo);
}
//
// Handler function invoked when a thread's execution is suspended or
// resumed. We have to be careful that only async-safe functions are
// called here (Note: most pthread functions are not async safe and
@ -4018,7 +4028,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
static int SR_initialize() {
struct sigaction act;
char *s;
/* Get signal number to use for suspend/resume */
// Get signal number to use for suspend/resume
if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) {
int sig = ::strtol(s, 0, 10);
if (sig > 0 || sig < _NSIG) {
@ -4032,7 +4042,7 @@ static int SR_initialize() {
sigemptyset(&SR_sigset);
sigaddset(&SR_sigset, SR_signum);
/* Set up signal handler for suspend/resume */
// Set up signal handler for suspend/resume
act.sa_flags = SA_RESTART|SA_SIGINFO;
act.sa_handler = (void (*)(int)) SR_handler;
@ -4158,9 +4168,10 @@ static void do_resume(OSThread* osthread) {
// Note that the VM will print warnings if it detects conflicting signal
// handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
//
extern "C" JNIEXPORT int
JVM_handle_linux_signal(int signo, siginfo_t* siginfo,
void* ucontext, int abort_if_unrecognized);
extern "C" JNIEXPORT int JVM_handle_linux_signal(int signo,
siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
void signalHandler(int sig, siginfo_t* info, void* uc) {
assert(info != NULL && uc != NULL, "it must be old kernel");
@ -4482,14 +4493,16 @@ static void print_signal_handler(outputStream* st, int sig,
#define DO_SIGNAL_CHECK(sig) \
if (!sigismember(&check_signal_done, sig)) \
os::Linux::check_signal_handler(sig)
do { \
if (!sigismember(&check_signal_done, sig)) { \
os::Linux::check_signal_handler(sig); \
} \
} while (0)
// This method is a periodic task to check for misbehaving JNI applications
// under CheckJNI, we can add any periodic checks here
void os::run_periodic_checks() {
if (check_signals == false) return;
// SEGV and BUS if overridden could potentially prevent
@ -4600,7 +4613,8 @@ void os::Linux::check_signal_handler(int sig) {
}
}
extern void report_error(char* file_name, int line_no, char* title, char* format, ...);
extern void report_error(char* file_name, int line_no, char* title,
char* format, ...);
extern bool signal_name(int signo, char* buf, size_t len);
@ -4618,7 +4632,7 @@ const char* os::exception_name(int exception_code, char* buf, size_t size) {
// this is called _before_ the most of global arguments have been parsed
void os::init(void) {
char dummy; /* used to get a guess on initial stack address */
char dummy; // used to get a guess on initial stack address
// first_hrtime = gethrtime();
// With LinuxThreads the JavaMain thread pid (primordial thread)
@ -4691,8 +4705,7 @@ extern "C" {
}
// this is called _after_ the global arguments have been parsed
jint os::init_2(void)
{
jint os::init_2(void) {
Linux::fast_thread_clock_init();
// Allocate a single page and mark it as readable for safepoint polling
@ -4702,8 +4715,10 @@ jint os::init_2(void)
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
if (!UseMembar) {
@ -4712,8 +4727,10 @@ jint os::init_2(void)
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
}
@ -4801,17 +4818,19 @@ jint os::init_2(void)
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
}
}
}
// Initialize lock used to serialize thread creation (see os::create_thread)
Linux::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false));
@ -4854,16 +4873,17 @@ void os::init_3(void) {
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if (!guard_memory((char*)_polling_page, Linux::page_size()))
if (!guard_memory((char*)_polling_page, Linux::page_size())) {
fatal("Could not disable polling page");
};
}
}
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if (!linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
fatal("Could not enable polling page");
}
};
}
int os::active_processor_count() {
// Linux doesn't yet have a (official) notion of processor sets,
@ -4936,8 +4956,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) {
return fetcher.result();
}
int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
{
int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond,
pthread_mutex_t *_mutex,
const struct timespec *_abstime) {
if (is_NPTL()) {
return pthread_cond_timedwait(_cond, _mutex, _abstime);
} else {
@ -4984,8 +5005,9 @@ bool os::find(address addr, outputStream* st) {
if (begin < lowest) begin = lowest;
Dl_info dlinfo2;
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) {
end = (address) dlinfo2.dli_saddr;
}
Disassembler::decode(begin, end, st);
}
return true;
@ -5041,10 +5063,6 @@ bool os::check_heap(bool force) {
return true;
}
int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
return ::vsnprintf(buf, count, format, args);
}
// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
DIR *dir = NULL;
@ -5053,7 +5071,7 @@ bool os::dir_is_empty(const char* path) {
dir = opendir(path);
if (dir == NULL) return true;
/* Scan the directory */
// Scan the directory
bool result = true;
char buf[sizeof(struct dirent) + MAX_PATH];
while (result && (ptr = ::readdir(dir)) != NULL) {
@ -5077,7 +5095,6 @@ bool os::dir_is_empty(const char* path) {
// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
int os::open(const char *path, int oflag, int mode) {
if (strlen(path) > MAX_PATH - 1) {
errno = ENAMETOOLONG;
return -1;
@ -5107,34 +5124,34 @@ int os::open(const char *path, int oflag, int mode) {
}
}
/*
* All file descriptors that are opened in the JVM and not
* specifically destined for a subprocess should have the
* close-on-exec flag set. If we don't set it, then careless 3rd
* party native code might fork and exec without closing all
* appropriate file descriptors (e.g. as we do in closeDescriptors in
* UNIXProcess.c), and this in turn might:
*
* - cause end-of-file to fail to be detected on some file
* descriptors, resulting in mysterious hangs, or
*
* - might cause an fopen in the subprocess to fail on a system
* suffering from bug 1085341.
*
* (Yes, the default setting of the close-on-exec flag is a Unix
* design flaw)
*
* See:
* 1085341: 32-bit stdio routines should support file descriptors >255
* 4843136: (process) pipe file descriptor from Runtime.exec not being closed
* 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
*/
// All file descriptors that are opened in the JVM and not
// specifically destined for a subprocess should have the
// close-on-exec flag set. If we don't set it, then careless 3rd
// party native code might fork and exec without closing all
// appropriate file descriptors (e.g. as we do in closeDescriptors in
// UNIXProcess.c), and this in turn might:
//
// - cause end-of-file to fail to be detected on some file
// descriptors, resulting in mysterious hangs, or
//
// - might cause an fopen in the subprocess to fail on a system
// suffering from bug 1085341.
//
// (Yes, the default setting of the close-on-exec flag is a Unix
// design flaw)
//
// See:
// 1085341: 32-bit stdio routines should support file descriptors >255
// 4843136: (process) pipe file descriptor from Runtime.exec not being closed
// 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
//
#ifdef FD_CLOEXEC
{
int flags = ::fcntl(fd, F_GETFD);
if (flags != -1)
if (flags != -1) {
::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
}
}
#endif
if (o_delete != 0) {
@ -5174,11 +5191,9 @@ int os::available(int fd, jlong *bytes) {
if (::fstat64(fd, &buf64) >= 0) {
mode = buf64.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
/*
* XXX: is the following call interruptible? If so, this might
* need to go through the INTERRUPT_IO() wrapper as for other
* blocking, interruptible calls in this file.
*/
// XXX: is the following call interruptible? If so, this might
// need to go through the INTERRUPT_IO() wrapper as for other
// blocking, interruptible calls in this file.
int n;
if (::ioctl(fd, FIONREAD, &n) >= 0) {
*bytes = n;
@ -5304,10 +5319,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
}
}
//
// -1 on error.
//
static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
pid_t tid = thread->osthread()->thread_id();
char *s;
@ -5640,35 +5652,31 @@ void os::PlatformEvent::unpark() {
// JSR166
// -------------------------------------------------------
/*
* The solaris and linux implementations of park/unpark are fairly
* conservative for now, but can be improved. They currently use a
* mutex/condvar pair, plus a a count.
* Park decrements count if > 0, else does a condvar wait. Unpark
* sets count to 1 and signals condvar. Only one thread ever waits
* on the condvar. Contention seen when trying to park implies that someone
* is unparking you, so don't wait. And spurious returns are fine, so there
* is no need to track notifications.
*/
// The solaris and linux implementations of park/unpark are fairly
// conservative for now, but can be improved. They currently use a
// mutex/condvar pair, plus a a count.
// Park decrements count if > 0, else does a condvar wait. Unpark
// sets count to 1 and signals condvar. Only one thread ever waits
// on the condvar. Contention seen when trying to park implies that someone
// is unparking you, so don't wait. And spurious returns are fine, so there
// is no need to track notifications.
/*
* This code is common to linux and solaris and will be moved to a
* common place in dolphin.
*
* The passed in time value is either a relative time in nanoseconds
* or an absolute time in milliseconds. Either way it has to be unpacked
* into suitable seconds and nanoseconds components and stored in the
* given timespec structure.
* Given time is a 64-bit value and the time_t used in the timespec is only
* a signed-32-bit value (except on 64-bit Linux) we have to watch for
* overflow if times way in the future are given. Further on Solaris versions
* prior to 10 there is a restriction (see cond_timedwait) that the specified
* number of seconds, in abstime, is less than current_time + 100,000,000.
* As it will be 28 years before "now + 100000000" will overflow we can
* ignore overflow and just impose a hard-limit on seconds using the value
* of "now + 100,000,000". This places a limit on the timeout of about 3.17
* years from "now".
*/
// This code is common to linux and solaris and will be moved to a
// common place in dolphin.
//
// The passed in time value is either a relative time in nanoseconds
// or an absolute time in milliseconds. Either way it has to be unpacked
// into suitable seconds and nanoseconds components and stored in the
// given timespec structure.
// Given time is a 64-bit value and the time_t used in the timespec is only
// a signed-32-bit value (except on 64-bit Linux) we have to watch for
// overflow if times way in the future are given. Further on Solaris versions
// prior to 10 there is a restriction (see cond_timedwait) that the specified
// number of seconds, in abstime, is less than current_time + 100,000,000.
// As it will be 28 years before "now + 100000000" will overflow we can
// ignore overflow and just impose a hard-limit on seconds using the value
// of "now + 100,000,000". This places a limit on the timeout of about 3.17
// years from "now".
static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
assert(time > 0, "convertTime");
@ -5959,13 +5967,19 @@ bool os::is_headless_jre() {
// Get rid of libjvm.so
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// Get rid of client or server
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// check xawt/libmawt.so
strcpy(libmawtpath, buf);
@ -6052,7 +6066,6 @@ void MemNotifyThread::run() {
}
}
//
// See if the /dev/mem_notify device exists, and if so, start a thread to monitor it.
//
void MemNotifyThread::start() {

View File

@ -27,7 +27,7 @@
// Linux_OS defines the interface to Linux operating systems
/* pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1 */
// pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1
typedef int (*pthread_getattr_func_type)(pthread_t, pthread_attr_t *);
// Information about the protection of the page at address '0' on this os.

View File

@ -263,4 +263,8 @@ inline bool os::supports_monotonic_clock() {
return Linux::_clock_gettime != NULL;
}
inline void os::exit(int num) {
::exit(num);
}
#endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP

View File

@ -250,6 +250,7 @@ int generateJvmOffsets(GEN_variant gen_variant) {
printf("\n");
GEN_OFFS(nmethod, _method);
GEN_OFFS(nmethod, _dependencies_offset);
GEN_OFFS(nmethod, _metadata_offset);
GEN_OFFS(nmethod, _scopes_data_offset);
GEN_OFFS(nmethod, _scopes_pcs_offset);

View File

@ -595,7 +595,7 @@ static int nmethod_info(Nmethod_t *N)
/* scopes_pcs */
err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32);
CHECK_FAIL(err);
err = ps_pread(J->P, nm + OFFSET_nmethod_handler_table_offset, &N->scopes_pcs_end, SZ32);
err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32);
CHECK_FAIL(err);
/* scopes_data */

View File

@ -357,7 +357,8 @@ static volatile hrtime_t max_hrtime = 0;
void os::Solaris::initialize_system_info() {
set_processor_count(sysconf(_SC_NPROCESSORS_CONF));
_processors_online = sysconf(_SC_NPROCESSORS_ONLN);
_physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE);
_physical_memory = (julong)sysconf(_SC_PHYS_PAGES) *
(julong)sysconf(_SC_PAGESIZE);
}
int os::active_processor_count() {
@ -556,8 +557,7 @@ bool os::bind_to_processor(uint processor_id) {
bool os::getenv(const char* name, char* buffer, int len) {
char* val = ::getenv(name);
if (val == NULL
|| strlen(val) + 1 > len ) {
if (val == NULL || strlen(val) + 1 > len) {
if (len > 0) buffer[0] = 0; // return a null string
return false;
}
@ -780,8 +780,7 @@ void os::breakpoint() {
BREAKPOINT;
}
bool os::obsolete_option(const JavaVMOption *option)
{
bool os::obsolete_option(const JavaVMOption *option) {
if (!strncmp(option->optionString, "-Xt", 3)) {
return true;
} else if (!strncmp(option->optionString, "-Xtm", 4)) {
@ -906,7 +905,6 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) {
}
void os::Solaris::hotspot_sigmask(Thread* thread) {
//Save caller's signal mask
sigset_t sigmask;
thr_sigsetmask(SIG_SETMASK, NULL, &sigmask);
@ -970,7 +968,8 @@ bool os::create_main_thread(JavaThread* thread) {
}
bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
bool os::create_thread(Thread* thread, ThreadType thr_type,
size_t stack_size) {
// Allocate the OSThread object
OSThread* osthread = new OSThread(NULL, NULL);
if (osthread == NULL) {
@ -1088,11 +1087,11 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
return true;
}
/* defined for >= Solaris 10. This allows builds on earlier versions
* of Solaris to take advantage of the newly reserved Solaris JVM signals
* With SIGJVM1, SIGJVM2, INTERRUPT_SIGNAL is SIGJVM1, ASYNC_SIGNAL is SIGJVM2
* and -XX:+UseAltSigs does nothing since these should have no conflict
*/
// defined for >= Solaris 10. This allows builds on earlier versions
// of Solaris to take advantage of the newly reserved Solaris JVM signals
// With SIGJVM1, SIGJVM2, INTERRUPT_SIGNAL is SIGJVM1, ASYNC_SIGNAL is SIGJVM2
// and -XX:+UseAltSigs does nothing since these should have no conflict
//
#if !defined(SIGJVM1)
#define SIGJVM1 39
#define SIGJVM2 40
@ -1108,11 +1107,12 @@ bool os::Solaris::is_sig_ignored(int sig) {
sigaction(sig, (struct sigaction*)NULL, &oact);
void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oact.sa_handler);
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN))
if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) {
return true;
else
} else {
return false;
}
}
// Note: SIGRTMIN is a macro that calls sysconf() so it will
// dynamically detect SIGRTMIN value for the system at runtime, not buildtime
@ -1173,8 +1173,9 @@ void os::Solaris::signal_sets_init() {
}
// Fill in signals that are blocked by all but the VM thread.
sigemptyset(&vm_sigs);
if (!ReduceSignalUsage)
if (!ReduceSignalUsage) {
sigaddset(&vm_sigs, BREAK_SIGNAL);
}
debug_only(signal_sets_initialized = true);
// For diagnostics only used in run_periodic_checks
@ -1244,14 +1245,13 @@ void os::initialize_thread(Thread* thr) {
assert(stack_size > 0, "Stack size calculation problem");
if (stack_size > jt->stack_size()) {
NOT_PRODUCT(
#ifndef PRODUCT
struct rlimit limits;
getrlimit(RLIMIT_STACK, &limits);
size_t size = adjust_stack_size(base, (size_t)limits.rlim_cur);
assert(size >= jt->stack_size(), "Stack size problem in main thread");
)
tty->print_cr(
"Stack size of %d Kb exceeds current limit of %d Kb.\n"
#endif
tty->print_cr("Stack size of %d Kb exceeds current limit of %d Kb.\n"
"(Stack sizes are rounded up to a multiple of the system page size.)\n"
"See limit(1) to increase the stack size limit.",
stack_size / K, jt->stack_size() / K);
@ -1325,20 +1325,23 @@ int os::allocate_thread_local_storage() {
// JavaThread in Java code, and have stubs simply
// treat %g2 as a caller-save register, preserving it in a %lN.
thread_key_t tk;
if (thr_keycreate( &tk, NULL))
if (thr_keycreate(&tk, NULL)) {
fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed "
"(%s)", strerror(errno)));
}
return int(tk);
}
void os::free_thread_local_storage(int index) {
// %%% don't think we need anything here
// if ( pthread_key_delete((pthread_key_t) tk) )
// if (pthread_key_delete((pthread_key_t) tk)) {
// fatal("os::free_thread_local_storage: pthread_key_delete failed");
// }
}
#define SMALLINT 32 // libthread allocate for tsd_common is a version specific
// libthread allocate for tsd_common is a version specific
// small number - point is NO swap space available
#define SMALLINT 32
void os::thread_local_storage_at_put(int index, void* value) {
// %%% this is used only in threadLocalStorage.cpp
if (thr_setspecific((thread_key_t)index, value)) {
@ -1431,29 +1434,31 @@ bool os::supports_vtime() { return true; }
bool os::enable_vtime() {
int fd = ::open("/proc/self/ctl", O_WRONLY);
if (fd == -1)
if (fd == -1) {
return false;
}
long cmd[] = { PCSET, PR_MSACCT };
int res = ::write(fd, cmd, sizeof(long) * 2);
::close(fd);
if (res != sizeof(long) * 2)
if (res != sizeof(long) * 2) {
return false;
}
return true;
}
bool os::vtime_enabled() {
int fd = ::open("/proc/self/status", O_RDONLY);
if (fd == -1)
if (fd == -1) {
return false;
}
pstatus_t status;
int res = os::read(fd, (void*) &status, sizeof(pstatus_t));
::close(fd);
if (res != sizeof(pstatus_t))
if (res != sizeof(pstatus_t)) {
return false;
}
return status.pr_flags & PR_MSACCT;
}
@ -1471,8 +1476,9 @@ jlong getTimeMillis() {
// Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis
jlong os::javaTimeMillis() {
timeval t;
if (gettimeofday( &t, NULL) == -1)
if (gettimeofday(&t, NULL) == -1) {
fatal(err_msg("os::javaTimeMillis: gettimeofday (%s)", strerror(errno)));
}
return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000;
}
@ -1776,8 +1782,7 @@ void os::print_dll_info(outputStream * st) {
// in case of error it checks if .dll/.so was built for the
// same architecture as Hotspot is running on
void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
void * result= ::dlopen(filename, RTLD_LAZY);
if (result != NULL) {
// Successful loading
@ -2232,7 +2237,6 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
// from src/solaris/hpi/src/system_md.c
size_t os::lasterror(char *buf, size_t len) {
if (errno == 0) return 0;
const char *s = ::strerror(errno);
@ -2327,9 +2331,10 @@ void* os::signal(int signal_number, void* handler) {
sigAct.sa_flags = SA_RESTART & ~SA_RESETHAND;
sigAct.sa_handler = CAST_TO_FN_PTR(sa_handler_t, handler);
if (sigaction(signal_number, &sigAct, &oldSigAct))
if (sigaction(signal_number, &sigAct, &oldSigAct)) {
// -1 means registration failed
return (void *)-1;
}
return CAST_FROM_FN_PTR(void*, oldSigAct.sa_handler);
}
@ -2338,10 +2343,8 @@ void os::signal_raise(int signal_number) {
raise(signal_number);
}
/*
* The following code is moved from os.cpp for making this
* code platform specific, which it is by its very nature.
*/
// The following code is moved from os.cpp for making this
// code platform specific, which it is by its very nature.
// a counter for each possible signal value
static int Sigexit = 0;
@ -2424,12 +2427,10 @@ static int check_pending_signals(bool wait_for_signal) {
// were we externally suspended while we were waiting?
threadIsSuspended = thread->handle_special_suspend_equivalent_condition();
if (threadIsSuspended) {
//
// The semaphore has been incremented, but while we were waiting
// another thread suspended us. We don't want to continue running
// while suspended because that would surprise the thread that
// suspended us.
//
ret = ::sema_post(&sig_sem);
assert(ret == 0, "sema_post() failed");
@ -2538,29 +2539,30 @@ void os::pd_commit_memory_or_exit(char* addr, size_t bytes, bool exec,
}
}
size_t os::Solaris::page_size_for_alignment(size_t alignment) {
assert(is_size_aligned(alignment, (size_t) vm_page_size()),
err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT,
alignment, (size_t) vm_page_size()));
for (int i = 0; _page_sizes[i] != 0; i++) {
if (is_size_aligned(alignment, _page_sizes[i])) {
return _page_sizes[i];
}
}
return (size_t) vm_page_size();
}
int os::Solaris::commit_memory_impl(char* addr, size_t bytes,
size_t alignment_hint, bool exec) {
int err = Solaris::commit_memory_impl(addr, bytes, exec);
if (err == 0) {
if (UseLargePages && (alignment_hint > (size_t)vm_page_size())) {
// If the large page size has been set and the VM
// is using large pages, use the large page size
// if it is smaller than the alignment hint. This is
// a case where the VM wants to use a larger alignment size
// for its own reasons but still want to use large pages
// (which is what matters to setting the mpss range.
size_t page_size = 0;
if (large_page_size() < alignment_hint) {
assert(UseLargePages, "Expected to be here for large page use only");
page_size = large_page_size();
} else {
// If the alignment hint is less than the large page
// size, the VM wants a particular alignment (thus the hint)
// for internal reasons. Try to set the mpss range using
// the alignment_hint.
page_size = alignment_hint;
}
// Since this is a hint, ignore any failures.
if (err == 0 && UseLargePages && alignment_hint > 0) {
assert(is_size_aligned(bytes, alignment_hint),
err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint));
// The syscall memcntl requires an exact page size (see man memcntl for details).
size_t page_size = page_size_for_alignment(alignment_hint);
if (page_size > (size_t) vm_page_size()) {
(void)Solaris::setup_large_pages(addr, bytes, page_size);
}
}
@ -2727,7 +2729,8 @@ bool os::get_page_info(char *start, page_info* info) {
// Scan the pages from start to end until a page different than
// the one described in the info parameter is encountered.
char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
char *os::scan_pages(char *start, char* end, page_info* page_expected,
page_info* page_found) {
const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE };
const size_t types = sizeof(info_types) / sizeof(info_types[0]);
uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1];
@ -2754,8 +2757,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info
if (outdata[types * i + 1] != page_expected->size) {
break;
}
} else
if (page_expected->size != 0) {
} else if (page_expected->size != 0) {
break;
}
@ -2808,11 +2810,13 @@ char* os::Solaris::mmap_chunk(char *addr, size_t size, int flags, int prot) {
return b;
}
char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed) {
char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes,
size_t alignment_hint, bool fixed) {
char* addr = requested_addr;
int flags = MAP_PRIVATE | MAP_NORESERVE;
assert(!(fixed && (alignment_hint > 0)), "alignment hint meaningless with fixed mmap");
assert(!(fixed && (alignment_hint > 0)),
"alignment hint meaningless with fixed mmap");
if (fixed) {
flags |= MAP_FIXED;
@ -2827,8 +2831,10 @@ char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, size_t alignmen
return mmap_chunk(addr, bytes, flags, PROT_NONE);
}
char* os::pd_reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) {
char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL));
char* os::pd_reserve_memory(size_t bytes, char* requested_addr,
size_t alignment_hint) {
char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint,
(requested_addr != NULL));
guarantee(requested_addr == NULL || requested_addr == addr,
"OS failed to return requested mmap address.");
@ -3093,7 +3099,22 @@ void os::large_page_init() {
}
}
bool os::Solaris::is_valid_page_size(size_t bytes) {
for (int i = 0; _page_sizes[i] != 0; i++) {
if (_page_sizes[i] == bytes) {
return true;
}
}
return false;
}
bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) {
assert(is_valid_page_size(align), err_msg(SIZE_FORMAT " is not a valid page size", align));
assert(is_ptr_aligned((void*) start, align),
err_msg(PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align));
assert(is_size_aligned(bytes, align),
err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align));
// Signal to OS that we want large pages for addresses
// from addr, addr + bytes
struct memcntl_mha mpss_struct;
@ -3108,7 +3129,8 @@ bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) {
return true;
}
char* os::reserve_memory_special(size_t size, size_t alignment, char* addr, bool exec) {
char* os::reserve_memory_special(size_t size, size_t alignment, char* addr,
bool exec) {
fatal("os::reserve_memory_special should not be called on Solaris.");
return NULL;
}
@ -3173,14 +3195,14 @@ bool os::dont_yield() {
static hrtime_t last_time = 0;
hrtime_t diff = getTimeNanos() - last_time;
if (diff < DontYieldALotInterval * 1000000)
if (diff < DontYieldALotInterval * 1000000) {
return true;
}
last_time += diff;
return false;
}
else {
} else {
return false;
}
}
@ -3375,8 +3397,10 @@ static int lwp_priocntl_init() {
myMax = MIN2(myMax, (int)fxInfo->fx_uprilim); // clamp - restrict
} else {
// No clue - punt
if (ThreadPriorityVerbose)
tty->print_cr("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
if (ThreadPriorityVerbose) {
tty->print_cr("Unknown scheduling class: %s ... \n",
ClassInfo.pc_clname);
}
return EINVAL; // no clue, punt
}
@ -3399,9 +3423,7 @@ static int lwp_priocntl_init() {
// Convert from the libthread "thr_setprio" scale to our current
// lwp scheduling class scale.
//
static
int scale_to_lwp_priority (int rMin, int rMax, int x)
{
static int scale_to_lwp_priority(int rMin, int rMax, int x) {
int v;
if (x == 127) return rMax; // avoid round-down
@ -3428,8 +3450,9 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
// If something went wrong on init, don't change priorities.
if (!priocntl_enable) {
if (ThreadPriorityVerbose)
if (ThreadPriorityVerbose) {
tty->print_cr("Trying to set priority but init failed, ignoring");
}
return EINVAL;
}
@ -3591,7 +3614,6 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
// Maximum priority an so on. This will cause VM threads
// to get unfair treatment against other Solaris processes
// which do not explicitly alter their thread priorities.
//
int os::java_to_os_priority[CriticalPriority + 1] = {
-99999, // 0 Entry should never be used
@ -3654,7 +3676,8 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
OSReturn os::get_native_priority(const Thread* const thread,
int *priority_ptr) {
int p;
if (!UseThreadPriorities) {
*priority_ptr = NormalPriority;
@ -3883,7 +3906,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) {
// This does not do anything on Solaris. This is basically a hook for being
// able to use structured exception handling (thread-local exception filters) on, e.g., Win32.
void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
void os::os_exception_wrapper(java_call_t f, JavaValue* value,
methodHandle* method, JavaCallArguments* args,
Thread* thread) {
f(value, method, args, thread);
}
@ -3914,8 +3939,9 @@ void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* met
// Note that the VM will print warnings if it detects conflicting signal
// handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
//
extern "C" JNIEXPORT int
JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext,
extern "C" JNIEXPORT int JVM_handle_solaris_signal(int signo,
siginfo_t* siginfo,
void* ucontext,
int abort_if_unrecognized);
@ -3925,11 +3951,11 @@ void signalHandler(int sig, siginfo_t* info, void* ucVoid) {
errno = orig_errno;
}
/* Do not delete - if guarantee is ever removed, a signal handler (even empty)
is needed to provoke threads blocked on IO to return an EINTR
Note: this explicitly does NOT call JVM_handle_solaris_signal and
does NOT participate in signal chaining due to requirement for
NOT setting SA_RESTART to make EINTR work. */
// Do not delete - if guarantee is ever removed, a signal handler (even empty)
// is needed to provoke threads blocked on IO to return an EINTR
// Note: this explicitly does NOT call JVM_handle_solaris_signal and
// does NOT participate in signal chaining due to requirement for
// NOT setting SA_RESTART to make EINTR work.
extern "C" void sigINTRHandler(int sig, siginfo_t* info, void* ucVoid) {
if (UseSignalChaining) {
struct sigaction *actp = os::Solaris::get_chained_signal_action(sig);
@ -4021,26 +4047,30 @@ bool os::Solaris::chained_handler(int sig, siginfo_t* siginfo, void* context) {
}
struct sigaction* os::Solaris::get_preinstalled_handler(int sig) {
assert((chainedsigactions != (struct sigaction *)NULL) && (preinstalled_sigs != (int *)NULL) , "signals not yet initialized");
assert((chainedsigactions != (struct sigaction *)NULL) &&
(preinstalled_sigs != (int *)NULL), "signals not yet initialized");
if (preinstalled_sigs[sig] != 0) {
return &chainedsigactions[sig];
}
return NULL;
}
void os::Solaris::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
void os::Solaris::save_preinstalled_handler(int sig,
struct sigaction& oldAct) {
assert(sig > 0 && sig <= Maxsignum, "vm signal out of expected range");
assert((chainedsigactions != (struct sigaction *)NULL) && (preinstalled_sigs != (int *)NULL) , "signals not yet initialized");
assert((chainedsigactions != (struct sigaction *)NULL) &&
(preinstalled_sigs != (int *)NULL), "signals not yet initialized");
chainedsigactions[sig] = oldAct;
preinstalled_sigs[sig] = 1;
}
void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain) {
void os::Solaris::set_signal_handler(int sig, bool set_installed,
bool oktochain) {
// Check for overwrite.
struct sigaction oldAct;
sigaction(sig, (struct sigaction*)NULL, &oldAct);
void* oldhand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
void* oldhand =
oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler);
if (oldhand != CAST_FROM_FN_PTR(void*, SIG_DFL) &&
oldhand != CAST_FROM_FN_PTR(void*, SIG_IGN) &&
@ -4072,9 +4102,9 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain
// not using stack banging
if (!UseStackBanging && sig == SIGSEGV) {
sigAct.sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK;
} else if (sig == os::Solaris::SIGinterrupt()) {
// Interruptible i/o requires SA_RESTART cleared so EINTR
// is returned instead of restarting system calls
} else if (sig == os::Solaris::SIGinterrupt()) {
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = NULL;
sigAct.sa_flags = SA_SIGINFO;
@ -4093,8 +4123,11 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain
#define DO_SIGNAL_CHECK(sig) \
if (!sigismember(&check_signal_done, sig)) \
os::Solaris::check_signal_handler(sig)
do { \
if (!sigismember(&check_signal_done, sig)) { \
os::Solaris::check_signal_handler(sig); \
} \
} while (0)
// This method is a periodic task to check for misbehaving JNI applications
// under CheckJNI, we can add any periodic checks here
@ -4288,7 +4321,8 @@ void os::Solaris::install_signal_handlers() {
}
void report_error(const char* file_name, int line_no, const char* title, const char* format, ...);
void report_error(const char* file_name, int line_no, const char* title,
const char* format, ...);
const char * signames[] = {
"SIG0",
@ -4402,8 +4436,7 @@ void os::Solaris::synchronization_init() {
os::Solaris::set_cond_init(lwp_cond_init);
os::Solaris::set_cond_destroy(lwp_cond_destroy);
os::Solaris::set_cond_scope(USYNC_THREAD);
}
else {
} else {
os::Solaris::set_mutex_scope(USYNC_THREAD);
os::Solaris::set_cond_scope(USYNC_THREAD);
@ -4420,8 +4453,7 @@ void os::Solaris::synchronization_init() {
os::Solaris::set_cond_broadcast(CAST_TO_FN_PTR(int_fnP_cond_tP, resolve_symbol("pthread_cond_broadcast")));
os::Solaris::set_cond_init(pthread_cond_default_init);
os::Solaris::set_cond_destroy(CAST_TO_FN_PTR(int_fnP_cond_tP, resolve_symbol("pthread_cond_destroy")));
}
else {
} else {
os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_lock")));
os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_trylock")));
os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_unlock")));
@ -4502,9 +4534,10 @@ void os::init(void) {
init_random(1234567);
page_size = sysconf(_SC_PAGESIZE);
if (page_size == -1)
if (page_size == -1) {
fatal(err_msg("os_solaris.cpp: os::init: sysconf failed (%s)",
strerror(errno)));
}
init_page_sizes((size_t) page_size);
Solaris::initialize_system_info();
@ -4530,8 +4563,9 @@ void os::init(void) {
// and is available on linker patches for 5.7 and 5.8.
// libdl.so must have been loaded, this call is just an entry lookup
void * hdl = dlopen("libdl.so", RTLD_NOW);
if (hdl)
if (hdl) {
dladdr1_func = CAST_TO_FN_PTR(dladdr1_func_type, dlsym(hdl, "dladdr1"));
}
// (Solaris only) this switches to calls that actually do locking.
ThreadCritical::initialize();
@ -4579,8 +4613,10 @@ jint os::init_2(void) {
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
if (!UseMembar) {
@ -4589,8 +4625,10 @@ jint os::init_2(void) {
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
}
@ -4669,17 +4707,19 @@ jint os::init_2(void) {
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
}
}
}
// Calculate theoretical max. size of Threads to guard gainst
// artifical out-of-memory situations, where all available address-
@ -4728,41 +4768,22 @@ void os::init_3(void) {
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0)
if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0) {
fatal("Could not disable polling page");
};
}
}
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0)
if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0) {
fatal("Could not enable polling page");
};
}
}
// OS interface.
bool os::check_heap(bool force) { return true; }
typedef int (*vsnprintf_t)(char* buf, size_t count, const char* fmt, va_list argptr);
static vsnprintf_t sol_vsnprintf = NULL;
int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) {
if (!sol_vsnprintf) {
//search for the named symbol in the objects that were loaded after libjvm
void* where = RTLD_NEXT;
if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL)
sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf"));
if (!sol_vsnprintf){
//search for the named symbol in the objects that were loaded before libjvm
where = RTLD_DEFAULT;
if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL)
sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf"));
assert(sol_vsnprintf != NULL, "vsnprintf not found");
}
}
return (*sol_vsnprintf)(buf, count, fmt, argptr);
}
// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
DIR *dir = NULL;
@ -4771,7 +4792,7 @@ bool os::dir_is_empty(const char* path) {
dir = opendir(path);
if (dir == NULL) return true;
/* Scan the directory */
// Scan the directory
bool result = true;
char buf[sizeof(struct dirent) + MAX_PATH];
struct dirent *dbuf = (struct dirent *) buf;
@ -4824,40 +4845,40 @@ int os::open(const char *path, int oflag, int mode) {
return -1;
}
}
/*
* 32-bit Solaris systems suffer from:
*
* - an historical default soft limit of 256 per-process file
* descriptors that is too low for many Java programs.
*
* - a design flaw where file descriptors created using stdio
* fopen must be less than 256, _even_ when the first limit above
* has been raised. This can cause calls to fopen (but not calls to
* open, for example) to fail mysteriously, perhaps in 3rd party
* native code (although the JDK itself uses fopen). One can hardly
* criticize them for using this most standard of all functions.
*
* We attempt to make everything work anyways by:
*
* - raising the soft limit on per-process file descriptors beyond
* 256
*
* - As of Solaris 10u4, we can request that Solaris raise the 256
* stdio fopen limit by calling function enable_extended_FILE_stdio.
* This is done in init_2 and recorded in enabled_extended_FILE_stdio
*
* - If we are stuck on an old (pre 10u4) Solaris system, we can
* workaround the bug by remapping non-stdio file descriptors below
* 256 to ones beyond 256, which is done below.
*
* See:
* 1085341: 32-bit stdio routines should support file descriptors >255
* 6533291: Work around 32-bit Solaris stdio limit of 256 open files
* 6431278: Netbeans crash on 32 bit Solaris: need to call
* enable_extended_FILE_stdio() in VM initialisation
* Giri Mandalika's blog
* http://technopark02.blogspot.com/2005_05_01_archive.html
*/
// 32-bit Solaris systems suffer from:
//
// - an historical default soft limit of 256 per-process file
// descriptors that is too low for many Java programs.
//
// - a design flaw where file descriptors created using stdio
// fopen must be less than 256, _even_ when the first limit above
// has been raised. This can cause calls to fopen (but not calls to
// open, for example) to fail mysteriously, perhaps in 3rd party
// native code (although the JDK itself uses fopen). One can hardly
// criticize them for using this most standard of all functions.
//
// We attempt to make everything work anyways by:
//
// - raising the soft limit on per-process file descriptors beyond
// 256
//
// - As of Solaris 10u4, we can request that Solaris raise the 256
// stdio fopen limit by calling function enable_extended_FILE_stdio.
// This is done in init_2 and recorded in enabled_extended_FILE_stdio
//
// - If we are stuck on an old (pre 10u4) Solaris system, we can
// workaround the bug by remapping non-stdio file descriptors below
// 256 to ones beyond 256, which is done below.
//
// See:
// 1085341: 32-bit stdio routines should support file descriptors >255
// 6533291: Work around 32-bit Solaris stdio limit of 256 open files
// 6431278: Netbeans crash on 32 bit Solaris: need to call
// enable_extended_FILE_stdio() in VM initialisation
// Giri Mandalika's blog
// http://technopark02.blogspot.com/2005_05_01_archive.html
//
#ifndef _LP64
if ((!enabled_extended_FILE_stdio) && fd < 256) {
int newfd = ::fcntl(fd, F_DUPFD, 256);
@ -4867,34 +4888,35 @@ int os::open(const char *path, int oflag, int mode) {
}
}
#endif // 32-bit Solaris
/*
* All file descriptors that are opened in the JVM and not
* specifically destined for a subprocess should have the
* close-on-exec flag set. If we don't set it, then careless 3rd
* party native code might fork and exec without closing all
* appropriate file descriptors (e.g. as we do in closeDescriptors in
* UNIXProcess.c), and this in turn might:
*
* - cause end-of-file to fail to be detected on some file
* descriptors, resulting in mysterious hangs, or
*
* - might cause an fopen in the subprocess to fail on a system
* suffering from bug 1085341.
*
* (Yes, the default setting of the close-on-exec flag is a Unix
* design flaw)
*
* See:
* 1085341: 32-bit stdio routines should support file descriptors >255
* 4843136: (process) pipe file descriptor from Runtime.exec not being closed
* 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
*/
// All file descriptors that are opened in the JVM and not
// specifically destined for a subprocess should have the
// close-on-exec flag set. If we don't set it, then careless 3rd
// party native code might fork and exec without closing all
// appropriate file descriptors (e.g. as we do in closeDescriptors in
// UNIXProcess.c), and this in turn might:
//
// - cause end-of-file to fail to be detected on some file
// descriptors, resulting in mysterious hangs, or
//
// - might cause an fopen in the subprocess to fail on a system
// suffering from bug 1085341.
//
// (Yes, the default setting of the close-on-exec flag is a Unix
// design flaw)
//
// See:
// 1085341: 32-bit stdio routines should support file descriptors >255
// 4843136: (process) pipe file descriptor from Runtime.exec not being closed
// 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
//
#ifdef FD_CLOEXEC
{
int flags = ::fcntl(fd, F_GETFD);
if (flags != -1)
if (flags != -1) {
::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
}
}
#endif
if (o_delete != 0) {
@ -5048,8 +5070,7 @@ void record_synch(char* name, bool returning); // defined below
class RecordSynch {
char* _name;
public:
RecordSynch(char* name) :_name(name)
{ record_synch(_name, false); }
RecordSynch(char* name) :_name(name) { record_synch(_name, false); }
~RecordSynch() { record_synch(_name, true); }
};
@ -5288,10 +5309,11 @@ bool os::find(address addr, outputStream* st) {
st->print(PTR_FORMAT ": ", addr);
if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
} else if (dlinfo.dli_fbase != NULL)
} else if (dlinfo.dli_fbase != NULL) {
st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
else
} else {
st->print("<absolute address>");
}
if (dlinfo.dli_fname != NULL) {
st->print(" in %s", dlinfo.dli_fname);
}
@ -5309,8 +5331,9 @@ bool os::find(address addr, outputStream* st) {
if (begin < lowest) begin = lowest;
Dl_info dlinfo2;
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) {
end = (address) dlinfo2.dli_saddr;
}
Disassembler::decode(begin, end, st);
}
return true;
@ -5567,36 +5590,34 @@ void os::PlatformEvent::unpark() {
// JSR166
// -------------------------------------------------------
/*
* The solaris and linux implementations of park/unpark are fairly
* conservative for now, but can be improved. They currently use a
* mutex/condvar pair, plus _counter.
* Park decrements _counter if > 0, else does a condvar wait. Unpark
* sets count to 1 and signals condvar. Only one thread ever waits
* on the condvar. Contention seen when trying to park implies that someone
* is unparking you, so don't wait. And spurious returns are fine, so there
* is no need to track notifications.
*/
// The solaris and linux implementations of park/unpark are fairly
// conservative for now, but can be improved. They currently use a
// mutex/condvar pair, plus _counter.
// Park decrements _counter if > 0, else does a condvar wait. Unpark
// sets count to 1 and signals condvar. Only one thread ever waits
// on the condvar. Contention seen when trying to park implies that someone
// is unparking you, so don't wait. And spurious returns are fine, so there
// is no need to track notifications.
#define MAX_SECS 100000000
/*
* This code is common to linux and solaris and will be moved to a
* common place in dolphin.
*
* The passed in time value is either a relative time in nanoseconds
* or an absolute time in milliseconds. Either way it has to be unpacked
* into suitable seconds and nanoseconds components and stored in the
* given timespec structure.
* Given time is a 64-bit value and the time_t used in the timespec is only
* a signed-32-bit value (except on 64-bit Linux) we have to watch for
* overflow if times way in the future are given. Further on Solaris versions
* prior to 10 there is a restriction (see cond_timedwait) that the specified
* number of seconds, in abstime, is less than current_time + 100,000,000.
* As it will be 28 years before "now + 100000000" will overflow we can
* ignore overflow and just impose a hard-limit on seconds using the value
* of "now + 100,000,000". This places a limit on the timeout of about 3.17
* years from "now".
*/
// This code is common to linux and solaris and will be moved to a
// common place in dolphin.
//
// The passed in time value is either a relative time in nanoseconds
// or an absolute time in milliseconds. Either way it has to be unpacked
// into suitable seconds and nanoseconds components and stored in the
// given timespec structure.
// Given time is a 64-bit value and the time_t used in the timespec is only
// a signed-32-bit value (except on 64-bit Linux) we have to watch for
// overflow if times way in the future are given. Further on Solaris versions
// prior to 10 there is a restriction (see cond_timedwait) that the specified
// number of seconds, in abstime, is less than current_time + 100,000,000.
// As it will be 28 years before "now + 100000000" will overflow we can
// ignore overflow and just impose a hard-limit on seconds using the value
// of "now + 100,000,000". This places a limit on the timeout of about 3.17
// years from "now".
//
static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
assert(time > 0, "convertTime");
@ -5610,19 +5631,16 @@ static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
jlong secs = time / 1000;
if (secs > max_secs) {
absTime->tv_sec = max_secs;
}
else {
} else {
absTime->tv_sec = secs;
}
absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC;
}
else {
} else {
jlong secs = time / NANOSECS_PER_SEC;
if (secs >= MAX_SECS) {
absTime->tv_sec = max_secs;
absTime->tv_nsec = 0;
}
else {
} else {
absTime->tv_sec = now.tv_sec + secs;
absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000;
if (absTime->tv_nsec >= NANOSECS_PER_SEC) {
@ -5844,13 +5862,19 @@ bool os::is_headless_jre() {
// Get rid of libjvm.so
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// Get rid of client or server
p = strrchr(buf, '/');
if (p == NULL) return false;
else *p = '\0';
if (p == NULL) {
return false;
} else {
*p = '\0';
}
// check xawt/libmawt.so
strcpy(libmawtpath, buf);
@ -5924,8 +5948,9 @@ int os::timeout(int fd, long timeout) {
gettimeofday(&t, &aNull);
newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000;
timeout -= newtime - prevtime;
if (timeout <= 0)
if (timeout <= 0) {
return OS_OK;
}
prevtime = newtime;
}
} else return res;
@ -5956,12 +5981,12 @@ int os::connect(int fd, struct sockaddr *him, socklen_t len) {
//
// EISCONN The socket is already connected.
if (_result == OS_ERR && errno == EINTR) {
/* restarting a connect() changes its errno semantics */
// restarting a connect() changes its errno semantics
RESTARTABLE(::connect(fd, him, len), _result);
/* undo these changes */
// undo these changes
if (_result == OS_ERR) {
if (errno == EALREADY) {
errno = EINPROGRESS; /* fall through */
errno = EINPROGRESS; // fall through
} else if (errno == EISCONN) {
errno = 0;
return OS_OK;

View File

@ -61,8 +61,8 @@ class Solaris {
typedef id_t lgrp_id_t;
typedef int lgrp_rsrc_t;
typedef enum lgrp_view {
LGRP_VIEW_CALLER, /* what's available to the caller */
LGRP_VIEW_OS /* what's available to operating system */
LGRP_VIEW_CALLER, // what's available to the caller
LGRP_VIEW_OS // what's available to operating system
} lgrp_view_t;
typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
@ -97,6 +97,8 @@ class Solaris {
static meminfo_func_t _meminfo;
// Large Page Support
static bool is_valid_page_size(size_t bytes);
static size_t page_size_for_alignment(size_t alignment);
static bool setup_large_pages(caddr_t start, size_t bytes, size_t align);
static void init_thread_fpu_state(void);
@ -216,8 +218,7 @@ class Solaris {
static void set_mutex_destroy(int_fnP_mutex_tP func) { _mutex_destroy = func; }
static void set_mutex_scope(int scope) { _mutex_scope = scope; }
static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst)
{ return _cond_timedwait(cv, mx, abst); }
static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) { return _cond_timedwait(cv, mx, abst); }
static int cond_wait(cond_t *cv, mutex_t *mx) { return _cond_wait(cv, mx); }
static int cond_signal(cond_t *cv) { return _cond_signal(cv); }
static int cond_broadcast(cond_t *cv) { return _cond_broadcast(cv); }
@ -225,8 +226,7 @@ class Solaris {
static int cond_destroy(cond_t *cv) { return _cond_destroy(cv); }
static int cond_scope() { return _cond_scope; }
static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func)
{ _cond_timedwait = func; }
static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) { _cond_timedwait = func; }
static void set_cond_wait(int_fnP_cond_tP_mutex_tP func) { _cond_wait = func; }
static void set_cond_signal(int_fnP_cond_tP func) { _cond_signal = func; }
static void set_cond_broadcast(int_fnP_cond_tP func) { _cond_broadcast = func; }
@ -247,7 +247,7 @@ class Solaris {
static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; }
static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; }
static int lgrp_fini(lgrp_cookie_t cookie) { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; }
static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; };
static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }
static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent,
lgrp_id_t *lgrp_array, uint_t lgrp_array_size) {
return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1;

View File

@ -157,4 +157,8 @@ inline bool os::supports_monotonic_clock() {
return true;
}
inline void os::exit(int num) {
::exit(num);
}
#endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ static const char* path_separator() { return ";"; }
class win32 {
friend class os;
friend unsigned __stdcall java_start(class Thread*);
protected:
static int _vm_page_size;
@ -47,6 +48,7 @@ class win32 {
static bool _is_nt;
static bool _is_windows_2003;
static bool _is_windows_server;
static bool _has_exit_bug;
static bool _has_performance_count;
static void print_windows_version(outputStream* st);
@ -70,6 +72,10 @@ class win32 {
static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
private:
enum Ept { EPT_THREAD, EPT_PROCESS, EPT_PROCESS_DIE };
// Wrapper around _endthreadex(), exit() and _exit()
static int exit_process_or_thread(Ept what, int exit_code);
static void initialize_performance_counter();
public:
@ -88,6 +94,9 @@ class win32 {
// Tells whether the platform is Windows 2003
static bool is_windows_2003() { return _is_windows_2003; }
// Tells whether there can be the race bug during process exit on this platform
static bool has_exit_bug() { return _has_exit_bug; }
// Returns the byte size of a virtual memory page
static int vm_page_size() { return _vm_page_size; }

View File

@ -100,6 +100,10 @@ inline bool os::supports_monotonic_clock() {
return win32::_has_performance_count;
}
inline void os::exit(int num) {
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}
#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
os::win32::call_test_func_with_wrapper(f)

View File

@ -1,156 +0,0 @@
import static java.nio.file.FileVisitResult.CONTINUE;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Stack;
import java.util.Vector;
public class FileTreeCreatorVC7 extends FileTreeCreator {
public FileTreeCreatorVC7(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) {
super(startDir, allConfigs, wg);
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attr) {
DirAttributes currentFileAttr = attributes.peek().clone();
boolean usePch = false;
boolean disablePch = false;
boolean useIgnore = false;
String fileName = file.getFileName().toString();
// usePch applies to all configs for a file.
if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) {
usePch = true;
}
for (BuildConfig cfg : allConfigs) {
if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) {
useIgnore = true;
currentFileAttr.setIgnore(cfg);
} else if (cfg.matchesIgnoredPath(file.toAbsolutePath().toString())) {
useIgnore = true;
currentFileAttr.setIgnore(cfg);
}
if (cfg.lookupHashFieldInContext("DisablePch", fileName) != null) {
disablePch = true;
currentFileAttr.setDisablePch(cfg);
}
Vector<String> rv = new Vector<String>();
cfg.collectRelevantVectors(rv, "AdditionalFile");
for(String addFile : rv) {
if (addFile.equals(fileName)) {
// supress any ignore
currentFileAttr.removeFromIgnored(cfg);
}
}
}
if (!useIgnore && !disablePch && !usePch) {
wg.tag("File", new String[] { "RelativePath", vcProjLocation.relativize(file).toString()});
} else {
wg.startTag(
"File",
new String[] { "RelativePath", vcProjLocation.relativize(file).toString()});
for (BuildConfig cfg : allConfigs) {
boolean ignore = currentFileAttr.hasIgnore(cfg);
String [] fileConfAttr;
if (ignore) {
fileConfAttr = new String[] {"Name", cfg.get("Name"), "ExcludedFromBuild", "TRUE" };
} else {
fileConfAttr = new String[] {"Name", cfg.get("Name")};
}
if (!disablePch && !usePch && !ignore) {
continue;
} else if (!disablePch && !usePch) {
wg.tag("FileConfiguration", fileConfAttr);
} else {
wg.startTag("FileConfiguration", fileConfAttr);
if (usePch) {
// usePch always applies to all configs, might not always be so.
wg.tag("Tool", new String[] {
"Name", "VCCLCompilerTool", "UsePrecompiledHeader",
"1" });
assert(!disablePch);
}
if (disablePch) {
if (currentFileAttr.hasDisablePch(cfg)) {
wg.tag("Tool", new String[] {
"Name", "VCCLCompilerTool", "UsePrecompiledHeader",
"0" });
}
assert(!usePch);
}
wg.endTag();
}
}
wg.endTag();
}
return CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs)
throws IOException {
Boolean hide = false;
DirAttributes newAttr = attributes.peek().clone();
String rPath;
if (path.toAbsolutePath().toString().equals(this.startDir.toAbsolutePath().toString())){
rPath = startDir.toString();
} else {
rPath = path.getFileName().toString();
}
// check per config ignorePaths!
for (BuildConfig cfg : allConfigs) {
if (cfg.matchesIgnoredPath(path.toAbsolutePath().toString())) {
newAttr.setIgnore(cfg);
}
// Hide is always on all configs. And additional files are never hiddden
if (cfg.matchesHidePath(path.toAbsolutePath().toString())) {
hide = true;
break;
}
}
if (!hide) {
wg.startTag("Filter", new String[] {
"Name", rPath});
attributes.push(newAttr);
return super.preVisitDirectory(path, attrs);
} else {
return FileVisitResult.SKIP_SUBTREE;
}
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
//end matching attributes set by ignorepath
wg.endTag();
attributes.pop();
return CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
return CONTINUE;
}
public void writeFileTree() throws IOException {
Files.walkFileTree(this.startDir, this);
}
}

View File

@ -33,7 +33,7 @@ import java.util.LinkedList;
import java.util.UUID;
import java.util.Vector;
public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
public class WinGammaPlatformVC10 extends WinGammaPlatform {
LinkedList <String>filters = new LinkedList<String>();

View File

@ -1,353 +0,0 @@
/*
* Copyright (c) 2005, 2013, 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.
*
*/
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.FileSystems;
import java.util.Vector;
public class WinGammaPlatformVC7 extends WinGammaPlatform {
// TODO How about moving all globals configs to its own BuildConfig?
String projectVersion() {
return "7.10";
};
public void writeProjectFile(String projectFileName, String projectName,
Vector<BuildConfig> allConfigs) throws IOException {
System.out.println();
System.out.println(" Writing .vcproj file: " + projectFileName);
// If we got this far without an error, we're safe to actually
// write the .vcproj file
printWriter = new PrintWriter(new FileWriter(projectFileName));
printWriter
.println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>");
startTag("VisualStudioProject", new String[] { "ProjectType",
"Visual C++", "Version", projectVersion(), "Name", projectName,
"ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
"SccProjectName", "", "SccLocalPath", "" });
startTag("Platforms");
tag("Platform",
new String[] { "Name",
(String) BuildConfig.getField(null, "PlatformName") });
endTag();
startTag("Configurations");
for (BuildConfig cfg : allConfigs) {
writeConfiguration(cfg);
}
endTag();
tag("References");
writeFiles(allConfigs);
tag("Globals");
endTag();
printWriter.close();
System.out.println(" Done.");
}
void writeCustomToolConfig(Vector<BuildConfig> configs, String[] customToolAttrs) {
for (BuildConfig cfg : configs) {
startTag("FileConfiguration",
new String[] { "Name", (String) cfg.get("Name") });
tag("Tool", customToolAttrs);
endTag();
}
}
void writeFiles(Vector<BuildConfig> allConfigs) {
// This code assummes there are no config specific includes.
startTag("Files");
String sourceBase = BuildConfig.getFieldString(null, "SourceBase");
// Use first config for all global absolute includes.
BuildConfig baseConfig = allConfigs.firstElement();
Vector<String> rv = new Vector<String>();
// Then use first config for all relative includes
Vector<String> ri = new Vector<String>();
baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude");
for (String f : ri) {
rv.add(sourceBase + Util.sep + f);
}
baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude");
handleIncludes(rv, allConfigs);
startTag("Filter", new String[] { "Name", "Resource Files", "Filter",
"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" });
endTag();
endTag();
}
// Will visit file tree for each include
private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) {
for (String path : includes) {
FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this);
try {
ftc.writeFileTree();
} catch (IOException e) {
e.printStackTrace();
}
}
}
void writeConfiguration(BuildConfig cfg) {
startTag("Configuration", new String[] { "Name", cfg.get("Name"),
"OutputDirectory", cfg.get("OutputDir"),
"IntermediateDirectory", cfg.get("OutputDir"),
"ConfigurationType", "2", "UseOfMFC", "0",
"ATLMinimizesCRunTimeLibraryUsage", "FALSE" });
tagV("Tool", cfg.getV("CompilerFlags"));
tag("Tool", new String[] { "Name", "VCCustomBuildTool" });
tagV("Tool", cfg.getV("LinkerFlags"));
String postBuildCmd = BuildConfig.getFieldString(null,
"PostbuildCommand");
if (postBuildCmd != null) {
tag("Tool",
new String[] {
"Name",
"VCPostBuildEventTool",
"Description",
BuildConfig
.getFieldString(null, "PostbuildDescription"),
// Caution: String.replace(String,String) is available
// from JDK5 onwards only
"CommandLine",
cfg.expandFormat(postBuildCmd.replace("\t",
"&#x0D;&#x0A;")) });
}
tag("Tool", new String[] { "Name", "VCPreBuildEventTool" });
tag("Tool",
new String[] {
"Name",
"VCPreLinkEventTool",
"Description",
BuildConfig.getFieldString(null, "PrelinkDescription"),
// Caution: String.replace(String,String) is available
// from JDK5 onwards only
"CommandLine",
cfg.expandFormat(BuildConfig.getFieldString(null,
"PrelinkCommand").replace("\t", "&#x0D;&#x0A;")) });
tag("Tool", new String[] { "Name", "VCResourceCompilerTool",
"PreprocessorDefinitions", "NDEBUG", "Culture", "1033" });
tag("Tool", new String[] { "Name", "VCMIDLTool",
"PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible",
"TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment",
"1", "TypeLibraryName",
cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName",
"" });
endTag();
}
protected String getProjectExt() {
return ".vcproj";
}
}
class CompilerInterfaceVC7 extends CompilerInterface {
void getBaseCompilerFlags_common(Vector defines, Vector includes,
String outDir, Vector rv) {
// advanced M$ IDE (2003) can only recognize name if it's first or
// second attribute in the tag - go guess
addAttr(rv, "Name", "VCCLCompilerTool");
addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
addAttr(rv, "PreprocessorDefinitions",
Util.join(";", defines).replace("\"", "&quot;"));
addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp");
addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch");
addAttr(rv, "AssemblerListingLocation", outDir);
addAttr(rv, "ObjectFile", outDir + Util.sep);
addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb");
// Set /nologo optin
addAttr(rv, "SuppressStartupBanner", "TRUE");
// Surpass the default /Tc or /Tp. 0 is compileAsDefault
addAttr(rv, "CompileAs", "0");
// Set /W3 option. 3 is warningLevel_3
addAttr(rv, "WarningLevel", "3");
// Set /WX option,
addAttr(rv, "WarnAsError", "TRUE");
// Set /GS option
addAttr(rv, "BufferSecurityCheck", "FALSE");
// Set /Zi option. 3 is debugEnabled
addAttr(rv, "DebugInformationFormat", "3");
}
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
Vector rv = new Vector();
getBaseCompilerFlags_common(defines, includes, outDir, rv);
// Set /Yu option. 3 is pchUseUsingSpecific
// Note: Starting VC8 pchUseUsingSpecific is 2 !!!
addAttr(rv, "UsePrecompiledHeader", "3");
// Set /EHsc- option
addAttr(rv, "ExceptionHandling", "FALSE");
return rv;
}
Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
Vector rv = new Vector();
addAttr(rv, "Name", "VCLinkerTool");
addAttr(rv, "AdditionalOptions",
"/export:JNI_GetDefaultJavaVMInitArgs "
+ "/export:JNI_CreateJavaVM "
+ "/export:JVM_FindClassFromBootLoader "
+ "/export:JNI_GetCreatedJavaVMs "
+ "/export:jio_snprintf /export:jio_printf "
+ "/export:jio_fprintf /export:jio_vfprintf "
+ "/export:jio_vsnprintf "
+ "/export:JVM_GetVersionInfo "
+ "/export:JVM_GetThreadStateNames "
+ "/export:JVM_GetThreadStateValues "
+ "/export:JVM_InitAgentProperties ");
addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
addAttr(rv, "OutputFile", outDll);
// Set /INCREMENTAL option. 1 is linkIncrementalNo
addAttr(rv, "LinkIncremental", "1");
addAttr(rv, "SuppressStartupBanner", "TRUE");
addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def");
addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb");
// Set /SUBSYSTEM option. 2 is subSystemWindows
addAttr(rv, "SubSystem", "2");
addAttr(rv, "BaseAddress", "0x8000000");
addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib");
if (platformName.equals("Win32")) {
// Set /MACHINE option. 1 is X86
addAttr(rv, "TargetMachine", "1");
} else {
// Set /MACHINE option. 17 is X64
addAttr(rv, "TargetMachine", "17");
}
return rv;
}
void getDebugCompilerFlags_common(String opt, Vector rv) {
// Set /On option
addAttr(rv, "Optimization", opt);
// Set /FR option. 1 is brAllInfo
addAttr(rv, "BrowseInformation", "1");
addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep);
// Set /MD option. 2 is rtMultiThreadedDLL
addAttr(rv, "RuntimeLibrary", "2");
// Set /Oy- option
addAttr(rv, "OmitFramePointers", "FALSE");
}
Vector getDebugCompilerFlags(String opt, String platformName) {
Vector rv = new Vector();
getDebugCompilerFlags_common(opt, rv);
return rv;
}
Vector getDebugLinkerFlags() {
Vector rv = new Vector();
addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option
return rv;
}
void getAdditionalNonKernelLinkerFlags(Vector rv) {
extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace ");
}
void getProductCompilerFlags_common(Vector rv) {
// Set /O2 option. 2 is optimizeMaxSpeed
addAttr(rv, "Optimization", "2");
// Set /Oy- option
addAttr(rv, "OmitFramePointers", "FALSE");
// Set /Ob option. 1 is expandOnlyInline
addAttr(rv, "InlineFunctionExpansion", "1");
// Set /GF option.
addAttr(rv, "StringPooling", "TRUE");
// Set /MD option. 2 is rtMultiThreadedDLL
addAttr(rv, "RuntimeLibrary", "2");
// Set /Gy option
addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
}
Vector getProductCompilerFlags() {
Vector rv = new Vector();
getProductCompilerFlags_common(rv);
return rv;
}
Vector getProductLinkerFlags() {
Vector rv = new Vector();
// Set /OPT:REF option. 2 is optReferences
addAttr(rv, "OptimizeReferences", "2");
// Set /OPT:optFolding option. 2 is optFolding
addAttr(rv, "EnableCOMDATFolding", "2");
return rv;
}
String getOptFlag() {
return "2";
}
String getNoOptFlag() {
return "0";
}
String makeCfgName(String flavourBuild, String platform) {
return flavourBuild + "|" + platform;
}
}

View File

@ -1,68 +0,0 @@
/*
* Copyright (c) 2005, 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.
*
*/
import java.util.Vector;
public class WinGammaPlatformVC8 extends WinGammaPlatformVC7 {
String projectVersion() {return "8.00";};
}
class CompilerInterfaceVC8 extends CompilerInterfaceVC7 {
Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) {
Vector rv = new Vector();
getBaseCompilerFlags_common(defines,includes, outDir, rv);
// Set /Yu option. 2 is pchUseUsingSpecific
addAttr(rv, "UsePrecompiledHeader", "2");
// Set /EHsc- option. 0 is cppExceptionHandlingNo
addAttr(rv, "ExceptionHandling", "0");
// enable multi process builds
extAttr(rv, "AdditionalOptions", "/MP");
return rv;
}
Vector getDebugCompilerFlags(String opt, String platformName) {
Vector rv = new Vector();
getDebugCompilerFlags_common(opt,rv);
return rv;
}
Vector getProductCompilerFlags() {
Vector rv = new Vector();
getProductCompilerFlags_common(rv);
return rv;
}
}

View File

@ -39,7 +39,6 @@ class ciField : public ResourceObj {
CI_PACKAGE_ACCESS
friend class ciEnv;
friend class ciInstanceKlass;
friend class NonStaticFieldFiller;
private:
ciFlags _flags;

View File

@ -44,7 +44,7 @@
//
// Loaded instance klass.
ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
ciKlass(h_k), _non_static_fields(NULL)
ciKlass(h_k)
{
assert(get_Klass()->oop_is_instance(), "wrong type");
assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
@ -407,37 +407,6 @@ ciField* ciInstanceKlass::get_field_by_name(ciSymbol* name, ciSymbol* signature,
return field;
}
// ------------------------------------------------------------------
// ciInstanceKlass::non_static_fields.
class NonStaticFieldFiller: public FieldClosure {
GrowableArray<ciField*>* _arr;
ciEnv* _curEnv;
public:
NonStaticFieldFiller(ciEnv* curEnv, GrowableArray<ciField*>* arr) :
_curEnv(curEnv), _arr(arr)
{}
void do_field(fieldDescriptor* fd) {
ciField* field = new (_curEnv->arena()) ciField(fd);
_arr->append(field);
}
};
GrowableArray<ciField*>* ciInstanceKlass::non_static_fields() {
if (_non_static_fields == NULL) {
VM_ENTRY_MARK;
ciEnv* curEnv = ciEnv::current();
InstanceKlass* ik = get_instanceKlass();
int max_n_fields = ik->java_fields_count();
Arena* arena = curEnv->arena();
_non_static_fields =
new (arena) GrowableArray<ciField*>(arena, max_n_fields, 0, NULL);
NonStaticFieldFiller filler(curEnv, _non_static_fields);
ik->do_nonstatic_fields(&filler);
}
return _non_static_fields;
}
static int sort_field_by_offset(ciField** a, ciField** b) {
return (*a)->offset_in_bytes() - (*b)->offset_in_bytes();

View File

@ -71,8 +71,6 @@ private:
// Itsef: more than one implementors.
ciInstanceKlass* _implementor;
GrowableArray<ciField*>* _non_static_fields;
protected:
ciInstanceKlass(KlassHandle h_k);
ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
@ -181,8 +179,6 @@ public:
ciField* get_field_by_offset(int field_offset, bool is_static);
ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
GrowableArray<ciField*>* non_static_fields();
// total number of nonstatic fields (including inherited):
int nof_nonstatic_fields() {
if (_nonstatic_fields == NULL)

View File

@ -1364,8 +1364,6 @@ void nmethod::invalidate_osr_method() {
// Remove from list of active nmethods
if (method() != NULL)
method()->method_holder()->remove_osr_nmethod(this);
// Set entry as invalid
_entry_bci = InvalidOSREntryBci;
}
void nmethod::log_state_change() const {

View File

@ -202,13 +202,6 @@ class nmethod : public CodeBlob {
bool _oops_are_stale; // indicates that it's no longer safe to access oops section
#endif
enum { in_use = 0, // executable nmethod
not_entrant = 1, // marked for deoptimization but activations may still exist,
// will be transformed to zombie when all activations are gone
zombie = 2, // no activations exist, nmethod is ready for purge
unloaded = 3 }; // there should be no activations, should not be called,
// will be transformed to zombie immediately
jbyte _scavenge_root_state;
#if INCLUDE_RTM_OPT
@ -431,6 +424,13 @@ class nmethod : public CodeBlob {
address entry_point() const { return _entry_point; } // normal entry point
address verified_entry_point() const { return _verified_entry_point; } // if klass is correct
enum { in_use = 0, // executable nmethod
not_entrant = 1, // marked for deoptimization but activations may still exist,
// will be transformed to zombie when all activations are gone
zombie = 2, // no activations exist, nmethod is ready for purge
unloaded = 3 }; // there should be no activations, should not be called,
// will be transformed to zombie immediately
// flag accessing and manipulation
bool is_in_use() const { return _state == in_use; }
bool is_alive() const { return _state == in_use || _state == not_entrant; }
@ -759,7 +759,7 @@ public:
// support for code generation
static int verified_entry_point_offset() { return offset_of(nmethod, _verified_entry_point); }
static int osr_entry_point_offset() { return offset_of(nmethod, _osr_entry_point); }
static int entry_bci_offset() { return offset_of(nmethod, _entry_bci); }
static int state_offset() { return offset_of(nmethod, _state); }
// RedefineClasses support. Mark metadata in nmethods as on_stack so that
// redefine classes doesn't purge it.

View File

@ -4737,7 +4737,7 @@ void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
}
bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
const char* type = "";
const char* type = r->get_type_str();
HeapWord* bottom = r->bottom();
HeapWord* end = r->end();
size_t capacity_bytes = r->capacity();
@ -4748,15 +4748,7 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
size_t remset_bytes = r->rem_set()->mem_size();
size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size();
if (r->used() == 0) {
type = "FREE";
} else if (r->is_survivor()) {
type = "SURV";
} else if (r->is_young()) {
type = "EDEN";
} else if (r->startsHumongous()) {
type = "HUMS";
if (r->startsHumongous()) {
assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 &&
_hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0,
"they should have been zeroed after the last time we used them");
@ -4769,12 +4761,9 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
&prev_live_bytes, &next_live_bytes);
end = bottom + HeapRegion::GrainWords;
} else if (r->continuesHumongous()) {
type = "HUMC";
get_hum_bytes(&used_bytes, &capacity_bytes,
&prev_live_bytes, &next_live_bytes);
assert(end == bottom + HeapRegion::GrainWords, "invariant");
} else {
type = "OLD";
}
_total_used_bytes += used_bytes;

View File

@ -211,7 +211,10 @@ void YoungList::empty_list(HeapRegion* list) {
HeapRegion* next = list->get_next_young_region();
list->set_next_young_region(NULL);
list->uninstall_surv_rate_group();
list->set_not_young();
// This is called before a Full GC and all the non-empty /
// non-humongous regions at the end of the Full GC will end up as
// old anyway.
list->set_old();
list = next;
}
}
@ -370,7 +373,7 @@ void YoungList::print() {
if (curr == NULL)
gclog_or_tty->print_cr(" empty");
while (curr != NULL) {
gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT "N: "PTR_FORMAT", age: %4d",
gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT ", N: "PTR_FORMAT", age: %4d",
HR_FORMAT_PARAMS(curr),
curr->prev_top_at_mark_start(),
curr->next_top_at_mark_start(),
@ -802,6 +805,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
#ifdef ASSERT
for (uint i = first; i < first + obj_regions; ++i) {
HeapRegion* hr = region_at(i);
assert(hr->is_free(), "sanity");
assert(hr->is_empty(), "sanity");
assert(is_on_master_free_list(hr), "sanity");
}
@ -1225,10 +1229,8 @@ private:
public:
bool doHeapRegion(HeapRegion* hr) {
assert(!hr->is_young(), "not expecting to find young regions");
if (hr->is_free()) {
// We only generate output for non-empty regions.
if (!hr->is_empty()) {
if (!hr->isHumongous()) {
_hr_printer->post_compaction(hr, G1HRPrinter::Old);
} else if (hr->startsHumongous()) {
if (hr->region_num() == 1) {
// single humongous region
@ -1236,10 +1238,12 @@ public:
} else {
_hr_printer->post_compaction(hr, G1HRPrinter::StartsHumongous);
}
} else {
assert(hr->continuesHumongous(), "only way to get here");
} else if (hr->continuesHumongous()) {
_hr_printer->post_compaction(hr, G1HRPrinter::ContinuesHumongous);
}
} else if (hr->is_old()) {
_hr_printer->post_compaction(hr, G1HRPrinter::Old);
} else {
ShouldNotReachHere();
}
return false;
}
@ -1477,9 +1481,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// Discard all rset updates
JavaThread::dirty_card_queue_set().abandon_logs();
assert(!G1DeferredRSUpdate
|| (G1DeferredRSUpdate &&
(dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any");
assert(dirty_card_queue_set().completed_buffers_num() == 0, "DCQS should be empty");
_young_list->reset_sampled_info();
// At this point there should be no regions in the
@ -2090,7 +2092,6 @@ jint G1CollectedHeap::initialize() {
concurrent_g1_refine()->red_zone(),
Shared_DirtyCardQ_lock);
if (G1DeferredRSUpdate) {
dirty_card_queue_set().initialize(NULL, // Should never be called by the Java code
DirtyCardQ_CBL_mon,
DirtyCardQ_FL_lock,
@ -2098,7 +2099,6 @@ jint G1CollectedHeap::initialize() {
-1, // no limit on length
Shared_DirtyCardQ_lock,
&JavaThread::dirty_card_queue_set());
}
// Initialize the card queue set used to hold cards containing
// references into the collection set.
@ -2121,8 +2121,8 @@ jint G1CollectedHeap::initialize() {
// We'll re-use the same region whether the alloc region will
// require BOT updates or not and, if it doesn't, then a non-young
// region will complain that it cannot support allocations without
// BOT updates. So we'll tag the dummy region as young to avoid that.
dummy_region->set_young();
// BOT updates. So we'll tag the dummy region as eden to avoid that.
dummy_region->set_eden();
// Make sure it's full.
dummy_region->set_top(dummy_region->end());
G1AllocRegion::setup(this, dummy_region);
@ -4031,14 +4031,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
if (_hr_printer.is_active()) {
HeapRegion* hr = g1_policy()->collection_set();
while (hr != NULL) {
G1HRPrinter::RegionType type;
if (!hr->is_young()) {
type = G1HRPrinter::Old;
} else if (hr->is_survivor()) {
type = G1HRPrinter::Survivor;
} else {
type = G1HRPrinter::Eden;
}
_hr_printer.cset(hr);
hr = hr->next_in_collection_set();
}
@ -5393,7 +5385,6 @@ class G1RedirtyLoggedCardsTask : public AbstractGangTask {
};
void G1CollectedHeap::redirty_logged_cards() {
guarantee(G1DeferredRSUpdate, "Must only be called when using deferred RS updates.");
double redirty_logged_cards_start = os::elapsedTime();
uint n_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
@ -5448,9 +5439,10 @@ public:
void do_oop(narrowOop* p) { guarantee(false, "Not needed"); }
void do_oop(oop* p) {
oop obj = *p;
assert(obj != NULL, "the caller should have filtered out NULL values");
G1CollectedHeap::in_cset_state_t cset_state = _g1->in_cset_state(obj);
if (obj == NULL || cset_state == G1CollectedHeap::InNeither) {
if (cset_state == G1CollectedHeap::InNeither) {
return;
}
if (cset_state == G1CollectedHeap::InCSet) {
@ -6052,9 +6044,7 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
// RSets.
enqueue_discovered_references(n_workers);
if (G1DeferredRSUpdate) {
redirty_logged_cards();
}
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
}
@ -6062,7 +6052,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
FreeRegionList* free_list,
bool par,
bool locked) {
assert(!hr->isHumongous(), "this is only for non-humongous regions");
assert(!hr->is_free(), "the region should not be free");
assert(!hr->is_empty(), "the region should not be empty");
assert(_hrm.is_available(hr->hrm_index()), "region should be committed");
assert(free_list != NULL, "pre-condition");
@ -6092,14 +6082,14 @@ void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
// We need to read this before we make the region non-humongous,
// otherwise the information will be gone.
uint last_index = hr->last_hc_index();
hr->set_notHumongous();
hr->clear_humongous();
free_region(hr, free_list, par);
uint i = hr->hrm_index() + 1;
while (i < last_index) {
HeapRegion* curr_hr = region_at(i);
assert(curr_hr->continuesHumongous(), "invariant");
curr_hr->set_notHumongous();
curr_hr->clear_humongous();
free_region(curr_hr, free_list, par);
i += 1;
}
@ -6407,9 +6397,9 @@ void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& e
if (cur->is_young()) {
cur->set_young_index_in_cset(-1);
}
cur->set_not_young();
cur->set_evacuation_failed(false);
// The region is now considered to be old.
cur->set_old();
_old_set.add(cur);
evacuation_info.increment_collectionset_used_after(cur->used());
}
@ -6696,16 +6686,15 @@ public:
TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { }
bool doHeapRegion(HeapRegion* r) {
if (r->is_empty()) {
// We ignore empty regions, we'll empty the free list afterwards
} else if (r->is_young()) {
// We ignore young regions, we'll empty the young list afterwards
} else if (r->isHumongous()) {
// We ignore humongous regions, we're not tearing down the
// humongous region set
} else {
// The rest should be old
if (r->is_old()) {
_old_set->remove(r);
} else {
// We ignore free regions, we'll empty the free list afterwards.
// We ignore young regions, we'll empty the young list afterwards.
// We ignore humongous regions, we're not tearing down the
// humongous regions set.
assert(r->is_free() || r->is_young() || r->isHumongous(),
"it cannot be another type");
}
return false;
}
@ -6755,6 +6744,7 @@ public:
if (r->is_empty()) {
// Add free regions to the free list
r->set_free();
_hrm->insert_into_free_list(r);
} else if (!_free_list_only) {
assert(!r->is_young(), "we should not come across young regions");
@ -6762,7 +6752,11 @@ public:
if (r->isHumongous()) {
// We ignore humongous regions, we left the humongous set unchanged
} else {
// The rest should be old, add them to the old set
// Objects that were compacted would have ended up on regions
// that were previously old or free.
assert(r->is_free() || r->is_old(), "invariant");
// We now consider them old, so register as such.
r->set_old();
_old_set->add(r);
}
_total_used += r->used();
@ -6829,7 +6823,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region,
size_t allocated_bytes) {
assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
assert(alloc_region->is_young(), "all mutator alloc regions should be young");
assert(alloc_region->is_eden(), "all mutator alloc regions should be eden");
g1_policy()->add_region_to_incremental_cset_lhs(alloc_region);
_summary_bytes_used += allocated_bytes;
@ -6888,6 +6882,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
check_bitmaps("Survivor Region Allocation", new_alloc_region);
} else {
new_alloc_region->set_old();
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
check_bitmaps("Old Region Allocation", new_alloc_region);
}
@ -6999,9 +6994,11 @@ public:
} else if (hr->is_empty()) {
assert(_hrm->is_free(hr), err_msg("Heap region %u is empty but not on the free list.", hr->hrm_index()));
_free_count.increment(1u, hr->capacity());
} else {
} else if (hr->is_old()) {
assert(hr->containing_set() == _old_set, err_msg("Heap region %u is old but not in the old set.", hr->hrm_index()));
_old_count.increment(1u, hr->capacity());
} else {
ShouldNotReachHere();
}
return false;
}

View File

@ -1665,7 +1665,7 @@ G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) {
// Add the heap region at the head of the non-incremental collection set
void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) {
assert(_inc_cset_build_state == Active, "Precondition");
assert(!hr->is_young(), "non-incremental add of young region");
assert(hr->is_old(), "the region should be old");
assert(!hr->in_collection_set(), "should not already be in the CSet");
hr->set_in_collection_set(true);
@ -1829,7 +1829,7 @@ void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) {
// Add the region to the LHS of the incremental cset
void G1CollectorPolicy::add_region_to_incremental_cset_lhs(HeapRegion* hr) {
// Survivors should be added to the RHS at the end of a pause
assert(!hr->is_survivor(), "Logic");
assert(hr->is_eden(), "Logic");
// Do the 'common' stuff
add_region_to_incremental_cset_common(hr);
@ -1989,7 +1989,11 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf
HeapRegion* hr = young_list->first_survivor_region();
while (hr != NULL) {
assert(hr->is_survivor(), "badly formed young list");
hr->set_young();
// There is a convention that all the young regions in the CSet
// are tagged as "eden", so we do this for the survivors here. We
// use the special set_eden_pre_gc() as it doesn't check that the
// region is free (which is not the case here).
hr->set_eden_pre_gc();
hr = hr->get_next_young_region();
}

View File

@ -299,13 +299,13 @@ public:
// Accessors
void set_region_eden(HeapRegion* hr, int young_index_in_cset) {
hr->set_young();
hr->set_eden();
hr->install_surv_rate_group(_short_lived_surv_rate_group);
hr->set_young_index_in_cset(young_index_in_cset);
}
void set_region_survivor(HeapRegion* hr, int young_index_in_cset) {
assert(hr->is_young() && hr->is_survivor(), "pre-condition");
assert(hr->is_survivor(), "pre-condition");
hr->install_surv_rate_group(_survivor_surv_rate_group);
hr->set_young_index_in_cset(young_index_in_cset);
}

View File

@ -176,15 +176,17 @@ public:
class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
G1CollectedHeap* _g1h;
ConcurrentMark* _cm;
OopsInHeapRegionClosure *_update_rset_cl;
uint _worker_id;
DirtyCardQueue _dcq;
UpdateRSetDeferred _update_rset_cl;
public:
RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
OopsInHeapRegionClosure* update_rset_cl,
uint worker_id) :
_g1h(g1h), _update_rset_cl(update_rset_cl),
_worker_id(worker_id), _cm(_g1h->concurrent_mark()) { }
_g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
_worker_id(worker_id), _cm(_g1h->concurrent_mark()) {
}
bool doHeapRegion(HeapRegion *hr) {
bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause();
@ -195,7 +197,7 @@ public:
if (hr->claimHeapRegion(HeapRegion::ParEvacFailureClaimValue)) {
if (hr->evacuation_failed()) {
RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, _update_rset_cl,
RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
during_initial_mark,
during_conc_mark,
_worker_id);
@ -214,7 +216,7 @@ public:
// whenever this might be required in the future.
hr->rem_set()->reset_for_par_iteration();
hr->reset_bot();
_update_rset_cl->set_region(hr);
_update_rset_cl.set_region(hr);
hr->object_iterate(&rspc);
hr->rem_set()->clean_strong_code_roots(hr);
@ -238,16 +240,7 @@ public:
_g1h(g1h) { }
void work(uint worker_id) {
UpdateRSetImmediate immediate_update(_g1h->g1_rem_set());
DirtyCardQueue dcq(&_g1h->dirty_card_queue_set());
UpdateRSetDeferred deferred_update(_g1h, &dcq);
OopsInHeapRegionClosure *update_rset_cl = &deferred_update;
if (!G1DeferredRSUpdate) {
update_rset_cl = &immediate_update;
}
RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, update_rset_cl, worker_id);
RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id);
HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id);
_g1h->collection_set_iterate_from(hr, &rsfp_cl);

View File

@ -237,11 +237,9 @@ void G1GCPhaseTimes::note_gc_end() {
_last_gc_worker_times_ms.verify();
_last_gc_worker_other_times_ms.verify();
if (G1DeferredRSUpdate) {
_last_redirty_logged_cards_time_ms.verify();
_last_redirty_logged_cards_processed_cards.verify();
}
}
void G1GCPhaseTimes::note_string_dedup_fixup_start() {
_cur_string_dedup_queue_fixup_worker_times_ms.reset();
@ -352,13 +350,11 @@ void G1GCPhaseTimes::print(double pause_time_sec) {
_recorded_non_young_cset_choice_time_ms));
print_stats(2, "Ref Proc", _cur_ref_proc_time_ms);
print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
if (G1DeferredRSUpdate) {
print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms);
if (G1Log::finest()) {
_last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty");
_last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards");
}
}
if (G1ReclaimDeadHumongousObjectsAtYoungGC) {
print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms);
if (G1Log::finest()) {

View File

@ -27,7 +27,6 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1HotCardCache.hpp"
#include "gc_implementation/g1/g1RemSet.hpp"
#include "gc_implementation/g1/heapRegion.hpp"
#include "runtime/atomic.inline.hpp"
G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h):
@ -136,7 +135,6 @@ void G1HotCardCache::drain(uint worker_i,
}
void G1HotCardCache::reset_card_counts(HeapRegion* hr) {
assert(!hr->isHumongous(), "Should have been cleared");
_card_counts.clear_region(hr);
}

View File

@ -84,20 +84,6 @@ class G1ParScanThreadState : public StackObj {
DirtyCardQueue& dirty_card_queue() { return _dcq; }
G1SATBCardTableModRefBS* ctbs() { return _ct_bs; }
template <class T> inline void immediate_rs_update(HeapRegion* from, T* p, int tid);
template <class T> void deferred_rs_update(HeapRegion* from, T* p, int tid) {
// If the new value of the field points to the same region or
// is the to-space, we don't need to include it in the Rset updates.
if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) {
size_t card_index = ctbs()->index_for(p);
// If the card hasn't been added to the buffer, do it.
if (ctbs()->mark_card_deferred(card_index)) {
dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index));
}
}
}
public:
G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
~G1ParScanThreadState();
@ -124,8 +110,17 @@ class G1ParScanThreadState : public StackObj {
_refs->push(ref);
}
template <class T> inline void update_rs(HeapRegion* from, T* p, int tid);
template <class T> void update_rs(HeapRegion* from, T* p, int tid) {
// If the new value of the field points to the same region or
// is the to-space, we don't need to include it in the Rset updates.
if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) {
size_t card_index = ctbs()->index_for(p);
// If the card hasn't been added to the buffer, do it.
if (ctbs()->mark_card_deferred(card_index)) {
dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index));
}
}
}
private:
inline HeapWord* allocate(GCAllocPurpose purpose, size_t word_sz);

View File

@ -29,20 +29,6 @@
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "oops/oop.inline.hpp"
template <class T> inline void G1ParScanThreadState::immediate_rs_update(HeapRegion* from, T* p, int tid) {
if (!from->is_survivor()) {
_g1_rem->par_write_ref(from, p, tid);
}
}
template <class T> void G1ParScanThreadState::update_rs(HeapRegion* from, T* p, int tid) {
if (G1DeferredRSUpdate) {
deferred_rs_update(from, p, tid);
} else {
immediate_rs_update(from, p, tid);
}
}
template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)),
"Reference should not be NULL here as such are never pushed to the task queue.");

View File

@ -339,12 +339,8 @@ void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc,
// are just discarded (there's no need to update the RSets of regions
// that were in the collection set - after the pause these regions
// are wholly 'free' of live objects. In the event of an evacuation
// failure the cards/buffers in this queue set are:
// * passed to the DirtyCardQueueSet that is used to manage deferred
// RSet updates, or
// * scanned for references that point into the collection set
// and the RSet of the corresponding region in the collection set
// is updated immediately.
// failure the cards/buffers in this queue set are passed to the
// DirtyCardQueueSet that is used to manage RSet updates
DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
assert((ParallelGCThreads > 0) || worker_i == 0, "invariant");
@ -358,7 +354,6 @@ void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc,
void G1RemSet::prepare_for_oops_into_collection_set_do() {
cleanupHRRS();
ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine();
_g1->set_refine_cte_cl_concurrency(false);
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
dcqs.concatenate_logs();
@ -371,66 +366,6 @@ void G1RemSet::prepare_for_oops_into_collection_set_do() {
_total_cards_scanned = 0;
}
// This closure, applied to a DirtyCardQueueSet, is used to immediately
// update the RSets for the regions in the CSet. For each card it iterates
// through the oops which coincide with that card. It scans the reference
// fields in each oop; when it finds an oop that points into the collection
// set, the RSet for the region containing the referenced object is updated.
class UpdateRSetCardTableEntryIntoCSetClosure: public CardTableEntryClosure {
G1CollectedHeap* _g1;
CardTableModRefBS* _ct_bs;
public:
UpdateRSetCardTableEntryIntoCSetClosure(G1CollectedHeap* g1,
CardTableModRefBS* bs):
_g1(g1), _ct_bs(bs)
{ }
bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
// Construct the region representing the card.
HeapWord* start = _ct_bs->addr_for(card_ptr);
// And find the region containing it.
HeapRegion* r = _g1->heap_region_containing(start);
// Scan oops in the card looking for references into the collection set
// Don't use addr_for(card_ptr + 1) which can ask for
// a card beyond the heap. This is not safe without a perm
// gen.
HeapWord* end = start + CardTableModRefBS::card_size_in_words;
MemRegion scanRegion(start, end);
UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set());
FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl);
FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl);
// We can pass false as the "filter_young" parameter here as:
// * we should be in a STW pause,
// * the DCQS to which this closure is applied is used to hold
// references that point into the collection set from the prior
// RSet updating,
// * the post-write barrier shouldn't be logging updates to young
// regions (but there is a situation where this can happen - see
// the comment in G1RemSet::refine_card() below -
// that should not be applicable here), and
// * during actual RSet updating, the filtering of cards in young
// regions in HeapRegion::oops_on_card_seq_iterate_careful is
// employed.
// As a result, when this closure is applied to "refs into cset"
// DCQS, we shouldn't see any cards in young regions.
update_rs_cl.set_region(r);
HeapWord* stop_point =
r->oops_on_card_seq_iterate_careful(scanRegion,
&filter_then_update_rs_cset_oop_cl,
false /* filter_young */,
NULL /* card_ptr */);
// Since this is performed in the event of an evacuation failure, we
// we shouldn't see a non-null stop point
assert(stop_point == NULL, "saw an unallocated region");
return true;
}
};
void G1RemSet::cleanup_after_oops_into_collection_set_do() {
guarantee( _cards_scanned != NULL, "invariant" );
_total_cards_scanned = 0;
@ -451,25 +386,10 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() {
double restore_remembered_set_start = os::elapsedTime();
// Restore remembered sets for the regions pointing into the collection set.
if (G1DeferredRSUpdate) {
// If deferred RS updates are enabled then we just need to transfer
// the completed buffers from (a) the DirtyCardQueueSet used to hold
// cards that contain references that point into the collection set
// to (b) the DCQS used to hold the deferred RS updates
// We just need to transfer the completed buffers from the DirtyCardQueueSet
// used to hold cards that contain references that point into the collection set
// to the DCQS used to hold the deferred RS updates.
_g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs);
} else {
CardTableModRefBS* bs = (CardTableModRefBS*)_g1->barrier_set();
UpdateRSetCardTableEntryIntoCSetClosure update_rs_cset_immediate(_g1, bs);
int n_completed_buffers = 0;
while (into_cset_dcqs.apply_closure_to_completed_buffer(&update_rs_cset_immediate,
0, 0, true)) {
n_completed_buffers++;
}
assert(n_completed_buffers == into_cset_n_buffers, "missed some buffers");
}
_g1->g1_policy()->phase_times()->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0);
}

View File

@ -193,18 +193,4 @@ public:
bool apply_to_weak_ref_discovered_field() { return true; }
};
class UpdateRSetImmediate: public OopsInHeapRegionClosure {
private:
G1RemSet* _g1_rem_set;
template <class T> void do_oop_work(T* p);
public:
UpdateRSetImmediate(G1RemSet* rs) :
_g1_rem_set(rs) {}
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
virtual void do_oop( oop* p) { do_oop_work(p); }
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP

View File

@ -79,13 +79,4 @@ inline void UpdateRSOopClosure::do_oop_work(T* p) {
_rs->par_write_ref(_from, p, _worker_i);
}
template <class T>
inline void UpdateRSetImmediate::do_oop_work(T* p) {
assert(_from->is_in_reserved(p), "paranoia");
T heap_oop = oopDesc::load_heap_oop(p);
if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) {
_g1_rem_set->par_write_ref(_from, p, 0);
}
}
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_INLINE_HPP

View File

@ -259,14 +259,16 @@ public:
size_t code_root_elems = hrrs->strong_code_roots_list_length();
RegionTypeCounter* current = NULL;
if (r->is_young()) {
if (r->is_free()) {
current = &_free;
} else if (r->is_young()) {
current = &_young;
} else if (r->isHumongous()) {
current = &_humonguous;
} else if (r->is_empty()) {
current = &_free;
} else {
} else if (r->is_old()) {
current = &_old;
} else {
ShouldNotReachHere();
}
current->add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);
_all.add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);

View File

@ -31,8 +31,6 @@
#include "oops/oop.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
class DirtyCardQueueSet;
class G1SATBCardTableLoggingModRefBS;
@ -180,7 +178,4 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
void write_ref_array_work(MemRegion mr) { invalidate(mr); }
};
#endif // INCLUDE_ALL_GCS
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP

View File

@ -108,9 +108,6 @@
develop(bool, G1RSBarrierRegionFilter, true, \
"If true, generate region filtering code in RS barrier") \
\
develop(bool, G1DeferredRSUpdate, true, \
"If true, use deferred RS updates") \
\
develop(bool, G1RSLogCheckCardTable, false, \
"If true, verify that no dirty cards remain after RS log " \
"processing.") \

View File

@ -211,8 +211,6 @@ void HeapRegion::reset_after_compaction() {
}
void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
assert(_humongous_type == NotHumongous,
"we should have already filtered out humongous regions");
assert(_humongous_start_region == NULL,
"we should have already filtered out humongous regions");
assert(_end == _orig_end,
@ -222,7 +220,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
set_young_index_in_cset(-1);
uninstall_surv_rate_group();
set_young_type(NotYoung);
set_free();
reset_pre_dummy_top();
if (!par) {
@ -273,7 +271,7 @@ void HeapRegion::set_startsHumongous(HeapWord* new_top, HeapWord* new_end) {
assert(top() == bottom(), "should be empty");
assert(bottom() <= new_top && new_top <= new_end, "pre-condition");
_humongous_type = StartsHumongous;
_type.set_starts_humongous();
_humongous_start_region = this;
set_end(new_end);
@ -287,11 +285,11 @@ void HeapRegion::set_continuesHumongous(HeapRegion* first_hr) {
assert(top() == bottom(), "should be empty");
assert(first_hr->startsHumongous(), "pre-condition");
_humongous_type = ContinuesHumongous;
_type.set_continues_humongous();
_humongous_start_region = first_hr;
}
void HeapRegion::set_notHumongous() {
void HeapRegion::clear_humongous() {
assert(isHumongous(), "pre-condition");
if (startsHumongous()) {
@ -307,7 +305,6 @@ void HeapRegion::set_notHumongous() {
}
assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
_humongous_type = NotHumongous;
_humongous_start_region = NULL;
}
@ -327,12 +324,12 @@ HeapRegion::HeapRegion(uint hrm_index,
MemRegion mr) :
G1OffsetTableContigSpace(sharedOffsetArray, mr),
_hrm_index(hrm_index),
_humongous_type(NotHumongous), _humongous_start_region(NULL),
_humongous_start_region(NULL),
_in_collection_set(false),
_next_in_special_set(NULL), _orig_end(NULL),
_claimed(InitialClaimValue), _evacuation_failed(false),
_prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
_young_type(NotYoung), _next_young_region(NULL),
_next_young_region(NULL),
_next_dirty_cards_region(NULL), _next(NULL), _prev(NULL),
#ifdef ASSERT
_containing_set(NULL),
@ -686,26 +683,11 @@ void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const
void HeapRegion::print() const { print_on(gclog_or_tty); }
void HeapRegion::print_on(outputStream* st) const {
if (isHumongous()) {
if (startsHumongous())
st->print(" HS");
else
st->print(" HC");
} else {
st->print(" ");
}
st->print(" %2s", get_short_type_str());
if (in_collection_set())
st->print(" CS");
else
st->print(" ");
if (is_young())
st->print(is_survivor() ? " SU" : " Y ");
else
st->print(" ");
if (is_empty())
st->print(" F");
else
st->print(" ");
st->print(" TS %5d", _gc_time_stamp);
st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT,
prev_top_at_mark_start(), next_top_at_mark_start());

View File

@ -27,6 +27,7 @@
#include "gc_implementation/g1/g1BlockOffsetTable.hpp"
#include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
#include "gc_implementation/g1/heapRegionType.hpp"
#include "gc_implementation/g1/survRateGroup.hpp"
#include "gc_implementation/shared/ageTable.hpp"
#include "gc_implementation/shared/spaceDecorator.hpp"
@ -34,8 +35,6 @@
#include "memory/watermark.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
// A HeapRegion is the smallest piece of a G1CollectedHeap that
// can be collected independently.
@ -55,10 +54,7 @@ class nmethod;
#define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
#define HR_FORMAT_PARAMS(_hr_) \
(_hr_)->hrm_index(), \
(_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
(_hr_)->startsHumongous() ? "HS" : \
(_hr_)->continuesHumongous() ? "HC" : \
!(_hr_)->is_empty() ? "O" : "F", \
(_hr_)->get_short_type_str(), \
p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
// sentinel value for hrm_index
@ -215,12 +211,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
friend class VMStructs;
private:
enum HumongousType {
NotHumongous = 0,
StartsHumongous,
ContinuesHumongous
};
// The remembered set for this region.
// (Might want to make this "inline" later, to avoid some alloc failure
// issues.)
@ -232,7 +222,8 @@ class HeapRegion: public G1OffsetTableContigSpace {
// The index of this region in the heap region sequence.
uint _hrm_index;
HumongousType _humongous_type;
HeapRegionType _type;
// For a humongous region, region in which it starts.
HeapRegion* _humongous_start_region;
// For the start region of a humongous sequence, it's original end().
@ -274,13 +265,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
// The calculated GC efficiency of the region.
double _gc_efficiency;
enum YoungType {
NotYoung, // a region is not young
Young, // a region is young
Survivor // a region is young and it contains survivors
};
volatile YoungType _young_type;
int _young_index_in_cset;
SurvRateGroup* _surv_rate_group;
int _age_index;
@ -305,12 +289,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
_next_top_at_mark_start = bot;
}
void set_young_type(YoungType new_type) {
//assert(_young_type != new_type, "setting the same type" );
// TODO: add more assertions here
_young_type = new_type;
}
// Cached attributes used in the collection set policy information
// The RSet length that was added to the total value
@ -430,9 +408,21 @@ class HeapRegion: public G1OffsetTableContigSpace {
_prev_marked_bytes = _next_marked_bytes = 0;
}
bool isHumongous() const { return _humongous_type != NotHumongous; }
bool startsHumongous() const { return _humongous_type == StartsHumongous; }
bool continuesHumongous() const { return _humongous_type == ContinuesHumongous; }
const char* get_type_str() const { return _type.get_str(); }
const char* get_short_type_str() const { return _type.get_short_str(); }
bool is_free() const { return _type.is_free(); }
bool is_young() const { return _type.is_young(); }
bool is_eden() const { return _type.is_eden(); }
bool is_survivor() const { return _type.is_survivor(); }
bool isHumongous() const { return _type.is_humongous(); }
bool startsHumongous() const { return _type.is_starts_humongous(); }
bool continuesHumongous() const { return _type.is_continues_humongous(); }
bool is_old() const { return _type.is_old(); }
// For a humongous region, region in which it starts.
HeapRegion* humongous_start_region() const {
return _humongous_start_region;
@ -496,7 +486,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
void set_continuesHumongous(HeapRegion* first_hr);
// Unsets the humongous-related fields on the region.
void set_notHumongous();
void clear_humongous();
// If the region has a remembered set, return a pointer to it.
HeapRegionRemSet* rem_set() const {
@ -623,9 +613,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
void calc_gc_efficiency(void);
double gc_efficiency() { return _gc_efficiency;}
bool is_young() const { return _young_type != NotYoung; }
bool is_survivor() const { return _young_type == Survivor; }
int young_index_in_cset() const { return _young_index_in_cset; }
void set_young_index_in_cset(int index) {
assert( (index == -1) || is_young(), "pre-condition" );
@ -677,11 +664,13 @@ class HeapRegion: public G1OffsetTableContigSpace {
}
}
void set_young() { set_young_type(Young); }
void set_free() { _type.set_free(); }
void set_survivor() { set_young_type(Survivor); }
void set_eden() { _type.set_eden(); }
void set_eden_pre_gc() { _type.set_eden_pre_gc(); }
void set_survivor() { _type.set_survivor(); }
void set_not_young() { set_young_type(NotYoung); }
void set_old() { _type.set_old(); }
// Determine if an object has been allocated since the last
// mark performed by the collector. This returns true iff the object
@ -809,6 +798,4 @@ class HeapRegionClosure : public StackObj {
bool complete() { return _complete; }
};
#endif // INCLUDE_ALL_GCS
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP

View File

@ -42,7 +42,9 @@ void HeapRegionSetBase::verify_region(HeapRegion* hr) {
assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrm_index()));
assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrm_index())); // currently we don't use these sets for young regions
assert(hr->isHumongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrm_index(), name()));
assert(hr->is_empty() == regions_empty(), err_msg("Wrong empty state for region %u and set %s", hr->hrm_index(), name()));
assert(hr->is_free() == regions_free(), err_msg("Wrong free state for region %u and set %s", hr->hrm_index(), name()));
assert(!hr->is_free() || hr->is_empty(), err_msg("Free region %u is not empty for set %s", hr->hrm_index(), name()));
assert(!hr->is_empty() || hr->is_free(), err_msg("Empty region %u is not free for set %s", hr->hrm_index(), name()));
assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrm_index()));
}
#endif
@ -85,16 +87,16 @@ void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
out->print_cr("Set: %s ("PTR_FORMAT")", name(), this);
out->print_cr(" Region Assumptions");
out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous()));
out->print_cr(" empty : %s", BOOL_TO_STR(regions_empty()));
out->print_cr(" free : %s", BOOL_TO_STR(regions_free()));
out->print_cr(" Attributes");
out->print_cr(" length : %14u", length());
out->print_cr(" total capacity : "SIZE_FORMAT_W(14)" bytes",
total_capacity_bytes());
}
HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool empty, HRSMtSafeChecker* mt_safety_checker)
HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker)
: _name(name), _verify_in_progress(false),
_is_humongous(humongous), _is_empty(empty), _mt_safety_checker(mt_safety_checker),
_is_humongous(humongous), _is_free(free), _mt_safety_checker(mt_safety_checker),
_count()
{ }

View File

@ -81,7 +81,7 @@ class HeapRegionSetBase VALUE_OBJ_CLASS_SPEC {
friend class VMStructs;
private:
bool _is_humongous;
bool _is_empty;
bool _is_free;
HRSMtSafeChecker* _mt_safety_checker;
protected:
@ -102,9 +102,9 @@ protected:
// not. Only used during verification.
bool regions_humongous() { return _is_humongous; }
// Indicates whether all regions in the set should be empty or
// Indicates whether all regions in the set should be free or
// not. Only used during verification.
bool regions_empty() { return _is_empty; }
bool regions_free() { return _is_free; }
void check_mt_safety() {
if (_mt_safety_checker != NULL) {
@ -114,7 +114,7 @@ protected:
virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg) { }
HeapRegionSetBase(const char* name, bool humongous, bool empty, HRSMtSafeChecker* mt_safety_checker);
HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker);
public:
const char* name() { return _name; }
@ -171,7 +171,7 @@ public:
do { \
assert(((_set1_)->regions_humongous() == \
(_set2_)->regions_humongous()) && \
((_set1_)->regions_empty() == (_set2_)->regions_empty()), \
((_set1_)->regions_free() == (_set2_)->regions_free()), \
hrs_err_msg("the contents of set %s and set %s should match", \
(_set1_)->name(), (_set2_)->name())); \
} while (0)
@ -184,7 +184,7 @@ public:
class HeapRegionSet : public HeapRegionSetBase {
public:
HeapRegionSet(const char* name, bool humongous, HRSMtSafeChecker* mt_safety_checker):
HeapRegionSetBase(name, humongous, false /* empty */, mt_safety_checker) { }
HeapRegionSetBase(name, humongous, false /* free */, mt_safety_checker) { }
void bulk_remove(const HeapRegionSetCount& removed) {
_count.decrement(removed.length(), removed.capacity());

View File

@ -19,41 +19,51 @@
* 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.
*
*/
import sun.hotspot.WhiteBox;
#include "precompiled.hpp"
#include "gc_implementation/g1/heapRegionType.hpp"
class AllocateBeyondMetaspaceSize {
public static Object dummy;
public static void main(String [] args) {
if (args.length != 2) {
throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
bool HeapRegionType::is_valid(Tag tag) {
switch (tag) {
case FreeTag:
case EdenTag:
case SurvTag:
case HumStartsTag:
case HumContTag:
case OldTag:
return true;
}
return false;
}
long metaspaceSize = Long.parseLong(args[0]);
long youngGenSize = Long.parseLong(args[1]);
run(metaspaceSize, youngGenSize);
const char* HeapRegionType::get_str() const {
hrt_assert_is_valid(_tag);
switch (_tag) {
case FreeTag: return "FREE";
case EdenTag: return "EDEN";
case SurvTag: return "SURV";
case HumStartsTag: return "HUMS";
case HumContTag: return "HUMC";
case OldTag: return "OLD";
}
ShouldNotReachHere();
// keep some compilers happy
return NULL;
}
private static void run(long metaspaceSize, long youngGenSize) {
WhiteBox wb = WhiteBox.getWhiteBox();
long allocationBeyondMetaspaceSize = metaspaceSize * 2;
long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize);
triggerYoungGC(youngGenSize);
wb.freeMetaspace(null, metaspace, metaspace);
}
private static void triggerYoungGC(long youngGenSize) {
long approxAllocSize = 32 * 1024;
long numAllocations = 2 * youngGenSize / approxAllocSize;
for (long i = 0; i < numAllocations; i++) {
dummy = new byte[(int)approxAllocSize];
}
const char* HeapRegionType::get_short_str() const {
hrt_assert_is_valid(_tag);
switch (_tag) {
case FreeTag: return "F";
case EdenTag: return "E";
case SurvTag: return "S";
case HumStartsTag: return "HS";
case HumContTag: return "HC";
case OldTag: return "O";
}
ShouldNotReachHere();
// keep some compilers happy
return NULL;
}

View File

@ -0,0 +1,134 @@
/*
* Copyright (c) 2014, 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 SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP
#include "memory/allocation.hpp"
#define hrt_assert_is_valid(tag) \
assert(is_valid((tag)), err_msg("invalid HR type: %u", (uint) (tag)))
class HeapRegionType VALUE_OBJ_CLASS_SPEC {
private:
// We encode the value of the heap region type so the generation can be
// determined quickly. The tag is split into two parts:
//
// major type (young, humongous) : top N-1 bits
// minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit
//
// If there's need to increase the number of minor types in the
// future, we'll have to increase the size of the latter and hence
// decrease the size of the former.
//
// 0000 0 [ 0] Free
//
// 0001 0 Young Mask
// 0001 0 [ 2] Eden
// 0001 1 [ 3] Survivor
//
// 0010 0 Humongous Mask
// 0010 0 [ 4] Humongous Starts
// 0010 1 [ 5] Humongous Continues
//
// 01000 [ 8] Old
typedef enum {
FreeTag = 0,
YoungMask = 2,
EdenTag = YoungMask,
SurvTag = YoungMask + 1,
HumMask = 4,
HumStartsTag = HumMask,
HumContTag = HumMask + 1,
OldTag = 8
} Tag;
volatile Tag _tag;
static bool is_valid(Tag tag);
Tag get() const {
hrt_assert_is_valid(_tag);
return _tag;
}
// Sets the type to 'tag'.
void set(Tag tag) {
hrt_assert_is_valid(tag);
hrt_assert_is_valid(_tag);
_tag = tag;
}
// Sets the type to 'tag', expecting the type to be 'before'. This
// is available for when we want to add sanity checking to the type
// transition.
void set_from(Tag tag, Tag before) {
hrt_assert_is_valid(tag);
hrt_assert_is_valid(before);
hrt_assert_is_valid(_tag);
assert(_tag == before,
err_msg("HR tag: %u, expected: %u new tag; %u", _tag, before, tag));
_tag = tag;
}
public:
// Queries
bool is_free() const { return get() == FreeTag; }
bool is_young() const { return (get() & YoungMask) != 0; }
bool is_eden() const { return get() == EdenTag; }
bool is_survivor() const { return get() == SurvTag; }
bool is_humongous() const { return (get() & HumMask) != 0; }
bool is_starts_humongous() const { return get() == HumStartsTag; }
bool is_continues_humongous() const { return get() == HumContTag; }
bool is_old() const { return get() == OldTag; }
// Setters
void set_free() { set(FreeTag); }
void set_eden() { set_from(EdenTag, FreeTag); }
void set_eden_pre_gc() { set_from(EdenTag, SurvTag); }
void set_survivor() { set_from(SurvTag, FreeTag); }
void set_starts_humongous() { set_from(HumStartsTag, FreeTag); }
void set_continues_humongous() { set_from(HumContTag, FreeTag); }
void set_old() { set(OldTag); }
// Misc
const char* get_str() const;
const char* get_short_str() const;
HeapRegionType() : _tag(FreeTag) { hrt_assert_is_valid(_tag); }
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP

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