8003487: NMT: incorrect assertion in VMMemPointerIterator::remove_released_region method (memSnapshot.cpp)
Summary: The assertion is applied to only the region to be released, also performs region integrity checking
Reviewed-by: acorn, coleenp
## Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.## This code is free software; you can redistribute it and/or modify it# under the terms of the GNU General Public License version 2 only, as# published by the Free Software Foundation. Oracle designates this# particular file as subject to the "Classpath" exception as provided# by Oracle in the LICENSE file that accompanied this code.## 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.## If NEWBUILD is defined, use the new build-infra Makefiles and configure.# See NewMakefile.gmk for more information.ifeq ($(NEWBUILD),true) # The new top level Makefile include NewMakefile.gmkelse # Original Makefile logicBUILD_PARENT_DIRECTORY=.# Basename of any originally supplied ALT_OUTPUTDIR directoryifndef ORIG_OUTPUTDIR_BASENAME ifdef ALT_OUTPUTDIR ORIG_OUTPUTDIR_BASENAME := $(shell basename $(ALT_OUTPUTDIR)) else ORIG_OUTPUTDIR_BASENAME = $(PLATFORM)-$(ARCH) endifendifexport ORIG_OUTPUTDIR_BASENAME# The three possible directories created for output (3 build flavors)OUTPUTDIR_BASENAME- = $(ORIG_OUTPUTDIR_BASENAME)OUTPUTDIR_BASENAME-debug = $(ORIG_OUTPUTDIR_BASENAME)-debugOUTPUTDIR_BASENAME-fastdebug = $(ORIG_OUTPUTDIR_BASENAME)-fastdebug# Relative path to a debug output areaREL_JDK_OUTPUTDIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))# The created jdk image directoryJDK_IMAGE_DIRNAME = j2sdk-imageJDK_IMAGE_DIR = $(OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)ABS_JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)# Relative path from an output directory to the image directoryREL_JDK_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-$(DEBUG_NAME))/$(JDK_IMAGE_DIRNAME)REL_JDK_DEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-debug)/$(JDK_IMAGE_DIRNAME)REL_JDK_FASTDEBUG_IMAGE_DIR = ../$(OUTPUTDIR_BASENAME-fastdebug)/$(JDK_IMAGE_DIRNAME)ifndef TOPDIR TOPDIR:=.endififndef JDK_TOPDIR JDK_TOPDIR=$(TOPDIR)/jdkendififndef JDK_MAKE_SHARED_DIR JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/sharedendifdefault: allinclude $(JDK_MAKE_SHARED_DIR)/Defs-control.gmkinclude ./make/Defs-internal.gmkinclude ./make/sanity-rules.gmkinclude ./make/hotspot-rules.gmkinclude ./make/langtools-rules.gmkinclude ./make/corba-rules.gmkinclude ./make/jaxp-rules.gmkinclude ./make/jaxws-rules.gmkinclude ./make/jdk-rules.gmkinclude ./make/install-rules.gmkinclude ./make/sponsors-rules.gmkinclude ./make/deploy-rules.gmkall:: sanityifeq ($(SKIP_FASTDEBUG_BUILD), false) all:: fastdebug_buildendififeq ($(SKIP_DEBUG_BUILD), false) all:: debug_buildendifall:: all_product_build all_product_build::# Everything for a full product buildifeq ($(SKIP_PRODUCT_BUILD), false) all_product_build:: product_build ifeq ($(BUILD_INSTALL), true) all_product_build:: $(INSTALL) clobber:: install-clobber endif ifeq ($(BUILD_SPONSORS), true) all_product_build:: $(SPONSORS) clobber:: sponsors-clobber endif ifneq ($(SKIP_COMPARE_IMAGES), true) all_product_build:: compare-image endifendifdefine StartTimer $(MKDIR) -p $(BUILDTIMESDIR) $(RM) $(BUILDTIMESDIR)/build_time_* $(call RecordStartTime,TOTAL)endefdefine StopTimer $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),)endef# Generic build of basic repo seriesgeneric_build_repo_series:: $(SOURCE_TIPS) $(MKDIR) -p $(JDK_IMAGE_DIR) @$(call StartTimer)ifeq ($(BUILD_LANGTOOLS), true) generic_build_repo_series:: langtools clobber:: langtools-clobberendififeq ($(BUILD_CORBA), true) generic_build_repo_series:: corba clobber:: corba-clobberendififeq ($(BUILD_JAXP), true) generic_build_repo_series:: jaxp clobber:: jaxp-clobberendififeq ($(BUILD_JAXWS), true) generic_build_repo_series:: jaxws clobber:: jaxws-clobberendififeq ($(BUILD_HOTSPOT), true) generic_build_repo_series:: $(HOTSPOT) clobber:: hotspot-clobberendififeq ($(BUILD_JDK), true) generic_build_repo_series:: $(JDK_JAVA_EXE) clobber:: jdk-clobberendififeq ($(BUILD_DEPLOY), true) generic_build_repo_series:: $(DEPLOY) clobber:: deploy-clobberendifgeneric_build_repo_series:: @$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build))# The debug build, fastdebug or debug. Needs special handling.# Note that debug builds do NOT do INSTALL steps, but must be done# after the product build and before the INSTALL step of the product build.## DEBUG_NAME is fastdebug or debug# ALT_OUTPUTDIR is changed to have -debug or -fastdebug suffix# The resulting image directory (j2sdk-image) is used by the install makefiles# to create a debug install bundle jdk-*-debug-** bundle (tar or zip) # which will install in the debug or fastdebug subdirectory of the# normal product install area.# The install process needs to know what the DEBUG_NAME is, so# look for INSTALL_DEBUG_NAME in the install rules.## NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).# Due to the use of short paths in $(ABS_OUTPUTDIR), this may # not be the same location.## Location of fresh bootdir outputABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdkFRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(JDK_IMAGE_DIRNAME)FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/$(REL_JDK_IMAGE_DIR)create_fresh_product_bootdir: FRC $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_SETTINGS= \ build_product_imagecreate_fresh_debug_bootdir: FRC $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_DEBUG_SETTINGS= \ build_debug_imagecreate_fresh_fastdebug_bootdir: FRC $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_DEBUG_SETTINGS= \ build_fastdebug_image# Create boot image?ifeq ($(SKIP_BOOT_CYCLE),false) ifneq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64) DO_BOOT_CYCLE=true endifendififeq ($(DO_BOOT_CYCLE),true) # Create the bootdir to use in the build product_build:: create_fresh_product_bootdir debug_build:: create_fresh_debug_bootdir fastdebug_build:: create_fresh_fastdebug_bootdir # Define variables to be used now for the boot jdk BOOT_CYCLE_SETTINGS= \ ALT_BOOTDIR=$(FRESH_BOOTDIR) \ ALT_JDK_IMPORT_PATH=$(FRESH_BOOTDIR) BOOT_CYCLE_DEBUG_SETTINGS= \ ALT_BOOTDIR=$(FRESH_DEBUG_BOOTDIR) \ ALT_JDK_IMPORT_PATH=$(FRESH_DEBUG_BOOTDIR)else # Use the supplied ALT_BOOTDIR as the boot BOOT_CYCLE_SETTINGS= BOOT_CYCLE_DEBUG_SETTINGS=endifbuild_product_image: $(MAKE) \ SKIP_FASTDEBUG_BUILD=true \ SKIP_DEBUG_BUILD=true \ $(BOOT_CYCLE_SETTINGS) \ generic_build_repo_series# NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).# Due to the use of short paths in $(ABS_OUTPUTDIR), this may # not be the same location.generic_debug_build: $(MAKE) \ ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/$(REL_JDK_OUTPUTDIR) \ DEBUG_NAME=$(DEBUG_NAME) \ GENERATE_DOCS=false \ $(BOOT_CYCLE_DEBUG_SETTINGS) \ generic_build_repo_seriesbuild_debug_image: $(MAKE) DEBUG_NAME=debug generic_debug_buildbuild_fastdebug_image: $(MAKE) DEBUG_NAME=fastdebug generic_debug_build# Build final imageproduct_build:: build_product_imagedebug_build:: build_debug_imagefastdebug_build:: build_fastdebug_image# The source tips are stored with the relative path to the repo.# This file will be used when constructing the jdk image.source_tips: $(SOURCE_TIPS) $(CAT) $<$(SOURCE_TIPS): FRC @$(prep-target) @$(call GetSourceTips)clobber:: REPORT_BUILD_TIMES=clobber:: $(RM) -r $(OUTPUTDIR)/* -($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))clean: clobber## Dev builds#dev : dev-builddev-build: $(MAKE) DEV_ONLY=true alldev-sanity: $(MAKE) DEV_ONLY=true sanitydev-clobber: $(MAKE) DEV_ONLY=true clobber## Quick jdk verification build#jdk_only: $(MAKE) SKIP_FASTDEBUG_BUILD=true BUILD_HOTSPOT=false all## Quick jdk verification fastdebug build#jdk_fastdebug_only: $(MAKE) DEBUG_NAME=fastdebug BUILD_HOTSPOT=false BUILD_DEPLOY=false \ BUILD_INSTALL=false BUILD_SPONSORS=false generic_debug_build## Quick deploy verification fastdebug build#deploy_fastdebug_only: $(MAKE) \ DEBUG_NAME=fastdebug \ BUILD_HOTSPOT=false \ BUILD_JDK=false \ BUILD_LANGTOOLS=false \ BUILD_CORBA=false \ BUILD_JAXP=false \ BUILD_JAXWS=false \ BUILD_INSTALL=false \ BUILD_SPONSORS=false \ generic_debug_build## Product build (skip debug builds)#product_only: $(MAKE) SKIP_FASTDEBUG_BUILD=true all## Check target#check: variable_check## Help target#help: intro_help target_help variable_help notes_help examples_help# Intro help messageintro_help: @$(ECHO) "\Makefile for the JDK builds (all the JDK). \n\"# Target helptarget_help: @$(ECHO) "\--- Common Targets --- \n\all -- build the core JDK (default target) \n\help -- Print out help information \n\check -- Check make variable values for correctness \n\sanity -- Perform detailed sanity checks on system and settings \n\fastdebug_build -- build the core JDK in 'fastdebug' mode (-g -O) \n\debug_build -- build the core JDK in 'debug' mode (-g) \n\clean -- remove all built and imported files \n\clobber -- same as clean \n\"# Variable help (only common ones used by this Makefile)variable_help: variable_help_intro variable_list variable_help_endvariable_help_intro: @$(ECHO) "--- Common Variables ---"variable_help_end: @$(ECHO) " "# One line descriptions for the variablesOUTPUTDIR.desc = Output directoryPARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run countSLASH_JAVA.desc = Root of all build tools, e.g. /java or J:BOOTDIR.desc = JDK used to boot the buildJDK_IMPORT_PATH.desc = JDK used to import components of the buildCOMPILER_PATH.desc = Compiler install directoryCACERTS_FILE.desc = Location of certificates fileDEVTOOLS_PATH.desc = Directory containing zip and gnumakeCUPS_HEADERS_PATH.desc = Include directory location for CUPS header filesDXSDK_PATH.desc = Root directory of DirectX SDK# Make variables to print out (description and value)VARIABLE_PRINTVAL_LIST += \ OUTPUTDIR \ PARALLEL_COMPILE_JOBS \ SLASH_JAVA \ BOOTDIR \ JDK_IMPORT_PATH \ COMPILER_PATH \ CACERTS_FILE \ DEVTOOLS_PATH# Make variables that should refer to directories that existVARIABLE_CHECKDIR_LIST += \ SLASH_JAVA \ BOOTDIR \ JDK_IMPORT_PATH \ COMPILER_PATH \ DEVTOOLS_PATH # Make variables that should refer to files that existVARIABLE_CHECKFIL_LIST += \ CACERTS_FILE# Some are windows specificifeq ($(PLATFORM), windows)VARIABLE_PRINTVAL_LIST += \ DXSDK_PATHVARIABLE_CHECKDIR_LIST += \ DXSDK_PATHendif# For pattern rules below, so all are treated the sameDO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval)DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir)DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil)# Complete variable checkvariable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST)variable_list: $(DO_PRINTVAL_LIST) variable_check# Pattern rule for printing out a variable%.printval: @$(ECHO) " ALT_$* - $($*.desc)" @$(ECHO) " \t $*=$($*)"# Pattern rule for checking to see if a variable with a directory exists%.checkdir: @if [ ! -d $($*) ] ; then \ $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ fi# Pattern rule for checking to see if a variable with a file exists%.checkfil: @if [ ! -f $($*) ] ; then \ $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ fi# Misc notes on helpnotes_help: @$(ECHO) "\--- Notes --- \n\- All builds use same output directory unless overridden with \n\ \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ \t to use the clean target first. \n\- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ \t builds or previous release JDK builds will work. \n\- The fastest builds have been when the sources and the BOOTDIR are on \n\ \t local disk. \n\"examples_help: @$(ECHO) "\--- Examples --- \n\ $(MAKE) fastdebug_build \n\ $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug_build \n\ $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.5.0 \n\ $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.6.0 \n\"################################################################# Source bundling################################################################ifeq ($(BUNDLE_RULES_AVAILABLE), true) include $(BUNDLE_RULES)endif################################################################# rule to test################################################################.NOTPARALLEL: test_runtest: $(MAKE) test_runtest_run: test_clean test_start test_summarytest_start: @$(ECHO) "Tests started at `$(DATE)`"test_clean: $(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txttest_summary: $(OUTPUTDIR)/test_failures.txt @$(ECHO) "#################################################" @$(ECHO) "Tests completed at `$(DATE)`" @( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \ || $(ECHO) "No TEST STATS seen in log" ) @$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt" @$(ECHO) "#################################################" @if [ -s $< ] ; then \ $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \ $(CAT) $<; \ exit 1; \ else \ $(ECHO) "Success! No failures detected"; \ fi# Get failure list from log$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt @$(RM) $@ @( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@# Get log file of all tests runJDK_TO_TEST := $(shell \ if [ -d "$(ABS_JDK_IMAGE_DIR)" ] ; then \ $(ECHO) "$(ABS_JDK_IMAGE_DIR)"; \ elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then \ $(ECHO) "$(ABS_OUTPUTDIR)"; \ elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then \ $(ECHO) "$(PRODUCT_HOME)"; \ fi \)TEST_TARGETS=all$(OUTPUTDIR)/test_log.txt: $(RM) $@ ( $(CD) test && \ $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \ ) | tee $@################################################################# JPRT rule to build################################################################include ./make/jprt.gmk################################################################# PHONY################################################################.PHONY: all test test_run test_start test_summary test_clean \ generic_build_repo_series \ what clobber insane \ dev dev-build dev-sanity dev-clobber \ product_build \ fastdebug_build \ debug_build \ build_product_image \ build_debug_image \ build_fastdebug_image \ create_fresh_product_bootdir \ create_fresh_debug_bootdir \ create_fresh_fastdebug_bootdir \ generic_debug_build# Force targetFRC:endif # Original Makefile logic