提交 86ea1380 编写于 作者: D dcubed

Merge

# #
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -133,8 +133,10 @@ $(GENERATEDFILES): refresh_adfiles ...@@ -133,8 +133,10 @@ $(GENERATEDFILES): refresh_adfiles
# Note that product files are updated via "mv", which is atomic. # Note that product files are updated via "mv", which is atomic.
TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
# Debuggable by default ifneq ($(DEBUG_BINARIES), true)
CFLAGS += -g # Debuggable by default (unless already done by DEBUG_BINARIES)
CFLAGS += -g
endif
# Pass -D flags into ADLC. # Pass -D flags into ADLC.
ADLCFLAGS += $(SYSDEFS) ADLCFLAGS += $(SYSDEFS)
......
...@@ -215,22 +215,26 @@ AOUT_FLAGS += -Xlinker -export-dynamic ...@@ -215,22 +215,26 @@ AOUT_FLAGS += -Xlinker -export-dynamic
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Debug flags # Debug flags
# Use the stabs format for debugging information (this is the default # DEBUG_BINARIES uses full -g debug information for all configs
# on gcc-2.91). It's good enough, has all the information about line ifeq ($(DEBUG_BINARIES), true)
# numbers and local variables, and libjvm_g.so is only about 16M. CFLAGS += -g
# Change this back to "-g" if you want the most expressive format. else
# (warning: that could easily inflate libjvm_g.so to 150M!) # Use the stabs format for debugging information (this is the default
# Note: The Itanium gcc compiler crashes when using -gstabs. # on gcc-2.91). It's good enough, has all the information about line
DEBUG_CFLAGS/ia64 = -g # numbers and local variables, and libjvm_g.so is only about 16M.
DEBUG_CFLAGS/amd64 = -g # Change this back to "-g" if you want the most expressive format.
DEBUG_CFLAGS/arm = -g # (warning: that could easily inflate libjvm_g.so to 150M!)
DEBUG_CFLAGS/ppc = -g # Note: The Itanium gcc compiler crashes when using -gstabs.
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) DEBUG_CFLAGS/ia64 = -g
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) DEBUG_CFLAGS/amd64 = -g
DEBUG_CFLAGS += -gstabs DEBUG_CFLAGS/arm = -g
endif DEBUG_CFLAGS/ppc = -g
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
DEBUG_CFLAGS += -gstabs
endif
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
FASTDEBUG_CFLAGS/ia64 = -g FASTDEBUG_CFLAGS/ia64 = -g
FASTDEBUG_CFLAGS/amd64 = -g FASTDEBUG_CFLAGS/amd64 = -g
FASTDEBUG_CFLAGS/arm = -g FASTDEBUG_CFLAGS/arm = -g
...@@ -248,12 +252,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ...@@ -248,12 +252,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
OPT_CFLAGS += -gstabs OPT_CFLAGS += -gstabs
endif endif
endif endif
# DEBUG_BINARIES overrides everything, use full -g debug information
ifeq ($(DEBUG_BINARIES), true)
DEBUG_CFLAGS = -g
CFLAGS += $(DEBUG_CFLAGS)
endif endif
# If we are building HEADLESS, pass on to VM # If we are building HEADLESS, pass on to VM
......
...@@ -188,14 +188,22 @@ ifdef COOKED_BUILD_NUMBER ...@@ -188,14 +188,22 @@ ifdef COOKED_BUILD_NUMBER
MAKE_ARGS += JDK_BUILD_NUMBER=$(COOKED_BUILD_NUMBER) MAKE_ARGS += JDK_BUILD_NUMBER=$(COOKED_BUILD_NUMBER)
endif endif
NMAKE= MAKEFLAGS= MFLAGS= nmake /NOLOGO NMAKE= MAKEFLAGS= MFLAGS= nmake -NOLOGO
ifndef SYSTEM_UNAME
SYSTEM_UNAME := $(shell uname)
export SYSTEM_UNAME
endif
# Check for CYGWIN # Check for CYGWIN
ifneq (,$(findstring CYGWIN,$(shell uname))) ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
USING_CYGWIN=true USING_CYGWIN=true
else else
USING_CYGWIN=false USING_CYGWIN=false
endif endif
# Check for MinGW
ifneq (,$(findstring MINGW,$(SYSTEM_UNAME)))
USING_MINGW=true
endif
# FIXUP: The subdirectory for a debug build is NOT the same on all platforms # FIXUP: The subdirectory for a debug build is NOT the same on all platforms
VM_DEBUG=debug VM_DEBUG=debug
...@@ -208,7 +216,12 @@ ifeq ($(USING_CYGWIN), true) ...@@ -208,7 +216,12 @@ ifeq ($(USING_CYGWIN), true)
ABS_BOOTDIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(BOOTDIR)")) ABS_BOOTDIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(BOOTDIR)"))
ABS_GAMMADIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(GAMMADIR)")) ABS_GAMMADIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(GAMMADIR)"))
ABS_OS_MAKEFILE := $(shell /bin/cygpath -m -a "$(HS_MAKE_DIR)/$(OSNAME)")/build.make ABS_OS_MAKEFILE := $(shell /bin/cygpath -m -a "$(HS_MAKE_DIR)/$(OSNAME)")/build.make
else else ifeq ($(USING_MINGW), true)
ABS_OUTPUTDIR := $(shell $(CD) $(OUTPUTDIR);$(PWD))
ABS_BOOTDIR := $(shell $(CD) $(BOOTDIR);$(PWD))
ABS_GAMMADIR := $(shell $(CD) $(GAMMADIR);$(PWD))
ABS_OS_MAKEFILE := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME);$(PWD))/build.make
else
ABS_OUTPUTDIR := $(subst /,\\,$(shell $(CD) $(OUTPUTDIR);$(PWD))) ABS_OUTPUTDIR := $(subst /,\\,$(shell $(CD) $(OUTPUTDIR);$(PWD)))
ABS_BOOTDIR := $(subst /,\\,$(shell $(CD) $(BOOTDIR);$(PWD))) ABS_BOOTDIR := $(subst /,\\,$(shell $(CD) $(BOOTDIR);$(PWD)))
ABS_GAMMADIR := $(subst /,\\,$(shell $(CD) $(GAMMADIR);$(PWD))) ABS_GAMMADIR := $(subst /,\\,$(shell $(CD) $(GAMMADIR);$(PWD)))
......
...@@ -23,14 +23,15 @@ ...@@ -23,14 +23,15 @@
# #
# These are the commands used externally to compile and run. # These are the commands used externally to compile and run.
# The \ are used here for traditional Windows apps and " quoted to get
# past the Unix-like shell:
!ifdef BootStrapDir !ifdef BootStrapDir
RUN_JAVA=$(BootStrapDir)\bin\java RUN_JAVA="$(BootStrapDir)\bin\java"
RUN_JAVAP=$(BootStrapDir)\bin\javap RUN_JAVAP="$(BootStrapDir)\bin\javap"
RUN_JAVAH=$(BootStrapDir)\bin\javah RUN_JAVAH="$(BootStrapDir)\bin\javah"
RUN_JAR=$(BootStrapDir)\bin\jar RUN_JAR="$(BootStrapDir)\bin\jar"
COMPILE_JAVAC=$(BootStrapDir)\bin\javac $(BOOTSTRAP_JAVAC_FLAGS) COMPILE_JAVAC="$(BootStrapDir)\bin\javac" $(BOOTSTRAP_JAVAC_FLAGS)
COMPILE_RMIC=$(BootStrapDir)\bin\rmic COMPILE_RMIC="$(BootStrapDir)\bin\rmic"
BOOT_JAVA_HOME=$(BootStrapDir) BOOT_JAVA_HOME=$(BootStrapDir)
!else !else
RUN_JAVA=java RUN_JAVA=java
......
...@@ -36,37 +36,37 @@ checkAndBuildSA:: ...@@ -36,37 +36,37 @@ checkAndBuildSA::
!include $(WorkSpace)/make/windows/makefiles/rules.make !include $(WorkSpace)/make/windows/makefiles/rules.make
!include $(WorkSpace)/make/sa.files !include $(WorkSpace)/make/sa.files
GENERATED = ..\generated GENERATED = ../generated
# tools.jar is needed by the JDI - SA binding # tools.jar is needed by the JDI - SA binding
SA_CLASSPATH = $(BOOT_JAVA_HOME)\lib\tools.jar SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
SA_CLASSDIR = $(GENERATED)\saclasses SA_CLASSDIR = $(GENERATED)/saclasses
SA_BUILD_VERSION_PROP = sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION) SA_BUILD_VERSION_PROP = sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)
SA_PROPERTIES = $(SA_CLASSDIR)\sa.properties SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
default:: $(GENERATED)\sa-jdi.jar default:: $(GENERATED)/sa-jdi.jar
# Remove the space between $(SA_BUILD_VERSION_PROP) and > below as it adds a white space # Remove the space between $(SA_BUILD_VERSION_PROP) and > below as it adds a white space
# at the end of SA version string and causes a version mismatch with the target VM version. # at the end of SA version string and causes a version mismatch with the target VM version.
$(GENERATED)\sa-jdi.jar: $(AGENT_FILES:/=\) $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
@if not exist $(SA_CLASSDIR) mkdir $(SA_CLASSDIR) $(QUIETLY) mkdir -p $(SA_CLASSDIR)
@echo ...Building sa-jdi.jar @echo ...Building sa-jdi.jar into $(SA_CLASSDIR)
@echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) .... @echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) ....
@$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES:/=\) @$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES)
$(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer $(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES) $(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
$(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
$(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
$(QUIETLY) mkdir $(SA_CLASSDIR)\sun\jvm\hotspot\ui\resources $(QUIETLY) mkdir $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
$(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
$(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR) $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)
$(RUN_JAR) cf $@ -C $(SA_CLASSDIR) . $(RUN_JAR) cf $@ -C $(SA_CLASSDIR) .
$(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR:/=\) META-INF\services\com.sun.jdi.connect.Connector $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext
...@@ -85,27 +85,27 @@ checkAndBuildSA:: $(SAWINDBG) ...@@ -85,27 +85,27 @@ checkAndBuildSA:: $(SAWINDBG)
# will be useful to have the assertion checks in place # will be useful to have the assertion checks in place
!if "$(BUILDARCH)" == "ia64" !if "$(BUILDARCH)" == "ia64"
SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 $(GX_OPTION) /Od /D "WIN32" /D "WIN64" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
!elseif "$(BUILDARCH)" == "amd64" !elseif "$(BUILDARCH)" == "amd64"
SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 $(GX_OPTION) /Od /D "WIN32" /D "WIN64" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
!if "$(COMPILER_NAME)" == "VS2005" !if "$(COMPILER_NAME)" == "VS2005"
# On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, # On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line,
# otherwise we get missing __security_check_cookie externals at link time. # otherwise we get missing __security_check_cookie externals at link time.
SA_LD_FLAGS = bufferoverflowU.lib SA_LD_FLAGS = bufferoverflowU.lib
!endif !endif
!else !else
SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 /Gm $(GX_OPTION) /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
SA_CFLAGS = $(SA_CFLAGS) /ZI SA_CFLAGS = $(SA_CFLAGS) -ZI
!endif !endif
!endif !endif
!if "$(MT)" != "" !if "$(MT)" != ""
SA_LD_FLAGS = /manifest $(SA_LD_FLAGS) SA_LD_FLAGS = -manifest $(SA_LD_FLAGS)
!endif !endif
SASRCFILE = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp SASRCFILE = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp
SA_LFLAGS = $(SA_LD_FLAGS) /nologo /subsystem:console /machine:$(MACHINE) SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE)
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
SA_LFLAGS = $(SA_LFLAGS) /map /debug SA_LFLAGS = $(SA_LFLAGS) -map -debug
!endif !endif
# Note that we do not keep sawindbj.obj around as it would then # Note that we do not keep sawindbj.obj around as it would then
...@@ -117,15 +117,15 @@ SA_LFLAGS = $(SA_LFLAGS) /map /debug ...@@ -117,15 +117,15 @@ SA_LFLAGS = $(SA_LFLAGS) /map /debug
$(SAWINDBG): $(SASRCFILE) $(SAWINDBG): $(SASRCFILE)
set INCLUDE=$(SA_INCLUDE)$(INCLUDE) set INCLUDE=$(SA_INCLUDE)$(INCLUDE)
$(CXX) @<< $(CXX) @<<
/I"$(BootStrapDir)/include" /I"$(BootStrapDir)/include/win32" -I"$(BootStrapDir)/include" -I"$(BootStrapDir)/include/win32"
/I"$(GENERATED)" $(SA_CFLAGS) -I"$(GENERATED)" $(SA_CFLAGS)
$(SASRCFILE) $(SASRCFILE)
/out:$*.obj -out:$*.obj
<< <<
set LIB=$(SA_LIB)$(LIB) set LIB=$(SA_LIB)$(LIB)
$(LD) /out:$@ /DLL $*.obj dbgeng.lib $(SA_LFLAGS) $(LD) -out:$@ -DLL $*.obj dbgeng.lib $(SA_LFLAGS)
!if "$(MT)" != "" !if "$(MT)" != ""
$(MT) /manifest $(@F).manifest /outputresource:$(@F);#2 $(MT) -manifest $(@F).manifest -outputresource:$(@F);#2
!endif !endif
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
!if "$(ZIP_DEBUGINFO_FILES)" == "1" !if "$(ZIP_DEBUGINFO_FILES)" == "1"
...@@ -136,6 +136,6 @@ $(SAWINDBG): $(SASRCFILE) ...@@ -136,6 +136,6 @@ $(SAWINDBG): $(SASRCFILE)
-@rm -f $*.obj -@rm -f $*.obj
cleanall : cleanall :
rm -rf $(GENERATED:\=/)/saclasses rm -rf $(GENERATED)/saclasses
rm -rf $(GENERATED:\=/)/sa-jdi.jar rm -rf $(GENERATED)/sa-jdi.jar
!endif !endif
...@@ -36,11 +36,12 @@ CXX=cl.exe ...@@ -36,11 +36,12 @@ CXX=cl.exe
!ifdef SUBDIRS !ifdef SUBDIRS
# \ is used below because $(MAKE) is nmake here, which expects Windows paths
$(SUBDIRS): FORCE $(SUBDIRS): FORCE
@if not exist $@ mkdir $@ @if not exist $@ mkdir $@
@if not exist $@\local.make echo # Empty > $@\local.make @if not exist $@/local.make echo # Empty > $@/local.make
@echo nmake $(ACTION) in $(DIR)\$@ @echo nmake $(ACTION) in $(DIR)/$@
cd $@ && $(MAKE) /NOLOGO /f $(WorkSpace)\make\windows\makefiles\$@.make $(ACTION) DIR=$(DIR)\$@ BUILD_FLAVOR=$(BUILD_FLAVOR) cd $@ && $(MAKE) -NOLOGO -f $(WorkSpace)\make\windows\makefiles\$@.make $(ACTION) DIR=$(DIR)\$@ BUILD_FLAVOR=$(BUILD_FLAVOR)
!endif !endif
# Creates the needed directory # Creates the needed directory
......
...@@ -344,7 +344,7 @@ void MemSnapshot::promote() { ...@@ -344,7 +344,7 @@ void MemSnapshot::promote() {
// due to platform dependent behaviors. On some platforms, we see uncommit/release // due to platform dependent behaviors. On some platforms, we see uncommit/release
// native thread stack, but some, we don't. // native thread stack, but some, we don't.
if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) { if (!cur_vm->is_uncommit_record() && !cur_vm->is_deallocation_record()) {
ShouldNotReachHere(); fatal(err_msg("Should not reach here, pointer flags = [%x]", cur_vm->flags()));
} }
#endif #endif
} }
......
...@@ -63,13 +63,13 @@ class MemPointerIterator : public MemPointerArrayIteratorImpl { ...@@ -63,13 +63,13 @@ class MemPointerIterator : public MemPointerArrayIteratorImpl {
MemPointer* p1 = (MemPointer*)ptr; MemPointer* p1 = (MemPointer*)ptr;
MemPointer* p2 = (MemPointer*)_array->at(_pos - 1); MemPointer* p2 = (MemPointer*)_array->at(_pos - 1);
assert(!is_dup_pointer(p1, p2), assert(!is_dup_pointer(p1, p2),
"dup pointer"); err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
} }
if (_pos < _array->length() -1) { if (_pos < _array->length() -1) {
MemPointer* p1 = (MemPointer*)ptr; MemPointer* p1 = (MemPointer*)ptr;
MemPointer* p2 = (MemPointer*)_array->at(_pos + 1); MemPointer* p2 = (MemPointer*)_array->at(_pos + 1);
assert(!is_dup_pointer(p1, p2), assert(!is_dup_pointer(p1, p2),
"dup pointer"); err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
} }
return _array->insert_at(ptr, _pos); return _array->insert_at(ptr, _pos);
} }
...@@ -79,14 +79,14 @@ class MemPointerIterator : public MemPointerArrayIteratorImpl { ...@@ -79,14 +79,14 @@ class MemPointerIterator : public MemPointerArrayIteratorImpl {
MemPointer* p1 = (MemPointer*)ptr; MemPointer* p1 = (MemPointer*)ptr;
MemPointer* p2 = (MemPointer*)_array->at(_pos - 1); MemPointer* p2 = (MemPointer*)_array->at(_pos - 1);
assert(!is_dup_pointer(p1, p2), assert(!is_dup_pointer(p1, p2),
"dup pointer"); err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
} }
if (_pos < _array->length() - 1) { if (_pos < _array->length() - 1) {
MemPointer* p1 = (MemPointer*)ptr; MemPointer* p1 = (MemPointer*)ptr;
MemPointer* p2 = (MemPointer*)_array->at(_pos + 1); MemPointer* p2 = (MemPointer*)_array->at(_pos + 1);
assert(!is_dup_pointer(p1, p2), assert(!is_dup_pointer(p1, p2),
"dup pointer"); err_msg("duplicated pointer, flag = [%x]", (unsigned int)((MemPointerRecord*)p1)->flags()));
} }
if (_array->insert_at(ptr, _pos + 1)) { if (_array->insert_at(ptr, _pos + 1)) {
_pos ++; _pos ++;
......
...@@ -99,9 +99,11 @@ void MemTrackWorker::run() { ...@@ -99,9 +99,11 @@ void MemTrackWorker::run() {
} }
if (rec != NULL) { if (rec != NULL) {
// merge the recorder into staging area // merge the recorder into staging area
bool result = snapshot->merge(rec); if (!snapshot->merge(rec)) {
assert(result, "merge failed"); MemTracker::shutdown(MemTracker::NMT_out_of_memory);
debug_only(_merge_count ++;) } else {
NOT_PRODUCT(_merge_count ++;)
}
MemTracker::release_thread_recorder(rec); MemTracker::release_thread_recorder(rec);
} else { } else {
// no more recorder to merge, promote staging area // no more recorder to merge, promote staging area
...@@ -129,7 +131,7 @@ void MemTrackWorker::run() { ...@@ -129,7 +131,7 @@ void MemTrackWorker::run() {
} }
assert(MemTracker::shutdown_in_progress(), "just check"); assert(MemTracker::shutdown_in_progress(), "just check");
// transites to final shutdown // transits to final shutdown
MemTracker::final_shutdown(); MemTracker::final_shutdown();
} }
......
...@@ -184,7 +184,6 @@ class MemTracker : AllStatic { ...@@ -184,7 +184,6 @@ class MemTracker : AllStatic {
// record a 'malloc' call // record a 'malloc' call
static inline void record_malloc(address addr, size_t size, MEMFLAGS flags, static inline void record_malloc(address addr, size_t size, MEMFLAGS flags,
address pc = 0, Thread* thread = NULL) { address pc = 0, Thread* thread = NULL) {
assert(is_on(), "check by caller");
if (NMT_CAN_TRACK(flags)) { if (NMT_CAN_TRACK(flags)) {
create_memory_record(addr, (flags|MemPointerRecord::malloc_tag()), size, pc, thread); create_memory_record(addr, (flags|MemPointerRecord::malloc_tag()), size, pc, thread);
} }
...@@ -285,7 +284,6 @@ class MemTracker : AllStatic { ...@@ -285,7 +284,6 @@ class MemTracker : AllStatic {
// retrieve global snapshot // retrieve global snapshot
static MemSnapshot* get_snapshot() { static MemSnapshot* get_snapshot() {
assert(is_on(), "native memory tracking is off");
if (shutdown_in_progress()) { if (shutdown_in_progress()) {
return NULL; return NULL;
} }
......
...@@ -21,7 +21,7 @@ fi ...@@ -21,7 +21,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## skip on windows ## skip on windows
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
......
...@@ -49,7 +49,7 @@ fi ...@@ -49,7 +49,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
......
...@@ -28,7 +28,7 @@ fi ...@@ -28,7 +28,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
......
...@@ -27,17 +27,10 @@ case "$OS" in ...@@ -27,17 +27,10 @@ case "$OS" in
PS=":" PS=":"
FS="/" FS="/"
;; ;;
SunOS | Windows_* | *BSD) * )
NULL=NUL
PS=";"
FS="\\"
echo "Test passed; only valid for Linux" echo "Test passed; only valid for Linux"
exit 0; exit 0;
;; ;;
* )
echo "Unrecognized system!"
exit 1;
;;
esac esac
# Choose arch: i386 or amd64 (test is Linux-specific) # Choose arch: i386 or amd64 (test is Linux-specific)
......
...@@ -43,7 +43,7 @@ fi ...@@ -43,7 +43,7 @@ fi
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
FS="/" FS="/"
;; ;;
Windows_* ) Windows_* )
......
...@@ -37,7 +37,7 @@ fi ...@@ -37,7 +37,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
FS="/" FS="/"
RM=/bin/rm RM=/bin/rm
CP=/bin/cp CP=/bin/cp
......
...@@ -46,7 +46,7 @@ fi ...@@ -46,7 +46,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin )
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
...@@ -67,13 +67,13 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH ...@@ -67,13 +67,13 @@ CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
THIS_DIR=`pwd` THIS_DIR=`pwd`
${TESTJAVA}${FS}bin${FS}java -fullversion ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}InternTest.java ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}InternTest.java
cp ${TESTSRC}${FS}badstrings.txt . cp ${TESTSRC}${FS}badstrings.txt .
${TESTJAVA}${FS}bin${FS}java -XX:+PrintStringTableStatistics -XX:+TraceSafepointCleanupTime InternTest bad > test.out 2>&1 & ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -XX:+PrintStringTableStatistics -XX:+TraceSafepointCleanupTime InternTest bad > test.out 2>&1 &
C_PID=$! C_PID=$!
sleep 60 sleep 60
......
...@@ -21,7 +21,7 @@ fi ...@@ -21,7 +21,7 @@ fi
# set platform-dependent variables # set platform-dependent variables
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS | Linux ) SunOS | Linux | Darwin)
NULL=/dev/null NULL=/dev/null
PS=":" PS=":"
FS="/" FS="/"
...@@ -52,30 +52,7 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion ...@@ -52,30 +52,7 @@ ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -fullversion
${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java ${TESTJAVA}${FS}bin${FS}javac -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar *.java
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out 2>&1 & ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath .${PS}$TESTJAVA${FS}lib${FS}tools.jar FieldMonitor > test.out
P_PID=$!
sleep 60
STATUS=0
case "$OS" in
SunOS | Linux )
ps -ef | grep $P_PID | grep -v grep > ${NULL}
if [ $? = 0 ]; then
kill -9 $P_PID
STATUS=1
fi
;;
* )
ps | grep -i "FieldMonitor" | grep -v grep > ${NULL}
if [ $? = 0 ]; then
C_PID=`ps | grep -i "FieldMonitor" | awk '{print $1}'`
kill -s 9 $C_PID
STATUS=1
fi
;;
esac
grep "A fatal error has been detected" test.out > ${NULL} grep "A fatal error has been detected" test.out > ${NULL}
if [ $? = 0 ]; then if [ $? = 0 ]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册