--- a/.hgtags Mon Oct 15 10:29:06 2018 +0530
+++ b/.hgtags Tue Oct 16 14:26:22 2018 +0530
@@ -515,3 +515,6 @@
15094d12a632f452a2064318a4e416d0c7a9ce0c jdk-12+12
511a9946f83e3e3c7b9dbe1840367063fb39b4e1 jdk-12+13
8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
+8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
+6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14
+f8626bcc169813a4b2a15880386b952719d1d6d1 jdk-12+15
--- a/make/BuildStatic.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/BuildStatic.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -42,7 +42,7 @@
$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
$(call LogInfo, Generating global exported.symbols file)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(CAT) $^ > $@
TARGETS += $(GLOBAL_SYMBOLS_FILE)
--- a/make/Bundles.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/Bundles.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -70,6 +70,7 @@
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
+ $$(call MakeTargetDir)
# If any of the files contain a space in the file name, CacheFind
# will have replaced it with ?. Tar does not accept that so need to
# switch it back.
@@ -79,7 +80,6 @@
$$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
&& $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
)
- $$(call MakeDir, $$(@D))
ifneq ($$($1_SPECIAL_INCLUDES), )
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
$$(foreach d, $$($1_BASE_DIRS), \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/CompileCommands.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2018, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+# When FIXPATH is set, let it process the file to make sure all paths are usable
+# by system native tools. The FIXPATH tool assumes arguments preceeded by an @
+# character points to a text file containing further arguments (similar to a
+# linker). It replaces any such arguments with a different temporary filename,
+# whose contents has been processed to make any paths native. To obtain a
+# properly processed compile_commands.json, FIXPATH is then made to invoke an
+# AWK script with the unprocessed json file as the only argument, prepended with
+# an @ character. The AWK script simply copies the contents of this processed
+# file.
+#
+# The sed command encloses the fragments inside brackets and removes the final
+# trailing comma.
+$(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-commands/*.json)
+ $(call LogWarn, Updating compile_commands.json)
+ $(RM) $@
+ $(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \
+ $(SORT) | $(XARGS) $(CAT) >> $@.tmp
+ $(if $(FIXPATH),$(FIXPATH) $(AWK) 'BEGIN { \
+ tmpfile = substr(ARGV[2],2); \
+ cmd = "$(CP) " "\047" tmpfile "\047" " $@.tmp"; \
+ system(cmd); \
+ }' -- @$@.tmp)
+ $(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' $@.tmp > $@
+ $(RM) $@.tmp
+
+TARGETS += $(OUTPUTDIR)/compile_commands.json
+
+all: $(TARGETS)
+
+.PHONY: all
--- a/make/CopyInterimCLDRConverter.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/CopyInterimCLDRConverter.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -33,7 +33,7 @@
### CLDRConverter needs the JRE time zone names from the java.base source.
define cldrconverter_copytznames
- $(MKDIR) -p '$(@D)'
+ $(call MakeTargetDir)
$(RM) '$@'
$(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
-e "s/extends TimeZoneNamesBundle//" \
@@ -46,7 +46,7 @@
DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
FILES := TimeZoneNames.java, \
MACRO := cldrconverter_copytznames))
-
+
##########################################################################################
all: $(COPY_INTERIM_CLDRCONVERTER)
--- a/make/CreateBuildJdkCopy.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/CreateBuildJdkCopy.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -41,7 +41,7 @@
$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \
$(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY))))
- $(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)"
+ $(call LogInfo, Copying java modules to buildjdk: $(MODULES_TO_COPY))
$(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules
$(MKDIR) -p $(BUILDJDK_OUTPUTDIR)/jdk/modules
$(foreach m, $(MODULES_TO_COPY), \
--- a/make/GenerateModuleSummary.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/GenerateModuleSummary.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -35,18 +35,18 @@
TOOLS_MODULE_SRCDIR := $(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw
$(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --output $(GENGRAPHS_DIR)
$(SPEC_DOTFILES_DIR)/java.se.dot: $(BUILD_JIGSAW_TOOLS)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --spec --output $(SPEC_DOTFILES_DIR)
$(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summary.html
$(install-file)
$(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/technology-summary.html
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot
--- a/make/GensrcModuleInfo.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/GensrcModuleInfo.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -79,7 +79,7 @@
$(BUILD_TOOLS_JDK) \
$(MOD_FILES) \
$(call DependOnVariable, ALL_MODULES)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \
--source-file $< \
--- a/make/Help.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/Help.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -119,7 +119,7 @@
run-test-prebuilt:
@( cd $(topdir) && \
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
- run-test-prebuilt TEST="$(TEST)" )
+ run-test-prebuilt CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
ALL_GLOBAL_TARGETS := help print-configurations run-test-prebuilt
--- a/make/Images.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/Images.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -90,24 +90,32 @@
$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
- $(ECHO) Creating jdk image
+ $(call LogWarn, Creating jdk image)
$(RM) -r $(JDK_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
$(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
$(JLINK_JDK_EXTRA_OPTS) \
--output $(JDK_IMAGE_DIR) \
)
+ ifeq ($(BUILD_CDS_ARCHIVE), true)
+ $(call LogWarn, Creating CDS archive for jdk image)
+ $(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+ endif
$(TOUCH) $@
$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
- $(ECHO) Creating legacy jre image
+ $(call LogWarn, Creating legacy jre image)
$(RM) -r $(JRE_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
$(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
$(JLINK_JRE_EXTRA_OPTS) \
--output $(JRE_IMAGE_DIR) \
)
+ ifeq ($(BUILD_CDS_ARCHIVE), true)
+ $(call LogWarn, Creating CDS archive for jre image)
+ $(JRE_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+ endif
$(TOUCH) $@
TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
--- a/make/MacBundles.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/MacBundles.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -63,13 +63,13 @@
$(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@
$(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@
--- a/make/Main.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/Main.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -263,6 +263,31 @@
$(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-ide-project
################################################################################
+# Generate libs and launcher targets for creating compile_commands.json fragments
+define DeclareCompileCommandsRecipe
+ $1-compile-commands:
+ $$(call LogInfo, Generating compile_commands.json fragments for $1)
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \
+ GENERATE_COMPILE_COMMANDS_ONLY=true)
+
+ COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands
+endef
+
+$(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \
+ $(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \
+)
+
+$(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \
+ $(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \
+)
+
+compile-commands compile-commands-hotspot:
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCommands.gmk)
+
+ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
+ALL_TARGETS += compile-commands compile-commands-hotspot
+
+################################################################################
# Build demos targets
demos-jdk:
@@ -559,8 +584,12 @@
test-make:
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
+test-compile-commands:
+ ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk test-compile-commands)
+
ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
- test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make
+ test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make \
+ test-compile-commands
################################################################################
# Bundles
@@ -735,6 +764,20 @@
$(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
+ # Setup the minimal set of generated native source dependencies for hotspot
+ $(foreach v, $(JVM_VARIANTS), \
+ $(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
+ $(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
+ $(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
+ )
+
+ # For the full JDK compile commands, create all possible generated sources
+ $(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
+ $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
+
+ compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
+ compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
+
# Jmods cannot be created until we have the jmod tool ready to run. During
# a normal build we run it from the exploded image, but when cross compiling
# it's run from the buildjdk, which is either created at build time or user
@@ -849,6 +892,8 @@
test-make: clean-test-make
+ test-compile-commands: compile-commands
+
build-test-lib: exploded-image-optimize
build-test-failure-handler: interim-langtools
@@ -1071,7 +1116,7 @@
# Remove everything, except the output from configure.
clean: $(CLEAN_DIR_TARGETS)
- ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log*)
+ ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
$(ECHO) Cleaned all build artifacts.
clean-docs:
--- a/make/ModuleWrapper.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/ModuleWrapper.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -100,5 +100,9 @@
$(TARGETS)), \
))
-all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
- $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
+ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
+ all: $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
+else
+ all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
+ $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
+endif
--- a/make/RunTests.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/RunTests.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -45,8 +45,8 @@
endif
$(eval $(call ParseKeywordVariable, TEST_OPTS, \
- KEYWORDS := JOBS TIMEOUT, \
- STRING_KEYWORDS := VM_OPTIONS, \
+ SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR, \
+ STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \
))
# Helper function to propagate TEST_OPTS values.
@@ -104,22 +104,50 @@
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
################################################################################
+# Setup global test running parameters
+################################################################################
+
+# Each factor variable comes in 3 variants. The first one is reserved for users
+# to use on command line. The other two are for predifined configurations in JDL
+# and for machine specific configurations respectively.
+TEST_JOBS_FACTOR ?= 1
+TEST_JOBS_FACTOR_JDL ?= 1
+TEST_JOBS_FACTOR_MACHINE ?= 1
+
+ifeq ($(TEST_JOBS), 0)
+ # Concurrency based on min(cores / 2, 12) * TEST_JOBS_FACTOR
+ TEST_JOBS := $(shell $(AWK) \
+ 'BEGIN { \
+ c = $(NUM_CORES) / 2; \
+ if (c > 12) c = 12; \
+ c = c * $(TEST_JOBS_FACTOR); \
+ c = c * $(TEST_JOBS_FACTOR_JDL); \
+ c = c * $(TEST_JOBS_FACTOR_MACHINE); \
+ if (c < 1) c = 1; \
+ printf "%.0f", c; \
+ }')
+endif
+
+################################################################################
# Parse control variables
################################################################################
ifneq ($(TEST_OPTS), )
# Inform the user
$(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
-
- $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
- $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
-
- $(eval $(call SetTestOpt,JOBS,JTREG))
- $(eval $(call SetTestOpt,TIMEOUT,JTREG))
endif
+$(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
+$(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
+$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
+$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
+
+$(eval $(call SetTestOpt,JOBS,JTREG))
+$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
+
$(eval $(call ParseKeywordVariable, JTREG, \
- KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \
+ SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
+ EXTRA_PROBLEM_LISTS KEYWORDS, \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
))
@@ -129,8 +157,8 @@
endif
$(eval $(call ParseKeywordVariable, GTEST, \
- KEYWORDS := REPEAT, \
- STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
+ SINGLE_KEYWORDS := REPEAT, \
+ STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
))
ifneq ($(GTEST), )
@@ -143,17 +171,6 @@
# Component-specific Jtreg settings
################################################################################
-ifeq ($(TEST_JOBS), 0)
- # If TEST_JOBS is not specified, hotspot fallback default is
- # min(num_cores / 2, 12).
- hotspot_JTREG_JOBS := $(shell $(EXPR) $(NUM_CORES) / 2)
- ifeq ($(hotspot_JTREG_JOBS), 0)
- hotspot_JTREG_JOBS := 1
- else ifeq ($(shell $(EXPR) $(hotspot_JTREG_JOBS) \> 12), 1)
- hotspot_JTREG_JOBS := 12
- endif
-endif
-
hotspot_JTREG_MAX_MEM := 0
hotspot_JTREG_ASSERT := false
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
@@ -165,6 +182,8 @@
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
+langtools_JTREG_MAX_MEM := 768m
+
################################################################################
# Parse test selection
#
@@ -368,15 +387,16 @@
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
endif
- run-test-$1:
+ run-test-$1: $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
- -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
- --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
- $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
+ -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
+ --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
+ $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
+ $$($1_GTEST_JAVA_OPTIONS) \
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
@@ -447,12 +467,11 @@
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
- $1_COMPONENT := \
+ $1_TEST_ROOT := \
$$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
- $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \
- $$(lastword $$(subst /, $$(SPACE), $$(root))) \
- ) \
+ $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), $$(root)) \
))
+ $1_COMPONENT := $$(lastword $$(subst /, $$(SPACE), $$($1_TEST_ROOT)))
# This will work only as long as just hotspot has the additional "jtreg" directory
ifeq ($$($1_COMPONENT), jtreg)
$1_COMPONENT := hotspot
@@ -475,11 +494,12 @@
$$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
$$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
+ # Only the problem list for the current test root should be used.
+ $1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
+
ifneq ($(TEST_JOBS), 0)
- # User has specified TEST_JOBS, use that as fallback default
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
else
- # Use JOBS as default (except for hotspot)
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
endif
@@ -487,7 +507,7 @@
# we may end up with a lot of JVM's
$1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
- JTREG_TIMEOUT ?= 4
+ JTREG_TIMEOUT_FACTOR ?= 4
JTREG_VERBOSE ?= fail,error,summary
JTREG_RETAIN ?= fail,error
@@ -498,10 +518,10 @@
$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
- -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \
+ -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
- $1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet
+ $1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
# Make it possible to specify the JIB_DATA_DIR for tests using the
# JIB Artifact resolver
@@ -531,6 +551,14 @@
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
endif
+ ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), )
+ # Accept both absolute paths as well as relative to the current test root.
+ $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$(wildcard \
+ $$(JTREG_EXTRA_PROBLEM_LISTS) \
+ $$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_EXTRA_PROBLEM_LISTS)) \
+ ))
+ endif
+
ifneq ($$(JIB_HOME), )
$1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME)
endif
@@ -541,10 +569,21 @@
$1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
endif
+ ifneq ($$(JTREG_KEYWORDS), )
+ # The keywords string may contain problematic characters and may be quoted
+ # already when it arrives here. Remove any existing quotes and replace them
+ # with one set of single quotes.
+ $1_JTREG_KEYWORDS := \
+ $$(strip $$(subst $$(SQUOTE),,$$(subst $$(DQUOTE),,$$(JTREG_KEYWORDS))))
+ ifneq ($$($1_JTREG_KEYWORDS), )
+ $1_JTREG_BASIC_OPTIONS += -k:'$$($1_JTREG_KEYWORDS)'
+ endif
+ endif
+
clean-workdir-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
- run-test-$1: clean-workdir-$1
+ run-test-$1: clean-workdir-$1 $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@@ -631,7 +670,7 @@
$$(error Invalid special test specification: $$($1_TEST_NAME))
endif
- run-test-$1:
+ run-test-$1: $(TEST_PREREQS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
--- a/make/RunTestsPrebuilt.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/RunTestsPrebuilt.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -49,10 +49,11 @@
# given.
# Note: No spaces are allowed around the arguments.
#
-# $1: The name of the argument
+# $1: The name of the variable
# $2: The default value, if any, or OPTIONAL (do not provide a default but
# do not exit if it is missing)
# $3: If NO_CHECK, disable checking for target file/directory existence
+# If MKDIR, create the default directory
define SetupVariable
ifeq ($$($1), )
ifeq ($2, )
@@ -75,10 +76,17 @@
endif
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK),
# and if wildcard is empty, then complain that the file is missing.
- ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1)) $3), )
- $$(info Error: Prebuilt variable $1 points to missing file/directory:)
- $$(info '$$($1)')
- $$(error Cannot continue.)
+ ifeq ($3, MKDIR)
+ ifneq ($$(findstring $$(LOG), info debug trace), )
+ $$(info Creating directory for $1)
+ endif
+ $$(shell mkdir -p $$($1))
+ else ifneq ($3, NO_CHECK)
+ ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
+ $$(info Error: Prebuilt variable $1 points to missing file/directory:)
+ $$(info '$$($1)')
+ $$(error Cannot continue.)
+ endif
endif
endef
@@ -106,14 +114,14 @@
# Verify that user has given correct additional input.
# These variables are absolutely necessary
-$(eval $(call SetupVariable,OUTPUTDIR))
+$(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
$(eval $(call SetupVariable,BOOT_JDK))
$(eval $(call SetupVariable,JT_HOME))
# These can have default values based on the ones above
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
-$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols))
+$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols,NO_CHECK))
# Provide default values for tools that we need
$(eval $(call SetupVariable,MAKE,make,NO_CHECK))
@@ -202,8 +210,8 @@
ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), )
- $$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
- $$(error Cannot continue.)
+ $(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
+ $(error Cannot continue.)
endif
FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c
PATH_SEP:=;
@@ -214,15 +222,17 @@
# Check number of cores
ifeq ($(OPENJDK_TARGET_OS), linux)
- NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor)
+ NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
- NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
+ NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
else ifeq ($(OPENJDK_TARGET_OS), solaris)
- NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
+ NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
else ifeq ($(OPENJDK_TARGET_OS), windows)
- NUM_CORES := $(NUMBER_OF_PROCESSORS)
-else
- NUM_CORES := 1
+ NUM_CORES := $(NUMBER_OF_PROCESSORS)
+endif
+ifeq ($(NUM_CORES), )
+ $(warn Could not find number of CPUs, assuming 1)
+ NUM_CORES := 1
endif
################################################################################
@@ -276,9 +286,6 @@
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
@cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
TEST="$(TEST)"
- @if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
- exit 1 ; \
- fi
all: run-test-prebuilt
--- a/make/RunTestsPrebuiltSpec.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/RunTestsPrebuiltSpec.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -124,7 +124,7 @@
JMOD := $(FIXPATH) $(JMOD_CMD)
JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD)
-BUILD_JAVA := $(JAVA)
+BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA
################################################################################
# Some common tools. Assume most common name and no path.
AWK := awk
@@ -172,3 +172,13 @@
EXPR := expr
FILE := file
HG := hg
+
+# On Solaris gnu versions of some tools are required.
+ifeq ($(OPENJDK_BUILD_OS), solaris)
+ AWK := gawk
+ GREP := ggrep
+ EGREP := ggrep -E
+ FGREP := grep -F
+ SED := gsed
+ TAR := gtar
+endif
--- a/make/autoconf/basics.m4 Mon Oct 15 10:29:06 2018 +0530
+++ b/make/autoconf/basics.m4 Tue Oct 16 14:26:22 2018 +0530
@@ -569,7 +569,8 @@
BASIC_REQUIRE_PROGS(GZIP, pigz gzip)
BASIC_REQUIRE_PROGS(LN, ln)
BASIC_REQUIRE_PROGS(LS, ls)
- BASIC_REQUIRE_PROGS(MKDIR, mkdir)
+ # gmkdir is known to be safe for concurrent invocations with -p flag.
+ BASIC_REQUIRE_PROGS(MKDIR, [gmkdir mkdir])
BASIC_REQUIRE_PROGS(MKTEMP, mktemp)
BASIC_REQUIRE_PROGS(MV, mv)
BASIC_REQUIRE_PROGS(NAWK, [nawk gawk awk])
--- a/make/autoconf/configure.ac Mon Oct 15 10:29:06 2018 +0530
+++ b/make/autoconf/configure.ac Tue Oct 16 14:26:22 2018 +0530
@@ -233,6 +233,7 @@
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
JDKOPT_EXCLUDE_TRANSLATIONS
JDKOPT_ENABLE_DISABLE_MANPAGES
+JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE
###############################################################################
#
--- a/make/autoconf/hotspot.m4 Mon Oct 15 10:29:06 2018 +0530
+++ b/make/autoconf/hotspot.m4 Tue Oct 16 14:26:22 2018 +0530
@@ -252,14 +252,6 @@
AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
fi
- # Disable CDS on AIX.
- if test "x$OPENJDK_TARGET_OS" = "xaix"; then
- ENABLE_CDS="false"
- if test "x$enable_cds" = "xyes"; then
- AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
- fi
- fi
-
AC_SUBST(ENABLE_CDS)
])
@@ -489,6 +481,34 @@
# All variants but minimal (and custom) get these features
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc jni-check jvmti management nmt services vm-structs"
+ # Disable CDS on AIX.
+ if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+ ENABLE_CDS="false"
+ if test "x$enable_cds" = "xyes"; then
+ AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
+ fi
+ fi
+
+ # Disable CDS if user requested it with --with-jvm-features=-cds.
+ DISABLE_CDS=`$ECHO $DISABLED_JVM_FEATURES | $GREP cds`
+ if test "x$DISABLE_CDS" = "xcds"; then
+ ENABLE_CDS="false"
+ if test "x$enable_cds" = "xyes"; then
+ AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.])
+ fi
+ fi
+
+ # Disable CDS for zero, minimal, core..
+ if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(minimal) || HOTSPOT_CHECK_JVM_VARIANT(core); then
+ # ..except when the user explicitely requested it with --enable-jvm-features
+ if ! HOTSPOT_CHECK_JVM_FEATURE(cds); then
+ ENABLE_CDS="false"
+ if test "x$enable_cds" = "xyes"; then
+ AC_MSG_ERROR([CDS not implemented for variants zero, minimal, core. Remove --enable-cds.])
+ fi
+ fi
+ fi
+
AC_MSG_CHECKING([if cds should be enabled])
if test "x$ENABLE_CDS" = "xtrue"; then
if test "x$enable_cds" = "xyes"; then
--- a/make/autoconf/jdk-options.m4 Mon Oct 15 10:29:06 2018 +0530
+++ b/make/autoconf/jdk-options.m4 Tue Oct 16 14:26:22 2018 +0530
@@ -527,7 +527,7 @@
# Check if it's likely that it's possible to generate the classlist. Depending
# on exact jvm configuration it could be possible anyway.
- if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client)); then
+ if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) || HOTSPOT_CHECK_JVM_FEATURE(cds)); then
ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
else
ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
@@ -605,3 +605,37 @@
AC_SUBST(BUILD_MANPAGES)
])
+
+################################################################################
+#
+# Disable the default CDS archive generation
+# cross compilation - disabled
+#
+AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
+[
+ AC_ARG_ENABLE([cds-archive], [AS_HELP_STRING([--disable-cds-archive],
+ [Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])])
+
+ AC_MSG_CHECKING([if a default CDS archive should be generated])
+ if test "x$ENABLE_CDS" = "xfalse"; then
+ AC_MSG_RESULT([no, because CDS is disabled])
+ BUILD_CDS_ARCHIVE="false"
+ elif test "x$COMPILE_TYPE" = "xcross"; then
+ AC_MSG_RESULT([no, not possible with cross compilation])
+ BUILD_CDS_ARCHIVE="false"
+ elif test "x$enable_cds_archive" = "xyes"; then
+ AC_MSG_RESULT([yes, forced])
+ BUILD_CDS_ARCHIVE="true"
+ elif test "x$enable_cds_archive" = "x"; then
+ AC_MSG_RESULT([yes])
+ BUILD_CDS_ARCHIVE="true"
+ elif test "x$enable_cds_archive" = "xno"; then
+ AC_MSG_RESULT([no, forced])
+ BUILD_CDS_ARCHIVE="false"
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([--enable-cds_archive can only be yes/no or empty])
+ fi
+
+ AC_SUBST(BUILD_CDS_ARCHIVE)
+])
--- a/make/autoconf/spec.gmk.in Mon Oct 15 10:29:06 2018 +0530
+++ b/make/autoconf/spec.gmk.in Tue Oct 16 14:26:22 2018 +0530
@@ -309,6 +309,8 @@
BUILD_MANPAGES := @BUILD_MANPAGES@
+BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
+
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
# it in sync.
BOOT_JDK:=@BOOT_JDK@
--- a/make/common/JarArchive.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/JarArchive.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -235,7 +235,7 @@
# Here is the rule that creates/updates the jar file.
$$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
- $(MKDIR) -p $$($1_BIN)
+ $$(call MakeTargetDir)
$$($1_GREP_INCLUDE_OUTPUT)
$$($1_GREP_EXCLUDE_OUTPUT)
# If the vardeps file is part of the newer prereq list, it means that
--- a/make/common/JavaCompilation.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/JavaCompilation.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,8 @@
$1_COPY_$$($2_TARGET) := 1
# Now we can setup the dependency that will trigger the copying.
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
- $(MKDIR) -p $$(@D)
- $(CP) $$< $$@
+ $$(call LogInfo, Copying $$(patsubst $(OUTPUTDIR)/%,%, $$@))
+ $$(install-file)
$(CHMOD) -f ug+w $$@
# And do not forget this target
@@ -120,7 +120,8 @@
ifneq ($$($1_CLEAN_$$($2_TARGET)), 1)
$1_CLEAN_$$($2_TARGET) := 1
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
- $(MKDIR) -p $$(@D)
+ $$(call LogInfo, Cleaning $$(patsubst $(OUTPUTDIR)/%,%, $$@))
+ $$(call MakeTargetDir)
export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
| $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
-e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \
@@ -422,7 +423,7 @@
$1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
$$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
--- a/make/common/JdkNativeCompilation.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/JdkNativeCompilation.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -47,6 +47,29 @@
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
$(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
+# Find a library
+# Param 1 - module name
+# Param 2 - library name
+# Param 3 - optional subdir for library
+FindLib = \
+ $(call FindLibDirForModule, \
+ $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
+
+# Find a static library
+# Param 1 - module name
+# Param 2 - library name
+# Param 3 - optional subdir for library
+FindStaticLib = \
+ $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
+ $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
+
+# If only generating compile_commands.json, make these return empty to avoid
+# declaring dependencies.
+ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
+ FindLib =
+ FindStaticLib =
+endif
+
GetJavaHeaderDir = \
$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))
--- a/make/common/MakeBase.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/MakeBase.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -842,7 +842,7 @@
# Parameter 1 is the name of the rule, and is also the name of the variable.
#
# Remaining parameters are named arguments. These include:
-# KEYWORDS A list of valid keywords
+# SINGLE_KEYWORDS A list of valid keywords with single string values
# STRING_KEYWORDS A list of valid keywords, processed as string. This means
# that '%20' will be replaced by ' ' to allow for multi-word strings.
#
@@ -856,7 +856,7 @@
$$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \
$$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \
$$(eval $1_NO_MATCH := true) \
- $$(foreach keyword, $$($1_KEYWORDS), \
+ $$(foreach keyword, $$($1_SINGLE_KEYWORDS), \
$$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
$$(if $$(filter $$(keyword)=%, $$(part)), \
$$(eval $(strip $1)_$$$$(keyword_eval) := $$$$(strip $$$$(patsubst $$$$(keyword_eval)=%, %, $$$$(part)))) \
@@ -871,11 +871,11 @@
) \
) \
$$(if $$($1_NO_MATCH), \
- $$(if $$(filter $$(part), $$($1_KEYWORDS) $$($1_STRING_KEYWORDS)), \
+ $$(if $$(filter $$(part), $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS)), \
$$(info Keyword $$(part) for $1 needs to be assigned a value.) \
, \
$$(info $$(part) is not a valid keyword for $1.) \
- $$(info Valid keywords: $$($1_KEYWORDS) $$($1_STRING_KEYWORDS).) \
+ $$(info Valid keywords: $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS).) \
) \
$$(error Cannot continue) \
) \
--- a/make/common/Modules.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/Modules.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -321,7 +321,7 @@
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(foreach m, $(MODULE_INFOS), \
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
--- a/make/common/NativeCompilation.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/NativeCompilation.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -60,6 +60,29 @@
endef
################################################################################
+# Creates a recipe that creates a compile_commands.json fragment. Remove any
+# occurences of FIXPATH programs from the command to show the actual invocation.
+#
+# Param 1: Name of file to create
+# Param 2: Working directory
+# Param 3: Source file
+# Param 4: Compile command
+# Param 5: Object name
+################################################################################
+define WriteCompileCommandsFragment
+ $(call LogInfo, Creating compile commands fragment for $(notdir $3))
+ $(call MakeDir, $(dir $1))
+ $(call WriteFile,{ \
+ "directory": "$(strip $2)"$(COMMA) \
+ "file": "$(strip $3)"$(COMMA) \
+ "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
+ $(subst $(FIXPATH),,$4))))"$(COMMA) \
+ "output": "$(strip $5)" \
+ }$(COMMA), \
+ $1)
+endef
+
+################################################################################
# Define a native toolchain configuration that can be used by
# SetupNativeCompilation calls
#
@@ -203,6 +226,11 @@
$1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
$$($1_FILENAME))
+ # Generate the corresponding compile_commands.json fragment.
+ $1_OBJ_JSON = $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
+ $$(OUTPUTDIR)/,,$$($1_OBJ))).json
+ $$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON)
+
# Only continue if this object file hasn't been processed already. This lets
# the first found source file override any other with the same name.
ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
@@ -297,8 +325,15 @@
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps)
endif
- $$($1_OBJ): $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
- $$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO)
+ $1_OBJ_DEPS := $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
+ $$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE)
+ $1_COMPILE_OPTIONS := $$($1_FLAGS) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)
+
+ $$($1_OBJ_JSON): $$($1_OBJ_DEPS)
+ $$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
+ $$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ))
+
+ $$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
$$(call MakeDir, $$(@D))
ifneq ($(TOOLCHAIN_TYPE), microsoft)
@@ -307,13 +342,11 @@
# object file in the generated deps files. Fixing it with sed. If
# compiling assembly, don't try this.
$$(call ExecuteWithLog, $$@, \
- $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP).tmp \
- $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
+ $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP).tmp $$($1_COMPILE_OPTIONS))
$(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP)
else
$$(call ExecuteWithLog, $$@, \
- $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP) \
- $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
+ $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP) $$($1_COMPILE_OPTIONS))
endif
# Create a dependency target file from the dependency file.
# Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
@@ -329,8 +362,7 @@
# on Windows. No need to save exit code from compilation since
# pipefail is always active on Windows.
$$(call ExecuteWithLog, $$@, \
- $$($1_COMPILER) $$($1_FLAGS) -showIncludes \
- $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)) \
+ $$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS)) \
| $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
-e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \
$(ECHO) $$@: \\ > $$($1_DEP) ; \
@@ -694,17 +726,25 @@
-include $$($1_PCH_DEP)
-include $$($1_PCH_DEP_TARGETS)
+ $1_PCH_COMMAND := $$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
+ $$($1_OPT_CFLAGS) -x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEP)
+
$$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
$$(call LogInfo, Generating precompiled header)
$$(call MakeDir, $$(@D))
- $$(call ExecuteWithLog, $$@, \
- $$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
- $$($1_OPT_CFLAGS) \
- -x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEP) $$< -o $$@)
+ $$(call ExecuteWithLog, $$@, $$($1_PCH_COMMAND) $$< -o $$@)
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEP) > $$($1_PCH_DEP_TARGETS)
$$($1_ALL_OBJS): $$($1_PCH_FILE)
+ # Generate the corresponding compile_commands.json fragment.
+ $1_PCH_FILE_JSON := $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
+ $$(OUTPUTDIR)/,,$$($1_PCH_FILE))).json
+ $1_ALL_OBJS_JSON += $$($1_PCH_FILE_JSON)
+
+ $$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
+ $$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
+ $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE))
endif
endif
endif
@@ -1025,6 +1065,10 @@
endif
endif
endif
+
+ ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
+ $1 := $$($1_ALL_OBJS_JSON)
+ endif
endef
endif # _NATIVE_COMPILATION_GMK
--- a/make/common/ZipArchive.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/common/ZipArchive.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -124,8 +124,8 @@
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12
# and only fail if it's not.
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
- $(MKDIR) -p $$(@D)
- $(ECHO) Updating $$($1_NAME)
+ $$(call LogWarn, Updating $$($1_NAME))
+ $$(call MakeTargetDir)
$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
$$($1_ZIP_EXCLUDES_$$s) \
--- a/make/conf/jib-profiles.js Mon Oct 15 10:29:06 2018 +0530
+++ b/make/conf/jib-profiles.js Tue Oct 16 14:26:22 2018 +0530
@@ -522,7 +522,7 @@
.forEach(function (name) {
var maketestName = name + "-testmake";
profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
- profiles[maketestName].default_make_targets = [ "test-make" ];
+ profiles[maketestName].default_make_targets = [ "test-make", "test-compile-commands" ];
});
// Profiles for building the zero jvm variant. These are used for verification.
@@ -755,16 +755,15 @@
"run-test-prebuilt": {
target_os: input.build_os,
target_cpu: input.build_cpu,
- src: "src.conf",
dependencies: [ "jtreg", "gnumake", "boot_jdk", "jib", testedProfile + ".jdk",
- testedProfile + ".test", "src.full"
+ testedProfile + ".test"
],
- work_dir: input.get("src.full", "install_path") + "/test",
+ src: "src.conf",
+ make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true" ],
environment: {
- "JT_JAVA": common.boot_jdk_home,
- "PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"),
- "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"),
- "TEST_OUTPUT_DIR": input.src_top_dir
+ "BOOT_JDK": common.boot_jdk_home,
+ "JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"),
+ "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path")
},
labels: "test"
}
@@ -802,13 +801,34 @@
windowsRunTestPrebuiltExtra = {
dependencies: [ testedProfile + ".jdk_symbols" ],
environment: {
- "PRODUCT_SYMBOLS_HOME": input.get(testedProfile + ".jdk_symbols", "home_path"),
+ "SYMBOLS_IMAGE_DIR": input.get(testedProfile + ".jdk_symbols", "home_path"),
}
};
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
windowsRunTestPrebuiltExtra);
}
+ // The profile run-test-prebuilt defines src.conf as the src bundle. When
+ // running in Mach 5, this reduces the time it takes to populate the
+ // considerably. But with just src.conf, we cannot actually run any tests,
+ // so if running from a workspace with just src.conf in it, we need to also
+ // get src.full as a dependency, and define the work_dir (where make gets
+ // run) to be in the src.full install path. By running in the install path,
+ // the same cached installation of the full src can be reused for multiple
+ // test tasks. Care must however be taken not to polute that work dir by
+ // setting the appropriate make variables to control output directories.
+ //
+ // Use the existance of the top level README as indication of if this is
+ // the full source or just src.conf.
+ if (!new java.io.File(__DIR__, "../../README").exists()) {
+ var runTestPrebuiltSrcFullExtra = {
+ dependencies: "src.full",
+ work_dir: input.get("src.full", "install_path"),
+ }
+ profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
+ runTestPrebuiltSrcFullExtra);
+ }
+
// Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles);
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
@@ -835,7 +855,7 @@
: "gcc7.3.0-Fedora27+1.0"),
linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
- : (input.profile.indexOf("arm32") >= 0
+ : (input.profile != null && input.profile.indexOf("arm32") >= 0
? "gcc7.3.0-Fedora27+1.0"
: "arm-linaro-4.7+1.0"
)
--- a/make/copy/Copy-java.base.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/copy/Copy-java.base.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -128,7 +128,7 @@
POLICY_SRC_LIST := $(POLICY_SRC)
$(POLICY_DST): $(POLICY_SRC_LIST)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@
@@ -153,7 +153,7 @@
endif
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@
--- a/make/data/jdwp/jdwp.spec Mon Oct 15 10:29:06 2018 +0530
+++ b/make/data/jdwp/jdwp.spec Tue Oct 16 14:26:22 2018 +0530
@@ -2185,7 +2185,7 @@
"in this thread group. Threads and thread groups in child "
"thread groups are not included. "
"A thread is alive if it has been started and has not yet been stopped. "
- "See <a href=../../../api/java/lang/ThreadGroup.html>java.lang.ThreadGroup </a>
+ "See <a href=../../api/java.base/java/lang/ThreadGroup.html>java.lang.ThreadGroup </a>
"for information about active ThreadGroups.
(Out
(threadGroupObject group "The thread group object ID. ")
--- a/make/data/unicodedata/UnicodeData.txt Mon Oct 15 10:29:06 2018 +0530
+++ b/make/data/unicodedata/UnicodeData.txt Tue Oct 16 14:26:22 2018 +0530
@@ -11729,6 +11729,7 @@
32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
+32FF;SQUARE ERA NAME NEWERA;So;0;L;<square> 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;;
3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;
--- a/make/gendata/GendataFontConfig.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gendata/GendataFontConfig.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -38,7 +38,7 @@
$(GENDATA_FONT_CONFIG_DST)/%.bfc: \
$(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(TOOL_COMPILEFONTCONFIG) $< $@
$(CHMOD) 444 $@
--- a/make/gendata/GendataHtml32dtd.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gendata/GendataHtml32dtd.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -28,7 +28,7 @@
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
$(HTML32DTD): $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating HTML DTD file)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
($(TOOL_DTDBUILDER) html32 > $@) || exit 1
--- a/make/gendata/GendataTZDB.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gendata/GendataTZDB.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -35,8 +35,8 @@
GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat
$(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
+ $(call MakeTargetDir)
$(RM) $(GENDATA_TZDB_DAT)
- $(MKDIR) -p $(@D)
$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
TARGETS += $(GENDATA_TZDB_DAT)
--- a/make/gensrc/GensrcCLDR.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcCLDR.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -50,7 +50,7 @@
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(ZONENAME_TEMPLATE) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_BASEDIR)
+ $(call MakeDir, $(GENSRC_BASEDIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_BASEDIR) \
@@ -62,7 +62,7 @@
$(wildcard $(CLDRSRCDIR)/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_DIR)
+ $(call MakeDir, $(GENSRC_DIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_DIR)
--- a/make/gensrc/GensrcCharsetCoder.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcCharsetCoder.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -34,8 +34,8 @@
################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
- $(MKDIR) -p $(@D)
- -$(RM) $@.tmp
+ $(call MakeTargetDir)
+ $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \
-Kdecoder \
-DA='A' \
@@ -69,8 +69,8 @@
################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
- $(MKDIR) -p $(@D)
- -$(RM) $@.tmp
+ $(call MakeTargetDir)
+ $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \
-Kencoder \
-DA='An' \
--- a/make/gensrc/GensrcCommonLangtools.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcCommonLangtools.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -49,7 +49,7 @@
# root.
define SetupVersionProperties
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2):
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
$(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \
> $$@
@@ -92,7 +92,7 @@
# Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
- $(MKDIR) -p $$(@D) $$(PROPDIRS)
+ $$(call MakeDir, $$(@D) $$(PROPDIRS))
$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
@@ -122,7 +122,7 @@
# Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES)
- $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
+ $$(call MakeDir, $$(@D) $$(PARSEPROPDIRS))
$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)
--- a/make/gensrc/GensrcLocaleData.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcLocaleData.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -131,7 +131,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \
$(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
$(SED) $(SED_BASEARGS) $< > $@
@@ -139,7 +139,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \
$(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONBASEARGS) $< > $@
--- a/make/gensrc/GensrcModuleLoaderMap.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcModuleLoaderMap.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -46,7 +46,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java: \
$(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java \
$(VARDEPS_FILE) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(TOOL_GENCLASSLOADERMAP) -boot $(BOOT_MODULES_LIST) \
-platform $(PLATFORM_MODULES_LIST) -o $@.tmp $<
--- a/make/gensrc/GensrcProperties.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcProperties.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -34,7 +34,7 @@
$$(subst _zh_TW,_zh_HK, $2))
$$($1_$2_TARGET): $2
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
$(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@
$1 += $$($1_$2_TARGET)
@@ -105,8 +105,8 @@
# Now setup the rule for the generation of the resource bundles.
$$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $$(@D) $$($1_DIRS)
- $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
+ $$(call LogWarn, Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE))
+ $$(call MakeDir, $$(@D) $$($1_DIRS))
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
$(TOUCH) $$@
--- a/make/gensrc/GensrcSwing.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/gensrc/GensrcSwing.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -32,7 +32,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating Nimbus source files)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
--- a/make/hotspot/lib/CompileJvm.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/hotspot/lib/CompileJvm.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -92,7 +92,7 @@
DISABLED_WARNINGS_gcc += return-type switch
endif
-DISABLED_WARNINGS_clang := tautological-compare deprecated-declarations \
+DISABLED_WARNINGS_clang := tautological-compare \
undefined-var-template sometimes-uninitialized unknown-pragmas \
delete-non-virtual-dtor missing-braces char-subscripts \
ignored-qualifiers missing-field-initializers mismatched-tags
@@ -214,15 +214,17 @@
$(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \
$(BUILD_LIBJVM_TARGET_DEPS))
-ifeq ($(OPENJDK_TARGET_OS), windows)
- # It doesn't matter which jvm.lib file gets exported, but we need
- # to pick just one.
- ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
- $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
- DEST := $(LIB_OUTPUTDIR), \
- FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
- ))
- TARGETS += $(COPY_JVM_LIB)
+ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ # It doesn't matter which jvm.lib file gets exported, but we need
+ # to pick just one.
+ ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
+ $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
+ DEST := $(LIB_OUTPUTDIR), \
+ FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
+ ))
+ TARGETS += $(COPY_JVM_LIB)
+ endif
endif
endif
@@ -261,44 +263,46 @@
# Search the output for the operator(s) of interest, to see where they are
# referenced.
-ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), )
+ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
+ ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), )
- DEMANGLED_REGEXP := [^:]operator (new|delete)
+ DEMANGLED_REGEXP := [^:]operator (new|delete)
- # Running c++filt to find offending symbols in all files is too expensive,
- # especially on Solaris, so use mangled names when looking for symbols.
- # Save the demangling for when something is actually found.
- ifeq ($(TOOLCHAIN_TYPE), solstudio)
- MANGLED_SYMS := \
- __1c2n6FL_pv_ \
- __1c2N6FL_pv_ \
- __1c2k6Fpv_v_ \
- __1c2K6Fpv_v_ \
- #
- UNDEF_PATTERN := UNDEF
- else
- MANGLED_SYMS := \
- _ZdaPv \
- _ZdlPv \
- _Znam \
- _Znwm \
- #
- UNDEF_PATTERN := ' U '
+ # Running c++filt to find offending symbols in all files is too expensive,
+ # especially on Solaris, so use mangled names when looking for symbols.
+ # Save the demangling for when something is actually found.
+ ifeq ($(TOOLCHAIN_TYPE), solstudio)
+ MANGLED_SYMS := \
+ __1c2n6FL_pv_ \
+ __1c2N6FL_pv_ \
+ __1c2k6Fpv_v_ \
+ __1c2K6Fpv_v_ \
+ #
+ UNDEF_PATTERN := UNDEF
+ else
+ MANGLED_SYMS := \
+ _ZdaPv \
+ _ZdlPv \
+ _Znam \
+ _Znwm \
+ #
+ UNDEF_PATTERN := ' U '
+ endif
+
+ define SetupOperatorNewDeleteCheck
+ $1.op_check: $1
+ if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \
+ | $(GREP) $(UNDEF_PATTERN)`" ]; then \
+ $(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \
+ $(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \
+ $(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \
+ exit 1; \
+ fi
+ $(TOUCH) $$@
+
+ TARGETS += $1.op_check
+ endef
+
+ $(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o)))
endif
-
- define SetupOperatorNewDeleteCheck
- $1.op_check: $1
- if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \
- | $(GREP) $(UNDEF_PATTERN)`" ]; then \
- $(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \
- $(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \
- $(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \
- exit 1; \
- fi
- $(TOUCH) $$@
-
- TARGETS += $1.op_check
- endef
-
- $(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o)))
endif
--- a/make/launcher/Launcher-java.base.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/launcher/Launcher-java.base.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -45,7 +45,7 @@
))
$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@
--- a/make/launcher/Launcher-jdk.pack.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/launcher/Launcher-jdk.pack.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -91,21 +91,15 @@
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
DISABLED_WARNINGS_clang := format-nonliteral, \
- LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
- $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
+ LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
+ EXTRA_OBJECT_FILES := $(UNPACKEXE_ZIPOBJS) \
))
-ifneq ($(USE_EXTERNAL_LIBZ), true)
-
- $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
-
-endif
-
TARGETS += $(BUILD_UNPACKEXE)
################################################################################
--- a/make/launcher/LauncherCommon.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/launcher/LauncherCommon.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -135,7 +135,7 @@
$1_LIBS += -lz
endif
- $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
+ $1_WINDOWS_JLI_LIB := $(call FindStaticLib, java.base, jli, /libjli)
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
NAME := $1, \
@@ -181,11 +181,11 @@
TARGETS += $$($1)
ifeq ($(OPENJDK_TARGET_OS), aix)
- $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
+ $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli_static)
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
- $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
+ $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, java, /libjava) \
$$($1_WINDOWS_JLI_LIB)
endif
endef
--- a/make/lib/Awt2dLibraries.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/lib/Awt2dLibraries.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -739,11 +739,11 @@
ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
else
- $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
+ $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_headless)
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
+ $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_lwawt)
endif
endif # OPENJDK_TARGET_OS
--- a/make/lib/Lib-jdk.accessibility.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/lib/Lib-jdk.accessibility.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -55,7 +55,7 @@
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
)
- $$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
+ $$(BUILD_JAVAACCESSBRIDGE$1): $(call FindStaticLib, java.desktop, jawt, /libjawt)
TARGETS += $$(BUILD_JAVAACCESSBRIDGE$1)
endef
--- a/make/lib/Lib-jdk.hotspot.agent.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -44,7 +44,12 @@
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
SA_CXXFLAGS := -DWIN64
else
- SA_CXXFLAGS := -RTC1
+ # Only add /RTC1 flag for debug builds as it's
+ # incompatible with release type builds. See
+ # https://msdn.microsoft.com/en-us/library/8wtf2dfz.aspx
+ ifeq ($(DEBUG_LEVEL),slowdebug)
+ SA_CXXFLAGS := -RTC1
+ endif
endif
endif
--- a/make/lib/LibCommon.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/lib/LibCommon.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -61,24 +61,6 @@
endif
endif
-################################################################################
-# Find a library
-# Param 1 - module name
-# Param 2 - library name
-# Param 3 - optional subdir for library
-FindLib = \
- $(call FindLibDirForModule, \
- $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
-
-################################################################################
-# Find a static library
-# Param 1 - module name
-# Param 2 - library name
-# Param 3 - optional subdir for library
-FindStaticLib = \
- $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
- $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
-
# Put the libraries here.
INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
--- a/make/rmic/Rmic-java.management.rmi.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/make/rmic/Rmic-java.management.rmi.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -51,7 +51,7 @@
$(foreach src, $(classfiles), \
$(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \
$(STUB_CLASSES_DIR)/%, $(src))) \
- $(MKDIR) -p $(dir $(target)) ; \
+ $(call MakeDir, $(dir $(target))) \
$(MV) $(src) $(target) $(NEWLINE))
$(TOUCH) $@
--- a/make/scripts/compare.sh Mon Oct 15 10:29:06 2018 +0530
+++ b/make/scripts/compare.sh Tue Oct 16 14:26:22 2018 +0530
@@ -385,6 +385,7 @@
! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \
! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \
! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \
+ ! -name "classes.jsa" \
| $GREP -v "./bin/" | $SORT | $FILTER)
echo Other files with binary differences...
--- a/src/hotspot/cpu/ppc/c2_globals_ppc.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/ppc/c2_globals_ppc.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,7 +62,7 @@
define_pd_global(bool, UseCISCSpill, false);
define_pd_global(bool, OptoBundling, false);
define_pd_global(bool, OptoRegScheduling, false);
-define_pd_global(bool, SuperWordLoopUnrollAnalysis, false);
+define_pd_global(bool, SuperWordLoopUnrollAnalysis, true);
// GL:
// Detected a problem with unscaled compressed oops and
// narrow_oop_use_complex_address() == false.
--- a/src/hotspot/cpu/s390/frame_s390.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/s390/frame_s390.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,14 +53,135 @@
bool frame::safe_for_sender(JavaThread *thread) {
bool safe = false;
- address cursp = (address)sp();
- address curfp = (address)fp();
- if ((cursp != NULL && curfp != NULL &&
- (cursp <= thread->stack_base() && cursp >= thread->stack_base() - thread->stack_size())) &&
- (curfp <= thread->stack_base() && curfp >= thread->stack_base() - thread->stack_size())) {
- safe = true;
+ address sp = (address)_sp;
+ address fp = (address)_fp;
+ address unextended_sp = (address)_unextended_sp;
+
+ // Consider stack guards when trying to determine "safe" stack pointers
+ static size_t stack_guard_size = os::uses_stack_guard_pages() ?
+ JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_reserved_zone_size() : 0;
+ size_t usable_stack_size = thread->stack_size() - stack_guard_size;
+
+ // sp must be within the usable part of the stack (not in guards)
+ bool sp_safe = (sp < thread->stack_base()) &&
+ (sp >= thread->stack_base() - usable_stack_size);
+
+
+ if (!sp_safe) {
+ return false;
+ }
+
+ // Unextended sp must be within the stack
+ bool unextended_sp_safe = (unextended_sp < thread->stack_base());
+
+ if (!unextended_sp_safe) {
+ return false;
}
- return safe;
+
+ // An fp must be within the stack and above (but not equal) sp.
+ bool fp_safe = (fp <= thread->stack_base()) && (fp > sp);
+ // An interpreter fp must be within the stack and above (but not equal) sp.
+ // Moreover, it must be at least the size of the z_ijava_state structure.
+ bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) &&
+ ((fp - sp) >= z_ijava_state_size);
+
+ // We know sp/unextended_sp are safe, only fp is questionable here
+
+ // If the current frame is known to the code cache then we can attempt to
+ // to construct the sender and do some validation of it. This goes a long way
+ // toward eliminating issues when we get in frame construction code
+
+ if (_cb != NULL ) {
+ // Entry frame checks
+ if (is_entry_frame()) {
+ // An entry frame must have a valid fp.
+ return fp_safe && is_entry_frame_valid(thread);
+ }
+
+ // Now check if the frame is complete and the test is
+ // reliable. Unfortunately we can only check frame completeness for
+ // runtime stubs. Other generic buffer blobs are more
+ // problematic so we just assume they are OK. Adapter blobs never have a
+ // complete frame and are never OK. nmethods should be OK on s390.
+ if (!_cb->is_frame_complete_at(_pc)) {
+ if (_cb->is_adapter_blob() || _cb->is_runtime_stub()) {
+ return false;
+ }
+ }
+
+ // Could just be some random pointer within the codeBlob.
+ if (!_cb->code_contains(_pc)) {
+ return false;
+ }
+
+ if (is_interpreted_frame() && !fp_interp_safe) {
+ return false;
+ }
+
+ z_abi_160* sender_abi = (z_abi_160*) fp;
+ intptr_t* sender_sp = (intptr_t*) sender_abi->callers_sp;
+ address sender_pc = (address) sender_abi->return_pc;
+
+ // We must always be able to find a recognizable pc.
+ CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc);
+ if (sender_blob == NULL) {
+ return false;
+ }
+
+ // Could be a zombie method
+ if (sender_blob->is_zombie() || sender_blob->is_unloaded()) {
+ return false;
+ }
+
+ // It should be safe to construct the sender though it might not be valid.
+
+ frame sender(sender_sp, sender_pc);
+
+ // Do we have a valid fp?
+ address sender_fp = (address) sender.fp();
+
+ // sender_fp must be within the stack and above (but not
+ // equal) current frame's fp.
+ if (sender_fp > thread->stack_base() || sender_fp <= fp) {
+ return false;
+ }
+
+ // If the potential sender is the interpreter then we can do some more checking.
+ if (Interpreter::contains(sender_pc)) {
+ return sender.is_interpreted_frame_valid(thread);
+ }
+
+ // Could just be some random pointer within the codeBlob.
+ if (!sender.cb()->code_contains(sender_pc)) {
+ return false;
+ }
+
+ // We should never be able to see an adapter if the current frame is something from code cache.
+ if (sender_blob->is_adapter_blob()) {
+ return false;
+ }
+
+ if (sender.is_entry_frame()) {
+ return sender.is_entry_frame_valid(thread);
+ }
+
+ // Frame size is always greater than zero. If the sender frame size is zero or less,
+ // something is really weird and we better give up.
+ if (sender_blob->frame_size() <= 0) {
+ return false;
+ }
+
+ return true;
+ }
+
+ // Must be native-compiled frame. Since sender will try and use fp to find
+ // linkages it must be safe
+
+ if (!fp_safe) {
+ return false;
+ }
+
+ return true;
}
bool frame::is_interpreted_frame() const {
--- a/src/hotspot/cpu/s390/frame_s390.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/s390/frame_s390.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -491,9 +491,12 @@
static int interpreter_frame_interpreterstate_size_in_bytes();
static int interpreter_frame_monitor_size_in_bytes();
+
+ // template interpreter state
+ inline z_ijava_state* ijava_state_unchecked() const;
+
private:
- // template interpreter state
inline z_ijava_state* ijava_state() const;
// Where z_ijava_state.monitors is saved.
--- a/src/hotspot/cpu/s390/frame_s390.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/s390/frame_s390.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -77,8 +77,13 @@
#endif
// template interpreter state
+inline frame::z_ijava_state* frame::ijava_state_unchecked() const {
+ z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size);
+ return state;
+}
+
inline frame::z_ijava_state* frame::ijava_state() const {
- z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size);
+ z_ijava_state* state = ijava_state_unchecked();
assert(state->magic == (intptr_t) frame::z_istate_magic_number,
"wrong z_ijava_state in interpreter frame (no magic found)");
return state;
--- a/src/hotspot/cpu/sparc/nativeInst_sparc.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/sparc/nativeInst_sparc.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -205,9 +205,9 @@
uint idx;
int offsets[] = {
0x0,
- 0xfffffff0,
- 0x7ffffff0,
- 0x80000000,
+ (int)0xfffffff0,
+ (int)0x7ffffff0,
+ (int)0x80000000,
0x20,
0x4000,
};
@@ -361,9 +361,9 @@
uint idx;
int offsets[] = {
0x0,
- 0x7fffffff,
- 0x80000000,
- 0xffffffff,
+ (int)0x7fffffff,
+ (int)0x80000000,
+ (int)0xffffffff,
0x20,
4096,
4097,
@@ -534,9 +534,9 @@
uint idx;
int offsets[] = {
0x0,
- 0x7fffffff,
- 0x80000000,
- 0xffffffff,
+ (int)0x7fffffff,
+ (int)0x80000000,
+ (int)0xffffffff,
0x20,
4096,
4097,
@@ -630,9 +630,9 @@
uint idx1;
int offsets[] = {
0x0,
- 0xffffffff,
- 0x7fffffff,
- 0x80000000,
+ (int)0xffffffff,
+ (int)0x7fffffff,
+ (int)0x80000000,
4096,
4097,
0x20,
@@ -751,9 +751,9 @@
uint idx;
int offsets[] = {
0x0,
- 0xffffffff,
- 0x7fffffff,
- 0x80000000,
+ (int)0xffffffff,
+ (int)0x7fffffff,
+ (int)0x80000000,
4096,
4097,
0x20,
--- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -688,7 +688,7 @@
}
LIR_Opr result = new_register(T_INT);
__ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
- result, type);
+ result, T_INT);
return result;
}
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -35,9 +35,6 @@
#define BUFFER_SIZE 30*wordSize
-// Instead of issuing lfence for LoadLoad barrier, we create data dependency
-// between loads, which is more efficient than lfence.
-
// Common register usage:
// rax/xmm0: result
// c_rarg0: jni env
@@ -77,12 +74,6 @@
__ mov (robj, c_rarg1);
__ testb (rcounter, 1);
__ jcc (Assembler::notZero, slow);
-
- __ xorptr(robj, rcounter);
- __ xorptr(robj, rcounter); // obj, since
- // robj ^ rcounter ^ rcounter == robj
- // robj is data dependent on rcounter.
-
__ mov (roffset, c_rarg2);
__ shrptr(roffset, 2); // offset
@@ -103,12 +94,7 @@
default: ShouldNotReachHere();
}
- // create data dependency on rax
- __ lea(rcounter_addr, counter);
- __ xorptr(rcounter_addr, rax);
- __ xorptr(rcounter_addr, rax);
- __ cmpl (rcounter, Address(rcounter_addr, 0));
-
+ __ cmp32 (rcounter, counter);
__ jcc (Assembler::notEqual, slow);
__ ret (0);
@@ -178,11 +164,6 @@
__ testb (rcounter, 1);
__ jcc (Assembler::notZero, slow);
- __ xorptr(robj, rcounter);
- __ xorptr(robj, rcounter); // obj, since
- // robj ^ rcounter ^ rcounter == robj
- // robj is data dependent on rcounter.
-
// Both robj and rtmp are clobbered by try_resolve_jobject_in_native.
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow);
@@ -198,13 +179,7 @@
case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
default: ShouldNotReachHere();
}
-
- __ lea(rcounter_addr, counter);
- __ movdq (rax, xmm0);
- // counter address is data dependent on xmm0.
- __ xorptr(rcounter_addr, rax);
- __ xorptr(rcounter_addr, rax);
- __ cmpl (rcounter, Address(rcounter_addr, 0));
+ __ cmp32 (rcounter, counter);
__ jcc (Assembler::notEqual, slow);
__ ret (0);
--- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -33,7 +33,7 @@
enum platform_dependent_constants {
code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small)
- code_size2 = 33800 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small)
+ code_size2 = 35300 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small)
};
class x86 {
--- a/src/hotspot/os/aix/os_aix.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os/aix/os_aix.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -4259,7 +4259,7 @@
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
char * argv[4] = {"sh", "-c", cmd, NULL};
pid_t pid = fork();
--- a/src/hotspot/os/bsd/os_bsd.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os/bsd/os_bsd.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -3238,16 +3238,6 @@
Bsd::clock_init();
initial_time_count = javaTimeNanos();
-#ifdef __APPLE__
- // XXXDARWIN
- // Work around the unaligned VM callbacks in hotspot's
- // sharedRuntime. The callbacks don't use SSE2 instructions, and work on
- // Linux, Solaris, and FreeBSD. On Mac OS X, dyld (rightly so) enforces
- // alignment when doing symbol lookup. To work around this, we force early
- // binding of all symbols now, thus binding when alignment is known-good.
- _dyld_bind_fully_image_containing_address((const void *) &os::init);
-#endif
-
os::Posix::init();
}
@@ -3795,7 +3785,7 @@
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL};
// fork() in BsdThreads/NPTL is not async-safe. It needs to run
--- a/src/hotspot/os/linux/os_linux.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os/linux/os_linux.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -5676,10 +5676,16 @@
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL};
- pid_t pid = fork();
+ pid_t pid ;
+
+ if (use_vfork_if_available) {
+ pid = vfork();
+ } else {
+ pid = fork();
+ }
if (pid < 0) {
// fork failed
--- a/src/hotspot/os/solaris/os_solaris.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os/solaris/os_solaris.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1567,11 +1567,11 @@
}
typedef struct {
- Elf32_Half code; // Actual value as defined in elf.h
- Elf32_Half compat_class; // Compatibility of archs at VM's sense
- char elf_class; // 32 or 64 bit
- char endianess; // MSB or LSB
- char* name; // String representation
+ Elf32_Half code; // Actual value as defined in elf.h
+ Elf32_Half compat_class; // Compatibility of archs at VM's sense
+ unsigned char elf_class; // 32 or 64 bit
+ unsigned char endianess; // MSB or LSB
+ char* name; // String representation
} arch_t;
static const arch_t arch_array[]={
@@ -5252,7 +5252,7 @@
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
char * argv[4];
argv[0] = (char *)"sh";
argv[1] = (char *)"-c";
--- a/src/hotspot/os/windows/os_windows.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os/windows/os_windows.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -5254,7 +5254,7 @@
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process).
-int os::fork_and_exec(char* cmd) {
+int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD exit_code;
--- a/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -42,10 +42,51 @@
}
bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
- ucontext_t* uc = (ucontext_t*) ucontext;
- *fr_addr = frame((intptr_t*)uc->uc_mcontext.gregs[15/*REG_SP*/],
+ assert(this->is_Java_thread(), "must be JavaThread");
+
+ // If we have a last_Java_frame, then we should use it even if
+ // isInJava == true. It should be more reliable than ucontext info.
+ if (has_last_Java_frame() && frame_anchor()->walkable()) {
+ *fr_addr = pd_last_frame();
+ return true;
+ }
+
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ frame ret_frame((intptr_t*)uc->uc_mcontext.gregs[15/*Z_SP*/],
(address)uc->uc_mcontext.psw.addr);
- return true;
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+ return false;
+ }
+
+ if (ret_frame.is_interpreted_frame()) {
+ frame::z_ijava_state* istate = ret_frame.ijava_state_unchecked();
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
+ uint64_t reg_bcp = uc->uc_mcontext.gregs[13/*Z_BCP*/];
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
+ if (istate_bcp >= code_start && istate_bcp < code_end) {
+ // we have a valid bcp, don't touch it, do nothing
+ } else if (reg_bcp >= code_start && reg_bcp < code_end) {
+ istate->bcp = reg_bcp;
+ } else {
+ return false;
+ }
+ }
+ if (!ret_frame.safe_for_sender(this)) {
+ // nothing else to try if the frame isn't good
+ return false;
+ }
+ *fr_addr = ret_frame;
+ return true;
+ }
+ // nothing else to try
+ return false;
}
// Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Linux/S390x.
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,6 +54,16 @@
"std %0, %1\n"
: "=&f"(tmp), "=Q"(*(volatile double*)dst)
: "Q"(*(volatile double*)src));
+#elif defined(__ARM_ARCH_7A__)
+ // Note that a ldrexd + clrex combination is only needed for
+ // correctness on the OS level (context-switches). In this
+ // case, clrex *may* be beneficial for performance. For now
+ // don't bother with clrex as this is Zero.
+ jlong tmp;
+ asm volatile ("ldrexd %0, [%1]\n"
+ : "=r"(tmp)
+ : "r"(src), "m"(src));
+ *(jlong *) dst = tmp;
#else
*(jlong *) dst = *(const jlong *) src;
#endif
--- a/src/hotspot/share/aot/aotCodeHeap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -436,14 +436,19 @@
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance", address, JVMCIRuntime::new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array", address, JVMCIRuntime::new_array);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array", address, JVMCIRuntime::new_multi_array);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array", address, JVMCIRuntime::dynamic_new_array);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance_or_null", address, JVMCIRuntime::new_instance_or_null);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array_or_null", address, JVMCIRuntime::new_array_or_null);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array_or_null", address, JVMCIRuntime::new_multi_array_or_null);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance_or_null", address, JVMCIRuntime::dynamic_new_instance_or_null);
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array_or_null", address, JVMCIRuntime::dynamic_new_array_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_validate_object", address, JVMCIRuntime::validate_object);
#if INCLUDE_G1GC
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_pre", address, JVMCIRuntime::write_barrier_pre);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_post", address, JVMCIRuntime::write_barrier_post);
#endif
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_identity_hash_code", address, JVMCIRuntime::identity_hash_code);
- SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_thread_is_interrupted", address, JVMCIRuntime::thread_is_interrupted);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_exception_handler_for_pc", address, JVMCIRuntime::exception_handler_for_pc);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_test_deoptimize_call_int", address, JVMCIRuntime::test_deoptimize_call_int);
@@ -735,6 +740,14 @@
NOT_PRODUCT( klasses_seen++; )
+ // AOT does not support custom class loaders.
+ ClassLoaderData* cld = ik->class_loader_data();
+ if (!cld->is_builtin_class_loader_data()) {
+ log_trace(aot, class, load)("skip class %s for custom classloader %s (%p) tid=" INTPTR_FORMAT,
+ ik->internal_name(), cld->loader_name(), cld, p2i(thread));
+ return false;
+ }
+
AOTKlassData* klass_data = find_klass(ik);
if (klass_data == NULL) {
return false;
@@ -759,9 +772,10 @@
assert(klass_data->_class_id < _class_count, "invalid class id");
AOTClass* aot_class = &_classes[klass_data->_class_id];
- if (aot_class->_classloader != NULL && aot_class->_classloader != ik->class_loader_data()) {
- log_trace(aot, class, load)("class %s in %s already loaded for classloader %p vs %p tid=" INTPTR_FORMAT,
- ik->internal_name(), _lib->name(), aot_class->_classloader, ik->class_loader_data(), p2i(thread));
+ ClassLoaderData* aot_cld = aot_class->_classloader;
+ if (aot_cld != NULL && aot_cld != cld) {
+ log_trace(aot, class, load)("class %s in %s already loaded for classloader %s (%p) vs %s (%p) tid=" INTPTR_FORMAT,
+ ik->internal_name(), _lib->name(), aot_cld->loader_name(), aot_cld, cld->loader_name(), cld, p2i(thread));
NOT_PRODUCT( aot_klasses_cl_miss++; )
return false;
}
@@ -774,9 +788,9 @@
NOT_PRODUCT( aot_klasses_found++; )
- log_trace(aot, class, load)("found %s in %s for classloader %p tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), ik->class_loader_data(), p2i(thread));
+ log_trace(aot, class, load)("found %s in %s for classloader %s (%p) tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), cld->loader_name(), cld, p2i(thread));
- aot_class->_classloader = ik->class_loader_data();
+ aot_class->_classloader = cld;
// Set klass's Resolve (second) got cell.
_klasses_got[klass_data->_got_index] = ik;
if (ik->is_initialized()) {
--- a/src/hotspot/share/classfile/classLoader.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/classLoader.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -135,7 +135,6 @@
PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL;
PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL;
PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL;
-PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
@@ -1604,9 +1603,6 @@
NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS,
"unsafeDefineClassCalls");
-
- NEWPERFEVENTCOUNTER(_load_instance_class_failCounter, SUN_CLS,
- "loadInstanceClassFailRate");
}
// lookup zip library entry points
--- a/src/hotspot/share/classfile/classLoader.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/classLoader.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -192,7 +192,6 @@
static PerfCounter* _sync_JNIDefineClassLockFreeCounter;
static PerfCounter* _unsafe_defineClassCallCounter;
- static PerfCounter* _load_instance_class_failCounter;
// The boot class path consists of 3 ordered pieces:
// 1. the module/path pairs specified to --patch-module
@@ -340,12 +339,6 @@
return _unsafe_defineClassCallCounter;
}
- // Record how many times SystemDictionary::load_instance_class call
- // fails with linkageError when Unsyncloadclass flag is set.
- static PerfCounter* load_instance_class_failCounter() {
- return _load_instance_class_failCounter;
- }
-
// Modular java runtime image is present vs. a build with exploded modules
static bool has_jrt_entry() { return (_jrt_entry != NULL); }
static ClassPathEntry* get_jrt_entry() { return _jrt_entry; }
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -487,6 +487,21 @@
}
#endif // PRODUCT
+bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) {
+ DEBUG_ONLY( if (!VMError::is_error_reported()) { assert_locked_or_safepoint(ClassLoaderDataGraph_lock); } )
+ if (loader_data != NULL) {
+ if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
+ return true;
+ }
+ for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
+ if (loader_data == data) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
// Move class loader data from main list to the unloaded list for unloading
// and deallocation later.
bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -146,6 +146,10 @@
#ifndef PRODUCT
static bool contains_loader_data(ClassLoaderData* loader_data);
#endif
+
+ // Check if ClassLoaderData is part of the ClassLoaderDataGraph (not unloaded)
+ // Usage without lock only allowed during error reporting.
+ static bool is_valid(ClassLoaderData* loader_data);
};
class LockedClassesDo : public KlassClosure {
--- a/src/hotspot/share/classfile/compactHashtable.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/compactHashtable.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -174,7 +174,7 @@
// The CompactHashtable implementation
//
-void SimpleCompactHashtable::serialize(SerializeClosure* soc) {
+void SimpleCompactHashtable::serialize_header(SerializeClosure* soc) {
soc->do_ptr((void**)&_base_address);
soc->do_u4(&_entry_count);
soc->do_u4(&_bucket_count);
--- a/src/hotspot/share/classfile/compactHashtable.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/compactHashtable.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -123,6 +123,15 @@
public:
void dump(SimpleCompactHashtable *cht, const char* table_name);
+
+ static int default_num_buckets(size_t num_entries) {
+ return default_num_buckets((int)num_entries);
+ }
+ static int default_num_buckets(int num_entries) {
+ int num_buckets = num_entries / SharedSymbolTableBucketSize;
+ // calculation of num_buckets can result in zero buckets, we need at least one
+ return (num_buckets < 1) ? 1 : num_buckets;
+ }
};
#endif // INCLUDE_CDS
@@ -213,8 +222,8 @@
_entries = entries;
}
- // For reading from/writing to the CDS archive
- void serialize(SerializeClosure* soc) NOT_CDS_RETURN;
+ // Read/Write the table's header from/to the CDS archive
+ void serialize_header(SerializeClosure* soc) NOT_CDS_RETURN;
inline bool empty() {
return (_entry_count == 0);
--- a/src/hotspot/share/classfile/javaClasses.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/javaClasses.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -36,8 +36,9 @@
#include "interpreter/linkResolver.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
+#include "memory/heapShared.inline.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/fieldStreams.hpp"
@@ -750,7 +751,7 @@
{
assert(fd->signature() == vmSymbols::string_signature(),
"just checking");
- if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) {
+ if (DumpSharedSpaces && HeapShared::is_archived_object(mirror())) {
// Archive the String field and update the pointer.
oop s = mirror()->obj_field(fd->offset());
oop archived_s = StringTable::create_archived_string(s, CHECK);
@@ -788,7 +789,7 @@
}
if (k->is_shared() && k->has_raw_archived_mirror()) {
- if (MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (HeapShared::open_archive_heap_region_mapped()) {
bool present = restore_archived_mirror(k, Handle(), Handle(), Handle(), CHECK);
assert(present, "Missing archived mirror for %s", k->external_name());
return;
@@ -1011,14 +1012,14 @@
};
void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
- "MetaspaceShared::is_heap_object_archiving_allowed() must be true");
+ assert(HeapShared::is_heap_object_archiving_allowed(),
+ "HeapShared::is_heap_object_archiving_allowed() must be true");
for (int t = 0; t <= T_VOID; t++) {
oop m = Universe::_mirrors[t];
if (m != NULL) {
// Update the field at _array_klass_offset to point to the relocated array klass.
- oop archived_m = MetaspaceShared::archive_heap_object(m, THREAD);
+ oop archived_m = HeapShared::archive_heap_object(m, THREAD);
assert(archived_m != NULL, "sanity");
Klass *ak = (Klass*)(archived_m->metadata_field(_array_klass_offset));
assert(ak != NULL || t == T_VOID, "should not be NULL");
@@ -1071,8 +1072,8 @@
// be used at runtime, new mirror object is created for the shared
// class. The _has_archived_raw_mirror is cleared also during the process.
oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
- "MetaspaceShared::is_heap_object_archiving_allowed() must be true");
+ assert(HeapShared::is_heap_object_archiving_allowed(),
+ "HeapShared::is_heap_object_archiving_allowed() must be true");
// Mirror is already archived
if (k->has_raw_archived_mirror()) {
@@ -1101,7 +1102,7 @@
}
// Now start archiving the mirror object
- oop archived_mirror = MetaspaceShared::archive_heap_object(mirror, THREAD);
+ oop archived_mirror = HeapShared::archive_heap_object(mirror, THREAD);
if (archived_mirror == NULL) {
return NULL;
}
@@ -1139,7 +1140,7 @@
if (k->is_typeArray_klass()) {
// The primitive type mirrors are already archived. Get the archived mirror.
oop comp_mirror = java_lang_Class::component_mirror(mirror);
- archived_comp_mirror = MetaspaceShared::find_archived_heap_object(comp_mirror);
+ archived_comp_mirror = HeapShared::find_archived_heap_object(comp_mirror);
assert(archived_comp_mirror != NULL, "Must be");
} else {
assert(k->is_objArray_klass(), "Must be");
@@ -1202,7 +1203,7 @@
return true;
}
- oop m = MetaspaceShared::materialize_archived_object(k->archived_java_mirror_raw_narrow());
+ oop m = HeapShared::materialize_archived_object(k->archived_java_mirror_raw_narrow());
if (m == NULL) {
return false;
@@ -1211,7 +1212,7 @@
log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
// mirror is archived, restore
- assert(MetaspaceShared::is_archive_object(m), "must be archived mirror object");
+ assert(HeapShared::is_archived_object(m), "must be archived mirror object");
Handle mirror(THREAD, m);
if (!k->is_array_klass()) {
--- a/src/hotspot/share/classfile/stringTable.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/stringTable.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -36,7 +36,6 @@
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
#include "memory/heapShared.inline.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/access.inline.hpp"
@@ -798,18 +797,17 @@
oop StringTable::create_archived_string(oop s, Thread* THREAD) {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
- if (MetaspaceShared::is_archive_object(s)) {
+ if (HeapShared::is_archived_object(s)) {
return s;
}
oop new_s = NULL;
typeArrayOop v = java_lang_String::value_no_keepalive(s);
- typeArrayOop new_v =
- (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
+ typeArrayOop new_v = (typeArrayOop)HeapShared::archive_heap_object(v, THREAD);
if (new_v == NULL) {
return NULL;
}
- new_s = MetaspaceShared::archive_heap_object(s, THREAD);
+ new_s = HeapShared::archive_heap_object(s, THREAD);
if (new_s == NULL) {
return NULL;
}
@@ -819,18 +817,9 @@
return new_s;
}
-class CompactStringTableWriter: public CompactHashtableWriter {
-public:
- CompactStringTableWriter(int num_entries, CompactHashtableStats* stats) :
- CompactHashtableWriter(num_entries, stats) {}
- void add(unsigned int hash, oop string) {
- CompactHashtableWriter::add(hash, CompressedOops::encode(string));
- }
-};
-
struct CopyToArchive : StackObj {
- CompactStringTableWriter* _writer;
- CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {}
+ CompactHashtableWriter* _writer;
+ CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
bool operator()(WeakHandle<vm_string_table_data>* val) {
oop s = val->peek();
if (s == NULL) {
@@ -838,6 +827,7 @@
}
unsigned int hash = java_lang_String::hash_code(s);
if (hash == 0) {
+ // We do not archive Strings with a 0 hashcode because ......
return true;
}
@@ -849,34 +839,34 @@
val->replace(new_s);
// add to the compact table
- _writer->add(hash, new_s);
+ _writer->add(hash, CompressedOops::encode(new_s));
return true;
}
};
-void StringTable::copy_shared_string_table(CompactStringTableWriter* writer) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
+void StringTable::copy_shared_string_table(CompactHashtableWriter* writer) {
+ assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
CopyToArchive copy(writer);
StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
}
void StringTable::write_to_archive() {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
+ assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
_shared_table.reset();
- int num_buckets = the_table()->_items_count / SharedSymbolTableBucketSize;
- // calculation of num_buckets can result in zero buckets, we need at least one
- CompactStringTableWriter writer(num_buckets > 1 ? num_buckets : 1,
- &MetaspaceShared::stats()->string);
+ int num_buckets = CompactHashtableWriter::default_num_buckets(
+ StringTable::the_table()->_items_count);
+ CompactHashtableWriter writer(num_buckets,
+ &MetaspaceShared::stats()->string);
// Copy the interned strings into the "string space" within the java heap
copy_shared_string_table(&writer);
writer.dump(&_shared_table, "string");
}
-void StringTable::serialize(SerializeClosure* soc) {
- _shared_table.serialize(soc);
+void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
+ _shared_table.serialize_header(soc);
if (soc->writing()) {
// Sanity. Make sure we don't use the shared table at dump time
--- a/src/hotspot/share/classfile/stringTable.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/stringTable.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -33,7 +33,7 @@
#include "oops/weakHandle.hpp"
#include "utilities/concurrentHashTable.hpp"
-class CompactStringTableWriter;
+class CompactHashtableWriter;
class SerializeClosure;
class StringTable;
@@ -163,14 +163,14 @@
// Sharing
private:
oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
- static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
+ static void copy_shared_string_table(CompactHashtableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
public:
static oop create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static void set_shared_string_mapped() { _shared_string_mapped = true; }
static bool shared_string_mapped() { return _shared_string_mapped; }
static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
- static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
+ static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
// Jcmd
static void dump(outputStream* st, bool verbose=false);
--- a/src/hotspot/share/classfile/symbolTable.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/symbolTable.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -627,43 +627,31 @@
}
#if INCLUDE_CDS
-class CompactSymbolTableWriter: public CompactHashtableWriter {
-public:
- CompactSymbolTableWriter(int num_buckets, CompactHashtableStats* stats) :
- CompactHashtableWriter(num_buckets, stats) {}
- void add(unsigned int hash, Symbol *symbol) {
- uintx deltax = MetaspaceShared::object_delta(symbol);
+struct CopyToArchive : StackObj {
+ CompactHashtableWriter* _writer;
+ CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
+ bool operator()(Symbol** value) {
+ assert(value != NULL, "expected valid value");
+ assert(*value != NULL, "value should point to a symbol");
+ Symbol* sym = *value;
+ unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
+ assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
+ "must not rehash during dumping");
+
+ uintx deltax = MetaspaceShared::object_delta(sym);
// When the symbols are stored into the archive, we already check that
// they won't be more than MAX_SHARED_DELTA from the base address, or
// else the dumping would have been aborted.
assert(deltax <= MAX_SHARED_DELTA, "must not be");
u4 delta = u4(deltax);
- CompactHashtableWriter::add(hash, delta);
- }
-};
-
-struct CopyToArchive : StackObj {
- CompactSymbolTableWriter* _writer;
- CopyToArchive(CompactSymbolTableWriter* writer) : _writer(writer) {}
- bool operator()(Symbol** value) {
- assert(value != NULL, "expected valid value");
- assert(*value != NULL, "value should point to a symbol");
- Symbol* sym = *value;
- unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
- if (fixed_hash == 0) {
- return true;
- }
- assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
- "must not rehash during dumping");
-
// add to the compact table
- _writer->add(fixed_hash, sym);
+ _writer->add(fixed_hash, delta);
return true;
}
};
-void SymbolTable::copy_shared_symbol_table(CompactSymbolTableWriter* writer) {
+void SymbolTable::copy_shared_symbol_table(CompactHashtableWriter* writer) {
CopyToArchive copy(writer);
SymbolTable::the_table()->_local_table->do_scan(Thread::current(), copy);
}
@@ -671,10 +659,10 @@
void SymbolTable::write_to_archive() {
_shared_table.reset();
- int num_buckets = (int)(SymbolTable::the_table()->_items_count / SharedSymbolTableBucketSize);
- // calculation of num_buckets can result in zero buckets, we need at least one
- CompactSymbolTableWriter writer(num_buckets > 1 ? num_buckets : 1,
- &MetaspaceShared::stats()->symbol);
+ int num_buckets = CompactHashtableWriter::default_num_buckets(
+ SymbolTable::the_table()->_items_count);
+ CompactHashtableWriter writer(num_buckets,
+ &MetaspaceShared::stats()->symbol);
copy_shared_symbol_table(&writer);
writer.dump(&_shared_table, "symbol");
@@ -686,8 +674,8 @@
assert(sym == _shared_table.lookup(name, hash, len), "sanity");
}
-void SymbolTable::serialize(SerializeClosure* soc) {
- _shared_table.serialize(soc);
+void SymbolTable::serialize_shared_table_header(SerializeClosure* soc) {
+ _shared_table.serialize_header(soc);
if (soc->writing()) {
// Sanity. Make sure we don't use the shared table at dump time
--- a/src/hotspot/share/classfile/symbolTable.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/symbolTable.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -84,7 +84,7 @@
operator Symbol*() { return _temp; }
};
-class CompactSymbolTableWriter;
+class CompactHashtableWriter;
class SerializeClosure;
class SymbolTableConfig;
@@ -240,10 +240,10 @@
// Sharing
private:
- static void copy_shared_symbol_table(CompactSymbolTableWriter* ch_table);
+ static void copy_shared_symbol_table(CompactHashtableWriter* ch_table);
public:
static void write_to_archive() NOT_CDS_RETURN;
- static void serialize(SerializeClosure* soc) NOT_CDS_RETURN;
+ static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_RETURN;
static void metaspace_pointers_do(MetaspaceClosure* it);
// Jcmd
--- a/src/hotspot/share/classfile/systemDictionary.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/systemDictionary.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,6 +52,7 @@
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/filemap.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
@@ -2037,13 +2038,13 @@
// ConstantPool::restore_unshareable_info (restores the archived
// resolved_references array object).
//
- // MetaspaceShared::fixup_mapped_heap_regions() fills the empty
+ // HeapShared::fixup_mapped_heap_regions() fills the empty
// spaces in the archived heap regions and may use
// SystemDictionary::Object_klass(), so we can do this only after
// Object_klass is resolved. See the above resolve_wk_klasses_through()
// call. No mirror objects are accessed/restored in the above call.
// Mirrors are restored after java.lang.Class is loaded.
- MetaspaceShared::fixup_mapped_heap_regions();
+ HeapShared::fixup_mapped_heap_regions();
// Initialize the constant pool for the Object_class
Object_klass()->constants()->restore_unshareable_info(CHECK);
--- a/src/hotspot/share/classfile/verificationType.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/verificationType.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -111,7 +111,7 @@
VerificationType comp_from = from.get_component(context, CHECK_false);
if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
return comp_this.is_component_assignable_from(comp_from, context,
- from_field_is_protected, CHECK_false);
+ from_field_is_protected, THREAD);
}
}
return false;
--- a/src/hotspot/share/classfile/verificationType.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/classfile/verificationType.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -312,7 +312,7 @@
case Short:
return false;
default:
- return is_assignable_from(from, context, from_field_is_protected, CHECK_false);
+ return is_assignable_from(from, context, from_field_is_protected, THREAD);
}
}
}
--- a/src/hotspot/share/code/codeBlob.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/code/codeBlob.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,9 @@
#include "jvm.h"
#include "code/codeBlob.hpp"
#include "code/codeCache.hpp"
+#include "code/icBuffer.hpp"
#include "code/relocInfo.hpp"
+#include "code/vtableStubs.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/bytecode.hpp"
#include "memory/allocation.inline.hpp"
@@ -559,6 +561,67 @@
st->print_cr("[CodeBlob]");
}
+void CodeBlob::dump_for_addr(address addr, outputStream* st, bool verbose) const {
+ if (is_buffer_blob()) {
+ // the interpreter is generated into a buffer blob
+ InterpreterCodelet* i = Interpreter::codelet_containing(addr);
+ if (i != NULL) {
+ st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin()));
+ i->print_on(st);
+ return;
+ }
+ if (Interpreter::contains(addr)) {
+ st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
+ " (not bytecode specific)", p2i(addr));
+ return;
+ }
+ //
+ if (AdapterHandlerLibrary::contains(this)) {
+ st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - code_begin()));
+ AdapterHandlerLibrary::print_handler_on(st, this);
+ }
+ // the stubroutines are generated into a buffer blob
+ StubCodeDesc* d = StubCodeDesc::desc_for(addr);
+ if (d != NULL) {
+ st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin()));
+ d->print_on(st);
+ st->cr();
+ return;
+ }
+ if (StubRoutines::contains(addr)) {
+ st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr));
+ return;
+ }
+ // the InlineCacheBuffer is using stubs generated into a buffer blob
+ if (InlineCacheBuffer::contains(addr)) {
+ st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr));
+ return;
+ }
+ VtableStub* v = VtableStubs::stub_containing(addr);
+ if (v != NULL) {
+ st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point()));
+ v->print_on(st);
+ st->cr();
+ return;
+ }
+ }
+ if (is_nmethod()) {
+ nmethod* nm = (nmethod*)this;
+ ResourceMark rm;
+ st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
+ p2i(addr), (int)(addr - nm->entry_point()), p2i(nm));
+ if (verbose) {
+ st->print(" for ");
+ nm->method()->print_value_on(st);
+ }
+ st->cr();
+ nm->print_nmethod(verbose);
+ return;
+ }
+ st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - code_begin()));
+ print_on(st);
+}
+
void RuntimeBlob::verify() {
ShouldNotReachHere();
}
--- a/src/hotspot/share/code/codeBlob.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/code/codeBlob.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -221,6 +221,7 @@
virtual void print() const { print_on(tty); };
virtual void print_on(outputStream* st) const;
virtual void print_value_on(outputStream* st) const;
+ void dump_for_addr(address addr, outputStream* st, bool verbose) const;
void print_code();
// Print the comment associated with offset on stream, if there is one
--- a/src/hotspot/share/code/nmethod.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/code/nmethod.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -2340,7 +2340,7 @@
for (int i = 0; i < oops_count(); i++) {
oop o = oop_at(i);
tty->print("#%3d: " INTPTR_FORMAT " ", i, p2i(o));
- if (o == (oop)Universe::non_oop_word()) {
+ if (o == Universe::non_oop_word()) {
tty->print("non-oop word");
} else {
if (o != NULL) {
--- a/src/hotspot/share/code/relocInfo.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/code/relocInfo.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -574,7 +574,7 @@
oop oop_Relocation::oop_value() {
oop v = *oop_addr();
// clean inline caches store a special pseudo-null
- if (v == (oop)Universe::non_oop_word()) v = NULL;
+ if (v == Universe::non_oop_word()) v = NULL;
return v;
}
--- a/src/hotspot/share/compiler/compileBroker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/compiler/compileBroker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1781,30 +1781,31 @@
return; // Stop this thread.
}
}
- continue;
- }
-
- if (UseDynamicNumberOfCompilerThreads) {
- possibly_add_compiler_threads();
- }
+ } else {
+ // Assign the task to the current thread. Mark this compilation
+ // thread as active for the profiler.
+ // CompileTaskWrapper also keeps the Method* from being deallocated if redefinition
+ // occurs after fetching the compile task off the queue.
+ CompileTaskWrapper ctw(task);
+ nmethodLocker result_handle; // (handle for the nmethod produced by this task)
+ task->set_code_handle(&result_handle);
+ methodHandle method(thread, task->method());
- // Assign the task to the current thread. Mark this compilation
- // thread as active for the profiler.
- CompileTaskWrapper ctw(task);
- nmethodLocker result_handle; // (handle for the nmethod produced by this task)
- task->set_code_handle(&result_handle);
- methodHandle method(thread, task->method());
+ // Never compile a method if breakpoints are present in it
+ if (method()->number_of_breakpoints() == 0) {
+ // Compile the method.
+ if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
+ invoke_compiler_on_method(task);
+ thread->start_idle_timer();
+ } else {
+ // After compilation is disabled, remove remaining methods from queue
+ method->clear_queued_for_compilation();
+ task->set_failure_reason("compilation is disabled");
+ }
+ }
- // Never compile a method if breakpoints are present in it
- if (method()->number_of_breakpoints() == 0) {
- // Compile the method.
- if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
- invoke_compiler_on_method(task);
- thread->start_idle_timer();
- } else {
- // After compilation is disabled, remove remaining methods from queue
- method->clear_queued_for_compilation();
- task->set_failure_reason("compilation is disabled");
+ if (UseDynamicNumberOfCompilerThreads) {
+ possibly_add_compiler_threads();
}
}
}
--- a/src/hotspot/share/compiler/oopMap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/compiler/oopMap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -350,7 +350,7 @@
// implicit null check is used in compiled code.
// The narrow_oop_base could be NULL or be the address
// of the page below heap depending on compressed oops mode.
- if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
+ if (base_loc != NULL && *base_loc != NULL && !Universe::is_narrow_oop_base(*base_loc)) {
derived_oop_fn(base_loc, derived_loc);
}
oms.next();
@@ -371,7 +371,7 @@
guarantee(loc != NULL, "missing saved register");
if ( omv.type() == OopMapValue::oop_value ) {
oop val = *loc;
- if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
+ if (val == NULL || Universe::is_narrow_oop_base(val)) {
// Ignore NULL oops and decoded NULL narrow oops which
// equal to Universe::narrow_oop_base when a narrow oop
// implicit null check is used in compiled code.
@@ -769,7 +769,7 @@
assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
assert(derived_loc != base_loc, "Base and derived in same location");
if (_active) {
- assert(*derived_loc != (oop)base_loc, "location already added");
+ assert(*derived_loc != (void*)base_loc, "location already added");
assert(_list != NULL, "list must exist");
intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
// This assert is invalid because derived pointers can be
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -118,6 +118,8 @@
}
HeapWord* EpsilonHeap::allocate_work(size_t size) {
+ assert(is_object_aligned(size), "Allocation size should be aligned: " SIZE_FORMAT, size);
+
HeapWord* res = _space->par_allocate(size);
while (res == NULL) {
@@ -168,6 +170,7 @@
}
}
+ assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res));
return res;
}
@@ -211,6 +214,9 @@
// Always honor boundaries
size = MAX2(min_size, MIN2(_max_tlab_size, size));
+ // Always honor alignment
+ size = align_up(size, MinObjAlignment);
+
if (log_is_enabled(Trace, gc)) {
ResourceMark rm;
log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -270,7 +270,7 @@
// Check if the object is in open archive
static inline bool is_open_archive_object(oop object);
// Check if the object is either in closed archive or open archive
- static inline bool is_archive_object(oop object);
+ static inline bool is_archived_object(oop object);
private:
static bool _archive_check_enabled;
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -141,7 +141,7 @@
return (archive_check_enabled() && in_open_archive_range(object));
}
-inline bool G1ArchiveAllocator::is_archive_object(oop object) {
+inline bool G1ArchiveAllocator::is_archived_object(oop object) {
return (archive_check_enabled() && (in_closed_archive_range(object) ||
in_open_archive_range(object)));
}
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -80,7 +80,6 @@
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
@@ -827,7 +826,7 @@
oop G1CollectedHeap::materialize_archived_object(oop obj) {
assert(obj != NULL, "archived obj is NULL");
- assert(MetaspaceShared::is_archive_object(obj), "must be archived object");
+ assert(G1ArchiveAllocator::is_archived_object(obj), "must be archived object");
// Loading an archived object makes it strongly reachable. If it is
// loaded during concurrent marking, it must be enqueued to the SATB
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -68,7 +68,7 @@
oop obj = CompressedOops::decode_not_null(heap_oop);
assert(Universe::heap()->is_in(obj), "should be in heap");
- if (G1ArchiveAllocator::is_archive_object(obj)) {
+ if (G1ArchiveAllocator::is_archived_object(obj)) {
// We never forward archive objects.
return;
}
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -248,7 +248,7 @@
oop obj = RawAccess<>::oop_load(p);
if (_hr->is_open_archive()) {
- guarantee(obj == NULL || G1ArchiveAllocator::is_archive_object(obj),
+ guarantee(obj == NULL || G1ArchiveAllocator::is_archived_object(obj),
"Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT,
p2i(p), p2i(obj));
} else {
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -35,6 +35,7 @@
#include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
#include "logging/log.hpp"
+#include "memory/iterator.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/objArrayKlass.inline.hpp"
@@ -58,7 +59,7 @@
ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which);
- ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
+ PCMarkAndPushClosure mark_and_push_closure(cm);
MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
@@ -73,7 +74,7 @@
ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which);
- ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
+ PCMarkAndPushClosure mark_and_push_closure(cm);
switch (_root_type) {
case universe:
@@ -139,7 +140,7 @@
ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which);
- ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
+ PCMarkAndPushClosure mark_and_push_closure(cm);
ParCompactionManager::FollowStackClosure follow_stack_closure(cm);
_rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(),
mark_and_push_closure, follow_stack_closure);
@@ -182,13 +183,12 @@
ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which);
- ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
oop obj = NULL;
ObjArrayTask task;
do {
while (ParCompactionManager::steal_objarray(which, task)) {
- cm->follow_contents((objArrayOop)task.obj(), task.index());
+ cm->follow_array((objArrayOop)task.obj(), task.index());
cm->follow_marking_stacks();
}
while (ParCompactionManager::steal(which, obj)) {
--- a/src/hotspot/share/gc/parallel/psCardTable.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psCardTable.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -28,7 +28,7 @@
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
#include "gc/parallel/psCardTable.hpp"
#include "gc/parallel/psPromotionManager.inline.hpp"
-#include "gc/parallel/psScavenge.hpp"
+#include "gc/parallel/psScavenge.inline.hpp"
#include "gc/parallel/psTasks.hpp"
#include "gc/parallel/psYoungGen.hpp"
#include "memory/iterator.inline.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/parallel/psClosure.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2018, 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_PARALLEL_PSCLOSURE_INLINE_HPP
+#define SHARE_VM_GC_PARALLEL_PSCLOSURE_INLINE_HPP
+
+#include "gc/parallel/psPromotionManager.inline.hpp"
+#include "gc/parallel/psScavenge.inline.hpp"
+#include "memory/iterator.hpp"
+#include "oops/access.inline.hpp"
+#include "oops/oop.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+template <bool promote_immediately>
+class PSRootsClosure: public OopClosure {
+private:
+ PSPromotionManager* _promotion_manager;
+
+ template <class T> void do_oop_work(T *p) {
+ if (PSScavenge::should_scavenge(p)) {
+ // We never card mark roots, maybe call a func without test?
+ _promotion_manager->copy_and_push_safe_barrier<T, promote_immediately>(p);
+ }
+ }
+public:
+ PSRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
+ void do_oop(oop* p) { PSRootsClosure::do_oop_work(p); }
+ void do_oop(narrowOop* p) { PSRootsClosure::do_oop_work(p); }
+};
+
+typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
+typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
+
+// Scavenges a single oop in a ClassLoaderData.
+class PSScavengeFromCLDClosure: public OopClosure {
+private:
+ PSPromotionManager* _pm;
+ // Used to redirty a scanned cld if it has oops
+ // pointing to the young generation after being scanned.
+ ClassLoaderData* _scanned_cld;
+public:
+ PSScavengeFromCLDClosure(PSPromotionManager* pm) : _pm(pm), _scanned_cld(NULL) { }
+ void do_oop(narrowOop* p) { ShouldNotReachHere(); }
+ void do_oop(oop* p) {
+ ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
+ assert(!psh->is_in_reserved(p), "GC barrier needed");
+ if (PSScavenge::should_scavenge(p)) {
+ assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
+
+ oop o = *p;
+ oop new_obj;
+ if (o->is_forwarded()) {
+ new_obj = o->forwardee();
+ } else {
+ new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);
+ }
+ RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
+
+ if (PSScavenge::is_obj_in_young(new_obj)) {
+ do_cld_barrier();
+ }
+ }
+ }
+
+ void set_scanned_cld(ClassLoaderData* cld) {
+ assert(_scanned_cld == NULL || cld == NULL, "Should always only handling one cld at a time");
+ _scanned_cld = cld;
+ }
+
+private:
+ void do_cld_barrier() {
+ assert(_scanned_cld != NULL, "Should not be called without having a scanned cld");
+ _scanned_cld->record_modified_oops();
+ }
+};
+
+// Scavenges the oop in a ClassLoaderData.
+class PSScavengeCLDClosure: public CLDClosure {
+private:
+ PSScavengeFromCLDClosure _oop_closure;
+public:
+ PSScavengeCLDClosure(PSPromotionManager* pm) : _oop_closure(pm) { }
+ void do_cld(ClassLoaderData* cld) {
+ // If the cld has not been dirtied we know that there's
+ // no references into the young gen and we can skip it.
+
+ if (cld->has_modified_oops()) {
+ // Setup the promotion manager to redirty this cld
+ // if references are left in the young gen.
+ _oop_closure.set_scanned_cld(cld);
+
+ // Clean the cld since we're going to scavenge all the metadata.
+ cld->oops_do(&_oop_closure, false, /*clear_modified_oops*/true);
+
+ _oop_closure.set_scanned_cld(NULL);
+ }
+ }
+};
+
+#endif
--- a/src/hotspot/share/gc/parallel/psCompactionManager.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -132,113 +132,6 @@
return _manager_array[index];
}
-void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- assert(obj != NULL, "can't follow the content of NULL object");
-
- cm->follow_klass(this);
- // Only mark the header and let the scan of the meta-data mark
- // everything else.
-
- ParCompactionManager::MarkAndPushClosure cl(cm);
- if (UseCompressedOops) {
- InstanceKlass::oop_oop_iterate_oop_maps<narrowOop>(obj, &cl);
- } else {
- InstanceKlass::oop_oop_iterate_oop_maps<oop>(obj, &cl);
- }
-}
-
-void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- InstanceKlass::oop_pc_follow_contents(obj, cm);
-
- // Follow the klass field in the mirror.
- Klass* klass = java_lang_Class::as_Klass(obj);
- if (klass != NULL) {
- // An unsafe anonymous class doesn't have its own class loader,
- // so the call to follow_klass will mark and push its java mirror instead of the
- // class loader. When handling the java mirror for an unsafe anonymous
- // class we need to make sure its class loader data is claimed, this is done
- // by calling follow_class_loader explicitly. For non-anonymous classes the
- // call to follow_class_loader is made when the class loader itself is handled.
- if (klass->is_instance_klass() &&
- InstanceKlass::cast(klass)->is_unsafe_anonymous()) {
- cm->follow_class_loader(klass->class_loader_data());
- } else {
- cm->follow_klass(klass);
- }
- } else {
- // If klass is NULL then this a mirror for a primitive type.
- // We don't have to follow them, since they are handled as strong
- // roots in Universe::oops_do.
- assert(java_lang_Class::is_primitive(obj), "Sanity check");
- }
-
- ParCompactionManager::MarkAndPushClosure cl(cm);
- if (UseCompressedOops) {
- oop_oop_iterate_statics<narrowOop>(obj, &cl);
- } else {
- oop_oop_iterate_statics<oop>(obj, &cl);
- }
-}
-
-void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- InstanceKlass::oop_pc_follow_contents(obj, cm);
-
- ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data_acquire(obj);
- if (loader_data != NULL) {
- cm->follow_class_loader(loader_data);
- }
-}
-
-template <class T>
-static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) {
- T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
- T heap_oop = RawAccess<>::oop_load(referent_addr);
- log_develop_trace(gc, ref)("InstanceRefKlass::oop_pc_follow_contents " PTR_FORMAT, p2i(obj));
- if (!CompressedOops::is_null(heap_oop)) {
- oop referent = CompressedOops::decode_not_null(heap_oop);
- if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
- PSParallelCompact::ref_processor()->discover_reference(obj, klass->reference_type())) {
- // reference already enqueued, referent will be traversed later
- klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
- log_develop_trace(gc, ref)(" Non NULL enqueued " PTR_FORMAT, p2i(obj));
- return;
- } else {
- // treat referent as normal oop
- log_develop_trace(gc, ref)(" Non NULL normal " PTR_FORMAT, p2i(obj));
- cm->mark_and_push(referent_addr);
- }
- }
- // Treat discovered as normal oop.
- T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
- cm->mark_and_push(discovered_addr);
- klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
-}
-
-
-void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- if (UseCompressedOops) {
- oop_pc_follow_contents_specialized<narrowOop>(this, obj, cm);
- } else {
- oop_pc_follow_contents_specialized<oop>(this, obj, cm);
- }
-}
-
-void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- cm->follow_klass(this);
-
- if (UseCompressedOops) {
- oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm);
- } else {
- oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm);
- }
-}
-
-void TypeArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
- assert(obj->is_typeArray(),"must be a type array");
- // Performance tweak: We skip iterating over the klass pointer since we
- // know that Universe::TypeArrayKlass never moves.
-}
-
void ParCompactionManager::follow_marking_stacks() {
do {
// Drain the overflow stack first, to allow stealing from the marking stack.
@@ -253,7 +146,7 @@
// Process ObjArrays one at a time to avoid marking stack bloat.
ObjArrayTask task;
if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) {
- follow_contents((objArrayOop)task.obj(), task.index());
+ follow_array((objArrayOop)task.obj(), task.index());
}
} while (!marking_stacks_empty());
--- a/src/hotspot/share/gc/parallel/psCompactionManager.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -171,24 +171,10 @@
void drain_region_stacks();
void follow_contents(oop obj);
- void follow_contents(objArrayOop array, int index);
+ void follow_array(objArrayOop array, int index);
void update_contents(oop obj);
- class MarkAndPushClosure: public BasicOopIterateClosure {
- private:
- ParCompactionManager* _compaction_manager;
- public:
- MarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
-
- template <typename T> void do_oop_work(T* p);
- virtual void do_oop(oop* p);
- virtual void do_oop(narrowOop* p);
-
- // This closure provides its own oop verification code.
- debug_only(virtual bool should_verify_oops() { return false; })
- };
-
class FollowStackClosure: public VoidClosure {
private:
ParCompactionManager* _compaction_manager;
--- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -25,6 +25,7 @@
#ifndef SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
#define SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
+#include "classfile/javaClasses.inline.hpp"
#include "gc/parallel/parMarkBitMap.hpp"
#include "gc/parallel/psCompactionManager.hpp"
#include "gc/parallel/psParallelCompact.inline.hpp"
@@ -37,6 +38,37 @@
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"
+class PCMarkAndPushClosure: public OopClosure {
+private:
+ ParCompactionManager* _compaction_manager;
+public:
+ PCMarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
+
+ template <typename T> void do_oop_nv(T* p) { _compaction_manager->mark_and_push(p); }
+ virtual void do_oop(oop* p) { do_oop_nv(p); }
+ virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
+
+ // This closure provides its own oop verification code.
+ debug_only(virtual bool should_verify_oops() { return false; })
+};
+
+class PCIterateMarkAndPushClosure: public MetadataVisitingOopIterateClosure {
+private:
+ ParCompactionManager* _compaction_manager;
+public:
+ PCIterateMarkAndPushClosure(ParCompactionManager* cm, ReferenceProcessor* rp) : MetadataVisitingOopIterateClosure(rp), _compaction_manager(cm) { }
+
+ template <typename T> void do_oop_nv(T* p) { _compaction_manager->mark_and_push(p); }
+ virtual void do_oop(oop* p) { do_oop_nv(p); }
+ virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
+
+ void do_klass_nv(Klass* k) { _compaction_manager->follow_klass(k); }
+ void do_cld_nv(ClassLoaderData* cld) { _compaction_manager->follow_class_loader(cld); }
+
+ // This closure provides its own oop verification code.
+ debug_only(virtual bool should_verify_oops() { return false; })
+};
+
inline bool ParCompactionManager::steal(int queue_num, oop& t) {
return stack_array()->steal(queue_num, t);
}
@@ -84,14 +116,6 @@
}
}
-template <typename T>
-inline void ParCompactionManager::MarkAndPushClosure::do_oop_work(T* p) {
- _compaction_manager->mark_and_push(p);
-}
-
-inline void ParCompactionManager::MarkAndPushClosure::do_oop(oop* p) { do_oop_work(p); }
-inline void ParCompactionManager::MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_work(p); }
-
inline void ParCompactionManager::follow_klass(Klass* klass) {
oop holder = klass->klass_holder();
mark_and_push(&holder);
@@ -101,19 +125,8 @@
_compaction_manager->follow_marking_stacks();
}
-inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) {
- MarkAndPushClosure mark_and_push_closure(this);
-
- cld->oops_do(&mark_and_push_closure, true);
-}
-
-inline void ParCompactionManager::follow_contents(oop obj) {
- assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
- obj->pc_follow_contents(this);
-}
-
-template <class T>
-inline void oop_pc_follow_contents_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
+template <typename T>
+inline void follow_array_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
const size_t len = size_t(obj->length());
const size_t beg_index = size_t(index);
assert(beg_index < len || len == 0, "index too large");
@@ -134,16 +147,34 @@
}
}
-inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
+inline void ParCompactionManager::follow_array(objArrayOop obj, int index) {
if (UseCompressedOops) {
- oop_pc_follow_contents_specialized<narrowOop>(obj, index, this);
+ follow_array_specialized<narrowOop>(obj, index, this);
} else {
- oop_pc_follow_contents_specialized<oop>(obj, index, this);
+ follow_array_specialized<oop>(obj, index, this);
}
}
inline void ParCompactionManager::update_contents(oop obj) {
- obj->pc_update_contents(this);
+ if (!obj->klass()->is_typeArray_klass()) {
+ PCAdjustPointerClosure apc(this);
+ obj->oop_iterate(&apc);
+ }
+}
+
+inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) {
+ PCMarkAndPushClosure mark_and_push_closure(this);
+ cld->oops_do(&mark_and_push_closure, true);
+}
+
+inline void ParCompactionManager::follow_contents(oop obj) {
+ assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
+ if (obj->is_objArray()) {
+ follow_array(objArrayOop(obj), 0);
+ } else {
+ PCIterateMarkAndPushClosure cl(this, PSParallelCompact::ref_processor());
+ obj->oop_iterate(&cl);
+ }
}
#endif // SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -846,18 +846,43 @@
bool PSParallelCompact::IsAliveClosure::do_object_b(oop p) { return mark_bitmap()->is_marked(p); }
+class PCReferenceProcessor: public ReferenceProcessor {
+public:
+ PCReferenceProcessor(
+ BoolObjectClosure* is_subject_to_discovery,
+ BoolObjectClosure* is_alive_non_header) :
+ ReferenceProcessor(is_subject_to_discovery,
+ ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
+ ParallelGCThreads, // mt processing degree
+ true, // mt discovery
+ ParallelGCThreads, // mt discovery degree
+ true, // atomic_discovery
+ is_alive_non_header) {
+ }
+
+ template<typename T> bool discover(oop obj, ReferenceType type) {
+ T* referent_addr = (T*) java_lang_ref_Reference::referent_addr_raw(obj);
+ T heap_oop = RawAccess<>::oop_load(referent_addr);
+ oop referent = CompressedOops::decode_not_null(heap_oop);
+ return PSParallelCompact::mark_bitmap()->is_unmarked(referent)
+ && ReferenceProcessor::discover_reference(obj, type);
+ }
+ virtual bool discover_reference(oop obj, ReferenceType type) {
+ if (UseCompressedOops) {
+ return discover<narrowOop>(obj, type);
+ } else {
+ return discover<oop>(obj, type);
+ }
+ }
+};
+
void PSParallelCompact::post_initialize() {
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
_span_based_discoverer.set_span(heap->reserved_region());
_ref_processor =
- new ReferenceProcessor(&_span_based_discoverer,
- ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
- ParallelGCThreads, // mt processing degree
- true, // mt discovery
- ParallelGCThreads, // mt discovery degree
- true, // atomic_discovery
- &_is_alive_closure, // non-header is alive closure
- false); // disable adjusting number of processing threads
+ new PCReferenceProcessor(&_span_based_discoverer,
+ &_is_alive_closure); // non-header is alive closure
+
_counters = new CollectorCounters("PSParallelCompact", 1);
// Initialize static fields in ParCompactionManager.
@@ -2077,7 +2102,7 @@
TaskQueueSetSuper* qset = ParCompactionManager::stack_array();
ParallelTaskTerminator terminator(active_gc_threads, qset);
- ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
+ PCMarkAndPushClosure mark_and_push_closure(cm);
ParCompactionManager::FollowStackClosure follow_stack_closure(cm);
// Need new claim bits before marking starts.
@@ -2178,7 +2203,7 @@
// Need new claim bits when tracing through and adjusting pointers.
ClassLoaderDataGraph::clear_claimed_marks();
- PSParallelCompact::AdjustPointerClosure oop_closure(cm);
+ PCAdjustPointerClosure oop_closure(cm);
// General strong roots.
Universe::oops_do(&oop_closure);
@@ -3071,76 +3096,6 @@
update_state(words);
}
-void InstanceKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- PSParallelCompact::AdjustPointerClosure closure(cm);
- if (UseCompressedOops) {
- oop_oop_iterate_oop_maps<narrowOop>(obj, &closure);
- } else {
- oop_oop_iterate_oop_maps<oop>(obj, &closure);
- }
-}
-
-void InstanceMirrorKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- InstanceKlass::oop_pc_update_pointers(obj, cm);
-
- PSParallelCompact::AdjustPointerClosure closure(cm);
- if (UseCompressedOops) {
- oop_oop_iterate_statics<narrowOop>(obj, &closure);
- } else {
- oop_oop_iterate_statics<oop>(obj, &closure);
- }
-}
-
-void InstanceClassLoaderKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- InstanceKlass::oop_pc_update_pointers(obj, cm);
-}
-
-#ifdef ASSERT
-template <class T> static void trace_reference_gc(const char *s, oop obj,
- T* referent_addr,
- T* discovered_addr) {
- log_develop_trace(gc, ref)("%s obj " PTR_FORMAT, s, p2i(obj));
- log_develop_trace(gc, ref)(" referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
- p2i(referent_addr), referent_addr ? p2i((oop)RawAccess<>::oop_load(referent_addr)) : NULL);
- log_develop_trace(gc, ref)(" discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
- p2i(discovered_addr), discovered_addr ? p2i((oop)RawAccess<>::oop_load(discovered_addr)) : NULL);
-}
-#endif
-
-template <class T>
-static void oop_pc_update_pointers_specialized(oop obj, ParCompactionManager* cm) {
- T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
- PSParallelCompact::adjust_pointer(referent_addr, cm);
- T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
- PSParallelCompact::adjust_pointer(discovered_addr, cm);
- debug_only(trace_reference_gc("InstanceRefKlass::oop_update_ptrs", obj,
- referent_addr, discovered_addr);)
-}
-
-void InstanceRefKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- InstanceKlass::oop_pc_update_pointers(obj, cm);
-
- if (UseCompressedOops) {
- oop_pc_update_pointers_specialized<narrowOop>(obj, cm);
- } else {
- oop_pc_update_pointers_specialized<oop>(obj, cm);
- }
-}
-
-void ObjArrayKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- assert(obj->is_objArray(), "obj must be obj array");
- PSParallelCompact::AdjustPointerClosure closure(cm);
- if (UseCompressedOops) {
- oop_oop_iterate_elements<narrowOop>(objArrayOop(obj), &closure);
- } else {
- oop_oop_iterate_elements<oop>(objArrayOop(obj), &closure);
- }
-}
-
-void TypeArrayKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
- assert(obj->is_typeArray(),"must be a type array");
-}
-
ParMarkBitMapClosure::IterationStatus
MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) {
assert(destination() != NULL, "sanity");
--- a/src/hotspot/share/gc/parallel/psParallelCompact.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -934,23 +934,6 @@
virtual bool do_object_b(oop p);
};
- class AdjustPointerClosure: public BasicOopIterateClosure {
- public:
- AdjustPointerClosure(ParCompactionManager* cm) {
- assert(cm != NULL, "associate ParCompactionManage should not be NULL");
- _cm = cm;
- }
- template <typename T> void do_oop_work(T* p);
- virtual void do_oop(oop* p);
- virtual void do_oop(narrowOop* p);
-
- // This closure provides its own oop verification code.
- debug_only(virtual bool should_verify_oops() { return false; })
- private:
- ParCompactionManager* _cm;
- };
-
- friend class AdjustPointerClosure;
friend class RefProcTaskProxy;
friend class PSParallelCompactTest;
--- a/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -124,12 +124,21 @@
}
}
-template <typename T>
-void PSParallelCompact::AdjustPointerClosure::do_oop_work(T* p) {
- adjust_pointer(p, _cm);
-}
+class PCAdjustPointerClosure: public BasicOopIterateClosure {
+public:
+ PCAdjustPointerClosure(ParCompactionManager* cm) {
+ assert(cm != NULL, "associate ParCompactionManage should not be NULL");
+ _cm = cm;
+ }
+ template <typename T> void do_oop_nv(T* p) { PSParallelCompact::adjust_pointer(p, _cm); }
+ virtual void do_oop(oop* p) { do_oop_nv(p); }
+ virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
-inline void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p) { do_oop_work(p); }
-inline void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { do_oop_work(p); }
+ // This closure provides its own oop verification code.
+ debug_only(virtual bool should_verify_oops() { return false; })
+ virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
+private:
+ ParCompactionManager* _cm;
+};
#endif // SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
--- a/src/hotspot/share/gc/parallel/psPromotionManager.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psPromotionManager.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -41,14 +41,7 @@
#include "memory/padded.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
-#include "oops/arrayOop.inline.hpp"
#include "oops/compressedOops.inline.hpp"
-#include "oops/instanceClassLoaderKlass.inline.hpp"
-#include "oops/instanceKlass.inline.hpp"
-#include "oops/instanceMirrorKlass.inline.hpp"
-#include "oops/objArrayKlass.inline.hpp"
-#include "oops/objArrayOop.inline.hpp"
-#include "oops/oop.inline.hpp"
PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
@@ -397,101 +390,6 @@
}
}
-class PushContentsClosure : public BasicOopIterateClosure {
- PSPromotionManager* _pm;
- public:
- PushContentsClosure(PSPromotionManager* pm) : _pm(pm) {}
-
- template <typename T> void do_oop_work(T* p) {
- if (PSScavenge::should_scavenge(p)) {
- _pm->claim_or_forward_depth(p);
- }
- }
-
- virtual void do_oop(oop* p) { do_oop_work(p); }
- virtual void do_oop(narrowOop* p) { do_oop_work(p); }
-
- // Don't use the oop verification code in the oop_oop_iterate framework.
- debug_only(virtual bool should_verify_oops() { return false; })
-};
-
-void InstanceKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- PushContentsClosure cl(pm);
- if (UseCompressedOops) {
- oop_oop_iterate_oop_maps_reverse<narrowOop>(obj, &cl);
- } else {
- oop_oop_iterate_oop_maps_reverse<oop>(obj, &cl);
- }
-}
-
-void InstanceMirrorKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- // Note that we don't have to follow the mirror -> klass pointer, since all
- // klasses that are dirty will be scavenged when we iterate over the
- // ClassLoaderData objects.
-
- InstanceKlass::oop_ps_push_contents(obj, pm);
-
- PushContentsClosure cl(pm);
- if (UseCompressedOops) {
- oop_oop_iterate_statics<narrowOop>(obj, &cl);
- } else {
- oop_oop_iterate_statics<oop>(obj, &cl);
- }
-}
-
-void InstanceClassLoaderKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- InstanceKlass::oop_ps_push_contents(obj, pm);
-
- // This is called by the young collector. It will already have taken care of
- // all class loader data. So, we don't have to follow the class loader ->
- // class loader data link.
-}
-
-template <class T>
-static void oop_ps_push_contents_specialized(oop obj, InstanceRefKlass *klass, PSPromotionManager* pm) {
- T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
- if (PSScavenge::should_scavenge(referent_addr)) {
- ReferenceProcessor* rp = PSScavenge::reference_processor();
- if (rp->discover_reference(obj, klass->reference_type())) {
- // reference discovered, referent will be traversed later.
- klass->InstanceKlass::oop_ps_push_contents(obj, pm);
- return;
- } else {
- // treat referent as normal oop
- pm->claim_or_forward_depth(referent_addr);
- }
- }
- // Treat discovered as normal oop
- T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
- if (PSScavenge::should_scavenge(discovered_addr)) {
- pm->claim_or_forward_depth(discovered_addr);
- }
- klass->InstanceKlass::oop_ps_push_contents(obj, pm);
-}
-
-void InstanceRefKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- if (UseCompressedOops) {
- oop_ps_push_contents_specialized<narrowOop>(obj, this, pm);
- } else {
- oop_ps_push_contents_specialized<oop>(obj, this, pm);
- }
-}
-
-void ObjArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- assert(obj->is_objArray(), "obj must be obj array");
- PushContentsClosure cl(pm);
- if (UseCompressedOops) {
- oop_oop_iterate_elements<narrowOop>(objArrayOop(obj), &cl);
- } else {
- oop_oop_iterate_elements<oop>(objArrayOop(obj), &cl);
- }
-}
-
-void TypeArrayKlass::oop_ps_push_contents(oop obj, PSPromotionManager* pm) {
- assert(obj->is_typeArray(),"must be a type array");
- ShouldNotReachHere();
-}
-
oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
assert(_old_gen_is_full || PromotionFailureALot, "Sanity");
--- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -30,9 +30,10 @@
#include "gc/parallel/psOldGen.hpp"
#include "gc/parallel/psPromotionLAB.inline.hpp"
#include "gc/parallel/psPromotionManager.hpp"
-#include "gc/parallel/psScavenge.hpp"
+#include "gc/parallel/psScavenge.inline.hpp"
#include "gc/shared/taskqueue.inline.hpp"
#include "logging/log.hpp"
+#include "memory/iterator.inline.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.inline.hpp"
@@ -99,8 +100,48 @@
}
}
+class PSPushContentsClosure: public BasicOopIterateClosure {
+ PSPromotionManager* _pm;
+ public:
+ PSPushContentsClosure(PSPromotionManager* pm) : BasicOopIterateClosure(PSScavenge::reference_processor()), _pm(pm) {}
+
+ template <typename T> void do_oop_nv(T* p) {
+ if (PSScavenge::should_scavenge(p)) {
+ _pm->claim_or_forward_depth(p);
+ }
+ }
+
+ virtual void do_oop(oop* p) { do_oop_nv(p); }
+ virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
+
+ // Don't use the oop verification code in the oop_oop_iterate framework.
+ debug_only(virtual bool should_verify_oops() { return false; })
+};
+
+//
+// This closure specialization will override the one that is defined in
+// instanceRefKlass.inline.cpp. It swaps the order of oop_oop_iterate and
+// oop_oop_iterate_ref_processing. Unfortunately G1 and Parallel behaves
+// significantly better (especially in the Derby benchmark) using opposite
+// order of these function calls.
+//
+template <>
+inline void InstanceRefKlass::oop_oop_iterate_reverse<oop, PSPushContentsClosure>(oop obj, PSPushContentsClosure* closure) {
+ oop_oop_iterate_ref_processing<oop>(obj, closure);
+ InstanceKlass::oop_oop_iterate_reverse<oop>(obj, closure);
+}
+
+template <>
+inline void InstanceRefKlass::oop_oop_iterate_reverse<narrowOop, PSPushContentsClosure>(oop obj, PSPushContentsClosure* closure) {
+ oop_oop_iterate_ref_processing<narrowOop>(obj, closure);
+ InstanceKlass::oop_oop_iterate_reverse<narrowOop>(obj, closure);
+}
+
inline void PSPromotionManager::push_contents(oop obj) {
- obj->ps_push_contents(this);
+ if (!obj->klass()->is_typeArray_klass()) {
+ PSPushContentsClosure pcc(this);
+ obj->oop_iterate_backwards(&pcc);
+ }
}
//
// This method is pretty bulky. It would be nice to split it up
--- a/src/hotspot/share/gc/parallel/psScavenge.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psScavenge.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -28,8 +28,10 @@
#include "gc/parallel/gcTaskManager.hpp"
#include "gc/parallel/parallelScavengeHeap.hpp"
#include "gc/parallel/psAdaptiveSizePolicy.hpp"
+#include "gc/parallel/psClosure.inline.hpp"
#include "gc/parallel/psMarkSweepProxy.hpp"
#include "gc/parallel/psParallelCompact.inline.hpp"
+#include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.inline.hpp"
#include "gc/parallel/psTasks.hpp"
#include "gc/shared/collectorPolicy.hpp"
--- a/src/hotspot/share/gc/parallel/psScavenge.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psScavenge.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,6 @@
#define SHARE_VM_GC_PARALLEL_PSSCAVENGE_INLINE_HPP
#include "gc/parallel/parallelScavengeHeap.hpp"
-#include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
@@ -65,93 +64,4 @@
return should_scavenge(p);
}
-template<bool promote_immediately>
-class PSRootsClosure: public OopClosure {
- private:
- PSPromotionManager* _promotion_manager;
-
- protected:
- template <class T> void do_oop_work(T *p) {
- if (PSScavenge::should_scavenge(p)) {
- // We never card mark roots, maybe call a func without test?
- _promotion_manager->copy_and_push_safe_barrier<T, promote_immediately>(p);
- }
- }
- public:
- PSRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
- void do_oop(oop* p) { PSRootsClosure::do_oop_work(p); }
- void do_oop(narrowOop* p) { PSRootsClosure::do_oop_work(p); }
-};
-
-typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
-typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
-
-// Scavenges a single oop in a ClassLoaderData.
-class PSScavengeFromCLDClosure: public OopClosure {
- private:
- PSPromotionManager* _pm;
- // Used to redirty a scanned cld if it has oops
- // pointing to the young generation after being scanned.
- ClassLoaderData* _scanned_cld;
- public:
- PSScavengeFromCLDClosure(PSPromotionManager* pm) : _pm(pm), _scanned_cld(NULL) { }
- void do_oop(narrowOop* p) { ShouldNotReachHere(); }
- void do_oop(oop* p) {
- ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
- assert(!psh->is_in_reserved(p), "GC barrier needed");
- if (PSScavenge::should_scavenge(p)) {
- assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
-
- oop o = *p;
- oop new_obj;
- if (o->is_forwarded()) {
- new_obj = o->forwardee();
- } else {
- new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);
- }
- RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
-
- if (PSScavenge::is_obj_in_young(new_obj)) {
- do_cld_barrier();
- }
- }
- }
-
- void set_scanned_cld(ClassLoaderData* cld) {
- assert(_scanned_cld == NULL || cld == NULL, "Should always only handling one cld at a time");
- _scanned_cld = cld;
- }
-
- private:
- void do_cld_barrier() {
- assert(_scanned_cld != NULL, "Should not be called without having a scanned cld");
- _scanned_cld->record_modified_oops();
- }
-};
-
-// Scavenges the oop in a ClassLoaderData.
-class PSScavengeCLDClosure: public CLDClosure {
- private:
- PSScavengeFromCLDClosure _oop_closure;
- protected:
- public:
- PSScavengeCLDClosure(PSPromotionManager* pm) : _oop_closure(pm) { }
- void do_cld(ClassLoaderData* cld) {
- // If the cld has not been dirtied we know that there's
- // no references into the young gen and we can skip it.
-
- if (cld->has_modified_oops()) {
- // Setup the promotion manager to redirty this cld
- // if references are left in the young gen.
- _oop_closure.set_scanned_cld(cld);
-
- // Clean the cld since we're going to scavenge all the metadata.
- cld->oops_do(&_oop_closure, false, /*clear_modified_oops*/true);
-
- _oop_closure.set_scanned_cld(NULL);
- }
- }
-};
-
-
#endif // SHARE_VM_GC_PARALLEL_PSSCAVENGE_INLINE_HPP
--- a/src/hotspot/share/gc/parallel/psTasks.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/parallel/psTasks.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -29,6 +29,7 @@
#include "code/codeCache.hpp"
#include "gc/parallel/gcTaskManager.hpp"
#include "gc/parallel/psCardTable.hpp"
+#include "gc/parallel/psClosure.inline.hpp"
#include "gc/parallel/psPromotionManager.hpp"
#include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.inline.hpp"
--- a/src/hotspot/share/gc/shared/barrierSet.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/barrierSet.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -130,6 +130,10 @@
virtual void on_thread_detach(JavaThread* thread) {}
virtual void make_parsable(JavaThread* thread) {}
+#ifdef CHECK_UNHANDLED_OOPS
+ virtual bool oop_equals_operator_allowed() { return true; }
+#endif
+
public:
// Print a description of the memory for the barrier set
virtual void print_on(outputStream* st) const = 0;
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -445,6 +445,15 @@
CollectedHeap::fill_with_object(start, end, zap);
}
+size_t CollectedHeap::min_dummy_object_size() const {
+ return oopDesc::header_size();
+}
+
+size_t CollectedHeap::tlab_alloc_reserve() const {
+ size_t min_size = min_dummy_object_size();
+ return min_size > (size_t)MinObjAlignment ? align_object_size(min_size) : 0;
+}
+
HeapWord* CollectedHeap::allocate_new_tlab(size_t min_size,
size_t requested_size,
size_t* actual_size) {
@@ -586,3 +595,7 @@
void CollectedHeap::deduplicate_string(oop str) {
// Do nothing, unless overridden in subclass.
}
+
+size_t CollectedHeap::obj_size(oop obj) const {
+ return obj->size();
+}
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -309,6 +309,8 @@
}
virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap);
+ virtual size_t min_dummy_object_size() const;
+ size_t tlab_alloc_reserve() const;
// Return the address "addr" aligned by "alignment_in_bytes" if such
// an address is below "end". Return NULL otherwise.
@@ -576,6 +578,8 @@
virtual bool is_oop(oop object) const;
+ virtual size_t obj_size(oop obj) const;
+
// Non product verification and debugging.
#ifndef PRODUCT
// Support for PromotionFailureALot. Return true if it's time to cause a
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -649,9 +649,6 @@
// a whole heap collection.
complete = complete || collected_old;
- print_heap_change(young_prev_used, old_prev_used);
- MetaspaceUtils::print_metaspace_change(metadata_prev_used);
-
// Adjust generation sizes.
if (collected_old) {
_old_gen->compute_new_size();
@@ -667,6 +664,9 @@
update_full_collections_completed();
}
+ print_heap_change(young_prev_used, old_prev_used);
+ MetaspaceUtils::print_metaspace_change(metadata_prev_used);
+
// Track memory usage and detect low memory after GC finishes
MemoryService::track_memory_usage();
--- a/src/hotspot/share/gc/shared/memAllocator.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -120,27 +120,22 @@
return false;
}
- if (!_overhead_limit_exceeded) {
+ const char* message = _overhead_limit_exceeded ? "GC overhead limit exceeded" : "Java heap space";
+ if (!THREAD->in_retryable_allocation()) {
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
- report_java_out_of_memory("Java heap space");
+ report_java_out_of_memory(message);
if (JvmtiExport::should_post_resource_exhausted()) {
JvmtiExport::post_resource_exhausted(
JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
- "Java heap space");
+ message);
}
- THROW_OOP_(Universe::out_of_memory_error_java_heap(), true);
+ oop exception = _overhead_limit_exceeded ?
+ Universe::out_of_memory_error_gc_overhead_limit() :
+ Universe::out_of_memory_error_java_heap();
+ THROW_OOP_(exception, true);
} else {
- // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
- report_java_out_of_memory("GC overhead limit exceeded");
-
- if (JvmtiExport::should_post_resource_exhausted()) {
- JvmtiExport::post_resource_exhausted(
- JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
- "GC overhead limit exceeded");
- }
-
- THROW_OOP_(Universe::out_of_memory_error_gc_overhead_limit(), true);
+ THROW_OOP_(Universe::out_of_memory_error_retry(), true);
}
}
@@ -192,7 +187,7 @@
// support for JVMTI VMObjectAlloc event (no-op if not enabled)
JvmtiExport::vm_object_alloc_event_collector(obj());
- if (!ThreadHeapSampler::enabled()) {
+ if (!JvmtiExport::should_post_sampled_object_alloc()) {
// Sampling disabled
return;
}
@@ -203,15 +198,6 @@
return;
}
- assert(JavaThread::current()->heap_sampler().add_sampling_collector(),
- "Should never return false.");
-
- // Only check if the sampler could actually sample something in this path.
- assert(!JvmtiExport::should_post_sampled_object_alloc() ||
- !JvmtiSampledObjectAllocEventCollector::object_alloc_is_safe_to_sample() ||
- _thread->heap_sampler().sampling_collector_present(),
- "Sampling collector not present.");
-
if (JvmtiExport::should_post_sampled_object_alloc()) {
// If we want to be sampling, protect the allocated object with a Handle
// before doing the callback. The callback is done in the destructor of
@@ -224,8 +210,6 @@
_thread->heap_sampler().check_for_sampling(obj_h(), size_in_bytes, bytes_since_last);
}
- assert(JavaThread::current()->heap_sampler().remove_sampling_collector(), "Should never return false.");
-
if (_tlab_end_reset_for_sample || _allocated_tlab_size != 0) {
_thread->tlab().set_sample_end();
}
@@ -298,7 +282,7 @@
HeapWord* mem = NULL;
ThreadLocalAllocBuffer& tlab = _thread->tlab();
- if (ThreadHeapSampler::enabled()) {
+ if (JvmtiExport::should_post_sampled_object_alloc()) {
// Try to allocate the sampled object from TLAB, it is possible a sample
// point was put and the TLAB still has space.
tlab.set_back_allocation_end();
--- a/src/hotspot/share/gc/shared/oopStorage.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -727,7 +727,7 @@
_allocation_mutex(allocation_mutex),
_active_mutex(active_mutex),
_allocation_count(0),
- _concurrent_iteration_active(false)
+ _concurrent_iteration_count(0)
{
_active_array->increment_refcount();
assert(_active_mutex->rank() < _allocation_mutex->rank(),
@@ -769,7 +769,7 @@
// blocks available for deletion.
while (reduce_deferred_updates()) {}
// Don't interfere with a concurrent iteration.
- if (_concurrent_iteration_active) return;
+ if (_concurrent_iteration_count > 0) return;
// Delete empty (and otherwise deletable) blocks from end of _allocation_list.
for (Block* block = _allocation_list.tail();
(block != NULL) && block->is_deletable();
@@ -804,7 +804,7 @@
{
MutexLockerEx aml(_active_mutex, Mutex::_no_safepoint_check_flag);
// Don't interfere with a concurrent iteration.
- if (_concurrent_iteration_active) return;
+ if (_concurrent_iteration_count > 0) return;
_active_array->remove(block);
}
// Remove block from _allocation_list and delete it.
@@ -875,7 +875,7 @@
_concurrent(concurrent)
{
assert(estimated_thread_count > 0, "estimated thread count must be positive");
- update_iteration_state(true);
+ update_concurrent_iteration_count(1);
// Get the block count *after* iteration state updated, so concurrent
// empty block deletion is suppressed and can't reduce the count. But
// ensure the count we use was written after the block with that count
@@ -885,14 +885,14 @@
OopStorage::BasicParState::~BasicParState() {
_storage->relinquish_block_array(_active_array);
- update_iteration_state(false);
+ update_concurrent_iteration_count(-1);
}
-void OopStorage::BasicParState::update_iteration_state(bool value) {
+void OopStorage::BasicParState::update_concurrent_iteration_count(int value) {
if (_concurrent) {
MutexLockerEx ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
- assert(_storage->_concurrent_iteration_active != value, "precondition");
- _storage->_concurrent_iteration_active = value;
+ _storage->_concurrent_iteration_count += value;
+ assert(_storage->_concurrent_iteration_count >= 0, "invariant");
}
}
@@ -954,7 +954,7 @@
st->print("%s: " SIZE_FORMAT " entries in " SIZE_FORMAT " blocks (%.F%%), " SIZE_FORMAT " bytes",
name(), allocations, blocks, alloc_percentage, total_memory_usage());
- if (_concurrent_iteration_active) {
+ if (_concurrent_iteration_count > 0) {
st->print(", concurrent iteration active");
}
}
--- a/src/hotspot/share/gc/shared/oopStorage.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/oopStorage.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -220,7 +220,7 @@
mutable SingleWriterSynchronizer _protect_active;
// mutable because this gets set even for const iteration.
- mutable bool _concurrent_iteration_active;
+ mutable int _concurrent_iteration_count;
Block* find_block_or_null(const oop* ptr) const;
void delete_empty_block(const Block& block);
--- a/src/hotspot/share/gc/shared/oopStorageParState.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/oopStorageParState.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -31,22 +31,16 @@
//////////////////////////////////////////////////////////////////////////////
// Support for parallel and optionally concurrent state iteration.
//
-// Parallel iteration is for the exclusive use of the GC. Other iteration
-// clients must use serial iteration.
-//
// Concurrent Iteration
//
// Iteration involves the _active_array (an ActiveArray), which contains all
// of the blocks owned by a storage object.
//
-// At most one concurrent ParState can exist at a time for a given storage
-// object.
-//
-// A concurrent ParState sets the associated storage's
-// _concurrent_iteration_active flag true when the state is constructed, and
-// sets it false when the state is destroyed. These assignments are made with
+// A concurrent ParState increments the associated storage's
+// _concurrent_iteration_count when the state is constructed, and
+// decrements it when the state is destroyed. These assignments are made with
// _active_mutex locked. Meanwhile, empty block deletion is not done while
-// _concurrent_iteration_active is true. The flag check and the dependent
+// _concurrent_iteration_count is non-zero. The counter check and the dependent
// removal of a block from the _active_array is performed with _active_mutex
// locked. This prevents concurrent iteration and empty block deletion from
// interfering with with each other.
@@ -83,8 +77,8 @@
// scheduling both operations to run at the same time.
//
// ParState<concurrent, is_const>
-// concurrent must be true if iteration is concurrent with the
-// mutator, false if iteration is at a safepoint.
+// concurrent must be true if iteration may be concurrent with the
+// mutators.
//
// is_const must be true if the iteration is over a constant storage
// object, false if the iteration may modify the storage object.
@@ -92,8 +86,7 @@
// ParState([const] OopStorage* storage)
// Construct an object for managing an iteration over storage. For a
// concurrent ParState, empty block deletion for the associated storage
-// is inhibited for the life of the ParState. There can be no more
-// than one live concurrent ParState at a time for a given storage object.
+// is inhibited for the life of the ParState.
//
// template<typename F> void iterate(F f)
// Repeatedly claims a block from the associated storage that has
@@ -152,7 +145,7 @@
struct IterationData;
- void update_iteration_state(bool value);
+ void update_concurrent_iteration_count(int value);
bool claim_next_segment(IterationData* data);
bool finish_iteration(const IterationData* data) const;
--- a/src/hotspot/share/gc/shared/plab.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/plab.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -27,7 +27,6 @@
#include "gc/shared/plab.inline.hpp"
#include "gc/shared/threadLocalAllocBuffer.hpp"
#include "logging/log.hpp"
-#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
size_t PLAB::min_size() {
@@ -43,8 +42,7 @@
_word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
_end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
{
- // ArrayOopDesc::header_size depends on command line initialization.
- AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
+ AlignmentReserve = Universe::heap()->tlab_alloc_reserve();
assert(min_size() > AlignmentReserve,
"Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " "
"to be able to contain objects", min_size(), AlignmentReserve);
--- a/src/hotspot/share/gc/shared/referenceProcessor.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -284,7 +284,7 @@
// First _prev_next ref actually points into DiscoveredList (gross).
oop new_next;
- if (_next_discovered == _current_discovered) {
+ if (oopDesc::equals_raw(_next_discovered, _current_discovered)) {
// At the end of the list, we should make _prev point to itself.
// If _ref is the first ref, then _prev_next will be in the DiscoveredList,
// and _prev will be NULL.
@@ -474,7 +474,7 @@
ReferenceProcessor::clear_discovered_references(DiscoveredList& refs_list) {
oop obj = NULL;
oop next = refs_list.head();
- while (next != obj) {
+ while (!oopDesc::equals_raw(next, obj)) {
obj = next;
next = java_lang_ref_Reference::discovered(obj);
java_lang_ref_Reference::set_discovered_raw(obj, NULL);
@@ -746,7 +746,7 @@
ref_lists[to_idx].inc_length(refs_to_move);
// Remove the chain from the from list.
- if (move_tail == new_head) {
+ if (oopDesc::equals_raw(move_tail, new_head)) {
// We found the end of the from list.
ref_lists[from_idx].set_head(NULL);
} else {
--- a/src/hotspot/share/gc/shared/referenceProcessor.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/referenceProcessor.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -143,13 +143,13 @@
inline size_t removed() const { return _removed; }
inline void move_to_next() {
- if (_current_discovered == _next_discovered) {
+ if (oopDesc::equals_raw(_current_discovered, _next_discovered)) {
// End of the list.
_current_discovered = NULL;
} else {
_current_discovered = _next_discovered;
}
- assert(_current_discovered != _first_seen, "cyclic ref_list found");
+ assert(!oopDesc::equals_raw(_current_discovered, _first_seen), "cyclic ref_list found");
_processed++;
}
};
--- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -375,7 +375,7 @@
}
typeArrayOop existing_value = lookup_or_add(value, latin1, hash);
- if (existing_value == value) {
+ if (oopDesc::equals_raw(existing_value, value)) {
// Same value, already known
stat->inc_known();
return;
--- a/src/hotspot/share/gc/shared/taskqueue.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -370,6 +370,8 @@
public:
// Returns "true" if some TaskQueue in the set contains a task.
virtual bool peek() = 0;
+ // Tasks in queue
+ virtual uint tasks() const = 0;
};
template <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
@@ -399,6 +401,7 @@
bool steal(uint queue_num, E& t);
bool peek();
+ uint tasks() const;
uint size() const { return _n; }
};
@@ -424,6 +427,15 @@
return false;
}
+template<class T, MEMFLAGS F>
+uint GenericTaskQueueSet<T, F>::tasks() const {
+ uint n = 0;
+ for (uint j = 0; j < _n; j++) {
+ n += _queues[j]->size();
+ }
+ return n;
+}
+
// When to terminate from the termination protocol.
class TerminatorTerminator: public CHeapObj<mtInternal> {
public:
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/threadLocalAllocBuffer.inline.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
@@ -461,3 +462,8 @@
_perf_max_slow_allocations ->set_value(_max_slow_allocations);
}
}
+
+size_t ThreadLocalAllocBuffer::end_reserve() {
+ size_t reserve_size = Universe::heap()->tlab_alloc_reserve();
+ return MAX2(reserve_size, (size_t)_reserve_for_allocation_prefetch);
+}
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,6 @@
#define SHARE_VM_GC_SHARED_THREADLOCALALLOCBUFFER_HPP
#include "gc/shared/gcUtil.hpp"
-#include "oops/typeArrayOop.hpp"
#include "runtime/perfData.hpp"
#include "runtime/vm_version.hpp"
@@ -138,10 +137,7 @@
inline HeapWord* allocate(size_t size);
// Reserve space at the end of TLAB
- static size_t end_reserve() {
- int reserve_size = typeArrayOopDesc::header_size(T_INT);
- return MAX2(reserve_size, _reserve_for_allocation_prefetch);
- }
+ static size_t end_reserve();
static size_t alignment_reserve() { return align_object_size(end_reserve()); }
static size_t alignment_reserve_in_bytes() { return alignment_reserve() * HeapWordSize; }
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1427,6 +1427,10 @@
return c;
}
+bool ZBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
+ return type == T_OBJECT || type == T_ARRAY;
+}
+
// == Verification ==
#ifdef ASSERT
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -194,7 +194,7 @@
virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const;
virtual void register_potential_barrier_node(Node* node) const;
virtual void unregister_potential_barrier_node(Node* node) const;
- virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return true; }
+ virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
virtual Node* step_over_gc_barrier(Node* c) const;
// If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
// expanded later, then now is the time to do so.
--- a/src/hotspot/share/interpreter/linkResolver.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/interpreter/linkResolver.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -793,24 +793,6 @@
check_method_loader_constraints(link_info, resolved_method, "method", CHECK_NULL);
}
- // For private method invocation we should only find the method in the resolved class.
- // If that is not the case then we have a found a supertype method that we have nestmate
- // access to.
- if (resolved_method->is_private() && resolved_method->method_holder() != resolved_klass) {
- ResourceMark rm(THREAD);
- DEBUG_ONLY(bool is_nestmate = InstanceKlass::cast(link_info.current_klass())->has_nestmate_access_to(InstanceKlass::cast(resolved_klass), THREAD);)
- assert(is_nestmate, "was only expecting nestmates to get here!");
- Exceptions::fthrow(
- THREAD_AND_LOCATION,
- vmSymbols::java_lang_NoSuchMethodError(),
- "%s: method %s%s not found",
- resolved_klass->external_name(),
- resolved_method->name()->as_C_string(),
- resolved_method->signature()->as_C_string()
- );
- return NULL;
- }
-
return resolved_method;
}
--- a/src/hotspot/share/interpreter/templateTable.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/interpreter/templateTable.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -36,6 +36,7 @@
// and the snippet generator, a template is assigned to each bytecode which can be
// used to generate the bytecode's implementation if needed.
+class BarrierSet;
class InterpreterMacroAssembler;
// A Template describes the properties of a code template for a given bytecode
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -148,7 +148,7 @@
require_local);
if (elem_klass != NULL) {
// Now make an array for it
- return elem_klass->array_klass(CHECK_NULL);
+ return elem_klass->array_klass(THREAD);
}
}
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -109,22 +109,72 @@
}
}
-JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
+// Manages a scope for a JVMCI runtime call that attempts a heap allocation.
+// If there is a pending exception upon closing the scope and the runtime
+// call is of the variety where allocation failure returns NULL without an
+// exception, the following action is taken:
+// 1. The pending exception is cleared
+// 2. NULL is written to JavaThread::_vm_result
+// 3. Checks that an OutOfMemoryError is Universe::out_of_memory_error_retry().
+class RetryableAllocationMark: public StackObj {
+ private:
+ JavaThread* _thread;
+ public:
+ RetryableAllocationMark(JavaThread* thread, bool activate) {
+ if (activate) {
+ assert(!thread->in_retryable_allocation(), "retryable allocation scope is non-reentrant");
+ _thread = thread;
+ _thread->set_in_retryable_allocation(true);
+ } else {
+ _thread = NULL;
+ }
+ }
+ ~RetryableAllocationMark() {
+ if (_thread != NULL) {
+ _thread->set_in_retryable_allocation(false);
+ JavaThread* THREAD = _thread;
+ if (HAS_PENDING_EXCEPTION) {
+ oop ex = PENDING_EXCEPTION;
+ CLEAR_PENDING_EXCEPTION;
+ oop retry_oome = Universe::out_of_memory_error_retry();
+ if (ex->is_a(retry_oome->klass()) && retry_oome != ex) {
+ ResourceMark rm;
+ fatal("Unexpected exception in scope of retryable allocation: " INTPTR_FORMAT " of type %s", p2i(ex), ex->klass()->external_name());
+ }
+ _thread->set_vm_result(NULL);
+ }
+ }
+ }
+};
+
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance_common(JavaThread* thread, Klass* klass, bool null_on_fail))
JRT_BLOCK;
assert(klass->is_klass(), "not a class");
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
InstanceKlass* ik = InstanceKlass::cast(klass);
- ik->check_valid_for_instantiation(true, CHECK);
- // make sure klass is initialized
- ik->initialize(CHECK);
- // allocate instance and return via TLS
- oop obj = ik->allocate_instance(CHECK);
- thread->set_vm_result(obj);
+ {
+ RetryableAllocationMark ram(thread, null_on_fail);
+ ik->check_valid_for_instantiation(true, CHECK);
+ oop obj;
+ if (null_on_fail) {
+ if (!ik->is_initialized()) {
+ // Cannot re-execute class initialization without side effects
+ // so return without attempting the initialization
+ return;
+ }
+ } else {
+ // make sure klass is initialized
+ ik->initialize(CHECK);
+ }
+ // allocate instance and return via TLS
+ obj = ik->allocate_instance(CHECK);
+ thread->set_vm_result(obj);
+ }
JRT_BLOCK_END;
SharedRuntime::on_slowpath_allocation_exit(thread);
JRT_END
-JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* thread, Klass* array_klass, jint length, bool null_on_fail))
JRT_BLOCK;
// Note: no handle for klass needed since they are not used
// anymore after new_objArray() and no GC can happen before.
@@ -133,10 +183,12 @@
oop obj;
if (array_klass->is_typeArray_klass()) {
BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
+ RetryableAllocationMark ram(thread, null_on_fail);
obj = oopFactory::new_typeArray(elt_type, length, CHECK);
} else {
Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
+ RetryableAllocationMark ram(thread, null_on_fail);
obj = oopFactory::new_objArray(elem_klass, length, CHECK);
}
thread->set_vm_result(obj);
@@ -146,8 +198,12 @@
static int deopts = 0;
// Alternate between deoptimizing and raising an error (which will also cause a deopt)
if (deopts++ % 2 == 0) {
- ResourceMark rm(THREAD);
- THROW(vmSymbols::java_lang_OutOfMemoryError());
+ if (null_on_fail) {
+ return;
+ } else {
+ ResourceMark rm(THREAD);
+ THROW(vmSymbols::java_lang_OutOfMemoryError());
+ }
} else {
deopt_caller();
}
@@ -156,32 +212,43 @@
SharedRuntime::on_slowpath_allocation_exit(thread);
JRT_END
-JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
+JRT_ENTRY(void, JVMCIRuntime::new_multi_array_common(JavaThread* thread, Klass* klass, int rank, jint* dims, bool null_on_fail))
assert(klass->is_klass(), "not a class");
assert(rank >= 1, "rank must be nonzero");
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
+ RetryableAllocationMark ram(thread, null_on_fail);
oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
thread->set_vm_result(obj);
JRT_END
-JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array_common(JavaThread* thread, oopDesc* element_mirror, jint length, bool null_on_fail))
+ RetryableAllocationMark ram(thread, null_on_fail);
oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
thread->set_vm_result(obj);
JRT_END
-JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance_common(JavaThread* thread, oopDesc* type_mirror, bool null_on_fail))
InstanceKlass* klass = InstanceKlass::cast(java_lang_Class::as_Klass(type_mirror));
if (klass == NULL) {
ResourceMark rm(THREAD);
THROW(vmSymbols::java_lang_InstantiationException());
}
+ RetryableAllocationMark ram(thread, null_on_fail);
// Create new instance (the receiver)
klass->check_valid_for_instantiation(false, CHECK);
- // Make sure klass gets initialized
- klass->initialize(CHECK);
+ if (null_on_fail) {
+ if (!klass->is_initialized()) {
+ // Cannot re-execute class initialization without side effects
+ // so return without attempting the initialization
+ return;
+ }
+ } else {
+ // Make sure klass gets initialized
+ klass->initialize(CHECK);
+ }
oop obj = klass->allocate_instance(CHECK);
thread->set_vm_result(obj);
--- a/src/hotspot/share/jvmci/jvmciRuntime.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -121,13 +121,35 @@
static BasicType kindToBasicType(Handle kind, TRAPS);
- // The following routines are all called from compiled JVMCI code
+ static void new_instance_common(JavaThread* thread, Klass* klass, bool null_on_fail);
+ static void new_array_common(JavaThread* thread, Klass* klass, jint length, bool null_on_fail);
+ static void new_multi_array_common(JavaThread* thread, Klass* klass, int rank, jint* dims, bool null_on_fail);
+ static void dynamic_new_array_common(JavaThread* thread, oopDesc* element_mirror, jint length, bool null_on_fail);
+ static void dynamic_new_instance_common(JavaThread* thread, oopDesc* type_mirror, bool null_on_fail);
+
+ // The following routines are called from compiled JVMCI code
- static void new_instance(JavaThread* thread, Klass* klass);
- static void new_array(JavaThread* thread, Klass* klass, jint length);
- static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
- static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
- static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
+ // When allocation fails, these stubs:
+ // 1. Exercise -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError handling and also
+ // post a JVMTI_EVENT_RESOURCE_EXHAUSTED event if the failure is an OutOfMemroyError
+ // 2. Return NULL with a pending exception.
+ // Compiled code must ensure these stubs are not called twice for the same allocation
+ // site due to the non-repeatable side effects in the case of OOME.
+ static void new_instance(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, false); }
+ static void new_array(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, false); }
+ static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, false); }
+ static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, false); }
+ static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, false); }
+
+ // When allocation fails, these stubs return NULL and have no pending exception. Compiled code
+ // can use these stubs if a failed allocation will be retried (e.g., by deoptimizing and
+ // re-executing in the interpreter).
+ static void new_instance_or_null(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, true); }
+ static void new_array_or_null(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, true); }
+ static void new_multi_array_or_null(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, true); }
+ static void dynamic_new_array_or_null(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, true); }
+ static void dynamic_new_instance_or_null(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, true); }
+
static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -622,6 +622,12 @@
declare_function(JVMCIRuntime::dynamic_new_array) \
declare_function(JVMCIRuntime::dynamic_new_instance) \
\
+ declare_function(JVMCIRuntime::new_instance_or_null) \
+ declare_function(JVMCIRuntime::new_array_or_null) \
+ declare_function(JVMCIRuntime::new_multi_array_or_null) \
+ declare_function(JVMCIRuntime::dynamic_new_array_or_null) \
+ declare_function(JVMCIRuntime::dynamic_new_instance_or_null) \
+ \
declare_function(JVMCIRuntime::thread_is_interrupted) \
declare_function(JVMCIRuntime::vm_message) \
declare_function(JVMCIRuntime::identity_hash_code) \
--- a/src/hotspot/share/memory/filemap.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/filemap.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -191,7 +191,7 @@
_shared_path_table_size = mapinfo->_shared_path_table_size;
_shared_path_table = mapinfo->_shared_path_table;
_shared_path_entry_size = mapinfo->_shared_path_entry_size;
- if (MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (HeapShared::is_heap_object_archiving_allowed()) {
_heap_reserved = Universe::heap()->reserved_region();
}
@@ -908,7 +908,7 @@
// regions may be added. GC may mark and update references in the mapped
// open archive objects.
void FileMapInfo::map_heap_regions_impl() {
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
log_info(cds)("CDS heap data is being ignored. UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required.");
return;
@@ -1000,7 +1000,7 @@
MetaspaceShared::max_open_archive_heap_region,
&num_open_archive_heap_ranges,
true /* open */)) {
- MetaspaceShared::set_open_archive_heap_region_mapped();
+ HeapShared::set_open_archive_heap_region_mapped();
}
}
}
@@ -1014,7 +1014,7 @@
assert(string_ranges == NULL && num_string_ranges == 0, "sanity");
}
- if (!MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (!HeapShared::open_archive_heap_region_mapped()) {
assert(open_archive_heap_ranges == NULL && num_open_archive_heap_ranges == 0, "sanity");
}
}
@@ -1088,8 +1088,8 @@
}
bool FileMapInfo::verify_mapped_heap_regions(int first, int num) {
- for (int i = first;
- i <= first + num; i++) {
+ assert(num > 0, "sanity");
+ for (int i = first; i < first + num; i++) {
if (!verify_region_checksum(i)) {
return false;
}
@@ -1160,7 +1160,7 @@
if ((MetaspaceShared::is_string_region(i) &&
!StringTable::shared_string_mapped()) ||
(MetaspaceShared::is_open_archive_heap_region(i) &&
- !MetaspaceShared::open_archive_heap_region_mapped())) {
+ !HeapShared::open_archive_heap_region_mapped())) {
return true; // archived heap data is not mapped
}
const char* buf = region_addr(i);
--- a/src/hotspot/share/memory/heapShared.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/heapShared.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -24,66 +24,218 @@
#include "precompiled.hpp"
#include "classfile/javaClasses.inline.hpp"
+#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
#include "logging/logStream.hpp"
+#include "memory/filemap.hpp"
#include "memory/heapShared.inline.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
+#include "runtime/safepointVerifiers.hpp"
#include "utilities/bitMap.inline.hpp"
+#if INCLUDE_G1GC
+#include "gc/g1/g1CollectedHeap.hpp"
+#endif
#if INCLUDE_CDS_JAVA_HEAP
-KlassSubGraphInfo* HeapShared::_subgraph_info_list = NULL;
-int HeapShared::_num_archived_subgraph_info_records = 0;
-Array<ArchivedKlassSubGraphInfoRecord>* HeapShared::_archived_subgraph_info_records = NULL;
+
+bool HeapShared::_open_archive_heap_region_mapped = false;
+bool HeapShared::_archive_heap_region_fixed = false;
+
+address HeapShared::_narrow_oop_base;
+int HeapShared::_narrow_oop_shift;
+
+////////////////////////////////////////////////////////////////
+//
+// Java heap object archiving support
+//
+////////////////////////////////////////////////////////////////
+void HeapShared::fixup_mapped_heap_regions() {
+ FileMapInfo *mapinfo = FileMapInfo::current_info();
+ mapinfo->fixup_mapped_heap_regions();
+ set_archive_heap_region_fixed();
+}
+
+unsigned HeapShared::oop_hash(oop const& p) {
+ assert(!p->mark()->has_bias_pattern(),
+ "this object should never have been locked"); // so identity_hash won't safepoin
+ unsigned hash = (unsigned)p->identity_hash();
+ return hash;
+}
+
+HeapShared::ArchivedObjectCache* HeapShared::_archived_object_cache = NULL;
+oop HeapShared::find_archived_heap_object(oop obj) {
+ assert(DumpSharedSpaces, "dump-time only");
+ ArchivedObjectCache* cache = archived_object_cache();
+ oop* p = cache->get(obj);
+ if (p != NULL) {
+ return *p;
+ } else {
+ return NULL;
+ }
+}
+
+oop HeapShared::archive_heap_object(oop obj, Thread* THREAD) {
+ assert(DumpSharedSpaces, "dump-time only");
-KlassSubGraphInfo* HeapShared::find_subgraph_info(Klass* k) {
- KlassSubGraphInfo* info = _subgraph_info_list;
- while (info != NULL) {
- if (info->klass() == k) {
- return info;
- }
- info = info->next();
+ oop ao = find_archived_heap_object(obj);
+ if (ao != NULL) {
+ // already archived
+ return ao;
+ }
+
+ int len = obj->size();
+ if (G1CollectedHeap::heap()->is_archive_alloc_too_large(len)) {
+ log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: " SIZE_FORMAT,
+ p2i(obj), (size_t)obj->size());
+ return NULL;
+ }
+
+ // Pre-compute object identity hash at CDS dump time.
+ obj->identity_hash();
+
+ oop archived_oop = (oop)G1CollectedHeap::heap()->archive_mem_allocate(len);
+ if (archived_oop != NULL) {
+ Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len);
+ MetaspaceShared::relocate_klass_ptr(archived_oop);
+ ArchivedObjectCache* cache = archived_object_cache();
+ cache->put(obj, archived_oop);
+ log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
+ p2i(obj), p2i(archived_oop));
+ } else {
+ log_error(cds, heap)(
+ "Cannot allocate space for object " PTR_FORMAT " in archived heap region",
+ p2i(obj));
+ vm_exit(1);
+ }
+ return archived_oop;
+}
+
+oop HeapShared::materialize_archived_object(narrowOop v) {
+ assert(archive_heap_region_fixed(),
+ "must be called after archive heap regions are fixed");
+ if (!CompressedOops::is_null(v)) {
+ oop obj = HeapShared::decode_from_archive(v);
+ return G1CollectedHeap::heap()->materialize_archived_object(obj);
}
return NULL;
}
+void HeapShared::archive_klass_objects(Thread* THREAD) {
+ GrowableArray<Klass*>* klasses = MetaspaceShared::collected_klasses();
+ assert(klasses != NULL, "sanity");
+ for (int i = 0; i < klasses->length(); i++) {
+ Klass* k = klasses->at(i);
+
+ // archive mirror object
+ java_lang_Class::archive_mirror(k, CHECK);
+
+ // archive the resolved_referenes array
+ if (k->is_instance_klass()) {
+ InstanceKlass* ik = InstanceKlass::cast(k);
+ ik->constants()->archive_resolved_references(THREAD);
+ }
+ }
+}
+
+void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion> *closed,
+ GrowableArray<MemRegion> *open) {
+ if (!is_heap_object_archiving_allowed()) {
+ if (log_is_enabled(Info, cds)) {
+ log_info(cds)(
+ "Archived java heap is not supported as UseG1GC, "
+ "UseCompressedOops and UseCompressedClassPointers are required."
+ "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
+ BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
+ BOOL_TO_STR(UseCompressedClassPointers));
+ }
+ return;
+ }
+
+ {
+ NoSafepointVerifier nsv;
+
+ // Cache for recording where the archived objects are copied to
+ create_archived_object_cache();
+
+ tty->print_cr("Dumping objects to closed archive heap region ...");
+ NOT_PRODUCT(StringTable::verify());
+ copy_closed_archive_heap_objects(closed);
+
+ tty->print_cr("Dumping objects to open archive heap region ...");
+ copy_open_archive_heap_objects(open);
+
+ destroy_archived_object_cache();
+ }
+
+ G1HeapVerifier::verify_archive_regions();
+}
+
+void HeapShared::copy_closed_archive_heap_objects(
+ GrowableArray<MemRegion> * closed_archive) {
+ assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");
+
+ Thread* THREAD = Thread::current();
+ G1CollectedHeap::heap()->begin_archive_alloc_range();
+
+ // Archive interned string objects
+ StringTable::write_to_archive();
+
+ G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
+ os::vm_allocation_granularity());
+}
+
+void HeapShared::copy_open_archive_heap_objects(
+ GrowableArray<MemRegion> * open_archive) {
+ assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");
+
+ Thread* THREAD = Thread::current();
+ G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
+
+ java_lang_Class::archive_basic_type_mirrors(THREAD);
+
+ archive_klass_objects(THREAD);
+
+ archive_object_subgraphs(THREAD);
+
+ G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
+ os::vm_allocation_granularity());
+}
+
+void HeapShared::init_narrow_oop_decoding(address base, int shift) {
+ _narrow_oop_base = base;
+ _narrow_oop_shift = shift;
+}
+
+//
+// Subgraph archiving support
+//
+HeapShared::DumpTimeKlassSubGraphInfoTable* HeapShared::_dump_time_subgraph_info_table = NULL;
+HeapShared::RunTimeKlassSubGraphInfoTable HeapShared::_run_time_subgraph_info_table;
+
// Get the subgraph_info for Klass k. A new subgraph_info is created if
// there is no existing one for k. The subgraph_info records the relocated
// Klass* of the original k.
KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
+ assert(DumpSharedSpaces, "dump time only");
Klass* relocated_k = MetaspaceShared::get_relocated_klass(k);
- KlassSubGraphInfo* info = find_subgraph_info(relocated_k);
- if (info != NULL) {
- return info;
+ KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(relocated_k);
+ if (info == NULL) {
+ _dump_time_subgraph_info_table->put(relocated_k, KlassSubGraphInfo(relocated_k));
+ info = _dump_time_subgraph_info_table->get(relocated_k);
+ ++ _dump_time_subgraph_info_table->_count;
}
-
- info = new KlassSubGraphInfo(relocated_k, _subgraph_info_list);
- _subgraph_info_list = info;
return info;
}
-address HeapShared::_narrow_oop_base;
-int HeapShared::_narrow_oop_shift;
-
-int HeapShared::num_of_subgraph_infos() {
- int num = 0;
- KlassSubGraphInfo* info = _subgraph_info_list;
- while (info != NULL) {
- num ++;
- info = info->next();
- }
- return num;
-}
-
// Add an entry field to the current KlassSubGraphInfo.
void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) {
assert(DumpSharedSpaces, "dump time only");
@@ -156,7 +308,6 @@
// Initialize an archived subgraph_info_record from the given KlassSubGraphInfo.
void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
_k = info->klass();
- _next = NULL;
_entry_field_records = NULL;
_subgraph_object_klasses = NULL;
@@ -191,6 +342,26 @@
}
}
+struct CopyKlassSubGraphInfoToArchive : StackObj {
+ CompactHashtableWriter* _writer;
+ CopyKlassSubGraphInfoToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
+
+ bool do_entry(Klass* klass, KlassSubGraphInfo& info) {
+ if (info.subgraph_object_klasses() != NULL || info.subgraph_entry_fields() != NULL) {
+ ArchivedKlassSubGraphInfoRecord* record =
+ (ArchivedKlassSubGraphInfoRecord*)MetaspaceShared::read_only_space_alloc(sizeof(ArchivedKlassSubGraphInfoRecord));
+ record->init(&info);
+
+ unsigned int hash = primitive_hash<Klass*>(klass);
+ uintx deltax = MetaspaceShared::object_delta(record);
+ guarantee(deltax <= MAX_SHARED_DELTA, "must not be");
+ u4 delta = u4(deltax);
+ _writer->add(hash, delta);
+ }
+ return true; // keep on iterating
+ }
+};
+
// Build the records of archived subgraph infos, which include:
// - Entry points to all subgraphs from the containing class mirror. The entry
// points are static fields in the mirror. For each entry point, the field
@@ -198,144 +369,95 @@
// back to the corresponding field at runtime.
// - A list of klasses that need to be loaded/initialized before archived
// java object sub-graph can be accessed at runtime.
-//
-// The records are saved in the archive file and reloaded at runtime.
-//
-// Layout of the archived subgraph info records:
-//
-// records_size | num_records | records*
-// ArchivedKlassSubGraphInfoRecord | entry_fields | subgraph_object_klasses
-size_t HeapShared::build_archived_subgraph_info_records(int num_records) {
- // remember the start address
- char* start_p = MetaspaceShared::read_only_space_top();
+void HeapShared::write_subgraph_info_table() {
+ // Allocate the contents of the hashtable(s) inside the RO region of the CDS archive.
+ DumpTimeKlassSubGraphInfoTable* d_table = _dump_time_subgraph_info_table;
+ CompactHashtableStats stats;
+
+ _run_time_subgraph_info_table.reset();
- // now populate the archived subgraph infos, which will be saved in the
- // archive file
- _archived_subgraph_info_records =
- MetaspaceShared::new_ro_array<ArchivedKlassSubGraphInfoRecord>(num_records);
- KlassSubGraphInfo* info = _subgraph_info_list;
- int i = 0;
- while (info != NULL) {
- assert(i < _archived_subgraph_info_records->length(), "sanity");
- ArchivedKlassSubGraphInfoRecord* record =
- _archived_subgraph_info_records->adr_at(i);
- record->init(info);
- info = info->next();
- i ++;
- }
+ int num_buckets = CompactHashtableWriter::default_num_buckets(d_table->_count);
+ CompactHashtableWriter writer(num_buckets, &stats);
+ CopyKlassSubGraphInfoToArchive copy(&writer);
+ _dump_time_subgraph_info_table->iterate(©);
- // _subgraph_info_list is no longer needed
- delete _subgraph_info_list;
- _subgraph_info_list = NULL;
-
- char* end_p = MetaspaceShared::read_only_space_top();
- size_t records_size = end_p - start_p;
- return records_size;
+ writer.dump(&_run_time_subgraph_info_table, "subgraphs");
}
-// Write the subgraph info records in the shared _ro region
-void HeapShared::write_archived_subgraph_infos() {
- assert(DumpSharedSpaces, "dump time only");
-
- Array<intptr_t>* records_header = MetaspaceShared::new_ro_array<intptr_t>(3);
-
- _num_archived_subgraph_info_records = num_of_subgraph_infos();
- size_t records_size = build_archived_subgraph_info_records(
- _num_archived_subgraph_info_records);
-
- // Now write the header information:
- // records_size, num_records, _archived_subgraph_info_records
- assert(records_header != NULL, "sanity");
- intptr_t* p = (intptr_t*)(records_header->data());
- *p = (intptr_t)records_size;
- p ++;
- *p = (intptr_t)_num_archived_subgraph_info_records;
- p ++;
- *p = (intptr_t)_archived_subgraph_info_records;
-}
-
-char* HeapShared::read_archived_subgraph_infos(char* buffer) {
- Array<intptr_t>* records_header = (Array<intptr_t>*)buffer;
- intptr_t* p = (intptr_t*)(records_header->data());
- size_t records_size = (size_t)(*p);
- p ++;
- _num_archived_subgraph_info_records = *p;
- p ++;
- _archived_subgraph_info_records =
- (Array<ArchivedKlassSubGraphInfoRecord>*)(*p);
-
- buffer = (char*)_archived_subgraph_info_records + records_size;
- return buffer;
+void HeapShared::serialize_subgraph_info_table_header(SerializeClosure* soc) {
+ _run_time_subgraph_info_table.serialize_header(soc);
}
void HeapShared::initialize_from_archived_subgraph(Klass* k) {
- if (!MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (!open_archive_heap_region_mapped()) {
return; // nothing to do
}
+ assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
- if (_num_archived_subgraph_info_records == 0) {
- return; // no subgraph info records
- }
+ unsigned int hash = primitive_hash<Klass*>(k);
+ ArchivedKlassSubGraphInfoRecord* record = _run_time_subgraph_info_table.lookup(k, hash, 0);
// Initialize from archived data. Currently this is done only
// during VM initialization time. No lock is needed.
- Thread* THREAD = Thread::current();
- for (int i = 0; i < _archived_subgraph_info_records->length(); i++) {
- ArchivedKlassSubGraphInfoRecord* record = _archived_subgraph_info_records->adr_at(i);
- if (record->klass() == k) {
- int i;
- // Found the archived subgraph info record for the requesting klass.
- // Load/link/initialize the klasses of the objects in the subgraph.
- // NULL class loader is used.
- Array<Klass*>* klasses = record->subgraph_object_klasses();
- if (klasses != NULL) {
- for (i = 0; i < klasses->length(); i++) {
- Klass* obj_k = klasses->at(i);
- Klass* resolved_k = SystemDictionary::resolve_or_null(
- (obj_k)->name(), THREAD);
- if (resolved_k != obj_k) {
- return;
- }
- if ((obj_k)->is_instance_klass()) {
- InstanceKlass* ik = InstanceKlass::cast(obj_k);
- ik->initialize(THREAD);
- } else if ((obj_k)->is_objArray_klass()) {
- ObjArrayKlass* oak = ObjArrayKlass::cast(obj_k);
- oak->initialize(THREAD);
- }
+ if (record != NULL) {
+ Thread* THREAD = Thread::current();
+ if (log_is_enabled(Info, cds, heap)) {
+ ResourceMark rm;
+ log_info(cds, heap)("initialize_from_archived_subgraph " PTR_FORMAT " %s", p2i(k),
+ k->external_name());
+ }
+
+ int i;
+ // Load/link/initialize the klasses of the objects in the subgraph.
+ // NULL class loader is used.
+ Array<Klass*>* klasses = record->subgraph_object_klasses();
+ if (klasses != NULL) {
+ for (i = 0; i < klasses->length(); i++) {
+ Klass* obj_k = klasses->at(i);
+ Klass* resolved_k = SystemDictionary::resolve_or_null(
+ (obj_k)->name(), THREAD);
+ if (resolved_k != obj_k) {
+ return;
+ }
+ if ((obj_k)->is_instance_klass()) {
+ InstanceKlass* ik = InstanceKlass::cast(obj_k);
+ ik->initialize(THREAD);
+ } else if ((obj_k)->is_objArray_klass()) {
+ ObjArrayKlass* oak = ObjArrayKlass::cast(obj_k);
+ oak->initialize(THREAD);
}
}
+ }
+
+ if (HAS_PENDING_EXCEPTION) {
+ CLEAR_PENDING_EXCEPTION;
+ // None of the field value will be set if there was an exception.
+ // The java code will not see any of the archived objects in the
+ // subgraphs referenced from k in this case.
+ return;
+ }
+
+ // Load the subgraph entry fields from the record and store them back to
+ // the corresponding fields within the mirror.
+ oop m = k->java_mirror();
+ Array<juint>* entry_field_records = record->entry_field_records();
+ if (entry_field_records != NULL) {
+ int efr_len = entry_field_records->length();
+ assert(efr_len % 2 == 0, "sanity");
+ for (i = 0; i < efr_len;) {
+ int field_offset = entry_field_records->at(i);
+ // The object refereced by the field becomes 'known' by GC from this
+ // point. All objects in the subgraph reachable from the object are
+ // also 'known' by GC.
+ oop v = materialize_archived_object(entry_field_records->at(i+1));
+ m->obj_field_put(field_offset, v);
+ i += 2;
+
+ log_debug(cds, heap)(" " PTR_FORMAT " init field @ %2d = " PTR_FORMAT, p2i(k), field_offset, p2i(v));
+ }
- if (HAS_PENDING_EXCEPTION) {
- CLEAR_PENDING_EXCEPTION;
- // None of the field value will be set if there was an exception.
- // The java code will not see any of the archived objects in the
- // subgraphs referenced from k in this case.
- return;
- }
-
- // Load the subgraph entry fields from the record and store them back to
- // the corresponding fields within the mirror.
- oop m = k->java_mirror();
- Array<juint>* entry_field_records = record->entry_field_records();
- if (entry_field_records != NULL) {
- int efr_len = entry_field_records->length();
- assert(efr_len % 2 == 0, "sanity");
- for (i = 0; i < efr_len;) {
- int field_offset = entry_field_records->at(i);
- // The object refereced by the field becomes 'known' by GC from this
- // point. All objects in the subgraph reachable from the object are
- // also 'known' by GC.
- oop v = MetaspaceShared::materialize_archived_object(
- entry_field_records->at(i+1));
- m->obj_field_put(field_offset, v);
- i += 2;
- }
- }
-
- // Done. Java code can see the archived sub-graphs referenced from k's
- // mirror after this point.
- return;
+ // Done. Java code can see the archived sub-graphs referenced from k's
+ // mirror after this point.
}
}
}
@@ -362,7 +484,7 @@
template <class T> void do_oop_work(T *p) {
oop obj = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(obj)) {
- assert(!MetaspaceShared::is_archive_object(obj),
+ assert(!HeapShared::is_archived_object(obj),
"original objects must not point to archived objects");
size_t field_delta = pointer_delta(p, _orig_referencing_obj, sizeof(char));
@@ -381,7 +503,7 @@
oop archived = HeapShared::archive_reachable_objects_from(_level + 1, _subgraph_info, obj, THREAD);
assert(archived != NULL, "VM should have exited with unarchivable objects for _level > 1");
- assert(MetaspaceShared::is_archive_object(archived), "must be");
+ assert(HeapShared::is_archived_object(archived), "must be");
if (!_record_klasses_only) {
// Update the reference in the archived copy of the referencing object.
@@ -399,7 +521,7 @@
// (3) Record the klasses of all orig_obj and all reachable objects.
oop HeapShared::archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS) {
assert(orig_obj != NULL, "must be");
- assert(!MetaspaceShared::is_archive_object(orig_obj), "sanity");
+ assert(!is_archived_object(orig_obj), "sanity");
// java.lang.Class instances cannot be included in an archived
// object sub-graph.
@@ -408,7 +530,7 @@
vm_exit(1);
}
- oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+ oop archived_obj = find_archived_heap_object(orig_obj);
if (java_lang_String::is_instance(orig_obj) && archived_obj != NULL) {
// To save time, don't walk strings that are already archived. They just contain
// pointers to a type array, whose klass doesn't need to be recorded.
@@ -425,7 +547,7 @@
bool record_klasses_only = (archived_obj != NULL);
if (archived_obj == NULL) {
++_num_new_archived_objs;
- archived_obj = MetaspaceShared::archive_heap_object(orig_obj, THREAD);
+ archived_obj = archive_heap_object(orig_obj, THREAD);
if (archived_obj == NULL) {
// Skip archiving the sub-graph referenced from the current entry field.
ResourceMark rm;
@@ -499,7 +621,7 @@
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();
- oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+ oop archived_m = find_archived_heap_object(m);
if (CompressedOops::is_null(archived_m)) {
return;
}
@@ -560,7 +682,7 @@
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();
- oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+ oop archived_m = find_archived_heap_object(m);
if (CompressedOops::is_null(archived_m)) {
return;
}
@@ -571,7 +693,7 @@
}
void HeapShared::verify_subgraph_from(oop orig_obj) {
- oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+ oop archived_obj = find_archived_heap_object(orig_obj);
if (archived_obj == NULL) {
// It's OK for the root of a subgraph to be not archived. See comments in
// archive_reachable_objects_from().
@@ -598,11 +720,11 @@
set_has_been_seen_during_subgraph_recording(obj);
if (is_archived) {
- assert(MetaspaceShared::is_archive_object(obj), "must be");
- assert(MetaspaceShared::find_archived_heap_object(obj) == NULL, "must be");
+ assert(is_archived_object(obj), "must be");
+ assert(find_archived_heap_object(obj) == NULL, "must be");
} else {
- assert(!MetaspaceShared::is_archive_object(obj), "must be");
- assert(MetaspaceShared::find_archived_heap_object(obj) != NULL, "must be");
+ assert(!is_archived_object(obj), "must be");
+ assert(find_archived_heap_object(obj) != NULL, "must be");
}
VerifySharedOopClosure walker(is_archived);
@@ -702,6 +824,8 @@
};
void HeapShared::init_archivable_static_fields(Thread* THREAD) {
+ _dump_time_subgraph_info_table = new (ResourceObj::C_HEAP, mtClass)DumpTimeKlassSubGraphInfoTable();
+
for (int i = 0; i < num_archivable_static_fields; i++) {
ArchivableStaticFieldInfo* info = &archivable_static_fields[i];
TempNewSymbol klass_name = SymbolTable::new_symbol(info->klass_name, THREAD);
@@ -720,7 +844,7 @@
}
}
-void HeapShared::archive_static_fields(Thread* THREAD) {
+void HeapShared::archive_object_subgraphs(Thread* THREAD) {
// For each class X that has one or more archived fields:
// [1] Dump the subgraph of each archived field
// [2] Create a list of all the class of the objects that can be reached
@@ -817,11 +941,6 @@
return oopmap;
}
-void HeapShared::init_narrow_oop_decoding(address base, int shift) {
- _narrow_oop_base = base;
- _narrow_oop_shift = shift;
-}
-
// Patch all the embedded oop pointers inside an archived heap region,
// to be consistent with the runtime oop encoding.
class PatchEmbeddedPointers: public BitMapClosure {
--- a/src/hotspot/share/memory/heapShared.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/heapShared.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -25,6 +25,7 @@
#ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
#define SHARE_VM_MEMORY_HEAPSHARED_HPP
+#include "classfile/compactHashtable.hpp"
#include "classfile/systemDictionary.hpp"
#include "memory/allocation.hpp"
#include "memory/universe.hpp"
@@ -42,7 +43,6 @@
// within the sub-graphs.
class KlassSubGraphInfo: public CHeapObj<mtClass> {
private:
- KlassSubGraphInfo* _next;
// The class that contains the static field(s) as the entry point(s)
// of archived object sub-graph(s).
Klass* _k;
@@ -54,8 +54,8 @@
GrowableArray<juint>* _subgraph_entry_fields;
public:
- KlassSubGraphInfo(Klass* k, KlassSubGraphInfo* next) :
- _next(next), _k(k), _subgraph_object_klasses(NULL),
+ KlassSubGraphInfo(Klass* k) :
+ _k(k), _subgraph_object_klasses(NULL),
_subgraph_entry_fields(NULL) {}
~KlassSubGraphInfo() {
if (_subgraph_object_klasses != NULL) {
@@ -66,7 +66,6 @@
}
};
- KlassSubGraphInfo* next() { return _next; }
Klass* klass() { return _k; }
GrowableArray<Klass*>* subgraph_object_klasses() {
return _subgraph_object_klasses;
@@ -87,7 +86,6 @@
// at runtime.
class ArchivedKlassSubGraphInfoRecord {
private:
- ArchivedKlassSubGraphInfoRecord* _next;
Klass* _k;
// contains pairs of field offset and value for each subgraph entry field
@@ -98,11 +96,9 @@
Array<Klass*>* _subgraph_object_klasses;
public:
ArchivedKlassSubGraphInfoRecord() :
- _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
+ _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
void init(KlassSubGraphInfo* info);
Klass* klass() { return _k; }
- ArchivedKlassSubGraphInfoRecord* next() { return _next; }
- void set_next(ArchivedKlassSubGraphInfoRecord* next) { _next = next; }
Array<juint>* entry_field_records() { return _entry_field_records; }
Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; }
};
@@ -111,15 +107,58 @@
class HeapShared: AllStatic {
friend class VerifySharedOopClosure;
private:
+
#if INCLUDE_CDS_JAVA_HEAP
- // This is a list of subgraph infos built at dump time while
- // archiving object subgraphs.
- static KlassSubGraphInfo* _subgraph_info_list;
+ static bool _open_archive_heap_region_mapped;
+ static bool _archive_heap_region_fixed;
+
+ static bool oop_equals(oop const& p1, oop const& p2) {
+ return oopDesc::equals(p1, p2);
+ }
+ static unsigned oop_hash(oop const& p);
+
+ typedef ResourceHashtable<oop, oop,
+ HeapShared::oop_hash,
+ HeapShared::oop_equals,
+ 15889, // prime number
+ ResourceObj::C_HEAP> ArchivedObjectCache;
+ static ArchivedObjectCache* _archived_object_cache;
+
+ static bool klass_equals(Klass* const& p1, Klass* const& p2) {
+ return primitive_equals<Klass*>(p1, p2);
+ }
+
+ static unsigned klass_hash(Klass* const& klass) {
+ return primitive_hash<address>((address)klass);
+ }
- // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored
- // in the archive file and reloaded at runtime.
- static int _num_archived_subgraph_info_records;
- static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records;
+ class DumpTimeKlassSubGraphInfoTable
+ : public ResourceHashtable<Klass*, KlassSubGraphInfo,
+ HeapShared::klass_hash,
+ HeapShared::klass_equals,
+ 137, // prime number
+ ResourceObj::C_HEAP> {
+ public:
+ int _count;
+ };
+
+ inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) {
+ return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset);
+ }
+
+ inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
+ return (value->klass() == key);
+ }
+
+ typedef CompactHashtable<
+ const Klass*,
+ ArchivedKlassSubGraphInfoRecord*,
+ read_record_from_compact_hashtable,
+ record_equals_compact_hashtable_entry
+ > RunTimeKlassSubGraphInfoTable;
+
+ static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
+ static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;
// Archive object sub-graph starting from the given static field
// in Klass k's mirror.
@@ -131,24 +170,15 @@
static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN;
- static KlassSubGraphInfo* find_subgraph_info(Klass *k);
static KlassSubGraphInfo* get_subgraph_info(Klass *k);
static int num_of_subgraph_infos();
- static size_t build_archived_subgraph_info_records(int num_records);
+ static void build_archived_subgraph_info_records(int num_records);
// Used by decode_from_archive
static address _narrow_oop_base;
static int _narrow_oop_shift;
- static bool oop_equals(oop const& p1, oop const& p2) {
- return primitive_equals<oop>(p1, p2);
- }
-
- static unsigned oop_hash(oop const& p) {
- return primitive_hash<address>((address)p);
- }
-
typedef ResourceHashtable<oop, bool,
HeapShared::oop_hash,
HeapShared::oop_equals,
@@ -184,8 +214,60 @@
static bool has_been_seen_during_subgraph_recording(oop obj);
static void set_has_been_seen_during_subgraph_recording(oop obj);
+
+ public:
+ static void create_archived_object_cache() {
+ _archived_object_cache =
+ new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
+ }
+ static void destroy_archived_object_cache() {
+ delete _archived_object_cache;
+ _archived_object_cache = NULL;
+ }
+ static ArchivedObjectCache* archived_object_cache() {
+ return _archived_object_cache;
+ }
+
+ static oop find_archived_heap_object(oop obj);
+ static oop archive_heap_object(oop obj, Thread* THREAD);
+ static oop materialize_archived_object(narrowOop v);
+
+ static void archive_klass_objects(Thread* THREAD);
+
+ static void set_archive_heap_region_fixed() {
+ _archive_heap_region_fixed = true;
+ }
+ static bool archive_heap_region_fixed() {
+ return _archive_heap_region_fixed;
+ }
+
+ static void archive_java_heap_objects(GrowableArray<MemRegion> *closed,
+ GrowableArray<MemRegion> *open);
+ static void copy_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive);
+ static void copy_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive);
#endif // INCLUDE_CDS_JAVA_HEAP
+
public:
+ static bool is_heap_object_archiving_allowed() {
+ CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
+ NOT_CDS_JAVA_HEAP(return false;)
+ }
+
+ static void set_open_archive_heap_region_mapped() {
+ CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true);
+ NOT_CDS_JAVA_HEAP_RETURN;
+ }
+ static bool open_archive_heap_region_mapped() {
+ CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped);
+ NOT_CDS_JAVA_HEAP_RETURN_(false);
+ }
+
+ static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
+
+ inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+
+ static void archive_java_heap_objects() NOT_CDS_JAVA_HEAP_RETURN;
+
static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
@@ -202,7 +284,9 @@
size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
- static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+ static void archive_object_subgraphs(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+ static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
+ static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
#if INCLUDE_CDS_JAVA_HEAP
static ResourceBitMap calculate_oopmap(MemRegion region);
--- a/src/hotspot/share/memory/heapShared.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/heapShared.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -27,9 +27,16 @@
#include "oops/compressedOops.inline.hpp"
#include "memory/heapShared.hpp"
+#if INCLUDE_G1GC
+#include "gc/g1/g1Allocator.inline.hpp"
+#endif
#if INCLUDE_CDS_JAVA_HEAP
+bool HeapShared::is_archived_object(oop p) {
+ return (p == NULL) ? false : G1ArchiveAllocator::is_archived_object(p);
+}
+
inline oop HeapShared::decode_from_archive(narrowOop v) {
assert(!CompressedOops::is_null(v), "narrow oop value can never be zero");
oop result = (oop)(void*)((uintptr_t)_narrow_oop_base + ((uintptr_t)v << _narrow_oop_shift));
--- a/src/hotspot/share/memory/metaspace.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspace.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -863,6 +863,42 @@
#endif
}
+// Utils to check if a pointer or range is part of a committed metaspace region.
+metaspace::VirtualSpaceNode* MetaspaceUtils::find_enclosing_virtual_space(const void* p) {
+ VirtualSpaceNode* vsn = Metaspace::space_list()->find_enclosing_space(p);
+ if (Metaspace::using_class_space() && vsn == NULL) {
+ vsn = Metaspace::class_space_list()->find_enclosing_space(p);
+ }
+ return vsn;
+}
+
+bool MetaspaceUtils::is_in_committed(const void* p) {
+#if INCLUDE_CDS
+ if (UseSharedSpaces) {
+ for (int idx = MetaspaceShared::ro; idx <= MetaspaceShared::mc; idx++) {
+ if (FileMapInfo::current_info()->is_in_shared_region(p, idx)) {
+ return true;
+ }
+ }
+ }
+#endif
+ return find_enclosing_virtual_space(p) != NULL;
+}
+
+bool MetaspaceUtils::is_range_in_committed(const void* from, const void* to) {
+#if INCLUDE_CDS
+ if (UseSharedSpaces) {
+ for (int idx = MetaspaceShared::ro; idx <= MetaspaceShared::mc; idx++) {
+ if (FileMapInfo::current_info()->is_in_shared_region(from, idx)) {
+ return FileMapInfo::current_info()->is_in_shared_region(to, idx);
+ }
+ }
+ }
+#endif
+ VirtualSpaceNode* vsn = find_enclosing_virtual_space(from);
+ return (vsn != NULL) && vsn->contains(to);
+}
+
// Metaspace methods
--- a/src/hotspot/share/memory/metaspace.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspace.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -71,6 +71,7 @@
class PrintCLDMetaspaceInfoClosure;
class SpaceManager;
class VirtualSpaceList;
+ class VirtualSpaceNode;
}
// Metaspaces each have a SpaceManager and allocations
@@ -297,6 +298,10 @@
// Spacemanager updates running counters.
friend class metaspace::SpaceManager;
+ // Special access for error reporting (checks without locks).
+ friend class oopDesc;
+ friend class Klass;
+
// Running counters for statistics concerning in-use chunks.
// Note: capacity = used + free + waste + overhead. Note that we do not
// count free and waste. Their sum can be deduces from the three other values.
@@ -324,6 +329,12 @@
// Helper for print_xx_report.
static void print_vs(outputStream* out, size_t scale);
+ // Utils to check if a pointer or range is part of a committed metaspace region
+ // without acquiring any locks.
+ static metaspace::VirtualSpaceNode* find_enclosing_virtual_space(const void* p);
+ static bool is_in_committed(const void* p);
+ static bool is_range_in_committed(const void* from, const void* to);
+
public:
// Collect used metaspace statistics. This involves walking the CLDG. The resulting
--- a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -141,17 +141,17 @@
// This function looks at the mmap regions in the metaspace without locking.
// The chunks are added with store ordering and not deleted except for at
// unloading time during a safepoint.
-bool VirtualSpaceList::contains(const void* ptr) {
+VirtualSpaceNode* VirtualSpaceList::find_enclosing_space(const void* ptr) {
// List should be stable enough to use an iterator here because removing virtual
// space nodes is only allowed at a safepoint.
VirtualSpaceListIterator iter(virtual_space_list());
while (iter.repeat()) {
VirtualSpaceNode* vsn = iter.get_next();
if (vsn->contains(ptr)) {
- return true;
+ return vsn;
}
}
- return false;
+ return NULL;
}
void VirtualSpaceList::retire_current_virtual_space() {
--- a/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -116,7 +116,8 @@
void inc_virtual_space_count();
void dec_virtual_space_count();
- bool contains(const void* ptr);
+ VirtualSpaceNode* find_enclosing_space(const void* ptr);
+ bool contains(const void* ptr) { return find_enclosing_space(ptr) != NULL; }
// Unlink empty VirtualSpaceNodes and free it.
void purge(ChunkManager* chunk_manager);
--- a/src/hotspot/share/memory/metaspaceShared.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspaceShared.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -75,8 +75,6 @@
bool MetaspaceShared::_has_error_classes;
bool MetaspaceShared::_archive_loading_failed = false;
bool MetaspaceShared::_remapped_readwrite = false;
-bool MetaspaceShared::_open_archive_heap_region_mapped = false;
-bool MetaspaceShared::_archive_heap_region_fixed = false;
address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
size_t MetaspaceShared::_core_spaces_size = 0;
@@ -108,7 +106,7 @@
// [5] C++ vtables are copied into the md region.
// [6] Original class files are copied into the od region.
//
-// The s0/s1 and oa0/oa1 regions are populated inside MetaspaceShared::dump_java_heap_objects.
+// The s0/s1 and oa0/oa1 regions are populated inside HeapShared::archive_java_heap_objects.
// Their layout is independent of the other 5 regions.
class DumpRegion {
@@ -420,10 +418,10 @@
vmSymbols::serialize(soc);
soc->do_tag(--tag);
- // Dump/restore the symbol and string tables
- SymbolTable::serialize(soc);
- StringTable::serialize(soc);
- soc->do_tag(--tag);
+ // Dump/restore the symbol/string/subgraph_info tables
+ SymbolTable::serialize_shared_table_header(soc);
+ StringTable::serialize_shared_table_header(soc);
+ HeapShared::serialize_subgraph_info_table_header(soc);
JavaClasses::serialize_offsets(soc);
InstanceMirrorKlass::serialize_offsets(soc);
@@ -454,6 +452,10 @@
// is run at a safepoint just before exit, this is the entire set of classes.
static GrowableArray<Klass*>* _global_klass_objects;
+GrowableArray<Klass*>* MetaspaceShared::collected_klasses() {
+ return _global_klass_objects;
+}
+
static void collect_array_classes(Klass* k) {
_global_klass_objects->append_if_missing(k);
if (k->is_array_klass()) {
@@ -512,7 +514,7 @@
}
static void clear_basic_type_mirrors() {
- assert(!MetaspaceShared::is_heap_object_archiving_allowed(), "Sanity");
+ assert(!HeapShared::is_heap_object_archiving_allowed(), "Sanity");
Universe::set_int_mirror(NULL);
Universe::set_float_mirror(NULL);
Universe::set_double_mirror(NULL);
@@ -850,7 +852,7 @@
if (*o == NULL) {
_dump_region->append_intptr_t(0);
} else {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
+ assert(HeapShared::is_heap_object_archiving_allowed(),
"Archiving heap object is not allowed");
_dump_region->append_intptr_t(
(intptr_t)CompressedOops::encode_not_null(*o));
@@ -1098,6 +1100,21 @@
return _alloc_stats;
}
+ // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
+ // outside of ArchiveCompactor::allocate(). These are usually for misc tables
+ // that are allocated in the RO space.
+ class OtherROAllocMark {
+ char* _oldtop;
+ public:
+ OtherROAllocMark() {
+ _oldtop = _ro_region.top();
+ }
+ ~OtherROAllocMark() {
+ char* newtop = _ro_region.top();
+ ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - _oldtop), true);
+ }
+ };
+
static void allocate(MetaspaceClosure::Ref* ref, bool read_only) {
address obj = ref->obj();
int bytes = ref->size() * BytesPerWord;
@@ -1308,13 +1325,13 @@
}
char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
- char* oldtop = _ro_region.top();
+ ArchiveCompactor::OtherROAllocMark mark;
// Reorder the system dictionary. Moving the symbols affects
// how the hash table indices are calculated.
SystemDictionary::reorder_dictionary_for_sharing();
tty->print("Removing java_mirror ... ");
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
clear_basic_type_mirrors();
}
remove_java_mirror_in_classes();
@@ -1329,11 +1346,6 @@
char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
SystemDictionary::copy_table(table_top, _ro_region.top());
- // Write the archived object sub-graph infos. For each klass with sub-graphs,
- // the info includes the static fields (sub-graph entry points) and Klasses
- // of objects included in the sub-graph.
- HeapShared::write_archived_subgraph_infos();
-
// Write the other data to the output array.
WriteClosure wc(&_ro_region);
MetaspaceShared::serialize(&wc);
@@ -1341,8 +1353,6 @@
// Write the bitmaps for patching the archive heap regions
dump_archive_heap_oopmaps();
- char* newtop = _ro_region.top();
- ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - oldtop), true);
return buckets_top;
}
@@ -1790,42 +1800,18 @@
#if INCLUDE_CDS_JAVA_HEAP
void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
- if (log_is_enabled(Info, cds)) {
- log_info(cds)(
- "Archived java heap is not supported as UseG1GC, "
- "UseCompressedOops and UseCompressedClassPointers are required."
- "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
- BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
- BOOL_TO_STR(UseCompressedClassPointers));
- }
- return;
- }
-
- {
- NoSafepointVerifier nsv;
-
- // Cache for recording where the archived objects are copied to
- MetaspaceShared::create_archive_object_cache();
-
- tty->print_cr("Dumping objects to closed archive heap region ...");
- NOT_PRODUCT(StringTable::verify());
- // The closed space has maximum two regions. See FileMapInfo::write_archive_heap_regions() for details.
- _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
- MetaspaceShared::dump_closed_archive_heap_objects(_closed_archive_heap_regions);
-
- tty->print_cr("Dumping objects to open archive heap region ...");
- _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
- MetaspaceShared::dump_open_archive_heap_objects(_open_archive_heap_regions);
-
- MetaspaceShared::destroy_archive_object_cache();
- }
-
- G1HeapVerifier::verify_archive_regions();
+ // The closed and open archive heap space has maximum two regions.
+ // See FileMapInfo::write_archive_heap_regions() for details.
+ _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
+ _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
+ HeapShared::archive_java_heap_objects(_closed_archive_heap_regions,
+ _open_archive_heap_regions);
+ ArchiveCompactor::OtherROAllocMark mark;
+ HeapShared::write_subgraph_info_table();
}
void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
- if (MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (HeapShared::is_heap_object_archiving_allowed()) {
_closed_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
dump_archive_heap_oopmaps(_closed_archive_heap_regions, _closed_archive_heap_oopmaps);
@@ -1853,124 +1839,6 @@
oopmaps->append(info);
}
}
-
-void MetaspaceShared::dump_closed_archive_heap_objects(
- GrowableArray<MemRegion> * closed_archive) {
- assert(is_heap_object_archiving_allowed(), "Cannot dump java heap objects");
-
- Thread* THREAD = Thread::current();
- G1CollectedHeap::heap()->begin_archive_alloc_range();
-
- // Archive interned string objects
- StringTable::write_to_archive();
-
- G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
- os::vm_allocation_granularity());
-}
-
-void MetaspaceShared::dump_open_archive_heap_objects(
- GrowableArray<MemRegion> * open_archive) {
- assert(UseG1GC, "Only support G1 GC");
- assert(UseCompressedOops && UseCompressedClassPointers,
- "Only support UseCompressedOops and UseCompressedClassPointers enabled");
-
- Thread* THREAD = Thread::current();
- G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
-
- java_lang_Class::archive_basic_type_mirrors(THREAD);
-
- MetaspaceShared::archive_klass_objects(THREAD);
-
- HeapShared::archive_static_fields(THREAD);
-
- G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
- os::vm_allocation_granularity());
-}
-
-unsigned MetaspaceShared::obj_hash(oop const& p) {
- assert(!p->mark()->has_bias_pattern(),
- "this object should never have been locked"); // so identity_hash won't safepoin
- unsigned hash = (unsigned)p->identity_hash();
- return hash;
-}
-
-MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
-oop MetaspaceShared::find_archived_heap_object(oop obj) {
- assert(DumpSharedSpaces, "dump-time only");
- ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
- oop* p = cache->get(obj);
- if (p != NULL) {
- return *p;
- } else {
- return NULL;
- }
-}
-
-oop MetaspaceShared::archive_heap_object(oop obj, Thread* THREAD) {
- assert(DumpSharedSpaces, "dump-time only");
-
- oop ao = find_archived_heap_object(obj);
- if (ao != NULL) {
- // already archived
- return ao;
- }
-
- int len = obj->size();
- if (G1CollectedHeap::heap()->is_archive_alloc_too_large(len)) {
- log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: " SIZE_FORMAT,
- p2i(obj), (size_t)obj->size());
- return NULL;
- }
-
- int hash = obj->identity_hash();
- oop archived_oop = (oop)G1CollectedHeap::heap()->archive_mem_allocate(len);
- if (archived_oop != NULL) {
- Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len);
- relocate_klass_ptr(archived_oop);
- ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
- cache->put(obj, archived_oop);
- log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
- p2i(obj), p2i(archived_oop));
- } else {
- log_error(cds, heap)(
- "Cannot allocate space for object " PTR_FORMAT " in archived heap region",
- p2i(obj));
- vm_exit(1);
- }
- return archived_oop;
-}
-
-oop MetaspaceShared::materialize_archived_object(narrowOop v) {
- assert(archive_heap_region_fixed(),
- "must be called after archive heap regions are fixed");
- if (!CompressedOops::is_null(v)) {
- oop obj = HeapShared::decode_from_archive(v);
- return G1CollectedHeap::heap()->materialize_archived_object(obj);
- }
- return NULL;
-}
-
-void MetaspaceShared::archive_klass_objects(Thread* THREAD) {
- int i;
- for (i = 0; i < _global_klass_objects->length(); i++) {
- Klass* k = _global_klass_objects->at(i);
-
- // archive mirror object
- java_lang_Class::archive_mirror(k, CHECK);
-
- // archive the resolved_referenes array
- if (k->is_instance_klass()) {
- InstanceKlass* ik = InstanceKlass::cast(k);
- ik->constants()->archive_resolved_references(THREAD);
- }
- }
-}
-
-void MetaspaceShared::fixup_mapped_heap_regions() {
- FileMapInfo *mapinfo = FileMapInfo::current_info();
- mapinfo->fixup_mapped_heap_regions();
- set_archive_heap_region_fixed();
-}
#endif // INCLUDE_CDS_JAVA_HEAP
// Closure for serializing initialization data in from a data area
@@ -2010,12 +1878,12 @@
void do_oop(oop *p) {
narrowOop o = (narrowOop)nextPtr();
- if (o == 0 || !MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (o == 0 || !HeapShared::open_archive_heap_region_mapped()) {
p = NULL;
} else {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
+ assert(HeapShared::is_heap_object_archiving_allowed(),
"Archived heap object is not allowed");
- assert(MetaspaceShared::open_archive_heap_region_mapped(),
+ assert(HeapShared::open_archive_heap_region_mapped(),
"Open archive heap region is not mapped");
*p = HeapShared::decode_from_archive(o);
}
@@ -2145,9 +2013,6 @@
buffer += sizeof(intptr_t);
buffer += len;
- // The table of archived java heap object sub-graph infos
- buffer = HeapShared::read_archived_subgraph_infos(buffer);
-
// Verify various attributes of the archive, plus initialize the
// shared string/symbol tables
intptr_t* array = (intptr_t*)buffer;
--- a/src/hotspot/share/memory/metaspaceShared.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/metaspaceShared.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -58,8 +58,6 @@
static bool _has_error_classes;
static bool _archive_loading_failed;
static bool _remapped_readwrite;
- static bool _open_archive_heap_region_mapped;
- static bool _archive_heap_region_fixed;
static address _cds_i2i_entry_code_buffers;
static size_t _cds_i2i_entry_code_buffers_size;
static size_t _core_spaces_size;
@@ -93,63 +91,7 @@
static int preload_classes(const char * class_list_path,
TRAPS) NOT_CDS_RETURN_(0);
-#if INCLUDE_CDS_JAVA_HEAP
- private:
- static bool obj_equals(oop const& p1, oop const& p2) {
- return p1 == p2;
- }
- static unsigned obj_hash(oop const& p);
-
- typedef ResourceHashtable<oop, oop,
- MetaspaceShared::obj_hash,
- MetaspaceShared::obj_equals,
- 15889, // prime number
- ResourceObj::C_HEAP> ArchivedObjectCache;
- static ArchivedObjectCache* _archive_object_cache;
-
- public:
- static ArchivedObjectCache* archive_object_cache() {
- return _archive_object_cache;
- }
- static oop find_archived_heap_object(oop obj);
- static oop archive_heap_object(oop obj, Thread* THREAD);
- static oop materialize_archived_object(narrowOop v);
- static void archive_klass_objects(Thread* THREAD);
-
- static void set_archive_heap_region_fixed() {
- _archive_heap_region_fixed = true;
- }
-
- static bool archive_heap_region_fixed() {
- return _archive_heap_region_fixed;
- }
-#endif
-
- inline static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
-
- static bool is_heap_object_archiving_allowed() {
- CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
- NOT_CDS_JAVA_HEAP(return false;)
- }
- static void create_archive_object_cache() {
- CDS_JAVA_HEAP_ONLY(_archive_object_cache = new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache(););
- }
- static void destroy_archive_object_cache() {
- CDS_JAVA_HEAP_ONLY(delete _archive_object_cache; _archive_object_cache = NULL;);
- }
- static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
-
- static void dump_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive) NOT_CDS_JAVA_HEAP_RETURN;
-
- static void dump_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive) NOT_CDS_JAVA_HEAP_RETURN;
- static void set_open_archive_heap_region_mapped() {
- CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true);
- NOT_CDS_JAVA_HEAP_RETURN;
- }
- static bool open_archive_heap_region_mapped() {
- CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped);
- NOT_CDS_JAVA_HEAP_RETURN_(false);
- }
+ static GrowableArray<Klass*>* collected_klasses();
static ReservedSpace* shared_rs() {
CDS_ONLY(return &_shared_rs);
--- a/src/hotspot/share/memory/universe.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/universe.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -39,6 +39,7 @@
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
+#include "memory/heapShared.hpp"
#include "memory/filemap.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
@@ -113,6 +114,7 @@
oop Universe::_out_of_memory_error_array_size = NULL;
oop Universe::_out_of_memory_error_gc_overhead_limit = NULL;
oop Universe::_out_of_memory_error_realloc_objects = NULL;
+oop Universe::_out_of_memory_error_retry = NULL;
oop Universe::_delayed_stack_overflow_error_message = NULL;
objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
@@ -195,6 +197,7 @@
f->do_oop((oop*)&_out_of_memory_error_array_size);
f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit);
f->do_oop((oop*)&_out_of_memory_error_realloc_objects);
+ f->do_oop((oop*)&_out_of_memory_error_retry);
f->do_oop((oop*)&_delayed_stack_overflow_error_message);
f->do_oop((oop*)&_preallocated_out_of_memory_error_array);
f->do_oop((oop*)&_null_ptr_exception_instance);
@@ -240,8 +243,15 @@
f->do_ptr((void**)&_objectArrayKlassObj);
#if INCLUDE_CDS_JAVA_HEAP
- // The mirrors are NULL if MetaspaceShared::is_heap_object_archiving_allowed
- // is false.
+#ifdef ASSERT
+ if (DumpSharedSpaces && !HeapShared::is_heap_object_archiving_allowed()) {
+ assert(_int_mirror == NULL && _float_mirror == NULL &&
+ _double_mirror == NULL && _byte_mirror == NULL &&
+ _bool_mirror == NULL && _char_mirror == NULL &&
+ _long_mirror == NULL && _short_mirror == NULL &&
+ _void_mirror == NULL, "mirrors should be NULL");
+ }
+#endif
f->do_oop(&_int_mirror);
f->do_oop(&_float_mirror);
f->do_oop(&_double_mirror);
@@ -420,9 +430,9 @@
void Universe::initialize_basic_type_mirrors(TRAPS) {
#if INCLUDE_CDS_JAVA_HEAP
if (UseSharedSpaces &&
- MetaspaceShared::open_archive_heap_region_mapped() &&
+ HeapShared::open_archive_heap_region_mapped() &&
_int_mirror != NULL) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(), "Sanity");
+ assert(HeapShared::is_heap_object_archiving_allowed(), "Sanity");
assert(_float_mirror != NULL && _double_mirror != NULL &&
_byte_mirror != NULL && _byte_mirror != NULL &&
_bool_mirror != NULL && _char_mirror != NULL &&
@@ -565,7 +575,8 @@
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_class_metaspace)) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_array_size)) &&
(!oopDesc::equals(throwable(), Universe::_out_of_memory_error_gc_overhead_limit)) &&
- (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)));
+ (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)) &&
+ (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_retry)));
}
@@ -974,6 +985,7 @@
Universe::_out_of_memory_error_gc_overhead_limit =
ik->allocate_instance(CHECK_false);
Universe::_out_of_memory_error_realloc_objects = ik->allocate_instance(CHECK_false);
+ Universe::_out_of_memory_error_retry = ik->allocate_instance(CHECK_false);
// Setup preallocated cause message for delayed StackOverflowError
if (StackReservedPages > 0) {
@@ -1019,6 +1031,9 @@
msg = java_lang_String::create_from_str("Java heap space: failed reallocation of scalar replaced objects", CHECK_false);
java_lang_Throwable::set_message(Universe::_out_of_memory_error_realloc_objects, msg());
+ msg = java_lang_String::create_from_str("Java heap space: failed retryable allocation", CHECK_false);
+ java_lang_Throwable::set_message(Universe::_out_of_memory_error_retry, msg());
+
msg = java_lang_String::create_from_str("/ by zero", CHECK_false);
java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg());
--- a/src/hotspot/share/memory/universe.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/memory/universe.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -148,6 +148,7 @@
static oop _out_of_memory_error_array_size;
static oop _out_of_memory_error_gc_overhead_limit;
static oop _out_of_memory_error_realloc_objects;
+ static oop _out_of_memory_error_retry;
// preallocated cause message for delayed StackOverflowError
static oop _delayed_stack_overflow_error_message;
@@ -363,6 +364,8 @@
static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); }
static oop out_of_memory_error_realloc_objects() { return gen_out_of_memory_error(_out_of_memory_error_realloc_objects); }
+ // Throw default _out_of_memory_error_retry object as it will never propagate out of the VM
+ static oop out_of_memory_error_retry() { return _out_of_memory_error_retry; }
static oop delayed_stack_overflow_error_message() { return _delayed_stack_overflow_error_message; }
// The particular choice of collected heap.
--- a/src/hotspot/share/oops/access.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/access.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -277,7 +277,7 @@
}
static bool equals(oop o1, oop o2) {
- verify_decorators<INTERNAL_EMPTY>();
+ verify_decorators<AS_RAW>();
return AccessInternal::equals<decorators>(o1, o2);
}
};
--- a/src/hotspot/share/oops/accessBackend.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/accessBackend.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -410,7 +410,7 @@
static oop resolve(oop obj) { return obj; }
- static bool equals(oop o1, oop o2) { return o1 == o2; }
+ static bool equals(oop o1, oop o2) { return (void*)o1 == (void*)o2; }
};
// Below is the implementation of the first 4 steps of the template pipeline:
@@ -998,7 +998,7 @@
template <DecoratorSet decorators>
inline static typename EnableIf<
- HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
+ HasDecorator<decorators, AS_RAW>::value || HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
equals(oop o1, oop o2) {
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
return Raw::equals(o1, o2);
@@ -1006,7 +1006,7 @@
template <DecoratorSet decorators>
inline static typename EnableIf<
- !HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
+ !HasDecorator<decorators, AS_RAW>::value && !HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
equals(oop o1, oop o2) {
return RuntimeDispatch<decorators, oop, BARRIER_EQUALS>::equals(o1, o2);
}
--- a/src/hotspot/share/oops/arrayKlass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/arrayKlass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -130,14 +130,7 @@
}
objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
- if (length < 0) {
- THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
- }
- if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
- report_java_out_of_memory("Requested array size exceeds VM limit");
- JvmtiExport::post_array_size_exhausted();
- THROW_OOP_0(Universe::out_of_memory_error_array_size());
- }
+ check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0);
int size = objArrayOopDesc::object_size(length);
Klass* k = array_klass(n+dimension(), CHECK_0);
ArrayKlass* ak = ArrayKlass::cast(k);
--- a/src/hotspot/share/oops/compressedOops.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/compressedOops.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,7 +66,7 @@
assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
uint64_t result = pd >> shift;
assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow");
- assert(decode(result) == v, "reversibility");
+ assert(oopDesc::equals_raw(decode(result), v), "reversibility");
return (narrowOop)result;
}
--- a/src/hotspot/share/oops/constantPool.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/constantPool.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -33,6 +33,7 @@
#include "interpreter/linkResolver.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -295,7 +296,7 @@
}
}
- oop archived = MetaspaceShared::archive_heap_object(rr, THREAD);
+ oop archived = HeapShared::archive_heap_object(rr, THREAD);
// If the resolved references array is not archived (too large),
// the 'archived' object is NULL. No need to explicitly check
// the return value of archive_heap_object here. At runtime, the
@@ -340,7 +341,7 @@
if (SystemDictionary::Object_klass_loaded()) {
ClassLoaderData* loader_data = pool_holder()->class_loader_data();
#if INCLUDE_CDS_JAVA_HEAP
- if (MetaspaceShared::open_archive_heap_region_mapped() &&
+ if (HeapShared::open_archive_heap_region_mapped() &&
_cache->archived_references() != NULL) {
oop archived = _cache->archived_references();
// Create handle for the archived resolved reference array object
@@ -373,7 +374,7 @@
// If archiving heap objects is not allowed, clear the resolved references.
// Otherwise, it is cleared after the resolved references array is cached
// (see archive_resolved_references()).
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
set_resolved_references(NULL);
}
@@ -471,7 +472,7 @@
// or any internal exception fields such as cause or stacktrace. But since the
// detail message is often a class name or other literal string, we will repeat it
// if we can find it in the symbol table.
- throw_resolution_error(this_cp, which, CHECK_0);
+ throw_resolution_error(this_cp, which, CHECK_NULL);
ShouldNotReachHere();
}
--- a/src/hotspot/share/oops/cpCache.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/cpCache.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -30,6 +30,7 @@
#include "interpreter/linkResolver.hpp"
#include "interpreter/rewriter.hpp"
#include "logging/log.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -777,7 +778,7 @@
if (CompressedOops::is_null(_archived_references)) {
return NULL;
}
- return MetaspaceShared::materialize_archived_object(_archived_references);
+ return HeapShared::materialize_archived_object(_archived_references);
}
void ConstantPoolCache::set_archived_references(oop o) {
--- a/src/hotspot/share/oops/instanceClassLoaderKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceClassLoaderKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -33,7 +33,7 @@
// An InstanceClassLoaderKlass is a specialization of the InstanceKlass. It does
// not add any field. It is added to walk the dependencies for the class loader
// key that this class loader points to. This is how the loader_data graph is
-// walked and dependant class loaders are kept alive. I thought we walked
+// walked and dependent class loaders are kept alive. I thought we walked
// the list later?
class InstanceClassLoaderKlass: public InstanceKlass {
@@ -48,21 +48,10 @@
public:
InstanceClassLoaderKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
// Oop fields (and metadata) iterators
//
// The InstanceClassLoaderKlass iterators also visit the CLD pointer (or mirror of anonymous klasses.)
- public:
// Forward iteration
// Iterate over the oop fields and metadata.
template <typename T, class OopClosureType>
--- a/src/hotspot/share/oops/instanceKlass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceKlass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1201,14 +1201,7 @@
}
objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
- if (length < 0) {
- THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
- }
- if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
- report_java_out_of_memory("Requested array size exceeds VM limit");
- JvmtiExport::post_array_size_exhausted();
- THROW_OOP_0(Universe::out_of_memory_error_array_size());
- }
+ check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_NULL);
int size = objArrayOopDesc::object_size(length);
Klass* ak = array_klass(n, CHECK_NULL);
objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
@@ -2745,48 +2738,6 @@
return;
}
-// tell if two classes have the same enclosing class (at package level)
-bool InstanceKlass::is_same_package_member(const Klass* class2, TRAPS) const {
- if (class2 == this) return true;
- if (!class2->is_instance_klass()) return false;
-
- // must be in same package before we try anything else
- if (!is_same_class_package(class2))
- return false;
-
- // As long as there is an outer_this.getEnclosingClass,
- // shift the search outward.
- const InstanceKlass* outer_this = this;
- for (;;) {
- // As we walk along, look for equalities between outer_this and class2.
- // Eventually, the walks will terminate as outer_this stops
- // at the top-level class around the original class.
- bool ignore_inner_is_member;
- const Klass* next = outer_this->compute_enclosing_class(&ignore_inner_is_member,
- CHECK_false);
- if (next == NULL) break;
- if (next == class2) return true;
- outer_this = InstanceKlass::cast(next);
- }
-
- // Now do the same for class2.
- const InstanceKlass* outer2 = InstanceKlass::cast(class2);
- for (;;) {
- bool ignore_inner_is_member;
- Klass* next = outer2->compute_enclosing_class(&ignore_inner_is_member,
- CHECK_false);
- if (next == NULL) break;
- // Might as well check the new outer against all available values.
- if (next == this) return true;
- if (next == outer_this) return true;
- outer2 = InstanceKlass::cast(next);
- }
-
- // If by this point we have not found an equality between the
- // two classes, we know they are in separate package members.
- return false;
-}
-
bool InstanceKlass::find_inner_classes_attr(int* ooff, int* noff, TRAPS) const {
constantPoolHandle i_cp(THREAD, constants());
for (InnerClassesIterator iter(this); !iter.done(); iter.next()) {
--- a/src/hotspot/share/oops/instanceKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -507,9 +507,6 @@
ClassLoaderData* loader_data,
TRAPS);
public:
- // tell if two classes have the same enclosing class (at package level)
- bool is_same_package_member(const Klass* class2, TRAPS) const;
-
// initialization state
bool is_loaded() const { return _init_state >= loaded; }
bool is_linked() const { return _init_state >= linked; }
@@ -1186,16 +1183,6 @@
const char* signature_name() const;
static Symbol* package_from_name(const Symbol* name, TRAPS);
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
// Oop fields (and metadata) iterators
//
// The InstanceKlass iterators also visits the Object's klass.
--- a/src/hotspot/share/oops/instanceMirrorKlass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceMirrorKlass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,7 +52,7 @@
// Since mirrors can be variable sized because of the static fields, store
// the size in the mirror itself.
- return (instanceOop)Universe::heap()->class_allocate(this, size, CHECK_NULL);
+ return (instanceOop)Universe::heap()->class_allocate(this, size, THREAD);
}
int InstanceMirrorKlass::oop_size(oop obj) const {
--- a/src/hotspot/share/oops/instanceMirrorKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceMirrorKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -89,16 +89,6 @@
// allocation
instanceOop allocate_instance(Klass* k, TRAPS);
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
static void serialize_offsets(class SerializeClosure* f) NOT_CDS_RETURN;
// Oop fields (and metadata) iterators
--- a/src/hotspot/share/oops/instanceRefKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/instanceRefKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -58,16 +58,6 @@
public:
InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
// Oop fields (and metadata) iterators
//
// The InstanceRefKlass iterators also support reference processing.
--- a/src/hotspot/share/oops/klass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/klass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/classLoaderDataGraph.inline.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
@@ -31,6 +32,7 @@
#include "gc/shared/collectedHeap.inline.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -541,7 +543,7 @@
if (this->has_raw_archived_mirror()) {
ResourceMark rm;
log_debug(cds, mirror)("%s has raw archived mirror", external_name());
- if (MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (HeapShared::open_archive_heap_region_mapped()) {
bool present = java_lang_Class::restore_archived_mirror(this, loader, module_handle,
protection_domain,
CHECK);
@@ -610,6 +612,20 @@
return NULL;
}
+void Klass::check_array_allocation_length(int length, int max_length, TRAPS) {
+ if (length > max_length) {
+ if (!THREAD->in_retryable_allocation()) {
+ report_java_out_of_memory("Requested array size exceeds VM limit");
+ JvmtiExport::post_array_size_exhausted();
+ THROW_OOP(Universe::out_of_memory_error_array_size());
+ } else {
+ THROW_OOP(Universe::out_of_memory_error_retry());
+ }
+ } else if (length < 0) {
+ THROW_MSG(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
+ }
+}
+
oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
// In product mode, this function doesn't have virtual function calls so
@@ -740,6 +756,22 @@
guarantee(obj->klass()->is_klass(), "klass field is not a klass");
}
+Klass* Klass::decode_klass_raw(narrowKlass narrow_klass) {
+ return (Klass*)(void*)( (uintptr_t)Universe::narrow_klass_base() +
+ ((uintptr_t)narrow_klass << Universe::narrow_klass_shift()));
+}
+
+bool Klass::is_valid(Klass* k) {
+ if (!is_aligned(k, sizeof(MetaWord))) return false;
+ if ((size_t)k < os::min_page_size()) return false;
+
+ if (!os::is_readable_range(k, k + 1)) return false;
+ if (!MetaspaceUtils::is_range_in_committed(k, k + 1)) return false;
+
+ if (!Symbol::is_valid(k->name())) return false;
+ return ClassLoaderDataGraph::is_valid(k->class_loader_data());
+}
+
klassVtable Klass::vtable() const {
return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size());
}
--- a/src/hotspot/share/oops/klass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/klass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -514,6 +514,9 @@
virtual Klass* array_klass_impl(bool or_null, int rank, TRAPS);
virtual Klass* array_klass_impl(bool or_null, TRAPS);
+ // Error handling when length > max_length or length < 0
+ static void check_array_allocation_length(int length, int max_length, TRAPS);
+
void set_vtable_length(int len) { _vtable_len= len; }
vtableEntry* start_of_vtable() const;
@@ -670,16 +673,6 @@
clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
}
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- virtual void oop_ps_push_contents( oop obj, PSPromotionManager* pm) = 0;
- // Parallel Compact
- virtual void oop_pc_follow_contents(oop obj, ParCompactionManager* cm) = 0;
- virtual void oop_pc_update_pointers(oop obj, ParCompactionManager* cm) = 0;
-#endif
-
virtual void array_klasses_do(void f(Klass* k)) {}
// Return self, except for abstract classes with exactly 1
@@ -715,6 +708,10 @@
virtual void oop_verify_on(oop obj, outputStream* st);
+ // for error reporting
+ static Klass* decode_klass_raw(narrowKlass narrow_klass);
+ static bool is_valid(Klass* k);
+
static bool is_null(narrowKlass obj);
static bool is_null(Klass* obj);
--- a/src/hotspot/share/oops/objArrayKlass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/objArrayKlass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -170,19 +170,10 @@
}
objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
- if (length >= 0) {
- if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
- int size = objArrayOopDesc::object_size(length);
- return (objArrayOop)Universe::heap()->array_allocate(this, size, length,
- /* do_zero */ true, THREAD);
- } else {
- report_java_out_of_memory("Requested array size exceeds VM limit");
- JvmtiExport::post_array_size_exhausted();
- THROW_OOP_0(Universe::out_of_memory_error_array_size());
- }
- } else {
- THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
- }
+ check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_0);
+ int size = objArrayOopDesc::object_size(length);
+ return (objArrayOop)Universe::heap()->array_allocate(this, size, length,
+ /* do_zero */ true, THREAD);
}
static int multi_alloc_counter = 0;
--- a/src/hotspot/share/oops/objArrayKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/objArrayKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -120,16 +120,6 @@
// Initialization (virtual from Klass)
void initialize(TRAPS);
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
// Oop fields (and metadata) iterators
//
// The ObjArrayKlass iterators also visits the Object's klass.
--- a/src/hotspot/share/oops/oop.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/oop.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/javaClasses.inline.hpp"
-#include "memory/metaspaceShared.inline.hpp"
+#include "memory/heapShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.inline.hpp"
@@ -144,8 +144,8 @@
}
#if INCLUDE_CDS_JAVA_HEAP
-bool oopDesc::is_archive_object(oop p) {
- return MetaspaceShared::is_archive_object(p);
+bool oopDesc::is_archived_object(oop p) {
+ return HeapShared::is_archived_object(p);
}
#endif
#endif // PRODUCT
@@ -171,6 +171,63 @@
return UseCompressedClassPointers;
}
+oop oopDesc::decode_oop_raw(narrowOop narrow_oop) {
+ return (oop)(void*)( (uintptr_t)Universe::narrow_oop_base() +
+ ((uintptr_t)narrow_oop << Universe::narrow_oop_shift()));
+}
+
+void* oopDesc::load_klass_raw(oop obj) {
+ if (UseCompressedClassPointers) {
+ narrowKlass narrow_klass = *(obj->compressed_klass_addr());
+ if (narrow_klass == 0) return NULL;
+ return (void*)Klass::decode_klass_raw(narrow_klass);
+ } else {
+ return *(void**)(obj->klass_addr());
+ }
+}
+
+void* oopDesc::load_oop_raw(oop obj, int offset) {
+ uintptr_t addr = (uintptr_t)(void*)obj + (uint)offset;
+ if (UseCompressedOops) {
+ narrowOop narrow_oop = *(narrowOop*)addr;
+ if (narrow_oop == 0) return NULL;
+ return (void*)decode_oop_raw(narrow_oop);
+ } else {
+ return *(void**)addr;
+ }
+}
+
+bool oopDesc::is_valid(oop obj) {
+ if (!is_object_aligned(obj)) return false;
+ if ((size_t)(oopDesc*)obj < os::min_page_size()) return false;
+
+ // We need at least the mark and the klass word in the committed region.
+ if (!os::is_readable_range(obj, (oopDesc*)obj + 1)) return false;
+ if (!Universe::heap()->is_in(obj)) return false;
+
+ Klass* k = (Klass*)load_klass_raw(obj);
+
+ if (!os::is_readable_range(k, k + 1)) return false;
+ return MetaspaceUtils::is_range_in_committed(k, k + 1);
+}
+
+oop oopDesc::oop_or_null(address addr) {
+ if (is_valid(oop(addr))) {
+ // We were just given an oop directly.
+ return oop(addr);
+ }
+
+ // Try to find addr using block_start.
+ HeapWord* p = Universe::heap()->block_start(addr);
+ if (p != NULL && Universe::heap()->block_is_obj(p)) {
+ if (!is_valid(oop(p))) return NULL;
+ return oop(p);
+ }
+
+ // If we can't find it it just may mean that heap wasn't parsable.
+ return NULL;
+}
+
oop oopDesc::obj_field_acquire(int offset) const { return HeapAccess<MO_ACQUIRE>::oop_load_at(as_oop(), offset); }
void oopDesc::obj_field_put_raw(int offset, oop value) { RawAccess<>::oop_store_at(as_oop(), offset, value); }
--- a/src/hotspot/share/oops/oop.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/oop.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -46,7 +46,6 @@
class ScanClosure;
class FastScanClosure;
class FilteringClosure;
-class BarrierSet;
class CMSIsAliveClosure;
class PSPromotionManager;
@@ -154,6 +153,8 @@
inline static bool equals(oop o1, oop o2) { return Access<>::equals(o1, o2); }
+ inline static bool equals_raw(oop o1, oop o2) { return RawAccess<>::equals(o1, o2); }
+
// Access to fields in a instanceOop through these methods.
template <DecoratorSet decorator>
oop obj_field_access(int offset) const;
@@ -256,7 +257,7 @@
static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
#ifndef PRODUCT
inline bool is_unlocked_oop() const;
- static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+ static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
#endif
// garbage collection
@@ -284,16 +285,6 @@
// mark-sweep support
void follow_body(int begin, int end);
- // Garbage Collection support
-
-#if INCLUDE_PARALLELGC
- // Parallel Compact
- inline void pc_follow_contents(ParCompactionManager* cm);
- inline void pc_update_contents(ParCompactionManager* cm);
- // Parallel Scavenge
- inline void ps_push_contents(PSPromotionManager* pm);
-#endif
-
template <typename OopClosureType>
inline void oop_iterate(OopClosureType* cl);
@@ -334,6 +325,13 @@
assert(has_klass_gap(), "only applicable to compressed klass pointers");
return klass_offset_in_bytes() + sizeof(narrowKlass);
}
+
+ // for error reporting
+ static oop decode_oop_raw(narrowOop narrow_oop);
+ static void* load_klass_raw(oop obj);
+ static void* load_oop_raw(oop obj, int offset);
+ static bool is_valid(oop obj);
+ static oop oop_or_null(address addr);
};
#endif // SHARE_VM_OOPS_OOP_HPP
--- a/src/hotspot/share/oops/oop.inline.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/oop.inline.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -351,8 +351,8 @@
"forwarding to something not aligned");
assert(Universe::heap()->is_in_reserved(p),
"forwarding to something not in heap");
- assert(!is_archive_object(oop(this)) &&
- !is_archive_object(p),
+ assert(!is_archived_object(oop(this)) &&
+ !is_archived_object(p),
"forwarding archive object");
markOop m = markOopDesc::encode_pointer_as_mark(p);
assert(m->decode_pointer() == p, "encoding must be reversable");
@@ -426,30 +426,6 @@
}
}
-#if INCLUDE_PARALLELGC
-void oopDesc::pc_follow_contents(ParCompactionManager* cm) {
- klass()->oop_pc_follow_contents(this, cm);
-}
-
-void oopDesc::pc_update_contents(ParCompactionManager* cm) {
- Klass* k = klass();
- if (!k->is_typeArray_klass()) {
- // It might contain oops beyond the header, so take the virtual call.
- k->oop_pc_update_pointers(this, cm);
- }
- // Else skip it. The TypeArrayKlass in the header never needs scavenging.
-}
-
-void oopDesc::ps_push_contents(PSPromotionManager* pm) {
- Klass* k = klass();
- if (!k->is_typeArray_klass()) {
- // It might contain oops beyond the header, so take the virtual call.
- k->oop_ps_push_contents(this, pm);
- }
- // Else skip it. The TypeArrayKlass in the header never needs scavenging.
-}
-#endif // INCLUDE_PARALLELGC
-
template <typename OopClosureType>
void oopDesc::oop_iterate(OopClosureType* cl) {
OopIteratorClosureDispatch::oop_oop_iterate(cl, this, klass());
--- a/src/hotspot/share/oops/oopsHierarchy.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/oopsHierarchy.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "gc/shared/barrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "oops/oopsHierarchy.hpp"
@@ -53,4 +54,15 @@
t->unhandled_oops()->unregister_unhandled_oop(this);
}
}
+
+bool oop::operator==(const oop o) const {
+ assert(BarrierSet::barrier_set()->oop_equals_operator_allowed(), "Not allowed");
+ return obj() == o.obj();
+}
+
+bool oop::operator!=(const volatile oop o) const {
+ assert(BarrierSet::barrier_set()->oop_equals_operator_allowed(), "Not allowed");
+ return obj() != o.obj();
+}
+
#endif // CHECK_UNHANDLED_OOPS
--- a/src/hotspot/share/oops/oopsHierarchy.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/oopsHierarchy.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -101,9 +101,9 @@
// General access
oopDesc* operator->() const { return obj(); }
- bool operator==(const oop o) const { return obj() == o.obj(); }
+ bool operator==(const oop o) const;
bool operator==(void *p) const { return obj() == p; }
- bool operator!=(const volatile oop o) const { return obj() != o.obj(); }
+ bool operator!=(const volatile oop o) const;
bool operator!=(void *p) const { return obj() != p; }
// Assignment
--- a/src/hotspot/share/oops/symbol.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/symbol.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -26,6 +26,7 @@
#include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/classLoaderData.hpp"
+#include "gc/shared/collectedHeap.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"
@@ -317,5 +318,21 @@
}
}
+bool Symbol::is_valid(Symbol* s) {
+ if (!is_aligned(s, sizeof(MetaWord))) return false;
+ if ((size_t)s < os::min_page_size()) return false;
+
+ if (!os::is_readable_range(s, s + 1)) return false;
+
+ // Symbols are not allocated in Java heap.
+ if (Universe::heap()->is_in_reserved(s)) return false;
+
+ int len = s->utf8_length();
+ if (len < 0) return false;
+
+ jbyte* bytes = (jbyte*) s->bytes();
+ return os::is_readable_range(bytes, bytes + len);
+}
+
// SymbolTable prints this in its statistics
NOT_PRODUCT(size_t Symbol::_total_count = 0;)
--- a/src/hotspot/share/oops/symbol.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/symbol.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -255,6 +255,8 @@
void print() { print_on(tty); }
void print_value() { print_value_on(tty); }
+ static bool is_valid(Symbol* s);
+
#ifndef PRODUCT
// Empty constructor to create a dummy symbol object on stack
// only for getting its vtable pointer.
--- a/src/hotspot/share/oops/typeArrayKlass.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/typeArrayKlass.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -99,19 +99,10 @@
typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
assert(log2_element_size() >= 0, "bad scale");
- if (length >= 0) {
- if (length <= max_length()) {
- size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
- return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
- do_zero, CHECK_NULL);
- } else {
- report_java_out_of_memory("Requested array size exceeds VM limit");
- JvmtiExport::post_array_size_exhausted();
- THROW_OOP_0(Universe::out_of_memory_error_array_size());
- }
- } else {
- THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
- }
+ check_array_allocation_length(length, max_length(), CHECK_NULL);
+ size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
+ return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
+ do_zero, CHECK_NULL);
}
oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
--- a/src/hotspot/share/oops/typeArrayKlass.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/oops/typeArrayKlass.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,16 +74,6 @@
// Copying
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
- // GC specific object visitors
- //
-#if INCLUDE_PARALLELGC
- // Parallel Scavenge
- void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
- // Parallel Compact
- void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
- void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
-#endif
-
// Oop iterators. Since there are no oops in TypeArrayKlasses,
// these functions only return the size of the object.
--- a/src/hotspot/share/opto/compile.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/opto/compile.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -3379,6 +3379,32 @@
n->set_req(MemBarNode::Precedent, top());
}
break;
+ case Op_MemBarAcquire: {
+ if (n->as_MemBar()->trailing_load() && n->req() > MemBarNode::Precedent) {
+ // At parse time, the trailing MemBarAcquire for a volatile load
+ // is created with an edge to the load. After optimizations,
+ // that input may be a chain of Phis. If those phis have no
+ // other use, then the MemBarAcquire keeps them alive and
+ // register allocation can be confused.
+ ResourceMark rm;
+ Unique_Node_List wq;
+ wq.push(n->in(MemBarNode::Precedent));
+ n->set_req(MemBarNode::Precedent, top());
+ while (wq.size() > 0) {
+ Node* m = wq.pop();
+ if (m->outcnt() == 0) {
+ for (uint j = 0; j < m->req(); j++) {
+ Node* in = m->in(j);
+ if (in != NULL) {
+ wq.push(in);
+ }
+ }
+ m->disconnect_inputs(NULL, this);
+ }
+ }
+ }
+ break;
+ }
case Op_RangeCheck: {
RangeCheckNode* rc = n->as_RangeCheck();
Node* iff = new IfNode(rc->in(0), rc->in(1), rc->_prob, rc->_fcnt);
--- a/src/hotspot/share/opto/graphKit.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/opto/graphKit.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1804,12 +1804,13 @@
// A better answer would be to separate out card marks from other memory.
// For now, return the input memory state, so that it can be reused
// after the call, if this call has restricted memory effects.
-Node* GraphKit::set_predefined_input_for_runtime_call(SafePointNode* call) {
+Node* GraphKit::set_predefined_input_for_runtime_call(SafePointNode* call, Node* narrow_mem) {
// Set fixed predefined input arguments
Node* memory = reset_memory();
+ Node* m = narrow_mem == NULL ? memory : narrow_mem;
call->init_req( TypeFunc::Control, control() );
call->init_req( TypeFunc::I_O, top() ); // does no i/o
- call->init_req( TypeFunc::Memory, memory ); // may gc ptrs
+ call->init_req( TypeFunc::Memory, m ); // may gc ptrs
call->init_req( TypeFunc::FramePtr, frameptr() );
call->init_req( TypeFunc::ReturnAdr, top() );
return memory;
@@ -2465,9 +2466,7 @@
} else {
assert(!wide_out, "narrow in => narrow out");
Node* narrow_mem = memory(adr_type);
- prev_mem = reset_memory();
- map()->set_memory(narrow_mem);
- set_predefined_input_for_runtime_call(call);
+ prev_mem = set_predefined_input_for_runtime_call(call, narrow_mem);
}
// Hook each parm in order. Stop looking at the first NULL.
--- a/src/hotspot/share/opto/graphKit.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/opto/graphKit.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -699,7 +699,7 @@
void set_predefined_output_for_runtime_call(Node* call,
Node* keep_mem,
const TypePtr* hook_mem);
- Node* set_predefined_input_for_runtime_call(SafePointNode* call);
+ Node* set_predefined_input_for_runtime_call(SafePointNode* call, Node* narrow_mem = NULL);
// Replace the call with the current state of the kit. Requires
// that the call was generated with separate io_projs so that
--- a/src/hotspot/share/opto/memnode.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/opto/memnode.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -3174,21 +3174,43 @@
}
MemBarNode* MemBarNode::trailing_membar() const {
+ ResourceMark rm;
Node* trailing = (Node*)this;
VectorSet seen(Thread::current()->resource_area());
- while (!trailing->is_MemBar() || !trailing->as_MemBar()->trailing()) {
- if (seen.test_set(trailing->_idx)) {
- // Dying subgraph?
- return NULL;
- }
- for (DUIterator_Fast jmax, j = trailing->fast_outs(jmax); j < jmax; j++) {
- Node* next = trailing->fast_out(j);
- if (next != trailing && next->is_CFG()) {
- trailing = next;
+ Node_Stack multis(0);
+ do {
+ Node* c = trailing;
+ uint i = 0;
+ do {
+ trailing = NULL;
+ for (; i < c->outcnt(); i++) {
+ Node* next = c->raw_out(i);
+ if (next != c && next->is_CFG()) {
+ if (c->is_MultiBranch()) {
+ if (multis.node() == c) {
+ multis.set_index(i+1);
+ } else {
+ multis.push(c, i+1);
+ }
+ }
+ trailing = next;
+ break;
+ }
+ }
+ if (trailing != NULL && !seen.test_set(trailing->_idx)) {
break;
}
- }
- }
+ while (multis.size() > 0) {
+ c = multis.node();
+ i = multis.index();
+ if (i < c->req()) {
+ break;
+ }
+ multis.pop();
+ }
+ } while (multis.size() > 0);
+ } while (!trailing->is_MemBar() || !trailing->as_MemBar()->trailing());
+
MemBarNode* mb = trailing->as_MemBar();
assert((mb->_kind == TrailingStore && _kind == LeadingStore) ||
(mb->_kind == TrailingLoadStore && _kind == LeadingLoadStore), "bad trailing membar");
@@ -3197,14 +3219,30 @@
}
MemBarNode* MemBarNode::leading_membar() const {
+ ResourceMark rm;
VectorSet seen(Thread::current()->resource_area());
+ Node_Stack regions(0);
Node* leading = in(0);
while (leading != NULL && (!leading->is_MemBar() || !leading->as_MemBar()->leading())) {
- if (seen.test_set(leading->_idx)) {
- // Dying subgraph?
- return NULL;
+ while (leading == NULL || leading->is_top() || seen.test_set(leading->_idx)) {
+ leading = NULL;
+ while (regions.size() > 0) {
+ Node* r = regions.node();
+ uint i = regions.index();
+ if (i < r->req()) {
+ leading = r->in(i);
+ regions.set_index(i+1);
+ } else {
+ regions.pop();
+ }
+ }
+ if (leading == NULL) {
+ assert(regions.size() == 0, "all paths should have been tried");
+ return NULL;
+ }
}
if (leading->is_Region()) {
+ regions.push(leading, 2);
leading = leading->in(1);
} else {
leading = leading->in(0);
--- a/src/hotspot/share/opto/parse2.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/opto/parse2.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1346,7 +1346,7 @@
if (prob <= PROB_MIN) prob_str = (prob == PROB_MIN) ? "min" : "never";
char prob_str_buf[30];
if (prob_str == NULL) {
- sprintf(prob_str_buf, "%g", prob);
+ jio_snprintf(prob_str_buf, sizeof(prob_str_buf), "%20.2f", prob);
prob_str = prob_str_buf;
}
C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d' cnt='%f' prob='%s'",
@@ -2854,7 +2854,7 @@
IdealGraphPrinter *printer = C->printer();
if (printer && printer->should_print(1)) {
char buffer[256];
- sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
+ jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
bool old = printer->traverse_outs();
printer->set_traverse_outs(true);
printer->print_method(buffer, 4);
--- a/src/hotspot/share/prims/jvmtiEnv.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -470,7 +470,7 @@
JvmtiEnv::GetObjectSize(jobject object, jlong* size_ptr) {
oop mirror = JNIHandles::resolve_external_guard(object);
NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
- *size_ptr = (jlong)mirror->size() * wordSize;
+ *size_ptr = (jlong)Universe::heap()->obj_size(mirror) * wordSize;
return JVMTI_ERROR_NONE;
} /* end GetObjectSize */
@@ -540,13 +540,6 @@
record_class_file_load_hook_enabled();
}
- if (event_type == JVMTI_EVENT_SAMPLED_OBJECT_ALLOC) {
- if (enabled) {
- ThreadHeapSampler::enable();
- } else {
- ThreadHeapSampler::disable();
- }
- }
JvmtiEventController::set_user_enabled(this, (JavaThread*) NULL, event_type, enabled);
} else {
// We have a specified event_thread.
--- a/src/hotspot/share/prims/whitebox.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/prims/whitebox.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -36,8 +36,9 @@
#include "gc/shared/gcConfig.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "jvmtifiles/jvmtiEnv.hpp"
+#include "memory/heapShared.inline.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/metadataFactory.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
@@ -371,7 +372,7 @@
WB_ENTRY(jlong, WB_GetObjectSize(JNIEnv* env, jobject o, jobject obj))
oop p = JNIHandles::resolve(obj);
- return p->size() * HeapWordSize;
+ return Universe::heap()->obj_size(p) * HeapWordSize;
WB_END
WB_ENTRY(jlong, WB_GetHeapSpaceAlignment(JNIEnv* env, jobject o))
@@ -1749,9 +1750,23 @@
return NULL;
WB_END
+WB_ENTRY(jobject, WB_GetDefaultArchivePath(JNIEnv* env, jobject wb))
+ const char* p = Arguments::get_default_shared_archive_path();
+ ThreadToNativeFromVM ttn(thread);
+ jstring path_string = env->NewStringUTF(p);
+
+ CHECK_JNI_EXCEPTION_(env, NULL);
+
+ return path_string;
+WB_END
+
+WB_ENTRY(jboolean, WB_IsSharingEnabled(JNIEnv* env, jobject wb))
+ return UseSharedSpaces;
+WB_END
+
WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
oop obj_oop = JNIHandles::resolve(obj);
- return MetaspaceShared::is_archive_object(obj_oop);
+ return HeapShared::is_archived_object(obj_oop);
WB_END
WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
@@ -1775,7 +1790,7 @@
WB_END
WB_ENTRY(jboolean, WB_AreOpenArchiveHeapObjectsMapped(JNIEnv* env))
- return MetaspaceShared::open_archive_heap_region_mapped();
+ return HeapShared::open_archive_heap_region_mapped();
WB_END
WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
@@ -1793,7 +1808,7 @@
WB_END
WB_ENTRY(jboolean, WB_IsJavaHeapArchiveSupported(JNIEnv* env))
- return MetaspaceShared::is_heap_object_archiving_allowed();
+ return HeapShared::is_heap_object_archiving_allowed();
WB_END
@@ -2185,6 +2200,9 @@
{CC"getMethodStringOption",
CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
(void*)&WB_GetMethodStringOption},
+ {CC"getDefaultArchivePath", CC"()Ljava/lang/String;",
+ (void*)&WB_GetDefaultArchivePath},
+ {CC"isSharingEnabled", CC"()Z", (void*)&WB_IsSharingEnabled},
{CC"isShared", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
{CC"isSharedClass", CC"(Ljava/lang/Class;)Z", (void*)&WB_IsSharedClass },
{CC"areSharedStringsIgnored", CC"()Z", (void*)&WB_AreSharedStringsIgnored },
--- a/src/hotspot/share/runtime/arguments.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/arguments.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -3450,21 +3450,27 @@
// Sharing support
// Construct the path to the archive
+char* Arguments::get_default_shared_archive_path() {
+ char *default_archive_path;
+ char jvm_path[JVM_MAXPATHLEN];
+ os::jvm_path(jvm_path, sizeof(jvm_path));
+ char *end = strrchr(jvm_path, *os::file_separator());
+ if (end != NULL) *end = '\0';
+ size_t jvm_path_len = strlen(jvm_path);
+ size_t file_sep_len = strlen(os::file_separator());
+ const size_t len = jvm_path_len + file_sep_len + 20;
+ default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
+ if (default_archive_path != NULL) {
+ jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
+ jvm_path, os::file_separator());
+ }
+ return default_archive_path;
+}
+
static char* get_shared_archive_path() {
char *shared_archive_path;
if (SharedArchiveFile == NULL) {
- char jvm_path[JVM_MAXPATHLEN];
- os::jvm_path(jvm_path, sizeof(jvm_path));
- char *end = strrchr(jvm_path, *os::file_separator());
- if (end != NULL) *end = '\0';
- size_t jvm_path_len = strlen(jvm_path);
- size_t file_sep_len = strlen(os::file_separator());
- const size_t len = jvm_path_len + file_sep_len + 20;
- shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
- if (shared_archive_path != NULL) {
- jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa",
- jvm_path, os::file_separator());
- }
+ shared_archive_path = Arguments::get_default_shared_archive_path();
} else {
shared_archive_path = os::strdup_check_oom(SharedArchiveFile, mtArguments);
}
--- a/src/hotspot/share/runtime/arguments.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/arguments.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -633,6 +633,7 @@
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
+ static char* get_default_shared_archive_path();
// Operation modi
static Mode mode() { return _mode; }
--- a/src/hotspot/share/runtime/handshake.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/handshake.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -347,6 +347,27 @@
target->is_ext_suspended();
}
+static bool possibly_vmthread_can_process_handshake(JavaThread* target) {
+ // An externally suspended thread cannot be resumed while the
+ // Threads_lock is held so it is safe.
+ // Note that this method is allowed to produce false positives.
+ assert(Threads_lock->owned_by_self(), "Not holding Threads_lock.");
+ if (target->is_ext_suspended()) {
+ return true;
+ }
+ switch (target->thread_state()) {
+ case _thread_in_native:
+ // native threads are safe if they have no java stack or have walkable stack
+ return !target->has_last_Java_frame() || target->frame_anchor()->walkable();
+
+ case _thread_blocked:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
bool HandshakeState::claim_handshake_for_vmthread() {
if (!_semaphore.trywait()) {
return false;
@@ -366,7 +387,7 @@
return;
}
- if (!vmthread_can_process_handshake(target)) {
+ if (!possibly_vmthread_can_process_handshake(target)) {
// JT is observed in an unsafe state, it must notice the handshake itself
return;
}
--- a/src/hotspot/share/runtime/java.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/java.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -575,9 +575,6 @@
}
void vm_perform_shutdown_actions() {
- // Warning: do not call 'exit_globals()' here. All threads are still running.
- // Calling 'exit_globals()' will disable thread-local-storage and cause all
- // kinds of assertions to trigger in debug mode.
if (is_init_completed()) {
Thread* thread = Thread::current_or_null();
if (thread != NULL && thread->is_Java_thread()) {
--- a/src/hotspot/share/runtime/javaCalls.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/javaCalls.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -307,25 +307,26 @@
JavaCalls::call_special(&void_result, klass,
vmSymbols::object_initializer_name(),
constructor_signature, args, CHECK_NH);
+ // Already returned a Null Handle if any exception is pending.
return obj;
}
Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, TRAPS) {
JavaCallArguments args;
- return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+ return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
}
Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, TRAPS) {
JavaCallArguments args;
args.push_oop(arg1);
- return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+ return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
}
Handle JavaCalls::construct_new_instance(InstanceKlass* klass, Symbol* constructor_signature, Handle arg1, Handle arg2, TRAPS) {
JavaCallArguments args;
args.push_oop(arg1);
args.push_oop(arg2);
- return JavaCalls::construct_new_instance(klass, constructor_signature, &args, CHECK_NH);
+ return JavaCalls::construct_new_instance(klass, constructor_signature, &args, THREAD);
}
// -------------------------------------------------
--- a/src/hotspot/share/runtime/mutexLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/mutexLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -133,8 +133,6 @@
Monitor* PeriodicTask_lock = NULL;
Monitor* RedefineClasses_lock = NULL;
-Mutex* ThreadHeapSampler_lock = NULL;
-
#if INCLUDE_JFR
Mutex* JfrStacktrace_lock = NULL;
Monitor* JfrMsg_lock = NULL;
@@ -301,8 +299,6 @@
def(PeriodicTask_lock , PaddedMonitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
def(RedefineClasses_lock , PaddedMonitor, nonleaf+5, true, Monitor::_safepoint_check_always);
- def(ThreadHeapSampler_lock , PaddedMutex, nonleaf, false, Monitor::_safepoint_check_never);
-
if (WhiteBoxAPI) {
def(Compilation_lock , PaddedMonitor, leaf, false, Monitor::_safepoint_check_never);
}
--- a/src/hotspot/share/runtime/mutexLocker.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/mutexLocker.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -132,7 +132,6 @@
extern Monitor* Service_lock; // a lock used for service thread operation
extern Monitor* PeriodicTask_lock; // protects the periodic task structure
extern Monitor* RedefineClasses_lock; // locks classes from parallel redefinition
-extern Mutex* ThreadHeapSampler_lock; // protects the static data for initialization.
#if INCLUDE_JFR
extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table
--- a/src/hotspot/share/runtime/os.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/os.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1010,6 +1010,15 @@
return (SafeFetch32(aligned, cafebabe) != cafebabe) || (SafeFetch32(aligned, deadbeef) != deadbeef);
}
+bool os::is_readable_range(const void* from, const void* to) {
+ for (address p = align_down((address)from, min_page_size()); p < to; p += min_page_size()) {
+ if (!is_readable_pointer(p)) {
+ return false;
+ }
+ }
+ return true;
+}
+
// moved from debug.cpp (used to be find()) but still called from there
// The verbose parameter is only set by the debug code in one case
@@ -1020,99 +1029,48 @@
st->print_cr("0x0 is NULL");
return;
}
+
+ // Check if addr points into a code blob.
CodeBlob* b = CodeCache::find_blob_unsafe(addr);
if (b != NULL) {
- if (b->is_buffer_blob()) {
- // the interpreter is generated into a buffer blob
- InterpreterCodelet* i = Interpreter::codelet_containing(addr);
- if (i != NULL) {
- st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin()));
- i->print_on(st);
- return;
- }
- if (Interpreter::contains(addr)) {
- st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
- " (not bytecode specific)", p2i(addr));
- return;
- }
- //
- if (AdapterHandlerLibrary::contains(b)) {
- st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - b->code_begin()));
- AdapterHandlerLibrary::print_handler_on(st, b);
- }
- // the stubroutines are generated into a buffer blob
- StubCodeDesc* d = StubCodeDesc::desc_for(addr);
- if (d != NULL) {
- st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin()));
- d->print_on(st);
- st->cr();
- return;
- }
- if (StubRoutines::contains(addr)) {
- st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr));
- return;
- }
- // the InlineCacheBuffer is using stubs generated into a buffer blob
- if (InlineCacheBuffer::contains(addr)) {
- st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr));
- return;
- }
- VtableStub* v = VtableStubs::stub_containing(addr);
- if (v != NULL) {
- st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point()));
- v->print_on(st);
- st->cr();
- return;
- }
- }
- nmethod* nm = b->as_nmethod_or_null();
- if (nm != NULL) {
- ResourceMark rm;
- st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
- p2i(addr), (int)(addr - nm->entry_point()), p2i(nm));
- if (verbose) {
- st->print(" for ");
- nm->method()->print_value_on(st);
- }
- st->cr();
- nm->print_nmethod(verbose);
- return;
- }
- st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - b->code_begin()));
- b->print_on(st);
+ b->dump_for_addr(addr, st, verbose);
return;
}
+ // Check if addr points into Java heap.
if (Universe::heap()->is_in(addr)) {
- HeapWord* p = Universe::heap()->block_start(addr);
- bool print = false;
- // If we couldn't find it it just may mean that heap wasn't parsable
- // See if we were just given an oop directly
- if (p != NULL && Universe::heap()->block_is_obj(p)) {
- print = true;
- } else if (p == NULL && oopDesc::is_oop(oop(addr))) {
- p = (HeapWord*) addr;
- print = true;
- }
- if (print) {
- if (p == (HeapWord*) addr) {
- st->print_cr(INTPTR_FORMAT " is an oop", p2i(addr));
+ oop o = oopDesc::oop_or_null(addr);
+ if (o != NULL) {
+ if ((HeapWord*)o == (HeapWord*)addr) {
+ st->print(INTPTR_FORMAT " is an oop: ", p2i(addr));
} else {
- st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, p2i(addr), p2i(p));
+ st->print(INTPTR_FORMAT " is pointing into object: " , p2i(addr));
}
- oop(p)->print_on(st);
+ o->print_on(st);
return;
}
- } else {
- if (Universe::heap()->is_in_reserved(addr)) {
- st->print_cr(INTPTR_FORMAT " is an unallocated location "
- "in the heap", p2i(addr));
+ } else if (Universe::heap()->is_in_reserved(addr)) {
+ st->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", p2i(addr));
+ return;
+ }
+
+ // Compressed oop needs to be decoded first.
+#ifdef _LP64
+ if (UseCompressedOops && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) {
+ narrowOop narrow_oop = (narrowOop)(uintptr_t)addr;
+ oop o = oopDesc::decode_oop_raw(narrow_oop);
+
+ if (oopDesc::is_valid(o)) {
+ st->print(UINT32_FORMAT " is a compressed pointer to object: ", narrow_oop);
+ o->print_on(st);
return;
}
}
+#endif
bool accessible = is_readable_pointer(addr);
+ // Check if addr is a JNI handle.
if (align_down((intptr_t)addr, sizeof(intptr_t)) != 0 && accessible) {
if (JNIHandles::is_global_handle((jobject) addr)) {
st->print_cr(INTPTR_FORMAT " is a global jni handle", p2i(addr));
@@ -1131,6 +1089,7 @@
#endif
}
+ // Check if addr belongs to a Java thread.
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
// Check for privilege stack
if (thread->privileged_stack_top() != NULL &&
@@ -1159,9 +1118,12 @@
}
}
- // Check if in metaspace and print types that have vptrs (only method now)
+ // Check if in metaspace and print types that have vptrs
if (Metaspace::contains(addr)) {
- if (Method::has_method_vptr((const void*)addr)) {
+ if (Klass::is_valid((Klass*)addr)) {
+ st->print_cr(INTPTR_FORMAT " is a pointer to class: ", p2i(addr));
+ ((Klass*)addr)->print_on(st);
+ } else if (Method::is_valid_method((const Method*)addr)) {
((Method*)addr)->print_value_on(st);
st->cr();
} else {
@@ -1171,13 +1133,31 @@
return;
}
+ // Compressed klass needs to be decoded first.
+#ifdef _LP64
+ if (UseCompressedClassPointers && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) {
+ narrowKlass narrow_klass = (narrowKlass)(uintptr_t)addr;
+ Klass* k = Klass::decode_klass_raw(narrow_klass);
+
+ if (Klass::is_valid(k)) {
+ st->print_cr(UINT32_FORMAT " is a compressed pointer to class: " INTPTR_FORMAT, narrow_klass, p2i((HeapWord*)k));
+ k->print_on(st);
+ return;
+ }
+ }
+#endif
+
// Try an OS specific find
if (os::find(addr, st)) {
return;
}
if (accessible) {
- st->print_cr(INTPTR_FORMAT " points into unknown readable memory", p2i(addr));
+ st->print(INTPTR_FORMAT " points into unknown readable memory:", p2i(addr));
+ for (address p = addr; p < align_up(addr + 1, sizeof(intptr_t)); ++p) {
+ st->print(" %02x", *(u1*)p);
+ }
+ st->cr();
return;
}
--- a/src/hotspot/share/runtime/os.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/os.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -303,6 +303,9 @@
return _page_sizes[0];
}
+ // Return a lower bound for page sizes. Also works before os::init completed.
+ static size_t min_page_size() { return 4 * K; }
+
// Methods for tracing page sizes returned by the above method.
// The region_{min,max}_size parameters should be the values
// passed to page_size_for_region() and page_size should be the result of that
@@ -415,6 +418,7 @@
// Check if pointer points to readable memory (by 4-byte read access)
static bool is_readable_pointer(const void* p);
+ static bool is_readable_range(const void* from, const void* to);
// Routines used to serialize the thread state without using membars
static void serialize_thread_states();
@@ -539,7 +543,7 @@
static char* do_you_want_to_debug(const char* message);
// run cmd in a separate process and return its exit code; or -1 on failures
- static int fork_and_exec(char *cmd);
+ static int fork_and_exec(char *cmd, bool use_vfork_if_available = false);
// Call ::exit() on all platforms but Windows
static void exit(int num);
--- a/src/hotspot/share/runtime/reflection.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/reflection.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -750,10 +750,12 @@
InnerClassesIterator iter(outer);
constantPoolHandle cp (THREAD, outer->constants());
for (; !iter.done(); iter.next()) {
- int ioff = iter.inner_class_info_index();
- int ooff = iter.outer_class_info_index();
+ int ioff = iter.inner_class_info_index();
+ int ooff = iter.outer_class_info_index();
- if (inner_is_member && ioff != 0 && ooff != 0) {
+ if (inner_is_member && ioff != 0 && ooff != 0) {
+ if (cp->klass_name_at_matches(outer, ooff) &&
+ cp->klass_name_at_matches(inner, ioff)) {
Klass* o = cp->klass_at(ooff, CHECK);
if (o == outer) {
Klass* i = cp->klass_at(ioff, CHECK);
@@ -761,14 +763,16 @@
return;
}
}
- }
- if (!inner_is_member && ioff != 0 && ooff == 0 &&
- cp->klass_name_at_matches(inner, ioff)) {
- Klass* i = cp->klass_at(ioff, CHECK);
- if (i == inner) {
- return;
- }
- }
+ }
+ }
+
+ if (!inner_is_member && ioff != 0 && ooff == 0 &&
+ cp->klass_name_at_matches(inner, ioff)) {
+ Klass* i = cp->klass_at(ioff, CHECK);
+ if (i == inner) {
+ return;
+ }
+ }
}
// 'inner' not declared as an inner klass in outer
--- a/src/hotspot/share/runtime/thread.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/thread.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1547,6 +1547,7 @@
_pending_failed_speculation = 0;
_pending_transfer_to_interpreter = false;
_adjusting_comp_level = false;
+ _in_retryable_allocation = false;
_jvmci._alternate_call_target = NULL;
assert(_jvmci._implicit_exception_pc == NULL, "must be");
if (JVMCICounterSize > 0) {
@@ -4211,10 +4212,10 @@
// <-- do not use anything that could get blocked by Safepoint -->
// + Disable tracing at JNI/JVM barriers
// + Set _vm_exited flag for threads that are still running native code
-// + Delete this thread
// + Call exit_globals()
// > deletes tty
// > deletes PerfMemory resources
+// + Delete this thread
// + Return to caller
bool Threads::destroy_vm() {
@@ -4290,6 +4291,9 @@
notify_vm_shutdown();
+ // exit_globals() will delete tty
+ exit_globals();
+
// We are after VM_Exit::set_vm_exited() so we can't call
// thread->smr_delete() or we will block on the Threads_lock.
// Deleting the shutdown thread here is safe because another
@@ -4303,9 +4307,6 @@
}
#endif
- // exit_globals() will delete tty
- exit_globals();
-
LogConfiguration::finalize();
return true;
--- a/src/hotspot/share/runtime/thread.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/thread.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -281,6 +281,14 @@
void leave_signal_handler() { _num_nested_signal--; }
bool is_inside_signal_handler() const { return _num_nested_signal > 0; }
+ // Determines if a heap allocation failure will be retried
+ // (e.g., by deoptimizing and re-executing in the interpreter).
+ // In this case, the failed allocation must raise
+ // Universe::out_of_memory_error_retry() and omit side effects
+ // such as JVMTI events and handling -XX:+HeapDumpOnOutOfMemoryError
+ // and -XX:OnOutOfMemoryError.
+ virtual bool in_retryable_allocation() const { return false; }
+
#ifdef ASSERT
void set_suspendible_thread() {
_suspendible_thread = true;
@@ -1048,6 +1056,10 @@
// Guard for re-entrant call to JVMCIRuntime::adjust_comp_level
bool _adjusting_comp_level;
+ // True if in a runtime call from compiled code that will deoptimize
+ // and re-execute a failed heap allocation in the interpreter.
+ bool _in_retryable_allocation;
+
// An id of a speculation that JVMCI compiled code can use to further describe and
// uniquely identify the speculative optimization guarded by the uncommon trap
long _pending_failed_speculation;
@@ -1458,7 +1470,7 @@
#if INCLUDE_JVMCI
int pending_deoptimization() const { return _pending_deoptimization; }
- long pending_failed_speculation() const { return _pending_failed_speculation; }
+ long pending_failed_speculation() const { return _pending_failed_speculation; }
bool adjusting_comp_level() const { return _adjusting_comp_level; }
void set_adjusting_comp_level(bool b) { _adjusting_comp_level = b; }
bool has_pending_monitorenter() const { return _pending_monitorenter; }
@@ -1468,6 +1480,9 @@
void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; }
void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; }
void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; }
+
+ virtual bool in_retryable_allocation() const { return _in_retryable_allocation; }
+ void set_in_retryable_allocation(bool b) { _in_retryable_allocation = b; }
#endif // INCLUDE_JVMCI
// Exception handling for compiled methods
--- a/src/hotspot/share/runtime/threadHeapSampler.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/threadHeapSampler.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -29,22 +29,29 @@
#include "runtime/sharedRuntime.hpp"
#include "runtime/threadHeapSampler.hpp"
-// Cheap random number generator
+// Cheap random number generator.
uint64_t ThreadHeapSampler::_rnd;
// Default is 512kb.
-int ThreadHeapSampler::_sampling_interval = 512 * 1024;
-int ThreadHeapSampler::_enabled;
+volatile int ThreadHeapSampler::_sampling_interval = 512 * 1024;
+
+// Ordering here is important: _log_table first, _log_table_initialized second.
+double ThreadHeapSampler::_log_table[1 << ThreadHeapSampler::FastLogNumBits] = {};
+
+// Force initialization of the log_table.
+bool ThreadHeapSampler::_log_table_initialized = init_log_table();
-// Statics for the fast log
-static const int FastLogNumBits = 10;
-static const int FastLogMask = (1 << FastLogNumBits) - 1;
-static double log_table[1<<FastLogNumBits]; // Constant
-static bool log_table_initialized;
+bool ThreadHeapSampler::init_log_table() {
+ for (int i = 0; i < (1 << FastLogNumBits); i++) {
+ _log_table[i] = (log(1.0 + static_cast<double>(i+0.5) / (1 << FastLogNumBits))
+ / log(2.0));
+ }
+ return true;
+}
// Returns the next prng value.
// pRNG is: aX+b mod c with a = 0x5DEECE66D, b = 0xB, c = 1<<48
// This is the lrand64 generator.
-static uint64_t next_random(uint64_t rnd) {
+uint64_t ThreadHeapSampler::next_random(uint64_t rnd) {
const uint64_t PrngMult = 0x5DEECE66DLL;
const uint64_t PrngAdd = 0xB;
const uint64_t PrngModPower = 48;
@@ -54,7 +61,7 @@
return (PrngMult * rnd + PrngAdd) & PrngModMask;
}
-static double fast_log2(const double & d) {
+double ThreadHeapSampler::fast_log2(const double& d) {
assert(d>0, "bad value passed to assert");
uint64_t x = 0;
assert(sizeof(d) == sizeof(x),
@@ -64,7 +71,9 @@
assert(FastLogNumBits <= 20, "FastLogNumBits should be less than 20.");
const uint32_t y = x_high >> (20 - FastLogNumBits) & FastLogMask;
const int32_t exponent = ((x_high >> 20) & 0x7FF) - 1023;
- return exponent + log_table[y];
+
+ assert(_log_table_initialized, "log table should be initialized");
+ return exponent + _log_table[y];
}
// Generates a geometric variable with the specified mean (512K by default).
@@ -134,36 +143,6 @@
pick_next_sample(overflow_bytes);
}
-void ThreadHeapSampler::init_log_table() {
- MutexLockerEx mu(ThreadHeapSampler_lock, Mutex::_no_safepoint_check_flag);
-
- if (log_table_initialized) {
- return;
- }
-
- for (int i = 0; i < (1 << FastLogNumBits); i++) {
- log_table[i] = (log(1.0 + static_cast<double>(i+0.5) / (1 << FastLogNumBits))
- / log(2.0));
- }
-
- log_table_initialized = true;
-}
-
-void ThreadHeapSampler::enable() {
- // Done here to be done when things have settled. This adds a mutex lock but
- // presumably, users won't be enabling and disabling all the time.
- init_log_table();
- OrderAccess::release_store(&_enabled, 1);
-}
-
-int ThreadHeapSampler::enabled() {
- return OrderAccess::load_acquire(&_enabled);
-}
-
-void ThreadHeapSampler::disable() {
- OrderAccess::release_store(&_enabled, 0);
-}
-
int ThreadHeapSampler::get_sampling_interval() {
return OrderAccess::load_acquire(&_sampling_interval);
}
@@ -171,20 +150,3 @@
void ThreadHeapSampler::set_sampling_interval(int sampling_interval) {
OrderAccess::release_store(&_sampling_interval, sampling_interval);
}
-
-// Methods used in assertion mode to check if a collector is present or not at
-// the moment of TLAB sampling, ie a slow allocation path.
-bool ThreadHeapSampler::sampling_collector_present() const {
- return _collectors_present > 0;
-}
-
-bool ThreadHeapSampler::remove_sampling_collector() {
- assert(_collectors_present > 0, "Problem with collector counter.");
- _collectors_present--;
- return true;
-}
-
-bool ThreadHeapSampler::add_sampling_collector() {
- _collectors_present++;
- return true;
-}
--- a/src/hotspot/share/runtime/threadHeapSampler.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/threadHeapSampler.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -30,20 +30,24 @@
class ThreadHeapSampler {
private:
+ // Statics for the fast log
+ static const int FastLogNumBits = 10;
+ static const int FastLogMask = (1 << FastLogNumBits) - 1;
+
size_t _bytes_until_sample;
// Cheap random number generator
static uint64_t _rnd;
+ static bool _log_table_initialized;
+
+ static double _log_table[1<<FastLogNumBits]; // Constant
+ static volatile int _sampling_interval;
void pick_next_geometric_sample();
void pick_next_sample(size_t overflowed_bytes = 0);
- static int _enabled;
- static int _sampling_interval;
- // Used for assertion mode to determine if there is a path to a TLAB slow path
- // without a collector present.
- size_t _collectors_present;
-
- static void init_log_table();
+ static double fast_log2(const double& d);
+ static bool init_log_table();
+ uint64_t next_random(uint64_t rnd);
public:
ThreadHeapSampler() : _bytes_until_sample(0) {
@@ -51,8 +55,6 @@
if (_rnd == 0) {
_rnd = 1;
}
-
- _collectors_present = 0;
}
size_t bytes_until_sample() { return _bytes_until_sample; }
@@ -60,16 +62,8 @@
void check_for_sampling(oop obj, size_t size_in_bytes, size_t bytes_allocated_before);
- static int enabled();
- static void enable();
- static void disable();
-
static void set_sampling_interval(int sampling_interval);
static int get_sampling_interval();
-
- bool sampling_collector_present() const;
- bool remove_sampling_collector();
- bool add_sampling_collector();
};
#endif // SHARE_RUNTIME_THREADHEAPSAMPLER_HPP
--- a/src/hotspot/share/runtime/vframe.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/vframe.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -134,7 +134,7 @@
//
// Skip the monitor that the thread is blocked to enter or waiting on
//
- if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
+ if (!found_first_monitor && (oopDesc::equals(obj, pending_obj) || oopDesc::equals(obj, waiting_obj))) {
continue;
}
found_first_monitor = true;
--- a/src/hotspot/share/runtime/vm_version.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/runtime/vm_version.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -218,10 +218,16 @@
#define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
#elif _MSC_VER == 1900
#define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)"
+ #elif _MSC_VER == 1911
+ #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.3 (VS2017)"
#elif _MSC_VER == 1912
#define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)"
#elif _MSC_VER == 1913
#define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)"
+ #elif _MSC_VER == 1914
+ #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.7 (VS2017)"
+ #elif _MSC_VER == 1915
+ #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.8 (VS2017)"
#else
#define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
#endif
--- a/src/hotspot/share/services/management.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/services/management.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -178,7 +178,7 @@
InstanceKlass* Management::load_and_initialize_klass(Symbol* sh, TRAPS) {
Klass* k = SystemDictionary::resolve_or_fail(sh, true, CHECK_NULL);
- return initialize_klass(k, CHECK_NULL);
+ return initialize_klass(k, THREAD);
}
InstanceKlass* Management::load_and_initialize_klass_or_null(Symbol* sh, TRAPS) {
@@ -186,7 +186,7 @@
if (k == NULL) {
return NULL;
}
- return initialize_klass(k, CHECK_NULL);
+ return initialize_klass(k, THREAD);
}
InstanceKlass* Management::initialize_klass(Klass* k, TRAPS) {
--- a/src/hotspot/share/utilities/exceptions.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/utilities/exceptions.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, 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
@@ -211,7 +211,7 @@
//
// CAUTION: make sure that the function call using a CHECK macro is not the only statement of a
// conditional branch w/o enclosing {} braces, since the CHECK macros expand into several state-
-// ments!
+// ments! Also make sure it is not used on a function call that is part of a return statement!
#define PENDING_EXCEPTION (((ThreadShadow*)THREAD)->pending_exception())
#define HAS_PENDING_EXCEPTION (((ThreadShadow*)THREAD)->has_pending_exception())
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -218,8 +218,8 @@
// Checking for finiteness
-inline int g_isfinite(jfloat f) { return finite(f); }
-inline int g_isfinite(jdouble f) { return finite(f); }
+inline int g_isfinite(jfloat f) { return isfinite(f); }
+inline int g_isfinite(jdouble f) { return isfinite(f); }
// Wide characters
--- a/src/hotspot/share/utilities/vmError.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/hotspot/share/utilities/vmError.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -756,6 +756,24 @@
st->cr();
}
+ STEP("inspecting top of stack")
+
+ // decode stack contents if possible
+ if (_verbose && _context && Universe::is_fully_initialized()) {
+ frame fr = os::fetch_frame_from_context(_context);
+ const int slots = 8;
+ const intptr_t *start = fr.sp();
+ const intptr_t *end = start + slots;
+ if (is_aligned(start, sizeof(intptr_t)) && os::is_readable_range(start, end)) {
+ st->print_cr("Stack slot to memory mapping:");
+ for (int i = 0; i < slots; ++i) {
+ st->print("stack at sp + %d slots: ", i);
+ os::print_location(st, *(start + i));
+ }
+ }
+ st->cr();
+ }
+
STEP("printing code blob if possible")
if (_verbose && _context) {
@@ -1565,7 +1583,7 @@
#endif
tty->print_cr("\"%s\"...", cmd);
- if (os::fork_and_exec(cmd) < 0) {
+ if (os::fork_and_exec(cmd, true) < 0) {
tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
os::strerror(errno), os::errno_name(errno), errno);
}
--- a/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java Tue Oct 16 14:26:22 2018 +0530
@@ -253,11 +253,10 @@
return result;
}
-
/**
* Sets the padding mechanism of this cipher.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist
@@ -660,10 +659,7 @@
* (e.g., has not been initialized)
*/
byte[] update(byte[] input, int inputOffset, int inputLen) {
- if (requireReinit) {
- throw new IllegalStateException
- ("Must use either different key or iv for GCM encryption");
- }
+ checkReinit();
byte[] output = null;
try {
@@ -711,10 +707,7 @@
*/
int update(byte[] input, int inputOffset, int inputLen, byte[] output,
int outputOffset) throws ShortBufferException {
- if (requireReinit) {
- throw new IllegalStateException
- ("Must use either different key or iv for GCM encryption");
- }
+ checkReinit();
// figure out how much can be sent to crypto function
int len = Math.addExact(buffered, inputLen);
@@ -849,12 +842,20 @@
*/
byte[] doFinal(byte[] input, int inputOffset, int inputLen)
throws IllegalBlockSizeException, BadPaddingException {
- byte[] output = null;
try {
- output = new byte[getOutputSizeByOperation(inputLen, true)];
- int len = doFinal(input, inputOffset, inputLen, output, 0);
- if (len < output.length) {
- byte[] copy = Arrays.copyOf(output, len);
+ checkReinit();
+ byte[] output = new byte[getOutputSizeByOperation(inputLen, true)];
+ byte[] finalBuf = prepareInputBuffer(input, inputOffset,
+ inputLen, output, 0);
+ int finalOffset = (finalBuf == input) ? inputOffset : 0;
+ int finalBufLen = (finalBuf == input) ? inputLen : finalBuf.length;
+
+ int outLen = fillOutputBuffer(finalBuf, finalOffset, output, 0,
+ finalBufLen, input);
+
+ endDoFinal();
+ if (outLen < output.length) {
+ byte[] copy = Arrays.copyOf(output, outLen);
if (decrypting) {
// Zero out internal (ouput) array
Arrays.fill(output, (byte) 0x00);
@@ -909,26 +910,81 @@
int outputOffset)
throws IllegalBlockSizeException, ShortBufferException,
BadPaddingException {
- if (requireReinit) {
- throw new IllegalStateException
- ("Must use either different key or iv for GCM encryption");
- }
+ checkReinit();
int estOutSize = getOutputSizeByOperation(inputLen, true);
- // check output buffer capacity.
- // if we are decrypting with padding applied, we can perform this
- // check only after we have determined how many padding bytes there
- // are.
- int outputCapacity = output.length - outputOffset;
- int minOutSize = (decrypting? (estOutSize - blockSize):estOutSize);
- if ((output == null) || (outputCapacity < minOutSize)) {
- throw new ShortBufferException("Output buffer must be "
- + "(at least) " + minOutSize + " bytes long");
+ int outputCapacity = checkOutputCapacity(output, outputOffset,
+ estOutSize);
+ int offset = decrypting ? 0 : outputOffset; // 0 for decrypting
+ byte[] finalBuf = prepareInputBuffer(input, inputOffset,
+ inputLen, output, outputOffset);
+ byte[] outWithPadding = null; // for decrypting only
+
+ int finalOffset = (finalBuf == input) ? inputOffset : 0;
+ int finalBufLen = (finalBuf == input) ? inputLen : finalBuf.length;
+
+ if (decrypting) {
+ // if the size of specified output buffer is less than
+ // the length of the cipher text, then the current
+ // content of cipher has to be preserved in order for
+ // users to retry the call with a larger buffer in the
+ // case of ShortBufferException.
+ if (outputCapacity < estOutSize) {
+ cipher.save();
+ }
+ // create temporary output buffer so that only "real"
+ // data bytes are passed to user's output buffer.
+ outWithPadding = new byte[estOutSize];
}
+ byte[] outBuffer = decrypting ? outWithPadding : output;
+ int outLen = fillOutputBuffer(finalBuf, finalOffset, outBuffer,
+ offset, finalBufLen, input);
+
+ if (decrypting) {
+
+ if (outputCapacity < outLen) {
+ // restore so users can retry with a larger buffer
+ cipher.restore();
+ throw new ShortBufferException("Output buffer too short: "
+ + (outputCapacity)
+ + " bytes given, " + outLen
+ + " bytes needed");
+ }
+ // copy the result into user-supplied output buffer
+ System.arraycopy(outWithPadding, 0, output, outputOffset, outLen);
+ // decrypt mode. Zero out output data that's not required
+ Arrays.fill(outWithPadding, (byte) 0x00);
+ }
+ endDoFinal();
+ return outLen;
+ }
+
+ private void endDoFinal() {
+ buffered = 0;
+ diffBlocksize = blockSize;
+ if (cipherMode != ECB_MODE) {
+ cipher.reset();
+ }
+ }
+
+ private int unpad(int outLen, byte[] outWithPadding)
+ throws BadPaddingException {
+ int padStart = padding.unpad(outWithPadding, 0, outLen);
+ if (padStart < 0) {
+ throw new BadPaddingException("Given final block not " +
+ "properly padded. Such issues can arise if a bad key " +
+ "is used during decryption.");
+ }
+ outLen = padStart;
+ return outLen;
+ }
+
+ private byte[] prepareInputBuffer(byte[] input, int inputOffset,
+ int inputLen, byte[] output, int outputOffset)
+ throws IllegalBlockSizeException, ShortBufferException {
// calculate total input length
int len = Math.addExact(buffered, inputLen);
-
// calculate padding length
int totalLen = Math.addExact(len, cipher.getBufferedLength());
int paddingLen = 0;
@@ -958,18 +1014,15 @@
* - there are internally buffered bytes
* - doing encryption and padding is needed
*/
- byte[] finalBuf = input;
- int finalOffset = inputOffset;
- int finalBufLen = inputLen;
if ((buffered != 0) || (!decrypting && padding != null) ||
((input == output)
&& (outputOffset - inputOffset < inputLen)
&& (inputOffset - outputOffset < buffer.length))) {
+ byte[] finalBuf;
if (decrypting || padding == null) {
paddingLen = 0;
}
finalBuf = new byte[Math.addExact(len, paddingLen)];
- finalOffset = 0;
if (buffered != 0) {
System.arraycopy(buffer, 0, finalBuf, 0, buffered);
if (!decrypting) {
@@ -980,56 +1033,31 @@
}
if (inputLen != 0) {
System.arraycopy(input, inputOffset, finalBuf,
- buffered, inputLen);
+ buffered, inputLen);
}
if (paddingLen != 0) {
padding.padWithLen(finalBuf, Math.addExact(buffered, inputLen), paddingLen);
}
- finalBufLen = finalBuf.length;
+ return finalBuf;
}
- int outLen = 0;
- if (decrypting) {
- // if the size of specified output buffer is less than
- // the length of the cipher text, then the current
- // content of cipher has to be preserved in order for
- // users to retry the call with a larger buffer in the
- // case of ShortBufferException.
- if (outputCapacity < estOutSize) {
- cipher.save();
- }
- // create temporary output buffer so that only "real"
- // data bytes are passed to user's output buffer.
- byte[] outWithPadding = new byte[estOutSize];
- outLen = finalNoPadding(finalBuf, finalOffset, outWithPadding,
- 0, finalBufLen);
+ return input;
+ }
- if (padding != null) {
- int padStart = padding.unpad(outWithPadding, 0, outLen);
- if (padStart < 0) {
- throw new BadPaddingException("Given final block not " +
- "properly padded. Such issues can arise if a bad key " +
- "is used during decryption.");
- }
- outLen = padStart;
+ private int fillOutputBuffer(byte[] finalBuf, int finalOffset,
+ byte[] output, int outOfs, int finalBufLen,
+ byte[] input)
+ throws ShortBufferException, BadPaddingException,
+ IllegalBlockSizeException {
+ int len;
+ try {
+ len = finalNoPadding(finalBuf, finalOffset, output,
+ outOfs, finalBufLen);
+ if (decrypting && padding != null) {
+ len = unpad(len, output);
}
-
- if (outputCapacity < outLen) {
- // restore so users can retry with a larger buffer
- cipher.restore();
- throw new ShortBufferException("Output buffer too short: "
- + (outputCapacity)
- + " bytes given, " + outLen
- + " bytes needed");
- }
- // copy the result into user-supplied output buffer
- System.arraycopy(outWithPadding, 0, output, outputOffset, outLen);
- // decrypt mode. Zero out output data that's not required
- Arrays.fill(outWithPadding, (byte) 0x00);
- } else { // encrypting
- try {
- outLen = finalNoPadding(finalBuf, finalOffset, output,
- outputOffset, finalBufLen);
- } finally {
+ return len;
+ } finally {
+ if (!decrypting) {
// reset after doFinal() for GCM encryption
requireReinit = (cipherMode == GCM_MODE);
if (finalBuf != input) {
@@ -1038,13 +1066,28 @@
}
}
}
+ }
- buffered = 0;
- diffBlocksize = blockSize;
- if (cipherMode != ECB_MODE) {
- cipher.reset();
+ private int checkOutputCapacity(byte[] output, int outputOffset,
+ int estOutSize) throws ShortBufferException {
+ // check output buffer capacity.
+ // if we are decrypting with padding applied, we can perform this
+ // check only after we have determined how many padding bytes there
+ // are.
+ int outputCapacity = output.length - outputOffset;
+ int minOutSize = decrypting ? (estOutSize - blockSize) : estOutSize;
+ if ((output == null) || (outputCapacity < minOutSize)) {
+ throw new ShortBufferException("Output buffer must be "
+ + "(at least) " + minOutSize + " bytes long");
}
- return outLen;
+ return outputCapacity;
+ }
+
+ private void checkReinit() {
+ if (requireReinit) {
+ throw new IllegalStateException
+ ("Must use either different key or iv for GCM encryption");
+ }
}
private int finalNoPadding(byte[] in, int inOfs, byte[] out, int outOfs,
@@ -1177,10 +1220,7 @@
* @since 1.8
*/
void updateAAD(byte[] src, int offset, int len) {
- if (requireReinit) {
- throw new IllegalStateException
- ("Must use either different key or iv for GCM encryption");
- }
+ checkReinit();
cipher.updateAAD(src, offset, len);
}
}
--- a/src/java.base/share/classes/java/io/RandomAccessFile.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/io/RandomAccessFile.java Tue Oct 16 14:26:22 2018 +0530
@@ -71,7 +71,9 @@
*/
private final String path;
- private final AtomicBoolean closed = new AtomicBoolean(false);
+ private final Object closeLock = new Object();
+
+ private volatile boolean closed;
private static final int O_RDONLY = 1;
private static final int O_RDWR = 2;
@@ -301,7 +303,7 @@
if (fc == null) {
this.channel = fc = FileChannelImpl.open(fd, path, true,
rw, false, this);
- if (closed.get()) {
+ if (closed) {
try {
fc.close();
} catch (IOException ioe) {
@@ -638,14 +640,21 @@
* @spec JSR-51
*/
public void close() throws IOException {
- if (!closed.compareAndSet(false, true)) {
- // if compareAndSet() returns false closed was already true
+ if (closed) {
return;
}
+ synchronized (closeLock) {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ }
FileChannel fc = channel;
if (fc != null) {
- fc.close();
+ // possible race with getChannel(), benign since
+ // FileChannel.close is final and idempotent
+ fc.close();
}
fd.closeAll(new Closeable() {
--- a/src/java.base/share/classes/java/lang/Character.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/Character.java Tue Oct 16 14:26:22 2018 +0530
@@ -5385,7 +5385,7 @@
0x3260, // 3260..327E; HANGUL
0x327F, // 327F..32CF; COMMON
0x32D0, // 32D0..32FE; KATAKANA
- 0x32FF, // 32FF ; UNKNOWN
+ 0x32FF, // 32FF ; COMMON
0x3300, // 3300..3357; KATAKANA
0x3358, // 3358..33FF; COMMON
0x3400, // 3400..4DB5; HAN
@@ -6902,7 +6902,7 @@
HANGUL, // 3260..327E
COMMON, // 327F..32CF
KATAKANA, // 32D0..32FE
- UNKNOWN, // 32FF
+ COMMON, // 32FF
KATAKANA, // 3300..3357
COMMON, // 3358..33FF
HAN, // 3400..4DB5
--- a/src/java.base/share/classes/java/lang/Class.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/Class.java Tue Oct 16 14:26:22 2018 +0530
@@ -64,7 +64,6 @@
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.misc.Unsafe;
-import jdk.internal.misc.VM;
import jdk.internal.module.Resources;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.ConstantPool;
@@ -540,11 +539,9 @@
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), false);
}
- // NOTE: the following code may not be strictly correct under
- // the current Java memory model.
-
// Constructor lookup
- if (cachedConstructor == null) {
+ Constructor<T> tmpConstructor = cachedConstructor;
+ if (tmpConstructor == null) {
if (this == Class.class) {
throw new IllegalAccessException(
"Can not call newInstance() on the Class for java.lang.Class"
@@ -555,9 +552,7 @@
final Constructor<T> c = getReflectionFactory().copyConstructor(
getConstructor0(empty, Member.DECLARED));
// Disable accessibility checks on the constructor
- // since we have to do the security check here anyway
- // (the stack depth is wrong for the Constructor's
- // security check to work)
+ // access check is done with the true caller
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<>() {
public Void run() {
@@ -565,32 +560,24 @@
return null;
}
});
- cachedConstructor = c;
+ cachedConstructor = tmpConstructor = c;
} catch (NoSuchMethodException e) {
throw (InstantiationException)
new InstantiationException(getName()).initCause(e);
}
}
- Constructor<T> tmpConstructor = cachedConstructor;
- // Security check (same as in java.lang.reflect.Constructor)
- Class<?> caller = Reflection.getCallerClass();
- if (newInstanceCallerCache != caller) {
- int modifiers = tmpConstructor.getModifiers();
- Reflection.ensureMemberAccess(caller, this, this, modifiers);
- newInstanceCallerCache = caller;
- }
- // Run constructor
+
try {
- return tmpConstructor.newInstance((Object[])null);
+ Class<?> caller = Reflection.getCallerClass();
+ return getReflectionFactory().newInstance(tmpConstructor, null, caller);
} catch (InvocationTargetException e) {
Unsafe.getUnsafe().throwException(e.getTargetException());
// Not reached
return null;
}
}
+
private transient volatile Constructor<T> cachedConstructor;
- private transient volatile Class<?> newInstanceCallerCache;
-
/**
* Determines if the specified {@code Object} is assignment-compatible
--- a/src/java.base/share/classes/java/lang/Module.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/Module.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -477,7 +477,7 @@
*
* @see ModuleDescriptor#opens()
* @see #addOpens(String,Module)
- * @see AccessibleObject#setAccessible(boolean)
+ * @see java.lang.reflect.AccessibleObject#setAccessible(boolean)
* @see java.lang.invoke.MethodHandles#privateLookupIn
*/
public boolean isOpen(String pn, Module other) {
@@ -747,7 +747,7 @@
* package to at least the caller's module
*
* @see #isOpen(String,Module)
- * @see AccessibleObject#setAccessible(boolean)
+ * @see java.lang.reflect.AccessibleObject#setAccessible(boolean)
* @see java.lang.invoke.MethodHandles#privateLookupIn
*/
@CallerSensitive
@@ -1061,7 +1061,10 @@
* @return a map of module name to runtime {@code Module}
*
* @throws IllegalArgumentException
- * If defining any of the modules to the VM fails
+ * If the function maps a module to the null or platform class loader
+ * @throws IllegalStateException
+ * If the module cannot be defined to the VM or its packages overlap
+ * with another module mapped to the same class loader
*/
static Map<String, Module> defineModules(Configuration cf,
Function<String, ClassLoader> clf,
--- a/src/java.base/share/classes/java/lang/SecurityManager.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java Tue Oct 16 14:26:22 2018 +0530
@@ -28,7 +28,6 @@
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Exports;
import java.lang.module.ModuleDescriptor.Opens;
-import java.lang.module.ModuleReference;
import java.lang.reflect.Member;
import java.io.FileDescriptor;
import java.io.File;
@@ -47,9 +46,7 @@
import java.util.PropertyPermission;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.reflect.CallerSensitive;
import sun.security.util.SecurityConstants;
@@ -81,10 +78,100 @@
* throws a <code>SecurityException</code> if the operation is not
* permitted.
* <p>
- * The current security manager is set by the
- * <code>setSecurityManager</code> method in class
- * <code>System</code>. The current security manager is obtained
- * by the <code>getSecurityManager</code> method.
+ * Environments using a security manager will typically set the security
+ * manager at startup. In the JDK implementation, this is done by setting
+ * the system property {@code java.security.manager} on the command line to
+ * the class name of the security manager. It can also be set to the empty
+ * String ("") or the special token "{@code default}" to use the
+ * default {@code java.lang.SecurityManager}. If a class name is specified,
+ * it must be {@code java.lang.SecurityManager} or a public subclass and have
+ * a public no-arg constructor. The class is loaded by the
+ * {@linkplain ClassLoader#getSystemClassLoader() built-in system class loader}
+ * if it is not {@code java.lang.SecurityManager}. If the
+ * {@code java.security.manager} system property is not set, the default value
+ * is {@code null}, which means a security manager will not be set at startup.
+ * <p>
+ * The Java run-time may also allow, but is not required to allow, the security
+ * manager to be set dynamically by invoking the
+ * {@link System#setSecurityManager(SecurityManager) setSecurityManager} method.
+ * In the JDK implementation, if the Java virtual machine is started with
+ * the {@code java.security.manager} system property set to the special token
+ * "{@code disallow}" then a security manager will not be set at startup and
+ * cannot be set dynamically (the
+ * {@link System#setSecurityManager(SecurityManager) setSecurityManager}
+ * method will throw an {@code UnsupportedOperationException}). If the
+ * {@code java.security.manager} system property is not set or is set to the
+ * special token "{@code allow}", then a security manager will not be set at
+ * startup but can be set dynamically. Finally, if the
+ * {@code java.security.manager} system property is set to the class name of
+ * the security manager, or to the empty String ("") or the special token
+ * "{@code default}", then a security manager is set at startup (as described
+ * previously) and can also be subsequently replaced (or disabled) dynamically
+ * (subject to the policy of the currently installed security manager). The
+ * following table illustrates the behavior of the JDK implementation for the
+ * different settings of the {@code java.security.manager} system property:
+ * <table class="striped">
+ * <caption style="display:none">property value,
+ * the SecurityManager set at startup,
+ * can dynamically set a SecurityManager
+ * </caption>
+ * <thead>
+ * <tr>
+ * <th scope="col">Property Value</th>
+ * <th scope="col">The SecurityManager set at startup</th>
+ * <th scope="col">System.setSecurityManager run-time behavior</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ *
+ * <tr>
+ * <th scope="row">null</th>
+ * <td>None</td>
+ * <td>Success or throws {@code SecurityException} if not permitted by
+ * the currently installed security manager</td>
+ * </tr>
+ *
+ * <tr>
+ * <th scope="row">empty String ("")</th>
+ * <td>{@code java.lang.SecurityManager}</td>
+ * <td>Success or throws {@code SecurityException} if not permitted by
+ * the currently installed security manager</td>
+ * </tr>
+ *
+ * <tr>
+ * <th scope="row">"default"</th>
+ * <td>{@code java.lang.SecurityManager}</td>
+ * <td>Success or throws {@code SecurityException} if not permitted by
+ * the currently installed security manager</td>
+ * </tr>
+ *
+ * <tr>
+ * <th scope="row">"disallow"</th>
+ * <td>None</td>
+ * <td>Always throws {@code UnsupportedOperationException}</td>
+ * </tr>
+ *
+ * <tr>
+ * <th scope="row">"allow"</th>
+ * <td>None</td>
+ * <td>Success or throws {@code SecurityException} if not permitted by
+ * the currently installed security manager</td>
+ * </tr>
+ *
+ * <tr>
+ * <th scope="row">a class name</th>
+ * <td>the named class</td>
+ * <td>Success or throws {@code SecurityException} if not permitted by
+ * the currently installed security manager</td>
+ * </tr>
+ *
+ * </tbody>
+ * </table>
+ * <p> A future release of the JDK may change the default value of the
+ * {@code java.security.manager} system property to "{@code disallow}".
+ * <p>
+ * The current security manager is returned by the
+ * {@link System#getSecurityManager() getSecurityManager} method.
* <p>
* The special method
* {@link SecurityManager#checkPermission(java.security.Permission)}
@@ -221,7 +308,6 @@
* @see java.net.SocketPermission
* @see java.util.PropertyPermission
* @see java.lang.RuntimePermission
- * @see java.awt.AWTPermission
* @see java.security.Policy Policy
* @see java.security.SecurityPermission SecurityPermission
* @see java.security.ProtectionDomain
--- a/src/java.base/share/classes/java/lang/System.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/System.java Tue Oct 16 14:26:22 2018 +0530
@@ -72,6 +72,7 @@
import jdk.internal.logger.LoggerFinderLoader;
import jdk.internal.logger.LazyLoggers;
import jdk.internal.logger.LocalizedLoggerWrapper;
+import jdk.internal.vm.annotation.Stable;
import sun.reflect.annotation.AnnotationType;
import sun.nio.ch.Interruptible;
import sun.security.util.SecurityConstants;
@@ -154,9 +155,18 @@
*/
public static final PrintStream err = null;
- /* The security manager for the system.
- */
- private static volatile SecurityManager security;
+ // indicates if a security manager is possible
+ private static final int NEVER = 1;
+ private static final int MAYBE = 2;
+ private static @Stable int allowSecurityManager;
+
+ // current security manager
+ private static volatile SecurityManager security; // read by VM
+
+ // return true if a security manager is allowed
+ private static boolean allowSecurityManager() {
+ return (allowSecurityManager != NEVER);
+ }
/**
* Reassigns the "standard" input stream.
@@ -231,6 +241,7 @@
}
private static volatile Console cons;
+
/**
* Returns the unique {@link java.io.Console Console} object associated
* with the current Java virtual machine, if any.
@@ -292,7 +303,7 @@
private static native void setErr0(PrintStream err);
/**
- * Sets the System security.
+ * Sets the system-wide security manager.
*
* If there is a security manager already installed, this method first
* calls the security manager's {@code checkPermission} method
@@ -306,27 +317,46 @@
* security manager has been established, then no action is taken and
* the method simply returns.
*
- * @param s the security manager.
- * @throws SecurityException if the security manager has already
- * been set and its {@code checkPermission} method
- * doesn't allow it to be replaced.
+ * @implNote In the JDK implementation, if the Java virtual machine is
+ * started with the system property {@code java.security.manager} set to
+ * the special token "{@code disallow}" then the {@code setSecurityManager}
+ * method cannot be used to set a security manager.
+ *
+ * @param sm the security manager or {@code null}
+ * @throws SecurityException
+ * if the security manager has already been set and its {@code
+ * checkPermission} method doesn't allow it to be replaced
+ * @throws UnsupportedOperationException
+ * if {@code sm} is non-null and a security manager is not allowed
+ * to be set dynamically
* @see #getSecurityManager
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*/
- public static void setSecurityManager(final SecurityManager s) {
- if (security == null) {
- // ensure image reader is initialized
- Object.class.getResource("java/lang/ANY");
- }
- if (s != null) {
- try {
- s.checkPackageAccess("java.lang");
- } catch (Exception e) {
- // no-op
+ public static void setSecurityManager(SecurityManager sm) {
+ if (allowSecurityManager()) {
+ if (security == null) {
+ // ensure image reader is initialized
+ Object.class.getResource("java/lang/ANY");
+ }
+ if (sm != null) {
+ try {
+ // pre-populates the SecurityManager.packageAccess cache
+ // to avoid recursive permission checking issues with custom
+ // SecurityManager implementations
+ sm.checkPackageAccess("java.lang");
+ } catch (Exception e) {
+ // no-op
+ }
+ }
+ setSecurityManager0(sm);
+ } else {
+ // security manager not allowed
+ if (sm != null) {
+ throw new UnsupportedOperationException(
+ "Runtime configured to disallow security manager");
}
}
- setSecurityManager0(s);
}
private static synchronized
@@ -335,13 +365,12 @@
if (sm != null) {
// ask the currently installed security manager if we
// can replace it.
- sm.checkPermission(new RuntimePermission
- ("setSecurityManager"));
+ sm.checkPermission(new RuntimePermission("setSecurityManager"));
}
if ((s != null) && (s.getClass().getClassLoader() != null)) {
// New security manager class is not on bootstrap classpath.
- // Cause policy to get initialized before we install the new
+ // Force policy to get initialized before we install the new
// security manager, in order to prevent infinite loops when
// trying to initialize the policy (which usually involves
// accessing some security and/or system properties, which in turn
@@ -361,7 +390,7 @@
}
/**
- * Gets the system security interface.
+ * Gets the system-wide security manager.
*
* @return if a security manager has already been established for the
* current application, then that security manager is returned;
@@ -369,7 +398,11 @@
* @see #setSecurityManager
*/
public static SecurityManager getSecurityManager() {
- return security;
+ if (allowSecurityManager()) {
+ return security;
+ } else {
+ return null;
+ }
}
/**
@@ -2028,35 +2061,48 @@
* 3. set TCCL
*
* This method must be called after the module system initialization.
- * The security manager and system class loader may be custom class from
+ * The security manager and system class loader may be a custom class from
* the application classpath or modulepath.
*/
private static void initPhase3() {
- // set security manager
- String cn = System.getProperty("java.security.manager");
- if (cn != null) {
- if (cn.isEmpty() || "default".equals(cn)) {
- System.setSecurityManager(new SecurityManager());
- } else {
- try {
- Class<?> c = Class.forName(cn, false, ClassLoader.getBuiltinAppClassLoader());
- Constructor<?> ctor = c.getConstructor();
- // Must be a public subclass of SecurityManager with
- // a public no-arg constructor
- if (!SecurityManager.class.isAssignableFrom(c) ||
+ String smProp = System.getProperty("java.security.manager");
+ if (smProp != null) {
+ switch (smProp) {
+ case "disallow":
+ allowSecurityManager = NEVER;
+ break;
+ case "allow":
+ allowSecurityManager = MAYBE;
+ break;
+ case "":
+ case "default":
+ setSecurityManager(new SecurityManager());
+ allowSecurityManager = MAYBE;
+ break;
+ default:
+ try {
+ ClassLoader cl = ClassLoader.getBuiltinAppClassLoader();
+ Class<?> c = Class.forName(smProp, false, cl);
+ Constructor<?> ctor = c.getConstructor();
+ // Must be a public subclass of SecurityManager with
+ // a public no-arg constructor
+ if (!SecurityManager.class.isAssignableFrom(c) ||
!Modifier.isPublic(c.getModifiers()) ||
!Modifier.isPublic(ctor.getModifiers())) {
- throw new Error("Could not create SecurityManager: " + ctor.toString());
+ throw new Error("Could not create SecurityManager: "
+ + ctor.toString());
+ }
+ // custom security manager may be in non-exported package
+ ctor.setAccessible(true);
+ SecurityManager sm = (SecurityManager) ctor.newInstance();
+ setSecurityManager(sm);
+ } catch (Exception e) {
+ throw new InternalError("Could not create SecurityManager", e);
}
- // custom security manager implementation may be in unnamed module
- // or a named module but non-exported package
- ctor.setAccessible(true);
- SecurityManager sm = (SecurityManager) ctor.newInstance();
- System.setSecurityManager(sm);
- } catch (Exception e) {
- throw new Error("Could not create SecurityManager", e);
- }
+ allowSecurityManager = MAYBE;
}
+ } else {
+ allowSecurityManager = MAYBE;
}
// initializing the system class loader
--- a/src/java.base/share/classes/java/lang/doc-files/ValueBased.html Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/doc-files/ValueBased.html Tue Oct 16 14:26:22 2018 +0530
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Value-based Classes</title>
- <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
+ <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<h2 id="ValueBased">Value-based Classes</h2>
--- a/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,7 @@
<html lang="en">
<head>
<title>Java Thread Primitive Deprecation</title>
- <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
+ <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<h2>Java Thread Primitive Deprecation</h2>
--- a/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/ClassSpecializer.java Tue Oct 16 14:26:22 2018 +0530
@@ -37,7 +37,6 @@
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -578,23 +577,17 @@
InvokerBytecodeGenerator.maybeDump(classBCName(className), classFile);
Class<?> speciesCode;
- ClassLoader cl = topClass().getClassLoader();
- ProtectionDomain pd = null;
- if (cl != null) {
- pd = AccessController.doPrivileged(
- new PrivilegedAction<>() {
- @Override
- public ProtectionDomain run() {
- return topClass().getProtectionDomain();
- }
- });
- }
- try {
- speciesCode = UNSAFE.defineClass(className, classFile, 0, classFile.length, cl, pd);
- } catch (Exception ex) {
- throw newInternalError(ex);
- }
-
+ MethodHandles.Lookup lookup = IMPL_LOOKUP.in(topClass());
+ speciesCode = AccessController.doPrivileged(new PrivilegedAction<>() {
+ @Override
+ public Class<?> run() {
+ try {
+ return lookup.defineClass(classFile);
+ } catch (Exception ex) {
+ throw newInternalError(ex);
+ }
+ }
+ });
return speciesCode.asSubclass(topClass());
}
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Tue Oct 16 14:26:22 2018 +0530
@@ -969,9 +969,6 @@
ProtectionDomain pd = (loader != null) ? lookupClassProtectionDomain() : null;
String source = "__Lookup_defineClass__";
Class<?> clazz = SharedSecrets.getJavaLangAccess().defineClass(loader, cn, bytes, pd, source);
- assert clazz.getClassLoader() == lookupClass.getClassLoader()
- && clazz.getPackageName().equals(lookupClass.getPackageName())
- && protectionDomain(clazz) == lookupClassProtectionDomain();
return clazz;
}
--- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,6 +27,7 @@
import java.lang.annotation.Annotation;
import java.lang.invoke.MethodHandle;
+import java.lang.ref.WeakReference;
import java.security.AccessController;
import jdk.internal.misc.VM;
@@ -567,21 +568,68 @@
// Shared access checking logic.
// For non-public members or members in package-private classes,
- // it is necessary to perform somewhat expensive security checks.
- // If the security check succeeds for a given class, it will
+ // it is necessary to perform somewhat expensive access checks.
+ // If the access check succeeds for a given class, it will
// always succeed (it is not affected by the granting or revoking
// of permissions); we speed up the check in the common case by
// remembering the last Class for which the check succeeded.
//
- // The simple security check for Constructor is to see if
+ // The simple access check for Constructor is to see if
// the caller has already been seen, verified, and cached.
- // (See also Class.newInstance(), which uses a similar method.)
//
- // A more complicated security check cache is needed for Method and Field
- // The cache can be either null (empty cache), a 2-array of {caller,targetClass},
+ // A more complicated access check cache is needed for Method and Field
+ // The cache can be either null (empty cache), {caller,targetClass} pair,
// or a caller (with targetClass implicitly equal to memberClass).
- // In the 2-array case, the targetClass is always different from the memberClass.
- volatile Object securityCheckCache;
+ // In the {caller,targetClass} case, the targetClass is always different
+ // from the memberClass.
+ volatile Object accessCheckCache;
+
+ private static class Cache {
+ final WeakReference<Class<?>> callerRef;
+ final WeakReference<Class<?>> targetRef;
+
+ Cache(Class<?> caller, Class<?> target) {
+ this.callerRef = new WeakReference<>(caller);
+ this.targetRef = new WeakReference<>(target);
+ }
+
+ boolean isCacheFor(Class<?> caller, Class<?> refc) {
+ return callerRef.get() == caller && targetRef.get() == refc;
+ }
+
+ static Object protectedMemberCallerCache(Class<?> caller, Class<?> refc) {
+ return new Cache(caller, refc);
+ }
+ }
+
+ /*
+ * Returns true if the previous access check was verified for the
+ * given caller accessing a protected member with an instance of
+ * the given targetClass where the target class is different than
+ * the declaring member class.
+ */
+ private boolean isAccessChecked(Class<?> caller, Class<?> targetClass) {
+ Object cache = accessCheckCache; // read volatile
+ if (cache instanceof Cache) {
+ return ((Cache) cache).isCacheFor(caller, targetClass);
+ }
+ return false;
+ }
+
+ /*
+ * Returns true if the previous access check was verified for the
+ * given caller accessing a static member or an instance member of
+ * the target class that is the same as the declaring member class.
+ */
+ private boolean isAccessChecked(Class<?> caller) {
+ Object cache = accessCheckCache; // read volatile
+ if (cache instanceof WeakReference) {
+ @SuppressWarnings("unchecked")
+ WeakReference<Class<?>> ref = (WeakReference<Class<?>>) cache;
+ return ref.get() == caller;
+ }
+ return false;
+ }
final void checkAccess(Class<?> caller, Class<?> memberClass,
Class<?> targetClass, int modifiers)
@@ -603,21 +651,13 @@
if (caller == memberClass) { // quick check
return true; // ACCESS IS OK
}
- Object cache = securityCheckCache; // read volatile
if (targetClass != null // instance member or constructor
&& Modifier.isProtected(modifiers)
&& targetClass != memberClass) {
- // Must match a 2-list of { caller, targetClass }.
- if (cache instanceof Class[]) {
- Class<?>[] cache2 = (Class<?>[]) cache;
- if (cache2[1] == targetClass &&
- cache2[0] == caller) {
- return true; // ACCESS IS OK
- }
- // (Test cache[1] first since range check for [1]
- // subsumes range check for [0].)
+ if (isAccessChecked(caller, targetClass)) {
+ return true; // ACCESS IS OK
}
- } else if (cache == caller) {
+ } else if (isAccessChecked(caller)) {
// Non-protected case (or targetClass == memberClass or static member).
return true; // ACCESS IS OK
}
@@ -642,14 +682,9 @@
Object cache = (targetClass != null
&& Modifier.isProtected(modifiers)
&& targetClass != memberClass)
- ? new Class<?>[] { caller, targetClass }
- : caller;
-
- // Note: The two cache elements are not volatile,
- // but they are effectively final. The Java memory model
- // guarantees that the initializing stores for the cache
- // elements will occur before the volatile write.
- securityCheckCache = cache; // write volatile
+ ? Cache.protectedMemberCallerCache(caller, targetClass)
+ : new WeakReference<>(caller);
+ accessCheckCache = cache; // write volatile
return true;
}
--- a/src/java.base/share/classes/java/lang/reflect/Constructor.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java Tue Oct 16 14:26:22 2018 +0530
@@ -476,18 +476,27 @@
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException
{
- if (!override) {
- Class<?> caller = Reflection.getCallerClass();
+ Class<?> caller = override ? null : Reflection.getCallerClass();
+ return newInstanceWithCaller(initargs, !override, caller);
+ }
+
+ /* package-private */
+ T newInstanceWithCaller(Object[] args, boolean checkAccess, Class<?> caller)
+ throws InstantiationException, IllegalAccessException,
+ InvocationTargetException
+ {
+ if (checkAccess)
checkAccess(caller, clazz, clazz, modifiers);
- }
+
if ((clazz.getModifiers() & Modifier.ENUM) != 0)
throw new IllegalArgumentException("Cannot reflectively create enum objects");
+
ConstructorAccessor ca = constructorAccessor; // read volatile
if (ca == null) {
ca = acquireConstructorAccessor();
}
@SuppressWarnings("unchecked")
- T inst = (T) ca.newInstance(initargs);
+ T inst = (T) ca.newInstance(args);
return inst;
}
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java Tue Oct 16 14:26:22 2018 +0530
@@ -39,12 +39,11 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
import jdk.internal.loader.BootLoader;
+import jdk.internal.misc.JavaLangAccess;
+import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.Modules;
-import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
@@ -468,7 +467,7 @@
* in which the proxy class will be defined.
*/
private static final class ProxyBuilder {
- private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+ private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
// prefix for all proxy class names
private static final String proxyClassNamePrefix = "$Proxy";
@@ -535,9 +534,8 @@
byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
proxyName, interfaces.toArray(EMPTY_CLASS_ARRAY), accessFlags);
try {
- Class<?> pc = UNSAFE.defineClass(proxyName, proxyClassFile,
- 0, proxyClassFile.length,
- loader, null);
+ Class<?> pc = JLA.defineClass(loader, proxyName, proxyClassFile,
+ null, "__dynamic_proxy__");
reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE);
return pc;
} catch (ClassFormatError e) {
--- a/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java Tue Oct 16 14:26:22 2018 +0530
@@ -159,4 +159,10 @@
public <T extends AccessibleObject> T getRoot(T obj) {
return (T) obj.getRoot();
}
+
+ public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
+ throws IllegalAccessException, InstantiationException, InvocationTargetException
+ {
+ return ctor.newInstanceWithCaller(args, true, caller);
+ }
}
--- a/src/java.base/share/classes/java/math/BigInteger.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/math/BigInteger.java Tue Oct 16 14:26:22 2018 +0530
@@ -41,6 +41,7 @@
import jdk.internal.math.DoubleConsts;
import jdk.internal.math.FloatConsts;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.Stable;
/**
* Immutable arbitrary-precision integers. All operations behave as if
@@ -1219,8 +1220,10 @@
* Initialize static constant array when class is loaded.
*/
private static final int MAX_CONSTANT = 16;
- private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
- private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
+ @Stable
+ private static final BigInteger[] posConst = new BigInteger[MAX_CONSTANT+1];
+ @Stable
+ private static final BigInteger[] negConst = new BigInteger[MAX_CONSTANT+1];
/**
* The cache of powers of each radix. This allows us to not have to
--- a/src/java.base/share/classes/java/net/SocketInputStream.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/net/SocketInputStream.java Tue Oct 16 14:26:22 2018 +0530
@@ -232,7 +232,11 @@
* @return the number of immediately available bytes
*/
public int available() throws IOException {
- return impl.available();
+ if (eof) {
+ return 0;
+ } else {
+ return impl.available();
+ }
}
/**
--- a/src/java.base/share/classes/java/time/Duration.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/Duration.java Tue Oct 16 14:26:22 2018 +0530
@@ -1519,7 +1519,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Duration
--- a/src/java.base/share/classes/java/time/Instant.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/Instant.java Tue Oct 16 14:26:22 2018 +0530
@@ -1332,7 +1332,7 @@
// -----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(2); // identifies an Instant
--- a/src/java.base/share/classes/java/time/LocalDate.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/LocalDate.java Tue Oct 16 14:26:22 2018 +0530
@@ -2189,7 +2189,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(3); // identifies a LocalDate
--- a/src/java.base/share/classes/java/time/LocalDateTime.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/LocalDateTime.java Tue Oct 16 14:26:22 2018 +0530
@@ -1975,12 +1975,12 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(5); // identifies a LocalDateTime
- * // the <a href="../../serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header
- * // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
* </pre>
*
* @return the instance of {@code Ser}, not null
--- a/src/java.base/share/classes/java/time/LocalTime.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/LocalTime.java Tue Oct 16 14:26:22 2018 +0530
@@ -1645,7 +1645,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* A twos-complement value indicates the remaining values are not in the stream
* and should be set to zero.
--- a/src/java.base/share/classes/java/time/MonthDay.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/MonthDay.java Tue Oct 16 14:26:22 2018 +0530
@@ -754,7 +754,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(13); // identifies a MonthDay
--- a/src/java.base/share/classes/java/time/OffsetDateTime.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/OffsetDateTime.java Tue Oct 16 14:26:22 2018 +0530
@@ -1915,12 +1915,12 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(10); // identifies an OffsetDateTime
- * // the <a href="../../serialized-form.html#java.time.LocalDateTime">datetime</a> excluding the one byte header
- * // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalDateTime">datetime</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
* </pre>
*
* @return the instance of {@code Ser}, not null
--- a/src/java.base/share/classes/java/time/OffsetTime.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/OffsetTime.java Tue Oct 16 14:26:22 2018 +0530
@@ -1400,12 +1400,12 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(9); // identifies an OffsetTime
- * // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
- * // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
* </pre>
*
* @return the instance of {@code Ser}, not null
--- a/src/java.base/share/classes/java/time/Period.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/Period.java Tue Oct 16 14:26:22 2018 +0530
@@ -1041,7 +1041,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(14); // identifies a Period
--- a/src/java.base/share/classes/java/time/Ser.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/Ser.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -139,20 +139,20 @@
* in the stream. Refer to each class {@code writeReplace}
* serialized form for the value of the type and sequence of values for the type.
* <ul>
- * <li><a href="../../serialized-form.html#java.time.Duration">Duration.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.Instant">Instant.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.Period">Period.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.Year">Year.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset.writeReplace</a>
- * <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Duration">Duration.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Instant">Instant.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalDate">LocalDate.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalDateTime">LocalDateTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalTime">LocalTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.MonthDay">MonthDay.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.OffsetTime">OffsetTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.OffsetDateTime">OffsetDateTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Period">Period.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Year">Year.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.YearMonth">YearMonth.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZoneId">ZoneId.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZoneOffset">ZoneOffset.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZonedDateTime">ZonedDateTime.writeReplace</a>
* </ul>
*
* @param out the data stream to write to, not null
@@ -223,20 +223,20 @@
* {@code Ser} object.
*
* <ul>
- * <li><a href="../../serialized-form.html#java.time.Duration">Duration</a> - {@code Duration.ofSeconds(seconds, nanos);}
- * <li><a href="../../serialized-form.html#java.time.Instant">Instant</a> - {@code Instant.ofEpochSecond(seconds, nanos);}
- * <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate</a> - {@code LocalDate.of(year, month, day);}
- * <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime</a> - {@code LocalDateTime.of(date, time);}
- * <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime</a> - {@code LocalTime.of(hour, minute, second, nano);}
- * <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay</a> - {@code MonthDay.of(month, day);}
- * <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime</a> - {@code OffsetTime.of(time, offset);}
- * <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime</a> - {@code OffsetDateTime.of(dateTime, offset);}
- * <li><a href="../../serialized-form.html#java.time.Period">Period</a> - {@code Period.of(years, months, days);}
- * <li><a href="../../serialized-form.html#java.time.Year">Year</a> - {@code Year.of(year);}
- * <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth</a> - {@code YearMonth.of(year, month);}
- * <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime</a> - {@code ZonedDateTime.ofLenient(dateTime, offset, zone);}
- * <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId</a> - {@code ZoneId.of(id);}
- * <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset</a> - {@code (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Duration">Duration</a> - {@code Duration.ofSeconds(seconds, nanos);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Instant">Instant</a> - {@code Instant.ofEpochSecond(seconds, nanos);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalDate">LocalDate</a> - {@code LocalDate.of(year, month, day);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalDateTime">LocalDateTime</a> - {@code LocalDateTime.of(date, time);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.LocalTime">LocalTime</a> - {@code LocalTime.of(hour, minute, second, nano);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.MonthDay">MonthDay</a> - {@code MonthDay.of(month, day);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.OffsetTime">OffsetTime</a> - {@code OffsetTime.of(time, offset);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.OffsetDateTime">OffsetDateTime</a> - {@code OffsetDateTime.of(dateTime, offset);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Period">Period</a> - {@code Period.of(years, months, days);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.Year">Year</a> - {@code Year.of(year);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.YearMonth">YearMonth</a> - {@code YearMonth.of(year, month);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZonedDateTime">ZonedDateTime</a> - {@code ZonedDateTime.ofLenient(dateTime, offset, zone);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZoneId">ZoneId</a> - {@code ZoneId.of(id);}
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.ZoneOffset">ZoneOffset</a> - {@code (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));}
* </ul>
*
* @param in the data to read, not null
--- a/src/java.base/share/classes/java/time/Year.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/Year.java Tue Oct 16 14:26:22 2018 +0530
@@ -1088,7 +1088,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(11); // identifies a Year
--- a/src/java.base/share/classes/java/time/YearMonth.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/YearMonth.java Tue Oct 16 14:26:22 2018 +0530
@@ -1212,7 +1212,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(12); // identifies a YearMonth
--- a/src/java.base/share/classes/java/time/ZoneId.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/ZoneId.java Tue Oct 16 14:26:22 2018 +0530
@@ -641,7 +641,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
--- a/src/java.base/share/classes/java/time/ZoneOffset.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/ZoneOffset.java Tue Oct 16 14:26:22 2018 +0530
@@ -750,7 +750,7 @@
// -----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(8); // identifies a ZoneOffset
--- a/src/java.base/share/classes/java/time/ZoneRegion.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/ZoneRegion.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -180,7 +180,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
--- a/src/java.base/share/classes/java/time/ZonedDateTime.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/ZonedDateTime.java Tue Oct 16 14:26:22 2018 +0530
@@ -2224,13 +2224,13 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(6); // identifies a ZonedDateTime
- * // the <a href="../../serialized-form.html#java.time.LocalDateTime">dateTime</a> excluding the one byte header
- * // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
- * // the <a href="../../serialized-form.html#java.time.ZoneId">zone ID</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.LocalDateTime">dateTime</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
+ * // the <a href="{@docRoot}/serialized-form.html#java.time.ZoneId">zone ID</a> excluding the one byte header
* </pre>
*
* @return the instance of {@code Ser}, not null
--- a/src/java.base/share/classes/java/time/chrono/AbstractChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/AbstractChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -721,7 +721,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* <pre>
* out.writeByte(1); // identifies this as a Chronology
* out.writeUTF(getId());
--- a/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -399,7 +399,7 @@
//-----------------------------------------------------------------------
/**
* Writes the ChronoLocalDateTime using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(2); // identifies a ChronoLocalDateTime
--- a/src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -355,7 +355,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* <pre>
* out.writeByte(12); // identifies this as a ChronoPeriodImpl
* out.writeUTF(getId()); // the chronology
--- a/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -322,7 +322,7 @@
//-----------------------------------------------------------------------
/**
* Writes the ChronoZonedDateTime using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(3); // identifies a ChronoZonedDateTime
--- a/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -1011,7 +1011,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Chronology
--- a/src/java.base/share/classes/java/time/chrono/HijrahDate.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/HijrahDate.java Tue Oct 16 14:26:22 2018 +0530
@@ -663,7 +663,7 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(6); // identifies a HijrahDate
--- a/src/java.base/share/classes/java/time/chrono/IsoChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/IsoChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -680,7 +680,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Chronology
--- a/src/java.base/share/classes/java/time/chrono/JapaneseChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/JapaneseChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -507,7 +507,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Chronology
--- a/src/java.base/share/classes/java/time/chrono/JapaneseDate.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/JapaneseDate.java Tue Oct 16 14:26:22 2018 +0530
@@ -725,7 +725,7 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(4); // identifies a JapaneseDate
--- a/src/java.base/share/classes/java/time/chrono/JapaneseEra.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/JapaneseEra.java Tue Oct 16 14:26:22 2018 +0530
@@ -395,7 +395,7 @@
//-----------------------------------------------------------------------
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(5); // identifies a JapaneseEra
--- a/src/java.base/share/classes/java/time/chrono/MinguoChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/MinguoChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -337,7 +337,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Chronology
--- a/src/java.base/share/classes/java/time/chrono/MinguoDate.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/MinguoDate.java Tue Oct 16 14:26:22 2018 +0530
@@ -487,7 +487,7 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(8); // identifies a MinguoDate
--- a/src/java.base/share/classes/java/time/chrono/Ser.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/Ser.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -136,18 +136,18 @@
* in the stream. Refer to each class {@code writeReplace}
* serialized form for the value of the type and sequence of values for the type.
* <ul>
- * <li><a href="../../../serialized-form.html#java.time.chrono.HijrahChronology">HijrahChronology.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.IsoChronology">IsoChronology.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseChronology">JapaneseChronology.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.MinguoChronology">MinguoChronology.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistChronology">ThaiBuddhistChronology.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.ChronoLocalDateTimeImpl">ChronoLocalDateTime.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.ChronoZonedDateTimeImpl">ChronoZonedDateTime.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseDate">JapaneseDate.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseEra">JapaneseEra.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.HijrahDate">HijrahDate.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.MinguoDate">MinguoDate.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistDate">ThaiBuddhistDate.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.HijrahChronology">HijrahChronology.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.IsoChronology">IsoChronology.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseChronology">JapaneseChronology.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.MinguoChronology">MinguoChronology.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ThaiBuddhistChronology">ThaiBuddhistChronology.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ChronoLocalDateTimeImpl">ChronoLocalDateTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ChronoZonedDateTimeImpl">ChronoZonedDateTime.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseDate">JapaneseDate.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseEra">JapaneseEra.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.HijrahDate">HijrahDate.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.MinguoDate">MinguoDate.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ThaiBuddhistDate">ThaiBuddhistDate.writeReplace</a>
* </ul>
*
* @param out the data stream to write to, not null
@@ -202,18 +202,18 @@
* {@code Ser} object.
*
* <ul>
- * <li><a href="../../../serialized-form.html#java.time.chrono.HijrahChronology">HijrahChronology</a> - Chronology.of(id)
- * <li><a href="../../../serialized-form.html#java.time.chrono.IsoChronology">IsoChronology</a> - Chronology.of(id)
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseChronology">JapaneseChronology</a> - Chronology.of(id)
- * <li><a href="../../../serialized-form.html#java.time.chrono.MinguoChronology">MinguoChronology</a> - Chronology.of(id)
- * <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistChronology">ThaiBuddhistChronology</a> - Chronology.of(id)
- * <li><a href="../../../serialized-form.html#java.time.chrono.ChronoLocalDateTimeImpl">ChronoLocalDateTime</a> - date.atTime(time)
- * <li><a href="../../../serialized-form.html#java.time.chrono.ChronoZonedDateTimeImpl">ChronoZonedDateTime</a> - dateTime.atZone(offset).withZoneSameLocal(zone)
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseDate">JapaneseDate</a> - JapaneseChronology.INSTANCE.date(year, month, dayOfMonth)
- * <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseEra">JapaneseEra</a> - JapaneseEra.of(eraValue)
- * <li><a href="../../../serialized-form.html#java.time.chrono.HijrahDate">HijrahDate</a> - HijrahChronology chrono.date(year, month, dayOfMonth)
- * <li><a href="../../../serialized-form.html#java.time.chrono.MinguoDate">MinguoDate</a> - MinguoChronology.INSTANCE.date(year, month, dayOfMonth)
- * <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistDate">ThaiBuddhistDate</a> - ThaiBuddhistChronology.INSTANCE.date(year, month, dayOfMonth)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.HijrahChronology">HijrahChronology</a> - Chronology.of(id)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.IsoChronology">IsoChronology</a> - Chronology.of(id)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseChronology">JapaneseChronology</a> - Chronology.of(id)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.MinguoChronology">MinguoChronology</a> - Chronology.of(id)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ThaiBuddhistChronology">ThaiBuddhistChronology</a> - Chronology.of(id)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ChronoLocalDateTimeImpl">ChronoLocalDateTime</a> - date.atTime(time)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ChronoZonedDateTimeImpl">ChronoZonedDateTime</a> - dateTime.atZone(offset).withZoneSameLocal(zone)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseDate">JapaneseDate</a> - JapaneseChronology.INSTANCE.date(year, month, dayOfMonth)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.JapaneseEra">JapaneseEra</a> - JapaneseEra.of(eraValue)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.HijrahDate">HijrahDate</a> - HijrahChronology chrono.date(year, month, dayOfMonth)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.MinguoDate">MinguoDate</a> - MinguoChronology.INSTANCE.date(year, month, dayOfMonth)
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.chrono.ThaiBuddhistDate">ThaiBuddhistDate</a> - ThaiBuddhistChronology.INSTANCE.date(year, month, dayOfMonth)
* </ul>
*
* @param in the data stream to read from, not null
--- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -374,7 +374,7 @@
//-----------------------------------------------------------------------
/**
* Writes the Chronology using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(1); // identifies a Chronology
--- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java Tue Oct 16 14:26:22 2018 +0530
@@ -487,7 +487,7 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
* @serialData
* <pre>
* out.writeByte(10); // identifies a ThaiBuddhistDate
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Tue Oct 16 14:26:22 2018 +0530
@@ -1138,9 +1138,12 @@
* <p>
* This returns an immutable formatter capable of formatting and parsing
* the ISO-8601 instant format.
- * When formatting, the second-of-minute is always output.
+ * When formatting, the instant will always be suffixed by 'Z' to indicate UTC.
+ * The second-of-minute is always output.
* The nano-of-second outputs zero, three, six or nine digits as necessary.
- * When parsing, time to at least the seconds field is required.
+ * When parsing, the behaviour of {@link DateTimeFormatterBuilder#appendOffsetId()}
+ * will be used to parse the offset, converting the instant to UTC as necessary.
+ * The time to at least the seconds field is required.
* Fractional seconds from zero to nine are parsed.
* The localized decimal style is not used.
* <p>
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java Tue Oct 16 14:26:22 2018 +0530
@@ -837,6 +837,10 @@
* The leap-second time of '23:59:59' is handled to some degree, see
* {@link DateTimeFormatter#parsedLeapSecond()} for full details.
* <p>
+ * When formatting, the instant will always be suffixed by 'Z' to indicate UTC.
+ * When parsing, the behaviour of {@link DateTimeFormatterBuilder#appendOffsetId()}
+ * will be used to parse the offset, converting the instant to UTC as necessary.
+ * <p>
* An alternative to this method is to format/parse the instant as a single
* epoch-seconds value. That is achieved using {@code appendValue(INSTANT_SECONDS)}.
*
@@ -3468,7 +3472,7 @@
.appendValue(MINUTE_OF_HOUR, 2).appendLiteral(':')
.appendValue(SECOND_OF_MINUTE, 2)
.appendFraction(NANO_OF_SECOND, minDigits, maxDigits, true)
- .appendLiteral('Z')
+ .appendOffsetId()
.toFormatter().toPrinterParser(false);
DateTimeParseContext newContext = context.copy();
int pos = parser.parse(newContext, text, position);
@@ -3486,6 +3490,7 @@
Long nanoVal = newContext.getParsed(NANO_OF_SECOND);
int sec = (secVal != null ? secVal.intValue() : 0);
int nano = (nanoVal != null ? nanoVal.intValue() : 0);
+ int offset = newContext.getParsed(OFFSET_SECONDS).intValue();
int days = 0;
if (hour == 24 && min == 0 && sec == 0 && nano == 0) {
hour = 0;
@@ -3498,7 +3503,7 @@
long instantSecs;
try {
LocalDateTime ldt = LocalDateTime.of(year, month, day, hour, min, sec, 0).plusDays(days);
- instantSecs = ldt.toEpochSecond(ZoneOffset.UTC);
+ instantSecs = ldt.toEpochSecond(ZoneOffset.ofTotalSeconds(offset));
instantSecs += Math.multiplyExact(yearParsed / 10_000L, SECONDS_PER_10000_YEARS);
} catch (RuntimeException ex) {
return ~position;
--- a/src/java.base/share/classes/java/time/zone/Ser.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/zone/Ser.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -125,9 +125,9 @@
* serialized form for the value of the type and sequence of values for the type.
*
* <ul>
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition.writeReplace</a>
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition.writeReplace</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule.writeReplace</a>
* </ul>
*
* @param out the data stream to write to, not null
@@ -168,11 +168,11 @@
* {@code Ser} object.
*
* <ul>
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneRules">ZoneRules</a>
* - {@code ZoneRules.of(standardTransitions, standardOffsets, savingsInstantTransitions, wallOffsets, lastRules);}
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition</a>
* - {@code ZoneOffsetTransition of(LocalDateTime.ofEpochSecond(epochSecond), offsetBefore, offsetAfter);}
- * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule</a>
+ * <li><a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule</a>
* - {@code ZoneOffsetTransitionRule.of(month, dom, dow, time, timeEndOfDay, timeDefinition, standardOffset, offsetBefore, offsetAfter);}
* </ul>
* @param in the data to read, not null
--- a/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -190,10 +190,10 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
* @serialData
* Refer to the serialized form of
- * <a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
+ * <a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
* for the encoding of epoch seconds and offsets.
* <pre style="font-size:1.0em">{@code
*
--- a/src/java.base/share/classes/java/time/zone/ZoneOffsetTransitionRule.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/zone/ZoneOffsetTransitionRule.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -249,10 +249,10 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
* @serialData
* Refer to the serialized form of
- * <a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
+ * <a href="{@docRoot}/serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
* for the encoding of epoch seconds and offsets.
* <pre style="font-size:1.0em">{@code
*
--- a/src/java.base/share/classes/java/time/zone/ZoneRules.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/time/zone/ZoneRules.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -327,7 +327,7 @@
/**
* Writes the object using a
- * <a href="../../../serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
+ * <a href="{@docRoot}/serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
* @serialData
* <pre style="font-size:1.0em">{@code
*
--- a/src/java.base/share/classes/java/util/Locale.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/Locale.java Tue Oct 16 14:26:22 2018 +0530
@@ -2246,22 +2246,26 @@
/**
* @serialField language String
- * language subtag in lower case. (See <a href="java/util/Locale.html#getLanguage()">getLanguage()</a>)
+ * language subtag in lower case.
+ * (See <a href="java.base/java/util/Locale.html#getLanguage()">getLanguage()</a>)
* @serialField country String
- * country subtag in upper case. (See <a href="java/util/Locale.html#getCountry()">getCountry()</a>)
+ * country subtag in upper case.
+ * (See <a href="java.base/java/util/Locale.html#getCountry()">getCountry()</a>)
* @serialField variant String
- * variant subtags separated by LOWLINE characters. (See <a href="java/util/Locale.html#getVariant()">getVariant()</a>)
+ * variant subtags separated by LOWLINE characters.
+ * (See <a href="java.base/java/util/Locale.html#getVariant()">getVariant()</a>)
* @serialField hashcode int
* deprecated, for forward compatibility only
* @serialField script String
- * script subtag in title case (See <a href="java/util/Locale.html#getScript()">getScript()</a>)
+ * script subtag in title case
+ * (See <a href="java.base/java/util/Locale.html#getScript()">getScript()</a>)
* @serialField extensions String
* canonical representation of extensions, that is,
* BCP47 extensions in alphabetical order followed by
* BCP47 private use subtags, all in lower case letters
* separated by HYPHEN-MINUS characters.
- * (See <a href="java/util/Locale.html#getExtensionKeys()">getExtensionKeys()</a>,
- * <a href="java/util/Locale.html#getExtension(char)">getExtension(char)</a>)
+ * (See <a href="java.base/java/util/Locale.html#getExtensionKeys()">getExtensionKeys()</a>,
+ * <a href="java.base/java/util/Locale.html#getExtension(char)">getExtension(char)</a>)
*/
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("language", String.class),
--- a/src/java.base/share/classes/java/util/jar/Attributes.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java Tue Oct 16 14:26:22 2018 +0530
@@ -550,7 +550,7 @@
* {@code Name} object for {@code Manifest-Version}
* manifest attribute. This attribute indicates the version number
* of the manifest standard to which a JAR file's manifest conforms.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#jar-manifest">
* Manifest and Signature Specification</a>
*/
public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
@@ -558,7 +558,7 @@
/**
* {@code Name} object for {@code Signature-Version}
* manifest attribute used when signing JAR files.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#jar-manifest">
* Manifest and Signature Specification</a>
*/
public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
@@ -572,7 +572,7 @@
/**
* {@code Name} object for {@code Class-Path}
* manifest attribute.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#classpath">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#class-path-attribute">
* JAR file specification</a>
*/
public static final Name CLASS_PATH = new Name("Class-Path");
--- a/src/java.base/share/classes/java/util/jar/JarFile.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java Tue Oct 16 14:26:22 2018 +0530
@@ -556,7 +556,8 @@
return JUZFA.entryNameStream(this).map(this::getBasename)
.filter(Objects::nonNull)
.distinct()
- .map(this::getJarEntry);
+ .map(this::getJarEntry)
+ .filter(Objects::nonNull);
}
return stream();
}
--- a/src/java.base/share/classes/java/util/jar/Manifest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java Tue Oct 16 14:26:22 2018 +0530
@@ -49,9 +49,6 @@
*/
public class Manifest implements Cloneable {
- private static final boolean jarInfoInExceptionText =
- SecurityProperties.includedInExceptions("jar");
-
// manifest main attributes
private Attributes attr = new Attributes();
@@ -203,10 +200,10 @@
}
static String getErrorPosition(String filename, final int lineNumber) {
- if (filename == null || !jarInfoInExceptionText) {
+ if (filename == null ||
+ !SecurityProperties.INCLUDE_JAR_NAME_IN_EXCEPTIONS) {
return "line " + lineNumber;
}
-
return "manifest of " + filename + ":" + lineNumber;
}
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Tue Oct 16 14:26:22 2018 +0530
@@ -1433,10 +1433,10 @@
/**
* The pattern is converted to normalized form ({@link
- * java.text.Normalizer.Form.NFC NFC}, canonical decomposition,
+ * java.text.Normalizer.Form#NFC NFC}, canonical decomposition,
* followed by canonical composition for the character class
- * part, and {@link java.text.Normalizer.Form.NFD NFD},
- * canonical decomposition) for the rest), and then a pure
+ * part, and {@link java.text.Normalizer.Form#NFD NFD},
+ * canonical decomposition for the rest), and then a pure
* group is constructed to match canonical equivalences of the
* characters.
*/
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -35,6 +35,7 @@
import java.lang.ref.Cleaner.Cleanable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
+import java.nio.file.InvalidPathException;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.Files;
import java.util.ArrayDeque;
@@ -1218,8 +1219,13 @@
static Source get(File file, boolean toDelete) throws IOException {
- Key key = new Key(file,
- Files.readAttributes(file.toPath(), BasicFileAttributes.class));
+ final Key key;
+ try {
+ key = new Key(file,
+ Files.readAttributes(file.toPath(), BasicFileAttributes.class));
+ } catch (InvalidPathException ipe) {
+ throw new IOException(ipe);
+ }
Source src;
synchronized (files) {
src = files.get(key);
--- a/src/java.base/share/classes/jdk/internal/loader/Loader.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/loader/Loader.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -198,7 +198,6 @@
this.acc = AccessController.getContext();
}
-
/**
* Completes initialization of this Loader. This method populates
* remotePackageToLoader with the packages of the remote modules, where
@@ -253,25 +252,25 @@
}
// find the packages that are exported to the target module
- String target = resolvedModule.name();
ModuleDescriptor descriptor = other.reference().descriptor();
- for (ModuleDescriptor.Exports e : descriptor.exports()) {
- boolean delegate;
- if (e.isQualified()) {
- // qualified export in same configuration
- delegate = (other.configuration() == cf)
- && e.targets().contains(target);
- } else {
- // unqualified
- delegate = true;
- }
+ if (descriptor.isAutomatic()) {
+ ClassLoader l = loader;
+ descriptor.packages().forEach(pn -> remotePackage(pn, l));
+ } else {
+ String target = resolvedModule.name();
+ for (ModuleDescriptor.Exports e : descriptor.exports()) {
+ boolean delegate;
+ if (e.isQualified()) {
+ // qualified export in same configuration
+ delegate = (other.configuration() == cf)
+ && e.targets().contains(target);
+ } else {
+ // unqualified
+ delegate = true;
+ }
- if (delegate) {
- String pn = e.source();
- ClassLoader l = remotePackageToLoader.putIfAbsent(pn, loader);
- if (l != null && l != loader) {
- throw new IllegalArgumentException("Package "
- + pn + " cannot be imported from multiple loaders");
+ if (delegate) {
+ remotePackage(e.source(), loader);
}
}
}
@@ -283,6 +282,22 @@
}
/**
+ * Adds to remotePackageToLoader so that an attempt to load a class in
+ * the package delegates to the given class loader.
+ *
+ * @throws IllegalStateException
+ * if the package is already mapped to a different class loader
+ */
+ private void remotePackage(String pn, ClassLoader loader) {
+ ClassLoader l = remotePackageToLoader.putIfAbsent(pn, loader);
+ if (l != null && l != loader) {
+ throw new IllegalStateException("Package "
+ + pn + " cannot be imported from multiple loaders");
+ }
+ }
+
+
+ /**
* Find the layer corresponding to the given configuration in the tree
* of layers rooted at the given parent.
*/
--- a/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -46,7 +46,7 @@
/**
* Creates a pool of class loaders. Each module in the given configuration
- * will be loaded its own class loader in the pool. The class loader is
+ * is mapped to its own class loader in the pool. The class loader is
* created with the given parent class loader as its parent.
*/
public LoaderPool(Configuration cf,
--- a/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,14 +27,16 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import jdk.internal.misc.Unsafe;
-/** Utility class which assists in calling Unsafe.defineClass() by
+import jdk.internal.misc.JavaLangAccess;
+import jdk.internal.misc.SharedSecrets;
+
+/** Utility class which assists in calling defineClass() by
creating a new class loader which delegates to the one needed in
order for proper resolution of the given bytecodes to occur. */
class ClassDefiner {
- static final Unsafe unsafe = Unsafe.getUnsafe();
+ static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
/** <P> We define generated code into a new class loader which
delegates to the defining loader of the target class. It is
@@ -60,7 +62,7 @@
return new DelegatingClassLoader(parentClassLoader);
}
});
- return unsafe.defineClass(name, bytes, off, len, newLoader, null);
+ return JLA.defineClass(newLoader, name, bytes, null, "__ClassDefiner__");
}
}
--- a/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java Tue Oct 16 14:26:22 2018 +0530
@@ -118,4 +118,8 @@
/** Gets the root of the given AccessibleObject object; null if arg is the root */
public <T extends AccessibleObject> T getRoot(T obj);
+
+ /** Returns a new instance created by the given constructor with access check */
+ public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
+ throws IllegalAccessException, InstantiationException, InvocationTargetException;
}
--- a/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java Tue Oct 16 14:26:22 2018 +0530
@@ -398,6 +398,12 @@
return langReflectAccess().getExecutableSharedParameterTypes(ex);
}
+ public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
+ throws IllegalAccessException, InstantiationException, InvocationTargetException
+ {
+ return langReflectAccess().newInstance(ctor, args, caller);
+ }
+
//--------------------------------------------------------------------------
//
// Routines used by serialization
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -31,6 +31,8 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.StringJoiner;
import static sun.reflect.annotation.TypeAnnotation.*;
@@ -202,6 +204,68 @@
}
+ @Override // java.lang.Object
+ public String toString() {
+ // Reusable toString implementation, but needs to be
+ // specialized for quirks of arrays.
+ return annotationsToString(getAnnotations(), false) + type.toString();
+ }
+
+ protected String annotationsToString(Annotation[] annotations, boolean leadingSpace) {
+ if (annotations != null && annotations.length > 0) {
+ StringJoiner sj = new StringJoiner(" ");
+ if (leadingSpace) {
+ sj.add(""); // Add a space
+ }
+
+ for (Annotation annotation : annotations) {
+ sj.add(annotation.toString());
+ }
+
+ if (!leadingSpace) {
+ sj.add("");
+ }
+ return sj.toString();
+ } else {
+ return "";
+ }
+ }
+
+ protected boolean equalsTypeAndAnnotations(AnnotatedType that) {
+ return getType().equals(that.getType()) &&
+ // Treat ordering of annotations as significant
+ Arrays.equals(getAnnotations(), that.getAnnotations()) &&
+ Objects.equals(getAnnotatedOwnerType(), that.getAnnotatedOwnerType());
+ }
+
+ int baseHashCode() {
+ return type.hashCode() ^
+ // Acceptable to use Objects.hash rather than
+ // Arrays.deepHashCode since the elements of the array
+ // are not themselves arrays.
+ Objects.hash((Object[])getAnnotations()) ^
+ Objects.hash(getAnnotatedOwnerType());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AnnotatedType &&
+ !(o instanceof AnnotatedArrayType) &&
+ !(o instanceof AnnotatedTypeVariable) &&
+ !(o instanceof AnnotatedParameterizedType) &&
+ !(o instanceof AnnotatedWildcardType)) {
+ AnnotatedType that = (AnnotatedType) o;
+ return equalsTypeAndAnnotations(that);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode();
+ }
+
// Implementation details
final LocationInfo getLocation() {
return location;
@@ -244,6 +308,52 @@
}
return ((GenericArrayType)t).getGenericComponentType();
}
+
+ @Override
+ public String toString() {
+ // To annotate the full type of an array, the annotations
+ // are placed between the type and the brackets. For
+ // example, to annotate an array of Strings, the syntax used is
+ //
+ // String @TypeAnnotation []
+ //
+ // and *not*
+ //
+ // @TypeAnnotation String[].
+ //
+ // The toString output should strive to be reusable in
+ // source code. Therefore, the general logic of putting
+ // the annotations before a textual representation of the
+ // type need to be overridden for arrays.
+ StringBuilder sb = new StringBuilder();
+
+ AnnotatedType componentType = this;
+ while (componentType instanceof AnnotatedArrayType) {
+ AnnotatedArrayType annotatedArrayType = (AnnotatedArrayType) componentType;
+ sb.append(annotationsToString(annotatedArrayType.getAnnotations(), true) + "[]");
+ componentType = annotatedArrayType.getAnnotatedGenericComponentType();
+ }
+
+ sb.insert(0, componentType.toString());
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AnnotatedArrayType) {
+ AnnotatedArrayType that = (AnnotatedArrayType) o;
+ return equalsTypeAndAnnotations(that) &&
+ Objects.equals(getAnnotatedGenericComponentType(),
+ that.getAnnotatedGenericComponentType());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode() ^ getAnnotatedGenericComponentType().hashCode();
+ }
}
private static final class AnnotatedTypeVariableImpl extends AnnotatedTypeBaseImpl implements AnnotatedTypeVariable {
@@ -266,6 +376,23 @@
private TypeVariable<?> getTypeVariable() {
return (TypeVariable)getType();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AnnotatedTypeVariable) {
+ AnnotatedTypeVariable that = (AnnotatedTypeVariable) o;
+ return equalsTypeAndAnnotations(that) &&
+ Arrays.equals(getAnnotatedBounds(), that.getAnnotatedBounds());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode() ^
+ Objects.hash((Object[])getAnnotatedBounds());
+ }
}
private static final class AnnotatedParameterizedTypeImpl extends AnnotatedTypeBaseImpl
@@ -316,6 +443,23 @@
private ParameterizedType getParameterizedType() {
return (ParameterizedType)getType();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AnnotatedParameterizedType) {
+ AnnotatedParameterizedType that = (AnnotatedParameterizedType) o;
+ return equalsTypeAndAnnotations(that) &&
+ Arrays.equals(getAnnotatedActualTypeArguments(), that.getAnnotatedActualTypeArguments());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode() ^
+ Objects.hash((Object[])getAnnotatedActualTypeArguments());
+ }
}
private static final class AnnotatedWildcardTypeImpl extends AnnotatedTypeBaseImpl implements AnnotatedWildcardType {
@@ -378,5 +522,26 @@
private boolean hasUpperBounds() {
return hasUpperBounds;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AnnotatedWildcardType) {
+ AnnotatedWildcardType that = (AnnotatedWildcardType) o;
+ return equalsTypeAndAnnotations(that) &&
+ // Treats ordering as significant
+ Arrays.equals(getAnnotatedLowerBounds(), that.getAnnotatedLowerBounds()) &&
+ // Treats ordering as significant
+ Arrays.equals(getAnnotatedUpperBounds(), that.getAnnotatedUpperBounds());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return baseHashCode() ^
+ Objects.hash((Object[])getAnnotatedLowerBounds()) ^
+ Objects.hash((Object[])getAnnotatedUpperBounds());
+ }
}
}
--- a/src/java.base/share/classes/sun/security/util/SecurityProperties.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/classes/sun/security/util/SecurityProperties.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,6 +32,9 @@
public class SecurityProperties {
+ public static final boolean INCLUDE_JAR_NAME_IN_EXCEPTIONS
+ = includedInExceptions("jar");
+
/**
* Returns the value of the security property propName, which can be overridden
* by a system property of the same name
--- a/src/java.base/share/native/libjava/io_util.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/native/libjava/io_util.c Tue Oct 16 14:26:22 2018 +0530
@@ -201,7 +201,7 @@
}
}
-JNIEXPORT void JNICALL
+void
throwFileNotFoundException(JNIEnv *env, jstring path)
{
char buf[256];
--- a/src/java.base/share/native/libjava/io_util.h Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/native/libjava/io_util.h Tue Oct 16 14:26:22 2018 +0530
@@ -54,8 +54,7 @@
void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
jint len, jboolean append, jfieldID fid);
void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
-JNIEXPORT void JNICALL
-throwFileNotFoundException(JNIEnv *env, jstring path);
+void throwFileNotFoundException(JNIEnv *env, jstring path);
/*
* Macros for managing platform strings. The typical usage pattern is:
--- a/src/java.base/share/native/libnet/net_util.h Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/share/native/libnet/net_util.h Tue Oct 16 14:26:22 2018 +0530
@@ -122,8 +122,6 @@
JNIEXPORT void JNICALL NET_ThrowNew(JNIEnv *env, int errorNum, char *msg);
-int NET_GetError();
-
void NET_ThrowCurrent(JNIEnv *env, char *msg);
jfieldID NET_GetFileDescriptorID(JNIEnv *env);
@@ -202,7 +200,6 @@
unsigned short in_cksum(unsigned short *addr, int len);
-JNIEXPORT jint JNICALL
-NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
+jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
#endif /* NET_UTILS_H */
--- a/src/java.base/unix/native/libjsig/jsig.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/unix/native/libjsig/jsig.c Tue Oct 16 14:26:22 2018 +0530
@@ -312,7 +312,7 @@
}
/* The three functions for the jvm to call into. */
-void JVM_begin_signal_setting() {
+JNIEXPORT void JVM_begin_signal_setting() {
signal_lock();
sigemptyset(&jvmsigs);
jvm_signal_installing = true;
@@ -320,7 +320,7 @@
signal_unlock();
}
-void JVM_end_signal_setting() {
+JNIEXPORT void JVM_end_signal_setting() {
signal_lock();
jvm_signal_installed = true;
jvm_signal_installing = false;
@@ -328,7 +328,7 @@
signal_unlock();
}
-struct sigaction *JVM_get_signal_action(int sig) {
+JNIEXPORT struct sigaction *JVM_get_signal_action(int sig) {
allocate_sact();
/* Does race condition make sense here? */
if (sigismember(&jvmsigs, sig)) {
--- a/src/java.base/unix/native/libnet/net_util_md.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/unix/native/libnet/net_util_md.c Tue Oct 16 14:26:22 2018 +0530
@@ -1546,7 +1546,7 @@
* It returns the time left from the timeout (possibly 0), or -1 if it expired.
*/
-JNIEXPORT jint JNICALL
+jint
NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout)
{
jlong prevNanoTime = JVM_NanoTime(env, 0);
--- a/src/java.base/unix/native/libnio/ch/Net.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/unix/native/libnio/ch/Net.c Tue Oct 16 14:26:22 2018 +0530
@@ -747,8 +747,7 @@
/* Declared in nio_util.h */
-JNIEXPORT jint JNICALL
-handleSocketError(JNIEnv *env, jint errorValue)
+jint handleSocketError(JNIEnv *env, jint errorValue)
{
char *xn;
switch (errorValue) {
--- a/src/java.base/unix/native/libnio/ch/nio_util.h Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/unix/native/libnio/ch/nio_util.h Tue Oct 16 14:26:22 2018 +0530
@@ -62,5 +62,4 @@
/* Defined in Net.c */
-JNIEXPORT jint JNICALL
-handleSocketError(JNIEnv *env, jint errorValue);
+jint handleSocketError(JNIEnv *env, jint errorValue);
--- a/src/java.base/windows/native/libjava/io_util_md.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.c Tue Oct 16 14:26:22 2018 +0530
@@ -213,8 +213,7 @@
return pathbuf;
}
-JNIEXPORT FD JNICALL
-winFileHandleOpen(JNIEnv *env, jstring path, int flags)
+FD winFileHandleOpen(JNIEnv *env, jstring path, int flags)
{
const DWORD access =
(flags & O_WRONLY) ? GENERIC_WRITE :
--- a/src/java.base/windows/native/libjava/io_util_md.h Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.h Tue Oct 16 14:26:22 2018 +0530
@@ -56,8 +56,7 @@
* Returns an opaque handle to file named by "path". If an error occurs,
* returns -1 and an exception is pending.
*/
-JNIEXPORT FD JNICALL
-winFileHandleOpen(JNIEnv *env, jstring path, int flags);
+FD winFileHandleOpen(JNIEnv *env, jstring path, int flags);
/*
* Macros to set/get fd from the java.io.FileDescriptor.
--- a/src/java.base/windows/native/libnet/net_util_md.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.base/windows/native/libnet/net_util_md.c Tue Oct 16 14:26:22 2018 +0530
@@ -903,7 +903,7 @@
* It returns the time left from the timeout, or -1 if it expired.
*/
-JNIEXPORT jint JNICALL
+jint
NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout)
{
jlong prevTime = JVM_CurrentTimeMillis(env, 0);
--- a/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -609,7 +609,7 @@
// get the channel name
char *channelName;
CFStringRef cfname = NULL;
- const AudioObjectPropertyAddress address = {kAudioObjectPropertyElementName, port->scope, ch};
+ const AudioObjectPropertyAddress address = {kAudioObjectPropertyElementName, port->scope, (unsigned)ch};
UInt32 size = sizeof(cfname);
OSStatus err = AudioObjectGetPropertyData(mixer->deviceID, &address, 0, NULL, &size, &cfname);
if (err == noErr) {
--- a/src/java.net.http/share/classes/java/net/http/WebSocket.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.net.http/share/classes/java/net/http/WebSocket.java Tue Oct 16 14:26:22 2018 +0530
@@ -197,9 +197,9 @@
* <li> {@link SecurityException} -
* if a security manager has been installed and it denies
* {@link java.net.URLPermission access} to {@code uri}.
- * <a href="HttpRequest.html#securitychecks">Security checks</a>
+ * <a href="HttpClient.html#securitychecks">Security checks</a>
* contains more information relating to the security context
- * in which the the listener is invoked.
+ * in which the listener is invoked.
* <li> {@link IllegalArgumentException} -
* if any of the arguments of this builder's methods are
* illegal
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java Tue Oct 16 14:26:22 2018 +0530
@@ -133,9 +133,7 @@
// A case insensitive TreeSet of strings.
TreeSet<String> treeSet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
treeSet.addAll(Set.of("connection", "content-length",
- "date", "expect", "from", "host", "origin",
- "referer", "upgrade",
- "via", "warning"));
+ "date", "expect", "from", "host", "upgrade", "via", "warning"));
DISALLOWED_HEADERS_SET = Collections.unmodifiableSet(treeSet);
}
--- a/src/java.security.jgss/share/native/libj2gss/NativeUtil.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.security.jgss/share/native/libj2gss/NativeUtil.c Tue Oct 16 14:26:22 2018 +0530
@@ -145,7 +145,7 @@
return JNI_ERR;
}
CLS_GSSNameElement = (*env)->NewGlobalRef(env, cls);
- if (CLS_GSSException == NULL) {
+ if (CLS_GSSNameElement == NULL) {
return JNI_ERR;
}
cls = (*env)->FindClass(env, "sun/security/jgss/wrapper/GSSCredElement");
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -144,7 +144,7 @@
/**
* Returns the dereferenced data, if
- * <a href="XMLSignContext.html#Supported%20Properties">reference caching</a>
+ * <a href="XMLSignContext.html#SupportedProperties">reference caching</a>
* is enabled. This is the result of dereferencing the URI of this
* reference during a validation or generation operation.
*
@@ -156,7 +156,7 @@
/**
* Returns the pre-digested input stream, if
- * <a href="XMLSignContext.html#Supported%20Properties">reference caching</a>
+ * <a href="XMLSignContext.html#SupportedProperties">reference caching</a>
* is enabled. This is the input to the digest operation during a
* validation or signing operation.
*
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -39,15 +39,19 @@
* @author Santiago PericasGeertsen
*/
public class ThreadLocalBufferAllocator {
- private static ThreadLocal<SoftReference<BufferAllocator>> tlba = new ThreadLocal<>();
+ private static final ThreadLocal<SoftReference<BufferAllocator>> TL = new ThreadLocal<>();
- public static BufferAllocator getBufferAllocator() {
- SoftReference<BufferAllocator> bAllocatorRef = tlba.get();
- if (bAllocatorRef == null || bAllocatorRef.get() == null) {
- bAllocatorRef = new SoftReference<>(new BufferAllocator());
- tlba.set(bAllocatorRef);
+ public static BufferAllocator getBufferAllocator() {
+ BufferAllocator ba = null;
+ SoftReference<BufferAllocator> sr = TL.get();
+ if (sr != null) {
+ ba = sr.get();
}
-
- return bAllocatorRef.get();
- }
+ if (ba == null) {
+ ba = new BufferAllocator();
+ sr = new SoftReference<>(ba);
+ TL.set(sr);
+ }
+ return ba;
+ }
}
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Tue Oct 16 14:26:22 2018 +0530
@@ -240,14 +240,20 @@
{"JVMCIRuntime::log_printf", "_aot_jvmci_runtime_log_printf"},
{"JVMCIRuntime::vm_message", "_aot_jvmci_runtime_vm_message"},
{"JVMCIRuntime::new_instance", "_aot_jvmci_runtime_new_instance"},
- {"JVMCIRuntime::log_primitive", "_aot_jvmci_runtime_log_primitive"},
+ {"JVMCIRuntime::new_array", "_aot_jvmci_runtime_new_array"},
{"JVMCIRuntime::new_multi_array", "_aot_jvmci_runtime_new_multi_array"},
+ {"JVMCIRuntime::dynamic_new_instance", "_aot_jvmci_runtime_dynamic_new_instance"},
+ {"JVMCIRuntime::dynamic_new_array", "_aot_jvmci_runtime_dynamic_new_array"},
+ {"JVMCIRuntime::new_instance_or_null", "_aot_jvmci_runtime_new_instance_or_null"},
+ {"JVMCIRuntime::new_array_or_null", "_aot_jvmci_runtime_new_array_or_null"},
+ {"JVMCIRuntime::new_multi_array_or_null", "_aot_jvmci_runtime_new_multi_array_or_null"},
+ {"JVMCIRuntime::dynamic_new_instance_or_null", "_aot_jvmci_runtime_dynamic_new_instance_or_null"},
+ {"JVMCIRuntime::dynamic_new_array_or_null", "_aot_jvmci_runtime_dynamic_new_array_or_null"},
+ {"JVMCIRuntime::log_primitive", "_aot_jvmci_runtime_log_primitive"},
{"JVMCIRuntime::validate_object", "_aot_jvmci_runtime_validate_object"},
- {"JVMCIRuntime::dynamic_new_array", "_aot_jvmci_runtime_dynamic_new_array"},
{"JVMCIRuntime::write_barrier_pre", "_aot_jvmci_runtime_write_barrier_pre"},
{"JVMCIRuntime::identity_hash_code", "_aot_jvmci_runtime_identity_hash_code"},
{"JVMCIRuntime::write_barrier_post", "_aot_jvmci_runtime_write_barrier_post"},
- {"JVMCIRuntime::dynamic_new_instance", "_aot_jvmci_runtime_dynamic_new_instance"},
{"JVMCIRuntime::thread_is_interrupted", "_aot_jvmci_runtime_thread_is_interrupted"},
{"JVMCIRuntime::exception_handler_for_pc", "_aot_jvmci_runtime_exception_handler_for_pc"},
{"JVMCIRuntime::test_deoptimize_call_int", "_aot_jvmci_runtime_test_deoptimize_call_int"},
@@ -256,8 +262,7 @@
{"JVMCIRuntime::throw_klass_external_name_exception", "_aot_jvmci_runtime_throw_klass_external_name_exception"},
{"JVMCIRuntime::throw_class_cast_exception", "_aot_jvmci_runtime_throw_class_cast_exception"},
- {"JVMCIRuntime::vm_error", "_aot_jvmci_runtime_vm_error"},
- {"JVMCIRuntime::new_array", "_aot_jvmci_runtime_new_array"}
+ {"JVMCIRuntime::vm_error", "_aot_jvmci_runtime_vm_error"}
};
//@formatter:on
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Tue Oct 16 14:26:22 2018 +0530
@@ -180,6 +180,7 @@
UNDERSCORE_IDENTIFIER(MIN, JDK8),
PRIVATE_INTERFACE_METHODS(JDK9, Fragments.FeaturePrivateIntfMethods, DiagKind.PLURAL),
LOCAL_VARIABLE_TYPE_INFERENCE(JDK10),
+ VAR_SYNTAX_IMPLICIT_LAMBDAS(JDK11, Fragments.FeatureVarSyntaxInImplicitLambda, DiagKind.PLURAL),
IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8),
SWITCH_MULTIPLE_CASE_LABELS(JDK12, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
SWITCH_RULE(JDK12, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Tue Oct 16 14:26:22 2018 +0530
@@ -1130,10 +1130,14 @@
make.at(tree.pos);
return makeLit(sym.type, cv);
}
- // Otherwise replace the variable by its proxy.
- sym = proxies.get(sym);
- Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
- tree = make.at(tree.pos).Ident(sym);
+ if (lambdaTranslationMap != null && lambdaTranslationMap.get(sym) != null) {
+ return make.at(tree.pos).Ident(lambdaTranslationMap.get(sym));
+ } else {
+ // Otherwise replace the variable by its proxy.
+ sym = proxies.get(sym);
+ Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
+ tree = make.at(tree.pos).Ident(sym);
+ }
}
JCExpression base = (tree.hasTag(SELECT)) ? ((JCFieldAccess) tree).selected : null;
switch (sym.kind) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Oct 16 14:26:22 2018 +0530
@@ -1783,7 +1783,9 @@
if (param.vartype != null &&
isRestrictedLocalVarTypeName(param.vartype, false) &&
param.vartype.hasTag(TYPEARRAY)) {
- log.error(DiagnosticFlag.SYNTAX, param.pos, Errors.VarNotAllowedArray);
+ log.error(DiagnosticFlag.SYNTAX, param.pos,
+ Feature.VAR_SYNTAX_IMPLICIT_LAMBDAS.allowedInSource(source)
+ ? Errors.VarNotAllowedArray : Errors.VarNotAllowedHere);
}
lambdaClassifier.addParameter(param);
if (lambdaClassifier.result() == LambdaParameterKind.ERROR) {
@@ -1794,7 +1796,9 @@
log.error(DiagnosticFlag.SYNTAX, pos, Errors.InvalidLambdaParameterDeclaration(lambdaClassifier.diagFragment));
}
for (JCVariableDecl param: params) {
- if (param.vartype != null && isRestrictedLocalVarTypeName(param.vartype, true)) {
+ if (param.vartype != null
+ && isRestrictedLocalVarTypeName(param.vartype, true)) {
+ checkSourceLevel(param.pos, Feature.VAR_SYNTAX_IMPLICIT_LAMBDAS);
param.startPos = TreeInfo.getStartPos(param.vartype);
param.vartype = null;
}
@@ -1804,9 +1808,9 @@
}
enum LambdaParameterKind {
- EXPLICIT(0),
- IMPLICIT(1),
- VAR(2),
+ VAR(0),
+ EXPLICIT(1),
+ IMPLICIT(2),
ERROR(-1);
private final int index;
@@ -1816,11 +1820,11 @@
}
}
- private final static Fragment[][] decisionTable = new Fragment[][]{
- /* EXPLICIT IMPLICIT VAR */
- /* EXPLICIT */ {null, ImplicitAndExplicitNotAllowed, VarAndExplicitNotAllowed},
- /* IMPLICIT */ {ImplicitAndExplicitNotAllowed, null, VarAndImplicitNotAllowed},
- /* VAR */ {VarAndExplicitNotAllowed, VarAndImplicitNotAllowed, null}
+ private final static Fragment[][] decisionTable = new Fragment[][] {
+ /* VAR EXPLICIT IMPLICIT */
+ /* VAR */ {null, VarAndExplicitNotAllowed, VarAndImplicitNotAllowed},
+ /* EXPLICIT */ {VarAndExplicitNotAllowed, null, ImplicitAndExplicitNotAllowed},
+ /* IMPLICIT */ {VarAndImplicitNotAllowed, ImplicitAndExplicitNotAllowed, null},
};
class LambdaClassifier {
@@ -1849,7 +1853,10 @@
} else if (kind != newKind && kind != LambdaParameterKind.ERROR) {
LambdaParameterKind currentKind = kind;
kind = LambdaParameterKind.ERROR;
- diagFragment = decisionTable[currentKind.index][newKind.index];
+ boolean varIndex = currentKind.index == LambdaParameterKind.VAR.index ||
+ newKind.index == LambdaParameterKind.VAR.index;
+ diagFragment = Feature.VAR_SYNTAX_IMPLICIT_LAMBDAS.allowedInSource(source) || !varIndex ?
+ decisionTable[currentKind.index][newKind.index] : null;
}
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Oct 16 14:26:22 2018 +0530
@@ -2832,6 +2832,9 @@
compiler.misc.feature.raw.string.literals=\
raw string literals
+compiler.misc.feature.var.syntax.in.implicit.lambda=\
+ var syntax in implicit lambdas
+
compiler.warn.underscore.as.identifier=\
as of release 9, ''_'' is a keyword, and may not be used as an identifier
--- a/src/jdk.hotspot.agent/share/native/libsaproc/sadis.c Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.hotspot.agent/share/native/libsaproc/sadis.c Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,7 @@
/*
* This file implements a binding between Java and the hsdis
- * dissasembler. It should compile on Linux/Solaris and Windows.
+ * disassembler. It should compile on Linux/Solaris and Windows.
* The only platform dependent pieces of the code for doing
* dlopen/dlsym to find the entry point in hsdis. All the rest is
* standard JNI code.
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -210,6 +210,7 @@
PlaceholderOutputStream o = getPlaceholderResponseBody();
tmpout.write (bytes(statusLine, 0), 0, statusLine.length());
boolean noContentToSend = false; // assume there is content
+ boolean noContentLengthHeader = false; // must not send Content-length is set
rspHdrs.set ("Date", dateFormat.get().format (new Date()));
/* check for response type that is not allowed to send a body */
@@ -225,6 +226,7 @@
logger.log (Level.WARNING, msg);
}
contentLen = -1;
+ noContentLengthHeader = (rCode != 304);
}
if (isHeadRequest() || rCode == 304) {
@@ -253,7 +255,11 @@
noContentToSend = true;
contentLen = 0;
}
- rspHdrs.set("Content-length", Long.toString(contentLen));
+ if (noContentLengthHeader) {
+ rspHdrs.remove("Content-length");
+ } else {
+ rspHdrs.set("Content-length", Long.toString(contentLen));
+ }
o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
}
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -108,7 +108,6 @@
* Otherwise the generated code might be the only reference to the boxed value and since object
* references from nmethods are weak this can cause GC problems.
*
- * @param source
* @return true if the box is cached
*/
private static boolean isBoxCached(JavaConstant source) {
@@ -182,13 +181,13 @@
if (hotspotField.isStatic()) {
HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
if (holder.isInitialized()) {
- return memoryAccess.readFieldValue(hotspotField, holder.mirror());
+ return memoryAccess.readFieldValue(hotspotField, holder.mirror(), field.isVolatile());
}
} else {
if (receiver.isNonNull()) {
Object object = ((HotSpotObjectConstantImpl) receiver).object();
if (hotspotField.isInObject(receiver)) {
- return memoryAccess.readFieldValue(hotspotField, object);
+ return memoryAccess.readFieldValue(hotspotField, object, field.isVolatile());
}
}
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -208,37 +208,34 @@
return ret;
}
- JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj) {
+ JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj, boolean isVolatile) {
assert obj != null;
assert !field.isStatic() || obj instanceof Class;
long displacement = field.getOffset();
assert checkRead(field.getJavaKind(), displacement, (HotSpotResolvedObjectType) runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(obj.getClass()), obj,
runtime.getHostJVMCIBackend().getMetaAccess());
- if (field.getJavaKind() == JavaKind.Object) {
- Object o = UNSAFE.getObject(obj, displacement);
- return HotSpotObjectConstantImpl.forObject(o);
- } else {
- JavaKind kind = field.getJavaKind();
- switch (kind) {
- case Boolean:
- return JavaConstant.forBoolean(UNSAFE.getBoolean(obj, displacement));
- case Byte:
- return JavaConstant.forByte(UNSAFE.getByte(obj, displacement));
- case Char:
- return JavaConstant.forChar(UNSAFE.getChar(obj, displacement));
- case Short:
- return JavaConstant.forShort(UNSAFE.getShort(obj, displacement));
- case Int:
- return JavaConstant.forInt(UNSAFE.getInt(obj, displacement));
- case Long:
- return JavaConstant.forLong(UNSAFE.getLong(obj, displacement));
- case Float:
- return JavaConstant.forFloat(UNSAFE.getFloat(obj, displacement));
- case Double:
- return JavaConstant.forDouble(UNSAFE.getDouble(obj, displacement));
- default:
- throw new IllegalArgumentException("Unsupported kind: " + kind);
- }
+ JavaKind kind = field.getJavaKind();
+ switch (kind) {
+ case Boolean:
+ return JavaConstant.forBoolean(isVolatile ? UNSAFE.getBooleanVolatile(obj, displacement) : UNSAFE.getBoolean(obj, displacement));
+ case Byte:
+ return JavaConstant.forByte(isVolatile ? UNSAFE.getByteVolatile(obj, displacement) : UNSAFE.getByte(obj, displacement));
+ case Char:
+ return JavaConstant.forChar(isVolatile ? UNSAFE.getCharVolatile(obj, displacement) : UNSAFE.getChar(obj, displacement));
+ case Short:
+ return JavaConstant.forShort(isVolatile ? UNSAFE.getShortVolatile(obj, displacement) : UNSAFE.getShort(obj, displacement));
+ case Int:
+ return JavaConstant.forInt(isVolatile ? UNSAFE.getIntVolatile(obj, displacement) : UNSAFE.getInt(obj, displacement));
+ case Long:
+ return JavaConstant.forLong(isVolatile ? UNSAFE.getLongVolatile(obj, displacement) : UNSAFE.getLong(obj, displacement));
+ case Float:
+ return JavaConstant.forFloat(isVolatile ? UNSAFE.getFloatVolatile(obj, displacement) : UNSAFE.getFloat(obj, displacement));
+ case Double:
+ return JavaConstant.forDouble(isVolatile ? UNSAFE.getDoubleVolatile(obj, displacement) : UNSAFE.getDouble(obj, displacement));
+ case Object:
+ return HotSpotObjectConstantImpl.forObject(isVolatile ? UNSAFE.getObjectVolatile(obj, displacement) : UNSAFE.getObject(obj, displacement));
+ default:
+ throw new IllegalArgumentException("Unsupported kind: " + kind);
}
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java Tue Oct 16 14:26:22 2018 +0530
@@ -648,11 +648,33 @@
public final long unsafeArraycopy = getFieldValue("StubRoutines::_unsafe_arraycopy", Long.class, "address");
public final long genericArraycopy = getFieldValue("StubRoutines::_generic_arraycopy", Long.class, "address");
+ // Allocation stubs that throw an exception when allocation fails
public final long newInstanceAddress = getAddress("JVMCIRuntime::new_instance");
public final long newArrayAddress = getAddress("JVMCIRuntime::new_array");
public final long newMultiArrayAddress = getAddress("JVMCIRuntime::new_multi_array");
- public final long dynamicNewArrayAddress = getAddress("JVMCIRuntime::dynamic_new_array");
- public final long dynamicNewInstanceAddress = getAddress("JVMCIRuntime::dynamic_new_instance");
+
+ // Allocation stubs that return null when allocation fails
+ public final long newInstanceOrNullAddress = getAddress("JVMCIRuntime::new_instance_or_null", 0L);
+ public final long newArrayOrNullAddress = getAddress("JVMCIRuntime::new_array_or_null", 0L);
+ public final long newMultiArrayOrNullAddress = getAddress("JVMCIRuntime::new_multi_array_or_null", 0L);
+
+ public boolean areNullAllocationStubsAvailable() {
+ return newInstanceOrNullAddress != 0L;
+ }
+
+ /**
+ * Checks that HotSpot implements all or none of the allocate-or-null stubs.
+ */
+ private boolean checkNullAllocationStubs() {
+ if (newInstanceOrNullAddress == 0L) {
+ assert newArrayOrNullAddress == 0L;
+ assert newMultiArrayOrNullAddress == 0L;
+ } else {
+ assert newArrayOrNullAddress != 0L;
+ assert newMultiArrayOrNullAddress != 0L;
+ }
+ return true;
+ }
public final long threadIsInterruptedAddress = getAddress("JVMCIRuntime::thread_is_interrupted");
public final long vmMessageAddress = getAddress("JVMCIRuntime::vm_message");
@@ -757,6 +779,7 @@
}
assert codeEntryAlignment > 0 : codeEntryAlignment;
+ assert checkNullAllocationStubs();
return true;
}
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Tue Oct 16 14:26:22 2018 +0530
@@ -279,21 +279,36 @@
public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class);
/**
- * New multi array stub call.
+ * New multi array stub that throws an {@link OutOfMemoryError} on allocation failure.
*/
public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, KlassPointer.class, int.class, Word.class);
/**
- * New array stub.
+ * New multi array stub that will return null on allocation failure.
+ */
+ public static final ForeignCallDescriptor NEW_MULTI_ARRAY_OR_NULL = new ForeignCallDescriptor("new_multi_array_or_null", Object.class, KlassPointer.class, int.class, Word.class);
+
+ /**
+ * New array stub that throws an {@link OutOfMemoryError} on allocation failure.
*/
public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class);
/**
- * New instance stub.
+ * New array stub that will return null on allocation failure.
+ */
+ public static final ForeignCallDescriptor NEW_ARRAY_OR_NULL = new ForeignCallDescriptor("new_array_or_null", Object.class, KlassPointer.class, int.class);
+
+ /**
+ * New instance stub that throws an {@link OutOfMemoryError} on allocation failure.
*/
public static final ForeignCallDescriptor NEW_INSTANCE = new ForeignCallDescriptor("new_instance", Object.class, KlassPointer.class);
/**
+ * New instance stub that will return null on allocation failure.
+ */
+ public static final ForeignCallDescriptor NEW_INSTANCE_OR_NULL = new ForeignCallDescriptor("new_instance_or_null", Object.class, KlassPointer.class);
+
+ /**
* @see ResolveConstantStubCall
*/
public static final ForeignCallDescriptor RESOLVE_STRING_BY_SYMBOL = new ForeignCallDescriptor("resolve_string_by_symbol", Object.class, Word.class, Word.class);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Tue Oct 16 14:26:22 2018 +0530
@@ -45,8 +45,11 @@
import static org.graalvm.compiler.hotspot.HotSpotBackend.MULTIPLY_TO_LEN;
import static org.graalvm.compiler.hotspot.HotSpotBackend.MUL_ADD;
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL;
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL;
import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL;
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_DYNAMIC_INVOKE;
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_KLASS_BY_SYMBOL;
import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_METHOD_BY_SYMBOL_AND_LOAD_COUNTERS;
@@ -78,8 +81,6 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_TOP_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITORENTER;
import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITOREXIT;
-import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_ARRAY;
-import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_INSTANCE;
import static org.graalvm.compiler.hotspot.replacements.ThreadSubstitutions.THREAD_IS_INTERRUPTED;
import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPOSTCALL;
import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPRECALL;
@@ -288,6 +289,14 @@
linkForeignCall(options, providers, NEW_INSTANCE, c.newInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
linkForeignCall(options, providers, NEW_ARRAY, c.newArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+ linkForeignCall(options, providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+
+ if (c.areNullAllocationStubsAvailable()) {
+ linkForeignCall(options, providers, NEW_INSTANCE_OR_NULL, c.newInstanceOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+ linkForeignCall(options, providers, NEW_ARRAY_OR_NULL, c.newArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+ linkForeignCall(options, providers, NEW_MULTI_ARRAY_OR_NULL, c.newMultiArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+ }
+
link(new ExceptionHandlerStub(options, providers, foreignCalls.get(EXCEPTION_HANDLER)));
link(new UnwindExceptionToCallerStub(options, providers, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any())));
link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS)));
@@ -305,11 +314,8 @@
linkForeignCall(options, providers, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
linkForeignCall(options, providers, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
linkForeignCall(options, providers, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, STACK_INSPECTABLE_LEAF, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
- linkForeignCall(options, providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
linkForeignCall(options, providers, NOTIFY, c.notifyAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
linkForeignCall(options, providers, NOTIFY_ALL, c.notifyAllAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
- linkForeignCall(options, providers, DYNAMIC_NEW_ARRAY, c.dynamicNewArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE);
- linkForeignCall(options, providers, DYNAMIC_NEW_INSTANCE, c.dynamicNewInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE);
linkForeignCall(options, providers, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
linkForeignCall(options, providers, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
linkForeignCall(options, providers, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,9 +24,17 @@
package org.graalvm.compiler.hotspot.replacements;
+import static jdk.vm.ci.meta.DeoptimizationAction.None;
+import static jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan;
-import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
+import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfigBase.INJECTED_VMCONFIG;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_ARRAY_KLASS_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION;
@@ -70,6 +78,7 @@
import static org.graalvm.compiler.replacements.nodes.ExplodeLoopNode.explodeLoop;
import org.graalvm.compiler.api.replacements.Fold;
+import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.api.replacements.Snippet.VarargsParameter;
@@ -80,7 +89,6 @@
import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
import org.graalvm.compiler.graph.Node.NodeIntrinsic;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
-import org.graalvm.compiler.hotspot.HotSpotBackend;
import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
import org.graalvm.compiler.hotspot.nodes.DimensionsNode;
@@ -126,8 +134,6 @@
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.vm.ci.meta.DeoptimizationAction;
-import jdk.vm.ci.meta.DeoptimizationReason;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaType;
@@ -220,14 +226,25 @@
if (counters != null && counters.stub != null) {
counters.stub.inc();
}
- result = newInstance(HotSpotBackend.NEW_INSTANCE, hub);
+ result = newInstanceStub(hub);
}
profileAllocation("instance", size, typeContext, options);
return verifyOop(result);
}
+ public static Object newInstanceStub(KlassPointer hub) {
+ if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+ return nonNullOrDeopt(newInstanceOrNull(NEW_INSTANCE_OR_NULL, hub));
+ } else {
+ return newInstance(NEW_INSTANCE, hub);
+ }
+ }
+
@NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
- public static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
+ private static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
+
+ @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+ private static native Object newInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
@Snippet
public static Object allocateInstancePIC(@ConstantParameter int size, KlassPointer hub, Word prototypeMarkWord, @ConstantParameter boolean fillContents,
@@ -244,18 +261,18 @@
public static Object allocateInstanceDynamic(Class<?> type, Class<?> classClass, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister,
@ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
if (probability(SLOW_PATH_PROBABILITY, type == null)) {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
Class<?> nonNullType = PiNode.piCastNonNullClass(type, SnippetAnchorNode.anchor());
if (probability(SLOW_PATH_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
- return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(type, fillContents, threadRegister, options, counters, nonNullType));
+ return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(fillContents, threadRegister, options, counters, nonNullType));
}
- private static Object allocateInstanceDynamicHelper(Class<?> type, boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) {
+ private static Object allocateInstanceDynamicHelper(boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) {
KlassPointer hub = ClassGetHubNode.readClass(nonNullType);
if (probability(FAST_PATH_PROBABILITY, !hub.isNull())) {
KlassPointer nonNullHub = ClassGetHubNode.piCastNonNull(hub, SnippetAnchorNode.anchor());
@@ -277,10 +294,11 @@
return allocateInstanceHelper(layoutHelper, nonNullHub, prototypeMarkWord, fillContents, threadRegister, false, "", options, counters);
}
} else {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
}
- return dynamicNewInstanceStub(type);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
+ return null;
}
/**
@@ -307,13 +325,30 @@
}
@Snippet
- public static Object allocateArray(KlassPointer hub, int length, Word prototypeMarkWord, @ConstantParameter int headerSize, @ConstantParameter int log2ElementSize,
- @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean maybeUnroll, @ConstantParameter String typeContext,
- @ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
+ public static Object allocateArray(KlassPointer hub,
+ int length,
+ Word prototypeMarkWord,
+ @ConstantParameter int headerSize,
+ @ConstantParameter int log2ElementSize,
+ @ConstantParameter boolean fillContents,
+ @ConstantParameter Register threadRegister,
+ @ConstantParameter boolean maybeUnroll,
+ @ConstantParameter String typeContext,
+ @ConstantParameter OptionValues options,
+ @ConstantParameter Counters counters) {
Object result = allocateArrayImpl(hub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters);
return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length);
}
+ /**
+ * When allocating on the slow path, determines whether to use a version of the runtime call
+ * that returns {@code null} on a failed allocation instead of raising an OutOfMemoryError.
+ */
+ @Fold
+ static boolean useNullAllocationStubs(@InjectedParameter GraalHotSpotVMConfig config) {
+ return config.areNullAllocationStubsAvailable();
+ }
+
private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister,
boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) {
Object result;
@@ -331,27 +366,41 @@
}
result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters);
} else {
- result = newArray(HotSpotBackend.NEW_ARRAY, hub, length);
+ result = newArrayStub(hub, length);
}
profileAllocation("array", allocationSize, typeContext, options);
return result;
}
- @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
- public static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
-
- public static final ForeignCallDescriptor DYNAMIC_NEW_ARRAY = new ForeignCallDescriptor("dynamic_new_array", Object.class, Class.class, int.class);
- public static final ForeignCallDescriptor DYNAMIC_NEW_INSTANCE = new ForeignCallDescriptor("dynamic_new_instance", Object.class, Class.class);
-
- @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
- public static native Object dynamicNewArrayStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType, int length);
-
- public static Object dynamicNewInstanceStub(Class<?> elementType) {
- return dynamicNewInstanceStubCall(DYNAMIC_NEW_INSTANCE, elementType);
+ public static Object newArrayStub(KlassPointer hub, int length) {
+ if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+ return nonNullOrDeopt(newArrayOrNull(NEW_ARRAY_OR_NULL, hub, length));
+ } else {
+ return newArray(NEW_ARRAY, hub, length);
+ }
}
@NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
- public static native Object dynamicNewInstanceStubCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
+ private static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
+
+ @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+ private static native Object newArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
+
+ /**
+ * Deoptimizes if {@code obj == null} otherwise returns {@code obj}.
+ */
+ private static Object nonNullOrDeopt(Object obj) {
+ if (obj == null) {
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
+ }
+ return obj;
+ }
+
+ @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
+ public static native Object dynamicNewInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
+
+ @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+ public static native Object dynamicNewInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
@Snippet
public static Object allocateArrayDynamic(Class<?> elementType, Class<?> voidClass, int length, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister,
@@ -369,17 +418,17 @@
*/
staticAssert(knownElementKind != JavaKind.Void, "unsupported knownElementKind");
if (knownElementKind == JavaKind.Illegal && probability(SLOW_PATH_PROBABILITY, elementType == null || DynamicNewArrayNode.throwsIllegalArgumentException(elementType, voidClass))) {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
KlassPointer klass = loadKlassFromObject(elementType, arrayKlassOffset(INJECTED_VMCONFIG), CLASS_ARRAY_KLASS_LOCATION);
if (klass.isNull()) {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
KlassPointer nonNullKlass = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor());
if (length < 0) {
- DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+ DeoptimizeNode.deopt(None, RuntimeConstraint);
}
int layoutHelper;
if (knownElementKind == JavaKind.Illegal) {
@@ -412,24 +461,35 @@
* Calls the runtime stub for implementing MULTIANEWARRAY.
*/
@Snippet
- public static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
+ private static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
Word dims = DimensionsNode.allocaDimsArray(rank);
ExplodeLoopNode.explodeLoop();
for (int i = 0; i < rank; i++) {
dims.writeInt(i * 4, dimensions[i], LocationIdentity.init());
}
- return newArrayCall(HotSpotBackend.NEW_MULTI_ARRAY, hub, rank, dims);
+ return newMultiArrayStub(hub, rank, dims);
+ }
+
+ private static Object newMultiArrayStub(KlassPointer hub, int rank, Word dims) {
+ if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+ return nonNullOrDeopt(newMultiArrayOrNull(NEW_MULTI_ARRAY_OR_NULL, hub, rank, dims));
+ } else {
+ return newMultiArray(NEW_MULTI_ARRAY, hub, rank, dims);
+ }
}
@Snippet
- public static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
+ private static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
// Array type would be resolved by dominating resolution.
KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub);
return newmultiarray(picHub, rank, dimensions);
}
@NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
- public static native Object newArrayCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
+ private static native Object newMultiArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
+
+ @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+ private static native Object newMultiArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
/**
* Maximum number of long stores to emit when zeroing an object with a constant size. Larger
@@ -509,17 +569,9 @@
}
/**
- * Formats some allocated memory with an object header and zeroes out the rest. Disables asserts
- * since they can't be compiled in stubs.
- */
- public static Object formatObjectForStub(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord) {
- return formatObject(hub, size, memory, compileTimePrototypeMarkWord, true, false, null);
- }
-
- /**
* Formats some allocated memory with an object header and zeroes out the rest.
*/
- protected static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) {
+ private static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) {
Word prototypeMarkWord = useBiasedLocking(INJECTED_VMCONFIG) ? hub.readWord(prototypeMarkWordOffset(INJECTED_VMCONFIG), PROTOTYPE_MARK_WORD_LOCATION) : compileTimePrototypeMarkWord;
initializeObjectHeader(memory, prototypeMarkWord, hub);
if (fillContents) {
@@ -532,7 +584,7 @@
}
@Snippet
- protected static void verifyHeap(@ConstantParameter Register threadRegister) {
+ private static void verifyHeap(@ConstantParameter Register threadRegister) {
Word thread = registerAsWord(threadRegister);
Word topValue = readTlabTop(thread);
if (!topValue.equal(WordFactory.zero())) {
@@ -546,7 +598,7 @@
/**
* Formats some allocated memory with an object header and zeroes out the rest.
*/
- public static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll,
+ private static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll,
Counters counters) {
memory.writeInt(arrayLengthOffset(INJECTED_VMCONFIG), length, LocationIdentity.init());
/*
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -34,6 +34,8 @@
import java.util.Map;
import java.util.Set;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
@@ -41,6 +43,7 @@
import com.sun.tools.javac.code.DeferredCompletionFailureHandler;
import com.sun.tools.javac.code.Symbol.Completer;
import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.comp.Enter;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -213,6 +216,17 @@
dcfh.setHandler(dcfh.userCodeHandler);
etable.analyze();
+
+ // Ensure that package-info is read for all included packages
+ for (Element e : etable.getIncludedElements()) {
+ if (e.getKind() == ElementKind.PACKAGE) {
+ PackageSymbol packge = (PackageSymbol) e;
+ if (packge.package_info != null) {
+ packge.package_info.complete();
+ }
+ }
+ }
+
} catch (CompletionFailure cf) {
throw new ToolException(ABNORMAL, cf.getMessage(), cf);
} catch (Abort abort) {
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Tue Oct 16 14:26:22 2018 +0530
@@ -236,15 +236,7 @@
final MethodImpl method,
final ValueImpl[] args,
final int options) {
- /*
- * Cache the values of args when TRACE_SENDS is enabled, for later printing.
- * If not cached, printing causes a remote call while synchronized, and deadlock.
- */
- if ((vm.traceFlags & VirtualMachine.TRACE_SENDS) != 0) {
- for (ValueImpl arg: args) {
- arg.toString();
- }
- }
+
CommandSender sender = getInvokeMethodSender(thread, method, args, options);
PacketStream stream;
if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -26,10 +26,7 @@
package com.sun.tools.jdi;
import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.ThreadReference;
@@ -44,12 +41,10 @@
/*
* Certain information can be cached only when the entire VM is
- * suspended and there are no pending resumes. The fields below
- * are used to track whether there are pending resumes. (There
- * is an assumption that JDWP command ids are increasing over time.)
+ * suspended and there are no pending resumes. The field below
+ * is used to track whether there are pending resumes.
*/
- private int lastCompletedCommandId = 0; // synchronized (this)
- private int lastResumeCommandId = 0; // synchronized (this)
+ private final Set<Integer> pendingResumeCommands = Collections.synchronizedSet(new HashSet<>());
// This is cached only while the VM is suspended
private static class Cache {
@@ -97,12 +92,12 @@
* A JDWP command has been completed (reply has been received).
* Update data that tracks pending resume commands.
*/
- synchronized void notifyCommandComplete(int id) {
- lastCompletedCommandId = id;
+ void notifyCommandComplete(int id) {
+ pendingResumeCommands.remove(id);
}
synchronized void freeze() {
- if (cache == null && (lastCompletedCommandId >= lastResumeCommandId)) {
+ if (cache == null && (pendingResumeCommands.isEmpty())) {
/*
* No pending resumes to worry about. The VM is suspended
* and additional state can be cached. Notify all
@@ -115,7 +110,7 @@
synchronized PacketStream thawCommand(CommandSender sender) {
PacketStream stream = sender.send();
- lastResumeCommandId = stream.id();
+ pendingResumeCommands.add(stream.id());
thaw();
return stream;
}
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java Tue Oct 16 14:26:22 2018 +0530
@@ -70,7 +70,7 @@
endClass();
byte[] bytes = classWriter.toByteArray();
ASMToolkit.logASM(fullClassName, bytes);
- return SecuritySupport.defineClass(type.getInternalName(), bytes, Event.class.getClassLoader()).asSubclass(Event.class);
+ return SecuritySupport.defineClass(Event.class, bytes).asSubclass(Event.class);
}
private void endClass() {
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventHandlerCreator.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventHandlerCreator.java Tue Oct 16 14:26:22 2018 +0530
@@ -134,7 +134,7 @@
buildWriteMethod();
byte[] bytes = classWriter.toByteArray();
ASMToolkit.logASM(className, bytes);
- return SecuritySupport.defineClass(className, bytes, Event.class.getClassLoader()).asSubclass(EventHandler.class);
+ return SecuritySupport.defineClass(EventHandler.class, bytes).asSubclass(EventHandler.class);
}
public static EventHandler instantiateEventHandler(Class<? extends EventHandler> handlerClass, boolean registered, EventType eventType, EventControl eventControl) throws Error {
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/SecuritySupport.java Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/SecuritySupport.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,6 +31,7 @@
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Reader;
+import java.lang.invoke.MethodHandles;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -71,6 +72,7 @@
*/
public final class SecuritySupport {
private final static Unsafe unsafe = Unsafe.getUnsafe();
+ private final static MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
private final static Module JFR_MODULE = Event.class.getModule();
public final static SafePath JFC_DIRECTORY = getPathInProperty("java.home", "lib/jfr");
@@ -381,8 +383,17 @@
unsafe.ensureClassInitialized(clazz);
}
- static Class<?> defineClass(String name, byte[] bytes, ClassLoader classLoader) {
- return unsafe.defineClass(name, bytes, 0, bytes.length, classLoader, null);
+ static Class<?> defineClass(Class<?> lookupClass, byte[] bytes) {
+ return AccessController.doPrivileged(new PrivilegedAction<>() {
+ @Override
+ public Class<?> run() {
+ try {
+ return MethodHandles.privateLookupIn(lookupClass, LOOKUP).defineClass(bytes);
+ } catch (IllegalAccessException e) {
+ throw new InternalError(e);
+ }
+ }
+ });
}
static Thread createThreadWitNoPermissions(String threadName, Runnable runnable) {
--- a/src/jdk.pack/share/native/common-unpack/constants.h Mon Oct 15 10:29:06 2018 +0530
+++ b/src/jdk.pack/share/native/common-unpack/constants.h Tue Oct 16 14:26:22 2018 +0530
@@ -203,7 +203,7 @@
AO_HAVE_FIELD_FLAGS_HI = 1<<10,
AO_HAVE_METHOD_FLAGS_HI = 1<<11,
AO_HAVE_CODE_FLAGS_HI = 1<<12,
- AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use.
+ AO_UNUSED_MBZ = (int)((~0U)<<13), // options bits reserved for future use.
#define ARCHIVE_BIT_DO(F) \
F(AO_HAVE_SPECIAL_FORMATS) \
--- a/test/TestCommon.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/test/TestCommon.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -178,20 +178,6 @@
endif
endif
-
-# Optionally create a CDS archive before running tests
-ifeq ($(GENERATE_CDS_ARCHIVE), true)
- CDS_ARCHIVE_FILE := $(ABS_TEST_OUTPUT_DIR)/cds_archive.jsa
-
- $(CDS_ARCHIVE_FILE): $(PRODUCT_HOME)
- $(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
- -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") -Xshare:dump
-
- CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)")
- JTREG_TEST_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
- TEST_PREREQS += $(CDS_ARCHIVE_FILE)
-endif
-
# How to create the test bundle (pass or fail, we want to create this)
# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
ifneq ($(ARCHIVE_BUNDLE), )
--- a/test/hotspot/jtreg/Makefile Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/Makefile Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,6 @@
NATIVE_TEST_PATH := hotspot/jtreg/native
-TREAT_EXIT_CODE_1_AS_0 := true
-
CLEAN_BEFORE_PREP := true
USE_JTREG_VERSION := 4.1
--- a/test/hotspot/jtreg/ProblemList-cds-mode.txt Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#
-# Copyright (c) 2018, 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.
-#
-
-#############################################################################
-#
-# Additional list of quarantined tests when CDS mode enabled.
-#
-#############################################################################
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/ProblemList-non-cds-mode.txt Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2018, 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.
+#
+
+#############################################################################
+#
+# Additional list of quarantined tests when non-CDS mode enabled.
+#
+#############################################################################
+
--- a/test/hotspot/jtreg/ProblemList.txt Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/ProblemList.txt Tue Oct 16 14:26:22 2018 +0530
@@ -59,6 +59,8 @@
compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
+compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x
+
#############################################################################
# :hotspot_gc
@@ -84,7 +86,6 @@
runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
runtime/RedefineTests/RedefineRunningMethods.java 8208778 macosx-x64
runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
-runtime/XCheckJniJsig/XCheckJSig.java 8211084 macosx-x64
#############################################################################
@@ -92,50 +93,50 @@
serviceability/sa/ClhsdbAttach.java 8193639 solaris-all
serviceability/sa/ClhsdbCDSCore.java 8193639 solaris-all
-serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all
+serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/CDSJMapClstats.java 8193639 solaris-all
serviceability/sa/ClhsdbField.java 8193639 solaris-all
-serviceability/sa/ClhsdbFindPC.java 8193639 solaris-all
+serviceability/sa/ClhsdbFindPC.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbFlags.java 8193639 solaris-all
-serviceability/sa/ClhsdbInspect.java 8193639 solaris-all
-serviceability/sa/ClhsdbJdis.java 8193639 solaris-all
-serviceability/sa/ClhsdbJhisto.java 8193639 solaris-all
-serviceability/sa/ClhsdbJstack.java 8193639 solaris-all
+serviceability/sa/ClhsdbInspect.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJdis.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJhisto.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbLongConstant.java 8193639 solaris-all
-serviceability/sa/ClhsdbPmap.java 8193639 solaris-all
+serviceability/sa/ClhsdbPmap.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbPrintAll.java 8193639 solaris-all
-serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
+serviceability/sa/ClhsdbPrintAs.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
-serviceability/sa/ClhsdbPstack.java 8193639 solaris-all
+serviceability/sa/ClhsdbPstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
-serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all
-serviceability/sa/ClhsdbSource.java 8193639 solaris-all
+serviceability/sa/ClhsdbScanOops.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbSource.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbSymbol.java 8193639 solaris-all
serviceability/sa/ClhsdbSymbolTable.java 8193639 solaris-all
-serviceability/sa/ClhsdbThread.java 8193639 solaris-all
+serviceability/sa/ClhsdbThread.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all
-serviceability/sa/ClhsdbWhere.java 8193639 solaris-all
-serviceability/sa/DeadlockDetectionTest.java 8193639 solaris-all
-serviceability/sa/JhsdbThreadInfoTest.java 8193639 solaris-all
+serviceability/sa/ClhsdbWhere.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/DeadlockDetectionTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/JhsdbThreadInfoTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java 8193639 solaris-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/sa/TestClassDump.java 8193639 solaris-all
-serviceability/sa/TestClhsdbJstackLock.java 8193639 solaris-all
-serviceability/sa/TestCpoolForInvokeDynamic.java 8193639 solaris-all
+serviceability/sa/TestClhsdbJstackLock.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/TestCpoolForInvokeDynamic.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/TestDefaultMethods.java 8193639 solaris-all
serviceability/sa/TestG1HeapRegion.java 8193639 solaris-all
serviceability/sa/TestHeapDumpForInvokeDynamic.java 8193639 solaris-all
serviceability/sa/TestHeapDumpForLargeArray.java 8193639 solaris-all
serviceability/sa/TestInstanceKlassSize.java 8193639 solaris-all
serviceability/sa/TestInstanceKlassSizeForInterface.java 8193639 solaris-all
-serviceability/sa/TestIntConstant.java 8193639 solaris-all
-serviceability/sa/TestJhsdbJstackLock.java 8193639 solaris-all
+serviceability/sa/TestIntConstant.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/TestJhsdbJstackLock.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/TestJmapCore.java 8193639 solaris-all
serviceability/sa/TestJmapCoreMetaspace.java 8193639 solaris-all
serviceability/sa/TestPrintMdo.java 8193639 solaris-all
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
serviceability/sa/TestType.java 8193639 solaris-all
-serviceability/sa/TestUniverse.java#id0 8193639 solaris-all
+serviceability/sa/TestUniverse.java#id0 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
#############################################################################
--- a/test/hotspot/jtreg/compiler/escapeAnalysis/TestArrayCopy.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/escapeAnalysis/TestArrayCopy.java Tue Oct 16 14:26:22 2018 +0530
@@ -33,7 +33,7 @@
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
*
- * @run main/othervm
+ * @run main/othervm/timeout=300
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
--- a/test/hotspot/jtreg/compiler/graalunit/JttLangMathALTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangMathALTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -34,5 +34,6 @@
*
* @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
*
- * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.Math_[a-lA-L] -exclude ExcludeList.txt
+ * @run main/othervm/timeout=300 compiler.graalunit.common.GraalUnitTestLauncher
+ * -prefix org.graalvm.compiler.jtt.lang.Math_[a-lA-L] -exclude ExcludeList.txt
*/
--- a/test/hotspot/jtreg/compiler/graalunit/JttLangMathMZTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangMathMZTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -34,5 +34,6 @@
*
* @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
*
- * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.Math_[m-zM-Z] -exclude ExcludeList.txt
+ * @run main/othervm/timeout=300 compiler.graalunit.common.GraalUnitTestLauncher
+ * -prefix org.graalvm.compiler.jtt.lang.Math_[m-zM-Z] -exclude ExcludeList.txt
*/
--- a/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,7 +25,7 @@
* @test
* @library /test/lib /
*
- * @run driver compiler.jsr292.ContinuousCallSiteTargetChange
+ * @run driver/timeout=300 compiler.jsr292.ContinuousCallSiteTargetChange
*/
package compiler.jsr292;
--- a/test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/RedefineTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/RedefineTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -48,7 +48,6 @@
package compiler.jsr292.NonInlinedCall;
-import jdk.internal.misc.Unsafe;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.vm.annotation.DontInline;
@@ -68,13 +67,15 @@
public class RedefineTest {
static final MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
- static final Unsafe UNSAFE = Unsafe.getUnsafe();
-
static final String NAME = "compiler/jsr292/NonInlinedCall/RedefineTest$T";
static Class<?> getClass(int r) {
byte[] classFile = getClassFile(r);
- return UNSAFE.defineClass(NAME, classFile, 0, classFile.length, null, null);
+ try {
+ return MethodHandles.lookup().defineClass(classFile);
+ } catch (IllegalAccessException e) {
+ throw new Error(e);
+ }
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/regalloc/VolatileLoadMemBarsOnlyUses.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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.
+ */
+
+/**
+ * @test
+ * @bug 8210389
+ * @summary C2: assert(n->outcnt() != 0 || C->top() == n || n->is_Proj()) failed: No dead instructions after post-alloc
+ *
+ * @run main/othervm -Xcomp -XX:CompileOnly=VolatileLoadMemBarsOnlyUses VolatileLoadMemBarsOnlyUses
+ *
+ */
+
+public class VolatileLoadMemBarsOnlyUses {
+
+ public static final int N = 400;
+ public static long instanceCount=-94L;
+ public static volatile byte byFld=-108;
+
+ public int mainTest(String[] strArr1) {
+
+ int i17=9, i19=1, i20=63, i21=-32916, i22=0, iArr[]=new int[N];
+ boolean b1=false;
+ double d3=76.18241;
+
+ for (int i : iArr) {
+ for (i17 = 2; i17 < 63; i17++) {
+ if (b1) break;
+ byFld += (byte)(0.131F + (i17 * i17));
+ }
+ for (i19 = 1; 63 > i19; ++i19) {
+ for (i21 = 1; i21 < 2; i21++) {
+ d3 = i22;
+ if (b1) continue;
+ i20 = i21;
+ }
+ d3 -= byFld;
+ instanceCount = 46725L;
+ }
+ switch ((((i22 >>> 1) % 4) * 5) + 91) {
+ case 98:
+ break;
+ case 110:
+ break;
+ case 105:
+ break;
+ case 103:
+ break;
+ default:
+ }
+ }
+
+ return i20;
+ }
+ public static void main(String[] strArr) {
+ VolatileLoadMemBarsOnlyUses _instance = new VolatileLoadMemBarsOnlyUses();
+ for (int i = 0; i < 10; i++ ) {
+ _instance.mainTest(strArr);
+ }
+ }
+}
--- a/test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,6 +32,9 @@
* java.base/jdk.internal.vm.annotation
* java.base/jdk.internal.misc
*
+ * @library ../jsr292/patches
+ * @build java.base/java.lang.invoke.MethodHandleHelper
+ *
* @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
* -Xbatch -XX:-TieredCompilation
* -XX:+FoldStableValues
@@ -64,6 +67,9 @@
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
+import java.lang.invoke.MethodHandleHelper;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -393,8 +399,9 @@
}
Test generate() {
- Class<?> c = U.defineClass(className, classFile, 0, classFile.length, THIS_CLASS.getClassLoader(), null);
try {
+ Lookup lookup = MethodHandleHelper.IMPL_LOOKUP.in(MethodHandles.class);
+ Class<?> c = lookup.defineClass(classFile);
return (Test) c.newInstance();
} catch(Exception e) {
throw new Error(e);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/epsilon/TestAlignment.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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.
+ */
+
+/**
+ * @test TestAlignment
+ * @key gc
+ * @requires vm.gc.Epsilon & !vm.graal.enabled
+ * @summary Check Epsilon runs fine with (un)usual alignments
+ * @bug 8212005
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:+UseTLAB TestAlignment
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:-UseTLAB TestAlignment
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:+UseTLAB -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestAlignment
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:-UseTLAB -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestAlignment
+ */
+
+public class TestAlignment {
+ static Object sink;
+
+ public static void main(String[] args) throws Exception {
+ for (int c = 0; c < 1000; c++) {
+ sink = new byte[c];
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Google 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.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import sun.hotspot.WhiteBox;
+
+/*
+ * @test TestMetaSpaceLog
+ * @bug 8211123
+ * @summary Ensure that the Metaspace is updated in the log
+ * @requires vm.gc=="null"
+ * @key gc
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ *
+ * @compile TestMetaSpaceLog.java
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main TestMetaSpaceLog
+ */
+
+public class TestMetaSpaceLog {
+ private static Pattern metaSpaceRegexp;
+
+ static {
+ // Do this once here.
+ metaSpaceRegexp = Pattern.compile(".*Metaspace: ([0-9]+).*->([0-9]+).*");
+ }
+
+ public static void main(String[] args) throws Exception {
+ testMetaSpaceUpdate("UseParallelGC");
+ testMetaSpaceUpdate("UseG1GC");
+ testMetaSpaceUpdate("UseConcMarkSweepGC");
+ testMetaSpaceUpdate("UseSerialGC");
+ }
+
+ private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
+ Predicate<String> collectedMetaSpace = line -> check(line);
+
+ // At least one metaspace line from GC should show GC being collected.
+ boolean foundCollectedMetaSpace = output.asLines().stream()
+ .filter(s -> s.contains("[gc,metaspace"))
+ .anyMatch(TestMetaSpaceLog::check);
+ Asserts.assertTrue(foundCollectedMetaSpace);
+ }
+
+ private static boolean check(String line) {
+ Matcher m = metaSpaceRegexp.matcher(line);
+ Asserts.assertTrue(m.matches(), "Unexpected line for metaspace logging: " + line);
+ long before = Long.parseLong(m.group(1));
+ long after = Long.parseLong(m.group(2));
+ return before > after;
+ }
+
+ private static void testMetaSpaceUpdate(String gcFlag) throws Exception {
+ // Propagate test.src for the jar file.
+ String testSrc= "-Dtest.src=" + System.getProperty("test.src", ".");
+
+ System.err.println("Testing with GC Flag: " + gcFlag);
+ ProcessBuilder pb =
+ ProcessTools.createJavaProcessBuilder(
+ "-XX:+" + gcFlag,
+ "-Xlog:gc*",
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ "-Xmx1000M",
+ "-Xms1000M",
+ testSrc, StressMetaSpace.class.getName());
+
+ OutputAnalyzer output = null;
+ try {
+ output = new OutputAnalyzer(pb.start());
+ verifyContainsMetaSpaceUpdate(output);
+ } catch (Exception e) {
+ // For error diagnosis: print and throw.
+ e.printStackTrace();
+ output.reportDiagnosticSummary();
+ throw e;
+ }
+ }
+
+ static class StressMetaSpace {
+ private static URL[] urls = new URL[1];
+
+ static {
+ try {
+ File jarFile = new File(System.getProperty("test.src") + "/testcases.jar");
+ urls[0] = jarFile.toURI().toURL();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[]) {
+ WhiteBox wb = WhiteBox.getWhiteBox();
+ for(int i = 0; i < 10000; i++) {
+ loadClass(wb);
+ }
+ wb.fullGC();
+ }
+
+ public static void loadClass(WhiteBox wb) {
+ try {
+ URLClassLoader ucl = new URLClassLoader(urls);
+ Class.forName("case00", false, ucl);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Binary file test/hotspot/jtreg/gc/logging/testcases.jar has changed
--- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java Tue Oct 16 14:26:22 2018 +0530
@@ -57,11 +57,10 @@
static class Test {
public static void test() throws Exception {
- Unsafe unsafe = Unsafe.getUnsafe();
TestClassLoader classloader = new TestClassLoader();
ProtectionDomain pd = new ProtectionDomain(null, null);
byte klassbuf[] = InMemoryJavaCompiler.compile("TestClass", "class TestClass { }");
- Class klass = unsafe.defineClass(null, klassbuf, 0, klassbuf.length, classloader, pd);
+ Class<?> klass = classloader.defineClass("TestClass", klassbuf, pd);
}
public static void main(String[] args) throws Exception {
@@ -91,6 +90,10 @@
public TestClassLoader() {
super();
}
+
+ public Class<?> defineClass(String name, byte[] bytes, ProtectionDomain pd) {
+ return defineClass(name, bytes, 0, bytes.length, pd);
+ }
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/InnerClassesAttr/Base.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ */
+
+package com.g;
+class Base {
+ static class Builder { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/InnerClassesAttr/Child.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ */
+
+package com.g;
+public final class Child extends Base {
+ public Builder setJobName() {
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/InnerClassesAttr/InnerClassesTest.jasm Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8079784
+ * @compile InnerClassesTest.jasm Base.java Child.java
+ * @run main com.n.InnerClassesTest
+ */
+
+// Test that if a class's InnerClasses attribute contains a class that is not
+// accessible to the class with the attribute then an IllegalAccessError
+// exception should not get thrown as a result of the class accessing other
+// classes in the InnerClasses attribute.
+//
+// In this test, class InnerClassesTest has an InnerClasses attribute with two
+// entries. One for inaccessable (non-public) class com/g/Base and class
+// con/g/Base$Builder. And, one entry for classes com/n/InnerClassTest and
+// com/n/InnerClasses/Test$Foo. The test accesses com/n/InnerClsses/Test$Foo
+// by calling getSimpleName(). This should not cause an IllegalAccessError
+// exception to get thrown.
+//
+//
+// This jasm code was generated from the following Java code. The only
+// difference is that, in the jasm code, the order of the entries in the
+// InnerClasses attributes for class InnerClassesTest were switched.
+//
+// package com.n;
+// import com.g.Child;
+//
+// public final class InnerClassesTest {
+//
+// public static final class Foo { }
+// void unused() {
+// new Child().setJobName();
+// }
+//
+// public static void main(String[] args) {
+// Class<?> clazz = InnerClassesTest.Foo.class;
+// clazz.getSimpleName();
+// }
+// }
+
+package com/n;
+
+super public final class InnerClassesTest$Foo version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+public static final InnerClass Foo=class InnerClassesTest$Foo of class InnerClassesTest;
+
+} // end Class InnerClassesTest$Foo
+
+
+super public final class InnerClassesTest version 53:0 {
+
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ Method unused:"()V" stack 2 locals 1 {
+ new class com/g/Child;
+ dup;
+ invokespecial Method com/g/Child."<init>":"()V";
+ invokevirtual Method com/g/Child.setJobName:"()Lcom/g/Base$Builder;";
+ pop;
+ return;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 1 locals 2 {
+ ldc class InnerClassesTest$Foo;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/Class.getSimpleName:"()Ljava/lang/String;";
+ pop;
+ return;
+ }
+
+static InnerClass Builder=class com/g/Base$Builder of class com/g/Base;
+public static final InnerClass Foo=class InnerClassesTest$Foo of class InnerClassesTest;
+
+} // end Class InnerClassesTest
--- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8046171
+ * @bug 8046171 8211065
* @summary Setup nestmate calls to private methods then use
* modified jcod classes to introduce errors. Test with
* and without verification enabled
@@ -96,14 +96,10 @@
System.out.println("Got expected exception:" + nsme);
}
- try {
- MissingMethodWithSuper m = new MissingMethodWithSuper();
- m.priv_invoke();
- throw new Error("Unexpected success invoking MissingMethodWithSuper.priv_invoke");
- }
- catch (NoSuchMethodError nsme) {
- System.out.println("Got expected exception:" + nsme);
- }
+ // This test was revised to expect successful invocation of the
+ // super class method - see JDK-8211065
+ MissingMethodWithSuper m = new MissingMethodWithSuper();
+ m.priv_invoke();
// Verification of Helper will trigger the nestmate access check failure
try {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/PrintStringTableStats/PrintStringTableStatsTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018, 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 jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+/*
+ * @test PrintStringTableStatsTest
+ * @bug 8211821
+ * @library /test/lib
+ * @run main PrintStringTableStatsTest
+ */
+
+public class PrintStringTableStatsTest {
+ public static void main(String... args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+PrintStringTableStatistics",
+ "--version");
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Number of buckets");
+ output.shouldHaveExitValue(0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test Default CDS archive file
+ * @summary JDK platforms/binaries do not support default CDS archive should
+ * not contain classes.jsa in the default location.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI CheckDefaultArchiveFile
+ */
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cds.CDSTestUtils;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckDefaultArchiveFile {
+ public static void main(String[] args) throws Exception {
+ WhiteBox wb = WhiteBox.getWhiteBox();
+ String osArch = Platform.getOsArch();
+ String vmName = System.getProperty("java.vm.name");
+ String vmString = vmName + "(" + osArch + ")";
+ String jsaString = wb.getDefaultArchivePath();
+ Path jsa = Paths.get(jsaString);
+ if (Platform.isDefaultCDSArchiveSupported()) {
+ if (Files.exists(jsa)) {
+ System.out.println("Passed. " + vmString +
+ ": has default classes.jsa file");
+ } else {
+ throw new RuntimeException(vmString + "has no " + jsaString);
+ }
+ } else {
+ throw new SkippedException("Default CDS archive is not supported");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckSharingWithDefaultArchive.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test Default CDS archive
+ * @summary Sharing should be enabled by default on supported platform/binaries.
+ * No -Xshare:dump is needed. No -Xshare:auto or -Xshare:on in needed.
+ * Verify a set of well-known shared classes.
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI CheckSharingWithDefaultArchive -showversion
+ */
+import jdk.test.lib.Platform;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckSharingWithDefaultArchive {
+ public static void main(String[] args) throws Exception {
+ if (!Platform.isDefaultCDSArchiveSupported()) {
+ throw new SkippedException("Supported platform");
+ }
+
+ WhiteBox wb = WhiteBox.getWhiteBox();
+ String classes[] = {"java.lang.Object",
+ "java.lang.String",
+ "java.lang.Class"};
+ // If maping fails, sharing is disabled
+ if (wb.isSharingEnabled()) {
+ for (int i = 0; i < classes.length; i++) {
+ Class c = Class.forName(classes[i]);
+ if (wb.isSharedClass(c)) {
+ System.out.println(classes[i] + " is shared.");
+ } else {
+ throw new RuntimeException(classes[i] + " is not shared");
+ }
+ }
+ } else {
+ throw new SkippedException("Sharing is not enabled.");
+ }
+ }
+}
--- a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java Tue Oct 16 14:26:22 2018 +0530
@@ -44,29 +44,21 @@
System.out.println("Regression test for bugs 7051189 and 8023393");
String jdk_path = System.getProperty("test.jdk");
- String os_arch = Platform.getOsArch();
String libjsig;
String env_var;
if (Platform.isOSX()) {
env_var = "DYLD_INSERT_LIBRARIES";
- libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location
- if (!(new File(libjsig).exists())) {
- libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
- }
+ libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
} else {
env_var = "LD_PRELOAD";
- libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location
- if (!(new File(libjsig).exists())) {
- libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location
- }
+ libjsig = jdk_path + "/lib/libjsig.so"; // jre location
}
// If this test fails, these might be useful to know.
System.out.println("libjsig: " + libjsig);
- System.out.println("osArch: " + os_arch);
// Make sure the libjsig file exists.
if (!(new File(libjsig).exists())) {
- throw new jtreg.SkippedException("File " + libjsig + " not found");
+ throw new RuntimeException("File libjsig not found, path: " + libjsig);
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,7 +24,10 @@
/*
* @test CommandLineFlagCombo
- * @requires vm.cds
+ * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
* @requires (vm.gc=="null")
* @summary Test command line flag combinations that
* could likely affect the behaviour of AppCDS
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,6 @@
* @test
* @summary Test automatic relocation of archive heap regions dur to heap size changes.
* @requires vm.cds.archived.java.heap
- * @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @compile ../test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,6 +26,9 @@
* @test
* @summary Test open archive heap regions
* @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationApp.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationApp.java Tue Oct 16 14:26:22 2018 +0530
@@ -116,10 +116,10 @@
System.out.println("INFO: AppCDSv1 " + (wb.isSharedClass(InstrumentationApp.class) ? "enabled" :"disabled"));
System.out.println("INFO: AppCDSv2 " + (isAppCDSV2Enabled() ? "enabled" : "disabled"));
- File bootJar = new File(args[0]);
- File appJar = new File(args[1]);
- File custJar = new File(args[2]);
- String flagFile = args[3];
+ String flagFile = args[0];
+ File bootJar = new File(args[1]);
+ File appJar = new File(args[2]);
+ File custJar = new File(args[3]);
waitAttach(flagFile);
instrumentation = InstrumentationRegisterClassFileTransformer.getInstrumentation();
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -120,7 +120,7 @@
"-XX:+WhiteBoxAPI",
"-Xshare:off",
agentCmdArg,
- "InstrumentationApp", bootJar, appJar, custJar, flagFile);
+ "InstrumentationApp", flagFile, bootJar, appJar, custJar);
TestCommon.executeAndLog(pb, "no-sharing").shouldHaveExitValue(0);
checkAttach(t);
@@ -155,7 +155,7 @@
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
agentCmdArg,
- "InstrumentationApp", bootJar, appJar, custJar, flagFile);
+ "InstrumentationApp", flagFile, bootJar, appJar, custJar);
CDSOptions opts = (new CDSOptions()).setXShareMode("auto");
TestCommon.checkExec(out, opts);
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,6 +27,9 @@
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_noCompactStrings.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_noCompactStrings.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,6 +27,9 @@
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_stringDedup.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_stringDedup.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,6 +27,9 @@
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,7 @@
* @test
* @summary Regression test for JDK-8098821
* @bug 8098821
- * @requires vm.cds
- * @requires vm.gc.G1
+ * @requires vm.cds.archived.java.heap
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java Tue Oct 16 14:26:22 2018 +0530
@@ -85,10 +85,14 @@
System.out.println("Calling getThreadCpuTime ...");
long t1 = mbean.getThreadCpuTime(t.getId());
if (t1 != -1) {
- throw new RuntimeException("Invalid ThreadCpuTime returned = " +
- t1 + " expected = -1");
+ // At least on PPC, we know threads can still be around a short
+ // instant. In some stress scenarios we seem to grab times of
+ // new threads started with the same thread id. In these cases
+ // we get here.
+ System.out.println("Unexpected: thread still reports CPU time: " + t1);
+ } else {
+ System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
}
- System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
} else {
System.out.println("Skipping Thread CPU time test as it's not supported");
}
@@ -96,10 +100,14 @@
System.out.println("Calling getThreadUserTime ...");
long t1 = mbean.getThreadUserTime(t.getId());
if (t1 != -1) {
- throw new RuntimeException("Invalid ThreadUserTime returned = " +
- t1 + " expected = -1");
+ // At least on PPC, we know threads can still be around a short
+ // instant. In some stress scenarios we seem to grab times of
+ // new threads started with the same thread id. In these cases
+ // we get here.
+ System.out.println("Unexpected: thread still reports User time: " + t1);
+ } else {
+ System.out.println("Okay: getThreadUserTime() reported -1 as expected");
}
- System.out.println("Okay: getThreadUserTime() reported -1 as expected");
System.out.println("Calling getThreadInfo ...");
ThreadInfo info = mbean.getThreadInfo(t.getId());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8211065
+ * @summary Test that deleting a subclass method implementation results in
+ * execution of a superclass implementation - if it is accessible.
+ * @compile TestDeletedMethod.java
+ * @compile TestDeletedMethod_Sub.jcod TestDeletedMethod_Super.jcod
+ * @run main/othervm -XX:+RelaxAccessControlCheck TestDeletedMethod
+ */
+
+// The access control relaxation was originally done to ensure an assertion
+// in the nestmate logic would not trigger unintentionally because it
+// assumed only nestmates could be involved. The assertion no longer exists
+// but we keep the test as a non-nestmate version of the situation.
+
+/* package */ class TestDeletedMethod_Super {
+ public static final int ID = 2;
+ private static int m() {
+ System.out.println("Super.m");
+ return ID;
+ }
+}
+
+/* package */ class TestDeletedMethod_Sub extends TestDeletedMethod_Super {
+ public static final int ID = 1;
+ // At runtime this implementation is not present
+ private static int m() {
+ System.out.println("Sub.m");
+ return ID;
+ }
+ public static int test() {
+ return TestDeletedMethod_Sub.m();
+ }
+}
+
+public class TestDeletedMethod {
+ public static void main(String[] args) {
+ int x = TestDeletedMethod_Sub.test();
+ if (x != TestDeletedMethod_Super.ID)
+ throw new RuntimeException("Wrong method invoked: " + x);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Sub.jcod Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+// We have deleted the local method m() by renaming it
+// We have set the class file version to 49 to allow relaxed access checks
+
+class TestDeletedMethod_Sub {
+ 0xCAFEBABE;
+ 0; // minor version
+ 49; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ Method #7 #21; // #1
+ Field #22 #23; // #2
+ String #24; // #3
+ Method #25 #26; // #4
+ class #27; // #5
+ Method #5 #28; // #6
+ class #29; // #7
+ Utf8 "ID"; // #8
+ Utf8 "I"; // #9
+ Utf8 "ConstantValue"; // #10
+ int 0x00000001; // #11
+ Utf8 "<init>"; // #12
+ Utf8 "()V"; // #13
+ Utf8 "Code"; // #14
+ Utf8 "LineNumberTable"; // #15
+ Utf8 "m"; // #16
+ Utf8 "()I"; // #17
+ Utf8 "test"; // #18
+ Utf8 "SourceFile"; // #19
+ Utf8 "TestDeletedMethod.java"; // #20
+ NameAndType #12 #13; // #21
+ class #30; // #22
+ NameAndType #31 #32; // #23
+ Utf8 "Sub.m"; // #24
+ class #33; // #25
+ NameAndType #34 #35; // #26
+ Utf8 "TestDeletedMethod_Sub"; // #27
+ NameAndType #16 #17; // #28
+ Utf8 "TestDeletedMethod_Super"; // #29
+ Utf8 "java/lang/System"; // #30
+ Utf8 "out"; // #31
+ Utf8 "Ljava/io/PrintStream;"; // #32
+ Utf8 "java/io/PrintStream"; // #33
+ Utf8 "println"; // #34
+ Utf8 "(Ljava/lang/String;)V"; // #35
+ Utf8 "m_renamed"; // #36 added
+ } // Constant Pool
+
+ 0x0020; // access
+ #5;// this_cpx
+ #7;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ { // Member
+ 0x0019; // access
+ #8; // name_cpx
+ #9; // sig_cpx
+ [] { // Attributes
+ Attr(#10) { // ConstantValue
+ #11;
+ } // end ConstantValue
+ } // Attributes
+ } // Member
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0000; // access
+ #12; // name_cpx
+ #13; // sig_cpx
+ [] { // Attributes
+ Attr(#14) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x2AB70001B1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#15) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 43;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x000A; // access
+ #36; // name_cpx UPDATED to rename method
+ #17; // sig_cpx
+ [] { // Attributes
+ Attr(#14) { // Code
+ 2; // max_stack
+ 0; // max_locals
+ Bytes[]{
+ 0xB200021203B60004;
+ 0x04AC;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#15) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 47;
+ 8 48;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0009; // access
+ #18; // name_cpx
+ #17; // sig_cpx
+ [] { // Attributes
+ Attr(#14) { // Code
+ 1; // max_stack
+ 0; // max_locals
+ Bytes[]{
+ 0xB80006AC;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#15) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 51;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ Attr(#19) { // SourceFile
+ #20;
+ } // end SourceFile
+ } // Attributes
+} // end class TestDeletedMethod_Sub
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Super.jcod Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+// We have set the class file version to 49 to allow relaxed access checks
+
+class TestDeletedMethod_Super {
+ 0xCAFEBABE;
+ 0; // minor version
+ 49; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ Method #6 #19; // #1
+ Field #20 #21; // #2
+ String #22; // #3
+ Method #23 #24; // #4
+ class #25; // #5
+ class #26; // #6
+ Utf8 "ID"; // #7
+ Utf8 "I"; // #8
+ Utf8 "ConstantValue"; // #9
+ int 0x00000002; // #10
+ Utf8 "<init>"; // #11
+ Utf8 "()V"; // #12
+ Utf8 "Code"; // #13
+ Utf8 "LineNumberTable"; // #14
+ Utf8 "m"; // #15
+ Utf8 "()I"; // #16
+ Utf8 "SourceFile"; // #17
+ Utf8 "TestDeletedMethod.java"; // #18
+ NameAndType #11 #12; // #19
+ class #27; // #20
+ NameAndType #28 #29; // #21
+ Utf8 "Super.m"; // #22
+ class #30; // #23
+ NameAndType #31 #32; // #24
+ Utf8 "TestDeletedMethod_Super"; // #25
+ Utf8 "java/lang/Object"; // #26
+ Utf8 "java/lang/System"; // #27
+ Utf8 "out"; // #28
+ Utf8 "Ljava/io/PrintStream;"; // #29
+ Utf8 "java/io/PrintStream"; // #30
+ Utf8 "println"; // #31
+ Utf8 "(Ljava/lang/String;)V"; // #32
+ } // Constant Pool
+
+ 0x0020; // access
+ #5;// this_cpx
+ #6;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ { // Member
+ 0x0019; // access
+ #7; // name_cpx
+ #8; // sig_cpx
+ [] { // Attributes
+ Attr(#9) { // ConstantValue
+ #10;
+ } // end ConstantValue
+ } // Attributes
+ } // Member
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0000; // access
+ #11; // name_cpx
+ #12; // sig_cpx
+ [] { // Attributes
+ Attr(#13) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x2AB70001B1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#14) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 35;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x000A; // access
+ #15; // name_cpx
+ #16; // sig_cpx
+ [] { // Attributes
+ Attr(#13) { // Code
+ 2; // max_stack
+ 0; // max_locals
+ Bytes[]{
+ 0xB200021203B60004;
+ 0x05AC;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#14) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 38;
+ 8 39;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ Attr(#17) { // SourceFile
+ #18;
+ } // end SourceFile
+ } // Attributes
+} // end class TestDeletedMethod_Super
--- a/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java Tue Oct 16 14:26:22 2018 +0530
@@ -50,8 +50,9 @@
OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
MODE("isInt", "isMixed", "isComp"),
- IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
- "hasSA", "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
+ IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
+ "isSlowDebugBuild", "hasSA", "shouldSAAttach", "isTieredSupported",
+ "areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported");
public final List<String> methodNames;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -192,8 +192,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -216,8 +215,7 @@
*/
static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... set\n");
@@ -314,9 +312,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -192,8 +192,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -216,8 +215,7 @@
*/
static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... set\n");
@@ -231,8 +229,7 @@
*/
static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
return NSK_FALSE;
}
@@ -334,9 +331,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,8 +57,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -71,8 +70,7 @@
*/
static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... set\n");
@@ -86,8 +84,7 @@
*/
static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
return NSK_FALSE;
}
@@ -183,9 +180,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,12 +74,12 @@
jint nativeMethodsNumber = 1;
if (!NSK_JNI_VERIFY(jni, (appClass =
- NSK_CPP_STUB2(FindClass, jni, ATTACH002_TARGET_APP_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ATTACH002_TARGET_APP_CLASS_NAME)) != NULL)) {
return NSK_FALSE;
}
if (!NSK_JNI_VERIFY(jni,
- (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+ (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
return NSK_FALSE;
}
@@ -205,7 +205,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
/*
* If VM is run with -Xshare:on agent can't get required capabilities (see 6718407)
*/
@@ -222,7 +222,7 @@
eventCallbacks.ClassLoad = classLoadHandler;
eventCallbacks.ClassPrepare = classPrepareHandler;
eventCallbacks.ClassFileLoadHook = classFileLoadHoockHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -106,13 +106,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.VMObjectAlloc = vmObjectAllocHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -123,14 +123,14 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.MonitorContendedEntered = monitorContentedEnteredHandler;
eventCallbacks.MonitorContendedEnter = monitorContentedEnterHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -82,8 +82,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB4(
- SetEventNotificationMode, jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread) ) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread) ) ) {
NSK_COMPLAIN1("Failed to enable events for thread '%s'\n", mainThreadName);
nsk_aod_agentFinished(jni, agentName, 0);
return;
@@ -142,7 +141,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = classLoadHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -65,7 +65,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)) ) {
return JNI_ERR;
}
@@ -75,7 +75,7 @@
NSK_DISPLAY1("%s: trying to get all potential capabilities:\n", agentName);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,7 +62,7 @@
if (!nsk_jvmti_aod_disableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD))
success = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
success = 0;
NSK_COMPLAIN1("%s: failed to dispose environment\n", agentName);
} else {
@@ -104,7 +104,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = classLoadHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -97,7 +97,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare = classPrepareHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -97,7 +97,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = classLoadHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -37,7 +37,7 @@
*/
JNIEXPORT jboolean JNICALL
Java_nsk_jvmti_AttachOnDemand_attach015_attach015Target_loadClassFromNative(JNIEnv * jni, jclass klass) {
- return NSK_CPP_STUB2(FindClass, jni, LOADED_CLASS_NAME) ? JNI_TRUE : JNI_FALSE;
+ return jni->FindClass(LOADED_CLASS_NAME) ? JNI_TRUE : JNI_FALSE;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -71,17 +71,15 @@
success = 0;
}
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, gcFinishMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(gcFinishMonitor))) {
gcFinishEventReceived = 1;
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorNotify, jvmti, gcFinishMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(gcFinishMonitor))) {
auxiliaryThreadNotified = 1;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, gcFinishMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(gcFinishMonitor))) {
success = 0;
}
} else {
@@ -96,17 +94,15 @@
void JNICALL auxiliaryThreadFunction(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
NSK_DISPLAY1("%s: auxiliary thread is running\n", agentName);
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, gcFinishMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(gcFinishMonitor))) {
if (!gcFinishEventReceived) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- RawMonitorWait, jvmti, gcFinishMonitor, 0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(gcFinishMonitor, 0))) {
success = 0;
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, gcFinishMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(gcFinishMonitor))) {
success = 0;
}
} else {
@@ -122,8 +118,7 @@
if (!NSK_VERIFY((thread = nsk_jvmti_aod_createThread(jni)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(
- RunAgentThread, jvmti, thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
return NSK_FALSE;
}
@@ -161,7 +156,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "GCFinishMonitor", &gcFinishMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("GCFinishMonitor", &gcFinishMonitor))) {
return JNI_ERR;
}
@@ -170,14 +165,14 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.GarbageCollectionStart = garbageCollectionStartHandler;
eventCallbacks.GarbageCollectionFinish = garbageCollectionFinishHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,7 +56,7 @@
JNIEXPORT jboolean JNICALL
Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_setTagFor(JNIEnv * jni,
jclass klass, jobject obj) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, obj, TAG_VALUE))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, TAG_VALUE))) {
return JNI_FALSE;
}
@@ -95,12 +95,12 @@
jint nativeMethodsNumber = 2;
if (!NSK_JNI_VERIFY(jni, (appClass =
- NSK_CPP_STUB2(FindClass, jni, ATTACH021_TARGET_APP_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ATTACH021_TARGET_APP_CLASS_NAME)) != NULL)) {
return NSK_FALSE;
}
if (!NSK_JNI_VERIFY(jni,
- (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+ (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
return NSK_FALSE;
}
@@ -142,13 +142,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = objectFreeHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -84,12 +84,10 @@
void JNICALL objectFreeHandler(jvmtiEnv *jvmti, jlong tag) {
NSK_DISPLAY2("%s: ObjectFree event received (object tag: %ld)\n", agentName, tag);
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, objectFreeMonitor))) {
-
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(objectFreeMonitor))) {
freedObjectsCounter++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, objectFreeMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(objectFreeMonitor))) {
success = 0;
}
} else {
@@ -107,12 +105,12 @@
jint nativeMethodsNumber = 1;
if (!NSK_JNI_VERIFY(jni, (appClass =
- NSK_CPP_STUB2(FindClass, jni, ATTACH022_TARGET_APP_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ATTACH022_TARGET_APP_CLASS_NAME)) != NULL)) {
return NSK_FALSE;
}
if (!NSK_JNI_VERIFY(jni,
- (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+ (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
return NSK_FALSE;
}
@@ -136,12 +134,10 @@
NSK_DISPLAY2("%s: ObjectAlloc event received (object class: %s)\n", agentName, className);
if (!strcmp(className, OBJECTS_FOR_ALLOCATION_TEST_CLASS_NAME)) {
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, objectTagMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(objectTagMonitor))) {
jlong tagValue = taggedObjectsCounter + 1;
-
- if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetTag, jvmti, object, tagValue))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tagValue))) {
NSK_COMPLAIN1("%s: failed to set tag\n", agentName);
success = 0;
} else {
@@ -149,7 +145,7 @@
taggedObjectsCounter++;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, objectTagMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(objectTagMonitor))) {
success = 0;
}
} else {
@@ -195,11 +191,11 @@
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "ObjectTagMonitor", &objectTagMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("ObjectTagMonitor", &objectTagMonitor))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "ObjectFreeMonitor", &objectFreeMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("ObjectFreeMonitor", &objectFreeMonitor))) {
return JNI_ERR;
}
@@ -207,14 +203,14 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = objectFreeHandler;
eventCallbacks.VMObjectAlloc = vmObjectAllocHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -122,14 +122,14 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.MonitorWaited = monitorWaitedHandler;
eventCallbacks.MonitorWait = monitorWaitHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -119,7 +119,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadEnd = threadEndHandler;
eventCallbacks.ThreadStart = threadStartHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -68,8 +68,7 @@
if (!NSK_VERIFY((thread = nsk_jvmti_aod_createThreadWithName(jni, STARTED_THREAD_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(
- RunAgentThread, jvmti, thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
return NSK_FALSE;
}
@@ -155,7 +154,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadEnd = threadEndHandler;
eventCallbacks.ThreadStart = threadStartHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,7 +66,7 @@
NSK_DISPLAY2("%s: ThreadStart event was received for thread '%s'\n", agentName, startedThreadName);
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+ if (NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
int startedThreadWasFound = 0;
for (i = 0; i < threadsCount; i++) {
@@ -94,8 +94,7 @@
}
if (strstr(startedThreadName, TEST_THREAD_NAME_PREFIX)) {
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, threadsCounterMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(threadsCounterMonitor))) {
testThreadsCounter++;
@@ -103,7 +102,7 @@
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, success, jvmti, jni);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, threadsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(threadsCounterMonitor))) {
success = 0;
}
} else {
@@ -145,13 +144,13 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "threadsCounterMonitor", &threadsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("threadsCounterMonitor", &threadsCounterMonitor))) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = threadStartHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,7 +52,7 @@
int i;
char threadGroupName[MAX_STRING_LENGTH];
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, group, &groupInfo))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupInfo(group, &groupInfo))) {
return 0;
}
@@ -61,7 +61,7 @@
NSK_DISPLAY3("%s: trying to find thread '%s' in group '%s'\n", agentName, threadNameToFind, threadGroupName);
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, group, &threadsCount, &threads, &groupsCount, &groups))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
return 0;
}
@@ -118,7 +118,7 @@
jthreadGroup *topGroups;
int i;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTopThreadGroups, jvmti, &groupsCount, &topGroups))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetTopThreadGroups(&groupsCount, &topGroups))) {
NSK_COMPLAIN1("%s: failed to get top thread groups\n", agentName);
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
return;
@@ -172,7 +172,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = threadStartHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,7 +62,7 @@
int i;
int startedThreadWasFound = 0;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
NSK_COMPLAIN1("%s: failed to get all threads\n", agentName);
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
return;
@@ -85,7 +85,7 @@
startedThreadWasFound = 1;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadState, jvmti, threads[i], &threadState))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threads[i], &threadState))) {
NSK_COMPLAIN2("%s: failed to get status of thread '%s'\n", agentName, threadName);
nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)threads);
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
@@ -136,7 +136,7 @@
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = threadStartHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,8 +57,7 @@
return;
}
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
eventsCounter++;
@@ -69,7 +68,7 @@
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, success, jvmti, jni);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
success = 0;
}
} else {
@@ -109,13 +108,13 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = classLoadHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,7 +59,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetLoadedClasses, jvmti, &loadedClassesCount, &loadedClasses))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLoadedClasses(&loadedClassesCount, &loadedClasses))) {
NSK_COMPLAIN1("%s: failed to get loaded classes\n", agentName);
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, 0, jvmti, jni);
return;
@@ -67,8 +67,7 @@
nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)loadedClasses);
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
eventsCounter++;
@@ -80,7 +79,7 @@
nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, success, jvmti, jni);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
success = 0;
}
} else {
@@ -120,13 +119,13 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare = classPrepareHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,7 +62,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
NSK_COMPLAIN1("%s: failed to get all threads\n", agentName);
nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni);
return;
@@ -70,8 +70,7 @@
nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)threads);
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
eventsCounter++;
@@ -86,7 +85,7 @@
nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
success = 0;
}
} else {
@@ -140,14 +139,14 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = threadStartHandler;
eventCallbacks.ThreadEnd = threadEndHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -68,8 +68,7 @@
return;
}
- if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+ if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
eventsCounter++;
@@ -79,7 +78,7 @@
if ((eventsCounter % 10) == 0) {
NSK_DISPLAY1("%s: force garbage collection\n", agentName);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(ForceGarbageCollection, jvmti)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection()))
success = 0;
}
@@ -89,7 +88,7 @@
nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
success = 0;
}
} else {
@@ -130,19 +129,19 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) {
return JNI_ERR;
}
memset(&caps, 0, sizeof(caps));
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.VMObjectAlloc = VMObjectAllocHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -113,13 +113,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
return JNI_ERR;
}
memset(&eventCallbacks,0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = classLoadHandler;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -67,15 +67,11 @@
int i;
for (i=0; i<METH_NUM; i++) {
- if (!NSK_JNI_VERIFY(env, (mid = NSK_CPP_STUB4(GetMethodID,
- env, klass, METHODS[i][0], METHODS[i][1])) != NULL))
- NSK_CPP_STUB2(FatalError, env,
- "failed to get ID for the java method\n");
+ if (!NSK_JNI_VERIFY(env, (mid = env->GetMethodID(klass, METHODS[i][0], METHODS[i][1])) != NULL))
+ env->FatalError("failed to get ID for the java method\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
- jvmti_env, mid, 0)))
- NSK_CPP_STUB2(FatalError, env,
- "failed to set breakpoint\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 0)))
+ env->FatalError("failed to set breakpoint\n");
}
}
@@ -88,10 +84,8 @@
if (vm_started) {
// GetClassSignature may be called only during the start or the live phase
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &sig, &generic)))
- NSK_CPP_STUB2(FatalError, env,
- "failed to obtain a class signature\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
+ env->FatalError("failed to obtain a class signature\n");
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
NSK_DISPLAY1(
@@ -117,8 +111,7 @@
NSK_DISPLAY0(">>>> Breakpoint event received\n");
/* checking thread info */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo,
- jvmti_env, thread, &thr_info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &thr_info))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get thread info during Breakpoint callback\n\n");
return;
@@ -148,14 +141,12 @@
(long) location);
/* checking method info */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, method, &klass))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &klass))) {
result = checkStatus = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method declaring class during Breakpoint callback\n\n");
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &clsSig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &clsSig, &generic))) {
result = checkStatus = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to obtain a class signature during Breakpoint callback\n\n");
return;
@@ -172,8 +163,7 @@
NSK_DISPLAY1("CHECK PASSED: class signature: \"%s\"\n",
clsSig);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methNam, &methSig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
result = checkStatus = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
return;
@@ -189,13 +179,11 @@
break;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methNam))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methSig))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
}
@@ -265,12 +253,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_breakpoint_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_single_step_events)
@@ -282,20 +268,16 @@
callbacks.ClassLoad = &ClassLoad;
callbacks.Breakpoint = &Breakpoint;
callbacks.VMStart = &VMStart;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -93,13 +93,11 @@
NSK_DISPLAY0("setting event callbacks ...\n");
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling ClassFileLoadHook event ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling ClassFileLoadHook event done\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -122,7 +122,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -130,14 +130,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -145,17 +144,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -167,7 +163,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -190,7 +186,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -240,8 +236,7 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Deallocate bytecode array: 0x%p\n", (void*)origClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, origClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(origClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -318,8 +313,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -332,8 +326,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -127,7 +127,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -135,14 +135,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -150,17 +149,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -172,7 +168,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -187,23 +183,21 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -229,7 +223,7 @@
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -286,11 +280,10 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to classloader object: 0x%p\n", (void*)classLoader);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, classLoader);
+ jni->DeleteGlobalRef(classLoader);
NSK_DISPLAY1("Deallocate classfile bytes array: 0x%p\n", (void*)origClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, origClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(origClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -331,7 +324,7 @@
NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n",
(void*)loader);
nsk_jvmti_setFailStatus();
- } else if (!NSK_CPP_STUB3(IsSameObject, jni, loader, classLoader)) {
+ } else if (!jni->IsSameObject(loader, classLoader)) {
NSK_COMPLAIN2("Unexpected classloader in CLASS_FILE_LOAD_HOOK for tested class:\n"
"# got classloder: 0x%p\n"
"# expected same as: 0x%p\n",
@@ -380,8 +373,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -394,8 +386,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,7 +61,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -69,14 +69,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -84,17 +83,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -106,7 +102,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -129,7 +125,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -271,8 +267,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -285,8 +280,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -123,7 +123,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -131,14 +131,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -146,17 +145,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -168,7 +164,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -191,7 +187,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -333,8 +329,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -347,8 +342,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -128,7 +128,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -136,14 +136,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -151,17 +150,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -173,7 +169,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -188,23 +184,21 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -223,8 +217,7 @@
classDef.class_bytes = bytes;
NSK_DISPLAY1("Redefine class: %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -250,7 +243,7 @@
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -309,11 +302,10 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+ jni->DeleteGlobalRef(testedClass);
NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -347,7 +339,7 @@
NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n",
(void*)class_being_redefined);
nsk_jvmti_setFailStatus();
- } else if (!NSK_CPP_STUB3(IsSameObject, jni, class_being_redefined, testedClass)) {
+ } else if (!jni->IsSameObject(class_being_redefined, testedClass)) {
NSK_COMPLAIN2("Unexpected class_being_redefined in CLASS_FILE_LOAD_HOOK:\n"
"# got class: 0x%p\n"
"# expected same as: 0x%p\n",
@@ -397,8 +389,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -411,8 +402,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -132,7 +132,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -140,14 +140,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -155,17 +154,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,7 +173,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -192,23 +188,21 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -227,8 +221,7 @@
classDef.class_bytes = bytes;
NSK_DISPLAY1("Redefine class: %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -254,7 +247,7 @@
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -319,14 +312,13 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to classloader object: 0x%p\n", (void*)classLoader);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, classLoader);
+ jni->DeleteGlobalRef(classLoader);
NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+ jni->DeleteGlobalRef(testedClass);
NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -360,7 +352,7 @@
NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n",
(void*)loader);
nsk_jvmti_setFailStatus();
- } else if (!NSK_CPP_STUB3(IsSameObject, jni, loader, classLoader)) {
+ } else if (!jni->IsSameObject(loader, classLoader)) {
NSK_COMPLAIN2("Unexpected classloader in CLASS_FILE_LOAD_HOOK:\n"
"# got classloder: 0x%p\n"
"# expected same as: 0x%p\n",
@@ -373,7 +365,7 @@
NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n",
(void*)class_being_redefined);
nsk_jvmti_setFailStatus();
- } else if (!NSK_CPP_STUB3(IsSameObject, jni, class_being_redefined, testedClass)) {
+ } else if (!jni->IsSameObject(class_being_redefined, testedClass)) {
NSK_COMPLAIN2("Unexpected class_being_redefined in CLASS_FILE_LOAD_HOOK:\n"
"# got class: 0x%p\n"
"# expected same as: 0x%p\n",
@@ -423,8 +415,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -437,8 +428,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -70,7 +70,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -78,14 +78,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -93,17 +92,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -115,7 +111,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -130,23 +126,21 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -165,8 +159,7 @@
classDef.class_bytes = bytes;
NSK_DISPLAY1("Redefine class: %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -192,7 +185,7 @@
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -258,11 +251,10 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+ jni->DeleteGlobalRef(testedClass);
NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -359,8 +351,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -373,8 +364,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -70,7 +70,7 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -78,14 +78,13 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -93,17 +92,14 @@
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -115,7 +111,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -130,23 +126,21 @@
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -165,8 +159,7 @@
classDef.class_bytes = bytes;
NSK_DISPLAY1("Redefine class: %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -192,7 +185,7 @@
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -258,11 +251,10 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+ jni->DeleteGlobalRef(testedClass);
NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
@@ -359,8 +351,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -373,8 +364,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -98,17 +98,13 @@
}
static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
/** callback functions **/
@@ -119,8 +115,7 @@
lock(jvmti_env, env);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &sig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n");
}
@@ -185,20 +180,17 @@
initCounters();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks ...\n");
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassLoad = &ClassLoad;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling ClassLoad event ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
return JNI_ERR;
NSK_DISPLAY0("the event enabled\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,8 +45,7 @@
VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
NSK_DISPLAY0("VMInit event received\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GenerateEvents,
- jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
NSK_COMPLAIN0("TEST FAILED: unable to generate events to represent the current state of the VM\n");
result = STATUS_FAILED;
}
@@ -63,8 +62,7 @@
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, &generic))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain method info\n");
return;
@@ -72,8 +70,7 @@
NSK_DISPLAY4("\tmethod: name=\"%s\" signature=\"%s\"\n\tcompiled code size=%d\n\tnumber of address location map entries=%d\n",
name, sig, code_size, map_length);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
- jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain phase of the VM execution\n");
return;
@@ -122,12 +119,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_compiled_method_load_events)
@@ -138,16 +133,13 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.CompiledMethodLoad = &CompiledMethodLoad;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling VMInit, CompiledMethodLoad event ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -47,8 +47,7 @@
VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
NSK_DISPLAY0("VMInit event received\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GenerateEvents,
- jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
NSK_COMPLAIN0("TEST FAILED: unable to generate events to represent the current state of the VM\n");
result = STATUS_FAILED;
}
@@ -64,8 +63,7 @@
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, &generic))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain method info\n\n");
return;
@@ -94,8 +92,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
} else {
// The class metadata has been completely unloaded so the name is not available.
NSK_DISPLAY0("for: \tmethod: name=<not available>\n");
@@ -104,8 +102,7 @@
// Count unloaded events
class_unloaded++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
- jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain phase of the VM execution\n");
return;
@@ -166,12 +163,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_compiled_method_load_events)
@@ -183,19 +178,15 @@
callbacks.VMInit = &VMInit;
callbacks.CompiledMethodLoad = &CompiledMethodLoad;
callbacks.CompiledMethodUnload = &CompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -118,13 +118,11 @@
NSK_DISPLAY0("setting event callbacks ...\n");
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.DataDumpRequest = &DataDumpRequest;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,8 +54,7 @@
return JNI_ERR;
NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in Agent_OnLoad()\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
return JNI_ERR;
}
NSK_DISPLAY0(" ... disposed\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,16 +45,14 @@
NSK_DISPLAY0("Disable VM_DEATH event in VM_DEATH callback\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_VM_DEATH, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, NULL))) {
success = NSK_FALSE;
} else {
NSK_DISPLAY0(" ... disabled\n");
}
NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in VM_DEATH callback\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
success = NSK_FALSE;
} else {
NSK_DISPLAY0(" ... disposed\n");
@@ -95,16 +93,13 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
NSK_DISPLAY0("Enable VM_DEATH event in JVM_OnLoad()\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_DEATH, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) {
return JNI_ERR;
}
NSK_DISPLAY0(" ... enabled\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -116,15 +116,12 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.DynamicCodeGenerated = &DynamicCodeGenerated;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable DynamicCodeGenerated event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,11 +45,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- SuspendThread
- , jvmti
- , earlyReturnThread
- )
+ jvmti ->SuspendThread (earlyReturnThread )
)
)
return JNI_FALSE;
@@ -67,11 +63,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- ResumeThread
- , jvmti
- , earlyReturnThread
- )
+ jvmti ->ResumeThread (earlyReturnThread )
)
)
return JNI_FALSE;
@@ -90,12 +82,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- ForceEarlyReturnObject
- , jvmti
- , earlyReturnThread
- , valueToReturn
- )
+ jvmti ->ForceEarlyReturnObject (earlyReturnThread , valueToReturn )
)
)
return JNI_FALSE;
@@ -114,12 +101,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- ForceEarlyReturnInt
- , jvmti
- , earlyReturnThread
- , valueToReturn
- )
+ jvmti ->ForceEarlyReturnInt (earlyReturnThread , valueToReturn )
)
)
return JNI_FALSE;
@@ -138,12 +120,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- ForceEarlyReturnLong
- , jvmti
- , earlyReturnThread
- , valueToReturn
- )
+ jvmti ->ForceEarlyReturnLong (earlyReturnThread , valueToReturn )
)
)
return JNI_FALSE;
@@ -162,12 +139,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- ForceEarlyReturnFloat
- , jvmti
- , earlyReturnThread
- , valueToReturn
- )
+ jvmti ->ForceEarlyReturnFloat (earlyReturnThread , valueToReturn )
)
)
return JNI_FALSE;
@@ -186,12 +158,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- ForceEarlyReturnDouble
- , jvmti
- , earlyReturnThread
- , valueToReturn
- )
+ jvmti ->ForceEarlyReturnDouble (earlyReturnThread , valueToReturn )
)
)
return JNI_FALSE;
@@ -209,11 +176,7 @@
)
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- ForceEarlyReturnVoid
- , jvmti
- , earlyReturnThread
- )
+ jvmti ->ForceEarlyReturnVoid (earlyReturnThread )
)
)
return JNI_FALSE;
@@ -245,11 +208,7 @@
)
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
+ if (!NSK_JVMTI_VERIFY(jvmti ->GetCapabilities (&caps)
)
)
return JNI_ERR;
@@ -258,11 +217,7 @@
caps.can_force_early_return = 1;
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
+ if (!NSK_JVMTI_VERIFY(jvmti ->AddCapabilities (&caps)
)
)
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,8 +45,7 @@
NSK_DISPLAY0(">>> Testcase #1: force GC to collect sofly reachable objects\n");
{
NSK_DISPLAY0("Call ForceGarbageCollection()\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
nsk_jvmti_setFailStatus();
return;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,8 +54,7 @@
return;
NSK_DISPLAY0("Call ForceGarbageCollection()\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
nsk_jvmti_setFailStatus();
return;
}
@@ -114,7 +113,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -122,9 +121,7 @@
jvmtiEventCallbacks eventCallbacks;
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.GarbageCollectionStart = callbackGarbageCollectionStart;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -51,8 +51,7 @@
NSK_DISPLAY1("%s: creating a raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti_env, "_lock", &_lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
msg);
@@ -63,8 +62,7 @@
NSK_DISPLAY1("%s: entering the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
msg);
@@ -75,8 +73,7 @@
NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
- jvmti_env, _lock, (jlong)10))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
msg);
@@ -87,8 +84,7 @@
NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
msg);
@@ -99,8 +95,7 @@
NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
msg);
@@ -111,8 +106,7 @@
NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
msg);
@@ -123,8 +117,7 @@
NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
msg);
@@ -137,8 +130,7 @@
static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
NSK_DISPLAY1("%s: allocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, MEM_SIZE, &mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
msg);
@@ -150,8 +142,7 @@
NSK_DISPLAY1("%s: deallocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
msg);
@@ -209,12 +200,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_garbage_collection_events)
@@ -225,16 +214,13 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMDeath = &VMDeath;
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -120,12 +120,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_garbage_collection_events)
@@ -137,19 +135,15 @@
callbacks.VMDeath = &VMDeath;
callbacks.GarbageCollectionStart = &GarbageCollectionStart;
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -51,8 +51,7 @@
NSK_DISPLAY1("%s: creating a raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti_env, "_lock", &_lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
msg);
@@ -63,8 +62,7 @@
NSK_DISPLAY1("%s: entering the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
msg);
@@ -76,8 +74,7 @@
NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
- jvmti_env, _lock, (jlong)10))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
msg);
@@ -88,8 +85,7 @@
NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
msg);
@@ -100,8 +96,7 @@
NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
msg);
@@ -112,8 +107,7 @@
NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
msg);
@@ -124,8 +118,7 @@
NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
msg);
@@ -138,8 +131,7 @@
static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
NSK_DISPLAY1("%s: allocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, MEM_SIZE, &mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
msg);
@@ -151,8 +143,7 @@
NSK_DISPLAY1("%s: deallocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
msg);
@@ -210,12 +201,10 @@
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_garbage_collection_events)
@@ -226,16 +215,13 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMDeath = &VMDeath;
callbacks.GarbageCollectionStart = &GarbageCollectionStart;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -99,13 +99,11 @@
}
NSK_DISPLAY0("Call GenerateEvents() to send missed events\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) {
nsk_jvmti_setFailStatus();
}
@@ -195,8 +193,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -207,9 +204,7 @@
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
eventCallbacks.DynamicCodeGenerated = callbackDynamicCodeGenerated;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,8 +53,7 @@
jint processors = 0;
NSK_DISPLAY0("GetAvailableProcessors() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetAvailableProcessors, jvmti, &processors))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAvailableProcessors(&processors))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got processors: %d\n", (int)processors);
@@ -157,9 +156,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -190,8 +190,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -297,9 +296,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -58,18 +58,15 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (testedFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -82,8 +79,7 @@
jint i;
for (i = 0; i < classCount && !found; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
- classes[i], &signature, &generic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic)))
break;
if (signature != NULL && strcmp(signature, exp_sig) == 0) {
@@ -92,10 +88,10 @@
}
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
if (generic != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+ jvmti->Deallocate((unsigned char*)generic);
}
return found;
@@ -119,13 +115,11 @@
NSK_DISPLAY0("Testcase #1: check on default classloader\n");
if (!NSK_JNI_VERIFY(jni, (testedClassLoader =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- testedClass, testedFieldID)) != NULL)) {
+ jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassLoaderClasses, jvmti,
- testedClassLoader, &classCount, &classes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassLoaderClasses(testedClassLoader, &classCount, &classes))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -143,7 +137,7 @@
return;
}
if (classes != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+ jvmti->Deallocate((unsigned char*)classes);
if (!nsk_jvmti_resumeSync())
return;
@@ -152,13 +146,11 @@
NSK_DISPLAY0("Testcase #2: check on custom classloader\n");
if (!NSK_JNI_VERIFY(jni, (testedClassLoader =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- testedClass, testedFieldID)) != NULL)) {
+ jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassLoaderClasses, jvmti,
- testedClassLoader, &classCount, &classes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassLoaderClasses(testedClassLoader, &classCount, &classes))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -183,9 +175,9 @@
nsk_jvmti_setFailStatus();
}
if (classes != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+ jvmti->Deallocate((unsigned char*)classes);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -58,8 +58,7 @@
char *sign;
char *gen_sign;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti, testedCls, &sign, &gen_sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(testedCls, &sign, &gen_sign))) {
NSK_COMPLAIN1("TEST FAILED: unable to get class signature for \"%s\"\n\n",
class_sig[idx][0]);
return STATUS_FAILED;
@@ -85,13 +84,11 @@
sign, (gen_sign==NULL)?"NULL":gen_sign);
NSK_DISPLAY0("Deallocating the signature array\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) {
totRes = STATUS_FAILED;
}
if (gen_sign!=NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) gen_sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) {
totRes = STATUS_FAILED;
}
@@ -108,8 +105,7 @@
jclass testedCls;
for (i=0; i<CLS_NUM; i++) {
- if (!NSK_JNI_VERIFY(jni, (testedCls = NSK_CPP_STUB2(
- FindClass, jni, class_sig[i][1])) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedCls = jni->FindClass(class_sig[i][1])) != NULL)) {
NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
class_sig[i][0]);
res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -70,8 +70,7 @@
int success = NSK_TRUE;
NSK_DISPLAY1("GetCurrentThreadCpuTime() for current thread: 0x%p\n", (void*)thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, (jlong *)time))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTime((jlong *)time))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -260,8 +259,7 @@
jvmtiThreadInfo threadInfo;
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -284,8 +282,7 @@
jvmtiThreadInfo threadInfo;
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -337,8 +334,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_current_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -353,9 +349,7 @@
eventCallbacks.VMDeath = callbackVMDeath;
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,7 +66,7 @@
NSK_DISPLAY0("GetCurrentThreadCpuTimerInfo() for current JVMTI env\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, info))) {
+ jvmti->GetCurrentThreadCpuTimerInfo(info))) {
return NSK_FALSE;
}
NSK_DISPLAY0("Got timer info:\n");
@@ -260,7 +260,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_current_thread_cpu_time = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -276,8 +276,7 @@
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -87,64 +87,29 @@
return JNI_ERR;
}
- if (NSK_CPP_STUB3(
- GetEnv
- , vm
- , (void **) &jvmti
- , JVMTI_VERSION_1_1
- ) != JNI_OK || jvmti == NULL)
- {
+ if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == NULL) {
NSK_COMPLAIN0("JVMTI_VERSION_1_1 isn't supported.");
return JNI_OK;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
caps.can_retransform_classes = 1;
// Register all necessary JVM capabilities
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
// Register all necessary event callbacks
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
// Enable class retransformation
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
- , NULL
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,8 +53,7 @@
void* storage = NULL;
NSK_DISPLAY0("GetEnvironmentLocalStorage() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, &storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage);
@@ -158,9 +157,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -152,15 +152,14 @@
for (i = 0; i < sizeof(errors)/sizeof(error_info); i++) {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetErrorName, jvmti, errors[i].err, &name)))
+ jvmti->GetErrorName(errors[i].err, &name)))
return NSK_FALSE;
if (strcmp(name, errors[i].name) != 0) {
NSK_COMPLAIN2("Error: function returns \"%s\", expected \"%s\"\n",
name, errors[i].name);
return_value = NSK_FALSE;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)name)))
return NSK_FALSE;
}
@@ -172,7 +171,7 @@
void JNICALL
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -194,10 +193,10 @@
unsigned char** new_class_data) {
jvmtiPhase curr_phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
nsk_jvmti_setFailStatus();
if (phase != curr_phase) {
@@ -210,7 +209,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -224,7 +223,7 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -270,12 +269,10 @@
return JNI_ERR;
/* Create data access lock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti,
- "_access_lock", &access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
return JNI_ERR;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -288,21 +285,17 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMInit event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
/* enable ClassFileLoadHook event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -48,12 +48,12 @@
NSK_DISPLAY0("Testcase #1: check on JVMTI_ERROR_ILLEGAL_ARGUMENT\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_ILLEGAL_ARGUMENT,
- NSK_CPP_STUB3(GetErrorName, jvmti, (jvmtiError)(-1), &name)))
+ jvmti->GetErrorName((jvmtiError)(-1), &name)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("Testcase #2: check on JVMTI_ERROR_NULL_POINTER\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
- NSK_CPP_STUB3(GetErrorName, jvmti, JVMTI_ERROR_NONE, NULL)))
+ jvmti->GetErrorName(JVMTI_ERROR_NONE, NULL)))
nsk_jvmti_setFailStatus();
/* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,8 +54,7 @@
int i;
NSK_DISPLAY0("Get extension events list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetExtensionEvents, jvmti, &extCount, &extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionEvents(&extCount, &extList))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got count: %d\n", (int)extCount);
@@ -219,8 +218,7 @@
}
NSK_DISPLAY1("Deallocate extension events list: 0x%p\n", (void*)extList);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)extList))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,8 +53,7 @@
int i;
NSK_DISPLAY0("Get extension functions list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetExtensionFunctions, jvmti, &extCount, &extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionFunctions(&extCount, &extList))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got count: %d\n", (int)extCount);
@@ -230,8 +229,7 @@
}
NSK_DISPLAY1("Deallocate extension functions list: 0x%p\n", (void*)extList);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)extList))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,8 +92,7 @@
char *sign;
char *gen_sign;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName,
- jvmti, testedCls, testedFld, &name, &sign, &gen_sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFieldName(testedCls, testedFld, &name, &sign, &gen_sign))) {
NSK_COMPLAIN1("TEST FAILED: unable to get field name & signature for \"%s\"\n\n",
fld_sig[idx][0]);
return STATUS_FAILED;
@@ -120,15 +119,12 @@
sign, (gen_sign==NULL)?"NULL":gen_sign);
NSK_DISPLAY0("Deallocating name & signature arrays\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name)))
totRes = STATUS_FAILED;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) sign)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign)))
totRes = STATUS_FAILED;
if (gen_sign!=NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) gen_sign)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign)))
totRes = STATUS_FAILED;
}
@@ -140,8 +136,7 @@
JNIEnv *jni, jobject obj) {
int res = PASSED, i, instance;
jfieldID testedFld = NULL;
- jclass objCls = NSK_CPP_STUB2(GetObjectClass,
- jni, obj);
+ jclass objCls = jni->GetObjectClass(obj);
for (i=0; i<FLDS_NUM; i++) {
instance = strcmp(fld_sig[i][1], "instance");
@@ -150,9 +145,7 @@
(instance==0)?"instance":"static",
fld_sig[i][0]);
if (instance==0) {
- if (!NSK_JNI_VERIFY(jni, (testedFld = NSK_CPP_STUB4(
- GetFieldID, jni, objCls,
- fld_sig[i][0], fld_sig[i][2])) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) {
NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n",
fld_sig[i][0]);
res = STATUS_FAILED;
@@ -160,9 +153,7 @@
}
}
else
- if (!NSK_JNI_VERIFY(jni, (testedFld = NSK_CPP_STUB4(
- GetStaticFieldID, jni, objCls,
- fld_sig[i][0], fld_sig[i][2])) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) {
NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n",
fld_sig[i][0]);
res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,14 +57,14 @@
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
jvmtiJlocationFormat format;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #3: check GetJLocationFormat in VMInit */
NSK_DISPLAY0("Testcase #3: check GetJLocationFormat in VMInit\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
|| (format == JVMTI_JLOCATION_MACHINEPC)
@@ -85,10 +85,10 @@
jvmtiJlocationFormat format;
jvmtiPhase curr_phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
nsk_jvmti_setFailStatus();
if (phase != curr_phase) {
@@ -97,7 +97,7 @@
/* testcase #2: check GetJLocationFormat in ClassFileLoadHook */
NSK_DISPLAY0("Testcase #2: check GetJLocationFormat in ClassFileLoadHook\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
|| (format == JVMTI_JLOCATION_MACHINEPC)
@@ -106,7 +106,7 @@
NSK_DISPLAY1("JlocationFormat: %s\n", TranslateJlocationFormat(format));
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -121,14 +121,14 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #4: check GetJLocationFormat in agentProc */
NSK_DISPLAY0("Testcase #4: check GetJLocationFormat in agentProc\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
|| (format == JVMTI_JLOCATION_MACHINEPC)
@@ -173,19 +173,17 @@
return JNI_ERR;
/* Create data access lock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti,
- "_access_lock", &access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
return JNI_ERR;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #1: check GetJLocationFormat in Agent_OnLoad */
NSK_DISPLAY0("Testcase #1: check GetJLocationFormat in Agent_OnLoad\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
|| (format == JVMTI_JLOCATION_MACHINEPC)
@@ -196,21 +194,17 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMInit event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
/* enable ClassFileLoadHook event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -46,8 +46,7 @@
return;
NSK_DISPLAY0("Check if GetJLocationFormat(NULL) returns JVMTI_ERROR_NULL_POINTER\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
- NSK_CPP_STUB2(GetJLocationFormat, jvmti, NULL)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(NULL)))
nsk_jvmti_setFailStatus();
/* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -60,8 +60,7 @@
jint i;
for (i = 0; i < classCount && !found; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
- classes[i], &signature, &generic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic)))
break;
if (signature != NULL && strcmp(signature, exp_sig) == 0) {
@@ -70,10 +69,10 @@
}
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
if (generic != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+ jvmti->Deallocate((unsigned char*)generic);
}
return found;
@@ -91,8 +90,7 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetLoadedClasses, jvmti,
- &classCount, &classes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLoadedClasses(&classCount, &classes))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -124,7 +122,7 @@
}
if (classes != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+ jvmti->Deallocate((unsigned char*)classes);
if (!nsk_jvmti_resumeSync())
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -99,13 +99,9 @@
/* get the JNI method ID for a method with name m_name and
signature m_sign */
if (methInfo[i].inst) /* an instance method */
- methInfo[i].mid = NSK_CPP_STUB4(GetMethodID,
- jni_env, testedCls,
- methInfo[i].m_name, methInfo[i].m_sign);
+ methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
else /* a static method */
- methInfo[i].mid = NSK_CPP_STUB4(GetStaticMethodID,
- jni_env, testedCls,
- methInfo[i].m_name, methInfo[i].m_sign);
+ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
if (methInfo[i].mid == NULL) {
NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
methInfo[i].inst?"instance":"static",
@@ -114,8 +110,7 @@
}
/* get the LocalVariableTable attribute */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
- jvmti, methInfo[i].mid, &count, &lv_table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(methInfo[i].mid, &count, &lv_table))) {
NSK_COMPLAIN3("TEST FAILED: unable to get local variable table\n\tfor the %s method \"%s\", signature \"%s\"\n\n",
methInfo[i].inst?"instance":"static",
methInfo[i].m_name, methInfo[i].m_sign);
@@ -175,8 +170,7 @@
JNIEXPORT jint JNICALL
Java_nsk_jvmti_GetLocalVariableTable_localtab004_check(
JNIEnv *env, jobject obj, jobject testedObj) {
- jclass testedCls = NSK_CPP_STUB2(GetObjectClass,
- env, testedObj);
+ jclass testedCls = env->GetObjectClass(testedObj);
if (!caps.can_access_local_variables)
return PASSED;
@@ -208,12 +202,10 @@
/* add capability to access local variables */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_access_local_variables = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_access_local_variables)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -107,13 +107,9 @@
/* get the JNI method ID for a method with name m_name and
signature m_sign */
if (methInfo[i].inst) /* an instance method */
- methInfo[i].mid = NSK_CPP_STUB4(GetMethodID,
- jni_env, testedCls,
- methInfo[i].m_name, methInfo[i].m_sign);
+ methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
else /* a static method */
- methInfo[i].mid = NSK_CPP_STUB4(GetStaticMethodID,
- jni_env, testedCls,
- methInfo[i].m_name, methInfo[i].m_sign);
+ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
if (methInfo[i].mid == NULL) {
NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
methInfo[i].inst?"instance":"static",
@@ -122,8 +118,7 @@
}
/* get the LocalVariableTable attribute */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
- jvmti, methInfo[i].mid, &count, &lv_table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(methInfo[i].mid, &count, &lv_table))) {
NSK_COMPLAIN3("TEST FAILED: unable to get local variable table\n\tfor the %s method \"%s\", signature \"%s\"\n\n",
methInfo[i].inst?"instance":"static",
methInfo[i].m_name, methInfo[i].m_sign);
@@ -185,8 +180,7 @@
}
}
NSK_DISPLAY0("Deallocating the local variable table entries\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) lv_table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) lv_table))) {
totRes = STATUS_FAILED;
}
@@ -200,8 +194,7 @@
JNIEXPORT jint JNICALL
Java_nsk_jvmti_GetLocalVariableTable_localtab005_check(
JNIEnv *env, jobject obj, jobject testedObj) {
- jclass testedCls = NSK_CPP_STUB2(GetObjectClass,
- env, testedObj);
+ jclass testedCls = env->GetObjectClass(testedObj);
if (!caps.can_access_local_variables)
return PASSED;
@@ -233,12 +226,10 @@
/* add capability to access local variables */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_access_local_variables = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_access_local_variables)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -89,8 +89,7 @@
char *sign;
char *gen_sign;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti, testedMeth, &name, &sign, &gen_sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(testedMeth, &name, &sign, &gen_sign))) {
NSK_COMPLAIN1("TEST FAILED: unable to get class signature for \"%s\"\n\n",
meth_sig[clsIdx][methIdx][0]);
return STATUS_FAILED;
@@ -112,17 +111,14 @@
sign, (gen_sign==NULL)?"NULL":gen_sign);
NSK_DISPLAY0("Deallocating name & signature arrays\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) {
totRes = STATUS_FAILED;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) {
totRes = STATUS_FAILED;
}
if (gen_sign!=NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*) gen_sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) {
totRes = STATUS_FAILED;
}
}
@@ -135,8 +131,7 @@
JNIEnv *jni, jobject obj, jobject testedObj, jint clsIdx) {
int res = PASSED, i, instance;
jmethodID testedMeth = NULL;
- jclass objCls = NSK_CPP_STUB2(GetObjectClass,
- jni, testedObj);
+ jclass objCls = jni->GetObjectClass(testedObj);
for (i=0; i<METH_NUM; i++) {
instance = strcmp(meth_sig[clsIdx][i][1], "instance");
@@ -145,9 +140,7 @@
(instance==0)?"instance":"static",
meth_sig[clsIdx][i][0]);
if (instance==0) {
- if (!NSK_JNI_VERIFY(jni, (testedMeth = NSK_CPP_STUB4(GetMethodID,
- jni, objCls, meth_sig[clsIdx][i][0],
- meth_sig[clsIdx][i][2])) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) {
NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n",
meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]);
res = STATUS_FAILED;
@@ -155,9 +148,7 @@
}
}
else
- if (!NSK_JNI_VERIFY(jni, (testedMeth = NSK_CPP_STUB4(GetStaticMethodID,
- jni, objCls, meth_sig[clsIdx][i][0],
- meth_sig[clsIdx][i][2])) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) {
NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n",
meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]);
res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -60,8 +60,7 @@
jfieldID objectField = NULL;
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -69,8 +68,7 @@
NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -78,16 +76,14 @@
NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... got object: %p\n", (void*)testedObject);
NSK_DISPLAY1("Create global reference for object: %p\n", (void*)testedObject);
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -97,8 +93,7 @@
NSK_DISPLAY0(">>> Testcase #1: get initial hash code of the object\n");
{
NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &objectHashCode))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectHashCode(testedObject, &objectHashCode))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -110,8 +105,7 @@
jint hashCode = 0;
NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &hashCode))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectHashCode(testedObject, &hashCode))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -141,7 +135,7 @@
NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &hashCode))) {
+ jvmti->GetObjectHashCode(testedObject, &hashCode))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -162,7 +156,7 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete object reference: %p\n", (void*)testedObject);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,8 +57,7 @@
jfieldID objectField = NULL;
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -66,8 +65,7 @@
NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -75,16 +73,14 @@
NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject);
NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -94,8 +90,7 @@
NSK_DISPLAY0(">>> Testcase #1: get initial size of the object\n");
{
NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &objectSize))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &objectSize))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -113,8 +108,7 @@
jlong size = 0;
NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &size))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -142,8 +136,7 @@
return;
NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &size))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -163,7 +156,7 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete object reference: 0x%p\n", (void*)testedObject);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -63,17 +63,13 @@
NSK_DISPLAY2("Allocate memory for lists: %d objects for %d tags\n",
objectsCount, tagsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (size * sizeof(jobject)),
- (unsigned char**)objects))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((size * sizeof(jobject)), (unsigned char**)objects))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... allocated objects list: 0x%p\n", (void*)objects);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (tagsCount * sizeof(jlong)),
- (unsigned char**)tags))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((tagsCount * sizeof(jlong)), (unsigned char**)tags))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -91,8 +87,7 @@
}
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -100,8 +95,7 @@
NSK_DISPLAY1("Find static field: %s\n", OBJECTS_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -109,8 +103,7 @@
NSK_DISPLAY1("Get objects array from static field: %s\n", OBJECTS_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (arrayObject = (jobjectArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -120,8 +113,7 @@
jsize arrayLen = 0;
jsize k;
- if (!NSK_JNI_VERIFY(jni, (arrayLen =
- NSK_CPP_STUB2(GetArrayLength, jni, arrayObject)) == size)) {
+ if (!NSK_JNI_VERIFY(jni, (arrayLen = jni->GetArrayLength(arrayObject)) == size)) {
NSK_DISPLAY1(" ... got array length: %d\n", (int)size);
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -131,13 +123,11 @@
for (k = 0; k < size; k++) {
jobject object = NULL;
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetObjectArrayElement, jni, arrayObject, k)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -162,14 +152,14 @@
NSK_DISPLAY1("Release objects references: %d objects\n", size);
for (k = 0; k < size; k++) {
if (objects[k] != NULL) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, objects[k]));
+ NSK_TRACE(jni->DeleteGlobalRef(objects[k]));
}
}
NSK_DISPLAY1(" ... object references released: %d objects\n", size);
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objects);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects))) {
+ jvmti->Deallocate((unsigned char*)objects))) {
nsk_jvmti_setFailStatus();
}
@@ -178,7 +168,7 @@
NSK_DISPLAY1("Deallocate tags list: 0x%p\n", (void*)tags);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)tags))) {
+ jvmti->Deallocate((unsigned char*)tags))) {
nsk_jvmti_setFailStatus();
}
@@ -197,8 +187,7 @@
NSK_DISPLAY1("Get tagged objects: %d tags\n", tagsCount);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, tagsCount, tags,
- &taggedObjectsCount, &taggedObjectsList, &taggedObjectsTags))) {
+ jvmti->GetObjectsWithTags(tagsCount, tags, &taggedObjectsCount, &taggedObjectsList, &taggedObjectsTags))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -258,7 +247,7 @@
for (j = 0; j < objectsCount; j++) {
jobject foundObject = ITEM(objects, i, j);
- if (NSK_CPP_STUB3(IsSameObject, jni, object, foundObject)) {
+ if (jni->IsSameObject(object, foundObject)) {
objectsFound++;
if (expectedCount > 0)
@@ -295,12 +284,12 @@
NSK_DISPLAY1("Deallocate got objects list: 0x%p\n", (void*)taggedObjectsList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsList))) {
+ jvmti->Deallocate((unsigned char*)taggedObjectsList))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY1("Deallocate got tags list: 0x%p\n", (void*)taggedObjectsTags);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsTags))) {
+ jvmti->Deallocate((unsigned char*)taggedObjectsTags))) {
nsk_jvmti_setFailStatus();
}
@@ -338,8 +327,7 @@
NSK_DISPLAY3(" #%d: object: 0x%p, tag: %ld\n",
j, (void*)object, (long)tags[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, object, tags[i]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tags[i]))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -384,8 +372,7 @@
NSK_DISPLAY3(" #%d: object: 0x%p, tag: %ld\n",
j, (void*)object, (long)tag);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, object, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -455,8 +442,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,14 +45,14 @@
VMStart(jvmtiEnv *jvmti, JNIEnv* jni) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("VMStart\n");
/* testcase #2: check JVMTI_PHASE_START */
NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -60,7 +60,7 @@
was_VMStart = JNI_TRUE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -68,14 +68,14 @@
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("VMInit\n");
/* testcase #3: check JVMTI_PHASE_LIVE */
NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -83,7 +83,7 @@
was_VMInit = JNI_TRUE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -93,7 +93,7 @@
void* address, void** new_address_ptr) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("NativeMethodBind\n");
@@ -102,7 +102,7 @@
/* testcase #5: check JVMTI_PHASE_PRIMORDIAL */
NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_PRIMORDIAL\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_PRIMORDIAL))
@@ -112,7 +112,7 @@
/* testcase #2: check JVMTI_PHASE_START */
NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -122,7 +122,7 @@
/* testcase #3: check JVMTI_PHASE_LIVE */
NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -132,14 +132,14 @@
/* testcase #4: check JVMTI_PHASE_DEAD */
NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -154,7 +154,7 @@
unsigned char** new_class_data) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("ClassFileLoadHook: %s\n", name);
@@ -163,7 +163,7 @@
/* testcase #5: check JVMTI_PHASE_PRIMORDIAL */
NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_PRIMORDIAL\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_PRIMORDIAL))
@@ -173,7 +173,7 @@
/* testcase #2: check JVMTI_PHASE_START */
NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -183,7 +183,7 @@
/* testcase #3: check JVMTI_PHASE_LIVE */
NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -193,14 +193,14 @@
/* testcase #4: check JVMTI_PHASE_DEAD */
NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -208,14 +208,14 @@
VMDeath(jvmtiEnv *jvmti, JNIEnv* jni) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("VMDeath\n");
/* testcase #3: check JVMTI_PHASE_LIVE */
NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -223,7 +223,7 @@
was_VMDeath = JNI_TRUE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
@@ -242,7 +242,7 @@
/* testcase #3: check JVMTI_PHASE_LIVE */
NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -289,13 +289,12 @@
/* Create data access lock */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti,
- "_access_lock", &access_lock)))
+ jvmti->CreateRawMonitor("_access_lock", &access_lock)))
return JNI_ERR;
/* testcase #1: check JVMTI_PHASE_ONLOAD */
NSK_DISPLAY0("Testcase #1: check if GetPhase returns JVMTI_PHASE_ONLOAD\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
if (!NSK_VERIFY(phase == JVMTI_PHASE_ONLOAD))
@@ -305,7 +304,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&callbacks, 0, sizeof(callbacks));
@@ -315,38 +314,32 @@
callbacks.NativeMethodBind = &NativeMethodBind;
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMStart event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_START, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
return JNI_ERR;
/* enable VMInit event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
/* enable NativeMethodBind event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
return JNI_ERR;
/* enable ClassFileLoadHook event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
/* enable VMDeath event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_DEATH, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
/* register agent proc and arg */
@@ -373,7 +366,7 @@
/* testcase #4: check JVMTI_PHASE_DEAD */
NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
exit(97);
if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -47,7 +47,7 @@
NSK_DISPLAY0("Check if GetPhase(NULL) returns JVMTI_ERROR_NULL_POINTER\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
- NSK_CPP_STUB2(GetPhase, jvmti, NULL)))
+ jvmti->GetPhase(NULL)))
nsk_jvmti_setFailStatus();
/* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -130,7 +130,7 @@
NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps))) {
+ jvmti->GetPotentialCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -233,8 +233,7 @@
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -42,7 +42,7 @@
NSK_DISPLAY0("Invoke GetSystemProperties()\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+ jvmti->GetSystemProperties(&count, &properties))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -75,7 +75,7 @@
}
NSK_DISPLAY0("Deallocate properties list\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+ jvmti->Deallocate((unsigned char*)properties))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,7 +56,7 @@
NSK_DISPLAY0("Get system properties list\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+ jvmti->GetSystemProperties(&count, &properties))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got properties: %d\n", (int)count);
@@ -108,7 +108,7 @@
NSK_DISPLAY0("Deallocate properties list\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+ jvmti->Deallocate((unsigned char*)properties))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -42,7 +42,7 @@
NSK_DISPLAY0("Get system properties names\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+ jvmti->GetSystemProperties(&count, &properties))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got properties: %d\n", (int)count);
@@ -65,7 +65,7 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperty, jvmti, properties[i], &value))) {
+ jvmti->GetSystemProperty(properties[i], &value))) {
success = NSK_FALSE;
continue;
}
@@ -81,7 +81,7 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)value))) {
+ jvmti->Deallocate((unsigned char*)value))) {
success = NSK_FALSE;
}
}
@@ -90,7 +90,7 @@
NSK_DISPLAY0("Deallocate properties list\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+ jvmti->Deallocate((unsigned char*)properties))) {
success = NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,7 +53,7 @@
NSK_DISPLAY1("Get value of tested property: %s\n", desc->name);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperty, jvmti, desc->name, &value))) {
+ jvmti->GetSystemProperty(desc->name, &value))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got value: \"%s\"\n", nsk_null_string(value));
@@ -73,7 +73,7 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)value))) {
+ jvmti->Deallocate((unsigned char*)value))) {
success = NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,7 +61,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -69,8 +69,7 @@
NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -78,8 +77,7 @@
NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -87,7 +85,7 @@
NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject);
if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+ jni->NewGlobalRef(testedObject)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -100,7 +98,7 @@
NSK_DISPLAY1("Get tag for object: 0x%p\n", (void*)testedObject);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTag, jvmti, testedObject, &objectTag))) {
+ jvmti->GetTag(testedObject, &objectTag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -120,7 +118,7 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete object reference: 0x%p\n", (void*)testedObject);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
}
}
@@ -164,7 +162,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -71,7 +71,7 @@
NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing NULL): 0x%p\n", (void*)thread);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, NULL, (jlong *)time))) {
+ jvmti->GetThreadCpuTime(NULL, (jlong *)time))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -261,7 +261,7 @@
jvmtiThreadInfo threadInfo;
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -285,7 +285,7 @@
jvmtiThreadInfo threadInfo;
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -338,7 +338,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_thread_cpu_time = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -354,8 +354,7 @@
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
int success = NSK_TRUE;
NSK_DISPLAY1("GetThreadCpuTime() for thread: 0x%p\n", (void*)thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, (jlong *)time))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thread, (jlong *)time))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -265,8 +264,7 @@
jvmtiThreadInfo threadInfo;
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -282,8 +280,7 @@
}
if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) {
- if (!NSK_JNI_VERIFY(jni, (testedThread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
}
@@ -302,8 +299,7 @@
jvmtiThreadInfo threadInfo;
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -324,7 +320,7 @@
if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) {
nsk_jvmti_setFailStatus();
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
testedThread = NULL;
}
}
@@ -365,8 +361,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -381,9 +376,7 @@
eventCallbacks.VMDeath = callbackVMDeath;
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,7 +66,7 @@
NSK_DISPLAY0("GetThreadCpuTimerInfo() for current JVMTI env\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, info))) {
+ jvmti->GetThreadCpuTimerInfo(info))) {
return NSK_FALSE;
}
NSK_DISPLAY0("Got timer info:\n");
@@ -260,7 +260,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_thread_cpu_time = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -276,8 +276,7 @@
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -81,7 +81,7 @@
NSK_DISPLAY0("Get top level thread groups\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTopThreadGroups, jvmti, &topGroupsCount, &topGroups))) {
+ jvmti->GetTopThreadGroups(&topGroupsCount, &topGroups))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -110,8 +110,7 @@
NSK_DISPLAY1("Get children of root thread group: %p\n", (void*)rootGroup);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, rootGroup,
- &threadsCount, &threads, &groupsCount, &groups))) {
+ jvmti->GetThreadGroupChildren(rootGroup, &threadsCount, &threads, &groupsCount, &groups))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -142,7 +141,7 @@
jvmtiThreadGroupInfo info;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, groups[i], &info))) {
+ jvmti->GetThreadGroupInfo(groups[i], &info))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -221,11 +220,11 @@
/* deallocate arrays */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+ jvmti->Deallocate((unsigned char*)groups))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
}
}
@@ -258,8 +257,7 @@
jthreadGroup* groups = NULL;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, group,
- &threadsCount, &threads, &groupsCount, &groups))) {
+ jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -290,7 +288,7 @@
jvmtiThreadInfo info;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+ jvmti->GetThreadInfo(threads[i], &info))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -314,11 +312,11 @@
/* deallocate arrays */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+ jvmti->Deallocate((unsigned char*)groups))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
}
}
@@ -339,8 +337,7 @@
jthreadGroup * groups = NULL;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, groupsList[i],
- &threadsCount, &threads, &groupsCount, &groups))) {
+ jvmti->GetThreadGroupChildren(groupsList[i], &threadsCount, &threads, &groupsCount, &groups))) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -357,7 +354,7 @@
if (groups[i] != NULL) {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, groups[i], &info))) {
+ jvmti->GetThreadGroupInfo(groups[i], &info))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -376,11 +373,11 @@
/* deallocate arrays */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+ jvmti->Deallocate((unsigned char*)groups))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,7 +59,7 @@
NSK_DISPLAY1("GetThreadLocalStorage() for tested thread: %p\n", (void*)testedThread);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadLocalStorage, jvmti, testedThread, &storage))) {
+ jvmti->GetThreadLocalStorage(testedThread, &storage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -76,7 +76,7 @@
NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadLocalStorage, jvmti, NULL, &storage))) {
+ jvmti->GetThreadLocalStorage(NULL, &storage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -91,7 +91,7 @@
}
NSK_DISPLAY0("Delete thread reference\n");
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,7 +59,7 @@
NSK_DISPLAY0("GetTime() for current JVMTI env\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, jvmti, (jlong *)time))) {
+ jvmti->GetTime((jlong *)time))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got time: %s\n", julong_to_string(*time, buf));
@@ -186,8 +186,7 @@
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,7 +59,7 @@
NSK_DISPLAY0("GetTimerInfo() for current JVMTI env\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, jvmti, info))) {
+ jvmti->GetTimerInfo(info))) {
return NSK_FALSE;
}
NSK_DISPLAY0("Got timer info:\n");
@@ -203,8 +203,7 @@
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,7 +57,7 @@
/* get all live threads */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -70,7 +70,7 @@
/* get thread information */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -89,7 +89,7 @@
/* deallocate threads list */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
return NSK_TRUE;
@@ -112,8 +112,7 @@
if (!NSK_VERIFY(runningThread != NULL)) {
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
- jvmti, runningThread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(runningThread)))
nsk_jvmti_setFailStatus();
}
@@ -121,8 +120,7 @@
if (!NSK_VERIFY(waitingThread != NULL)) {
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
- jvmti, waitingThread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(waitingThread)))
nsk_jvmti_setFailStatus();
}
@@ -130,8 +128,7 @@
if (!NSK_VERIFY(sleepingThread != NULL)) {
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
- jvmti, sleepingThread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(sleepingThread)))
nsk_jvmti_setFailStatus();
}
@@ -173,7 +170,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_signal_thread = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -60,7 +60,7 @@
NSK_DISPLAY3("Call IsObsolete() for %s method: %p (%s)\n", kind, (void*)method, name);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &obsolete))) {
+ jvmti->IsMethodObsolete(method, &obsolete))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY1(" ... got obsolete: %d\n", (int)obsolete);
@@ -83,8 +83,7 @@
NSK_DISPLAY1("Get stack frames for thread: %p\n", (void*)thread);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH,
- frameStack, &frameCount))) {
+ jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, frameStack, &frameCount))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -104,8 +103,7 @@
NSK_DISPLAY1(" frame #%i:\n", i);
NSK_DISPLAY1(" methodID: %p\n", (void*)frameStack[i].method);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(GetMethodName, jvmti, frameStack[i].method,
- &name, &signature, &generic))) {
+ jvmti->GetMethodName(frameStack[i].method, &name, &signature, &generic))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -122,15 +120,15 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name))) {
+ jvmti->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature))) {
+ jvmti->Deallocate((unsigned char*)signature))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic))) {
+ jvmti->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -156,7 +154,7 @@
NSK_DISPLAY1("Redefine class: %s\n", className);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -176,7 +174,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -184,8 +182,7 @@
NSK_DISPLAY1("Find static field: %s\n", CLASSFILE_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -193,15 +190,14 @@
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", CLASSFILE_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- fieldID)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: %p\n", (void*)array);
if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -210,8 +206,7 @@
{
jboolean isCopy;
if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -219,7 +214,7 @@
NSK_DISPLAY1(" ... got elements list: %p\n", (void*)elements);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -231,7 +226,7 @@
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: %p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
@@ -264,7 +259,7 @@
{
NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, TESTED_CLASS_NAME)) != NULL)) {
+ jni->FindClass(TESTED_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -272,7 +267,7 @@
NSK_DISPLAY1("Make global reference for class object: %p\n", (void*)testedClass);
if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) {
+ jni->NewGlobalRef(testedClass)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -280,8 +275,7 @@
NSK_DISPLAY1("Get static methodID: %s\n", STATIC_METHOD_NAME);
if (!NSK_JNI_VERIFY(jni, (staticMethodID =
- NSK_CPP_STUB4(GetStaticMethodID, jni, testedClass,
- STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) {
+ jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -289,8 +283,7 @@
NSK_DISPLAY1("Get instance methodID: %s\n", INSTANCE_METHOD_NAME);
if (!NSK_JNI_VERIFY(jni, (instanceMethodID =
- NSK_CPP_STUB4(GetMethodID, jni, testedClass,
- INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) {
+ jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -342,15 +335,15 @@
{
NSK_DISPLAY1("Deallocate classfile bytes array: %p\n", (void*)classfileBytes);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, classfileBytes))) {
+ jvmti->Deallocate(classfileBytes))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY1("Delete global eference to thread: %p\n", (void*)testedThread);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
NSK_DISPLAY1("Delete global reference to class: %p\n", (void*)testedClass);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
}
}
@@ -394,7 +387,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -134,9 +134,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -153,7 +151,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -161,7 +159,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -169,7 +167,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,8 +175,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -186,8 +183,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -195,8 +191,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -204,8 +199,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -213,8 +207,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -312,7 +305,7 @@
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -430,9 +423,7 @@
NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -542,7 +533,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -552,8 +543,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -134,9 +134,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -153,7 +151,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -161,7 +159,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -169,7 +167,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,8 +175,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -186,8 +183,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -195,8 +191,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -204,8 +199,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -213,8 +207,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -312,7 +305,7 @@
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -438,9 +431,7 @@
NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -550,7 +541,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -560,8 +551,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -134,9 +134,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -153,7 +151,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -161,7 +159,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -169,7 +167,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,8 +175,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -186,8 +183,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -195,8 +191,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -204,8 +199,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -213,8 +207,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -312,7 +305,7 @@
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -439,9 +432,7 @@
NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -551,7 +542,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -561,8 +552,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -65,9 +65,7 @@
*tag_ptr = (jlong)++objectDescCount;
/* Allocate memory for next list element*/
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("heapObjectCallbackForFirstIteration: Allocation failed. Iteration aborted.\n");
@@ -97,7 +95,7 @@
/* Deallocate memory of list element*/
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("heapObjectCallbackForSecondIteration: Deallocation failed. Iteration aborted.\n");
@@ -133,9 +131,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallbackForFirstIteration,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallbackForFirstIteration, &fakeUserData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -151,17 +147,13 @@
}
/* Allocate memory for array to save pointers to ObjectDescList elements */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (objectDescCount * sizeof(ObjectDesc*)),
- (unsigned char**)&objectDescArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectDescCount * sizeof(ObjectDesc*)), (unsigned char**)&objectDescArr))) {
nsk_jvmti_setFailStatus();
break;
}
/* Allocate memory for flags array and fill with false values */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (objectDescCount * sizeof(unsigned char)),
- &deallocatedFlagsArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectDescCount * sizeof(unsigned char)), &deallocatedFlagsArr))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -186,9 +178,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallbackForSecondIteration,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallbackForSecondIteration, &fakeUserData))) {
nsk_jvmti_setFailStatus();
}
}
@@ -202,7 +192,7 @@
for (ind = 0; ind < objectDescCount; ind++) {
if (!deallocatedFlagsArr[ind]) {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
NSK_COMPLAIN1("Unable to deallocate descriptor. Index = %d \n", ind);
nsk_jvmti_setFailStatus();
return;
@@ -211,12 +201,12 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr))) {
+ jvmti->Deallocate((unsigned char*)objectDescArr))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)deallocatedFlagsArr))) {
+ jvmti->Deallocate((unsigned char*)deallocatedFlagsArr))) {
nsk_jvmti_setFailStatus();
}
@@ -258,12 +248,11 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -51,54 +51,54 @@
objCounter++;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+ st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+ st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -119,11 +119,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- &fakeUserData))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
}
}
@@ -174,7 +170,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -46,12 +46,12 @@
void* storage_data) {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ st_jvmti->SetEnvironmentLocalStorage(storage_data ))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -73,11 +73,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- (void *)storage_data))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)storage_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -135,7 +131,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -46,7 +46,7 @@
void* user_data) {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1 ))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -65,13 +65,13 @@
/* ---------------------------------------------------------------------- */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ st_jvmti->GetCurrentThreadCpuTime(&nanos ))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ st_jvmti->GetTimerInfo(&timer_info2 ))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -91,7 +91,7 @@
nanos = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ st_jvmti->GetTime(&nanos ))) {
nsk_jvmti_setFailStatus();
}
@@ -113,11 +113,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- (void *)user_data))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)user_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -164,7 +160,7 @@
caps.can_get_current_thread_cpu_time = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -136,9 +136,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -155,7 +153,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -163,7 +161,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -171,7 +169,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -179,7 +177,7 @@
NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+ jni->NewGlobalRef(chainObjectClass)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -187,8 +185,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -196,8 +193,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -205,8 +201,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -214,8 +209,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -223,8 +217,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -234,7 +227,7 @@
NSK_DISPLAY0(" tested class object:\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+ jvmti->SetTag(*testedClass, testedClassTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -329,13 +322,13 @@
ObjectDesc* objectDescList, jclass testedClass) {
if (testedClass != NULL) {
NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
}
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -450,9 +443,7 @@
NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback, &fakeUserData))) {
+ jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -561,7 +552,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -571,8 +562,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -136,9 +136,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -155,7 +153,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -163,7 +161,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -171,7 +169,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -179,7 +177,7 @@
NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+ jni->NewGlobalRef(chainObjectClass)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -187,8 +185,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -196,8 +193,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -205,8 +201,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -214,8 +209,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -223,8 +217,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -234,7 +227,7 @@
NSK_DISPLAY0(" tested class object:\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+ jvmti->SetTag(*testedClass, testedClassTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -329,13 +322,13 @@
ObjectDesc* objectDescList, jclass testedClass) {
if (testedClass != NULL) {
NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
}
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -458,9 +451,7 @@
NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_TAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback, &fakeUserData))) {
+ jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -569,7 +560,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -579,8 +570,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -92,14 +92,14 @@
tag++;
if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -111,7 +111,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -136,9 +136,7 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -155,7 +153,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -163,7 +161,7 @@
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -171,7 +169,7 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -179,7 +177,7 @@
NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+ jni->NewGlobalRef(chainObjectClass)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -187,8 +185,7 @@
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -196,8 +193,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -205,8 +201,7 @@
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -214,8 +209,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -223,8 +217,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -234,7 +227,7 @@
NSK_DISPLAY0(" tested class object:\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+ jvmti->SetTag(*testedClass, testedClassTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -329,13 +322,13 @@
ObjectDesc* objectDescList, jclass testedClass) {
if (testedClass != NULL) {
NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
}
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -459,9 +452,7 @@
NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_UNTAGGED,
- heapObjectCallback, &fakeUserData))) {
+ jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -570,7 +561,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
@@ -580,8 +571,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ObjectFree = callbackObjectFree;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,9 +61,7 @@
/* Set tag */
*tag_ptr = objectCount;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, st_jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
allocationError = 1;
}
@@ -83,8 +81,7 @@
objectCount--;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, st_jvmti, (unsigned char*)objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->Deallocate((unsigned char*)objectDescBuf))) {
nsk_jvmti_setFailStatus();
}
@@ -115,12 +112,7 @@
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_UNTAGGED,
- heapObjectCallback1,
- &userData))) {
+ jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback1, &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -139,12 +131,7 @@
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_TAGGED\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback2,
- &userData))) {
+ jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback2, &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -200,7 +187,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -49,55 +49,46 @@
objCounter++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -127,12 +118,10 @@
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- &fakeUserData))) {
+ jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heapObjectCallback,
+ &fakeUserData))) {
nsk_jvmti_setFailStatus();
}
}
@@ -182,8 +171,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -45,13 +45,11 @@
jlong* tag_ptr,
void* storage_data) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -82,12 +80,10 @@
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- (void *)storage_data))) {
+ jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heapObjectCallback,
+ (void *) storage_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -144,8 +140,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -46,8 +46,7 @@
jlong* tag_ptr,
void* user_data) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -65,14 +64,12 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -91,8 +88,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
@@ -123,12 +119,10 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- (void *)user_data))) {
+ jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heapObjectCallback,
+ (void *) user_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -174,8 +168,7 @@
caps.can_tag_objects = 1;
caps.can_get_current_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -85,15 +85,13 @@
count--;
tag++;
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" tag=%-5ld object=0x%p\n", (long)objTag, (void*)obj);
@@ -104,7 +102,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return NSK_TRUE;
}
@@ -127,9 +125,8 @@
*objectsCount = 1 + 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)),
+ (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -144,16 +141,14 @@
}
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass);
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -161,34 +156,31 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)chainObjectClass);
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)objectField);
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID(
+ rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)reachableChainField);
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID(
+ rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -196,8 +188,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -205,15 +196,13 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (*rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)*rootObject);
- if (!NSK_JNI_VERIFY(jni, (*rootObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, *rootObject)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -222,8 +211,7 @@
NSK_DISPLAY0("Obtain and tag chain objects:\n");
NSK_DISPLAY0(" root tested object:\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, *rootObject, rootObjectTag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*rootObject, rootObjectTag))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" tag=%-5ld object=0x%p\n", (long)rootObjectTag, (void*)*rootObject);
@@ -304,13 +292,12 @@
ObjectDesc* objectDescList, jobject rootObject) {
if (rootObject != NULL) {
NSK_DISPLAY1("Release object reference to root tested object: 0x%p\n", rootObject);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, rootObject));
+ NSK_TRACE(jni->DeleteGlobalRef(rootObject));
}
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -445,7 +432,7 @@
NSK_DISPLAY0(">>> Start iteration for root tested object\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
+ jvmti->IterateOverObjectsReachableFromObject(
rootObject, objectReferenceCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
@@ -529,8 +516,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,9 +66,8 @@
/* Set tag */
*tag_ptr = objectCount;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, st_jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->Allocate((sizeof(ObjectDesc)),
+ (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
allocationError = 1;
}
@@ -91,8 +90,7 @@
objectCount--;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, st_jvmti, (unsigned char*)objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->Deallocate((unsigned char*)objectDescBuf))) {
nsk_jvmti_setFailStatus();
}
@@ -123,29 +121,23 @@
}
NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- objectFieldName, debugeeClassSignature)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with allocation\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- object,
- objectReferenceCallback1,
- &userData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ object, objectReferenceCallback1, &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -161,12 +153,8 @@
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with deallocation\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- object,
- objectReferenceCallback2,
- &userData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ object, objectReferenceCallback2, &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -221,8 +209,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,55 +53,46 @@
objCounter++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -131,29 +122,23 @@
}
NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- objectFieldName, debugeeClassSignature)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- object,
- objectReferenceCallback,
- &fakeUserData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ object, objectReferenceCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
}
}
@@ -203,8 +188,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,13 +52,11 @@
objCounter++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -89,29 +87,23 @@
}
NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- objectFieldName, debugeeClassSignature)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- object,
- objectReferenceCallback,
- &fakeUserData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ object, objectReferenceCallback, &fakeUserData))) {
nsk_jvmti_setFailStatus();
}
}
@@ -173,8 +165,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,8 +52,7 @@
objCounter++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -71,14 +70,12 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -97,8 +94,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
@@ -131,29 +127,23 @@
}
NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- objectFieldName, debugeeClassSignature)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- object,
- objectReferenceCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ object, objectReferenceCallback, &user_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -205,8 +195,7 @@
caps.can_tag_objects = 1;
caps.can_get_current_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -87,15 +87,13 @@
count--;
tag++;
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
objectDescList[count].tag = objTag;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, objTag))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -107,7 +105,7 @@
return NSK_FALSE;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+ NSK_TRACE(jni->DeleteLocalRef(obj));
return success;
}
@@ -131,9 +129,8 @@
*objectsCount = 2 * chainLength;
NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
- (unsigned char**)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)),
+ (unsigned char**)objectDescList))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -148,16 +145,14 @@
}
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass);
NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
- NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -165,34 +160,31 @@
NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
- NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+ jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)chainObjectClass);
NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+ debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)objectField);
NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (reachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID(
+ rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)reachableChainField);
NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
- if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
- NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
- UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID(
+ rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -200,8 +192,7 @@
NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (tailField =
- NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
- TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -209,8 +200,7 @@
NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (rootObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -288,8 +278,7 @@
ObjectDesc* objectDescList) {
if (objectDescList != NULL) {
NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
nsk_jvmti_setFailStatus();
}
}
@@ -638,9 +627,10 @@
NSK_DISPLAY0(">>> Start iteration over reachable objects\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback, stackReferenceCallback,
- objectReferenceCallback, &fakeUserData))) {
+ jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ &fakeUserData))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -722,8 +712,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -75,9 +75,7 @@
/* Set tag */
*tag_ptr = (jlong)++objectCount;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("heapRootCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -121,8 +119,7 @@
(long)*tag_ptr, (long)tag, objectCount);
*/
/* Deallocate memory of list element*/
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("heapRootCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -156,9 +153,7 @@
/* Set tag */
*tag_ptr = (jlong)++objectCount;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("stackReferenceCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -206,8 +201,7 @@
(long)*tag_ptr, (long)tag, objectCount);
*/
/* Deallocate memory of list element*/
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("stackReferenceCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -239,9 +233,7 @@
/* Set tag */
*tag_ptr = (jlong)++objectCount;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("objectReferenceCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -287,8 +279,7 @@
(long)*tag_ptr, (long)tag, objectCount);
*/
/* Deallocate memory of list element*/
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
nsk_jvmti_setFailStatus();
callbackAborted = 1;
NSK_COMPLAIN0("objectReferenceCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -320,9 +311,8 @@
{
do {
/* Allocate memory for first element of objectList */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
- (unsigned char**)&objectDescBuf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)),
+ (unsigned char**)&objectDescBuf))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -331,13 +321,11 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects with allocating object descriptors\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects,
- jvmti,
- heapRootCallbackForFirstObjectsIteration,
- stackReferenceCallbackForFirstObjectsIteration,
- objectReferenceCallbackForFirstObjectsIteration,
- &userData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(
+ heapRootCallbackForFirstObjectsIteration,
+ stackReferenceCallbackForFirstObjectsIteration,
+ objectReferenceCallbackForFirstObjectsIteration,
+ &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -357,25 +345,22 @@
objectCountMax = objectCount;
/* Deallocate last unnecessary descriptor */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
NSK_COMPLAIN0("Unable to deallocate last unnecessary descriptor. \n");
nsk_jvmti_setFailStatus();
break;
}
/* Allocate memory for array to save pointers to ObjectDescList elements */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (objectCount * sizeof(ObjectDesc*)),
- (unsigned char**)&objectDescArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectCount * sizeof(ObjectDesc*)),
+ (unsigned char**)&objectDescArr))) {
nsk_jvmti_setFailStatus();
break;
}
/* Allocate memory for flags array and fill with false values */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (objectCountMax * sizeof(short)),
- (unsigned char**)&deallocatedFlagsArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectCountMax * sizeof(short)),
+ (unsigned char**)&deallocatedFlagsArr))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -395,13 +380,11 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects with deallocating object descriptors\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects,
- jvmti,
- heapRootCallbackForSecondObjectsIteration,
- stackReferenceCallbackForSecondObjectsIteration,
- objectReferenceCallbackForSecondObjectsIteration,
- &userData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(
+ heapRootCallbackForSecondObjectsIteration,
+ stackReferenceCallbackForSecondObjectsIteration,
+ objectReferenceCallbackForSecondObjectsIteration,
+ &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -415,8 +398,7 @@
for (ind = 0; ind < objectCountMax; ind++) {
if (!deallocatedFlagsArr[ind]) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
NSK_COMPLAIN1("Unable to deallocate descriptor. Index = %d \n", ind);
nsk_jvmti_setFailStatus();
return;
@@ -424,13 +406,11 @@
}
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)deallocatedFlagsArr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)deallocatedFlagsArr))) {
nsk_jvmti_setFailStatus();
}
@@ -472,13 +452,11 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
@@ -491,15 +469,15 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done.\n");
NSK_DISPLAY0("enabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,55 +54,46 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "heapRootMonitor", &monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("heapRootMonitor", &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
/*
@@ -127,55 +118,46 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "stackRefMonitor", &monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("stackRefMonitor", &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
/*
@@ -199,55 +181,46 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "objRefMonitor", &monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("objRefMonitor", &monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Enter second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
/* Exit second time */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -270,12 +243,10 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects,
- jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- &userData))) {
+ jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -333,8 +304,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,14 +54,12 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
@@ -100,14 +98,12 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
@@ -145,14 +141,12 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
nsk_jvmti_setFailStatus();
return JVMTI_ITERATION_ABORT;
}
@@ -190,12 +184,10 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
{
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects,
- jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- &userData))) {
+ jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -253,8 +245,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,8 +53,7 @@
if (!nsk_jvmti_isFailStatus()) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -72,14 +71,12 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -98,8 +95,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
}
@@ -126,8 +122,7 @@
if (!nsk_jvmti_isFailStatus()) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -145,14 +140,12 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -171,8 +164,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
}
@@ -196,8 +188,7 @@
*tag_ptr = (jlong)++objCounter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -215,15 +206,13 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
}
/* Check the returned jvmtiTimerInfo structure */
@@ -242,8 +231,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
}
@@ -265,13 +253,10 @@
do {
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects,
- jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- &userData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ &userData))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -330,8 +315,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_get_current_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -95,8 +95,7 @@
primitive_callbacks.heap_iteration_callback = &heap_callback;
NSK_DISPLAY0("Iterating over reachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, NULL, &primitive_callbacks, &invocations))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -139,14 +138,12 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -368,21 +368,14 @@
jobjectArray testObjects;
int object;
- if(!NSK_VERIFY(NULL !=
- (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+ if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjectsField = NSK_CPP_STUB4(GetStaticFieldID,
- jni, debugee,
- fieldName,
- fieldSig))))
+ if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjects = (jobjectArray)(NSK_CPP_STUB3(GetStaticObjectField,
- jni, debugee,
- testObjectsField)))))
+ if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+ debugee, testObjectsField)))))
return JNI_ERR;
// For each of test objects tag every field
@@ -393,33 +386,28 @@
jint field;
memset(&objects_info[object],0,sizeof(object_info_t));
- if(!NSK_VERIFY(NULL !=
- (target = NSK_CPP_STUB3(GetObjectArrayElement,jni,
- testObjects,object))))
+ if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+ return JNI_ERR;
+
+ if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (targetClass = NSK_CPP_STUB2(GetObjectClass, jni, target))))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, targetClass,
- &(objects_info[object].name), NULL)))
- return JNI_ERR;
-
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassFields, jvmti, targetClass,
- &(objects_info[object].fields_count),
- &targetFields)))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+ targetClass, &(objects_info[object].fields_count), &targetFields)))
return JNI_ERR;
objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
// Iterate over fields, collect info about it and tag non primitive fields.
for(field = 0; field < objects_info[object].fields_count; field++) {
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName, jvmti,
- targetClass, targetFields[field],
- &objects_info[object].fields[field].name,
- &objects_info[object].fields[field].signature,
- NULL)))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+ targetFields[field],
+ &objects_info[object].fields[field].name,
+ &objects_info[object].fields[field].signature,
+ NULL)))
return JNI_ERR;
if(is_primitive_type(objects_info[object].fields[field].signature)) {
objects_info[object].fields[field].primitive = 1;
@@ -427,49 +415,42 @@
jint modifiers;
jobject value;
int tag_type = get_tag_type(objects_info[object].fields[field].signature);
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
- targetClass, targetFields[field],
- &modifiers))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+ targetClass, targetFields[field], &modifiers))) {
return JNI_ERR;
}
if(modifiers & STATIC_FIELD) {
- if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetStaticObjectField, jni,
- targetClass,
- targetFields[field])))) {
+ if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass,
+ targetFields[field])))) {
return JNI_ERR;
}
} else {
- if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetObjectField, jni,
- target,
- targetFields[field])))) {
+ if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
return JNI_ERR;
}
}
//tag field's value
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, value,
- ENCODE_TAG(tag_type,object,field)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(tag_type,object,field)))) {
return JNI_ERR;
}
//remove local reference so object will have a chance to become unreachable
- NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)value);
+ jni->DeleteLocalRef((jobject)value);
}
}
// tag class and it's instance to pass this tag into primitive field callback
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target,
- ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, targetClass,
- ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
return JNI_ERR;
- NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)targetFields));
+ NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)targetFields));
- NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)target);
- NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)targetClass);
+ jni->DeleteLocalRef((jobject)target);
+ jni->DeleteLocalRef((jobject)targetClass);
}
- NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)testObjects);
+ jni->DeleteLocalRef((jobject)testObjects);
return JNI_OK;
}
@@ -480,10 +461,10 @@
int field;
for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
for(field = 0; field < objects_info[object].fields_count; field++) {
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].fields[field].name);
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].fields[field].signature);
+ jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
+ jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
}
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].name);
+ jvmti->Deallocate((unsigned char*)objects_info[object].name);
free(objects_info[object].fields);
}
}
@@ -553,8 +534,7 @@
primitive_callbacks.heap_iteration_callback = &heap_callback;
NSK_DISPLAY0("Iterating over reachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, NULL, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -571,8 +551,7 @@
}
NSK_DISPLAY0("Iterating over unreachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, NULL, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -618,15 +597,13 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
event_callbacks.ObjectFree = &object_free_callback;
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -152,36 +152,26 @@
jobject testObject;
jclass testObjectClass;
- if(!NSK_VERIFY(NULL !=
- (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+ if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjectField = NSK_CPP_STUB4(GetStaticFieldID,
- jni, debugee,
- fieldName,
- fieldSig))))
+ if(!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObject = (NSK_CPP_STUB3(GetStaticObjectField,
- jni, debugee,
- testObjectField)))))
+ if(!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField)))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjectClass = (NSK_CPP_STUB2(GetObjectClass,
- jni, testObject)))))
+ if(!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject)))))
return JNI_ERR;
// tag class and it's instance to pass this tag into primitive field callback
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testObject, TEST_OBJECT_TAG)))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObject, TEST_OBJECT_TAG)))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testObjectClass, TEST_OBJECT_TAG)))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObjectClass, TEST_OBJECT_TAG)))
return JNI_ERR;
- NSK_CPP_STUB2(DeleteLocalRef, jni, testObjectClass);
- NSK_CPP_STUB2(DeleteLocalRef, jni, testObject);
+ jni->DeleteLocalRef(testObjectClass);
+ jni->DeleteLocalRef(testObject);
return JNI_OK;
}
@@ -207,7 +197,7 @@
jvmtiHeapCallbacks primitive_callbacks;
jclass klass;
- if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass,jni,testClassName)))) {
+ if(!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) {
NSK_COMPLAIN1("Can't find class %s.\n",testClassName);
nsk_jvmti_setFailStatus();
return;
@@ -233,8 +223,7 @@
primitive_callbacks.heap_iteration_callback = &heap_callback;
NSK_DISPLAY0("Iterating over reachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, klass, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -251,8 +240,7 @@
}
NSK_DISPLAY0("Iterating over unreachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, klass, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -292,15 +280,13 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
event_callbacks.ObjectFree = &object_free_callback;
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -299,21 +299,14 @@
jobjectArray testObjects;
int object;
- if(!NSK_VERIFY(NULL !=
- (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+ if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjectsField = NSK_CPP_STUB4(GetStaticFieldID,
- jni, debugee,
- fieldName,
- fieldSig))))
+ if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (testObjects = (jobjectArray)(NSK_CPP_STUB3(GetStaticObjectField,
- jni, debugee,
- testObjectsField)))))
+ if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+ debugee, testObjectsField)))))
return JNI_ERR;
// For each of test objects tag every field
@@ -325,22 +318,17 @@
int tagged = object == 0;
memset(&objects_info[object],0,sizeof(object_info_t));
- if(!NSK_VERIFY(NULL !=
- (target = NSK_CPP_STUB3(GetObjectArrayElement,jni,
- testObjects,object))))
+ if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+ return JNI_ERR;
+
+ if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
return JNI_ERR;
- if(!NSK_VERIFY(NULL !=
- (targetClass = NSK_CPP_STUB2(GetObjectClass, jni, target))))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, targetClass,
- &(objects_info[object].name), NULL)))
- return JNI_ERR;
-
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassFields, jvmti, targetClass,
- &(objects_info[object].fields_count),
- &targetFields)))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+ targetClass, &(objects_info[object].fields_count), &targetFields)))
return JNI_ERR;
objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
@@ -350,15 +338,14 @@
jint modifiers;
int is_static = 0;
int is_primitive = 0;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName, jvmti,
- targetClass, targetFields[field],
- &objects_info[object].fields[field].name,
- &objects_info[object].fields[field].signature,
- NULL)))
+ if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+ targetFields[field],
+ &objects_info[object].fields[field].name,
+ &objects_info[object].fields[field].signature,
+ NULL)))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
- targetClass, targetFields[field],
- &modifiers))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+ targetClass, targetFields[field], &modifiers))) {
return JNI_ERR;
}
is_static = (modifiers & STATIC_FIELD) == STATIC_FIELD;
@@ -367,31 +354,26 @@
is_primitive = 1;
} else {
jobject value;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
- targetClass, targetFields[field],
- &modifiers))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+ targetClass, targetFields[field], &modifiers))) {
return JNI_ERR;
}
if(is_static) {
- if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetStaticObjectField, jni,
- targetClass,
- targetFields[field])))) {
+ if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(
+ targetClass, targetFields[field])))) {
return JNI_ERR;
}
} else {
- if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetObjectField, jni,
- target,
- targetFields[field])))) {
+ if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
return JNI_ERR;
}
}
if(tagged) {
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, value,
- ENCODE_TAG(FIELD_TAG,object,field)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(FIELD_TAG,object,field)))) {
return JNI_ERR;
}
}
- NSK_CPP_STUB2(DeleteLocalRef, jni, value);
+ jni->DeleteLocalRef(value);
}
objects_info[object].fields[field].expected =
@@ -403,20 +385,18 @@
// tag class and it's instance to pass this tag into primitive field callback
if(tagged) {
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target,
- ENCODE_TAG(OBJECT_TAG,object,0))))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(OBJECT_TAG,object,0))))
return JNI_ERR;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, targetClass,
- ENCODE_TAG(CLASS_TAG,object,0))))
+ if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(CLASS_TAG,object,0))))
return JNI_ERR;
}
- NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)targetFields));
- NSK_CPP_STUB2(DeleteLocalRef, jni, target);
- NSK_CPP_STUB2(DeleteLocalRef, jni, targetClass);
+ NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)targetFields));
+ jni->DeleteLocalRef(target);
+ jni->DeleteLocalRef(targetClass);
}
- NSK_CPP_STUB2(DeleteLocalRef, jni, testObjects);
+ jni->DeleteLocalRef(testObjects);
return JNI_OK;
}
@@ -428,12 +408,10 @@
int field;
for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
for(field = 0; field < objects_info[object].fields_count; field++) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)objects_info[object].fields[field].name);
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)objects_info[object].fields[field].signature);
+ jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
+ jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
}
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].name);
+ jvmti->Deallocate((unsigned char*)objects_info[object].name);
free(objects_info[object].fields);
}
}
@@ -494,8 +472,7 @@
primitive_callbacks.heap_iteration_callback = &heap_callback;
NSK_DISPLAY0("Iterating over reachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- filter_type, NULL, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -512,8 +489,7 @@
}
NSK_DISPLAY0("Iterating over unreachable objects.\n");
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- filter_type, NULL, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -526,9 +502,7 @@
* since it will free some memory that the callback will access.
*/
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return;
}
@@ -586,15 +560,13 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
event_callbacks.ObjectFree = &object_free_callback;
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -156,14 +156,13 @@
phase = ZERO_INVOCATIONS_PHASE;
for(i = 0; i < FILTER_COUNT; i++) {
- if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass, jni, types[i])))) {
+ if(!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) {
NSK_COMPLAIN1("Can't find class %s.\n",types[i]);
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Iterating through heap with klass-filter '%s'.\n",types[i]);
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, klass, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -171,13 +170,12 @@
phase = STATIC_FIELDS_FINDING_PHASE;
NSK_DISPLAY0("Iterating through heap with klass-filter 'java/lang/Class'.\n");
- if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass, jni, "java/lang/Class")))) {
+ if(!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) {
NSK_COMPLAIN0("Can't find class java/lang/Class.\n");
nsk_jvmti_setFailStatus();
return;
}
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
- 0, klass, &primitive_callbacks, NULL))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -222,14 +220,12 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
- if(!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+ if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -55,8 +55,8 @@
}
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object, obj))
eventsCount++;
}
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,8 +98,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -110,35 +107,30 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'endingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "endingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "endingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
/* get 'endingMonitor' object */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
return NSK_FALSE;
/* enable MonitorContendedEnter event */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+ NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -147,9 +139,9 @@
static int clean() {
/* disable MonitorContendedEnter event */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+ NULL)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -228,14 +220,13 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -243,9 +234,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.MonitorContendedEnter = &MonitorContendedEnter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,8 +57,8 @@
}
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object, obj))
eventsCount++;
}
@@ -74,8 +74,8 @@
}
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object, obj))
eventsCount++;
}
@@ -94,8 +94,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -107,8 +106,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -120,8 +118,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -130,41 +127,36 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'endingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "endingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "endingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
/* get 'endingMonitor' object */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
return NSK_FALSE;
/* enable MonitorContendedEntered event */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,
+ NULL)))
return NSK_FALSE;
/* enable MonitorContendedEnter event */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+ NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -173,9 +165,9 @@
static int clean() {
/* disable MonitorContendedEntered event */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,
+ NULL)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -254,14 +246,13 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -271,9 +262,7 @@
callbacks.MonitorContendedEntered = &MonitorContendedEntered;
callbacks.MonitorContendedEnter = &MonitorContendedEnter;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -55,8 +55,8 @@
}
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object, obj)) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object, obj)) {
eventsCount++;
if (tout != timeout) {
NSK_COMPLAIN1("Unexpected timeout value: %d\n", (int)tout);
@@ -79,8 +79,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -92,8 +91,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -105,8 +103,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -115,35 +112,29 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
/* get 'waitingMonitor' object */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
return NSK_FALSE;
/* enable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -153,13 +144,12 @@
/* disable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
nsk_jvmti_setFailStatus();
/* dispose global references */
- NSK_CPP_STUB2(DeleteGlobalRef, jni, object);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, thread);
+ jni->DeleteGlobalRef(object);
+ jni->DeleteGlobalRef(thread);
return NSK_TRUE;
}
@@ -237,14 +227,13 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -252,9 +241,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.MonitorWait = &MonitorWait;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,8 +56,8 @@
}
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object, obj)) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object, obj)) {
eventsCount++;
if (timed_out == JNI_TRUE) {
NSK_COMPLAIN0("Unexpected timed_out value: true\n");
@@ -80,8 +80,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -93,8 +92,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -106,8 +104,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -116,35 +113,29 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
/* get 'waitingMonitor' object */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object =
- NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
return NSK_FALSE;
/* enable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -154,13 +145,12 @@
/* disable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
nsk_jvmti_setFailStatus();
/* dispose global references */
- NSK_CPP_STUB2(DeleteGlobalRef, jni, object);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, thread);
+ jni->DeleteGlobalRef(object);
+ jni->DeleteGlobalRef(thread);
return NSK_TRUE;
}
@@ -238,14 +228,13 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -253,9 +242,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.MonitorWaited = &MonitorWaited;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,17 +59,13 @@
static jrawMonitorID countLock;
static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
/** callback functions **/
@@ -84,7 +80,7 @@
NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
unlock(jvmti_env, jni_env);
return;
@@ -95,8 +91,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methNam, &methSig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
unlock(jvmti_env, jni_env);
@@ -118,13 +113,11 @@
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methNam))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methSig))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
}
@@ -152,8 +145,7 @@
if (registerNative == JNI_TRUE) {
NSK_DISPLAY1("Finding class \"%s\" ...\n", CLASS_SIG);
- if (!NSK_JNI_VERIFY(env, (testedCls =
- NSK_CPP_STUB2(FindClass, env, CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(env, (testedCls = env->FindClass(CLASS_SIG)) != NULL)) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
CLASS_SIG);
@@ -167,8 +159,7 @@
NSK_DISPLAY3("Calling RegisterNatives() with \"%s %s\"\n"
"\tfor class \"%s\" ...\n",
METHODS[1][0], METHODS[1][1], CLASS_SIG);
- if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
- env, testedCls, &meth, 1)) != 0)) {
+ if (!NSK_JNI_VERIFY_VOID(env, (env->RegisterNatives(testedCls, &meth, 1)) != 0)) {
result = STATUS_FAILED;
NSK_COMPLAIN3("TEST FAILURE: unable to RegisterNatives() \"%s %s\" for class \"%s\"\n\n",
METHODS[1][0], METHODS[1][1], CLASS_SIG);
@@ -221,19 +212,16 @@
return JNI_ERR;
/* create a raw monitor */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_native_method_bind_events)
NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -242,13 +230,13 @@
NSK_DISPLAY0("setting event callbacks ...\n");
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.NativeMethodBind = &NativeMethodBind;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_NATIVE_METHOD_BIND,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -42,17 +42,13 @@
static jrawMonitorID countLock;
static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
/** callback functions **/
@@ -64,8 +60,7 @@
lock(jvmti_env, jni_env);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
- jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
NSK_COMPLAIN0(
"TEST FAILED: unable to obtain phase of the VM execution\n"
@@ -79,8 +74,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methNam, &methSig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
}
@@ -89,12 +83,10 @@
methNam, methSig);
if (!(methNam==NULL))
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methNam)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam)))
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
if (!(methSig==NULL))
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methSig)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig)))
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
unlock(jvmti_env, jni_env);
@@ -149,19 +141,16 @@
return JNI_ERR;
/* create a raw monitor */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_native_method_bind_events)
NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -171,16 +160,17 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.NativeMethodBind = &NativeMethodBind;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_NATIVE_METHOD_BIND,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,17 +52,13 @@
static jrawMonitorID countLock;
static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
/** callback functions **/
@@ -76,7 +72,7 @@
NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
unlock(jvmti_env, jni_env);
return;
@@ -87,8 +83,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methNam, &methSig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
unlock(jvmti_env, jni_env);
@@ -102,13 +97,11 @@
NSK_DISPLAY2("\tmethod: \"%s %s\"\n", methNam, methSig);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methNam))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methSig))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method signature\n\n");
}
@@ -158,8 +151,7 @@
NSK_DISPLAY1("Inside the registerNative()\n"
"Finding class \"%s\" ...\n",
CLASS_SIG);
- if (!NSK_JNI_VERIFY(env, (testedCls =
- NSK_CPP_STUB2(FindClass, env, CLASS_SIG)) != NULL)) {
+ if (!NSK_JNI_VERIFY(env, (testedCls = env->FindClass(CLASS_SIG)) != NULL)) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
CLASS_SIG);
@@ -174,8 +166,7 @@
"Calling RegisterNatives() with \"%s %s\"\n"
"\tfor class \"%s\" ...\n",
METHODS[0], METHODS[1], CLASS_SIG);
- if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
- env, testedCls, &meth, 1)) != 0)) {
+ if (!NSK_JNI_VERIFY_VOID(env, (env->RegisterNatives(testedCls, &meth, 1)) != 0)) {
result = STATUS_FAILED;
NSK_COMPLAIN3("TEST FAILURE: unable to RegisterNatives() \"%s %s\" for class \"%s\"\n\n",
METHODS[0], METHODS[1], CLASS_SIG);
@@ -183,8 +174,7 @@
NSK_DISPLAY1("Calling UnregisterNatives() for class \"%s\" ...\n",
CLASS_SIG);
- if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB2(UnregisterNatives,
- env, testedCls)) != 0)) {
+ if (!NSK_JNI_VERIFY_VOID(env, (env->UnregisterNatives(testedCls)) != 0)) {
result = STATUS_FAILED;
NSK_COMPLAIN3("TEST FAILURE: unable to UnregisterNatives() \"%s %s\" for class \"%s\"\n\n",
METHODS[1][0], METHODS[1][1], CLASS_SIG);
@@ -215,19 +205,16 @@
return JNI_ERR;
/* create a raw monitor */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_native_method_bind_events)
NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -237,16 +224,17 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.NativeMethodBind = &NativeMethodBind;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_NATIVE_METHOD_BIND,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -67,17 +67,13 @@
}
static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
/** callback functions **/
@@ -90,7 +86,7 @@
NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
result = STATUS_FAILED;
unlock(jvmti_env, jni_env);
return;
@@ -101,8 +97,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methNam, &methSig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
unlock(jvmti_env, jni_env);
@@ -117,13 +112,11 @@
*new_addr = (void*) redirNativeMethod;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methNam))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methSig))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method signature\n\n");
}
@@ -190,19 +183,16 @@
return JNI_ERR;
/* create a raw monitor */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
/* add capability to generate compiled method events */
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_native_method_bind_events)
NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -211,13 +201,13 @@
NSK_DISPLAY0("setting event callbacks ...\n");
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.NativeMethodBind = &NativeMethodBind;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_NATIVE_METHOD_BIND,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,8 +62,7 @@
NSK_DISPLAY1("%s: creating a raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti_env, "_lock", &_lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
msg);
@@ -74,8 +73,7 @@
NSK_DISPLAY1("%s: entering the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
msg);
@@ -86,8 +84,7 @@
NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
msg);
@@ -98,8 +95,7 @@
NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
msg);
@@ -112,8 +108,7 @@
static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
NSK_DISPLAY1("%s: allocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, MEM_SIZE, &mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
msg);
@@ -125,8 +120,7 @@
NSK_DISPLAY1("%s: deallocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
msg);
@@ -142,8 +136,7 @@
NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
msg, (void*) &stor);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
- jvmti_env, (const void*) &stor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to set an environment local storage\n\n",
msg);
@@ -155,8 +148,7 @@
NSK_DISPLAY1("%s: getting an environment local storage ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
- jvmti_env, (void**) &obtainedData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to get an environment local storage\n\n",
msg);
@@ -229,8 +221,7 @@
JNIEXPORT void JNICALL
Java_nsk_jvmti_ObjectFree_objfree001_setTag(JNIEnv *jni_env, jobject obj, jobject objToTag) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
- jvmti, objToTag, (jlong) 1))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(objToTag, (jlong) 1))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n");
}
@@ -269,12 +260,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_object_free_events = 1;
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_object_free_events)
@@ -287,16 +276,17 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMDeath = &VMDeath;
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,8 +59,7 @@
NSK_DISPLAY1("%s: creating a raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti_env, "_lock", &_lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
msg);
@@ -71,8 +70,7 @@
NSK_DISPLAY1("%s: entering the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
msg);
@@ -83,8 +81,7 @@
NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
- jvmti_env, _lock, (jlong)10))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
msg);
@@ -95,8 +92,7 @@
NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
msg);
@@ -107,8 +103,7 @@
NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
msg);
@@ -119,8 +114,7 @@
NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
msg);
@@ -131,8 +125,7 @@
NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
- jvmti_env, _lock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
msg);
@@ -145,8 +138,7 @@
static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
NSK_DISPLAY1("%s: allocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, MEM_SIZE, &mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
msg);
@@ -158,8 +150,7 @@
NSK_DISPLAY1("%s: deallocating memory ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, mem))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
msg);
@@ -175,8 +166,7 @@
NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
msg, (void*) &stor);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
- jvmti_env, (const void*) &stor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to set an environment local storage\n\n",
msg);
@@ -188,8 +178,7 @@
NSK_DISPLAY1("%s: getting an environment local storage ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
- jvmti_env, (void**) &obtainedData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: %s: unable to get an environment local storage\n\n",
msg);
@@ -249,8 +238,7 @@
if ((num % 2) == 0) {
NSK_DISPLAY2("Setting the tag \"%ld\" for object #%d\n",
(long) num, num);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
- jvmti, objToTag, (jlong) num))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(objToTag, (jlong) num))) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: unable to set tag for object #%d\n",
num);
@@ -292,12 +280,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_object_free_events = 1;
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_object_free_events)
@@ -310,16 +296,17 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMDeath = &VMDeath;
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -33,12 +33,7 @@
// Deallocate memory region allocated by VM
#define DEALLOCATE(p) \
if (p != NULL) \
- if (!NSK_JVMTI_VERIFY( \
- NSK_CPP_STUB2( \
- Deallocate \
- , jvmti \
- , p \
- ))) \
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(p))) \
{ \
NSK_COMPLAIN0("Failed to deallocate: ##p##\n"); \
}
@@ -101,49 +96,22 @@
int failure = 1;
do {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetThreadInfo
- , jvmti
- , thread
- , &thr_info
- )))
- {
- break;
- }
-
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetMethodDeclaringClass
- , jvmti
- , method
- , &klass
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &thr_info)))
{
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- GetClassSignature
- , jvmti
- , klass
- , &class_signature
- , NULL
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodDeclaringClass(method, &klass)))
{
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName
- , jvmti
- , method
- , &entry_name
- , &entry_sig
- , NULL
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, NULL)))
+ {
+ break;
+ }
+
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, NULL)))
{
break;
}
@@ -181,12 +149,7 @@
NSK_DISPLAY0(">>>>>>>> Invoke SuspendThread()\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- SuspendThread
- , jvmti
- , suspendedThread
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(suspendedThread)))
{
return JNI_FALSE;
}
@@ -203,12 +166,7 @@
NSK_DISPLAY0(">>>>>>>> Invoke ResumeThread()\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- ResumeThread
- , jvmti
- , suspendedThread
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(suspendedThread)))
{
return JNI_FALSE;
}
@@ -234,25 +192,13 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_METHOD_EXIT
- , frameThr
- )))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, frameThr)))
{
result = JNI_FALSE;
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_FRAME_POP
- , frameThr
- )))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, frameThr)))
{
result = JNI_FALSE;
}
@@ -261,12 +207,7 @@
set_watch_jvmti_events(1); /* watch JVMTI events */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- PopFrame
- , jvmti
- , frameThr
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(frameThr)))
{
result = JNI_FALSE;
} else {
@@ -319,32 +260,17 @@
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetPotentialCapabilities
- , jvmti
- , &caps
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
{
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
{
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps
- )))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
{
return JNI_ERR;
}
@@ -365,12 +291,7 @@
callbacks.MethodExit = &MethodExit;
callbacks.FramePop = &FramePop;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)
)))
{
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -86,9 +86,9 @@
(JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
jboolean isCopy;
- bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+ bytesCount = jni_env->GetArrayLength(classBytes);
clsBytes =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+ jni_env->GetByteArrayElements(classBytes, &isCopy);
}
/** callback functions **/
@@ -100,8 +100,7 @@
char *sig;
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -138,8 +137,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
/************************/
@@ -163,8 +162,7 @@
/* at first, send all generated CompiledMethodLoad events */
NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -185,14 +183,12 @@
NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, hsMethodID, &decl_cls))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, decl_cls, &cls_sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -209,8 +205,7 @@
NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
"\tnew class byte count=%d\n",
classDef.class_byte_count);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
- jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -261,8 +256,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_compiled_method_load_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callback */
@@ -270,8 +264,7 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.CompiledMethodLoad = &CompiledMethodLoad;
callbacks.CompiledMethodUnload = &CompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -85,9 +85,9 @@
(JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
jboolean isCopy;
- bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+ bytesCount = jni_env->GetArrayLength(classBytes);
clsBytes =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+ jni_env->GetByteArrayElements(classBytes, &isCopy);
}
/** callback functions **/
@@ -99,8 +99,7 @@
char *sig;
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -137,8 +136,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
/************************/
@@ -162,8 +161,7 @@
/* at first, send all generated CompiledMethodLoad events */
NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -184,14 +182,12 @@
NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, hsMethodID, &decl_cls))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, decl_cls, &cls_sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -208,8 +204,7 @@
NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
"\tnew class byte count=%d\n",
classDef.class_byte_count);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
- jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -260,8 +255,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_compiled_method_load_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callback */
@@ -269,8 +263,7 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.CompiledMethodLoad = &CompiledMethodLoad;
callbacks.CompiledMethodUnload = &CompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -86,9 +86,9 @@
(JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
jboolean isCopy;
- bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+ bytesCount = jni_env->GetArrayLength(classBytes);
clsBytes =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+ jni_env->GetByteArrayElements(classBytes, &isCopy);
}
/** callback functions **/
@@ -100,8 +100,7 @@
char *sig;
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -138,8 +137,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
/************************/
@@ -163,8 +162,7 @@
/* at first, send all generated CompiledMethodLoad events */
NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -185,14 +183,12 @@
NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, hsMethodID, &decl_cls))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, decl_cls, &cls_sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -209,8 +205,7 @@
NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
"\tnew class byte count=%d\n",
classDef.class_byte_count);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
- jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
nsk_jvmti_resumeSync();
return;
@@ -261,8 +256,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_compiled_method_load_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callback */
@@ -270,8 +264,7 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.CompiledMethodLoad = &CompiledMethodLoad;
callbacks.CompiledMethodUnload = &CompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -193,8 +193,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -217,8 +216,7 @@
*/
static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... set\n");
@@ -232,8 +230,7 @@
*/
static int removeCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
NSK_DISPLAY0("RelinquishCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RelinquishCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... relinguished\n");
@@ -247,8 +244,7 @@
*/
static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
return NSK_FALSE;
}
@@ -350,9 +346,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -193,8 +193,7 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
return NSK_FALSE;
}
@@ -217,8 +216,7 @@
*/
static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... set\n");
@@ -232,8 +230,7 @@
*/
static int removeCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
NSK_DISPLAY0("RelinquishCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RelinquishCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(caps))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... relinguished\n");
@@ -247,8 +244,7 @@
*/
static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
return NSK_FALSE;
}
@@ -349,9 +345,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -86,15 +86,17 @@
memset(&capabilities, 0, sizeof(jvmtiCapabilities));
capabilities.can_generate_resource_exhaustion_heap_events = 1;
capabilities.can_generate_resource_exhaustion_threads_events = 1;
- if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, gJvmti, &capabilities)) )
+ if ( ! NSK_JVMTI_VERIFY(gJvmti->AddCapabilities(&capabilities)) )
return JNI_ERR;
memset((void *)&callbacks, 0, sizeof(jvmtiEventCallbacks));
callbacks.ResourceExhausted = resourceExhausted;
- if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, gJvmti, &callbacks, sizeof(callbacks))) )
+ if ( ! NSK_JVMTI_VERIFY(gJvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))) )
return JNI_ERR;
- if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, gJvmti, JVMTI_ENABLE, JVMTI_EVENT_RESOURCE_EXHAUSTED, NULL) ) )
+ if ( ! NSK_JVMTI_VERIFY(gJvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_RESOURCE_EXHAUSTED,
+ NULL) ) )
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -58,15 +58,13 @@
NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread);
NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
nsk_jvmti_setFailStatus();
}
@@ -74,8 +72,7 @@
{
jint state = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, testedThread, &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(testedThread, &state))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" ... got state vector: %s (%d)\n",
@@ -98,7 +95,7 @@
return;
NSK_DISPLAY0("Delete thread reference\n");
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
@@ -139,8 +136,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
return;
NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -83,8 +82,7 @@
return;
NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
nsk_jvmti_setFailStatus();
}
@@ -112,7 +110,7 @@
return;
NSK_DISPLAY0("Delete thread reference\n");
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
@@ -127,7 +125,7 @@
callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
/* check if event is for tested thread */
if (thread != NULL &&
- NSK_CPP_STUB3(IsSameObject, jni, testedThread, thread)) {
+ jni->IsSameObject(testedThread, thread)) {
NSK_DISPLAY1(" ... received THREAD_END event for tested thread: %p\n", (void*)thread);
eventsReceived++;
} else {
@@ -168,8 +166,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
@@ -178,8 +175,7 @@
jvmtiEventCallbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,18 +62,16 @@
int i;
NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jthread)),
+ (unsigned char**)&threads))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads);
NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jvmtiError)),
- (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jvmtiError)),
+ (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -84,8 +82,7 @@
return;
NSK_DISPLAY0("Suspend threads list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount, threads, results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threads, results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -99,8 +96,7 @@
}
NSK_DISPLAY0("Resume threads list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount, threads, results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threads, results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -118,8 +114,7 @@
jint state = 0;
NSK_DISPLAY2(" thread #%d (%p):\n", i, (void*)threads[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threads[i], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threads[i], &state))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2(" ... got state vector: %s (%d)\n",
@@ -144,18 +139,16 @@
NSK_DISPLAY0("Delete threads references\n");
for (i = 0; i < threadsCount; i++) {
if (threads[i] != NULL)
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threads[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threads[i]));
}
NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
}
@@ -181,8 +174,7 @@
foundThreads[i] = NULL;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &count, &threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -191,8 +183,7 @@
for (i = 0; i < count; i++) {
jvmtiThreadInfo info;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -207,8 +198,7 @@
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -226,7 +216,7 @@
NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount);
for (i = 0; i < foundCount; i++) {
if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, foundThreads[i])) != NULL)) {
+ jni->NewGlobalRef(foundThreads[i])) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -274,8 +264,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -71,18 +71,16 @@
int i;
NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jthread)),
+ (unsigned char**)&threads))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads);
NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jvmtiError)),
- (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jvmtiError)),
+ (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -93,8 +91,7 @@
return;
NSK_DISPLAY0("Suspend threads list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount, threads, results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threads, results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -117,8 +114,7 @@
return;
NSK_DISPLAY0("Resume threads list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount, threads, results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threads, results))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -159,18 +155,16 @@
NSK_DISPLAY0("Delete threads references\n");
for (i = 0; i < threadsCount; i++) {
if (threads[i] != NULL)
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threads[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threads[i]));
}
NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
}
@@ -196,8 +190,7 @@
foundThreads[i] = NULL;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &count, &threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -206,8 +199,7 @@
for (i = 0; i < count; i++) {
jvmtiThreadInfo info;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -222,8 +214,7 @@
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -241,7 +232,7 @@
NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount);
for (i = 0; i < foundCount; i++) {
if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, foundThreads[i])) != NULL)) {
+ jni->NewGlobalRef(foundThreads[i])) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -258,7 +249,7 @@
callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
int i = 0;
- jvmtiError e = NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventsReceivedMtx);
+ jvmtiError e = jvmti->RawMonitorEnter(eventsReceivedMtx);
if ( !NSK_JVMTI_VERIFY(e) ) {
NSK_DISPLAY1(" ... ERROR entering raw monitor for thread %p\n", (void *) thread);
return;
@@ -267,15 +258,15 @@
/* check if event is for tested thread */
for (i = 0; i < threadsCount; i++) {
if (thread != NULL &&
- NSK_CPP_STUB3(IsSameObject, jni, threads[i], thread)) {
+ jni->IsSameObject(threads[i], thread)) {
NSK_DISPLAY2(" ... received THREAD_END event for thread #%d: %p\n",
i, (void*)thread);
eventsReceived++;
- NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsReceivedMtx);
+ jvmti->RawMonitorExit(eventsReceivedMtx);
return;
}
}
- NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsReceivedMtx);
+ jvmti->RawMonitorExit(eventsReceivedMtx);
NSK_DISPLAY1(" ... received THREAD_END event for unknown thread: %p\n", (void*)thread);
}
@@ -317,8 +308,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
@@ -327,15 +317,13 @@
jvmtiEventCallbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
}
/* create a mutex for the eventsReceived variable */
{
- if ( ! NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "eventsReceived", &eventsReceivedMtx))) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventsReceived", &eventsReceivedMtx))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -49,15 +49,7 @@
)
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- RetransformClasses
- , jvmti
- , 1
- , &class_for_retransformation
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
return JNI_FALSE;
return JNI_TRUE;
@@ -114,53 +106,26 @@
)
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
caps.can_retransform_classes = 1;
// Register all necessary JVM capabilities
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
// Register all necessary event callbacks
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
// Enable class retransformation
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
- , NULL
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -63,15 +63,7 @@
, jclass class_for_retransformation
)
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- RetransformClasses
- , jvmti
- , 1
- , &class_for_retransformation
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
return JNI_FALSE;
return JNI_TRUE;
@@ -107,88 +99,28 @@
}
// Get ant the invoke callback function
- if (!NSK_VERIFY(
- (loader_class = NSK_CPP_STUB2(
- GetObjectClass
- , jni
- , loader
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != NULL))
return;
- if (!NSK_VERIFY(
- (method_id = NSK_CPP_STUB4(
- GetMethodID
- , jni
- , loader_class
- , "loadClass"
- , "(Ljava/lang/String;)Ljava/lang/Class;"
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((method_id = jni->GetMethodID(
+ loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL))
return;
- if (!NSK_VERIFY(
- (class_name_string =
- NSK_CPP_STUB2(
- NewStringUTF
- , jni
- , CALLBACK_CLASS_NAME
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != NULL))
return;
- if (!NSK_VERIFY(
- (callback_class = (jclass) NSK_CPP_STUB4(
- CallObjectMethod
- , jni
- , loader
- , method_id
- , class_name_string
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((callback_class = (jclass) jni->CallObjectMethod(
+ loader, method_id, class_name_string)) != NULL))
return;
- if (!NSK_VERIFY(
- (method_id = NSK_CPP_STUB4(
- GetStaticMethodID
- , jni
- , callback_class
- , "callback"
- , "(Ljava/lang/String;I)V"
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((method_id = jni->GetStaticMethodID(
+ callback_class, "callback", "(Ljava/lang/String;I)V")) != NULL))
return;
- if (!NSK_VERIFY(
- (class_name_string =
- NSK_CPP_STUB2(
- NewStringUTF
- , jni
- , name
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != NULL))
return;
- NSK_CPP_STUB5(
- CallStaticObjectMethod
- , jni
- , callback_class
- , method_id
- , class_name_string
- , agent_id
- );
+ jni->CallStaticObjectMethod(callback_class, method_id, class_name_string, agent_id);
}
@@ -219,19 +151,10 @@
agent_id= nsk_jvmti_findOptionIntValue("id", -1);
- if (!NSK_VERIFY(
- (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL
- )
- )
+ if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if(nsk_jvmti_findOptionIntValue("can_retransform_classes", 1)) {
@@ -242,41 +165,21 @@
// Register all necessary JVM capabilities
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
// Register all necessary event callbacks
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
// Enable class retransformation
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
- , NULL
- )
- )
- )
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,15 +52,7 @@
, jclass class_for_retransformation
)
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- RetransformClasses
- , jvmti
- , 1
- , &class_for_retransformation
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
return JNI_FALSE;
return JNI_TRUE;
@@ -85,15 +77,7 @@
)
{
// Allocate space for "retransformed" class version
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- Allocate
- , jvmti
- , class_data_len
- , new_class_data
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(class_data_len, new_class_data)))
return;
// Copy old code
@@ -127,53 +111,27 @@
)
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
caps.can_retransform_classes = 1;
// Register all necessary JVM capabilities
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
// Register all necessary event callbacks
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
// Enable class retransformation
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
- , NULL
- )
- )
- )
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char where[]) {
NSK_DISPLAY1("Set local storage for current JVMTI env: 0x%p\n", (void*)storage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, jvmti, storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEnvironmentLocalStorage(storage))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... ok\n");
@@ -89,8 +88,7 @@
StorageStructure* storage = NULL;
NSK_DISPLAY0("Get local storage for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, (void**)&storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage);
@@ -216,9 +214,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char where[]) {
NSK_DISPLAY1("Set local storage for current JVMTI env: 0x%p\n", (void*)storage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, jvmti, storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEnvironmentLocalStorage(storage))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... ok\n");
@@ -89,8 +88,7 @@
StorageStructure* storage = NULL;
NSK_DISPLAY0("Get local storage for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, (void**)&storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage);
@@ -221,9 +219,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char where[]) {
NSK_DISPLAY1("Set local storage for current JVMTI env: 0x%p\n", (void*)storage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, jvmti, storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEnvironmentLocalStorage(storage))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... ok\n");
@@ -89,8 +88,7 @@
StorageStructure* storage = NULL;
NSK_DISPLAY0("Get local storage for current JVMTI env\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, (void**)&storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage);
@@ -224,9 +222,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -143,9 +143,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_jvmti_setFailStatus();
} else {
nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL);
@@ -190,9 +188,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_jvmti_setFailStatus();
} else {
nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -145,8 +145,7 @@
NSK_DISPLAY0(">>> Testcase #2: Set NULL for events callbacks\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, NULL, 0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(NULL, 0))) {
nsk_jvmti_setFailStatus();
}
@@ -193,9 +192,7 @@
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_jvmti_setFailStatus();
} else {
nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -151,9 +151,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, size))) {
nsk_jvmti_setFailStatus();
}
@@ -198,9 +196,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMInit = callbackVMInit;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_jvmti_setFailStatus();
} else {
nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -48,8 +48,7 @@
int i;
NSK_DISPLAY0("Get extension events list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetExtensionEvents, jvmti, &extCount, &extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionEvents(&extCount, &extList))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got count: %d\n", (int)extCount);
@@ -72,18 +71,14 @@
NSK_DISPLAY1(" ... setting callback: 0x%p\n", (void*)callbackExtensionEvent);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetExtensionEventCallback, jvmti,
- extList[i].extension_event_index,
- callbackExtensionEvent))) {
+ jvmti->SetExtensionEventCallback(extList[i].extension_event_index, callbackExtensionEvent))) {
success = NSK_FALSE;
}
NSK_DISPLAY0(" ... done\n");
NSK_DISPLAY1(" ... clearing callback: 0x%p\n", (void*)NULL);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetExtensionEventCallback, jvmti,
- extList[i].extension_event_index,
- NULL))) {
+ jvmti->SetExtensionEventCallback(extList[i].extension_event_index, NULL))) {
success = NSK_FALSE;
}
NSK_DISPLAY0(" ... done\n");
@@ -91,8 +86,7 @@
}
NSK_DISPLAY1("Deallocate extension events list: 0x%p\n", (void*)extList);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)extList))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -123,27 +123,11 @@
char *str = NULL;
if (prefix != NULL) {
- if (!NSK_VERIFY(
- (str = (char *) NSK_CPP_STUB3(
- GetStringUTFChars
- , jni
- , prefix
- , 0
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL))
{ result = JNI_FALSE; goto finally; }
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- SetNativeMethodPrefix
- , jvmti
- , str
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefix(str)))
{ result = JNI_FALSE; goto finally; }
if (str != NULL) {
@@ -175,27 +159,10 @@
char *str = NULL;
if (prefix != NULL) {
- if (!NSK_VERIFY(
- (str = (char *) NSK_CPP_STUB3(
- GetStringUTFChars
- , jni
- , prefix
- , 0
- )
- ) != NULL
- )
- )
+ if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL))
{ result = JNI_FALSE; goto finally; }
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetNativeMethodPrefixes
- , jvmti
- , 1
- , (char **) &str
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(1, (char **) &str)))
{ result = JNI_FALSE; goto finally; }
NSK_DISPLAY1("MultiplePrefixes: New PREFIX is set: %s\n"
@@ -205,15 +172,7 @@
char* prefixes[1];
prefixes[0] = NULL;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetNativeMethodPrefixes
- , jvmti
- , 0
- , (char **)&prefixes
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(0, (char **)&prefixes)))
{ result = JNI_FALSE; goto finally; }
NSK_DISPLAY0("Old PREFIX is reset\n");
@@ -250,33 +209,11 @@
return JNI_FALSE;
}
- if (!NSK_VERIFY(
- (method.name =
- (char *) NSK_CPP_STUB3(
- GetStringUTFChars
- , jni
- , method_name_obj
- , 0
- )
- ) != NULL
- )
- )
- {
+ if (!NSK_VERIFY((method.name = (char *) jni->GetStringUTFChars(method_name_obj, 0)) != NULL)) {
goto finally;
}
- if (!NSK_VERIFY(
- (method.signature =
- (char *) NSK_CPP_STUB3(
- GetStringUTFChars
- , jni
- , method_sig_obj
- , 0
- )
- ) != NULL
- )
- )
- {
+ if (!NSK_VERIFY((method.signature = (char *) jni->GetStringUTFChars(method_sig_obj, 0)) != NULL)) {
goto finally;
}
@@ -341,25 +278,13 @@
)
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
// Register all necessary JVM capabilities
caps.can_set_native_method_prefix = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -60,13 +60,7 @@
static jboolean setMethodPrefix (char *prefix)
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- SetNativeMethodPrefix
- , jvmti
- , prefix)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefix(prefix)))
return JNI_FALSE;
return JNI_TRUE;
@@ -114,25 +108,13 @@
)
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
// Register all necessary JVM capabilities
caps.can_set_native_method_prefix = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- AddCapabilities
- , jvmti
- , &caps)
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,7 @@
char* value = NULL;
NSK_DISPLAY1(" property: %s\n", name);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSystemProperty, jvmti, name, &value))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetSystemProperty(name, &value))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" value: \"%s\"\n", nsk_null_string(value));
@@ -93,8 +92,7 @@
success = NSK_FALSE;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)value))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)value))) {
success = NSK_FALSE;
}
@@ -120,14 +118,12 @@
NSK_DISPLAY1(" value: \"%s\"\n", propDescList[i].values[step]);
if (step > 1) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_WRONG_PHASE,
- NSK_CPP_STUB3(SetSystemProperty, jvmti,
- propDescList[i].name, propDescList[i].values[step]))) {
+ jvmti->SetSystemProperty(propDescList[i].name, propDescList[i].values[step]))) {
success = NSK_FALSE;
}
} else {
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetSystemProperty, jvmti,
- propDescList[i].name, propDescList[i].values[step]))) {
+ jvmti->SetSystemProperty(propDescList[i].name, propDescList[i].values[step]))) {
success = NSK_FALSE;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,8 +56,7 @@
NSK_DISPLAY1(" property: %s\n", propDescList[i].name);
NSK_DISPLAY1(" value: \"%s\"\n", propDescList[i].value);
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetSystemProperty, jvmti,
- propDescList[i].name, propDescList[i].value))) {
+ jvmti->SetSystemProperty(propDescList[i].name, propDescList[i].value))) {
success = NSK_FALSE;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,7 +61,7 @@
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -69,8 +69,7 @@
NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (objectField =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+ jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -78,16 +77,14 @@
NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
- objectField)) != NULL)) {
+ jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject);
NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -97,8 +94,7 @@
NSK_DISPLAY0(">>> Testcase #1: set tag for the tested object\n");
{
NSK_DISPLAY1("Set tag for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, testedObject, objectTag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, objectTag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -110,8 +106,7 @@
jlong tag = 222;
NSK_DISPLAY1("Get tag for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -140,8 +135,7 @@
return;
NSK_DISPLAY1("Get tag for object: 0x%p\n", (void*)testedObject);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -162,7 +156,7 @@
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete object reference: 0x%p\n", (void*)testedObject);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
}
}
@@ -205,8 +199,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,9 +73,7 @@
NSK_DISPLAY1("SetThreadLocalStorage() for tested thread with pointer: %p\n",
(void*)initialStorage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetThreadLocalStorage, jvmti,
- testedThread, (void*)initialStorage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(testedThread, (void*)initialStorage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -90,8 +88,7 @@
NSK_DISPLAY0("GetThreadLocalStorage() for tested thread\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadLocalStorage, jvmti,
- testedThread, (void**)&obtainedStorage))) {
+ jvmti->GetThreadLocalStorage(testedThread, (void**)&obtainedStorage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -128,7 +125,7 @@
}
NSK_DISPLAY0("Delete thread reference\n");
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
}
NSK_DISPLAY0("Let debugee to finish\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,9 +66,7 @@
NSK_DISPLAY1("SetThreadLocalStorage() for current agent thread with pointer: %p\n",
(void*)initialStorage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetThreadLocalStorage, jvmti,
- NULL, (void*)initialStorage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -82,9 +80,7 @@
return;
NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadLocalStorage, jvmti,
- NULL, (void**)&obtainedStorage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) {
nsk_jvmti_setFailStatus();
return;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -120,8 +120,7 @@
if (thread != NULL) {
jvmtiThreadInfo info;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -133,9 +132,7 @@
NSK_DISPLAY1("SetThreadLocalStorage() for current thread with pointer: %p\n",
(void*)initialStorage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetThreadLocalStorage, jvmti,
- NULL, (void*)initialStorage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -151,8 +148,7 @@
if (thread != NULL) {
jvmtiThreadInfo info;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -168,8 +164,7 @@
NSK_DISPLAY0("GetThreadLocalStorage() for current thread\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadLocalStorage, jvmti,
- NULL, (void**)&obtainedStorage))) {
+ jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -243,8 +238,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ThreadStart = callbackThreadStart;
callbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -146,20 +146,13 @@
jmethodID cid;
jobject result;
- if (!NSK_JNI_VERIFY(jni, (cid =
- NSK_CPP_STUB4(GetMethodID, jni,
- cls,
- "<init>",
- "()V" )) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "<init>", "()V" )) != NULL)) {
NSK_COMPLAIN0("newObject: GetMethodID returned NULL\n\n");
nsk_jvmti_setFailStatus();
return NULL;
}
- if (!NSK_JNI_VERIFY(jni, ( result =
- NSK_CPP_STUB3(NewObject, jni,
- cls,
- cid )) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, ( result = jni->NewObject(cls, cid)) != NULL)) {
NSK_COMPLAIN0("newObject: NewObject returned NULL\n\n");
nsk_jvmti_setFailStatus();
@@ -174,31 +167,21 @@
jmethodID cid;
jobject result;
- if (!NSK_JNI_VERIFY(jni, ( cid =
- NSK_CPP_STUB4(GetMethodID, jni,
- cls,
- "<init>",
- "()V" )) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, ( cid = jni->GetMethodID(cls, "<init>", "()V" )) != NULL)) {
NSK_COMPLAIN0("allocObject: GetMethodID returned NULL\n\n");
nsk_jvmti_setFailStatus();
return NULL;
}
- if (!NSK_JNI_VERIFY(jni, ( result =
- NSK_CPP_STUB2(AllocObject, jni,
- cls )) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, ( result = jni->AllocObject(cls)) != NULL)) {
NSK_COMPLAIN0("allocObject: AllocObject returned NULL\n\n");
nsk_jvmti_setFailStatus();
return NULL;
}
- if (!NSK_JNI_VERIFY_VOID(jni,
- NSK_CPP_STUB4(CallNonvirtualVoidMethod, jni,
- result,
- cls,
- cid))) {
+ if (!NSK_JNI_VERIFY_VOID(jni,jni->CallNonvirtualVoidMethod(result, cls, cid))) {
NSK_COMPLAIN0("newObject: CallNonvirtualVoidMethod failed\n\n");
nsk_jvmti_setFailStatus();
@@ -225,10 +208,7 @@
}
NSK_DISPLAY0("Set tag for debugee class\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti,
- debugeeClass,
- DEBUGEE_CLASS_TAG ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(debugeeClass, DEBUGEE_CLASS_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -236,13 +216,10 @@
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_UNTAGGED,
- heapObjectCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ heapObjectCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -261,11 +238,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
obj_count = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED,
- heapObjectCallback,
- &user_data))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -282,12 +255,10 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -338,12 +309,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_object_free_events = 1;
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_object_free_events)
@@ -358,16 +327,17 @@
callbacks.ObjectFree = &ObjectFree;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -91,9 +91,7 @@
jclass exception_cls ) {
jint result;
- result = NSK_CPP_STUB3(ThrowNew, jni,
- exception_cls,
- "Got expected exception thrown from native code" );
+ result = jni->ThrowNew(exception_cls, "Got expected exception thrown from native code" );
if (result != 0) {
NSK_COMPLAIN1("throwException: Unable to throw exception in native code: %d\n\n", result );
nsk_jvmti_setFailStatus();
@@ -105,13 +103,10 @@
static void runIterations (jvmtiEnv* jvmti, jclass testedClass, jint exp_count) {
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- testedClass,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heapObjectCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -130,11 +125,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
obj_count = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_EITHER,
- heapObjectCallback,
- &user_data))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -151,12 +142,10 @@
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- NULL /*heapRootCallback*/,
- stackReferenceCallback,
- NULL /*objectReferenceCallback*/,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(NULL /*heapRootCallback*/,
+ stackReferenceCallback,
+ NULL /*objectReferenceCallback*/,
+ &user_data))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -189,15 +178,11 @@
return;
}
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL))
return;
NSK_DISPLAY0("Set tag for tested class\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti,
- testedClass,
- TESTED_CLASS_TAG ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedClass, TESTED_CLASS_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -212,7 +197,7 @@
runIterations (jvmti, testedClass, 2);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
NSK_DISPLAY0("Let debugee to finish\n");
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -242,12 +227,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -90,8 +90,7 @@
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP03_ap03t001_setTag( JNIEnv* jni, jobject obj, jlong tag) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
- jvmti, obj, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -117,23 +116,17 @@
}
NSK_DISPLAY0("Set tag for debugee class\n\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti,
- debugeeClass,
- DEBUGEE_CLASS_TAG ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(debugeeClass, DEBUGEE_CLASS_TAG))) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_TAGGED\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass,
- jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -151,11 +144,7 @@
NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
obj_count = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap,
- jvmti,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- &user_data))) {
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &user_data))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -171,18 +160,13 @@
}
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "catcher",
- DEBUGEE_SIGNATURE)) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != NULL )) {
nsk_jvmti_setFailStatus();
break;
}
if (!NSK_JNI_VERIFY(jni, (catcher =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- debugeeClass,
- fid )) != NULL )) {
+ jni->GetStaticObjectField(debugeeClass, fid)) != NULL )) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'catcher' field value\n\n");
nsk_jvmti_setFailStatus();
break;
@@ -190,11 +174,9 @@
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n");
obj_count = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
- catcher,
- objectReferenceCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(catcher,
+ objectReferenceCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -239,12 +221,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_object_free_events = 1;
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_object_free_events)
@@ -258,13 +238,13 @@
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,30 +66,26 @@
static void increaseCounter(volatile int* counterPtr) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
(*counterPtr)++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
static void setCounter(volatile int* counterPtr, int value) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
*counterPtr = value;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
@@ -97,15 +93,13 @@
static int getCounter(volatile int* counterPtr) {
int result;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
result = *counterPtr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -248,7 +242,7 @@
jobject target, /* object to be tagged */
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -258,7 +252,7 @@
jclass klass) {
NSK_DISPLAY0(" run: ForceGarbageCollection\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
nsk_jvmti_setFailStatus();
}
}
@@ -273,11 +267,9 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverHeap...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -303,12 +295,10 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -334,12 +324,10 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -363,27 +351,23 @@
int count = 0;
if (!NSK_JNI_VERIFY(jni, (root =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- debugeeClass,
- rootFieldID )) != NULL )) {
+ jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
nsk_jvmti_setFailStatus();
return;
}
// release secondary lock
- NSK_CPP_STUB3(CallStaticVoidMethod, jni, debugeeClass, unlockSecondaryID);
+ jni->CallStaticVoidMethod(debugeeClass, unlockSecondaryID);
setCounter(&errorCount, 0);
setCounter(&eventCount, 0);
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
- root,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -413,26 +397,19 @@
return;
}
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return;
NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (rootFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "root",
- ROOT_SIGNATURE)) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID =
- NSK_CPP_STUB4(GetStaticMethodID, jni,
- debugeeClass,
- "unlockSecondary",
- "()V")) != NULL )) {
+ jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL )) {
nsk_jvmti_setFailStatus();
return;
}
@@ -448,8 +425,8 @@
nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL);
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
NSK_DISPLAY0("Let debugee to finish\n");
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -477,8 +454,7 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
return JNI_ERR;
}
@@ -487,12 +463,10 @@
caps.can_generate_object_free_events = 1;
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
@@ -509,8 +483,7 @@
callbacks.ObjectFree = &ObjectFree;
callbacks.GarbageCollectionStart = &GarbageCollectionStart;
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -59,30 +59,26 @@
static void increaseCounter(volatile int* counterPtr) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
(*counterPtr)++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
static void setCounter(volatile int* counterPtr, int value) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
*counterPtr = value;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
@@ -90,15 +86,13 @@
static int getCounter(volatile int* counterPtr) {
int result;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
result = *counterPtr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -238,7 +232,7 @@
jobject target, /* object to be tagged */
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -253,11 +247,9 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverHeap...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -284,12 +276,10 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -316,12 +306,10 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -345,9 +333,7 @@
int count = 0;
if (!NSK_JNI_VERIFY(jni, (root =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- debugeeClass,
- rootFieldID )) != NULL )) {
+ jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
nsk_jvmti_setFailStatus();
return;
@@ -358,11 +344,9 @@
setCounter(&iterationCount, 0);
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
- root,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -393,35 +377,25 @@
return;
}
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return;
NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (rootFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "root",
- ROOT_SIGNATURE)) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY0("Find ID of 'modified' field\n");
if (!NSK_JNI_VERIFY(jni, (modifiedFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "modified",
- "I")) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "modified", "I")) != NULL )) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY0("Set FieldModification watchpoint for 'modified' field\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetFieldModificationWatch, jvmti,
- debugeeClass,
- modifiedFieldID))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(debugeeClass, modifiedFieldID))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -434,8 +408,8 @@
if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
NSK_DISPLAY0("Let debugee to finish\n");
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -463,8 +437,7 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
return JNI_ERR;
}
@@ -472,12 +445,10 @@
caps.can_tag_objects = 1;
caps.can_generate_field_modification_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
@@ -490,18 +461,15 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.FieldModification = &FieldModification;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done.\n");
NSK_DISPLAY0("enabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4( SetEventNotificationMode,
- jvmti,
- JVMTI_ENABLE,
- JVMTI_EVENT_FIELD_MODIFICATION,
- NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_FIELD_MODIFICATION,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,30 +61,26 @@
static void increaseCounter(volatile int* counterPtr) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
(*counterPtr)++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
static void setCounter(volatile int* counterPtr, int value) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
*counterPtr = value;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
}
@@ -92,15 +88,13 @@
static int getCounter(volatile int* counterPtr) {
int result;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
result = *counterPtr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
nsk_jvmti_setFailStatus();
}
@@ -113,16 +107,13 @@
/* enter and notify runLock */
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(runLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, jvmti, runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(runLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(runLock))) {
nsk_jvmti_setFailStatus();
}
}
@@ -227,12 +218,8 @@
{
jlong tag = (jlong)1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti,
- 1, &tag,
- &taggedObjectsCount,
- &taggedObjectsList,
- NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags(
+ 1, &tag, &taggedObjectsCount, &taggedObjectsList, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -246,23 +233,19 @@
}
/* enter runLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(runLock))) {
nsk_jvmti_setFailStatus();
}
/* enter and notify startLock */
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(startLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, jvmti, startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(startLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(startLock))) {
nsk_jvmti_setFailStatus();
}
}
@@ -271,12 +254,10 @@
/* wait on runLock */
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, runLock, timeout))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(runLock, timeout))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(runLock))) {
nsk_jvmti_setFailStatus();
}
}
@@ -288,8 +269,7 @@
int modified = 0;
int i;
for (i = 0; i < taggedObjectsCount; i+=2) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, taggedObjectsList[i], 0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(taggedObjectsList[i], 0))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -302,24 +282,20 @@
/* destroy objects list */
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)taggedObjectsList))) {
nsk_jvmti_setFailStatus();
}
}
/* enter and notify endLock */
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(endLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, jvmti, endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(endLock))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(endLock))) {
nsk_jvmti_setFailStatus();
}
}
@@ -333,31 +309,24 @@
int success = NSK_TRUE;
/* enter startLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(startLock))) {
nsk_jvmti_setFailStatus();
}
/* start thread */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(RunAgentThread, jvmti,
- threadObj,
- agent_start,
- NULL,
- JVMTI_THREAD_NORM_PRIORITY))) {
+ jvmti->RunAgentThread(threadObj, agent_start, NULL, JVMTI_THREAD_NORM_PRIORITY))) {
success = NSK_FALSE;
nsk_jvmti_setFailStatus();
} else {
/* wait on startLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, startLock, timeout))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(startLock, timeout))) {
nsk_jvmti_setFailStatus();
}
}
/* exit starLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(startLock))) {
nsk_jvmti_setFailStatus();
}
@@ -370,26 +339,17 @@
jmethodID cid;
jthread result = NULL;
- if (!NSK_JNI_VERIFY(jni, (thrClass =
- NSK_CPP_STUB2(FindClass, jni,
- "java/lang/Thread")) != NULL )) {
+ if (!NSK_JNI_VERIFY(jni, (thrClass = jni->FindClass("java/lang/Thread")) != NULL )) {
nsk_jvmti_setFailStatus();
return result;
}
- if (!NSK_JNI_VERIFY(jni, (cid =
- NSK_CPP_STUB4(GetMethodID, jni,
- thrClass,
- "<init>",
- "()V")) != NULL )) {
+ if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(thrClass, "<init>", "()V")) != NULL )) {
nsk_jvmti_setFailStatus();
return result;
}
- if (!NSK_JNI_VERIFY(jni, (result =
- NSK_CPP_STUB3(NewObject, jni,
- thrClass,
- cid )) != NULL )) {
+ if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(thrClass, cid)) != NULL )) {
nsk_jvmti_setFailStatus();
return result;
}
@@ -412,8 +372,7 @@
}
/* enter endLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(endLock))) {
nsk_jvmti_setFailStatus();
}
@@ -430,14 +389,12 @@
NSK_DISPLAY0("Wait for new agent thread to complete\n");
/* wait on endLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, endLock, timeout))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(endLock, timeout))) {
nsk_jvmti_setFailStatus();
}
/* exit endLock */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(endLock))) {
nsk_jvmti_setFailStatus();
}
}
@@ -450,7 +407,7 @@
jobject target, /* object to be tagged */
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -465,11 +422,9 @@
return;
NSK_DISPLAY0("Calling IterateOverHeap...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -497,12 +452,10 @@
return;
NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -530,12 +483,10 @@
return;
NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- debugeeClass,
- JVMTI_HEAP_OBJECT_TAGGED,
- heapObjectCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+ JVMTI_HEAP_OBJECT_TAGGED,
+ heapObjectCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -561,9 +512,7 @@
int found = 0;
if (!NSK_JNI_VERIFY(jni, (root =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- debugeeClass,
- rootFieldID )) != NULL )) {
+ jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
nsk_jvmti_setFailStatus();
return;
@@ -573,11 +522,9 @@
return;
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
- root,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -609,16 +556,12 @@
return;
}
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return;
NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (rootFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "root",
- ROOT_SIGNATURE)) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
nsk_jvmti_setFailStatus();
return;
}
@@ -631,11 +574,11 @@
if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, startLock));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, runLock));
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, endLock));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
+ NSK_TRACE(jvmti->DestroyRawMonitor(startLock));
+ NSK_TRACE(jvmti->DestroyRawMonitor(runLock));
+ NSK_TRACE(jvmti->DestroyRawMonitor(endLock));
NSK_DISPLAY0("Let debugee to finish\n");
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -663,33 +606,27 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "startLock", &startLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("startLock", &startLock))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "runLock", &runLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("runLock", &runLock))) {
return JNI_ERR;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "endLock", &endLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("endLock", &endLock))) {
return JNI_ERR;
}
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -105,15 +105,14 @@
jobject target,
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setReferrer( JNIEnv* jni, jclass klass, jobject ref) {
- if (!NSK_JNI_VERIFY(jni, (referrer =
- NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -130,12 +129,10 @@
staticFieldsCount = 0;
instanceFieldsCount = 0;
NSK_DISPLAY0("\nCalling IterateOverReachableObjects\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -156,12 +153,8 @@
instanceFieldsCount = 0;
NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- referrer,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ referrer, objectReferenceCallback, NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -180,7 +173,7 @@
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+ NSK_TRACE(jni->DeleteGlobalRef(referrer));
} while (0);
@@ -213,12 +206,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -103,7 +103,7 @@
jobject target,
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -111,8 +111,7 @@
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setReferrer( JNIEnv* jni, jclass klass, jobject ref, jint caseNum) {
caseNumber = caseNum;
- if (!NSK_JNI_VERIFY(jni, (referrer =
- NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -120,12 +119,10 @@
NSK_DISPLAY0("\nCalling IterateOverReachableObjects\n");
forthRef = 0;
backRef = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
if (forthRef != 1) {
@@ -142,12 +139,9 @@
NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
forthRef = 0;
backRef = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- referrer,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
if (forthRef != 1) {
@@ -175,7 +169,7 @@
NSK_DISPLAY0("CASE #1\n");
runCase();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+ NSK_TRACE(jni->DeleteGlobalRef(referrer));
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
return;
if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
@@ -184,7 +178,7 @@
NSK_DISPLAY0("CASE #2\n");
runCase();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+ NSK_TRACE(jni->DeleteGlobalRef(referrer));
} while (0);
NSK_DISPLAY0("Let debugee to finish\n");
@@ -216,12 +210,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -124,7 +124,7 @@
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP06_ap06t001Thread_setTag( JNIEnv* jni, jobject obj) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, obj, threadTag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, threadTag))) {
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY0("setTag: the tag was set for checked thread.");
@@ -153,34 +153,26 @@
}
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni,
- debugeeClass,
- "thread",
- THREAD_CLS_SIGNATURE)) != NULL )) {
+ jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}
if (!NSK_JNI_VERIFY(jni, (localRefThread =
- NSK_CPP_STUB3(GetStaticObjectField, jni,
- debugeeClass,
- fid )) != NULL )) {
+ jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'thread' field value\n\n");
nsk_jvmti_setFailStatus();
break;
}
- if (!NSK_JNI_VERIFY(jni, (globalRefThread =
- NSK_CPP_STUB2(NewGlobalRef, jni, localRefThread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != NULL))
return;
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -234,12 +226,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -111,15 +111,14 @@
jobject target,
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot( JNIEnv* jni, jobject obj) {
- if (!NSK_JNI_VERIFY(jni, (root =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -135,30 +134,24 @@
do {
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- root,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ root, objectReferenceCallback, NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, root));
+ NSK_TRACE(jni->DeleteGlobalRef(root));
} while (0);
@@ -191,12 +184,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -111,7 +111,7 @@
jobject target,
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -128,12 +128,10 @@
do {
NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- heapRootCallback,
- stackReferenceCallback,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+ stackReferenceCallback,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -169,12 +167,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -132,15 +132,14 @@
jobject target,
jlong tag ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setReferrer( JNIEnv* jni, jclass klass, jobject ref) {
- if (!NSK_JNI_VERIFY(jni, (referrer =
- NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -155,12 +154,9 @@
do {
NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
- jvmti,
- referrer,
- objectReferenceCallback,
- NULL /*user_data*/))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer,
+ objectReferenceCallback,
+ NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
if (!classFound) {
@@ -192,7 +188,7 @@
nsk_jvmti_setFailStatus();
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+ NSK_TRACE(jni->DeleteGlobalRef(referrer));
} while (0);
NSK_DISPLAY0("Let debugee to finish\n");
@@ -224,12 +220,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_tag_objects) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -61,8 +61,7 @@
NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
msg, (void*) &stor);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
- jvmti_env, (const void*) &stor))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: unable to set an environment local storage\n\n",
msg);
@@ -71,8 +70,7 @@
NSK_DISPLAY1("%s: getting an environment local storage ...\n",
msg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
- jvmti_env, (void**) &obtainedData))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: unable to get an environment local storage\n\n",
msg);
@@ -90,8 +88,7 @@
}
static void timerFunc(jvmtiEnv *jvmti_env, const char *msg) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti_env, &timer_info1 ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetCurrentThreadCpuTimerInfo returned unexpected error code\n\n",
msg);
@@ -114,8 +111,7 @@
}
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti_env, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetCurrentThreadCpuTime returned unexpected error code\n\n",
msg);
@@ -123,8 +119,7 @@
/* ---------------------------------------------------------------------- */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTimerInfo, jvmti_env, &timer_info2 ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetTimerInfo returned unexpected error code\n\n",
msg);
@@ -148,8 +143,7 @@
/* ---------------------------------------------------------------------- */
nanos = 0;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, jvmti_env, &nanos ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetTime returned unexpected error code\n\n",
msg);
@@ -223,10 +217,9 @@
NSK_DISPLAY0("Call IterateOverHeap to tag random objects for ObjectFree evnts\n\n");
{
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback,
- &user_data))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED,
+ heapObjectCallback,
+ &user_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -276,12 +269,10 @@
caps.can_get_thread_cpu_time = 1;
caps.can_generate_object_free_events = 1;
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_garbage_collection_events)
@@ -299,19 +290,21 @@
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_GARBAGE_COLLECTION_START,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_GARBAGE_COLLECTION_FINISH,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -43,8 +43,7 @@
jint i;
for (i = 0; i < classCount && !found; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
- classes[i], &signature, &generic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic)))
break;
if (signature != NULL && strcmp(signature, exp_sig) == 0) {
@@ -52,10 +51,10 @@
}
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
if (generic != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+ jvmti->Deallocate((unsigned char*)generic);
}
return found;
@@ -74,7 +73,7 @@
*/
{
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase ))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -85,14 +84,12 @@
}
do {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
- object_klass, &signature, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(object_klass, &signature, &generic))) {
nsk_jvmti_setFailStatus();
break;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti,
- thread, &threadInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -108,14 +105,13 @@
jint i;
jboolean found = JNI_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti,
- &threadCount, &threads))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadCount, &threads))) {
nsk_jvmti_setFailStatus();
break;
}
for (i = 0; i < threadCount && !found; i++) {
- found = NSK_CPP_STUB3(IsSameObject, jni, threads[i], thread);
+ found = jni->IsSameObject(threads[i], thread);
if (found == JNI_TRUE) {
break;
}
@@ -134,8 +130,7 @@
jint classCount;
jclass *classes;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetLoadedClasses, jvmti,
- &classCount, &classes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLoadedClasses(&classCount, &classes))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -147,7 +142,7 @@
}
if (classes != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+ jvmti->Deallocate((unsigned char*)classes);
} while(0);
@@ -155,8 +150,8 @@
*/
{
jclass klass;
- klass = NSK_CPP_STUB2(GetObjectClass, jni, object);
- if (!(NSK_CPP_STUB3(IsSameObject, jni, object_klass, klass))) {
+ klass = jni->GetObjectClass(object);
+ if (!(jni->IsSameObject(object_klass, klass))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("VMObjectAlloc: unexpected object_klass : \"%s\"\n\n", signature);
}
@@ -167,8 +162,7 @@
do {
jlong objSize;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectSize, jvmti,
- object, &objSize))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(object, &objSize))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -181,10 +175,10 @@
} while(0);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
if (generic != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+ jvmti->Deallocate((unsigned char*)generic);
}
/* ========================================================================== */
@@ -234,21 +228,18 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMObjectAlloc= &VMObjectAlloc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMObjectAlloc event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -79,8 +79,7 @@
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP12_ap12t001_setTag( JNIEnv* jni, jobject obj, jlong tag) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
- jvmti, obj, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -129,12 +128,10 @@
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_generate_object_free_events = 1;
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.can_generate_object_free_events)
@@ -149,16 +146,17 @@
callbacks.ObjectFree = &ObjectFree;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_OBJECT_FREE,
+ NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_VM_DEATH,
+ NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,23 +52,20 @@
jbyte* elements;
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni_env, (newClassSize =
- NSK_CPP_STUB2(GetArrayLength, jni_env, byteCode)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni_env, (newClassSize = jni_env->GetArrayLength(byteCode)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1("\t... got array size: %d\n", newClassSize);
if (!NSK_JNI_VERIFY(jni_env, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, byteCode,
- &isCopy)) != NULL)) {
+ jni_env->GetByteArrayElements(byteCode, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1("\t... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- newClassSize, &newClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize, &newClassBytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -82,7 +79,7 @@
NSK_DISPLAY1("\t... copied bytecode: %d bytes\n", (int)newClassSize);
NSK_DISPLAY1("\t... release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni_env, byteCode, elements, JNI_ABORT));
+ NSK_TRACE(jni_env->ReleaseByteArrayElements(byteCode, elements, JNI_ABORT));
NSK_DISPLAY0("\t... released\n");
return NSK_TRUE;
}
@@ -98,7 +95,7 @@
jobject o, jclass cls) {
if (!NSK_JNI_VERIFY(jni_env, (oldClassDef.klass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni_env, cls)) != NULL)) {
+ jni_env->NewGlobalRef(cls)) != NULL)) {
nsk_jvmti_setFailStatus();
}
}
@@ -129,9 +126,7 @@
unsigned char *arr;
oldClassDef.class_byte_count = class_data_len;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti_env, class_data_len,
- &arr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &arr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -181,9 +176,9 @@
return;
NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -205,8 +200,7 @@
nsk_printHexBytes(" ", 16, oldClassDef.class_byte_count,
oldClassDef.class_bytes);
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &oldClassDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &oldClassDef))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -219,7 +213,7 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- NSK_CPP_STUB2(DeleteGlobalRef, agentJNI, oldClassDef.klass);
+ agentJNI->DeleteGlobalRef(oldClassDef.klass);
NSK_DISPLAY0("Let debuggee to finish\n");
if (!nsk_jvmti_resumeSync())
@@ -256,7 +250,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -267,16 +261,15 @@
memset(&callbacks, 0, size);
callbacks.ClassFileLoadHook = cbClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,23 +54,20 @@
jbyte* elements;
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni_env, (newClassSize[ind] =
- NSK_CPP_STUB2(GetArrayLength, jni_env, byteCode)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni_env, (newClassSize[ind] = jni_env->GetArrayLength(byteCode)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1("\t... got array size: %d\n", newClassSize[ind]);
if (!NSK_JNI_VERIFY(jni_env, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, byteCode,
- &isCopy)) != NULL)) {
+ jni_env->GetByteArrayElements(byteCode, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1("\t... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- newClassSize[ind], &newClassBytes[ind]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize[ind], &newClassBytes[ind]))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -84,7 +81,7 @@
NSK_DISPLAY1("\t... copied bytecode: %d bytes\n", (int)newClassSize[ind]);
NSK_DISPLAY1("\t... release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni_env, byteCode, elements, JNI_ABORT));
+ NSK_TRACE(jni_env->ReleaseByteArrayElements(byteCode, elements, JNI_ABORT));
NSK_DISPLAY0("\t... released\n");
return NSK_TRUE;
}
@@ -100,7 +97,7 @@
jobject o, jint ind, jclass cls) {
if (!NSK_JNI_VERIFY(jni_env, (oldClassDef[ind].klass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni_env, cls)) != NULL)) {
+ jni_env->NewGlobalRef(cls)) != NULL)) {
nsk_jvmti_setFailStatus();
}
}
@@ -131,9 +128,7 @@
unsigned char *arr;
oldClassDef[clsLoadedIdx].class_byte_count = class_data_len;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti_env, class_data_len,
- &arr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &arr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -189,9 +184,9 @@
return;
NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -216,9 +211,7 @@
oldClassDef[i].class_bytes);
}
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, TOTAL_INSTRUMENTED_CLASSES,
- oldClassDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(TOTAL_INSTRUMENTED_CLASSES, oldClassDef))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -232,7 +225,7 @@
return;
for (i = 0; i < TOTAL_INSTRUMENTED_CLASSES; i++) {
- NSK_CPP_STUB2(DeleteGlobalRef, agentJNI, oldClassDef[i].klass);
+ agentJNI->DeleteGlobalRef(oldClassDef[i].klass);
}
NSK_DISPLAY0("Let debuggee to finish\n");
@@ -270,7 +263,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -281,16 +274,15 @@
memset(&callbacks, 0, size);
callbacks.ClassFileLoadHook = cbClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -63,13 +63,13 @@
/* sent by class load */
if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len =
- NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes)) > 0)) {
+ jni_env->GetArrayLength(classBytes)) > 0)) {
nsk_jvmti_setFailStatus();
return;
}
if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*)
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, NULL))
+ jni_env->GetByteArrayElements(classBytes, NULL))
!= NULL)) {
nsk_jvmti_setFailStatus();
return;
@@ -86,30 +86,27 @@
jfieldID field = NULL;
NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- "newClassBytes", "[B")) != NULL))
+ jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, field))
+ jni->GetStaticObjectField(debugeeClass, field))
!= NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB2(NewGlobalRef, jni, classBytes)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
return JNI_ERR;
return NSK_TRUE;
@@ -140,12 +137,13 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, classBytes));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jni->DeleteGlobalRef(classBytes));
if (!nsk_jvmti_resumeSync())
return;
@@ -183,7 +181,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
@@ -191,8 +189,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,35 +52,29 @@
jfieldID field = NULL;
NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- "newClassBytes", "[B")) != NULL))
+ jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, field))
+ jni->GetStaticObjectField(debugeeClass, field))
!= NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB2(NewGlobalRef, jni, classBytes)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL))
return NSK_FALSE;
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -93,17 +87,16 @@
NSK_DISPLAY0("Redefining ...\n");
- if (!NSK_JNI_VERIFY(jni, (class_def.class_byte_count =
- NSK_CPP_STUB2(GetArrayLength, jni, classBytes)) > 0))
+ if (!NSK_JNI_VERIFY(jni, (class_def.class_byte_count = jni->GetArrayLength(classBytes)) > 0))
return NSK_TRUE;
if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*)
- NSK_CPP_STUB3(GetByteArrayElements, jni, classBytes, NULL))
+ jni->GetByteArrayElements(classBytes, NULL))
!= NULL))
return NSK_TRUE;
class_def.klass = testedClass;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -132,9 +125,9 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, classBytes));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jni->DeleteGlobalRef(classBytes));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -171,7 +164,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -63,13 +63,13 @@
/* sent by class load */
if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len =
- NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes)) > 0)) {
+ jni_env->GetArrayLength(classBytes)) > 0)) {
nsk_jvmti_setFailStatus();
return;
}
if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*)
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, NULL))
+ jni_env->GetByteArrayElements(classBytes, NULL))
!= NULL)) {
nsk_jvmti_setFailStatus();
return;
@@ -86,30 +86,27 @@
jfieldID field = NULL;
NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- "newClassBytes", "[B")) != NULL))
+ jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, field))
+ jni->GetStaticObjectField(debugeeClass, field))
!= NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB2(NewGlobalRef, jni, classBytes)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
return JNI_ERR;
return NSK_TRUE;
@@ -140,12 +137,13 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+ NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, classBytes));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jni->DeleteGlobalRef(classBytes));
if (!nsk_jvmti_resumeSync())
return;
@@ -183,7 +181,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
@@ -191,8 +189,7 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,35 +52,29 @@
jfieldID field = NULL;
NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- "newClassBytes", "[B")) != NULL))
+ jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, field))
+ jni->GetStaticObjectField(debugeeClass, field))
!= NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)
- NSK_CPP_STUB2(NewGlobalRef, jni, classBytes)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL))
return NSK_FALSE;
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -93,17 +87,16 @@
NSK_DISPLAY0("Redefining ...\n");
- if (!NSK_JNI_VERIFY(jni, (class_def.class_byte_count =
- NSK_CPP_STUB2(GetArrayLength, jni, classBytes)) > 0))
+ if (!NSK_JNI_VERIFY(jni, (class_def.class_byte_count = jni->GetArrayLength(classBytes)) > 0))
return NSK_TRUE;
if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*)
- NSK_CPP_STUB3(GetByteArrayElements, jni, classBytes, NULL))
+ jni->GetByteArrayElements(classBytes, NULL))
!= NULL))
return NSK_TRUE;
class_def.klass = testedClass;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -132,9 +125,9 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, classBytes));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+ NSK_TRACE(jni->DeleteGlobalRef(classBytes));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -171,7 +164,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -69,9 +69,7 @@
classDef.class_byte_count = ftell(bytecode);
rewind(bytecode);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- classDef.class_byte_count,
- &newClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(classDef.class_byte_count, &newClassBytes))) {
NSK_COMPLAIN0("buffer couldn't be allocated\n");
return NSK_FALSE;
}
@@ -99,14 +97,13 @@
return;
NSK_DISPLAY1("Find class: %s\n", TESTED_CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (classDef.klass =
- NSK_CPP_STUB2(FindClass, jni, TESTED_CLASS_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (classDef.klass = jni->FindClass(TESTED_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
if (!NSK_JNI_VERIFY(jni, (classDef.klass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, classDef.klass)) != NULL)) {
+ jni->NewGlobalRef(classDef.klass)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -120,13 +117,12 @@
nsk_printHexBytes(" ", 16, classDef.class_byte_count,
classDef.class_bytes);
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return;
}
- NSK_CPP_STUB2(DeleteGlobalRef, jni, classDef.klass);
+ jni->DeleteGlobalRef(classDef.klass);
if (!nsk_jvmti_resumeSync())
return;
@@ -163,7 +159,7 @@
caps.can_redefine_classes = 1;
caps.can_redefine_any_class = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -79,8 +79,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -92,8 +91,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -105,24 +103,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -136,23 +130,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -168,27 +160,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -202,7 +190,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -215,7 +203,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -225,8 +213,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -269,44 +256,36 @@
jint dummy_user_data = 0;
NSK_DISPLAY0("Checking positive: SetTag\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetTag\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetObjectsWithTags\n");
tag = TAG_VALUE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverInstancesOfClass\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(
+ klass, JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverObjectsReachableFromObject\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+ thread, ObjectReference, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverReachableObjects\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(
+ HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -325,58 +304,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -391,18 +369,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -418,7 +395,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -431,7 +408,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -444,12 +421,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -463,7 +440,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -477,12 +454,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -496,12 +473,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -597,7 +574,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -609,13 +586,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -627,13 +604,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -645,10 +622,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -85,8 +84,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -98,24 +96,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -129,23 +123,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -161,27 +153,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -195,7 +183,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -208,7 +196,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -218,8 +206,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -263,43 +250,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -318,58 +307,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,18 +372,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -411,7 +398,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -424,7 +411,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -437,12 +424,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -455,10 +442,9 @@
unsigned char *bytecodes;
NSK_DISPLAY0("Checking positive: GetBytecodes\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -472,12 +458,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,12 +477,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -592,7 +578,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -604,13 +590,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -622,13 +608,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -640,10 +626,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,23 +125,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -163,27 +155,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -197,7 +185,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -210,7 +198,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -220,8 +208,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -265,43 +252,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -320,58 +309,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -386,18 +374,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -413,7 +400,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -426,7 +413,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -438,13 +425,11 @@
jboolean is_synthetic;
NSK_DISPLAY0("Checking positive: IsFieldSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IsMethodSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -458,7 +443,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -472,12 +457,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,12 +476,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -592,7 +577,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -604,13 +589,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -622,13 +607,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -640,10 +625,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -85,8 +84,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -98,24 +96,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -129,23 +123,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -161,27 +153,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -194,8 +182,7 @@
jobject *monitors = NULL;
NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -208,7 +195,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -218,8 +205,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -263,43 +249,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -318,58 +306,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,18 +371,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -411,7 +397,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -424,7 +410,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -437,12 +423,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -456,7 +442,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -470,12 +456,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -489,12 +475,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: checkGetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -590,7 +576,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -602,13 +588,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -620,13 +606,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -638,10 +624,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -85,8 +84,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -98,24 +96,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -129,23 +123,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -161,27 +153,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -195,7 +183,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -207,8 +195,7 @@
jobject monitor = NULL;
NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -218,8 +205,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -263,43 +249,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -318,58 +306,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,18 +371,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -411,7 +397,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -424,7 +410,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -437,12 +423,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -456,7 +442,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -470,12 +456,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -489,12 +475,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -590,7 +576,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -602,13 +588,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -620,13 +606,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -638,10 +624,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -85,8 +84,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -98,24 +96,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -129,23 +123,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -161,27 +153,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -195,7 +183,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -208,7 +196,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -218,8 +206,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -263,43 +250,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -318,58 +307,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,18 +372,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -411,7 +398,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -423,8 +410,7 @@
jvmtiMonitorUsage monitor_info;
NSK_DISPLAY0("Checking positive: GetObjectMonitorUsage\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -437,12 +423,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -456,7 +442,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -470,12 +456,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -489,12 +475,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -590,7 +576,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -602,13 +588,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -620,13 +606,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -638,10 +624,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,8 +72,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -85,8 +84,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -98,23 +96,19 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingFlag' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "waitingFlag", "Z")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -128,23 +122,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -160,27 +152,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -194,7 +182,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -207,7 +195,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -223,23 +211,23 @@
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
// PopFrame is allowed to fail with JVMTI_ERROR_OPAQUE_FRAME.
// That will happen if we are in a native function, for example while waiting for a Condition.
// See JCK-5020108.
- err = NSK_CPP_STUB2(PopFrame, jvmti, thread);
+ err = jvmti->PopFrame(thread);
if (err != JVMTI_ERROR_NONE && err != JVMTI_ERROR_OPAQUE_FRAME) {
NSK_DISPLAY1("jvmti error from PopFrame: %d\n", err);
return NSK_FALSE;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
return NSK_TRUE;
@@ -283,43 +271,47 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -338,58 +330,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -404,18 +395,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -431,7 +421,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -444,7 +434,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -457,12 +447,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -476,7 +466,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -490,12 +480,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -509,12 +499,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -610,7 +600,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -622,13 +612,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -640,13 +630,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -658,10 +648,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -89,8 +88,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -102,24 +100,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -133,23 +127,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -165,27 +157,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -199,7 +187,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -212,7 +200,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -222,8 +210,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -267,43 +254,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -322,58 +311,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -388,18 +376,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -415,12 +402,11 @@
class_def.klass = klass;
class_def.class_byte_count = klass_byte_count;
class_def.class_bytes = klass_bytes;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IsMethodObsolete\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete)))
return NSK_FALSE;
return NSK_TRUE;
@@ -433,7 +419,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -446,12 +432,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -465,7 +451,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -479,12 +465,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -498,12 +484,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -521,15 +507,14 @@
if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) {
NSK_DISPLAY1("ClassFileLoadHook: %s\n", name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
memcpy(klass_bytes, class_data, class_data_len);
klass_byte_count = class_data_len;
}
- NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL));
+ NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL));
}
}
@@ -624,7 +609,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -636,13 +621,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -654,13 +639,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -672,10 +657,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -686,11 +671,10 @@
/* activate ClassFileLoadHook to get class file data */
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,23 +125,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -163,25 +155,22 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: StopThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ if (!NSK_JVMTI_VERIFY(jvmti->StopThread(thread, exception)))
return NSK_FALSE;
return NSK_TRUE;
@@ -195,7 +184,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -208,7 +197,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -218,8 +207,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -263,43 +251,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -318,58 +308,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,18 +373,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -411,7 +399,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -424,7 +412,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -437,12 +425,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -456,7 +444,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -470,12 +458,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -489,12 +477,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -590,7 +578,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -602,13 +590,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -620,13 +608,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -638,10 +626,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -86,8 +85,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -99,24 +97,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,23 +124,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -162,27 +154,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -196,7 +184,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -209,7 +197,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -219,8 +207,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -264,43 +251,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -319,58 +308,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -384,19 +372,17 @@
jvmtiLineNumberEntry *line_number_table = NULL;
NSK_DISPLAY0("Checking positive: GetSourceFileName\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -412,7 +398,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -425,7 +411,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -438,12 +424,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -457,7 +443,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -471,12 +457,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -490,12 +476,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -591,7 +577,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -603,13 +589,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -621,13 +607,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -639,10 +625,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -83,8 +83,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -96,8 +95,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -109,24 +107,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -140,23 +134,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -172,27 +164,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -206,7 +194,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -219,7 +207,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -229,8 +217,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -274,43 +261,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -333,83 +322,80 @@
*/
NSK_DISPLAY0("Checking positive: GetLocalVariableTable\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
/* DEBUG -- while thread should be suspended
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
*/
for (i = 0; i < count; i++) {
if (strcmp(local_variable_table[i].name, "o") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalObject, jvmti,
- thread, 1, local_variable_table[i].slot, &object_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalObject(thread, 1, local_variable_table[i].slot, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalObject, jvmti,
- thread, 1, local_variable_table[i].slot, object_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalObject(thread, 1, local_variable_table[i].slot, object_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "i") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalInt\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalInt, jvmti,
- thread, 1, local_variable_table[i].slot, &int_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalInt(thread, 1, local_variable_table[i].slot, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalInt\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalInt, jvmti,
- thread, 1, local_variable_table[i].slot, int_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalInt(thread, 1, local_variable_table[i].slot, int_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "l") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalLong\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalLong, jvmti,
- thread, 1, local_variable_table[i].slot, &long_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalLong(thread, 1, local_variable_table[i].slot, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalLong\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalLong, jvmti,
- thread, 1, local_variable_table[i].slot, long_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalLong(thread, 1, local_variable_table[i].slot, long_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "f") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalFloat\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalFloat, jvmti,
- thread, 1, local_variable_table[i].slot, &float_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalFloat(thread, 1, local_variable_table[i].slot, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalFloat\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalFloat, jvmti,
- thread, 1, local_variable_table[i].slot, float_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalFloat(thread, 1, local_variable_table[i].slot, float_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "d") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalDouble\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalDouble, jvmti,
- thread, 1, local_variable_table[i].slot, &double_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalDouble(thread, 1, local_variable_table[i].slot, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalDouble\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalDouble, jvmti,
- thread, 1, local_variable_table[i].slot, double_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalDouble(thread, 1, local_variable_table[i].slot, double_value)))
return NSK_FALSE;
}
}
/* DEBUG -- while thread should be suspended
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
*/
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)local_variable_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)local_variable_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -424,18 +410,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -451,7 +436,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -464,7 +449,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -477,12 +462,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -496,7 +481,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -510,12 +495,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -529,12 +514,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -630,7 +615,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -642,13 +627,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -660,13 +645,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -678,10 +663,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -89,8 +88,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -102,24 +100,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -133,21 +127,19 @@
jvmtiError err;
NSK_DISPLAY0("Checking positive: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SuspendThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -163,27 +155,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -197,7 +185,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -210,7 +198,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -220,8 +208,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -265,43 +252,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -320,58 +309,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -386,18 +374,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -413,7 +400,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -426,7 +413,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -439,12 +426,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -458,7 +445,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -472,12 +459,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,12 +478,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -592,7 +579,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -604,13 +591,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -622,13 +609,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -640,10 +627,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -86,8 +85,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -99,24 +97,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,23 +124,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -162,27 +154,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -196,7 +184,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -209,7 +197,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -219,8 +207,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -264,43 +251,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -319,58 +308,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -385,18 +373,16 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetLineNumberTable\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -412,7 +398,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -425,7 +411,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -438,12 +424,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -457,7 +443,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -471,12 +457,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -490,12 +476,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -591,7 +577,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -603,13 +589,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -621,13 +607,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -639,10 +625,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,7 +124,7 @@
static int checkGetPotentialCapabilities() {
jvmtiCapabilities caps;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return NSK_FALSE;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -148,7 +142,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -160,7 +154,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (owe && !caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -182,7 +176,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -196,23 +190,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -228,27 +220,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -262,7 +250,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -275,7 +263,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -285,8 +273,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -330,43 +317,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -385,58 +374,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -451,18 +439,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -478,7 +465,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,7 +478,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -504,12 +491,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -523,15 +510,14 @@
if (positive) {
NSK_DISPLAY0("Checking positive: GetBytecodes\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(bytecodes)))
return NSK_FALSE;
} else {
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
}
@@ -546,12 +532,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -565,12 +551,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -89,8 +88,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -102,24 +100,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -132,7 +126,7 @@
static int checkGetPotentialCapabilities() {
jvmtiCapabilities caps;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return NSK_FALSE;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -150,7 +144,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -162,7 +156,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (owe && !caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -184,7 +178,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -198,23 +192,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -230,27 +222,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -264,7 +252,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -277,7 +265,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -287,8 +275,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -332,43 +319,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -387,58 +376,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -453,18 +441,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -480,7 +467,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -493,7 +480,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -506,23 +493,21 @@
if (positive) {
NSK_DISPLAY0("Checking positive: IsFieldSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IsMethodSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
} else {
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
}
@@ -537,7 +522,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -551,12 +536,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -570,12 +555,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,7 +124,7 @@
static int checkGetPotentialCapabilities() {
jvmtiCapabilities caps;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return NSK_FALSE;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -148,7 +142,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -160,7 +154,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (owe && !caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -182,7 +176,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -196,23 +190,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -228,27 +220,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -262,7 +250,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -275,7 +263,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -285,8 +273,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -330,43 +317,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -385,58 +374,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -451,18 +439,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -478,7 +465,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,14 +478,12 @@
if (positive) {
NSK_DISPLAY0("Checking positive: GetObjectMonitorUsage\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti,
- thread, &monitor_info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
} else {
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti,
- thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
}
@@ -512,12 +497,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -531,7 +516,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -545,12 +530,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -564,12 +549,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -76,8 +76,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -89,8 +88,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -102,24 +100,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -132,7 +126,7 @@
static int checkGetPotentialCapabilities() {
jvmtiCapabilities caps;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return NSK_FALSE;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -150,7 +144,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -162,7 +156,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (owe && !caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -184,7 +178,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -198,23 +192,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -230,37 +222,33 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
if (positive) {
NSK_DISPLAY0("Checking positive: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: StopThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, jvmti,
- thread, exception)))
+ if (!NSK_JVMTI_VERIFY(jvmti->StopThread(thread, exception)))
return NSK_FALSE;
} else {
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ jvmti->InterruptThread(thread)))
return NSK_FALSE;
}
@@ -275,7 +263,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -288,7 +276,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -298,8 +286,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -343,43 +330,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -398,58 +387,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -464,18 +452,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,7 +478,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -504,7 +491,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -517,12 +504,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -536,7 +523,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -550,12 +537,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -569,12 +556,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -78,8 +78,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -91,8 +90,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -104,24 +102,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -134,7 +128,7 @@
static int checkGetPotentialCapabilities() {
jvmtiCapabilities caps;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return NSK_FALSE;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -152,7 +146,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -164,7 +158,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (owe && !caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -186,7 +180,7 @@
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return NSK_FALSE;
return NSK_TRUE;
@@ -201,41 +195,39 @@
if (positive) {
NSK_DISPLAY0("Checking positive: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SuspendThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
} else {
NSK_DISPLAY0("Checking negative: SuspendThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
}
@@ -252,27 +244,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -286,7 +274,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -299,7 +287,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -309,8 +297,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -354,43 +341,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -409,58 +398,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -475,18 +463,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -502,7 +489,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -515,7 +502,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -528,12 +515,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -547,7 +534,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -561,12 +548,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -580,12 +567,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -86,8 +85,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -99,24 +97,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,23 +124,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -162,27 +154,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -196,7 +184,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -209,7 +197,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -219,8 +207,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -264,43 +251,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -319,58 +308,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -385,18 +373,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_ABSENT_INFORMATION,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -412,7 +399,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -425,7 +412,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -438,12 +425,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -457,7 +444,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -471,12 +458,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -490,12 +477,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -591,7 +578,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -603,13 +590,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -621,13 +608,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -639,10 +626,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,23 +125,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -163,27 +155,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -197,7 +185,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -210,7 +198,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -220,8 +208,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -265,43 +252,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -320,58 +309,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -386,18 +374,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -413,7 +400,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -426,7 +413,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -439,12 +426,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -458,7 +445,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -471,13 +458,11 @@
jlong nanos;
NSK_DISPLAY0("Checking positive: GetCurrentThreadCpuTimerInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetCurrentThreadCpuTime\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -491,12 +476,12 @@
NSK_DISPLAY0("Checking negative: GetThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: checkGetThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -592,7 +577,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -604,13 +589,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -622,13 +607,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -640,10 +625,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -74,8 +74,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,24 +98,20 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingMonitor' */
if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass,
- "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+ jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,23 +125,21 @@
jvmtiError err;
NSK_DISPLAY0("Checking negative: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SuspendThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: ResumeThreadList\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -163,27 +155,23 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: StopThread\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ jvmti->StopThread(thread, exception)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->InterruptThread(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -197,7 +185,7 @@
NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -210,7 +198,7 @@
NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -220,8 +208,7 @@
*/
static int checkPopFrame() {
NSK_DISPLAY0("Checking negative: PopFrame\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(PopFrame, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->PopFrame(thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -265,43 +252,45 @@
NSK_DISPLAY0("Checking negative: SetTag\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetTag\n");
- if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetObjectsWithTags\n");
tag = TAG_VALUE;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -320,58 +309,57 @@
NSK_DISPLAY0("Checking negative: GetLocalVariableTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalObject, jvmti, thread, 0, 0, &object_value)))
+ jvmti->GetLocalObject(thread, 0, 0, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalInt, jvmti, thread, 0, 0, &int_value)))
+ jvmti->GetLocalInt(thread, 0, 0, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalLong, jvmti, thread, 0, 0, &long_value)))
+ jvmti->GetLocalLong(thread, 0, 0, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalFloat, jvmti, thread, 0, 0, &float_value)))
+ jvmti->GetLocalFloat(thread, 0, 0, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(GetLocalDouble, jvmti, thread, 0, 0, &double_value)))
+ jvmti->GetLocalDouble(thread, 0, 0, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalObject\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalObject, jvmti, thread, 0, 0, thread)))
+ jvmti->SetLocalObject(thread, 0, 0, thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalInt\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalInt, jvmti, thread, 0, 0, (jint)0)))
+ jvmti->SetLocalInt(thread, 0, 0, (jint)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalLong\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalLong, jvmti, thread, 0, 0, (jlong)0)))
+ jvmti->SetLocalLong(thread, 0, 0, (jlong)0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalFloat\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalFloat, jvmti, thread, 0, 0, (jfloat)0.0)))
+ jvmti->SetLocalFloat(thread, 0, 0, (jfloat)0.0)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: SetLocalDouble\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB5(SetLocalDouble, jvmti, thread, 0, 0, (jdouble)0.0)))
+ jvmti->SetLocalDouble(thread, 0, 0, (jdouble)0.0)))
return NSK_FALSE;
return NSK_TRUE;
@@ -386,18 +374,17 @@
NSK_DISPLAY0("Checking negative: GetSourceFileName\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetLineNumberTable\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -413,7 +400,7 @@
class_def.class_byte_count = 0;
class_def.class_bytes = NULL;
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -426,7 +413,7 @@
NSK_DISPLAY0("Checking negative: GetObjectMonitorUsage\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -439,12 +426,12 @@
NSK_DISPLAY0("Checking negative: IsFieldSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: IsMethodSynthetic\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -458,7 +445,7 @@
NSK_DISPLAY0("Checking negative: GetBytecodes\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -472,12 +459,12 @@
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTimerInfo\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking negative: GetCurrentThreadCpuTime\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -490,13 +477,11 @@
jlong nanos;
NSK_DISPLAY0("Checking positive: GetThreadCpuTimerInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: checkGetThreadCpuTime\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -592,7 +577,7 @@
/* testcase #1: check GetPotentialCapabilities */
NSK_DISPLAY0("Testcase #1: check if GetPotentialCapabilities returns the capability\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetPotentialCapabilities does not return \"%s\" capability\n",
@@ -604,13 +589,13 @@
NSK_DISPLAY0("Testcase #2: add the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* testcase #3: check if GetCapabilities returns the capability */
NSK_DISPLAY0("Testcase #3: check if GetCapabilities returns the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
@@ -622,13 +607,13 @@
NSK_DISPLAY0("Testcase #4: relinquish the capability during Onload phase\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RelinquishCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(&caps)))
return JNI_ERR;
/* testcase #5: check if GetCapabilities does not return the capability */
NSK_DISPLAY0("Testcase #5: check if GetCapabilities does not return the capability\n");
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities returns relinquished \"%s\" capability\n",
@@ -640,10 +625,10 @@
NSK_DISPLAY0("Testcase #6: add back the capability and check with GetCapabilities\n");
memset(&caps, 0, sizeof(caps));
caps.CAPABILITY = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;
if (!caps.CAPABILITY) {
NSK_COMPLAIN1("GetCapabilities does not return \"%s\" capability\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001.java Tue Oct 16 14:26:22 2018 +0530
@@ -81,8 +81,8 @@
return status;
thread.letFinish();
- // pause to provoke contention
- Thread.sleep(100);
+ // pause to provoke contention on thread.endingMonitor
+ Thread.sleep(1000);
} catch (InterruptedException e) {
throw new Failure(e);
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -99,17 +99,16 @@
CompiledMethodLoadEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n",
name, signature, code_addr);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -126,8 +125,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
@@ -139,8 +138,7 @@
MonitorContendedEnterEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -156,8 +154,7 @@
MonitorContendedEnteredEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -173,8 +170,7 @@
MonitorWaitEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -190,8 +186,7 @@
MonitorWaitedEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -207,14 +202,13 @@
VMObjectAllocEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- object_klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -226,7 +220,7 @@
NativeMethodBindEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -234,8 +228,7 @@
if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE)
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -243,9 +236,9 @@
NSK_DISPLAY2("NativeMethodBind event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -280,8 +273,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -293,8 +285,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -305,18 +296,15 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -330,7 +318,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (!NSK_VERIFY(caps.can_tag_objects))
return NSK_FALSE;
@@ -373,8 +361,7 @@
jobject *monitors = NULL;
NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetOwnedMonitorInfo, jvmti, thread, &count, &monitors)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors)))
return NSK_FALSE;
return NSK_TRUE;
@@ -386,8 +373,7 @@
jobject monitor = NULL;
NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetCurrentContendedMonitor, jvmti, thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor)))
return NSK_FALSE;
return NSK_TRUE;
@@ -439,44 +425,44 @@
jint dummy_user_data = 0;
NSK_DISPLAY0("Checking positive: SetTag\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetTag, jvmti, thread, TAG_VALUE)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(thread, TAG_VALUE)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetTag\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetTag, jvmti, thread, &tag)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(thread, &tag)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetObjectsWithTags\n");
tag = TAG_VALUE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetObjectsWithTags, jvmti, 1, &tag,
- &count, &res_objects, &res_tags)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags(1, &tag, &count, &res_objects, &res_tags)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverHeap\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverHeap, jvmti, JVMTI_HEAP_OBJECT_TAGGED,
- HeapObject, &dummy_user_data)))
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, HeapObject, &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverInstancesOfClass\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, klass,
- JVMTI_HEAP_OBJECT_UNTAGGED, HeapObject, &dummy_user_data)))
+ jvmti->IterateOverInstancesOfClass(klass,
+ JVMTI_HEAP_OBJECT_UNTAGGED,
+ HeapObject,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti, thread,
- ThreadObjectReference, &dummy_user_data)))
+ jvmti->IterateOverObjectsReachableFromObject(thread,
+ ThreadObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
- HeapRoot, StackReference, ObjectReference, &dummy_user_data)))
+ jvmti->IterateOverReachableObjects(HeapRoot,
+ StackReference,
+ ObjectReference,
+ &dummy_user_data)))
return NSK_FALSE;
return NSK_TRUE;
@@ -488,8 +474,7 @@
jvmtiMonitorUsage monitor_info;
NSK_DISPLAY0("Checking positive: GetObjectMonitorUsage\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetObjectMonitorUsage, jvmti, thread, &monitor_info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(thread, &monitor_info)))
return NSK_FALSE;
return NSK_TRUE;
@@ -502,13 +487,11 @@
jlong nanos;
NSK_DISPLAY0("Checking positive: GetCurrentThreadCpuTimerInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: GetCurrentThreadCpuTime\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, &nanos)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTime(&nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -521,13 +504,11 @@
jlong nanos;
NSK_DISPLAY0("Checking positive: GetThreadCpuTimerInfo\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTimerInfo(&info)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: checkGetThreadCpuTime\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, &nanos)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thread, &nanos)))
return NSK_FALSE;
return NSK_TRUE;
@@ -641,7 +622,7 @@
if (!checkGetThreadCpuTime(jvmti))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
/* resume debugee and wait for sync */
if (!nsk_jvmti_resumeSync())
@@ -706,7 +687,7 @@
caps.can_generate_native_method_bind_events = 1;
caps.can_generate_garbage_collection_events = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callbacks */
@@ -723,46 +704,45 @@
callbacks.GarbageCollectionStart = &GarbageCollectionStart;
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
callbacks.ObjectFree = &ObjectFree;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -95,15 +95,15 @@
if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) {
NSK_DISPLAY1("ClassFileLoadHook: %s\n", name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
memcpy(klass_bytes, class_data, class_data_len);
klass_byte_count = class_data_len;
}
- NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL));
+ NSK_JVMTI_VERIFY(
+ jvmti_env->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL));
}
}
@@ -116,20 +116,18 @@
FieldAccessEventsCount++;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(ClearFieldAccessWatch, jvmti_env, klass, field)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->ClearFieldAccessWatch(klass, field)))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName,
- jvmti_env, field_klass, field, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("FieldAccess event: %s:%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -142,16 +140,15 @@
FieldModificationEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName,
- jvmti_env, field_klass, field, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("FieldModification event: %s:%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -162,19 +159,19 @@
SingleStepEventsCount++;
- NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
+ NSK_JVMTI_VERIFY(
+ jvmti_env->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("SingleStep event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -186,19 +183,17 @@
ExceptionEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Exception event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
void JNICALL
@@ -209,19 +204,17 @@
ExceptionCatchEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("ExceptionCatch event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -231,18 +224,17 @@
char *signature = NULL;
BreakpointEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
- NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0);
+ jvmti_env->NotifyFramePop(thread, 0);
}
static void JNICALL
@@ -253,16 +245,15 @@
char *signature = NULL;
FramePopEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("FramePop event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -272,16 +263,15 @@
char *signature = NULL;
MethodEntryEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -292,16 +282,15 @@
char *signature = NULL;
MethodExitEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -316,8 +305,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -329,8 +317,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -341,28 +328,23 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'delay' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "delay", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingFlag' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "waitingFlag", "Z")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -372,41 +354,37 @@
NSK_DISPLAY0("Prepare events ...\n");
/* get tested thread method 'letItGo' */
- if (!NSK_JNI_VERIFY(jni, (method =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "letItGo", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "letItGo", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread field 'waitingFlag' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "waitingFlag", "Z")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetFieldAccessWatch, jvmti, klass, field)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetFieldAccessWatch(klass, field)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetFieldModificationWatch, jvmti, klass, field)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(klass, field)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint, jvmti, method, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(method, 0)))
return NSK_FALSE;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, thread)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, thread)))
return NSK_FALSE;
return NSK_TRUE;
@@ -420,7 +398,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return NSK_FALSE;
if (!NSK_VERIFY(caps.can_get_bytecodes))
return NSK_FALSE;
@@ -471,10 +449,9 @@
unsigned char *bytecodes;
NSK_DISPLAY0("Checking positive: GetBytecodes\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetBytecodes, jvmti, method, &count, &bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetBytecodes(method, &count, &bytecodes)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, bytecodes)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(bytecodes)))
return NSK_FALSE;
return NSK_TRUE;
@@ -486,13 +463,11 @@
jboolean is_synthetic;
NSK_DISPLAY0("Checking positive: IsFieldSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(IsFieldSynthetic, jvmti, klass, field, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsFieldSynthetic(klass, field, &is_synthetic)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IsMethodSynthetic\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodSynthetic, jvmti, method, &is_synthetic)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodSynthetic(method, &is_synthetic)))
return NSK_FALSE;
return NSK_TRUE;
@@ -511,12 +486,11 @@
class_def.klass = klass;
class_def.class_byte_count = klass_byte_count;
class_def.class_bytes = klass_bytes;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: IsMethodObsolete\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete)))
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete)))
return NSK_FALSE;
return NSK_TRUE;
@@ -528,8 +502,7 @@
char *name;
NSK_DISPLAY0("Checking positive: GetSourceFileName\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetSourceFileName, jvmti, klass, &name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetSourceFileName(klass, &name)))
return NSK_FALSE;
return NSK_TRUE;
@@ -542,9 +515,7 @@
jvmtiLineNumberEntry *line_number_table = NULL;
NSK_DISPLAY0("Checking positive: GetLineNumberTable\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetLineNumberTable, jvmti, method, &count,
- &line_number_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &line_number_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -557,7 +528,7 @@
NSK_DISPLAY0("Checking positive: GetSourceDebugExtension\n");
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_ABSENT_INFORMATION,
- NSK_CPP_STUB3(GetSourceDebugExtension, jvmti, klass, &name)))
+ jvmti->GetSourceDebugExtension(klass, &name)))
return NSK_FALSE;
return NSK_TRUE;
@@ -576,77 +547,74 @@
int i;
NSK_DISPLAY0("Checking positive: GetLocalVariableTable\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetLocalVariableTable, jvmti, method, &count,
- &local_variable_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(method, &count, &local_variable_table)))
return NSK_FALSE;
/* DEBUG -- while 4913796 bug not fixed thread should be suspended
*/
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
for (i = 0; i < count; i++) {
if (strcmp(local_variable_table[i].name, "o") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalObject, jvmti,
- thread, 1, local_variable_table[i].slot, &object_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalObject(thread, 1, local_variable_table[i].slot, &object_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalObject, jvmti,
- thread, 1, local_variable_table[i].slot, object_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalObject(thread, 1, local_variable_table[i].slot, object_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "i") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalInt\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalInt, jvmti,
- thread, 1, local_variable_table[i].slot, &int_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalInt(thread, 1, local_variable_table[i].slot, &int_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalInt\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalInt, jvmti,
- thread, 1, local_variable_table[i].slot, int_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalInt(thread, 1, local_variable_table[i].slot, int_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "l") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalLong\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalLong, jvmti,
- thread, 1, local_variable_table[i].slot, &long_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalLong(thread, 1, local_variable_table[i].slot, &long_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalLong\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalLong, jvmti,
- thread, 1, local_variable_table[i].slot, long_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalLong(thread, 1, local_variable_table[i].slot, long_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "f") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalFloat\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalFloat, jvmti,
- thread, 1, local_variable_table[i].slot, &float_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalFloat(thread, 1, local_variable_table[i].slot, &float_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalFloat\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalFloat, jvmti,
- thread, 1, local_variable_table[i].slot, float_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalFloat(thread, 1, local_variable_table[i].slot, float_value)))
return NSK_FALSE;
} else if (strcmp(local_variable_table[i].name, "d") ==0) {
NSK_DISPLAY0("Checking positive: GetLocalDouble\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetLocalDouble, jvmti,
- thread, 1, local_variable_table[i].slot, &double_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetLocalDouble(thread, 1, local_variable_table[i].slot, &double_value)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SetLocalDouble\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(SetLocalDouble, jvmti,
- thread, 1, local_variable_table[i].slot, double_value)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetLocalDouble(thread, 1, local_variable_table[i].slot, double_value)))
return NSK_FALSE;
}
}
/* DEBUG -- while 4913796 bug not fixed thread should be suspended
*/
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)local_variable_table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)local_variable_table)))
return NSK_FALSE;
return NSK_TRUE;
@@ -658,21 +626,19 @@
jvmtiError err;
NSK_DISPLAY0("Checking positive: SuspendThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: SuspendThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(1, &thread, &err)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: ResumeThreadList\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, 1, &thread, &err)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(1, &thread, &err)))
return NSK_FALSE;
return NSK_TRUE;
@@ -685,20 +651,20 @@
jvmtiError err;
NSK_DISPLAY0("Checking positive: PopFrame\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
// PopFrame is allowed to fail with JVMTI_ERROR_OPAQUE_FRAME.
// That will happen if we are in a native function,
// for example while waiting for a Condition.
// See JCK-5020108.
- err = NSK_CPP_STUB2(PopFrame, jvmti, thread);
+ err = jvmti->PopFrame(thread);
if (err != JVMTI_ERROR_NONE && err != JVMTI_ERROR_OPAQUE_FRAME) {
result = NSK_FALSE;
NSK_DISPLAY1("jvmti error from PopFrame: %d\n", err);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
result = NSK_FALSE;
return result;
@@ -714,25 +680,22 @@
jmethodID ctor = NULL;
jobject exception = NULL;
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (exception =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: InterruptThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(thread)))
return NSK_FALSE;
NSK_DISPLAY0("Checking positive: StopThread\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(StopThread, jvmti, thread, exception)))
+ if (!NSK_JVMTI_VERIFY(jvmti->StopThread(thread, exception)))
return NSK_FALSE;
return NSK_TRUE;
@@ -847,7 +810,7 @@
if (!checkSignalThread(jvmti, jni))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
/* resume debugee and wait for sync */
if (!nsk_jvmti_resumeSync())
@@ -916,7 +879,7 @@
caps.can_generate_breakpoint_events = 1;
caps.can_generate_method_entry_events = 1;
caps.can_generate_method_exit_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callbacks */
@@ -931,25 +894,24 @@
callbacks.FramePop = &FramePop;
callbacks.MethodEntry = &MethodEntry;
callbacks.MethodExit = &MethodExit;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,8 +54,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -67,8 +66,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -79,38 +77,31 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'M1' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "M1", FIELD_SIG)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M1", FIELD_SIG)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (object_M1 =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M1 = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* get tested thread field 'M2' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "M2", FIELD_SIG)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M2", FIELD_SIG)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (object_M2 =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M2 = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -126,22 +117,19 @@
int i;
NSK_DISPLAY1("Checking GetObjectMonitorUsage for 0x%p\n", object);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetObjectMonitorUsage, jvmti, object, &inf)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(object, &inf)))
return NSK_FALSE;
if (nsk_getVerboseMode()) {
if (inf.owner == NULL) {
NSK_DISPLAY0("\towner: none (0x0)\n");
} else {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetThreadInfo, jvmti, inf.owner, &tinf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(inf.owner, &tinf))) {
result = NSK_FALSE;
} else {
NSK_DISPLAY2("\towner: %s (0x%p)\n", tinf.name, inf.owner);
if (tinf.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)tinf.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name)))
result = NSK_FALSE;
}
}
@@ -152,15 +140,13 @@
if (inf.waiter_count > 0) {
NSK_DISPLAY0("\twaiters:\n");
for (i = 0; i < inf.waiter_count; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetThreadInfo, jvmti, inf.waiters[i], &tinf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(inf.waiters[i], &tinf))) {
result = NSK_FALSE;
} else {
NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n",
i, tinf.name, inf.waiters[i]);
if (tinf.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)tinf.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name)))
result = NSK_FALSE;
}
}
@@ -171,15 +157,13 @@
if (inf.notify_waiter_count > 0) {
NSK_DISPLAY0("\tnotify_waiters:\n");
for (i = 0; i < inf.notify_waiter_count; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetThreadInfo, jvmti, inf.notify_waiters[i], &tinf))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(inf.notify_waiters[i], &tinf))) {
result = NSK_FALSE;
} else {
NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n",
i, tinf.name, inf.notify_waiters[i]);
if (tinf.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)tinf.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name)))
result = NSK_FALSE;
}
}
@@ -188,8 +172,7 @@
}
/* check owner to be debugee thread */
- if (!NSK_JNI_VERIFY(jni, (NSK_CPP_STUB3(
- IsSameObject, jni, inf.owner, thread)) == JNI_TRUE))
+ if (!NSK_JNI_VERIFY(jni, (jni->IsSameObject(inf.owner, thread)) == JNI_TRUE))
result = NSK_FALSE;
if (!NSK_VERIFY(inf.entry_count == 2))
@@ -203,13 +186,11 @@
/* deallocate monitor waiters arrays */
if (inf.waiters != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)inf.waiters)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.waiters)))
result = NSK_FALSE;
}
if (inf.notify_waiters != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)inf.notify_waiters)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.notify_waiters)))
result = NSK_FALSE;
}
@@ -279,7 +260,7 @@
/* add capabilities */
memset(&caps, 0, sizeof(caps));
caps.can_get_monitor_info = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Tue Oct 16 14:26:22 2018 +0530
@@ -71,7 +71,7 @@
thread.waitingBarrier1.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
@@ -79,7 +79,7 @@
thread.waitingBarrier2.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
@@ -87,7 +87,7 @@
thread.waitingBarrier3.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,8 +52,7 @@
jint line = 0;
int i;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(
- GetFrameLocation, jvmti, thread, 0, &method, &location)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(thread, 0, &method, &location)))
return 0;
if (!NSK_VERIFY(method != NULL))
@@ -62,8 +61,7 @@
if (!NSK_VERIFY(location != -1))
return 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(
- GetLineNumberTable, jvmti, method, &count, &table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &table)))
return 0;
if (!NSK_VERIFY(table != NULL))
@@ -81,8 +79,7 @@
line = table[i-1].line_number;
if (table != NULL) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)table)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)table)))
return 0;
}
@@ -108,8 +105,8 @@
}
/* check if event is for tested thread and object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object_M, obj)) {
if (!(line = findLineNumber(jvmti, thread))) {
nsk_jvmti_setFailStatus();
@@ -152,8 +149,8 @@
}
/* check if event is for tested thread and object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object_M, obj)) {
if (!(line = findLineNumber(jvmti, thread))) {
nsk_jvmti_setFailStatus();
@@ -194,8 +191,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -207,8 +203,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -219,15 +214,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -236,39 +229,34 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'M' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "M", FIELD_SIG)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (object_M =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object_M =
- NSK_CPP_STUB2(NewGlobalRef, jni, object_M)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL))
return NSK_FALSE;
/* enable MonitorContendedEntered event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
return NSK_FALSE;
/* enable MonitorContendedEntered event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -278,8 +266,8 @@
/* disable MonitorContendedEntered event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -364,15 +352,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
caps.can_get_line_numbers = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.MonitorContendedEnter = &MonitorContendedEnter;
callbacks.MonitorContendedEntered = &MonitorContendedEntered;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,38 +57,32 @@
NSK_DISPLAY1("Found deadlock #%d:\n", numberOfDeadlocks);
for (pThread = dThread;;pThread = cThread) {
NSK_DISPLAY1(" \"%s\":\n", threadList[pThread].name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetCurrentContendedMonitor,
- jvmti, threadList[pThread].thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
return NSK_FALSE;
if (monitor != NULL) {
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, monitor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(
- GetClassSignature, jvmti, klass, &name, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL)))
return NSK_FALSE;
NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name);
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
} else {
NSK_DISPLAY0(" (JVMTI raw monitor),\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage,
- jvmti, monitor, &usageInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo)))
return NSK_FALSE;
if (usageInfo.owner == NULL)
break;
for (cThread = 0; cThread < threads_count; cThread++) {
- if (NSK_CPP_STUB3(IsSameObject, jni,
- threadList[cThread].thread, usageInfo.owner))
+ if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
break;
}
if (usageInfo.waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.waiters);
}
if (usageInfo.notify_waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.notify_waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
}
if (!NSK_VERIFY(cThread != threads_count))
return NSK_FALSE;
@@ -113,15 +107,14 @@
NSK_DISPLAY0("Create threadList\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
return NSK_FALSE;
for (i = 0; i < threads_count; i++) {
@@ -129,8 +122,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -141,8 +133,7 @@
}
/* deallocate thread list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
for (i = 0; i < threads_count; i++) {
@@ -150,28 +141,24 @@
tDfn = gDfn;
threadList[i].dfn = gDfn++;
for (pThread = i;;pThread = cThread) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetCurrentContendedMonitor,
- jvmti, threadList[pThread].thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
return NSK_FALSE;
if (monitor == NULL)
break;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage,
- jvmti, monitor, &usageInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo)))
return NSK_FALSE;
if (usageInfo.owner == NULL)
break;
for (cThread = 0; cThread < threads_count; cThread++) {
- if (NSK_CPP_STUB3(IsSameObject, jni,
- threadList[cThread].thread, usageInfo.owner))
+ if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
break;
}
if (usageInfo.waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.waiters);
}
if (usageInfo.notify_waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.notify_waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
}
if (!NSK_VERIFY(cThread != threads_count))
return NSK_FALSE;
@@ -194,8 +181,7 @@
/* deallocate thread names */
for (i = 0; i < threads_count; i++) {
if (threadList[i].name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)threadList[i].name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name)))
return NSK_FALSE;
}
}
@@ -261,7 +247,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_current_contended_monitor = 1;
caps.can_get_monitor_info = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -57,38 +57,32 @@
NSK_DISPLAY1("Found deadlock #%d:\n", numberOfDeadlocks);
for (pThread = dThread;;pThread = cThread) {
NSK_DISPLAY1(" \"%s\":\n", threadList[pThread].name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetCurrentContendedMonitor,
- jvmti, threadList[pThread].thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
return NSK_FALSE;
if (monitor != NULL) {
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, monitor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(
- GetClassSignature, jvmti, klass, &name, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL)))
return NSK_FALSE;
NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name);
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
} else {
NSK_DISPLAY0(" (JVMTI raw monitor),\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage,
- jvmti, monitor, &usageInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo)))
return NSK_FALSE;
if (usageInfo.owner == NULL)
break;
for (cThread = 0; cThread < threads_count; cThread++) {
- if (NSK_CPP_STUB3(IsSameObject, jni,
- threadList[cThread].thread, usageInfo.owner))
+ if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
break;
}
if (usageInfo.waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.waiters);
}
if (usageInfo.notify_waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.notify_waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
}
if (!NSK_VERIFY(cThread != threads_count))
return NSK_FALSE;
@@ -113,15 +107,14 @@
NSK_DISPLAY0("Create threadList\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList)))
return NSK_FALSE;
for (i = 0; i < threads_count; i++) {
@@ -129,8 +122,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -141,8 +133,7 @@
}
/* deallocate thread list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
for (i = 0; i < threads_count; i++) {
@@ -150,28 +141,24 @@
tDfn = gDfn;
threadList[i].dfn = gDfn++;
for (pThread = i;;pThread = cThread) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetCurrentContendedMonitor,
- jvmti, threadList[pThread].thread, &monitor)))
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor)))
return NSK_FALSE;
if (monitor == NULL)
break;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage,
- jvmti, monitor, &usageInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo)))
return NSK_FALSE;
if (usageInfo.owner == NULL)
break;
for (cThread = 0; cThread < threads_count; cThread++) {
- if (NSK_CPP_STUB3(IsSameObject, jni,
- threadList[cThread].thread, usageInfo.owner))
+ if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner))
break;
}
if (usageInfo.waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.waiters);
}
if (usageInfo.notify_waiters != NULL) {
- NSK_CPP_STUB2(Deallocate, jvmti,
- (unsigned char*)usageInfo.notify_waiters);
+ jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters);
}
if (!NSK_VERIFY(cThread != threads_count))
return NSK_FALSE;
@@ -194,8 +181,7 @@
/* deallocate thread names */
for (i = 0; i < threads_count; i++) {
if (threadList[i].name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)threadList[i].name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name)))
return NSK_FALSE;
}
}
@@ -261,7 +247,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_get_current_contended_monitor = 1;
caps.can_get_monitor_info = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -44,14 +44,14 @@
static jboolean lockSyncLock(jvmtiEnv* jvmti) {
- jboolean status = NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock));
+ jboolean status = NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock));
if (!status)
nsk_jvmti_setFailStatus();
return status;
}
static void unlockSyncLock(jvmtiEnv* jvmti) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -73,7 +73,7 @@
}
/* check if event is for tested object */
- if (NSK_CPP_STUB3(IsInstanceOf, jni, obj, object_M)) {
+ if (jni->IsInstanceOf(obj, object_M)) {
if (lockSyncLock(jvmti)) {
waitEventsCount++;
unlockSyncLock(jvmti);
@@ -96,7 +96,7 @@
}
/* check if event is for tested object */
- if (NSK_CPP_STUB3(IsInstanceOf, jni, obj, object_M)) {
+ if (jni->IsInstanceOf(obj, object_M)) {
if (lockSyncLock(jvmti)) {
waitedEventsCount++;
unlockSyncLock(jvmti);
@@ -118,7 +118,7 @@
}
/* check if event is for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
+ if (jni->IsSameObject(object_M, obj)) {
jvmtiMonitorUsage usageInfo;
if (lockSyncLock(jvmti)) {
@@ -126,12 +126,10 @@
unlockSyncLock(jvmti);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetObjectMonitorUsage,
- jvmti, obj, &usageInfo))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(obj, &usageInfo))) {
nsk_jvmti_setFailStatus();
} else if (usageInfo.owner != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- InterruptThread, jvmti, usageInfo.owner)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(usageInfo.owner)))
nsk_jvmti_setFailStatus();
}
}
@@ -151,7 +149,7 @@
}
/* check if event is for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
+ if (jni->IsSameObject(object_M, obj)) {
if (lockSyncLock(jvmti)) {
enteredEventsCount++;
unlockSyncLock(jvmti);
@@ -166,40 +164,35 @@
NSK_DISPLAY0("Obtain tested object from debugee thread class\n");
- if (!NSK_JNI_VERIFY(jni, (object_M =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, object_M)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)jni->NewGlobalRef(object_M)) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock)))
return NSK_FALSE;
/* enable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
nsk_jvmti_setFailStatus();
/* enable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
nsk_jvmti_setFailStatus();
/* enable MonitorContendedEnter event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
nsk_jvmti_setFailStatus();
/* enable MonitorContendedEntered event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -209,30 +202,27 @@
/* disable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
nsk_jvmti_setFailStatus();
/* disable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
nsk_jvmti_setFailStatus();
/* disable MonitorContendedEnter event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
nsk_jvmti_setFailStatus();
/* disable MonitorContendedEntered event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -336,7 +326,7 @@
caps.can_generate_monitor_events = 1;
caps.can_get_monitor_info = 1;
caps.can_signal_thread = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&callbacks, 0, sizeof(callbacks));
@@ -344,8 +334,7 @@
callbacks.MonitorWaited = &MonitorWaited;
callbacks.MonitorContendedEnter = &MonitorContendedEnter;
callbacks.MonitorContendedEntered = &MonitorContendedEntered;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -72,14 +72,12 @@
}
/* check if event is for tested thread and object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetThreadCpuTime, jvmti, thr, &waitThreadCpuTime))) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object_M, obj)) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thr, &waitThreadCpuTime))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, jvmti, &waitTime))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTime(&waitTime))) {
nsk_jvmti_setFailStatus();
}
waitEventsCount++;
@@ -113,14 +111,12 @@
}
/* check if event is for tested thread and object */
- if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
- NSK_CPP_STUB3(IsSameObject, jni, object_M, obj)) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
- GetThreadCpuTime, jvmti, thr, &waitedThreadCpuTime))) {
+ if (jni->IsSameObject(thread, thr) &&
+ jni->IsSameObject(object_M, obj)) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thr, &waitedThreadCpuTime))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetTime, jvmti, &waitedTime))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTime(&waitedTime))) {
nsk_jvmti_setFailStatus();
}
waitedEventsCount++;
@@ -149,8 +145,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -162,8 +157,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -174,15 +168,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -191,39 +183,32 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'M' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "M", FIELD_SIG)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (object_M =
- NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL))
return NSK_FALSE;
/* make object accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (object_M =
- NSK_CPP_STUB2(NewGlobalRef, jni, object_M)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL))
return NSK_FALSE;
/* enable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
return NSK_FALSE;
/* enable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -233,14 +218,12 @@
/* disable MonitorWait event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
nsk_jvmti_setFailStatus();
/* disable MonitorWaited event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
nsk_jvmti_setFailStatus();
return NSK_TRUE;
@@ -343,14 +326,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
caps.can_get_thread_cpu_time = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.MonitorWait = &MonitorWait;
callbacks.MonitorWaited = &MonitorWaited;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,12 +54,12 @@
static void
changeCount(jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
eventCount[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -92,9 +92,7 @@
char *generic;
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -107,7 +105,7 @@
className);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -125,13 +123,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -145,15 +141,12 @@
jvmtiPhase phase;
- if (!NSK_JNI_VERIFY(jni_env, (classObject =
- NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, classObject,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(classObject, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -166,7 +159,7 @@
className);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -184,13 +177,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -200,7 +191,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -221,7 +212,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -242,7 +233,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -257,8 +248,7 @@
currentPhase = JVMTI_PHASE_DEAD;
changeCount(JVMTI_EVENT_VM_DEATH);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -294,9 +284,7 @@
static int
enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
NSK_DISPLAY1("enabling %s\n", TranslateEvent(event));
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -369,10 +357,7 @@
eventCallbacks.ThreadStart = cbThreadStart;
eventCallbacks.ThreadEnd = cbThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -446,8 +431,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -65,22 +65,20 @@
jmethodID methodID;
jclass loadedClass;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, loader)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(loader)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
- if (!NSK_JNI_VERIFY(jni_env, (methodID =
- NSK_CPP_STUB4(GetMethodID, jni_env, klass, "loadClass",
- "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env,
+ (methodID = jni_env->GetMethodID(
+ klass, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
if (!NSK_JNI_VERIFY(jni_env, (loadedClass = (jclass)
- NSK_CPP_STUB4(CallObjectMethod, jni_env, loader, methodID,
- className)) != NULL)) {
+ jni_env->CallObjectMethod(loader, methodID, className)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
@@ -99,8 +97,7 @@
jfieldID fieldID;
if (!NSK_JNI_VERIFY(jni_env, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni_env, klass,
- "toProvokePreparation", "I")) != NULL)) {
+ jni_env->GetStaticFieldID(klass, "toProvokePreparation", "I")) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -119,20 +116,18 @@
jclass klass;
jmethodID methodID;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
if (!NSK_JNI_VERIFY(jni_env, (methodID =
- NSK_CPP_STUB4(GetMethodID, jni_env, klass, "start", "()V")) != NULL)) {
+ jni_env->GetMethodID(klass, "start", "()V")) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY_VOID(jni_env,
- NSK_CPP_STUB3(CallVoidMethod, jni_env, thread, methodID)) ) {
+ if (!NSK_JNI_VERIFY_VOID(jni_env,jni_env->CallVoidMethod(thread, methodID)) ) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -146,12 +141,12 @@
static void
changeCount(jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
eventCount[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -184,9 +179,7 @@
char *generic;
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -199,7 +192,7 @@
className);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -217,13 +210,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -237,15 +228,12 @@
jvmtiPhase phase;
- if (!NSK_JNI_VERIFY(jni_env, (classObject =
- NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, classObject,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(classObject, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -258,7 +246,7 @@
className);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -276,13 +264,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -292,7 +278,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -313,7 +299,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -334,7 +320,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -349,8 +335,7 @@
currentPhase = JVMTI_PHASE_DEAD;
changeCount(JVMTI_EVENT_VM_DEATH);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -393,9 +378,7 @@
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -468,10 +451,7 @@
eventCallbacks.ThreadStart = cbThreadStart;
eventCallbacks.ThreadEnd = cbThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -544,8 +524,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -68,8 +68,7 @@
int i;
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NULL;
if (!NSK_VERIFY(threads != NULL))
@@ -81,8 +80,7 @@
break;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
break;
/* find by name */
@@ -92,8 +90,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NULL;
return returnValue;
@@ -108,16 +105,14 @@
jfieldID fieldID;
jclass klass = NULL;
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(FindClass, jni, className)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(className)) != NULL))
return NULL;
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, klass, objFieldName,
- signature)) != NULL))
+ jni->GetStaticFieldID(klass, objFieldName, signature)) != NULL))
return NULL;
- return NSK_CPP_STUB3(GetStaticObjectField, jni, klass, fieldID);
+ return jni->GetStaticObjectField(klass, fieldID);
}
/* ============================================================================= */
@@ -130,8 +125,7 @@
}
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (mainThread =
- NSK_CPP_STUB2(NewGlobalRef, jni, mainThread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (mainThread = jni->NewGlobalRef(mainThread)) != NULL))
return NSK_FALSE;
if (!NSK_VERIFY((startObject =
@@ -140,8 +134,7 @@
return NSK_FALSE;
/*make object accessable for a long time*/
- if (!NSK_JNI_VERIFY(jni, (startObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, startObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (startObject = jni->NewGlobalRef(startObject)) != NULL))
return NSK_FALSE;
@@ -151,8 +144,7 @@
return NSK_FALSE;
/*make object accessable for a long time*/
- if (!NSK_JNI_VERIFY(jni, (endObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, endObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (endObject = jni->NewGlobalRef(endObject)) != NULL))
return NSK_FALSE;
@@ -162,8 +154,7 @@
return NSK_FALSE;
/* make thread accessable for a long time */
- if (!NSK_JNI_VERIFY(jni, (debuggeeThread =
- NSK_CPP_STUB2(NewGlobalRef, jni, debuggeeThread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debuggeeThread = jni->NewGlobalRef(debuggeeThread)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -176,15 +167,15 @@
/* disable MonitorContendedEnter event */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ jvmti->SetEventNotificationMode(
+ JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
nsk_jvmti_setFailStatus();
/* dispose global references */
- NSK_CPP_STUB2(DeleteGlobalRef, jni, startObject);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, endObject);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, debuggeeThread);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, mainThread);
+ jni->DeleteGlobalRef(startObject);
+ jni->DeleteGlobalRef(endObject);
+ jni->DeleteGlobalRef(debuggeeThread);
+ jni->DeleteGlobalRef(mainThread);
startObject = NULL;
endObject = NULL;
@@ -219,8 +210,7 @@
static void
showThreadInfo(jthread thread) {
jvmtiThreadInfo info;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info)))
return;
NSK_DISPLAY2("\tthread (%s): %p\n", info.name, thread);
@@ -231,12 +221,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -327,8 +317,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -420,13 +409,13 @@
return;
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni_env, expectedThread, thread) &&
- NSK_CPP_STUB3(IsSameObject, jni_env, expectedObject, object)) {
+ if (jni_env->IsSameObject(expectedThread, thread) &&
+ jni_env->IsSameObject(expectedObject, object)) {
NSK_DISPLAY1("--->%-40s is received\n", TranslateEvent(event));
showThreadInfo(thread);
- if (NSK_CPP_STUB3(IsSameObject, jni_env, expectedObject, endObject))
+ if (jni_env->IsSameObject(expectedObject, endObject))
NSK_DISPLAY0("\tobject: 'endingMonitor'\n");
else
NSK_DISPLAY0("\tobject: 'startingMonitor'\n");
@@ -506,13 +495,13 @@
return;
/* check if event is for tested thread and for tested object */
- if (NSK_CPP_STUB3(IsSameObject, jni_env, expectedThread, thread) &&
- NSK_CPP_STUB3(IsSameObject, jni_env, expectedObject, object)) {
+ if (jni_env->IsSameObject(expectedThread, thread) &&
+ jni_env->IsSameObject(expectedObject, object)) {
NSK_DISPLAY1("--->%-40s is received (new callbacks)\n", TranslateEvent(event));
showThreadInfo(thread);
- if (NSK_CPP_STUB3(IsSameObject, jni_env, expectedObject, endObject))
+ if (jni_env->IsSameObject(expectedObject, endObject))
NSK_DISPLAY0("\tobject: 'endingMonitor'\n");
else
NSK_DISPLAY0("\tobject: 'startingMonitor'\n");
@@ -572,16 +561,13 @@
&& (event != JVMTI_EVENT_MONITOR_WAIT)
&& (event != JVMTI_EVENT_MONITOR_WAITED)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -679,10 +665,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -771,8 +754,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -782,7 +764,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -150,12 +150,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -177,8 +177,7 @@
if (!checkEvents(STEP_AMOUNT))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -345,16 +344,13 @@
&& (event != JVMTI_EVENT_GARBAGE_COLLECTION_START)
&& (event != JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -450,10 +446,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -519,8 +512,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -530,7 +522,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -134,12 +134,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -159,8 +159,7 @@
if (!checkEvents(STEP_AMOUNT))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -265,9 +264,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -277,17 +274,14 @@
changeCount(event, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -338,9 +332,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -348,17 +340,14 @@
NSK_DISPLAY2("\tMethod: %s, signature: %s\n", name, sign);
changeCount(event, &newEventCount[0]);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -389,16 +378,13 @@
&& (event != JVMTI_EVENT_COMPILED_METHOD_LOAD)
&& (event != JVMTI_EVENT_COMPILED_METHOD_UNLOAD)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -498,10 +484,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -568,8 +551,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -579,7 +561,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -146,12 +146,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -171,8 +171,7 @@
if (!checkEvents(STEP_AMOUNT))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -310,7 +309,7 @@
char *genc;
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -318,9 +317,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
return;
}
@@ -331,17 +328,14 @@
changeCount(JVMTI_EVENT_NATIVE_METHOD_BIND, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -355,7 +349,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -363,9 +357,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
return;
}
@@ -376,17 +368,14 @@
changeCount(JVMTI_EVENT_NATIVE_METHOD_BIND, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -398,16 +387,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_NATIVE_METHOD_BIND)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -505,10 +491,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -574,8 +557,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -585,7 +567,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_native_method_bind_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -133,12 +133,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -158,8 +158,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -302,9 +301,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, object_klass,
- &sign_ptr, &gen_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &sign_ptr, &gen_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -313,7 +310,7 @@
changeCount(JVMTI_EVENT_VM_OBJECT_ALLOC, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -326,13 +323,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) {
nsk_jvmti_setFailStatus();
}
if (gen_ptr != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)gen_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) {
nsk_jvmti_setFailStatus();
}
}
@@ -346,9 +341,7 @@
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, object_klass,
- &sign_ptr, &gen_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &sign_ptr, &gen_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -357,7 +350,7 @@
changeCount(JVMTI_EVENT_VM_OBJECT_ALLOC, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
}
@@ -370,13 +363,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) {
nsk_jvmti_setFailStatus();
}
if (gen_ptr != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)gen_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) {
nsk_jvmti_setFailStatus();
}
}
@@ -388,16 +379,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_VM_OBJECT_ALLOC)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -490,10 +478,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -553,8 +538,7 @@
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -564,7 +548,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -73,8 +73,7 @@
return;
}
- jclassName = (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass,
- methodID);
+ jclassName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass, methodID);
className = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jclassName, 0);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -60,8 +60,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -73,8 +72,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -90,8 +88,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (threadForStop == NULL) {
@@ -106,17 +103,14 @@
NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n");
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, THREAD_DEATH_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (ctor =
- NSK_CPP_STUB4(GetMethodID, jni, cls,
- THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
+ jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (threadDeath =
- NSK_CPP_STUB3(NewObject, jni, cls, ctor)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -140,8 +134,7 @@
if (!NSK_VERIFY(threadForStop != NULL)) {
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(StopThread, jvmti, threadForStop, threadDeath)))
+ if (!NSK_JVMTI_VERIFY(jvmti->StopThread(threadForStop, threadDeath)))
nsk_jvmti_setFailStatus();
}
@@ -149,8 +142,7 @@
if (!NSK_VERIFY(threadForInterrupt != NULL)) {
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(InterruptThread, jvmti, threadForInterrupt)))
+ if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(threadForInterrupt)))
nsk_jvmti_setFailStatus();
}
@@ -199,7 +191,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_signal_thread = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,14 +56,12 @@
jclass klass = NULL;
char *signature = NULL;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -75,7 +73,7 @@
NSK_DISPLAY1("Exception event: %s\n", signature);
- if (NSK_CPP_STUB3(IsSameObject, jni_env, threadForInterrupt, thread)) {
+ if (jni_env->IsSameObject(threadForInterrupt, thread)) {
if (strcmp(signature, INTERRUPTED_EXCEPTION_CLASS_SIG) == 0) {
InterruptedExceptionFlag++;
} else {
@@ -83,7 +81,7 @@
signature);
nsk_jvmti_setFailStatus();
}
- } else if (NSK_CPP_STUB3(IsSameObject, jni_env, threadForStop, thread)) {
+ } else if (jni_env->IsSameObject(threadForStop, thread)) {
if (strcmp(signature, THREAD_DEATH_CLASS_SIG) == 0) {
ThreadDeathFlag++;
} else {
@@ -93,7 +91,7 @@
}
}
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -109,8 +107,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -122,8 +119,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -139,8 +135,7 @@
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (threadForStop == NULL) {
@@ -153,17 +148,14 @@
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY(jni, (threadForStop =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadForStop)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadForStop = jni->NewGlobalRef(threadForStop)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (threadForInterrupt =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadForInterrupt)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadForInterrupt = jni->NewGlobalRef(threadForInterrupt)) != NULL))
return NSK_FALSE;
/* enable event */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -199,12 +191,11 @@
nsk_jvmti_setFailStatus();
/* disable event */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadForStop));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadForInterrupt));
+ NSK_TRACE(jni->DeleteGlobalRef(threadForStop));
+ NSK_TRACE(jni->DeleteGlobalRef(threadForInterrupt));
if (!nsk_jvmti_resumeSync())
return;
@@ -245,7 +236,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_exception_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -58,19 +58,17 @@
ExceptionEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Exception event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
void JNICALL
@@ -85,19 +83,17 @@
ExceptionCatchEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("ExceptionCatch event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -109,11 +105,9 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
nsk_jvmti_setFailStatus();
/* resume debugee and wait for sync */
@@ -122,11 +116,9 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Exception events received: %d\n",
@@ -178,7 +170,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_exception_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,19 +54,17 @@
ExceptionEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("Exception event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
void JNICALL
@@ -77,19 +75,17 @@
ExceptionCatchEventsCount++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1("ExceptionCatch event: %s\n", signature);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -156,7 +152,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_exception_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,16 +54,15 @@
char *signature = NULL;
MethodEntryEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -78,8 +77,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -91,8 +89,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -103,13 +100,11 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
return NSK_TRUE;
@@ -129,8 +124,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread)))
nsk_jvmti_setFailStatus();
/* resume debugee and wait for sync */
@@ -144,7 +138,7 @@
if (!NSK_VERIFY(MethodEntryEventsCount != 0))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
if (!nsk_jvmti_resumeSync())
return;
@@ -185,7 +179,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_method_entry_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -51,16 +51,15 @@
char *signature = NULL;
MethodEntryEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -122,7 +121,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_method_entry_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -55,16 +55,15 @@
char *signature = NULL;
MethodExitEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -79,8 +78,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -92,8 +90,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -104,13 +101,11 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
return NSK_TRUE;
@@ -130,8 +125,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, thread)))
nsk_jvmti_setFailStatus();
/* resume debugee and wait for sync */
@@ -145,7 +139,7 @@
if (!NSK_VERIFY(MethodExitEventsCount != 0))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
if (!nsk_jvmti_resumeSync())
return;
@@ -186,7 +180,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_method_exit_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,16 +52,15 @@
char *signature = NULL;
MethodExitEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -123,7 +122,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_method_exit_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -56,20 +56,18 @@
SingleStepEventsCount++;
- NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
+ NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature,
jlong_to_string(location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -84,8 +82,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -97,8 +94,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -109,13 +105,11 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
return NSK_TRUE;
@@ -135,8 +129,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thread)))
nsk_jvmti_setFailStatus();
/* resume debugee and wait for sync */
@@ -150,7 +143,7 @@
if (!NSK_VERIFY(SingleStepEventsCount != 0))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
if (!nsk_jvmti_resumeSync())
return;
@@ -191,7 +184,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_single_step_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -53,20 +53,18 @@
SingleStepEventsCount++;
- NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
+ NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature,
jlong_to_string(location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -128,7 +126,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_single_step_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,14 +52,13 @@
VMObjectAllocEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- object_klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -115,7 +114,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -124,8 +123,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -52,14 +52,13 @@
VMObjectAllocEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- object_klass, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -115,7 +114,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_vm_object_alloc_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,17 +54,16 @@
CompiledMethodLoadEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n",
name, signature, code_addr);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -81,8 +80,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
@@ -148,7 +147,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -158,11 +157,9 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -54,17 +54,16 @@
CompiledMethodLoadEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n",
name, signature, code_addr);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
static void JNICALL
@@ -82,8 +81,8 @@
if (err == JVMTI_ERROR_NONE) {
NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
name, sig, code_addr);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+ jvmti_env->Deallocate((unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)sig);
}
}
@@ -145,7 +144,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -115,7 +115,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -125,11 +125,9 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -115,7 +115,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_garbage_collection_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -55,8 +55,7 @@
MonitorContendedEnterEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -72,8 +71,7 @@
MonitorContendedEnteredEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -89,8 +87,7 @@
MonitorWaitEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -106,8 +103,7 @@
MonitorWaitedEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -189,7 +185,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -202,17 +198,13 @@
return JNI_ERR;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -55,8 +55,7 @@
MonitorContendedEnterEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -72,8 +71,7 @@
MonitorContendedEnteredEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -89,8 +87,7 @@
MonitorWaitEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -106,8 +103,7 @@
MonitorWaitedEventsCount++;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo, jvmti_env,
- thread, &info))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -189,7 +185,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_monitor_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -121,37 +121,35 @@
jsize i;
/* find debugee class */
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
/* find static field with threads array */
if (!NSK_JNI_VERIFY(jni, (threadsFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
+ jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
return NSK_FALSE;
/* get threads array from static field */
if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadsFieldID)) != NULL))
+ jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL))
return NSK_FALSE;
/* check array length */
if (!NSK_JNI_VERIFY(jni, (threadsArrayLength =
- NSK_CPP_STUB2(GetArrayLength, jni, threadsArray)) == THREADS_COUNT))
+ jni->GetArrayLength(threadsArray)) == THREADS_COUNT))
return NSK_FALSE;
/* get each thread from array */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB3(GetObjectArrayElement, jni, threadsArray, i)) != NULL))
+ jni->GetObjectArrayElement(threadsArray, i)) != NULL))
return NSK_FALSE;
}
/* make global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+ jni->NewGlobalRef(threadsList[i])) != NULL))
return NSK_FALSE;
}
@@ -174,8 +172,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsName[i]);
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i], &state))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -233,7 +230,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -155,8 +155,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -170,8 +169,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -189,8 +187,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -208,8 +205,7 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
- if (!NSK_JNI_VERIFY(jni, (threadsList[i] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL))
return NSK_FALSE;
}
@@ -225,13 +221,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i])))
nsk_jvmti_setFailStatus();
}
}
@@ -260,8 +254,7 @@
/* wait for WAITTIME for thread to reach expected state */
do {
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i], &state))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -371,7 +364,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
@@ -449,8 +442,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -155,8 +155,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -170,8 +169,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -189,8 +187,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -208,8 +205,7 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
- if (!NSK_JNI_VERIFY(jni, (threadsList[i] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL))
return NSK_FALSE;
}
@@ -226,14 +222,10 @@
/* suspend or resume threads list */
if (suspend) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, THREADS_COUNT,
- threadsList, results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(THREADS_COUNT, threadsList, results)))
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, THREADS_COUNT,
- threadsList, results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(THREADS_COUNT, threadsList, results)))
nsk_jvmti_setFailStatus();
}
@@ -273,8 +265,7 @@
/* wait for WAITTIME for thread to reach expected state */
do {
/* get thread status */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i], &state))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -384,7 +375,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
@@ -462,8 +453,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -136,8 +136,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -151,8 +150,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -170,8 +168,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -190,7 +187,7 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
}
@@ -206,13 +203,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -241,9 +236,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -252,8 +245,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -294,7 +286,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
}
return NSK_TRUE;
@@ -372,8 +364,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -158,8 +158,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -173,8 +172,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -192,8 +190,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -214,12 +211,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
/* get thread class */
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
- NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
+ jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
/* get frame method */
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
- threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n",
@@ -231,10 +227,10 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
@@ -250,13 +246,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -285,9 +279,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -296,8 +288,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -357,8 +348,8 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
@@ -436,8 +427,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -159,8 +159,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -174,8 +173,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -193,8 +191,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -215,12 +212,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
/* get thread class */
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
- NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
+ jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
/* get frame method */
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
- threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n",
@@ -232,10 +228,10 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
@@ -251,13 +247,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -288,9 +282,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -298,8 +290,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -319,8 +310,7 @@
(long)frameStack[j].location);
/* query frame location */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(GetFrameLocation, jvmti, threadsDesc[i].thread,
- j, &qMethod, &qLocation))) {
+ jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -375,8 +365,8 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
@@ -453,8 +443,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -158,9 +158,8 @@
threadsCounts[i] = 0;
threadsList[i] = NULL;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread),
+ (unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
@@ -169,8 +168,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -184,8 +182,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -202,8 +199,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -226,7 +222,7 @@
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i][j])) != NULL))
+ jni->NewGlobalRef(threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
@@ -244,8 +240,7 @@
int i, j;
/* allocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, resultsSize, (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -253,14 +248,10 @@
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
@@ -277,8 +268,7 @@
}
/* deallocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
@@ -295,13 +285,11 @@
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
@@ -329,8 +317,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i][j], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -373,14 +360,13 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i][j]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
@@ -465,8 +451,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -161,9 +161,8 @@
threadsCounts[i] = 0;
threadsList[i] = NULL;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread),
+ (unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
@@ -172,8 +171,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -187,8 +185,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -205,8 +202,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -229,7 +225,7 @@
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i][j])) != NULL))
+ jni->NewGlobalRef(threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
@@ -247,8 +243,7 @@
int i, j;
/* allocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, resultsSize, (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -256,14 +251,10 @@
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
@@ -280,8 +271,7 @@
}
/* deallocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
@@ -298,13 +288,11 @@
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
@@ -332,8 +320,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i][j], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -376,14 +363,13 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i][j]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
@@ -468,8 +454,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -158,9 +158,8 @@
threadsCounts[i] = 0;
threadsList[i] = NULL;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread),
+ (unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
@@ -169,8 +168,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -184,8 +182,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -202,8 +199,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -226,7 +222,7 @@
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i][j])) != NULL))
+ jni->NewGlobalRef(threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
@@ -244,8 +240,7 @@
int i, j;
/* allocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, resultsSize, (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -253,14 +248,10 @@
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
@@ -277,8 +268,7 @@
}
/* deallocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
@@ -295,13 +285,11 @@
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
@@ -329,8 +317,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i][j], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -373,14 +360,13 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i][j]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
@@ -465,8 +451,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -158,9 +158,8 @@
threadsCounts[i] = 0;
threadsList[i] = NULL;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
- (unsigned char**)&threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread),
+ (unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
@@ -169,8 +168,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -184,8 +182,7 @@
return NSK_FALSE;
/* get thread name (info) */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
@@ -202,8 +199,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -226,7 +222,7 @@
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i][j])) != NULL))
+ jni->NewGlobalRef(threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
@@ -244,8 +240,7 @@
int i, j;
/* allocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, resultsSize, (unsigned char**)&results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -253,14 +248,10 @@
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount,
- threadsList[i], results)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
@@ -277,8 +268,7 @@
}
/* deallocate results array */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
@@ -295,13 +285,11 @@
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i][j])))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
@@ -329,8 +317,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i][j], &state))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -373,14 +360,13 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i][j]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threadsList[i])))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
@@ -465,8 +451,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -143,9 +143,7 @@
int i;
for (i = 0; i < EVENTS_COUNT; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- eventsList[i], NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -168,37 +166,35 @@
jsize i;
/* find debugee class */
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
/* find static field with threads array */
if (!NSK_JNI_VERIFY(jni, (threadsFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
+ jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
return NSK_FALSE;
/* get threads array from static field */
if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadsFieldID)) != NULL))
+ jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL))
return NSK_FALSE;
/* check array length */
if (!NSK_JNI_VERIFY(jni, (threadsArrayLength =
- NSK_CPP_STUB2(GetArrayLength, jni, threadsArray)) == THREADS_COUNT))
+ jni->GetArrayLength(threadsArray)) == THREADS_COUNT))
return NSK_FALSE;
/* get each thread from array */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB3(GetObjectArrayElement, jni, threadsArray, i)) != NULL))
+ jni->GetObjectArrayElement(threadsArray, i)) != NULL))
return NSK_FALSE;
}
/* make global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+ jni->NewGlobalRef(threadsList[i])) != NULL))
return NSK_FALSE;
}
@@ -218,8 +214,7 @@
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, threadsName[i], (void*)thread);
/* get frames count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti, thread, &framesCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(thread, &framesCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -227,8 +222,7 @@
/* get stack frames */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH,
- stackFrames, &stackDepth))) {
+ jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, stackFrames, &stackDepth))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -269,7 +263,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
@@ -293,7 +287,7 @@
/* check if event is for tested thread */
for (i = 0; i < THREADS_COUNT; i++) {
- if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+ if (jni->IsSameObject(threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
eventsStart++;
@@ -320,7 +314,7 @@
/* check if event is for tested thread */
for (i = 0; i < THREADS_COUNT; i++) {
- if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+ if (jni->IsSameObject(threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
eventsEnd++;
@@ -403,9 +397,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -100,8 +100,7 @@
{
eventsStart = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_THREAD_START, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -122,8 +121,7 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_THREAD_START, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL))) {
nsk_jvmti_setFailStatus();
}
@@ -152,8 +150,7 @@
{
eventsEnd = 0;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
- JVMTI_EVENT_THREAD_END, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -174,8 +171,7 @@
}
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
- JVMTI_EVENT_THREAD_END, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL))) {
nsk_jvmti_setFailStatus();
}
@@ -221,8 +217,7 @@
int i;
for (i = 0; i < THREADS_COUNT; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i]))) {
nsk_jvmti_setFailStatus();
}
}
@@ -243,37 +238,35 @@
jsize i;
/* find debugee class */
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
/* find static field with threads array */
if (!NSK_JNI_VERIFY(jni, (threadsFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
+ jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
return NSK_FALSE;
/* get threads array from static field */
if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadsFieldID)) != NULL))
+ jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL))
return NSK_FALSE;
/* check array length */
if (!NSK_JNI_VERIFY(jni, (threadsArrayLength =
- NSK_CPP_STUB2(GetArrayLength, jni, threadsArray)) == THREADS_COUNT))
+ jni->GetArrayLength(threadsArray)) == THREADS_COUNT))
return NSK_FALSE;
/* get each thread from array */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB3(GetObjectArrayElement, jni, threadsArray, i)) != NULL))
+ jni->GetObjectArrayElement(threadsArray, i)) != NULL))
return NSK_FALSE;
}
/* make global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+ jni->NewGlobalRef(threadsList[i])) != NULL))
return NSK_FALSE;
}
@@ -293,8 +286,7 @@
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, threadsName[i], (void*)thread);
/* get frames count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti, thread, &framesCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(thread, &framesCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -302,8 +294,7 @@
/* get stack frames */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH,
- stackFrames, &stackDepth))) {
+ jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, stackFrames, &stackDepth))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -355,7 +346,7 @@
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
@@ -379,15 +370,14 @@
/* check if event is for tested thread */
for (i = 0; i < THREADS_COUNT; i++) {
- if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+ if (jni->IsSameObject(threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
/* suspend thread */
NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n",
i, threadsName[i], (void*)thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -414,15 +404,14 @@
/* check if event is for tested thread */
for (i = 0; i < THREADS_COUNT; i++) {
- if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+ if (jni->IsSameObject(threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n");
/* suspend thread */
NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n",
i, threadsName[i], (void*)thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -504,8 +493,7 @@
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
@@ -515,9 +503,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ThreadStart = callbackThreadStart;
eventCallbacks.ThreadEnd = callbackThreadEnd;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -135,8 +135,7 @@
* Generate missed events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -168,8 +167,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -182,8 +180,7 @@
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
if (threadInfo.name != NULL) {
@@ -200,8 +197,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -222,12 +218,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
- NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
+ jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
- threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n",
@@ -239,10 +234,10 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
@@ -262,13 +257,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -300,9 +293,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -311,8 +302,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -358,8 +348,8 @@
NSK_DISPLAY0("Dispose global references to threads\n");
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
@@ -492,8 +482,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -502,9 +491,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -143,8 +143,7 @@
* Generate missed events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,8 +176,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -191,8 +189,7 @@
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
if (threadInfo.name != NULL) {
@@ -209,8 +206,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -231,12 +227,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
- NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
+ jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
- threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n",
@@ -248,10 +243,10 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
@@ -271,13 +266,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -310,9 +303,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -321,8 +312,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -387,8 +377,8 @@
NSK_DISPLAY0("Dispose global references to threads\n");
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
@@ -521,8 +511,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -531,9 +520,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -143,8 +143,7 @@
* Generate missed events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -177,8 +176,7 @@
}
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
@@ -191,8 +189,7 @@
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
if (threadInfo.name != NULL) {
@@ -209,8 +206,7 @@
}
/* deallocate all threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
@@ -231,12 +227,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
- NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
+ jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
- threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n",
@@ -248,10 +243,10 @@
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
+ jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
@@ -271,13 +266,11 @@
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
@@ -312,9 +305,7 @@
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetFrameCount, jvmti,
- threadsDesc[i].thread, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -322,8 +313,7 @@
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
- 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
+ jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
@@ -343,8 +333,7 @@
(long)frameStack[j].location);
/* query frame location */
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(GetFrameLocation, jvmti, threadsDesc[i].thread,
- j, &qMethod, &qLocation))) {
+ jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -404,8 +393,8 @@
NSK_DISPLAY0("Dispose global references to threads\n");
for (i = 0; i < THREADS_COUNT; i++) {
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
+ NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
@@ -538,8 +527,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -548,9 +536,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -62,8 +62,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -75,8 +74,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -87,15 +85,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -103,8 +99,7 @@
return NSK_FALSE;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "waitLock", &waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("waitLock", &waitLock)))
return NSK_FALSE;
return NSK_TRUE;
@@ -114,14 +109,13 @@
static int wait_for(jvmtiEnv* jvmti, jlong millis) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(waitLock)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, waitLock, millis)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(waitLock, millis)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(waitLock)))
return NSK_FALSE;
return NSK_TRUE;
@@ -132,27 +126,25 @@
char *name = NULL;
char *signature = NULL;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_DISPLAY4(" got[%d] method: %s%s, location: %s\n", i, name,
signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- sampleStack[i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_DISPLAY4(" exp[%d] method: %s%s, location: %s\n", i, name,
signature, jlong_to_string(sampleStack[i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
return NSK_TRUE;
}
@@ -162,27 +154,25 @@
char *name = NULL;
char *signature = NULL;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_COMPLAIN3(" got: method=%s%s, location=%s\n", name, signature,
jlong_to_string(frameBuffer[frameCount-1-i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- sampleStack[i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_COMPLAIN3(" expected: method=%s%s, location=%s\n", name, signature,
jlong_to_string(sampleStack[i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
return NSK_TRUE;
}
@@ -193,13 +183,11 @@
int displayFlag =
(nsk_getVerboseMode() && (sampleCount % DISPLAYING_FREQUENCY) == 0);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(frameLock)))
return NSK_FALSE;
/* get stack trace */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, thread,
- 0, MAX_DEPTH, frameBuffer, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetStackTrace(thread, 0, MAX_DEPTH, frameBuffer, &frameCount))) {
res = NSK_FALSE;
} else {
if (displayFlag) {
@@ -228,7 +216,7 @@
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(frameLock)))
return NSK_FALSE;
return res;
@@ -278,49 +266,45 @@
return 0;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(frameLock)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetFrameLocation, jvmti, NULL, 1,
- &sampleStack[depth].method, &sampleStack[depth].location))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 1, &sampleStack[depth].method, &sampleStack[depth].location))) {
nsk_jvmti_setFailStatus();
return 0;
}
depth++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetFrameLocation, jvmti, NULL, 0,
- &sampleStack[depth].method, &sampleStack[depth].location))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 0, &sampleStack[depth].method, &sampleStack[depth].location))) {
nsk_jvmti_setFailStatus();
return 0;
}
depth++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(frameLock)))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (klass = NSK_CPP_STUB2(GetObjectClass,
- jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return 0;
}
- if (!NSK_JNI_VERIFY(jni, (method = NSK_CPP_STUB4(GetMethodID,
- jni, klass, "fibonacci", "(I)I")) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "fibonacci", "(I)I")) != NULL)) {
nsk_jvmti_setFailStatus();
return 0;
}
- result = NSK_CPP_STUB4(CallIntMethod, jni, obj, method, i);
+ result = jni->CallIntMethod(obj, method, i);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(frameLock)))
return NSK_FALSE;
depth--;
depth--;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(frameLock)))
return NSK_FALSE;
return result;
@@ -355,8 +339,7 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "frameLock", &frameLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("frameLock", &frameLock)))
return NSK_FALSE;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -66,8 +66,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -79,8 +78,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -91,15 +89,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -108,41 +104,34 @@
}
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread field 'MAX_LADDER' */
- if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, klass,
- "MAX_LADDER", "I")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (fid = jni->GetStaticFieldID(klass, "MAX_LADDER", "I")) != NULL))
return NSK_FALSE;
- MAX_LADDER = NSK_CPP_STUB3(GetStaticIntField, jni, klass, fid);
+ MAX_LADDER = jni->GetStaticIntField(klass, fid);
NSK_DISPLAY1("MAX_LADDER: %d\n", MAX_LADDER);
/* get tested thread field 'depth' */
- if (!NSK_JNI_VERIFY(jni, (field =
- NSK_CPP_STUB4(GetFieldID, jni, klass, "depth", "I")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "depth", "I")) != NULL))
return NSK_FALSE;
/* get tested thread method 'run' */
- if (!NSK_JNI_VERIFY(jni, (methodRun =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "run", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (methodRun = jni->GetMethodID(klass, "run", "()V")) != NULL))
return NSK_FALSE;
/* get tested thread method 'catcher' */
if (!NSK_JNI_VERIFY(jni, (methodCatcher =
- NSK_CPP_STUB4(GetMethodID, jni, klass, "catcher", "(II)V")) != NULL))
+ jni->GetMethodID(klass, "catcher", "(II)V")) != NULL))
return NSK_FALSE;
/* get tested thread method 'thrower' */
- if (!NSK_JNI_VERIFY(jni, (methodThrower=
- NSK_CPP_STUB4(GetMethodID, jni, klass, "thrower", "(I)V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (methodThrower= jni->GetMethodID(klass, "thrower", "(I)V")) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "waitLock", &waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("waitLock", &waitLock)))
return NSK_FALSE;
return NSK_TRUE;
@@ -152,14 +141,13 @@
static int wait_for(jvmtiEnv* jvmti, jlong millis) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(waitLock)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, waitLock, millis)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(waitLock, millis)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, waitLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(waitLock)))
return NSK_FALSE;
return NSK_TRUE;
@@ -170,16 +158,15 @@
char *name = NULL;
char *signature = NULL;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_DISPLAY4(" [%d] method: %s%s, location: %s\n", i, name,
signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
return NSK_TRUE;
}
@@ -189,19 +176,17 @@
char *name = NULL;
char *signature = NULL;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_COMPLAIN3(" got method: %s%s, location: %s\n", name, signature,
jlong_to_string(frameBuffer[frameCount-1-i].location, buffer));
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name);
+ jvmti->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+ jvmti->Deallocate((unsigned char*)signature);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, jvmti,
- method, &name, &signature, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &signature, NULL)))
return NSK_FALSE;
NSK_COMPLAIN2(" expected method: %s%s\n", name, signature);
@@ -217,19 +202,17 @@
int displayFlag =
(nsk_getVerboseMode() && (sampleCount % DISPLAYING_FREQUENCY) == 0);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SuspendThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread)))
return NSK_FALSE;
- depth = NSK_CPP_STUB3(GetIntField, jni, thread, field);
+ depth = jni->GetIntField(thread, field);
/* get stack trace */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB6(GetStackTrace, jvmti, thread,
- 0, MAX_DEPTH, frameBuffer, &frameCount))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetStackTrace(thread, 0, MAX_DEPTH, frameBuffer, &frameCount))) {
res = NSK_FALSE;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread)))
res = NSK_FALSE;
if (res) {
@@ -322,7 +305,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jboolean JNICALL Java_nsk_share_gc_lock_jni_BooleanArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jbooleanArray arr;
jboolean *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return JNI_FALSE;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return JNI_FALSE;
- }
}
arr = (jbooleanArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -34,7 +35,9 @@
* Method: criticalNative
*/
JNIEXPORT jbyte JNICALL Java_nsk_share_gc_lock_jni_ByteArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jbyteArray arr;
jbyte *pa;
@@ -43,22 +46,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jbyteArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return 0;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_CharArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jcharArray arr;
jchar *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jcharArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
current_time = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jdouble JNICALL Java_nsk_share_gc_lock_jni_DoubleArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jdoubleArray arr;
jdouble *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jdoubleArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jfloat JNICALL Java_nsk_share_gc_lock_jni_FloatArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jfloatArray arr;
jfloat *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jfloatArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jint JNICALL Java_nsk_share_gc_lock_jni_IntArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jintArray arr;
jint *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jintArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jlong JNICALL Java_nsk_share_gc_lock_jni_LongArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jlongArray arr;
jlong *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jlongArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jshort JNICALL Java_nsk_share_gc_lock_jni_ShortArrayCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jshortArray arr;
jshort *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return 0;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return 0;
- }
}
arr = (jshortArray) env->GetObjectField(o, objFieldId);
- if (arr == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetArrayLength(arr);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,7 +36,9 @@
* Signature: ([Z)Z
*/
JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_StringCriticalLocker_criticalNative
-(JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+(JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jsize size, i;
jstring str;
const jchar *pa;
@@ -44,22 +47,11 @@
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return JNI_FALSE;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return JNI_FALSE;
- }
}
str = (jstring) env->GetObjectField(o, objFieldId);
- if (str == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return JNI_FALSE;
- }
env->SetObjectField(o, objFieldId, NULL);
+
size = env->GetStringLength(str);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libBooleanArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libBooleanArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -22,5 +22,6 @@
*/
#include "BooleanArrayCriticalLocker.cpp"
+#include "ExceptionCheckingJniEnv.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libByteArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libByteArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -22,5 +22,6 @@
*/
#include "ByteArrayCriticalLocker.cpp"
+#include "ExceptionCheckingJniEnv.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libCharArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libCharArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -22,5 +22,6 @@
*/
#include "CharArrayCriticalLocker.cpp"
+#include "ExceptionCheckingJniEnv.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libDoubleArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libDoubleArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -22,5 +22,6 @@
*/
#include "DoubleArrayCriticalLocker.cpp"
+#include "ExceptionCheckingJniEnv.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libFloatArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libFloatArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "FloatArrayCriticalLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libIntArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libIntArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "IntArrayCriticalLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libLongArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libLongArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "LongArrayCriticalLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libShortArrayCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libShortArrayCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "ShortArrayCriticalLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libStringCriticalLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/libStringCriticalLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "StringCriticalLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -20,9 +20,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,28 +37,18 @@
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIGlobalRefLocker_criticalNative
- (JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+ (JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jobject obj;
jobject gref;
time_t start_time, current_time;
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return;
- }
}
obj = env->GetObjectField(o, objFieldId);
- if (obj == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return;
- }
env->SetObjectField(o, objFieldId, NULL);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,28 +36,18 @@
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNILocalRefLocker_criticalNative
- (JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+ (JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jobject obj;
jobject gref;
time_t start_time, current_time;
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return;
- }
}
obj = env->GetObjectField(o, objFieldId);
- if (obj == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return;
- }
env->SetObjectField(o, objFieldId, NULL);
start_time = time(NULL);
enterTime /= 1000;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,29 +36,21 @@
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIRefLocker_criticalNative
- (JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+ (JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jobject obj;
jobject gref, lref, gwref;
time_t start_time, current_time;
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return;
- }
}
+
obj = env->GetObjectField(o, objFieldId);
- if (obj == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return;
- }
env->SetObjectField(o, objFieldId, NULL);
+
start_time = time(NULL);
enterTime /= 1000;
current_time = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -23,6 +23,7 @@
#include <jni.h>
#include <stdio.h>
#include <time.h>
+#include "ExceptionCheckingJniEnv.hpp"
#include "jni_tools.h"
extern "C" {
@@ -35,29 +36,20 @@
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker_criticalNative
- (JNIEnv *env, jobject o, jlong enterTime, jlong sleepTime) {
+ (JNIEnv *jni_env, jobject o, jlong enterTime, jlong sleepTime) {
+ ExceptionCheckingJniEnvPtr env(jni_env);
+
jobject obj;
jobject gref;
time_t start_time, current_time;
if (objFieldId == NULL) {
jclass klass = env->GetObjectClass(o);
- if (klass == NULL) {
- printf("Error: GetObjectClass returned NULL\n");
- return;
- }
objFieldId = env->GetFieldID(klass, "obj", "Ljava/lang/Object;");
- if (objFieldId == NULL) {
- printf("Error: GetFieldID returned NULL\n");
- return;
- }
}
obj = env->GetObjectField(o, objFieldId);
- if (obj == NULL) {
- printf("Error: GetObjectField returned NULL\n");
- return;
- }
env->SetObjectField(o, objFieldId, NULL);
+
start_time = time(NULL);
enterTime /= 1000;
current_time = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIGlobalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIGlobalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "JNIGlobalRefLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNILocalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNILocalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "JNILocalRefLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "JNIRefLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIWeakGlobalRefLocker.cpp Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/libJNIWeakGlobalRefLocker.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -21,6 +21,7 @@
* questions.
*/
+#include "ExceptionCheckingJniEnv.cpp"
#include "JNIWeakGlobalRefLocker.cpp"
#include "jni_tools.cpp"
#include "nsk_tools.cpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Google 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.
+ */
+
+#include <stdlib.h>
+
+#include "ExceptionCheckingJniEnv.hpp"
+
+namespace {
+
+template<class T = void*>
+class JNIVerifier {
+ public:
+ JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_msg)
+ : _env(env), _base_msg(base_msg), _return_error(NULL) {
+ }
+
+ ~JNIVerifier() {
+ JNIEnv* jni_env = _env->GetJNIEnv();
+ if (jni_env->ExceptionCheck()) {
+ _env->HandleError(_base_msg);
+ return;
+ }
+
+ if (_return_error != NULL) {
+ ProcessReturnError();
+ }
+ }
+
+ void ProcessReturnError() {
+ int len = snprintf(NULL, 0, "%s : %s", _base_msg, _return_error) + 1;
+
+ if (len <= 0) {
+ _env->HandleError(_return_error);
+ return;
+ }
+
+ char* full_message = (char*) malloc(len);
+ if (full_message == NULL) {
+ _env->HandleError(_return_error);
+ return;
+ }
+
+ snprintf(full_message, len, "%s : %s", _base_msg, _return_error);
+
+ _env->HandleError(full_message);
+ free(full_message);
+ }
+
+ T ResultNotNull(T ptr) {
+ if (ptr == NULL) {
+ _return_error = "Return is NULL";
+ }
+ return ptr;
+ }
+
+ private:
+ ExceptionCheckingJniEnv* _env;
+ const char* const _base_msg;
+ const char* _return_error;
+};
+
+}
+
+jclass ExceptionCheckingJniEnv::GetObjectClass(jobject obj) {
+ JNIVerifier<jclass> marker(this, "GetObjectClass");
+ return marker.ResultNotNull(_jni_env->GetObjectClass(obj));
+}
+
+jfieldID ExceptionCheckingJniEnv::GetFieldID(jclass klass, const char *name, const char* type) {
+ JNIVerifier<jfieldID> marker(this, "GetFieldID");
+ return marker.ResultNotNull(_jni_env->GetFieldID(klass, name, type));
+}
+
+jobject ExceptionCheckingJniEnv::GetObjectField(jobject obj, jfieldID field) {
+ JNIVerifier<jobject> marker(this, "GetObjectField");
+ return marker.ResultNotNull(_jni_env->GetObjectField(obj, field));
+}
+
+void ExceptionCheckingJniEnv::SetObjectField(jobject obj, jfieldID field, jobject value) {
+ JNIVerifier<> marker(this, "SetObjectField");
+ _jni_env->SetObjectField(obj, field, value);
+}
+
+jobject ExceptionCheckingJniEnv::NewGlobalRef(jobject obj) {
+ JNIVerifier<jobject> marker(this, "NewGlobalRef");
+ return marker.ResultNotNull(_jni_env->NewGlobalRef(obj));
+}
+
+void ExceptionCheckingJniEnv::DeleteGlobalRef(jobject obj) {
+ JNIVerifier<> marker(this, "DeleteGlobalRef");
+ _jni_env->DeleteGlobalRef(obj);
+}
+
+jobject ExceptionCheckingJniEnv::NewLocalRef(jobject obj) {
+ JNIVerifier<jobject> marker(this, "NewLocalRef");
+ return marker.ResultNotNull(_jni_env->NewLocalRef(obj));
+}
+
+void ExceptionCheckingJniEnv::DeleteLocalRef(jobject obj) {
+ JNIVerifier<> marker(this, "DeleteLocalRef");
+ _jni_env->DeleteLocalRef(obj);
+}
+
+jweak ExceptionCheckingJniEnv::NewWeakGlobalRef(jobject obj) {
+ JNIVerifier<jweak> marker(this, "NewWeakGlobalRef");
+ return marker.ResultNotNull(_jni_env->NewWeakGlobalRef(obj));
+}
+
+void ExceptionCheckingJniEnv::DeleteWeakGlobalRef(jweak weak_ref) {
+ JNIVerifier<> marker(this, "DeleteWeakGlobalRef");
+ _jni_env->DeleteWeakGlobalRef(weak_ref);
+}
+
+jsize ExceptionCheckingJniEnv::GetArrayLength(jarray array) {
+ JNIVerifier<> marker(this, "GetArrayLength");
+ return _jni_env->GetArrayLength(array);
+}
+
+jsize ExceptionCheckingJniEnv::GetStringLength(jstring str) {
+ JNIVerifier<> marker(this, "GetStringLength");
+ return _jni_env->GetStringLength(str);
+}
+
+void* ExceptionCheckingJniEnv::GetPrimitiveArrayCritical(jarray array, jboolean* isCopy) {
+ JNIVerifier<> marker(this, "GetPrimitiveArrayCritical");
+ return marker.ResultNotNull(_jni_env->GetPrimitiveArrayCritical(array, isCopy));
+}
+
+void ExceptionCheckingJniEnv::ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode) {
+ JNIVerifier<> marker(this, "ReleasePrimitiveArrayCritical");
+ _jni_env->ReleasePrimitiveArrayCritical(array, carray, mode);
+}
+
+const jchar* ExceptionCheckingJniEnv::GetStringCritical(jstring str, jboolean* isCopy) {
+ JNIVerifier<const jchar*> marker(this, "GetPrimitiveArrayCritical");
+ return marker.ResultNotNull(_jni_env->GetStringCritical(str, isCopy));
+}
+
+void ExceptionCheckingJniEnv::ReleaseStringCritical(jstring str, const jchar* carray) {
+ JNIVerifier<> marker(this, "ReleaseStringCritical");
+ _jni_env->ReleaseStringCritical(str, carray);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Google 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 NSK_EXCEPTIONCHECKINGJNIENV_DEFINED
+#define NSK_EXCEPTIONCHECKINGJNIENV_DEFINED
+
+#include <jni.h>
+
+/**
+ * ExceptionCheckingJniEnv wraps around the JNIEnv data structure and
+ * methods to enable automatic exception checking. This allows test writers
+ * and readers to concentrate on what the test is to do and leave the
+ * error checking and throwing to this data structure and subsystem.
+ *
+ * For example:
+ *
+ * ... JNIEnv* env ...
+ * jclass klass = env->GetObjectClass(o);
+ * if (klass == NULL) {
+ * printf("Error: GetObjectClass returned NULL\n");
+ * return;
+ * }
+ * if (env->ExceptionCheck()) {
+ * ...
+ * }
+ *
+ * Can be simplified to:
+ * ... ExceptionCheckingJniEnv* env ...
+ * jclass klass = env->GetObjectClass(o);
+ *
+ * Where now the JNI Exception checking and the NULL return checking are done
+ * internally and will perform whatever action the ErrorHandler requires.
+ *
+ * By default, the error handler describes the exception via the JNI
+ * ExceptionDescribe method and calls FatalError.
+ *
+ * Note: at a future date, this will also include the tracing mechanism done in
+ * NSK_VERIFY, which will thus embed its logic into the ExceptionCheckingJniEnv
+ * and clearing that up for the code readers and writers.
+ */
+class ExceptionCheckingJniEnv {
+ public:
+ // JNIEnv API redefinitions.
+ jfieldID GetFieldID(jclass klass, const char *name, const char* type);
+ jclass GetObjectClass(jobject obj);
+ jobject GetObjectField(jobject obj, jfieldID field);
+ void SetObjectField(jobject obj, jfieldID field, jobject value);
+
+ jsize GetArrayLength(jarray array);
+ jsize GetStringLength(jstring str);
+
+ void* GetPrimitiveArrayCritical(jarray array, jboolean* isCopy);
+ void ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode);
+ const jchar* GetStringCritical(jstring str, jboolean* isCopy);
+ void ReleaseStringCritical(jstring str, const jchar* carray);
+
+ jobject NewGlobalRef(jobject obj);
+ void DeleteGlobalRef(jobject obj);
+ jobject NewLocalRef(jobject ref);
+ void DeleteLocalRef(jobject ref);
+ jweak NewWeakGlobalRef(jobject obj);
+ void DeleteWeakGlobalRef(jweak obj);
+
+ // ExceptionCheckingJniEnv methods.
+ JNIEnv* GetJNIEnv() {
+ return _jni_env;
+ }
+
+ void HandleError(const char* msg) {
+ if (_error_handler) {
+ _error_handler(_jni_env, msg);
+ }
+ }
+
+ typedef void (*ErrorHandler)(JNIEnv* env, const char* error_message);
+
+ static void FatalError(JNIEnv* env, const char* message) {
+ if (env->ExceptionCheck()) {
+ env->ExceptionDescribe();
+ }
+ env->FatalError(message);
+ }
+
+ ExceptionCheckingJniEnv(JNIEnv* jni_env, ErrorHandler error_handler) :
+ _jni_env(jni_env), _error_handler(error_handler) {}
+
+ private:
+ JNIEnv* _jni_env;
+ ErrorHandler _error_handler;
+};
+
+// We cannot use unique_ptr due to this being gnu98++, so use this instead:
+class ExceptionCheckingJniEnvPtr {
+ private:
+ ExceptionCheckingJniEnv _env;
+
+ public:
+ ExceptionCheckingJniEnv* operator->() {
+ return &_env;
+ }
+
+ ExceptionCheckingJniEnvPtr(
+ JNIEnv* jni_env,
+ ExceptionCheckingJniEnv::ErrorHandler error_handler = ExceptionCheckingJniEnv::FatalError) :
+ _env(jni_env, error_handler) {
+ }
+};
+
+#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/correctBootstrap/TestDescription.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/correctBootstrap/TestDescription.java Tue Oct 16 14:26:22 2018 +0530
@@ -50,7 +50,7 @@
* @build vm.mlvm.share.ClassfileGeneratorTest
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
- * @run main/othervm
+ * @run main/othervm/timeout=300
* vm.mlvm.share.ClassfileGeneratorTest
* -generator vm.mlvm.cp.share.GenManyIndyCorrectBootstrap
*/
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/incorrectBootstrap/TestDescription.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/incorrectBootstrap/TestDescription.java Tue Oct 16 14:26:22 2018 +0530
@@ -51,7 +51,7 @@
* @build vm.mlvm.share.ClassfileGeneratorTest
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
- * @run main/othervm
+ * @run main/othervm/timeout=300
* vm.mlvm.share.ClassfileGeneratorTest
* -generator vm.mlvm.cp.share.GenManyIndyIncorrectBootstrap
*/
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/mh/TestDescription.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/mh/TestDescription.java Tue Oct 16 14:26:22 2018 +0530
@@ -50,6 +50,6 @@
* @build vm.mlvm.share.ClassfileGeneratorTest
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
- * @run main/othervm vm.mlvm.share.ClassfileGeneratorTest -generator vm.mlvm.cp.share.GenCPFullOfMH
+ * @run main/othervm/timeout=300 vm.mlvm.share.ClassfileGeneratorTest -generator vm.mlvm.cp.share.GenCPFullOfMH
*/
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/mt/TestDescription.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/stress/classfmt/mt/TestDescription.java Tue Oct 16 14:26:22 2018 +0530
@@ -50,6 +50,6 @@
* @build vm.mlvm.share.ClassfileGeneratorTest
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
- * @run main/othervm vm.mlvm.share.ClassfileGeneratorTest -generator vm.mlvm.cp.share.GenCPFullOfMT
+ * @run main/othervm/timeout=300 vm.mlvm.share.ClassfileGeneratorTest -generator vm.mlvm.cp.share.GenCPFullOfMT
*/
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/gc/createLotsOfMHConsts/Test.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/gc/createLotsOfMHConsts/Test.java Tue Oct 16 14:26:22 2018 +0530
@@ -50,7 +50,7 @@
* @build vm.mlvm.meth.stress.gc.createLotsOfMHConsts.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
- * @run main/othervm
+ * @run main/othervm/timeout=300
* vm.mlvm.meth.stress.gc.createLotsOfMHConsts.Test
* -stressIterationsFactor 100000
* -generator vm.mlvm.cp.share.GenCPFullOfMH
--- a/test/jdk/Makefile Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/Makefile Tue Oct 16 14:26:22 2018 +0530
@@ -29,8 +29,6 @@
USE_FAILURE_HANDLER := true
-TREAT_EXIT_CODE_1_AS_0 := true
-
include ../TestCommon.gmk
# Default make rule (runs default jdk tests)
--- a/test/jdk/ProblemList.txt Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/ProblemList.txt Tue Oct 16 14:26:22 2018 +0530
@@ -508,6 +508,8 @@
# jdk_lang
java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all
+java/lang/ProcessBuilder/PipelineTest.java 8211844 aix-ppc64
+java/lang/ProcessHandle/InfoTest.java 8211847 aix-ppc64
############################################################################
@@ -556,6 +558,8 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
+java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64
+
############################################################################
# jdk_nio
@@ -564,14 +568,17 @@
java/nio/channels/DatagramChannel/ChangingAddress.java 7141822 macosx-all
+java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc64
+
java/nio/channels/Selector/Wakeup.java 6963118 windows-all
-java/nio/channels/Selector/RacyDeregister.java 8201765 windows-all
java/nio/file/WatchService/Basic.java 7158947 solaris-all Solaris 11
java/nio/file/WatchService/MayFlies.java 7158947 solaris-all Solaris 11
java/nio/file/WatchService/LotsOfCancels.java 8188039 solaris-all Solaris 11
java/nio/file/WatchService/LotsOfEvents.java 7158947 solaris-all Solaris 11
+sun/nio/cs/OLD/TestIBMDB.java 8211841 aix-ppc64
+
############################################################################
# jdk_rmi
@@ -828,8 +835,6 @@
# jdk_jdi
-com/sun/jdi/BasicJDWPConnectionTest.java 8195703 generic-all
-
com/sun/jdi/RepStep.java 8043571 generic-all
com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-all
@@ -853,7 +858,7 @@
# svc_tools
sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all
-sun/tools/jhsdb/BasicLauncherTest.java 8193639 solaris-all
+sun/tools/jhsdb/BasicLauncherTest.java 8193639,8211767 solaris-all,linux-ppc64,linux-ppc64le
sun/tools/jhsdb/HeapDumpTest.java 8193639 solaris-all
--- a/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -29,17 +29,15 @@
*/
import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.net.Socket;
import java.net.SocketException;
import jdk.test.lib.apps.LingeredApp;
-import jdk.test.lib.Utils;
import java.util.ArrayList;
-import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class BasicJDWPConnectionTest {
@@ -64,25 +62,37 @@
return res;
}
- public static ArrayList<String> prepareCmd(int port, String allowOpt) {
- String address = "*:" + String.valueOf(port);
+ public static ArrayList<String> prepareCmd(String allowOpt) {
ArrayList<String> cmd = new ArrayList<>();
String jdwpArgs = "-agentlib:jdwp=transport=dt_socket,server=y," +
- "suspend=n,address=" + address + allowOpt;
+ "suspend=n,address=*:0" + allowOpt;
cmd.add(jdwpArgs);
return cmd;
}
+ private static Pattern listenRegexp = Pattern.compile("Listening for transport \\b(.+)\\b at address: \\b(\\d+)\\b");
+ private static int detectPort(String s) {
+ Matcher m = listenRegexp.matcher(s);
+ if (!m.find()) {
+ throw new RuntimeException("Could not detect port from '" + s + "'");
+ }
+ // m.group(1) is transport, m.group(2) is port
+ return Integer.parseInt(m.group(2));
+ }
+
public static void positiveTest(String testName, String allowOpt)
throws InterruptedException, IOException {
System.err.println("\nStarting " + testName);
- int port = Utils.getFreePort();
- ArrayList<String> cmd = prepareCmd(port, allowOpt);
+ ArrayList<String> cmd = prepareCmd(allowOpt);
LingeredApp a = LingeredApp.startApp(cmd);
- int res = handshake(port);
- a.stopApp();
+ int res;
+ try {
+ res = handshake(detectPort(a.getProcessStdout()));
+ } finally {
+ a.stopApp();
+ }
if (res < 0) {
throw new RuntimeException(testName + " FAILED");
}
@@ -92,12 +102,15 @@
public static void negativeTest(String testName, String allowOpt)
throws InterruptedException, IOException {
System.err.println("\nStarting " + testName);
- int port = Utils.getFreePort();
- ArrayList<String> cmd = prepareCmd(port, allowOpt);
+ ArrayList<String> cmd = prepareCmd(allowOpt);
LingeredApp a = LingeredApp.startApp(cmd);
- int res = handshake(port);
- a.stopApp();
+ int res;
+ try {
+ res = handshake(detectPort(a.getProcessStdout()));
+ } finally {
+ a.stopApp();
+ }
if (res > 0) {
System.err.println(testName + ": res=" + res);
throw new RuntimeException(testName + " FAILED");
@@ -109,16 +122,18 @@
public static void badAllowOptionTest(String testName, String allowOpt)
throws InterruptedException, IOException {
System.err.println("\nStarting " + testName);
- int port = Utils.getFreePort();
- ArrayList<String> cmd = prepareCmd(port, allowOpt);
+ ArrayList<String> cmd = prepareCmd(allowOpt);
+ LingeredApp a;
try {
- LingeredApp a = LingeredApp.startApp(cmd);
+ a = LingeredApp.startApp(cmd);
} catch (IOException ex) {
System.err.println(testName + ": caught expected IOException");
System.err.println(testName + " PASSED");
return;
}
+ // LingeredApp.startApp is expected to fail, but if not, terminate the app
+ a.stopApp();
throw new RuntimeException(testName + " FAILED");
}
@@ -174,26 +189,16 @@
badAllowOptionTest("ExplicitMultiDefault2Test", allowOpt);
}
- public static void main(String[] args) {
- try {
- DefaultTest();
- ExplicitDefaultTest();
- AllowTest();
- MultiAllowTest();
- DenyTest();
- MultiDenyTest();
- EmptyAllowOptionTest();
- ExplicitMultiDefault1Test();
- ExplicitMultiDefault2Test();
- System.err.println("\nTest PASSED");
- } catch (InterruptedException ex) {
- System.err.println("\nTest ERROR, getFreePort");
- ex.printStackTrace();
- System.exit(3);
- } catch (IOException ex) {
- System.err.println("\nTest ERROR");
- ex.printStackTrace();
- System.exit(3);
- }
+ public static void main(String[] args) throws Exception {
+ DefaultTest();
+ ExplicitDefaultTest();
+ AllowTest();
+ MultiAllowTest();
+ DenyTest();
+ MultiDenyTest();
+ EmptyAllowOptionTest();
+ ExplicitMultiDefault1Test();
+ ExplicitMultiDefault2Test();
+ System.err.println("\nTest PASSED");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/DeferredStepTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2002, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 4629548
+ * @summary Deferred StepRequests are lost in multithreaded debuggee
+ * @comment converted from test/jdk/com/sun/jdi/DeferredStepTest.sh
+ *
+ * @library /test/lib
+ * @build DeferredStepTest
+ * @run main/othervm DeferredStepTest
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+class DeferredStepTestTarg {
+ static class jj1 implements Runnable {
+ public void run() {
+ int count = 0;
+
+ for ( int ii = 0; ii < 10; ii++) {
+ int intInPotato04 = 666;
+ ++count; // @1 breakpoint
+ System.out.println("Thread: " + Thread.currentThread().getName());
+ }
+ }
+ }
+
+ static class jj2 implements Runnable {
+ public void run() {
+ int count2 = 0;
+
+ for (int ii = 0; ii < 10; ii++) {
+ String StringInPotato05 = "I am";
+ ++count2; // @2 breakpoint
+ System.out.println("Thread: " + Thread.currentThread().getName());
+ }
+ }
+ }
+
+ public static void main(String argv[]) {
+ System.out.println("Version = " + System.getProperty("java.version"));
+
+ jj1 obj1 = new jj1();
+ jj2 obj2 = new jj2();
+ new Thread(obj1, "jj1").start();
+ new Thread(obj2, "jj2").start();
+ }
+}
+
+public class DeferredStepTest extends JdbTest {
+ public static void main(String argv[]) {
+ new DeferredStepTest().run();
+ }
+
+ private DeferredStepTest() {
+ super(DeferredStepTestTarg.class.getName());
+ }
+
+ private static class ThreadData {
+ int lastLine = -1; // line of the last stop
+ int minLine = -1; // min line (-1 means "not known yet")
+ int maxLine = -1; // max line (-1 means "not known yet")
+ }
+
+ private Map<String, ThreadData> threadData = new HashMap<>();
+
+ private Pattern threadRegexp = Pattern.compile("^(.+)\\[\\d+\\].*");
+ private Pattern lineRegexp = Pattern.compile("^(\\d+)\\b.*", Pattern.MULTILINE);
+
+ // returns the 1st group of the pattern.
+ private String parse(Pattern p, String input) {
+ Matcher m = p.matcher(input);
+ if (!m.find()) {
+ throw new RuntimeException("Input '" + input + "' does not matches '" + p.pattern() + "'");
+ }
+ return m.group(1);
+ }
+
+ private void next() {
+ List<String> reply = jdb.command(JdbCommand.next());
+ /*
+ * Each "next" produces something like ("Breakpoint hit" line only if the line has BP)
+ * Step completed:
+ * Breakpoint hit: "thread=jj2", DeferredStepTestTarg$jj2.run(), line=74 bci=12
+ * 74 ++count2; // @2 breakpoint
+ * <empty line>
+ * jj2[1]
+ */
+ // detect thread from the last line
+ String lastLine = reply.get(reply.size() - 1);
+ String threadName = parse(threadRegexp, lastLine);
+ String wholeReply = reply.stream().collect(Collectors.joining(Utils.NEW_LINE));
+ int lineNum = Integer.parseInt(parse(lineRegexp, wholeReply));
+
+ System.out.println("got: thread=" + threadName + ", line=" + lineNum);
+
+ ThreadData data = threadData.get(threadName);
+ if (data == null) {
+ data = new ThreadData();
+ threadData.put(threadName, data);
+ }
+ processThreadData(threadName, lineNum, data);
+ }
+
+ private void processThreadData(String threadName, int lineNum, ThreadData data) {
+ int lastLine = data.lastLine;
+ data.lastLine = lineNum;
+ if (lastLine < 0) {
+ // the 1st stop in the thread
+ return;
+ }
+ if (lineNum == lastLine + 1) {
+ // expected.
+ return;
+ }
+ if (lineNum < lastLine) {
+ // looks like step to the beginning of the cycle
+ if (data.minLine > 0) {
+ // minLine and maxLine are not set - verify
+ Asserts.assertEquals(lineNum, data.minLine, threadName + " - minLine");
+ Asserts.assertEquals(lastLine, data.maxLine, threadName + " - maxLine");
+ } else {
+ // set minLine/maxLine
+ data.minLine = lineNum;
+ data.maxLine = lastLine;
+ }
+ return;
+ }
+ throw new RuntimeException(threadName + " (line " + lineNum + ") - unexpected."
+ + " lastLine=" + lastLine + ", minLine=" + data.minLine + ", maxLine=" + data.maxLine);
+ }
+
+ @Override
+ protected void runCases() {
+ setBreakpoints(jdb, DeferredStepTestTarg.jj1.class.getName(),
+ getTestSourcePath("DeferredStepTest.java"), 1);
+ setBreakpoints(jdb, DeferredStepTestTarg.jj2.class.getName(),
+ getTestSourcePath("DeferredStepTest.java"), 2);
+
+ // Run to breakpoint #1
+ jdb.command(JdbCommand.run());
+
+ // 2 cycles with 4 lines each - maximum 80 stops
+ for (int i=0; i<50; i++) {
+ next();
+ }
+ }
+}
--- a/test/jdk/com/sun/jdi/DeferredStepTest.sh Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 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.
-#
-
-# @ test
-# This is a manual test. The script isn't smart enough
-# to detect the correct ordering of the output since it
-# is produced by multiple threads and can be interleaved
-# in many different ways.
-#
-# @bug 4629548
-# @summary Deferred StepRequests are lost in multithreaded debuggee
-# @author Jim Holmlund
-#
-# @run shell/manual DeferredStepTest.sh
-
-# Run this script to see the bug. See comments at the end
-# of the .java file for info on what the bug looks like.
-
-# These are variables that can be set to control execution
-
-#pkg=untitled7
-classname=DeferredStepTest
-#compileOptions=-g
-#java=java_g
-#mode=-Xcomp
-
-createJavaFile()
-{
- cat <<EOF > $classname.java.1
-public class $classname {
- static class jj1 implements Runnable {
- public void run() {
- int count = 0;
-
- for ( int ii = 0; ii < 10; ii++) { // line 6
- int intInPotato04 = 666; // line 7
- ++count; // line 8; @1 breakpoint
- System.out.println("Thread: " + Thread.currentThread().getName()); // line 9
- }
- }
- }
-
- static class jj2 implements Runnable {
- public void run() {
- int count2 = 0;
-
- for (int ii = 0; ii < 10; ii++) { // line 18
- String StringInPotato05 = "I am"; // line 19
- ++count2; // line 20; @1 breakpoint
- System.out.println("Thread: " + Thread.currentThread().getName()); // line 21
- }
- }
- }
-
- public static void main(String argv[]) {
- System.out.println("Version = " + System.getProperty("java.version"));
-
- jj1 aRP = new jj1();
- jj2 asRP = new jj2();
- new Thread(aRP, "jj1 *").start();
- new Thread(asRP, "jj2 **").start();
-// new Thread(aRP, "jj3 ***").start();
-// new Thread(asRP, "jj4 ****").start();
- }
-}
-
-/****************************
-To see this bug, do this
-
- jdb DeferredStep
- stop at DeferredStepTest$jj1:8
- stop at DeferredStepTest$jj2:20
- run
- next
- next
- :
-
-********/
-
-EOF
-}
-
-#sleepcmd="sleep 2"
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
- #set -x
- # We can't use setBkpts because it can only set bkpts in one class :-(
- #setBkpts @1
- cmd stop at $classname'$jj1:8'
- cmd stop at $classname'$jj2:20'
- #cmd run; $sleepcmd
- runToBkpt @1
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
-}
-
-mysetup()
-{
- if [ -z "$TESTSRC" ] ; then
- TESTSRC=.
- fi
-
- for ii in . $TESTSRC $TESTSRC/.. ; do
- if [ -r "$ii/ShellScaffold.sh" ] ; then
- . $ii/ShellScaffold.sh
- break
- fi
- done
-}
-
-
-# You could replace this next line with the contents
-# of ShellScaffold.sh and this script will run just the same.
-mysetup
-
-cat <<EOF
-****************************************************************
-This test should be run and checked manually.
-
-If this works right, you should see StepEvents/Breakpoint events for lines
- 8, 9, 6, 7, 8, 9, 6, .... for thread jj11
-and
- 20, 21, 18, 19, 20, 21, 18, ... for thread jj2
-
-Since both threads are running at the same time, these
-events can be intermixed.
-
-The bug is that you will frequently see step events missing.
-EG, you will see
- 8, 9, 8
-or
- 20, 21, 20, 21
-etc
-
-============================================================
-At some point you might get the msg 'Nothing suspended'
-This is bug:
- 4619349 Step Over fails in a multi threaded debuggee
-
-Kill the test and rerun it if this happens.
-****************************************************************
-
-EOF
-runit
-#jdbFailIfPresent "Nothing suspended"
-#pass
--- a/test/jdk/com/sun/jdi/DoubleAgentTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/jdi/DoubleAgentTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -41,10 +41,8 @@
"test.classes", ".");
public static void main(String[] args) throws Throwable {
- int port = Utils.getFreePort();
-
String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
- + ",server=y" + ",suspend=n" + ",address=*:" + String.valueOf(port);
+ + ",server=y" + ",suspend=n" + ",address=*:0";
OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath",
TEST_CLASSES,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/MethodInvokeWithTraceOnTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test
+ * @bug 8193879 8193801 8129348
+ * @summary Invokes static and instance methods when debugger trace
+ * mode is on.
+ * @library /test/lib
+ * @run build TestScaffold VMConnection TargetListener TargetAdapter
+ * @run compile -g MethodInvokeWithTraceOnTest.java
+ * @run driver MethodInvokeWithTraceOnTest
+ */
+
+import com.sun.jdi.*;
+import com.sun.jdi.event.*;
+import com.sun.jdi.request.*;
+
+import java.util.*;
+
+import static lib.jdb.JdbTest.*;
+
+/********** target program **********/
+
+class MethodInvokeWithTraceOnTestTarg {
+ public static void main(String[] args) {
+ new MethodInvokeWithTraceOnTestTarg().test();
+ }
+
+ private void test() {
+ Thread thread = Thread.currentThread();
+ print(thread); // @1 breakpoint
+ String str = "test";
+ printStatic(str); // @2 breakpoint
+
+ }
+
+ public void print(Object obj) {
+ System.out.println(obj);
+ }
+
+ public static void printStatic(Object obj) {
+ System.out.println(obj);
+ }
+
+}
+
+
+/********** test program **********/
+
+public class MethodInvokeWithTraceOnTest extends TestScaffold {
+
+ MethodInvokeWithTraceOnTest(String args[]) {
+ super(args);
+ }
+
+ public static void main(String[] args)
+ throws Exception {
+ new MethodInvokeWithTraceOnTest(args).startTests();
+ }
+
+ /********** test core **********/
+
+ protected void runTests() throws Exception {
+ init();
+
+ // Test with suspend policy set to SUSPEND_EVENT_THREAD
+ BreakpointEvent be = resumeToBreakpoint(true, 1);
+ System.out.println("Breakpoint 1 is hit, suspendPolicy:" + be.request().suspendPolicy());
+ testMethods(be);
+
+ // Test with suspend policy set to SUSPEND_ALL
+ be = resumeToBreakpoint(false, 2);
+ System.out.println("Breakpoint 2 is hit, suspendPolicy:" + be.request().suspendPolicy());
+ testMethods(be);
+
+ listenUntilVMDisconnect();
+ }
+
+ private void init() throws Exception {
+ startToMain("MethodInvokeWithTraceOnTestTarg");
+ vm().setDebugTraceMode(VirtualMachine.TRACE_ALL);
+ }
+
+ private BreakpointEvent resumeToBreakpoint(boolean suspendThread, int breakpointId) throws Exception {
+ int bkpLine = parseBreakpoints(getTestSourcePath("MethodInvokeWithTraceOnTest.java"), breakpointId).get(0);
+ System.out.println("Running to line: " + bkpLine);
+ return resumeTo("MethodInvokeWithTraceOnTestTarg", bkpLine, suspendThread);
+ }
+
+ private void testMethods(BreakpointEvent be) throws Exception {
+ System.out.println("Testing methods...");
+ ThreadReference thread = be.thread();
+ StackFrame frame = thread.frame(0);
+ ObjectReference thisObj = frame.thisObject();
+ LocalVariable threadVar = frame.visibleVariableByName("thread");
+ ThreadReference threadObj = (ThreadReference) frame.getValue(threadVar);
+ StringReference stringObj = vm().mirrorOf("test string");
+ int invokeOptions = getMethodInvokeOptions(be);
+
+ testInstanceMethod1(thread, thisObj, stringObj, threadObj, invokeOptions);
+ testStaticMethod1(thread, thisObj, stringObj, threadObj, invokeOptions);
+ testStaticMethod2(thread, invokeOptions);
+ }
+
+ private void testInstanceMethod1(ThreadReference thread, ObjectReference thisObj, StringReference stringObj,
+ ThreadReference threadObj, int invokeOptions) throws Exception {
+ ClassType classType = (ClassType) thisObj.referenceType();
+ Method printMethod = classType.methodsByName("print",
+ "(Ljava/lang/Object;)V").get(0);
+
+ System.out.println("Passing StringReference to instance method...");
+ thisObj.invokeMethod(thread, printMethod, Collections.singletonList(stringObj), invokeOptions);
+
+ System.out.println("Passing ThreadReference to instance method...");
+ thisObj.invokeMethod(thread, printMethod, Collections.singletonList(threadObj), invokeOptions);
+ }
+
+ private void testStaticMethod1(ThreadReference thread, ObjectReference thisObj, StringReference stringObj,
+ ThreadReference threadObj, int invokeOptions) throws Exception {
+ ClassType classType = (ClassType) thisObj.referenceType();
+ Method printMethod = classType.methodsByName("printStatic",
+ "(Ljava/lang/Object;)V").get(0);
+
+ System.out.println("Passing StringReference to static method...");
+ classType.invokeMethod(thread, printMethod, Collections.singletonList(stringObj), invokeOptions);
+
+ System.out.println("Passing ThreadReference to static method...");
+ classType.invokeMethod(thread, printMethod, Collections.singletonList(threadObj), invokeOptions);
+ }
+
+ private void testStaticMethod2(ThreadReference thread, int invokeOptions) throws Exception {
+ ClassType classType = getClassType("java.lang.Class");
+ Method forNameMethod = classType.methodsByName("forName",
+ "(Ljava/lang/String;)Ljava/lang/Class;").get(0);
+ StringReference classNameParam = vm().mirrorOf("java.lang.String");
+ classType.invokeMethod(thread, forNameMethod, Collections.singletonList(classNameParam), invokeOptions);
+ }
+
+ private ClassType getClassType(String className) {
+ List classes = vm().classesByName(className);
+ return (ClassType) classes.get(0);
+ }
+
+ private int getMethodInvokeOptions(BreakpointEvent be) {
+ return be.request().suspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ?
+ ObjectReference.INVOKE_SINGLE_THREADED : 0;
+ }
+}
--- a/test/jdk/com/sun/jdi/ShellScaffold.sh Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1221 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2017, 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.
-#
-
-#
-#
-# jtreg runs this in a scratch dir.
-# It (and runregress -no) sets these env vars:
-# TESTSRC: The dir that contains this file
-# TESTCLASSES: Where .class files are compiled to
-# TESTJAVA: The jdk to run
-#
-# This is a 'library' script that is included by
-# shell script test cases that want to run a .java file as the debuggee
-# and use jdb as the debugger. This file contains
-# several functions that support such a test.
-
-# The caller script can also set these shell vars before
-# including this file:
-# pkg=<package name> To use a package, define it here and put
-# package $pkg
-# in your java file
-# classname=<classnam> Omit this to use the default class name, 'shtest'.
-
-# compileOptions=<string> compile options for at least the first compile,
-# eg, compileOptions=-g
-# compileOptions2=<string> Options for the 2nd, ..., compile. compileOptions1
-# is used if this is not set. To use no compile
-# options for the 2nd ... compiles, do
-# compileOptions2=none
-#
-# mode=-Xcomp or mode=-Xint to run in these modes. These should not
-# really be used since the tests are normally
-# run in both modes.
-# javacCmd=path-to-javac to use a non-standard javac for compiling
-# compileOptions=<string> Options to pass to javac
-#
-# See RedefineException.sh as an example of a caller script.
-#
-# To do RedefineClasses operations, embed @1 tags in the .java
-# file to tell this script how to modify it to produce the 2nd
-# version of the .class file to be used in the redefine operation.
-# Here are examples of each editting tag and what change
-# it causes in the new file. Note that blanks are not preserved
-# in these editing operations.
-#
-# @1 uncomment
-# orig: // @1 uncomment gus = 89;
-# new: gus = 89;
-#
-# @1 commentout
-# orig: gus = 89 // @1 commentout
-# new: // gus = 89 // @1 commentout
-#
-# @1 delete
-# orig: gus = 89 // @1 delete
-# new: entire line deleted
-#
-# @1 newline
-# orig: gus = 89; // @1 newline gus++;
-# new: gus = 89; //
-# gus++;
-#
-# @1 replace
-# orig: gus = 89; // @1 replace gus = 90;
-# new: gus = 90;
-#
-# The only other tag supported is @1 breakpoint. The setbkpts function
-# sets bkpts at all lines that contain this string.
-#
-# Currently, all these tags are start with @1. It is envisioned that this script
-# could be ehanced to allow multiple cycles of redefines by allowing
-# @2, @3, ... tags. IE, processing the @i tags in the ith version of
-# the file will produce the i+1th version of the file.
-#
-# There are problem with jtreg leaving behind orphan java and jdb processes
-# when this script is run. Sometimes, on some platforms, it just doesn't
-# get them all killed properly.
-# The solution is to put a magic word in the cmd lines of background java
-# and jdb processes this script launches. We can then do the right kind
-# of ps cmds to find all these processes and kill them. We do this by
-# trapping the completion of this script.
-#
-# An associated problem is that our trap handler (cleanup) doesn't
-# always get called when jtreg terminates a test. This can leave tests
-# hanging but following tests should run ok because each test uses
-# unique names for the port and temp files (based on the PID returned
-# by $$).
-#
-# mks 6.2a on win 98 presents two problems:
-# $! returns the PID as a negative number whereas ps returns
-# it in the form 0xFFF.... This means our trick of
-# of using $! to get the PIDs of the jdb and debuggee processes
-# doesn't work. This will cause some error cases to fail
-# with a jtreg timeout instead of failing more gracefully.
-#
-# There is no form of the ps command that will show the whole
-# cmd line. Thus, the magic keyword trick doesn't work. We
-# resort to just killing java.exe and jdb.exes
-#
-# pid usage:
-# debuggeepid: used in jdb process to detect if debuggee has died.
-# - waitForDebuggeeMsg: fail if debuggee is gone
-#
-# jdbpid: dofail: used to detect if in main process or jdb process
-# waitforfinish: quit if the jdb process is gone
-
-#killcmd=/bin/kill
-killcmd=kill
-
-# This can be increased if timing seems to be an issue.
-sleep_seconds=1
-timeout_factor=1
-if [ -n "$TESTTIMEOUTFACTOR" ] ; then
- # convert float value to int
- timeout_factor=$(echo $TESTTIMEOUTFACTOR | awk '{printf "%d\n", int($1)}')
-fi
-
-echo "ShellScaffold.sh: Running with timeout_factor = $timeout_factor" >& 2
-topPid=$$
-
-# Be careful to echo to >& in these general functions.
-# If they are called from the functions that are sending
-# cmds to jdb, then stdout is redirected to jdb.
-cleanup()
-{
- if [ -r "$failFile" ] ; then
- ls -l "$failFile" >&2
- echo "<cleanup:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<cleanup:_end_failFile_contents>" >&2
- fi
-
- # Kill all processes that have our special
- # keyword in their cmd line.
- killOrphans cleanup $jdbKeyword
- killOrphans cleanup $debuggeeKeyword
-}
-
-# Kill all processes with $2 in their cmd lines
-# Print a msg about this using $1 as the prefix
-killOrphans()
-{
- str=$2
-
- if [ -z "$isCygwin" ] ; then
- toBeKilled=`$psCmd | $grep -v grep | $grep -i $str | awk '{print $1}' | tr '\n\r' ' '`
- else
- # The cygwin ps command doesn't show the options passed to a cmd.
- # We will use jps to get the win PID of the command, and
- # then use ps to find the cygwin pid to be killed.
- # The form of a ps output line is
- # ^ ddddd dddd dddd dddd.*
- # where the 4th digits are the win pid and the first
- # are the cygwin pid.
- if [ -r "$jdk/bin/$jstack" ] ; then
- winPid=`$jdk/bin/jps -v | $grep -i $str | sed -e 's@ .*@@'`
- if [ ! -z "$winPid" ] ; then
- # Here is a way to kill using a win cmd and the win PID.
- #echo "$1: taskkill /F $winPid" >& 2
- #taskkill /F /PID $winPid
-
- toBeKilled=`$psCmd | $grep -v grep | \
- $grep '^ +[0-9]+ +[0-9]+ +[0-9]+ +'"$winPid" |\
- awk '{print $1}' | tr '\n\r' ' '`
- fi
- else
- # Well, too bad - we can't find what to kill.
- toBeKilled=
- fi
- fi
-
- if [ ! -z "$toBeKilled" ] ; then
- echo "$1: kill -9 $toBeKilled" >& 2
- kill -9 $toBeKilled
- fi
-}
-
-# Returns 0 if $1 is the pid of a running process
-findPid()
-{
- if [ -z "$1" ] ; then
- return 1
- fi
-
- case "$osname" in
- SunOS | AIX)
- $psCmd | $grep '^ *'"$1 " > $devnull 2>&1
- res=$?
- ;;
- Windows* | CYGWIN*)
- # Don't use ps on cygwin since it sometimes misses
- # some processes (!).
- tasklist /NH | $grep " $1 " > $devnull 2>&1
- res=$?
- ;;
- *)
- # Never use plain 'ps', which requires a "controlling terminal"
- # and will fail with a "ps: no controlling terminal" error.
- # Running under 'rsh' will cause this ps error.
- $psCmd -e | $grep '^ *'"$1 " > $devnull 2>&1
- res=$?
- ;;
- esac
- return $res
-}
-
-setup()
-{
- failed=
- # This is used to tag each java and jdb cmd we issue so
- # we can kill them at the end of the run.
-
- orphanKeyword=HANGINGJAVA-$$
- debuggeeKeyword=${orphanKeyword}_DEB
- jdbKeyword=${orphanKeyword}_JDB
- baseArgs=-D${debuggeeKeyword}
- if [ -z "$TESTCLASSES" ] ; then
- echo "--Warning: TESTCLASSES is not defined; using TESTCLASSES=."
- echo " You should run: "
- echo " runregress $0 -no"
- echo " or"
- echo " (setenv TESTCLASSES .; $0 $*)"
- TESTCLASSES=.
- fi
- if [ ! -z "$TESTJAVA" ] ; then
- jdk="$TESTJAVA"
- else
- echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
- exit 1
- fi
-
- ulimitCmd=
- osname=`uname -s`
- isCygwin=
- case "$osname" in
- Windows* | CYGWIN*)
- devnull=NUL
- case "$osname" in
- CYGWIN*)
- isCygwin=1
- devnull=/dev/null
- ;;
- esac
-
- if [ -r $jdk/bin/dt_shmem.dll ] ; then
- transport=dt_shmem
- address=kkkk.$$
- else
- transport=dt_socket
- address=
- fi
- baseArgs="$baseArgs -XX:-ShowMessageBoxOnError"
- # jtreg puts \\s in TESTCLASSES and some uses, eg. echo
- # treat them as control chars on mks (eg \t is tab)
- # Oops; windows mks really seems to want this cat line
- # to start in column 1
- if [ -w "$Temp" ] ; then
- tmpFile=$Temp/tmp.$$
- elif [ -w "$TEMP" ] ; then
- tmpFile=$TEMP/tmp.$$
- else
- tmpFile=tmp.$$
- fi
-cat <<EOF >$tmpFile
-$TESTCLASSES
-EOF
- TESTCLASSES=`cat $tmpFile | sed -e 's@\\\\@/@g'`
- rm -f $tmpFile
- # on mks
- grep=egrep
- psCmd=ps
- jstack=jstack.exe
- ;;
- SunOS | Linux | Darwin | AIX)
- transport=dt_socket
- address=
- devnull=/dev/null
- grep=egrep
- jstack=jstack
- # On linux, core files take a long time, and can leave
- # zombie processes
- if [ "$osname" = SunOS ] ; then
- # Experiments show Solaris '/usr/ucb/ps -axwww' and
- # '/usr/bin/pgrep -f -l' provide the same small amount of the
- # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
- # 1) This seems to have been working OK in ShellScaffold.
- # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
- # instead
- # The alternative would be to use /usr/bin/pargs [pid] to get
- # all the args for a process, splice them back into one
- # long string, then grep.
- UU=`/usr/xpg4/bin/id -u -n`
- psCmd="pgrep -f -l -U $UU"
- else
- ulimit -c 0
- # See bug 6238593.
- psCmd="ps axwww"
- fi
- ;;
- *)
- echo "--Error: Unknown result from 'uname -s': $osname"
- exit 1
- ;;
- esac
-
-
- tmpFileDir=$TESTCLASSES/aa$$
- TESTCLASSES=$tmpFileDir
-
- mkdir -p $tmpFileDir
-
- # This must not contain 'jdb' or it shows up
- # in grep of ps output for some platforms
- jdbOutFile=$tmpFileDir/jxdbOutput.txt
- rm -f $jdbOutFile
- touch $jdbOutFile
-
- debuggeeOutFile=$tmpFileDir/debuggeeOutput.txt
- failFile=$tmpFileDir/testFailed
- debuggeepidFile=$tmpFileDir/debuggeepid
- rm -f $failFile $debuggeepidFile
- if [ -f "$failFile" ]; then
- echo "ERROR: unable to delete existing failFile:" >&2
- ls -l "$failFile" >&2
- fi
-
- if [ -z "$pkg" ] ; then
- pkgSlash=
- pkgDot=
- redefineSubdir=.
- else
- pkgSlash=$pkg/
- pkgDot=$pkg.
- redefineSubdir=$pkgSlash
- fi
- if [ -z "$classname" ] ; then
- classname=shtest
- fi
-
- if [ -z "$java" ] ; then
- java=java
- fi
-
- if [ -z "$jdb" ] ; then
- jdb=$jdk/bin/jdb
- fi
-
-####################################################3
-####################################################3
-####################################################3
-####################################################3
-# sol: this gets all processes killed but
-# no jstack
-# linux same as above
-# win mks: No dice; processes still running
- trap "cleanup" 0 1 2 3 4 6 9 10 15
-
- jdbOptions="$jdbOptions -J-D${jdbKeyword}"
-}
-
-docompile()
-{
- if [ "$compile" = 0 ] ; then
- return
- fi
- saveDir=`pwd`
- cd $tmpFileDir
- rm -f *.java
- createJavaFile $classname
-
- # Compile two versions of the file, the original and with the
- # indicated lines modified.
- cp $classname.java.1 $classname.java
- echo "--Compiling first version of `pwd`/$classname.java with options: $compileOptions"
- # Result is in $pkgSlash$classname.class
-
- if [ -z "$javacCmd" ] ; then
- javacCmd=$jdk/bin/javac
- fi
-
- echo "compiling " `ls *.java`
- $javacCmd $compileOptions -d . *.java
- if [ $? != 0 ] ; then
- dofail "First compile failed"
- fi
- if [ -r vers1 ] ; then
- rm -rf vers1
- fi
- mkdir -p vers1
- mv *.class vers1
- if [ ! -z "$compileOptions2" ] ; then
- if [ "$compileOptions2" = none ] ; then
- compileOptions=
- else
- compileOptions=$compileOptions2
- fi
- fi
-
- while [ 1 = 1 ] ; do
- # Not really a loop; just a way to avoid goto
- # by using breaks
- sed -e '/@1 *delete/ d' \
- -e 's! *// *@1 *uncomment! !' \
- -e 's!\(.*@1 *commentout\)!//\1!' \
- -e 's/@1 *newline/\
- /' \
- -e 's/.*@1 *replace//' \
- $classname.java.1 >$classname.java
-
- cmp -s $classname.java.1 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling second version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "Second compile failed"
- fi
- if [ -r vers2 ] ; then
- rm -rf vers2
- fi
- mkdir -p vers2
- mv *.class vers2
- mv $classname.java $classname.java.2
- cp $classname.java.1 $classname.java
-
- ###### Do the same for @2, and @3 allowing 3 redefines to occur.
- ###### If I had more time to write sed cmds, I would do
- ###### this in a loop. But, I don't think we will ever need
- ###### more than 3 redefines.
- sed -e '/@2 *delete/ d' \
- -e 's! *// *@2 *uncomment! !' \
- -e 's!\(.*@2 *commentout\)!//\1!' \
- -e 's/@2 *newline/\
- /' \
- -e 's/.*@2 *replace//' \
- $classname.java.2 >$classname.java
- cmp -s $classname.java.2 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling third version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "Third compile failed"
- fi
- if [ -r vers3 ] ; then
- rm -rf vers3
- fi
- mkdir -p vers3
- mv *.class vers3
- mv $classname.java $classname.java.3
- cp $classname.java.1 $classname.java
-
- ########
- sed -e '/@3 *delete/ d' \
- -e 's! *// *@3 *uncomment! !' \
- -e 's!\(.*@3 *commentout\)!//\1!' \
- -e 's/@3 *newline/\
- /' \
- -e 's/.*@3 *replace//' \
- $classname.java.3 >$classname.java
- cmp -s $classname.java.3 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling fourth version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "fourth compile failed"
- fi
- if [ -r vers4 ] ; then
- rm -rf vers4
- fi
- mkdir -p vers4
- mv *.class vers4
- mv $classname.java $classname.java.4
- cp $classname.java.1 $classname.java
- break
- fgrep @4 $classname.java
- if [ $? = 0 ] ; then
- echo "--Error: @4 and above are not yet allowed"
- exit 1
- fi
- done
-
- cp vers1/* $redefineSubdir
- cd $saveDir
-}
-
-# Send a cmd to jdb and wait for the jdb prompt to appear.
-# We don't want to allow > as a prompt because if the debuggee
-# runs for awhile after a command, jdb will show this prompt
-# but is not really ready to accept another command for the
-# debuggee - ie, a cont in this state will be ignored.
-# If it ever becomes necessary to send a jdb command before
-# a main[10] form of prompt appears, then this
-# code will have to be modified.
-#
-# Specify $1 = allowExit to show that the command given
-# allows JDB to exit
-cmd()
-{
- allowExit=
- case "$1" in
- allowExit)
- allowExit="allowExit"
- shift
- ;;
- exitJdb)
- # Quit JDB only with this cmd() invocation
- echo "--Sending cmd: quit" >& 2
- echo quit
- echo "--Quit cmd was sent" >& 2
- # See 6562090. Maybe there is a way that the exit
- # can cause jdb to not get the quit.
- sleep 5
-
- # The exit code value here doesn't matter since this function
- # is called as part of a pipeline and it is not the last command
- # in the pipeline.
- exit 1
- ;;
- esac
- command=$*
-
- if [ -z "$command" ] ; then
- dofail "Command can't be a null string. Test failure"
- fi
- if [ "$command" = "quit" -o "$command" = "exit" ] ; then
- # We don't want the test to manually quit jdb,
- # we will do it in the end automatically
- dofail "It's not allowed to send quit or exit commands from the test"
- fi
- if [ -r "$failFile" ] ; then
- # failFile exists, it's better to finish execution
- dofinish "quit"
- fi
-
- # $jdbOutFile always exists here and is non empty
- # because after starting jdb, we waited
- # for the prompt.
- fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
- echo "--Sending cmd: " $command >&2
-
- # jjh: We have a few intermittent failures here.
- # It is as if every so often, jdb doesn't
- # get the first cmd that is sent to it here.
- # (actually, I have seen it get the first cmd ok,
- # but then not get some subsequent cmd).
- # It seems like jdb really doesn't get the cmd; jdb's response
- # does not appear in the jxdboutput file. It contains:
- # main[1]
- # The application has been disconnected
-
- # Is it possible
- # that jdb got the cmd ok, but its response didn't make
- # it to the jxdboutput file? If so, why did 'The application
- # has been disconnected' make it?
-
- # This causes the following loop to timeout and the test to fail.
- # The above echo works because the cmd (stop at ...)
- # is in the System.err shown in the .jtr file.
- # Also, the cmd is shown in the 'jdb never responded ...'
- # msg output below after the timeout.
- # And, we know jdb is started because the main[1] output is in the .jtr
- # file. And, we wouldn't have gotten here if mydojdbcmds hadn't
- # seen the ].
- echo $command
-
- # Now we have to wait for the next jdb prompt. We wait for a pattern
- # to appear in the last line of jdb output. Normally, the prompt is
- #
- # 1) ^main[89] @
- #
- # where ^ means start of line, and @ means end of file with no end of line
- # and 89 is the current command counter. But we have complications e.g.,
- # the following jdb output can appear:
- #
- # 2) a[89] = 10
- #
- # The above form is an array assignment and not a prompt.
- #
- # 3) ^main[89] main[89] ...
- #
- # This occurs if the next cmd is one that causes no jdb output, e.g.,
- # 'trace methods'.
- #
- # 4) ^main[89] [main[89]] .... > @
- #
- # jdb prints a > as a prompt after something like a cont.
- # Thus, even though the above is the last 'line' in the file, it
- # isn't the next prompt we are waiting for after the cont completes.
- # HOWEVER, sometimes we see this for a cont command:
- #
- # ^main[89] $
- # <lines output for hitting a bkpt>
- #
- # 5) ^main[89] > @
- #
- # i.e., the > prompt comes out AFTER the prompt we we need to wait for.
- #
- # So, how do we know when the next prompt has appeared??
- # 1. Search for
- # main[89] $
- # This will handle cases 1, 2, 3
- # 2. This leaves cases 4 and 5.
- #
- # What if we wait for 4 more chars to appear and then search for
- #
- # main[89] [>]$
- #
- # on the last line?
- #
- # a. if we are currently at
- #
- # ^main[89] main[89] @
- #
- # and a 'trace methods comes in, we will wait until at least
- #
- # ^main[89] main[89] main@
- #
- # and then the search will find the new prompt when it completes.
- #
- # b. if we are currently at
- #
- # ^main[89] main[89] @
- #
- # and the first form of cont comes in, then we will see
- #
- # ^main[89] main[89] > $
- # ^x@
- #
- # where x is the first char of the msg output when the bkpt is hit
- # and we will start our search, which will find the prompt
- # when it comes out after the bkpt output, with or without the
- # trailing >
- #
-
- # wait for 4 new chars to appear in the jdb output
- count=0
- desiredFileSize=`expr $fileSize + 4`
- msg1=`echo At start: cmd/size/waiting : $command / $fileSize / \`date\``
- timeLimit=`expr 60 * $timeout_factor`
- while [ 1 = 1 ] ; do
- newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
- #echo jj: desired = $desiredFileSize, new = $newFileSize >& 2
-
- done=`expr $newFileSize \>= $desiredFileSize`
- if [ $done = 1 ] ; then
- break
- fi
- sleep ${sleep_seconds}
- count=`expr $count + ${sleep_seconds}`
- if [ $count -gt $timeLimit ] ; then
- # record some debug info.
- echo "--DEBUG: jdb $$ didn't respond to command in $count secs: $command" >& 2
- echo "--DEBUG:" $msg1 >& 2
- echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2
- echo "-- $jdbOutFile follows-------------------------------" >& 2
- cat $jdbOutFile >& 2
- echo "------------------------------------------" >& 2
- dojstack
- dofail "jdb never responded to command: $command"
- fi
- done
- # Note that this assumes just these chars in thread names.
- waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' 1 $allowExit
-}
-
-setBkpts()
-{
- # Can set multiple bkpts, but only in one class.
- # $1 is the bkpt name, eg, @1
- allLines=`$grep -n "$1 *breakpoint" $tmpFileDir/$classname.java.1 | sed -e 's@^\([0-9]*\).*@\1@g'`
- for ii in $allLines ; do
- cmd "stop at $pkgDot$classname:$ii"
- done
-}
-
-runToBkpt()
-{
- # Don't pass allowExit here as we don't want JDB to unexpectedly exit
- cmd run
- # Don't need to do this - the above waits for the next prompt which comes out
- # AFTER the Breakpoint hit message.
- # Wait for jdb to hit the bkpt
- #waitForJdbMsg "Breakpoint hit" 5
-}
-
-contToBkpt()
-{
- # Don't pass allowExit here as we don't want JDB to unexpectedly exit
- cmd cont
- # Don't need to do this - the above waits for the next prompt which comes out
- # AFTER the Breakpoint hit message.
- # Wait for jdb to hit the bkpt
- #waitForJdbMsg "Breakpoint hit" 5
-}
-
-
-# Wait until string $1 appears in the output file, within the last $2 lines
-# If $3 is allowExit, then don't fail if jdb exits before
-# the desired string appears.
-waitForJdbMsg()
-{
- # This can be called from the jdb thread which doesn't
- # have access to $debuggeepid, so we have to read it from the file.
- nlines=$2
- allowExit="$3"
- myCount=0
- timeLimit=`expr 40 * $timeout_factor` # wait a max of this many secs for a response from a jdb command
-
- while [ 1 = 1 ] ; do
- if [ -r $jdbOutFile ] ; then
- # Something here causes jdb to complain about Unrecognized cmd on x86.
- tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
- if [ $? = 0 ] ; then
- # Found desired string
- break
- fi
- fi
- tail -2 $jdbOutFile | $grep -s "The application exited" > $devnull 2>&1
- if [ $? = 0 ] ; then
- # Found 'The application exited'
- echo "--JDB finished: The application exited" >&2
- if [ ! -z "$allowExit" ] ; then
- # Exit is allowed
- dofinish
- fi
- # Otherwise, it is an error if we don't find $1
- if [ -r $jdbOutFile ] ; then
- tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
- if [ $? = 0 ] ; then
- break
- fi
- fi
- dofail "JDB unexpectedly finished: Waited for jdb msg $1, but it never appeared"
- fi
-
- sleep ${sleep_seconds}
- findPid $topPid
- if [ $? != 0 ] ; then
- echo "--Top process ($topPid) is dead. We better die too" >&2
- dojstack
- exit 1
- fi
-
- myCount=`expr $myCount + ${sleep_seconds}`
- if [ $myCount -gt $timeLimit ] ; then
- echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exiting" >> $failFile
- echo "vv jdbOutFile vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2
- cat $jdbOutFile >& 2
- echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2
- dojstack
- exit 1
- fi
- done
-
-}
-
-# Finishes JDB execution
-# Specify command to finish if it's needed
-dofinish()
-{
- if [ ! -z "$*" ] ; then
- echo "--Finish execution with sending \"$*\" command to JDB" >&2
- cmd "exitJdb" "$*"
- else
- echo "--Finish without sending \"quit\" command to JDB" >&2
- fi
- exit 0
-}
-
-# $1 is the string to print. If $2 exists,
-# it is the name of a file to print, ie, the name
-# of the file that contains the $1 string.
-dofail()
-{
- if [ ! -z "$jdbpid" ] ; then
- # we are in the main process instead of the jdb process
- echo " " >> $failFile
- echo "--Fail: main: $*" >> $failFile
- else
- # Kill the debuggee ; it could be hung so
- # we want to get rid of it as soon as possible.
- killOrphans "killing debuggee" $debuggeeKeyword
- # Kill debugger, it could be hung
- killOrphans "killing debugger" $jdbKeyword
-
- echo " " >>$failFile
- echo "--Fail: $*" >> $failFile
- fi
- if [ ! -z "$2" ] ; then
- echo "---- contents of $2 follows -------" >> $failFile
- cat "$2" >> $failFile
- echo "---------------" >>$failFile
- fi
- exit 1
-}
-
-
-redefineClass()
-{
- if [ -z "$1" ] ; then
- vers=2
- else
- vers=`echo $1 | sed -e 's/@//'`
- vers=`expr $vers + 1`
- fi
-
- cmd "redefine $pkgDot$classname $tmpFileDir/vers$vers/$classname.class"
-
- cp $tmpFileDir/$classname.java.$vers \
- $tmpFileDir/$classname.java
-}
-
-mydojdbCmds()
-{
- # Wait for jdb to start before we start sending cmds
- waitForJdbMsg ']' 1
- # Send commands from the test
- dojdbCmds
- # Finish jdb with quit command
- dofinish "quit"
-}
-
-startJdb()
-{
- if [ ! -r "$jdb" -a ! -r "$jdb.exe" ] ; then
- dofail "$jdb does not exist"
- fi
- echo
- echo "--Starting jdb, address=$address"
- if [ -z "$address" ] ; then
- # Let jdb choose the port and write it to stdout
- mydojdbCmds | $jdb $jdbOptions -listenany | tee $jdbOutFile &
-
- while [ 1 ] ; do
- lastLine=`$grep 'Listening at address' $jdbOutFile`
- if [ ! -z "$lastLine" ] ; then
- break
- fi
- sleep 1
- done
- # jjh: we got the address ok, and seemed to start the debuggee
- address=`echo $lastLine | sed -e 's@.*: *@@'`
- else
- mydojdbCmds | $jdb $jdbOptions -listen $address | tee $jdbOutFile &
- fi
- #echo address = $address
-
-
- # this gets the pid of tee, at least it does on solaris
- jdbpid=$!
-
- # This fails on linux because there is an entry for each thread in jdb
- # so we get a list of numbers in jdbpid
- # jdbpid=`$psCmd | $grep -v grep | $grep ${orphanKeyword}_JDB | awk '{print $1}' | tr '\n\r' ' '`
-}
-
-startDebuggee()
-{
- args="$TESTVMOPTS $TESTJAVAOPTS"
-
- if [ ! -z "$args" ] ; then
- echo "--Starting debuggee with args from TESTVMOPTS and/or TESTJAVAOPTS: $args"
- else
- echo "--Starting debuggee"
- fi
-
- debuggeepid=
- waitForJdbMsg Listening 4
-
- beOption="-agentlib:jdwp=transport=$transport,address=$address,server=n,suspend=y"
-# beOption="-Xdebug -Xrunjdwp:transport=$transport,address=$address,server=n,suspend=y"
-
- thecmd="$jdk/bin/$java $mode -classpath $tmpFileDir $baseArgs $args \
- -Djtreg.classDir=$TESTCLASSES \
- -showversion \
- $beOption \
- $pkgDot$classname"
- echo "Cmd: $thecmd"
-
- sh -c "$thecmd | tee $debuggeeOutFile" &
-
- # Note that the java cmd and the tee cmd will be children of
- # the sh process. We can use that to find them to kill them.
- debuggeepid=$!
-
- # Save this in a place where the jdb process can find it.
- # Note that it is possible for the java cmd to abort during startup
- # due to a bad classpath or whatever.
- echo $debuggeepid > $debuggeepidFile
-}
-
-dojstack()
-{
- if [ -r "$jdk/bin/$jstack" ] ; then
- # If jstack exists, so will jps
- # Show stack traces of jdb and debuggee as a possible debugging aid.
- jdbCmd=`$jdk/bin/jps -v | $grep $jdbKeyword`
- realJdbPid=`echo "$jdbCmd" | sed -e 's@ .*@@'`
- if [ ! -z "$realJdbPid" ] ; then
- echo "-- jdb process info ----------------------" >&2
- echo " $jdbCmd" >&2
- echo "-- jdb threads: jstack $realJdbPid" >&2
- $jdk/bin/$jstack $realJdbPid >&2
- echo "------------------------------------------" >&2
- echo >&2
- fi
- debuggeeCmd=`$jdk/bin/jps -v | $grep $debuggeeKeyword`
- realDebuggeePid=`echo "$debuggeeCmd" | sed -e 's@ .*@@'`
- if [ ! -z "$realDebuggeePid" ] ; then
- echo "-- debuggee process info ----------------------" >&2
- echo " $debuggeeCmd" >&2
- echo "-- debuggee threads: jstack $moption $realDebuggeePid" >&2
- $jdk/bin/$jstack $realDebuggeePid >&2
- echo "=============================================" >&2
- echo >&2
- fi
- fi
-}
-
-waitForFinish()
-{
- # This is the main process
- # Wait for the jdb process to finish, or some error to occur
-
- while [ 1 = 1 ] ; do
- findPid $jdbpid
- if [ $? != 0 ] ; then
- break
- fi
-
- # (Don't use jdbFailIfPresent here since it is not safe
- # to call from different processes)
- $grep -s 'Input stream closed' $jdbOutFile > $devnull 2>&1
- if [ $? = 0 ] ; then
- dofail "jdb input stream closed prematurely"
- fi
-
- # If a failure has occured, quit
- if [ -r "$failFile" ] ; then
- break
- fi
-
- sleep ${sleep_seconds}
- done
-
- # jdb exited because its input stream closed prematurely
- # (Don't use jdbFailIfPresent here since it is not safe
- # to call from different processes)
- $grep -s 'Input stream closed' $jdbOutFile > $devnull 2>&1
- if [ $? = 0 ] ; then
- dofail "jdb input stream closed prematurely"
- fi
-
- # It is necessary here to avoid the situation when JDB exited but
- # mydojdbCmds() didn't finish because it waits for JDB message
- # in waitForJdbMsg(), at the same time main process will finish
- # the execution with no errors.
- # To avoid that, wait for spawned processes to finish
- case "$osname" in
- SunOS)
- # `wait` function doesn't work in Solaris shell as in bash,
- # so create replacement that finds mydojdbCmds() shell process
- # and waits for its finish
- cmdsPid=
- # get list of processes except main process with $topPid
- processes=`$psCmd | $grep -v "$grep" | $grep -v $topPid | awk '{print $1}'`
- for pid in $processes; do
- # for each process grep its full args string for test name $0
- # $0 contains full test name with path
- pargs -l $pid 2>$devnull | $grep "$0" >$devnull 2>&1
- if [ $? = 0 ] ; then
- cmdsPid=$pid
- break
- fi
- done
- echo "--waitForFinish: Waiting for mydojdbCmds() to finish" >&2
- while [ 1 = 1 ] ; do
- findPid $cmdsPid
- if [ $? != 0 ] ; then
- break
- fi
- sleep ${sleep_seconds}
- done
- ;;
- *)
- echo "--waitForFinish: Waiting for all processes to finish" >&2
- wait
- ;;
- esac
-
- if [ -r "$failFile" ] ; then
- ls -l "$failFile" >&2
- echo "<waitForFinish:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<waitForFinish:_end_failFile_contents>" >&2
- exit 1
- fi
-}
-
-# $1 is the filename, $2 is the string to look for,
-# $3 is the number of lines to search (from the end)
-grepForString()
-{
- if [ -z "$3" ] ; then
- theCmd=cat
- else
- theCmd="tail -$3"
- fi
-
- case "$2" in
- *\>*)
- # Target string contains a '>' so we better not ignore it
- $theCmd $1 | $grep -s "$2" > $devnull 2>&1
- stat="$?"
- ;;
- *)
- # Target string does not contain a '>'.
- # NOTE: if $1 does not end with a new line, piping it to sed
- # doesn't include the chars on the last line. Detect this
- # case, and add a new line.
- theFile="$1"
- if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
- # The target file doesn't end with a new line so we have
- # add one to a copy of the target file so the sed command
- # below can filter that last line.
- cp "$theFile" "$theFile.tmp"
- theFile="$theFile.tmp"
- echo >> "$theFile"
- fi
-
- # See bug 6220903. Sometimes the jdb prompt chars ('> ') can
- # get interleaved in the target file which can keep us from
- # matching the target string.
- $theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
- | $grep -s "$2" > $devnull 2>&1
- stat=$?
- if [ "$theFile" != "$1" ]; then
- # remove the copy of the target file
- rm -f "$theFile"
- fi
- unset theFile
- esac
-
- return $stat
-}
-
-# $1 is the filename, $2 is the regexp to match and return,
-# $3 is the number of lines to search (from the end)
-matchRegexp()
-{
- if [ -z "$3" ] ; then
- theCmd=cat
- else
- theCmd="tail -$3"
- fi
-
- case "$2" in
- *\>*)
- # Target string contains a '>' so we better not ignore it
- res=`$theCmd $1 | sed -e "$2"`
- ;;
- *)
- # Target string does not contain a '>'.
- # NOTE: if $1 does not end with a new line, piping it to sed
- # doesn't include the chars on the last line. Detect this
- # case, and add a new line.
- theFile="$1"
- if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
- # The target file doesn't end with a new line so we have
- # add one to a copy of the target file so the sed command
- # below can filter that last line.
- cp "$theFile" "$theFile.tmp"
- theFile="$theFile.tmp"
- echo >> "$theFile"
- fi
-
- # See bug 6220903. Sometimes the jdb prompt chars ('> ') can
- # get interleaved in the target file which can keep us from
- # matching the target string.
- res=`$theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
- | sed -e "$2"`
- if [ "$theFile" != "$1" ]; then
- # remove the copy of the target file
- rm -f "$theFile"
- fi
- unset theFile
- esac
- return $res
-}
-
-# $1 is the filename, $2 is the string to look for,
-# $3 is the number of lines to search (from the end)
-failIfPresent()
-{
- if [ -r "$1" ] ; then
- grepForString "$1" "$2" "$3"
- if [ $? = 0 ] ; then
- dofail "Error output found: \"$2\" in $1" $1
- fi
- fi
-}
-
-# $1 is the filename, $2 is the string to look for
-# $3 is the number of lines to search (from the end)
-failIfNotPresent()
-{
- if [ ! -r "$1" ] ; then
- dofail "Required output \"$2\" not found in $1"
- fi
- grepForString "$1" "$2" "$3"
- if [ $? != 0 ] ; then
- dofail "Required output \"$2\" not found in $1" $1
- fi
-
-}
-
-# fail if $1 is not in the jdb output
-# $2 is the number of lines to search (from the end)
-jdbFailIfNotPresent()
-{
- failIfNotPresent $jdbOutFile "$1" $2
-}
-
-# fail if $1 is not in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeFailIfNotPresent()
-{
- failIfNotPresent $debuggeeOutFile "$1" $2
-}
-
-# fail if $1 is in the jdb output
-# $2 is the number of lines to search (from the end)
-jdbFailIfPresent()
-{
- failIfPresent $jdbOutFile "$1" $2
-}
-
-# fail if $1 is in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeFailIfPresent()
-{
- failIfPresent $debuggeeOutFile "$1" $2
-}
-
-# match and return the output from the regexp $1 in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeMatchRegexp()
-{
- matchRegexp $debuggeeOutFile "$1" $2
-}
-
-
-# This should really be named 'done' instead of pass.
-pass()
-{
- if [ ! -r "$failFile" ] ; then
- echo
- echo "--Done: test passed"
- exit 0
- else
- ls -l "$failFile" >&2
- echo "<pass:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<pass:_end_failFile_contents>" >&2
- fi
-}
-
-runit()
-{
- setup
- docompile
- startJdb
- startDebuggee
- waitForFinish
-
- # in hs_err file from 1.3.1
- debuggeeFailIfPresent "Virtual Machine Error"
-
- # in hs_err file from 1.4.2, 1.5: An unexpected error
- debuggeeFailIfPresent "An unexpected error"
-
- # in hs_err file from 1.4.2, 1.5: Internal error
- debuggeeFailIfPresent "Internal error"
-
-
- # Don't know how this arises
- debuggeeFailIfPresent "An unexpected exception"
-
- # Don't know how this arises
- debuggeeFailIfPresent "Internal exception"
-}
--- a/test/jdk/com/sun/jdi/TestScaffold.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/jdi/TestScaffold.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -784,9 +784,16 @@
}
public BreakpointEvent resumeTo(Location loc) {
+ return resumeTo(loc, false);
+ }
+
+ public BreakpointEvent resumeTo(Location loc, boolean suspendThread) {
final BreakpointRequest request =
- requestManager.createBreakpointRequest(loc);
+ requestManager.createBreakpointRequest(loc);
request.addCountFilter(1);
+ if (suspendThread) {
+ request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
+ }
request.enable();
return (BreakpointEvent)waitForRequestedEvent(request);
}
@@ -845,12 +852,16 @@
}
public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException {
+ return resumeTo(clsName, lineNumber, false);
+ }
+
+ public BreakpointEvent resumeTo(String clsName, int lineNumber, boolean suspendThread) throws AbsentInformationException {
ReferenceType rt = findReferenceType(clsName);
if (rt == null) {
rt = resumeToPrepareOf(clsName).referenceType();
}
- return resumeTo(findLocation(rt, lineNumber));
+ return resumeTo(findLocation(rt, lineNumber), suspendThread);
}
public ClassPrepareEvent resumeToPrepareOf(String className) {
--- a/test/jdk/com/sun/jdi/ZZZcleanup.sh Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 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.
-#
-
-# @test
-# @bug 1234567
-# @summary no bug
-# @author Jim Holmlund
-#
-# @run shell ZZZcleanup.sh
-
-# This is run by jtreg after all other tests in
-# this dir have run. It kills any orphan
-# processes that have been left.
-# If you can figure out a better way, let me know
-
-mysetup()
-{
- if [ -z "$TESTSRC" ] ; then
- TESTSRC=.
- fi
-
- for ii in . $TESTSRC $TESTSRC/.. ; do
- if [ -r "$ii/ShellScaffold.sh" ] ; then
- . $ii/ShellScaffold.sh
- break
- fi
- done
-}
-
-# You could replace this next line with the contents
-# of ShellScaffold.sh and this script will run just the same.
-mysetup
-setup
-pass
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -238,7 +238,7 @@
}
// gets full test source path for the given test filename
- protected static String getTestSourcePath(String fileName) {
+ public static String getTestSourcePath(String fileName) {
return Paths.get(System.getProperty("test.src")).resolve(fileName).toString();
}
--- a/test/jdk/com/sun/net/httpserver/SelCacheTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/SelCacheTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -24,14 +24,14 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm -Dsun.net.httpserver.selCacheTimeout=2 SelCacheTest
* @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import java.util.*;
import java.util.concurrent.*;
--- a/test/jdk/com/sun/net/httpserver/Test1.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test1.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test1
* @run main/othervm -Dsun.net.httpserver.maxReqTime=10 Test1
* @run main/othervm -Dsun.net.httpserver.nodelay=true Test1
@@ -38,7 +38,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/* basic http/s connectivity test
* Tests:
--- a/test/jdk/com/sun/net/httpserver/Test12.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test12.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test12
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/* basic http/s connectivity test
* Tests:
--- a/test/jdk/com/sun/net/httpserver/Test13.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test13.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test13
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -37,7 +37,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/* basic http/s connectivity test
* Tests:
--- a/test/jdk/com/sun/net/httpserver/Test6a.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test6a.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test6a
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/**
* Test https POST large file via chunked encoding (unusually small chunks)
--- a/test/jdk/com/sun/net/httpserver/Test7a.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test7a.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test7a
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/**
* Test POST large file via chunked encoding (large chunks)
--- a/test/jdk/com/sun/net/httpserver/Test8a.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test8a.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test8a
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/**
* Test POST large file via fixed len encoding
--- a/test/jdk/com/sun/net/httpserver/Test9.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test9.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test9
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/* Same as Test1 but requests run in parallel.
*/
--- a/test/jdk/com/sun/net/httpserver/Test9a.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/com/sun/net/httpserver/Test9a.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 6270015
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm Test9a
- * @summary Light weight HTTP server
+ * @summary Light weight HTTP server
*/
import com.sun.net.httpserver.*;
@@ -36,7 +36,7 @@
import java.io.*;
import java.net.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/* Same as Test1 but requests run in parallel.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/net/httpserver/bugs/B8211420.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test
+ * @bug 8211420
+ * @run main/othervm B8211420
+ * @summary
+ */
+
+import com.sun.net.httpserver.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+
+public class B8211420 {
+
+ public static void main (String[] args) throws Exception {
+ Logger logger = Logger.getLogger ("com.sun.net.httpserver");
+ ConsoleHandler c = new ConsoleHandler();
+ c.setLevel (Level.WARNING);
+ logger.addHandler (c);
+ logger.setLevel (Level.WARNING);
+ Handler handler = new Handler();
+ InetSocketAddress addr = new InetSocketAddress (0);
+ HttpServer server = HttpServer.create (addr, 0);
+ HttpContext ctx = server.createContext ("/test", handler);
+ ExecutorService executor = Executors.newCachedThreadPool();
+ server.setExecutor (executor);
+ server.start ();
+
+ URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
+ HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
+ try {
+ InputStream is = urlc.getInputStream();
+ while (is.read()!= -1) ;
+ is.close ();
+ String prop = urlc.getHeaderField("Content-length");
+ System.out.println ("Content-length = " + prop + " should be null");
+ if (prop != null)
+ throw new RuntimeException("Content-length was present");
+
+ urlc = (HttpURLConnection)url.openConnection();
+ is = urlc.getInputStream();
+ while (is.read()!= -1) ;
+ is.close ();
+ if (urlc.getResponseCode() != 304) // expected for 2nd test
+ throw new RuntimeException("wrong response code");
+ String clen = urlc.getHeaderField("Content-length");
+ System.out.println ("Content-length = " + clen + " should be 99");
+ System.out.println ("len = " + clen.length());
+ if (clen == null || !clen.equals("99"))
+ throw new RuntimeException("Content-length not present or has wrong value");
+ System.out.println ("OK");
+ } finally {
+ server.stop(2);
+ executor.shutdown();
+ }
+ }
+
+ public static boolean error = false;
+
+ static class Handler implements HttpHandler {
+ volatile int invocation = 1;
+ public void handle (HttpExchange t)
+ throws IOException
+ {
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ Headers rmap = t.getResponseHeaders();
+ while (is.read () != -1) ;
+ is.close();
+ if (invocation++ == 1) {
+ // send a 204 response with no body
+ t.sendResponseHeaders(204, -1);
+ t.close();
+ } else {
+ // send a 304 response with no body but with content - length
+ rmap.add("Content-length", "99");
+ t.sendResponseHeaders(304, -1);
+ t.close();
+ }
+ }
+ }
+}
--- a/test/jdk/java/lang/Character/Scripts.txt Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/Character/Scripts.txt Tue Oct 16 14:26:22 2018 +0530
@@ -402,6 +402,7 @@
328A..32B0 ; Common # So [39] CIRCLED IDEOGRAPH MOON..CIRCLED IDEOGRAPH NIGHT
32B1..32BF ; Common # No [15] CIRCLED NUMBER THIRTY SIX..CIRCLED NUMBER FIFTY
32C0..32CF ; Common # So [16] IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY..LIMITED LIABILITY SIGN
+32FF ; Common # So SQUARE ERA NAME NEWERA
3358..33FF ; Common # So [168] IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO..SQUARE GAL
4DC0..4DFF ; Common # So [64] HEXAGRAM FOR THE CREATIVE HEAVEN..HEXAGRAM FOR BEFORE COMPLETION
A700..A716 ; Common # Sk [23] MODIFIER LETTER CHINESE TONE YIN PING..MODIFIER LETTER EXTRA-LOW LEFT-STEM TONE BAR
--- a/test/jdk/java/lang/Character/UnicodeData.txt Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/Character/UnicodeData.txt Tue Oct 16 14:26:22 2018 +0530
@@ -11729,6 +11729,7 @@
32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
+32FF;SQUARE ERA NAME NEWERA;So;0;L;<square> 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;;
3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;
Binary file test/jdk/java/lang/Character/charprop00.bin has changed
--- a/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/ModuleLayer/BasicLayerTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,9 +23,10 @@
/**
* @test
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.misc
- * @build BasicLayerTest ModuleUtils
+ * @build BasicLayerTest
+ * jdk.test.lib.util.ModuleUtils
* @compile layertest/Test.java
* @run testng BasicLayerTest
* @summary Basic tests for java.lang.ModuleLayer
@@ -41,6 +42,8 @@
import java.util.Set;
import java.util.stream.Collectors;
+import jdk.test.lib.util.ModuleUtils;
+
import jdk.internal.misc.SharedSecrets;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/lang/ModuleLayer/LayerAndLoadersTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/ModuleLayer/LayerAndLoadersTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,9 +23,11 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build LayerAndLoadersTest jdk.test.lib.compiler.CompilerUtils ModuleUtils
+ * @build LayerAndLoadersTest
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.test.lib.util.ModuleUtils
* @run testng LayerAndLoadersTest
* @summary Tests for java.lang.ModuleLayer@defineModulesWithXXX methods
*/
@@ -54,6 +56,7 @@
import java.util.stream.Collectors;
import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.ModuleUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/java/lang/ModuleLayer/LayerControllerTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/ModuleLayer/LayerControllerTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,8 +23,9 @@
/**
* @test
- * @library /lib/testlibrary
- * @build LayerControllerTest ModuleUtils
+ * @library /test/lib
+ * @build LayerControllerTest
+ * jdk.test.lib.util.ModuleUtils
* @run testng LayerControllerTest
* @summary Basic tests for java.lang.ModuleLayer.Controller
*/
@@ -35,6 +36,8 @@
import java.util.List;
import java.util.Set;
+import jdk.test.lib.util.ModuleUtils;
+
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/AutomaticModulesTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test
+ * @bug 8211825
+ * @modules jdk.compiler
+ * @library /test/lib
+ * @build jdk.test.lib.compiler.CompilerUtils jdk.test.lib.util.JarUtils
+ * @run testng/othervm AutomaticModulesTest
+ * @summary Tests automatic modules in module layers
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.lang.ModuleLayer.Controller;
+import java.lang.module.*;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * This test uses two modules:
+ * m requires alib and has an entry point p.Main
+ * alib is an automatic module
+ */
+
+@Test
+public class AutomaticModulesTest {
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+
+ private static final Path CLASSES = Path.of("classes");
+ private static final Path LIB = Path.of("lib");
+ private static final Path MODS = Path.of("mods");
+
+ @BeforeTest
+ public void setup() throws Exception {
+ // javac -d classes src/alib/**
+ // jar cf lib/alib.jar -C classes .
+ Files.createDirectory(CLASSES);
+ assertTrue(CompilerUtils.compile(Path.of(TEST_SRC, "src", "alib"), CLASSES));
+ JarUtils.createJarFile(LIB.resolve("alib.jar"), CLASSES);
+
+ // javac -p lib -d mods/m - src/m/**
+ Path src = Path.of(TEST_SRC, "src", "m");
+ Path output = Files.createDirectories(MODS.resolve("m"));
+ assertTrue(CompilerUtils.compile(src, output, "-p", LIB.toString()));
+ }
+
+ /**
+ * Create a module layer with modules m and alib mapped to the same class
+ * loader.
+ */
+ public void testOneLoader() throws Exception {
+ Configuration cf = ModuleLayer.boot()
+ .configuration()
+ .resolve(ModuleFinder.of(), ModuleFinder.of(MODS, LIB), Set.of("m"));
+ ResolvedModule m = cf.findModule("m").orElseThrow();
+ ResolvedModule alib = cf.findModule("alib").orElseThrow();
+ assertTrue(m.reads().contains(alib));
+ assertTrue(alib.reference().descriptor().isAutomatic());
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+ Controller controller = ModuleLayer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl);
+ invokeMain(controller, "m/p.Main");
+ }
+
+ /**
+ * Create a module layer with modules m and alib mapped to different class
+ * loaders. This will test that L(m) delegates to L(alib) in the same layer.
+ */
+ public void testManyLoaders() throws Exception {
+ Configuration cf = ModuleLayer.boot()
+ .configuration()
+ .resolve(ModuleFinder.of(), ModuleFinder.of(MODS, LIB), Set.of("m"));
+ ResolvedModule m = cf.findModule("m").orElseThrow();
+ ResolvedModule alib = cf.findModule("alib").orElseThrow();
+ assertTrue(m.reads().contains(alib));
+ assertTrue(alib.reference().descriptor().isAutomatic());
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+ Controller controller = ModuleLayer.defineModulesWithManyLoaders(cf, List.of(bootLayer), scl);
+ invokeMain(controller, "m/p.Main");
+ }
+
+ /**
+ * Create a module layer with alib and another module layer with m.
+ * This will test that L(m) delegates to L(alib) in a parent layer.
+ */
+ public void testAutomaticModuleInParent() throws Exception {
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+ // configuration/layer containing alib
+ Configuration cf1 = bootLayer
+ .configuration()
+ .resolve(ModuleFinder.of(), ModuleFinder.of(LIB), Set.of("alib"));
+ ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
+
+ // configuration/layer containing m
+ Configuration cf2 = cf1.resolve(ModuleFinder.of(), ModuleFinder.of(MODS), Set.of("m"));
+ Controller controller = ModuleLayer.defineModulesWithOneLoader(cf2, List.of(layer1), scl);
+
+ invokeMain(controller, "m/p.Main");
+ }
+
+ /**
+ * Invokes the main method of the given entry point (module-name/class-name)
+ */
+ private void invokeMain(Controller controller, String entry) throws Exception {
+ String[] s = entry.split("/");
+ String moduleName = s[0];
+ String className = s[1];
+ int pos = className.lastIndexOf('.');
+ String packageName = className.substring(0, pos);
+ ModuleLayer layer = controller.layer();
+ Module module = layer.findModule(moduleName).orElseThrow();
+ controller.addExports(module, packageName, this.getClass().getModule());
+ ClassLoader loader = layer.findLoader(moduleName);
+ Class<?> c = loader.loadClass(className);
+ Method m = c.getMethod("main", String[].class);
+ m.invoke(null, (Object)new String[0]);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/alib/q/Lib.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+package q;
+
+public class Lib {
+ private Lib() { }
+
+ public static String generate() {
+ return "something useful";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/m/module-info.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+module m {
+ requires alib;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/m/p/Main.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+package p;
+
+import q.Lib;
+
+public class Main {
+ public static void main(String[] args) {
+ String s = Lib.generate();
+ System.out.println(s);
+ }
+}
--- a/test/jdk/java/lang/StackWalker/ReflectionFrames.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/StackWalker/ReflectionFrames.java Tue Oct 16 14:26:22 2018 +0530
@@ -48,6 +48,16 @@
public class ReflectionFrames {
final static boolean verbose = false;
+ final static Class<?> REFLECT_ACCESS = findClass("java.lang.reflect.ReflectAccess");
+ final static Class<?> REFLECTION_FACTORY = findClass("jdk.internal.reflect.ReflectionFactory");
+
+ private static Class<?> findClass(String cn) {
+ try {
+ return Class.forName(cn);
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError(e);
+ }
+ }
/**
* This test invokes new StackInspector() directly from
@@ -327,6 +337,8 @@
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ Constructor.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
+"::create",
@@ -355,6 +367,8 @@
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ Constructor.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
+"::create",
@@ -387,6 +401,8 @@
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ Constructor.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
+"::create",
@@ -436,15 +452,19 @@
assertEquals(obj.collectedFrames,
List.of(StackInspector.class.getName()
+"::<init>",
+ REFLECT_ACCESS.getName()
+ +"::newInstance",
+ REFLECTION_FACTORY.getName()
+ +"::newInstance",
Class.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
+"::create",
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertEquals(obj.filtered, 0);
// Calls the StackInspector.reflect method through reflection
@@ -464,6 +484,10 @@
assertEquals(obj.collectedFrames,
List.of(StackInspector.class.getName()
+"::<init>",
+ REFLECT_ACCESS.getName()
+ +"::newInstance",
+ REFLECTION_FACTORY.getName()
+ +"::newInstance",
Class.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
@@ -473,9 +497,9 @@
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertEquals(obj.filtered, 0);
// Calls the StackInspector.handle method through reflection
@@ -495,6 +519,10 @@
assertEquals(obj.collectedFrames,
List.of(StackInspector.class.getName()
+"::<init>",
+ REFLECT_ACCESS.getName()
+ +"::newInstance",
+ REFLECTION_FACTORY.getName()
+ +"::newInstance",
Class.class.getName()
+"::newInstance",
StackInspector.Caller.class.getName()
@@ -504,9 +532,9 @@
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertEquals(obj.filtered, 0);
// Sets a non-default walker configured to show
@@ -529,6 +557,8 @@
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ REFLECT_ACCESS.getName()
+"::newInstance",
Class.class.getName()
+"::newInstance",
@@ -538,9 +568,9 @@
+"::invoke",
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertNotEquals(obj.filtered, 0);
// Calls the StackInspector.reflect method through reflection
@@ -557,10 +587,13 @@
obj = ((StackInspector)StackInspector.Caller.class
.getMethod("reflect", How.class)
.invoke(null, How.CLASS));
+ System.out.println(obj.collectedFrames);
assertEquals(obj.collectedFrames,
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ REFLECT_ACCESS.getName()
+"::newInstance",
Class.class.getName()
+"::newInstance",
@@ -575,9 +608,9 @@
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertNotEquals(obj.filtered, 0);
// Calls the StackInspector.handle method through reflection
@@ -598,6 +631,8 @@
List.of(StackInspector.class.getName()
+"::<init>",
Constructor.class.getName()
+ +"::newInstanceWithCaller",
+ REFLECT_ACCESS.getName()
+"::newInstance",
Class.class.getName()
+"::newInstance",
@@ -611,9 +646,9 @@
ReflectionFrames.class.getName()
+"::testNewInstance"));
- // Because Class.newInstance is not filtered, then the
- // caller is Class.class
- assertEquals(obj.cls, Class.class);
+ // Because implementation frames are not filtered, then the
+ // caller is ReflectAccess.class
+ assertEquals(obj.cls, REFLECT_ACCESS);
assertNotEquals(obj.filtered, 0);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/AllowSecurityManager.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8191053
+ * @summary Test that the allow/disallow options of the java.security.manager
+ * system property work correctly
+ * @run main/othervm AllowSecurityManager
+ * @run main/othervm -Djava.security.manager=disallow AllowSecurityManager
+ * @run main/othervm -Djava.security.manager=allow AllowSecurityManager
+ */
+
+public class AllowSecurityManager {
+
+ public static void main(String args[]) throws Exception {
+ String prop = System.getProperty("java.security.manager");
+ boolean disallow = "disallow".equals(prop);
+ try {
+ System.setSecurityManager(new SecurityManager());
+ if (disallow) {
+ throw new Exception("System.setSecurityManager did not " +
+ "throw UnsupportedOperationException");
+ }
+ } catch (UnsupportedOperationException uoe) {
+ if (!disallow) {
+ throw new Exception("UnsupportedOperationException " +
+ "unexpectedly thrown by " +
+ "System.setSecurityManager");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/annotation/typeAnnotations/TestObjectMethods.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8058202
+ * @summary Test java.lang.Object methods on AnnotatedType objects.
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Test toString, equals, and hashCode on various AnnotatedType objects.
+ */
+public class TestObjectMethods {
+ private static int errors = 0;
+
+ /*
+ * There are various subtypes of AnnotatedType implementations:
+ *
+ * AnnotatedType
+ * AnnotatedArrayType
+ * AnnotatedParameterizedType
+ * AnnotatedTypeVariable
+ * AnnotatedWildcardType
+ *
+ * The implementations of each these implementations are
+ * examined. Wildcards don't appear as top-level types and need to
+ * be extracted from bounds.
+ *
+ * AnnotatedTypes with and without annotations are examined as
+ * well.
+ */
+ public static void main(String... args) {
+ Class<?>[] testClasses = {TypeHost.class, AnnotatedTypeHost.class};
+
+ for (Class<?> clazz : testClasses) {
+ testEqualsReflexivity(clazz);
+ testEquals(clazz);
+ }
+
+ testToString(TypeHost.class, false);
+ testToString(AnnotatedTypeHost.class, true);
+
+ testAnnotationsMatterForEquals(TypeHost.class, AnnotatedTypeHost.class);
+
+ testGetAnnotations(TypeHost.class, false);
+ testGetAnnotations(AnnotatedTypeHost.class, true);
+
+ testWildcards();
+
+ if (errors > 0) {
+ throw new RuntimeException(errors + " errors");
+ }
+ }
+
+ /*
+ * For non-array types, verify toString version of the annotated
+ * type ends with the same string as the generic type.
+ */
+ static void testToString(Class<?> clazz, boolean leadingAnnotations) {
+ System.err.println("Testing toString on methods of class " + clazz.getName());
+ Method[] methods = clazz.getDeclaredMethods();
+ for (Method m : methods) {
+ AnnotatedType annotType = m.getAnnotatedReturnType();
+ String annotTypeString = annotType.toString();
+
+ Type type = m.getGenericReturnType();
+ String typeString = type.toString();
+
+ boolean isArray = annotType instanceof AnnotatedArrayType;
+ boolean isVoid = "void".equals(typeString);
+
+ boolean valid;
+ if (!isArray) {
+ if (leadingAnnotations && !isVoid) {
+ valid =
+ annotTypeString.endsWith(typeString) &&
+ !annotTypeString.startsWith(typeString);
+ } else {
+ valid = annotTypeString.equals(typeString);
+ }
+ } else {
+ // Find final non-array component type and gets its name.
+ typeString = null;
+
+ AnnotatedType componentType = annotType;
+ while (componentType instanceof AnnotatedArrayType) {
+ AnnotatedArrayType annotatedArrayType = (AnnotatedArrayType) componentType;
+ componentType = annotatedArrayType.getAnnotatedGenericComponentType();
+ }
+
+ String componentName = componentType.getType().getTypeName();
+ valid = annotTypeString.contains(componentName);
+ }
+
+ if (!valid) {
+ errors++;
+ System.err.println(typeString + "\n" + annotTypeString +
+ "\n " + valid +
+ "\n\n");
+ }
+ }
+ }
+
+ static void testGetAnnotations(Class<?> clazz, boolean annotationsExpectedOnMethods) {
+ System.err.println("Testing getAnnotations on methods of class " + clazz.getName());
+ Method[] methods = clazz.getDeclaredMethods();
+ for (Method m : methods) {
+ Type type = m.getGenericReturnType();
+ AnnotatedType annotType = m.getAnnotatedReturnType();
+ Annotation[] annotations = annotType.getAnnotations();
+
+ boolean isVoid = "void".equals(type.toString());
+
+ if (annotationsExpectedOnMethods && !isVoid) {
+ if (annotations.length == 0 ) {
+ errors++;
+ System.err.println("Expected annotations missing on " + annotType);
+ }
+ } else {
+ if (annotations.length > 0 ) {
+ errors++;
+ System.err.println("Unexpected annotations present on " + annotType);
+ }
+ }
+ }
+ }
+
+ static void testEqualsReflexivity(Class<?> clazz) {
+ System.err.println("Testing reflexivity of equals on methods of class " + clazz.getName());
+ Method[] methods = clazz.getDeclaredMethods();
+ for (Method m : methods) {
+ checkTypesForEquality(m.getAnnotatedReturnType(),
+ m.getAnnotatedReturnType(),
+ true);
+ }
+ }
+
+ private static void checkTypesForEquality(AnnotatedType annotType1,
+ AnnotatedType annotType2,
+ boolean expected) {
+ boolean comparison = annotType1.equals(annotType2);
+
+ if (comparison) {
+ int hash1 = annotType1.hashCode();
+ int hash2 = annotType2.hashCode();
+ if (hash1 != hash2) {
+ errors++;
+ System.err.format("Equal AnnotatedTypes with unequal hash codes: %n%s%n%s%n",
+ annotType1.toString(), annotType2.toString());
+ }
+ }
+
+ if (comparison != expected) {
+ errors++;
+ System.err.println(annotType1);
+ System.err.println(expected ? " is not equal to " : " is equal to ");
+ System.err.println(annotType2);
+ System.err.println();
+ }
+ }
+
+ /*
+ * For each of the type host classes, the return type of a method
+ * should only equal the return type of that method.
+ */
+ static void testEquals(Class<?> clazz) {
+ Method[] methods = clazz.getDeclaredMethods();
+
+ for (int i = 0; i < methods.length; i++) {
+ for (int j = 0; j < methods.length; j++) {
+ if (i == j)
+ continue;
+ else {
+ checkTypesForEquality(methods[i].getAnnotatedReturnType(),
+ methods[j].getAnnotatedReturnType(),
+ false);
+ }
+ }
+ }
+ }
+
+ /**
+ * Roughly, compare the return types of corresponding methods on
+ * TypeHost and AnnotatedtypeHost and verify the AnnotatedType
+ * objects are *not* equal even if their underlying generic types
+ * are.
+ */
+ static void testAnnotationsMatterForEquals(Class<?> clazz1, Class<?> clazz2) {
+ System.err.println("Testing that presence/absence of annotations matters for equals comparison.");
+
+ String methodName = null;
+ for (Method method : clazz1.getDeclaredMethods()) {
+ if ("void".equals(method.getReturnType().toString())) {
+ continue;
+ }
+
+ methodName = method.getName();
+ try {
+ checkTypesForEquality(method.getAnnotatedReturnType(),
+ clazz2.getDeclaredMethod(methodName).getAnnotatedReturnType(),
+ false);
+ } catch (Exception e) {
+ errors++;
+ System.err.println("Method " + methodName + " not found.");
+ }
+ }
+ }
+
+
+ static void testWildcards() {
+ System.err.println("Testing wildcards");
+ // public @AnnotType(10) Set<? extends Number> fooNumberSet() {return null;}
+ // public @AnnotType(11) Set<@AnnotType(13) ? extends Number> fooNumberSet2() {return null;}
+ AnnotatedWildcardType awt1 = extractWildcard("fooNumberSet");
+ AnnotatedWildcardType awt2 = extractWildcard("fooNumberSet2");
+
+ if (!awt1.equals(extractWildcard("fooNumberSet")) ||
+ !awt2.equals(extractWildcard("fooNumberSet2"))) {
+ errors++;
+ System.err.println("Bad equality comparison on wildcards.");
+ }
+
+ checkTypesForEquality(awt1, awt2, false);
+
+ if (awt2.getAnnotations().length == 0) {
+ errors++;
+ System.err.println("Expected annotations not found.");
+ }
+ }
+
+ private static AnnotatedWildcardType extractWildcard(String methodName) {
+ try {
+ return (AnnotatedWildcardType)
+ (((AnnotatedParameterizedType)(AnnotatedTypeHost.class.getMethod(methodName).
+ getAnnotatedReturnType())).
+ getAnnotatedActualTypeArguments()[0] );
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // The TypeHost and AnnotatedTypeHost classes declare methods with
+ // the same name and signatures but with the AnnotatedTypeHost
+ // methods having annotations on their return type, where
+ // possible.
+
+ static class TypeHost<E, F extends Number> {
+ public void fooVoid() {return;}
+
+ public int foo() {return 0;}
+ public String fooString() {return null;}
+
+ public int[] fooIntArray() {return null;}
+ public String[] fooStringArray() {return null;}
+ public String [][] fooStringArrayArray() {return null;}
+
+ public Set<String> fooSetString() {return null;}
+ public E fooE() {return null;}
+ public F fooF() {return null;}
+ public <G> G fooG() {return null;}
+
+ public Set<? extends Number> fooNumberSet() {return null;}
+ public Set<? extends Integer> fooNumberSet2() {return null;}
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_USE)
+ static @interface AnnotType {
+ int value() default 0;
+ }
+
+ static class AnnotatedTypeHost<E, F extends Number> {
+ public /*@AnnotType(0)*/ void fooVoid() {return;} // Illegal to annotate void
+
+ public @AnnotType(1) int foo() {return 0;}
+ public @AnnotType(2) String fooString() {return null;}
+
+ public int @AnnotType(3) [] fooIntArray() {return null;}
+ public String @AnnotType(4) [] fooStringArray() {return null;}
+ public @AnnotType(5) String @AnnotType(0) [] @AnnotType(1) [] fooStringArrayArray() {return null;}
+
+ public @AnnotType(6) Set<String> fooSetString() {return null;}
+ public @AnnotType(7) E fooE() {return null;}
+ public @AnnotType(8) F fooF() {return null;}
+ public @AnnotType(9) <G> G fooG() {return null;}
+
+ public @AnnotType(10) Set<? extends Number> fooNumberSet() {return null;}
+ public @AnnotType(11) Set<@AnnotType(13) ? extends Number> fooNumberSet2() {return null;}
+ }
+}
--- a/test/jdk/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 5086470 6358247 7193302
+ * @bug 5086470 6358247 7193302 8048215
* @summary Test type conversion when invoking ThreadMXBean.dumpAllThreads
* through proxy.
* @author Mandy Chung
@@ -45,6 +45,7 @@
private static ThreadMXBean mbean;
static Mutex mutex = new Mutex();
static Object lock = new Object();
+ static Object waiter = new Object();
static MyThread thread = new MyThread();
public static void main(String[] argv) throws Exception {
mbean = newPlatformMXBeanProxy(server,
@@ -68,6 +69,12 @@
}
}
+ // 'thread' holds the mutex, which means it must also have the monitor of
+ // 'waiter' at least until it does the wait(). So we acquire the monitor of
+ // 'waiter' here, which ensures that 'thread' must be in wait()
+ synchronized(waiter) {
+ }
+
long[] ids = new long[] { thread.getId() };
// validate the local access
@@ -108,11 +115,10 @@
}
public void run() {
synchronized (lock) {
- mutex.lock();
- Object o = new Object();
- synchronized(o) {
+ synchronized(waiter) {
+ mutex.lock();
try {
- o.wait();
+ waiter.wait();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
--- a/test/jdk/java/lang/module/AutomaticModulesTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/module/AutomaticModulesTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,9 +23,10 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
- * @build AutomaticModulesTest ModuleUtils
+ * @library /test/lib
+ * @build AutomaticModulesTest
* jdk.test.lib.util.JarUtils
+ * jdk.test.lib.util.ModuleUtils
* @run testng AutomaticModulesTest
* @summary Basic tests for automatic modules
*/
@@ -50,6 +51,7 @@
import java.util.stream.Stream;
import jdk.test.lib.util.JarUtils;
+import jdk.test.lib.util.ModuleUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
--- a/test/jdk/java/lang/module/ConfigurationTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/module/ConfigurationTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,10 +23,11 @@
/**
* @test
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.misc
* java.base/jdk.internal.module
- * @build ConfigurationTest ModuleUtils
+ * @build ConfigurationTest
+ * jdk.test.lib.util.ModuleUtils
* @run testng ConfigurationTest
* @summary Basic tests for java.lang.module.Configuration
*/
@@ -47,6 +48,8 @@
import java.util.Optional;
import java.util.Set;
+import jdk.test.lib.util.ModuleUtils;
+
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.ModuleInfoWriter;
import jdk.internal.module.ModuleTarget;
--- a/test/jdk/java/lang/reflect/callerCache/AccessTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/reflect/callerCache/AccessTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -149,4 +149,11 @@
super("privateStaticFinalField");
}
}
+
+ public static class NewInstance implements Callable<Object> {
+ public Object call() throws Exception {
+ return Members.class.newInstance();
+ }
+ }
+
}
--- a/test/jdk/java/lang/reflect/callerCache/ReflectionCallerCacheTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/lang/reflect/callerCache/ReflectionCallerCacheTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -77,7 +77,8 @@
{ "AccessTest$PublicFinalField"},
{ "AccessTest$PrivateFinalField"},
{ "AccessTest$PublicStaticFinalField"},
- { "AccessTest$PrivateStaticFinalField"}
+ { "AccessTest$PrivateStaticFinalField"},
+ { "AccessTest$NewInstance"}
};
}
--- a/test/jdk/java/net/BindException/Test.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/BindException/Test.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,9 +26,15 @@
* @bug 4417734
* @key intermittent
* @summary Test that we get a BindException in all expected combinations
+ * @library /test/lib
+ * @build jdk.test.lib.NetworkConfiguration
+ * jdk.test.lib.Platform
+ * @run main Test -d
*/
+
import java.net.*;
import java.util.Enumeration;
+import jdk.test.lib.NetworkConfiguration;
public class Test {
@@ -106,6 +112,7 @@
} catch (BindException be) {
gotBindException = true;
+ failed_exc = be;
} catch (Exception e) {
failed = true;
failed_exc = e;
@@ -152,6 +159,7 @@
if (!failed) {
if (gotBindException) {
System.out.println("Got expected BindException - test passed!");
+ failed_exc.printStackTrace(System.out);
} else {
System.out.println("No BindException as expected - test passed!");
}
@@ -160,6 +168,7 @@
}
if (gotBindException) {
System.out.println("BindException unexpected - test failed!!!");
+ failed_exc.printStackTrace(System.out);
} else {
System.out.println("No bind failure as expected - test failed!!!");
}
@@ -206,6 +215,11 @@
*/
InetAddress addrs[] = { ia4_this, ia6_this };
+ if (!silent) {
+ System.out.println("Using ia4_this:" + ia4_this);
+ System.out.println("Using ia6_this:" + ia6_this);
+ }
+
Object tests[][] = getTestCombinations();
for (int i=0; i<tests.length; i++) {
@@ -227,6 +241,9 @@
System.out.println(count + " test(s) executed. " + failures + " failure(s).");
if (failures > 0) {
+ System.err.println("********************************");
+ NetworkConfiguration.printSystemConfiguration(System.err);
+ System.out.println("********************************");
throw new Exception(failures + " tests(s) failed - see log");
}
}
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -35,12 +35,12 @@
/*
* @test
* @bug 8169415
- * @library /lib/testlibrary/
+ * @library /test/lib
* @modules java.logging
* java.base/sun.net.www
* java.base/sun.net.www.protocol.http
* jdk.httpserver/sun.net.httpserver
- * @build jdk.testlibrary.SimpleSSLContext HTTPTest HTTPTestServer HTTPTestClient HTTPSetAuthenticatorTest
+ * @build jdk.test.lib.net.SimpleSSLContext HTTPTest HTTPTestServer HTTPTestClient HTTPSetAuthenticatorTest
* @summary A simple HTTP test that starts an echo server supporting the given
* authentication scheme, then starts a regular HTTP client to invoke it.
* The client first does a GET request on "/", then follows on
--- a/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/HttpURLConnection/SetAuthenticator/HTTPTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -41,16 +41,16 @@
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/*
* @test
* @bug 8169415
- * @library /lib/testlibrary/
+ * @library /test/lib
* @modules java.logging
* java.base/sun.net.www
* jdk.httpserver/sun.net.httpserver
- * @build jdk.testlibrary.SimpleSSLContext HTTPTest HTTPTestServer HTTPTestClient
+ * @build jdk.test.lib.net.SimpleSSLContext HTTPTest HTTPTestServer HTTPTestClient
* @summary A simple HTTP test that starts an echo server supporting Digest
* authentication, then starts a regular HTTP client to invoke it.
* The client first does a GET request on "/", then follows on
--- a/test/jdk/java/net/Socket/CloseAvailable.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/Socket/CloseAvailable.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4091859
+ * @bug 4091859 8189366
* @summary Test Socket.available()
* @run main CloseAvailable
* @run main/othervm -Djava.net.preferIPv4Stack=true CloseAvailable
@@ -33,18 +33,32 @@
import java.io.*;
-public class CloseAvailable implements Runnable {
- static ServerSocket ss;
- static InetAddress addr;
- static int port;
+public class CloseAvailable {
public static void main(String[] args) throws Exception {
+ testClose();
+
+ testEOF(true);
+ testEOF(false);
+ }
+
+ static void testClose() throws IOException {
boolean error = true;
- addr = InetAddress.getLocalHost();
- ss = new ServerSocket(0);
- port = ss.getLocalPort();
+ InetAddress addr = InetAddress.getLocalHost();
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
- Thread t = new Thread(new CloseAvailable());
+ Thread t = new Thread(new Thread("Close-Available-1") {
+ public void run() {
+ try {
+ Socket s = new Socket(addr, port);
+ s.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
t.start();
Socket soc = ss.accept();
@@ -63,13 +77,42 @@
throw new RuntimeException("Available() can be called after stream closed.");
}
- public void run() {
- try {
- Socket s = new Socket(addr, port);
- s.close();
- } catch (Exception e) {
- e.printStackTrace();
+ // Verifies consistency of `available` behaviour when EOF reached, both
+ // explicitly and implicitly.
+ static void testEOF(boolean readUntilEOF) throws IOException {
+ System.out.println("testEOF, readUntilEOF: " + readUntilEOF);
+ InetAddress addr = InetAddress.getLoopbackAddress();
+ ServerSocket ss = new ServerSocket();
+ ss.bind(new InetSocketAddress(addr, 0), 0);
+ int port = ss.getLocalPort();
+
+ try (Socket s = new Socket(addr, port)) {
+ s.getOutputStream().write(0x42);
+ s.shutdownOutput();
+
+ try (Socket soc = ss.accept()) {
+ ss.close();
+
+ InputStream is = soc.getInputStream();
+ int b = is.read();
+ assert b == 0x42;
+ assert !s.isClosed();
+ if (readUntilEOF) {
+ b = is.read();
+ assert b == -1;
+ }
+
+ int a;
+ for (int i = 0; i < 100; i++) {
+ a = is.available();
+ System.out.print(a + ", ");
+ if (a != 0)
+ throw new RuntimeException("Unexpected non-zero available: " + a);
+ }
+ assert !s.isClosed();
+ assert is.read() == -1;
+ }
}
+ System.out.println("\ncomplete");
}
-
}
--- a/test/jdk/java/net/URLPermission/URLTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/URLPermission/URLTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -26,8 +26,8 @@
* @test
* @bug 8010464
* @modules jdk.httpserver
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm URLTest
* @summary check URLPermission with Http(s)URLConnection
*/
@@ -38,7 +38,7 @@
import java.util.concurrent.*;
import com.sun.net.httpserver.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class URLTest {
--- a/test/jdk/java/net/httpclient/AbstractNoBody.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AbstractNoBody.java Tue Oct 16 14:26:22 2018 +0530
@@ -35,7 +35,7 @@
import com.sun.net.httpserver.HttpsServer;
import java.net.http.HttpClient;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,7 +24,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
@@ -35,7 +35,7 @@
* @run testng/othervm -Djdk.internal.httpclient.debug=true AbstractThrowingPushPromises
*/
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,7 +24,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/AsFileDownloadTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build jdk.test.lib.Platform
* @build jdk.test.lib.util.FileUtils
* @run testng/othervm AsFileDownloadTest
@@ -67,7 +67,7 @@
import java.util.Locale;
import java.util.Map;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import jdk.test.lib.util.FileUtils;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/AsFileDownloadTest.policy Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.policy Tue Oct 16 14:26:22 2018 +0530
@@ -21,10 +21,10 @@
// questions.
//
-// for JTwork/classes/0/lib/testlibrary/jdk/testlibrary/SimpleSSLContext.class
-grant codeBase "file:${test.classes}/../../../../lib/testlibrary/-" {
+// for JTwork/classes/0/test/lib/jdk/test/lib/net/SimpleSSLContext.class
+grant codeBase "file:${test.classes}/../../../../test/lib/-" {
permission java.util.PropertyPermission "test.src.path", "read";
- permission java.io.FilePermission "${test.src}/../../../lib/testlibrary/jdk/testlibrary/testkeys", "read";
+ permission java.io.FilePermission "${test.src}/../../../../lib/jdk/test/lib/net/testkeys", "read";
};
// for JTwork//classes/0/java/net/httpclient/http2/server/*
--- a/test/jdk/java/net/httpclient/BasicRedirectTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/BasicRedirectTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -30,9 +30,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
* BasicRedirectTest
@@ -53,7 +53,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/CancelledResponse.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/CancelledResponse.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,7 +26,7 @@
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLContext;
@@ -55,9 +55,9 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.net.http/jdk.internal.net.http.common
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer ReferenceTracker
* @run main/othervm CancelledResponse
* @run main/othervm CancelledResponse SSL
--- a/test/jdk/java/net/httpclient/ConcurrentResponses.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ConcurrentResponses.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,9 +32,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=headers,errors,channel
* ConcurrentResponses
@@ -67,7 +67,7 @@
import java.net.http.HttpResponse.BodyHandlers;
import java.net.http.HttpResponse.BodySubscriber;
import java.net.http.HttpResponse.BodySubscribers;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/CookieHeaderTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/CookieHeaderTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.tls.acknowledgeCloseNotify=true
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
@@ -43,7 +43,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/CustomRequestPublisher.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/CustomRequestPublisher.java Tue Oct 16 14:26:22 2018 +0530
@@ -30,9 +30,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm CustomRequestPublisher
*/
@@ -62,7 +62,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/CustomResponseSubscriber.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/CustomResponseSubscriber.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @summary Tests response body subscribers's onComplete is not invoked before onSubscribe
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -57,7 +57,7 @@
import java.net.http.HttpResponse.BodySubscriber;
import java.net.http.HttpResponse.BodySubscribers;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/DependentActionsTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/DependentActionsTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @summary Verify that dependent synchronous actions added before the CF
* completes are executed either asynchronously in an executor when the
* CF later completes, or in the user thread that joins.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters DependentActionsTest
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DependentActionsTest
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -43,7 +43,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @summary Verify that dependent synchronous actions added before the promise CF
* completes are executed either asynchronously in an executor when the
* CF later completes, or in the user thread that joins.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters DependentPromiseActionsTest
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DependentPromiseActionsTest
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -40,7 +40,7 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StackWalker.StackFrame;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/DigestEchoClient.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/DigestEchoClient.java Tue Oct 16 14:26:22 2018 +0530
@@ -51,7 +51,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import sun.net.NetProperties;
import sun.net.www.HeaderParser;
import static java.lang.System.out;
@@ -62,8 +62,8 @@
* @summary this test verifies that a client may provides authorization
* headers directly when connecting with a server.
* @bug 8087112
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters DigestEchoServer
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer
* ReferenceTracker DigestEchoClient
* @modules java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/DigestEchoClientSSL.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/DigestEchoClientSSL.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @bug 8087112
* @summary this test verifies that a client may provides authorization
* headers directly when connecting with a server over SSL.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext DigestEchoServer
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer
* DigestEchoClient ReferenceTracker DigestEchoClientSSL
* @modules java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/EchoHandler.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/EchoHandler.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,7 +32,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.net.http.HttpRequest.*;
import static java.net.http.HttpResponse.*;
import java.util.logging.ConsoleHandler;
--- a/test/jdk/java/net/httpclient/EncodedCharsInURI.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/EncodedCharsInURI.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @bug 8199683
* @summary Tests that escaped characters in URI are correctly
* handled (not re-escaped and not unescaped)
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters EncodedCharsInURI
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters EncodedCharsInURI
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -42,7 +42,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/EscapedOctetsInURI.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/EscapedOctetsInURI.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=reqeusts,headers
* EscapedOctetsInURI
@@ -58,7 +58,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ExpectContinue.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ExpectContinue.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @summary Basic test for Expect 100-Continue ( HTTP/1.1 only )
* @modules java.net.http
* jdk.httpserver
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm ExpectContinue
*/
@@ -49,7 +49,7 @@
import java.net.http.HttpResponse.BodyHandlers;
import java.util.List;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -43,7 +43,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -67,9 +67,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm FlowAdapterPublisherTest
*/
--- a/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -48,7 +48,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.net.http.HttpResponse.BodySubscribers;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -68,9 +68,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -Djdk.internal.httpclient.debug=true FlowAdapterSubscriberTest
*/
--- a/test/jdk/java/net/httpclient/HeadTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/HeadTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
* HeadTest
@@ -42,7 +42,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/HttpClientBuilderTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/HttpClientBuilderTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -48,7 +48,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpClient.Redirect;
import java.net.http.HttpClient.Version;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.Test;
import static java.time.Duration.*;
import static org.testng.Assert.*;
@@ -56,8 +56,8 @@
/*
* @test
* @summary HttpClient[.Builder] API and behaviour checks
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng HttpClientBuilderTest
*/
--- a/test/jdk/java/net/httpclient/HttpEchoHandler.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/HttpEchoHandler.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,7 +32,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.net.http.HttpRequest.*;
import static java.net.http.HttpResponse.*;
import java.util.logging.ConsoleHandler;
--- a/test/jdk/java/net/httpclient/HttpsTunnelTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/HttpsTunnelTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,7 +23,7 @@
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import javax.net.ssl.SSLContext;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -49,8 +49,8 @@
* be preemptively downgraded. That, is the stack should attempt
* a new h2 connection to the new host.
* @bug 8196967
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpsTunnelTest
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpsTunnelTest
* @modules java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
* java.net.http/jdk.internal.net.http.hpack
--- a/test/jdk/java/net/httpclient/ImmutableFlowItems.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ImmutableFlowItems.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests response body subscribers's onNext's Lists are unmodifiable,
* and that the buffers are read-only
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -57,7 +57,7 @@
import java.net.http.HttpResponse.BodySubscriber;
import java.net.http.HttpResponse.BodySubscribers;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @summary Tests an asynchronous BodySubscriber that completes
* immediately with an InputStream which issues bad
* requests
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext ReferenceTracker
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -38,7 +38,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/InvalidSSLContextTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/InvalidSSLContextTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Test to ensure the HTTP client throws an appropriate SSL exception
* when SSL context is not valid.
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -Djdk.internal.httpclient.debug=true InvalidSSLContextTest
*/
@@ -47,7 +47,7 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,8 +27,8 @@
* @summary Tests an asynchronous BodySubscriber that completes
* immediately with a Publisher<List<ByteBuffer>> whose
* subscriber issues bad requests
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext ReferenceTracker
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -39,7 +39,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/LightWeightHttpServer.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/LightWeightHttpServer.java Tue Oct 16 14:26:22 2018 +0530
@@ -22,8 +22,8 @@
*/
/**
- * library /lib/testlibrary/ /
- * build jdk.testlibrary.SimpleSSLContext ProxyServer
+ * library /test/lib /
+ * build jdk.test.lib.net.SimpleSSLContext ProxyServer
* compile ../../../com/sun/net/httpserver/LogFilter.java
* compile ../../../com/sun/net/httpserver/EchoHandler.java
* compile ../../../com/sun/net/httpserver/FileServerHandler.java
@@ -50,7 +50,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class LightWeightHttpServer {
--- a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -52,7 +52,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -77,9 +77,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer LineBodyHandlerTest HttpServerAdapters
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm LineBodyHandlerTest
*/
--- a/test/jdk/java/net/httpclient/ManyRequests.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ManyRequests.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,8 +27,8 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
@@ -63,7 +63,7 @@
import java.util.logging.Level;
import java.util.concurrent.CompletableFuture;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class ManyRequests {
--- a/test/jdk/java/net/httpclient/ManyRequests2.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ManyRequests2.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -27,8 +27,8 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
@@ -36,8 +36,11 @@
* @run main/othervm/timeout=40 -Dtest.XFixed=true ManyRequests2
* @run main/othervm/timeout=40 -Dtest.XFixed=true -Dtest.insertDelay=true ManyRequests2
* @run main/othervm/timeout=40 -Dtest.XFixed=true -Dtest.chunkSize=64 ManyRequests2
- * @run main/othervm/timeout=40 -Djdk.internal.httpclient.debug=true -Dtest.XFixed=true -Dtest.insertDelay=true -Dtest.chunkSize=64 ManyRequests2
- * @summary Send a large number of requests asynchronously. The server echoes back using known content length.
+ * @run main/othervm/timeout=40 -Djdk.internal.httpclient.debug=true
+ * -Dtest.XFixed=true -Dtest.insertDelay=true
+ * -Dtest.chunkSize=64 ManyRequests2
+ * @summary Send a large number of requests asynchronously.
+ * The server echoes back using known content length.
*/
// * @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl ManyRequests
--- a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,16 +26,19 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
* @run main/othervm/timeout=40 ManyRequestsLegacy
* @run main/othervm/timeout=40 -Dtest.insertDelay=true ManyRequestsLegacy
* @run main/othervm/timeout=40 -Dtest.chunkSize=64 ManyRequestsLegacy
- * @run main/othervm/timeout=40 -Dtest.insertDelay=true -Dtest.chunkSize=64 ManyRequestsLegacy
- * @summary Send a large number of requests asynchronously using the legacy URL.openConnection(), to help sanitize results of the test ManyRequest.java.
+ * @run main/othervm/timeout=40 -Dtest.insertDelay=true
+ * -Dtest.chunkSize=64 ManyRequestsLegacy
+ * @summary Send a large number of requests asynchronously using the legacy
+ * URL.openConnection(), to help sanitize results of the test
+ * ManyRequest.java.
*/
import javax.net.ssl.HttpsURLConnection;
@@ -70,7 +73,7 @@
import java.util.Random;
import java.util.logging.Logger;
import java.util.logging.Level;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class ManyRequestsLegacy {
--- a/test/jdk/java/net/httpclient/MappingResponseSubscriber.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/MappingResponseSubscriber.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @summary Tests mapped response subscriber
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -62,7 +62,7 @@
import java.net.http.HttpResponse.BodySubscriber;
import java.util.function.Function;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/MaxStreams.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/MaxStreams.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,9 +32,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -ea -esa MaxStreams
*/
@@ -60,7 +60,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandler;
import java.net.http.HttpResponse.BodyHandlers;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/NoBodyPartOne.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/NoBodyPartOne.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @bug 8161157
* @summary Test response body handlers/subscribers when there is no body
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/NoBodyPartTwo.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/NoBodyPartTwo.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @bug 8161157
* @summary Test response body handlers/subscribers when there is no body
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,9 +32,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile -encoding utf-8 NonAsciiCharsInURI.java
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=reqeusts,headers
@@ -58,7 +58,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java Tue Oct 16 14:26:22 2018 +0530
@@ -28,8 +28,8 @@
* it verifies that the client honor the jdk.http.auth.*.disabledSchemes
* net properties.
* @bug 8087112
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext DigestEchoServer DigestEchoClient
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer DigestEchoClient
* ReferenceTracker ProxyAuthDisabledSchemes
* @modules java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java Tue Oct 16 14:26:22 2018 +0530
@@ -28,8 +28,8 @@
* headers directly when connecting with a server over SSL, and
* it verifies that the client honor the jdk.http.auth.*.disabledSchemes
* net properties.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext DigestEchoServer DigestEchoClient
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer DigestEchoClient
* ReferenceTracker ProxyAuthDisabledSchemesSSL
* @modules java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/ProxyTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ProxyTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -56,7 +56,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/**
* @test
@@ -67,8 +67,8 @@
* an SSL Tunnel connection when the client is HTTP/2 and the server
* and proxy are HTTP/1.1
* @modules java.net.http
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext ProxyTest
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext ProxyTest
* @run main/othervm ProxyTest
* @author danielfuchs
*/
--- a/test/jdk/java/net/httpclient/RedirectMethodChange.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RedirectMethodChange.java Tue Oct 16 14:26:22 2018 +0530
@@ -29,9 +29,9 @@
* java.net.http/jdk.internal.net.http.frame
* java.net.http/jdk.internal.net.http.hpack
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm RedirectMethodChange
*/
@@ -50,7 +50,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/RedirectWithCookie.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RedirectWithCookie.java Tue Oct 16 14:26:22 2018 +0530
@@ -30,9 +30,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
* RedirectWithCookie
@@ -55,7 +55,7 @@
import java.net.http.HttpResponse.BodyHandlers;
import java.util.List;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/RequestBodyTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RequestBodyTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,11 +27,11 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/ /test/lib
+ * @library /test/lib
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build LightWeightHttpServer
* @build jdk.test.lib.Platform
* @build jdk.test.lib.util.FileUtils
--- a/test/jdk/java/net/httpclient/RequestBodyTest.policy Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RequestBodyTest.policy Tue Oct 16 14:26:22 2018 +0530
@@ -27,10 +27,10 @@
permission java.io.FilePermission "RequestBodyTest.tmp", "read,delete";
};
-// for JTwork/classes/0/lib/testlibrary/jdk/testlibrary/SimpleSSLContext.class
-grant codeBase "file:${test.classes}/../../../../lib/testlibrary/-" {
+// for JTwork/classes/0/test/lib/jdk/test/lib/net/SimpleSSLContext.class
+grant codeBase "file:${test.classes}/../../../../test/lib/-" {
permission java.util.PropertyPermission "test.src.path", "read";
- permission java.io.FilePermission "${test.src}/../../../lib/testlibrary/jdk/testlibrary/testkeys", "read";
+ permission java.io.FilePermission "${test.src}/../../../../lib/jdk/test/lib/net/testkeys", "read";
};
grant codeBase "file:${test.classes}/*" {
--- a/test/jdk/java/net/httpclient/RequestBuilderTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RequestBuilderTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -337,15 +337,31 @@
}
}
+ // headers that are allowed now, but weren't before
+ private static final Set<String> FORMERLY_RESTRICTED = Set.of("referer", "origin",
+ "OriGin", "Referer");
+
+ @Test
+ public void testFormerlyRestricted() throws URISyntaxException {
+ URI uri = new URI("http://localhost:80/test/");
+ URI otherURI = new URI("http://www.foo.com/test/");
+ for (String header : FORMERLY_RESTRICTED) {
+ HttpRequest req = HttpRequest.newBuilder(uri)
+ .header(header, otherURI.toString())
+ .GET()
+ .build();
+ }
+ }
+
private static final Set<String> RESTRICTED = Set.of("connection", "content-length",
- "date", "expect", "from", "host", "origin",
- "referer", "upgrade", "via", "warning",
+ "date", "expect", "from", "host",
+ "upgrade", "via", "warning",
"Connection", "Content-Length",
- "DATE", "eXpect", "frOm", "hosT", "origIN",
- "ReFerer", "upgradE", "vIa", "Warning",
+ "DATE", "eXpect", "frOm", "hosT",
+ "upgradE", "vIa", "Warning",
"CONNection", "CONTENT-LENGTH",
- "Date", "EXPECT", "From", "Host", "Origin",
- "Referer", "Upgrade", "Via", "WARNING");
+ "Date", "EXPECT", "From", "Host",
+ "Upgrade", "Via", "WARNING");
interface WithHeader {
HttpRequest.Builder withHeader(HttpRequest.Builder builder, String name, String value);
--- a/test/jdk/java/net/httpclient/ResponseBodyBeforeError.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ResponseBodyBeforeError.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests that all response body is delivered to the BodySubscriber
* before an abortive error terminates the flow
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm ResponseBodyBeforeError
*/
@@ -52,7 +52,7 @@
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Flow;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ResponsePublisher.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ResponsePublisher.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,8 +26,8 @@
* @bug 8201186
* @summary Tests an asynchronous BodySubscriber that completes
* immediately with a Publisher<List<ByteBuffer>>
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -40,7 +40,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/RetryWithCookie.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/RetryWithCookie.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext ReferenceTracker
+ * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
* RetryWithCookie
@@ -42,7 +42,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ServerCloseTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ServerCloseTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests that our client deals correctly with servers that
* close the connection right after sending the last byte.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters EncodedCharsInURI
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters EncodedCharsInURI
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -35,7 +35,7 @@
*/
//* -Djdk.internal.httpclient.debug=true
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/net/httpclient/ShortResponseBody.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ShortResponseBody.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests Exception detail message when too few response bytes are
* received before a socket exception or eof.
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=headers,errors,channel
* ShortResponseBody
@@ -55,7 +55,7 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Stream;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ShortResponseBodyWithRetry.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ShortResponseBodyWithRetry.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @summary Run of ShortResponseBody with -Djdk.httpclient.enableAllMethodRetry
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build ShortResponseBody
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=headers,errors,channel
--- a/test/jdk/java/net/httpclient/SmokeTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SmokeTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,8 +27,8 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext ProxyServer
+ * @library /test/lib /
+ * @build jdk.test.lib.net.SimpleSSLContext ProxyServer
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
@@ -88,7 +88,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;
--- a/test/jdk/java/net/httpclient/SpecialHeadersTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SpecialHeadersTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -32,9 +32,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer HttpServerAdapters SpecialHeadersTest
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=requests,headers,errors
* SpecialHeadersTest
@@ -43,7 +43,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -57,21 +57,25 @@
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Optional;
import static java.lang.System.err;
import static java.lang.System.out;
import static java.net.http.HttpClient.Builder.NO_PROXY;
import static java.nio.charset.StandardCharsets.US_ASCII;
+import org.testng.Assert;
import static org.testng.Assert.assertEquals;
public class SpecialHeadersTest implements HttpServerAdapters {
@@ -91,6 +95,13 @@
{"User-Agent: camel-cased"},
{"user-agent: all-lower-case"},
{"user-Agent: mixed"},
+ // headers which were restricted before and are now allowable
+ {"referer: lower"},
+ {"Referer: normal"},
+ {"REFERER: upper"},
+ {"origin: lower"},
+ {"Origin: normal"},
+ {"ORIGIN: upper"},
};
@DataProvider(name = "variants")
@@ -169,6 +180,50 @@
}
@Test(dataProvider = "variants")
+ void testHomeMadeIllegalHeader(String uriString, String headerNameAndValue, boolean sameClient) throws Exception {
+ out.println("\n--- Starting ");
+ final URI uri = URI.create(uriString);
+
+ HttpClient client = HttpClient.newBuilder()
+ .proxy(NO_PROXY)
+ .sslContext(sslContext)
+ .build();
+
+ // Test a request which contains an illegal header created
+ HttpRequest req = new HttpRequest() {
+ @Override public Optional<BodyPublisher> bodyPublisher() {
+ return Optional.of(BodyPublishers.noBody());
+ }
+ @Override public String method() {
+ return "GET";
+ }
+ @Override public Optional<Duration> timeout() {
+ return Optional.empty();
+ }
+ @Override public boolean expectContinue() {
+ return false;
+ }
+ @Override public URI uri() {
+ return uri;
+ }
+ @Override public Optional<HttpClient.Version> version() {
+ return Optional.empty();
+ }
+ @Override public HttpHeaders headers() {
+ Map<String, List<String>> map = Map.of("via", List.of("http://foo.com"));
+ return HttpHeaders.of(map, (x, y) -> true);
+ }
+ };
+
+ try {
+ HttpResponse<String> response = client.send(req, BodyHandlers.ofString());
+ Assert.fail("Unexpected reply: " + response);
+ } catch (IllegalArgumentException ee) {
+ out.println("Got IAE as expected");
+ }
+ }
+
+ @Test(dataProvider = "variants")
void testAsync(String uriString, String headerNameAndValue, boolean sameClient) {
out.println("\n--- Starting ");
int index = headerNameAndValue.indexOf(":");
@@ -259,7 +314,10 @@
https2TestServer.stop();
}
- /** A handler that returns, as its body, the exact received request URI. */
+ /** A handler that returns, as its body, the exact received request URI.
+ * The header whose name is in the URI query and is set in the request is
+ * returned in the response with its name prefixed by X-
+ */
static class HttpUriStringHandler implements HttpTestHandler {
@Override
public void handle(HttpTestExchange t) throws IOException {
--- a/test/jdk/java/net/httpclient/SplitResponse.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponse.java Tue Oct 16 14:26:22 2018 +0530
@@ -40,7 +40,7 @@
import java.net.http.HttpResponse;
import java.util.stream.Stream;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.lang.System.out;
import static java.lang.String.format;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
@@ -49,8 +49,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseKeepAlive.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseKeepAlive.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseKeepAliveAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseKeepAliveAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseSSL.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseSSL.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseSSLAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseSSLAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseSSLKeepAlive.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseSSLKeepAlive.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/SplitResponseSSLKeepAliveAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/SplitResponseSSLKeepAliveAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @bug 8087112
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @build MockServer SplitResponse
* @run main/othervm
* -Djdk.internal.httpclient.debug=true
--- a/test/jdk/java/net/httpclient/StreamingBody.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/StreamingBody.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,9 +31,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=trace,headers,requests
* StreamingBody
@@ -53,7 +53,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomAfterCancel
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomBeforeCancel
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOAfterCancel
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOBeforeCancel
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInNextRequest
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInRequest
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInSubscribe
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when request publishers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersSanity
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamCustom
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamIO
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesCustom
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesIO
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringCustom
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringIO
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when push promise handlers and their
* response body handlers and subscribers throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesSanity
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsInputStream AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsInputStreamAsync AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsLines AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsLinesAsync AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsString AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersAsStringAsync AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @summary Tests what happens when response body handlers and subscribers
* throw unexpected exceptions.
- * @library /lib/testlibrary http2/server
- * @build jdk.testlibrary.SimpleSSLContext HttpServerAdapters
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters
* ReferenceTracker ThrowingSubscribersSanity AbstractThrowingSubscribers
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
--- a/test/jdk/java/net/httpclient/TimeoutBasic.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/TimeoutBasic.java Tue Oct 16 14:26:22 2018 +0530
@@ -31,7 +31,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.net.http.HttpTimeoutException;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLContext;
@@ -46,8 +46,8 @@
/**
* @test
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @summary Basic tests for response timeouts
* @run main/othervm TimeoutBasic
*/
--- a/test/jdk/java/net/httpclient/UnauthorizedTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/UnauthorizedTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -35,9 +35,9 @@
* java.net.http/jdk.internal.net.http.hpack
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary /test/lib http2/server
+ * @library /test/lib http2/server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm
* -Djdk.httpclient.HttpClient.log=headers
* UnauthorizedTest
@@ -46,7 +46,7 @@
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/UnknownBodyLengthTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/UnknownBodyLengthTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -35,13 +35,13 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
/**
* @test
* @bug 8207966
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest plain false
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest SSL false
* @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true UnknownBodyLengthTest plain true
--- a/test/jdk/java/net/httpclient/dependent.policy Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/dependent.policy Tue Oct 16 14:26:22 2018 +0530
@@ -21,10 +21,10 @@
// questions.
//
-// for JTwork/classes/0/lib/testlibrary/jdk/testlibrary/SimpleSSLContext.class
-grant codeBase "file:${test.classes}/../../../../lib/testlibrary/-" {
+// for JTwork/classes/0/test/lib/jdk/test/lib/net/SimpleSSLContext.class
+grant codeBase "file:${test.classes}/../../../../test/lib/-" {
permission java.util.PropertyPermission "test.src.path", "read";
- permission java.io.FilePermission "${test.src}/../../../lib/testlibrary/jdk/testlibrary/testkeys", "read";
+ permission java.io.FilePermission "${test.src}/../../../../lib/jdk/test/lib/net/testkeys", "read";
};
// for JTwork//classes/0/java/net/httpclient/http2/server/*
--- a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,9 +27,9 @@
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
* java.net.http/jdk.internal.net.http.hpack
- * @library /lib/testlibrary server
+ * @library /test/lib server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest
*/
@@ -38,7 +38,7 @@
import jdk.internal.net.http.frame.HeaderFrame;
import jdk.internal.net.http.frame.HeadersFrame;
import jdk.internal.net.http.frame.Http2Frame;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/http2/BasicTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/BasicTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8087112
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -47,7 +47,7 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.Test;
import static java.net.http.HttpClient.Version.HTTP_2;
--- a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -28,9 +28,9 @@
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
* java.net.http/jdk.internal.net.http.hpack
- * @library /lib/testlibrary server
+ * @library /test/lib server
* @build Http2TestServer
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run testng/othervm ContinuationFrameTest
*/
@@ -55,7 +55,7 @@
import jdk.internal.net.http.frame.HeaderFrame;
import jdk.internal.net.http.frame.HeadersFrame;
import jdk.internal.net.http.frame.Http2Frame;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/http2/ErrorTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ErrorTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8157105
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -46,7 +46,7 @@
import javax.net.ssl.SSLParameters;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.net.http.HttpClient.Version.HTTP_2;
import org.testng.annotations.Test;
--- a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8087112 8177935
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
@@ -40,7 +40,7 @@
import javax.net.ssl.*;
import java.nio.file.*;
import java.util.concurrent.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import static java.net.http.HttpClient.Version.HTTP_2;
import org.testng.annotations.Test;
--- a/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,8 +23,8 @@
/*
* @test
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/http2/ProxyTest2.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ProxyTest2.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -52,7 +52,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import java.util.concurrent.*;
/**
@@ -61,12 +61,12 @@
* @summary Verifies that you can access an HTTP/2 server over HTTPS by
* tunnelling through an HTTP/1.1 proxy.
* @modules java.net.http
- * @library /lib/testlibrary server
+ * @library /test/lib server
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
* java.net.http/jdk.internal.net.http.hpack
- * @build jdk.testlibrary.SimpleSSLContext ProxyTest2
+ * @build jdk.test.lib.net.SimpleSSLContext ProxyTest2
* @run main/othervm ProxyTest2
* @author danielfuchs
*/
--- a/test/jdk/java/net/httpclient/http2/RedirectTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/RedirectTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8156514
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/http2/ServerPush.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ServerPush.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8087112 8159814
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,8 +23,8 @@
/*
* @test
- * @library /lib/testlibrary server
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.base/sun.net.www.http
* java.net.http/jdk.internal.net.http.common
* java.net.http/jdk.internal.net.http.frame
--- a/test/jdk/java/net/httpclient/security/Driver.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/security/Driver.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,12 +24,11 @@
/*
* @test
* @bug 8087112
- * @library /lib/testlibrary/
* @library /test/lib
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @build jdk.testlibrary.SimpleSSLContext jdk.test.lib.Utils
+ * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.Utils
* @compile ../../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../../com/sun/net/httpserver/FileServerHandler.java
* @compile ../ProxyServer.java
--- a/test/jdk/java/net/httpclient/security/Security.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/security/Security.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,8 +27,8 @@
* @modules java.net.http
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile ../../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../../com/sun/net/httpserver/FileServerHandler.java
* @compile ../ProxyServer.java
--- a/test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,8 +24,8 @@
/*
* @test
* @summary Basic test for WebSocketHandshakeException
- * @library /lib/testlibrary
- * @build jdk.testlibrary.SimpleSSLContext
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
* @modules java.net.http
* jdk.httpserver
* @run testng/othervm -Djdk.internal.httpclient.debug=true WSHandshakeExceptionTest
@@ -39,7 +39,7 @@
import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.net.http.WebSocketHandshakeException;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/AbstractSSLTubeTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/AbstractSSLTubeTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -28,22 +28,13 @@
import jdk.internal.net.http.common.Utils;
import org.testng.annotations.Test;
-import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
-import javax.net.ssl.TrustManagerFactory;
-import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CompletableFuture;
@@ -244,76 +235,4 @@
engine.setUseClientMode(client);
return engine;
}
-
- /**
- * Creates a simple usable SSLContext for SSLSocketFactory or a HttpsServer
- * using either a given keystore or a default one in the test tree.
- *
- * Using this class with a security manager requires the following
- * permissions to be granted:
- *
- * permission "java.util.PropertyPermission" "test.src.path", "read";
- * permission java.io.FilePermission "${test.src}/../../../../lib/testlibrary/jdk/testlibrary/testkeys",
- * "read"; The exact path above depends on the location of the test.
- */
- protected static class SimpleSSLContext {
-
- private final SSLContext ssl;
-
- /**
- * Loads default keystore from SimpleSSLContext source directory
- */
- public SimpleSSLContext() throws IOException {
- String paths = System.getProperty("test.src.path");
- StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
- boolean securityExceptions = false;
- SSLContext sslContext = null;
- while (st.hasMoreTokens()) {
- String path = st.nextToken();
- try {
- File f = new File(path, "../../../../lib/testlibrary/jdk/testlibrary/testkeys");
- if (f.exists()) {
- try (FileInputStream fis = new FileInputStream(f)) {
- sslContext = init(fis);
- break;
- }
- }
- } catch (SecurityException e) {
- // catch and ignore because permission only required
- // for one entry on path (at most)
- securityExceptions = true;
- }
- }
- if (securityExceptions) {
- System.err.println("SecurityExceptions thrown on loading testkeys");
- }
- ssl = sslContext;
- }
-
- private SSLContext init(InputStream i) throws IOException {
- try {
- char[] passphrase = "passphrase".toCharArray();
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(i, passphrase);
-
- KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
- kmf.init(ks, passphrase);
-
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
- tmf.init(ks);
-
- SSLContext ssl = SSLContext.getInstance("TLS");
- ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- return ssl;
- } catch (KeyManagementException | KeyStoreException |
- UnrecoverableKeyException | CertificateException |
- NoSuchAlgorithmException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public SSLContext get() {
- return ssl;
- }
- }
}
--- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/FlowTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/FlowTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,8 +24,6 @@
package jdk.internal.net.http;
import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -33,12 +31,6 @@
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;
@@ -53,9 +45,7 @@
import java.util.concurrent.SubmissionPublisher;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.*;
-import javax.net.ssl.TrustManagerFactory;
import jdk.internal.net.http.common.Utils;
import org.testng.annotations.Test;
import jdk.internal.net.http.common.SSLFlowDelegate;
@@ -467,80 +457,6 @@
}
}
- /**
- * Creates a simple usable SSLContext for SSLSocketFactory
- * or a HttpsServer using either a given keystore or a default
- * one in the test tree.
- * <p>
- * Using this class with a security manager requires the following
- * permissions to be granted:
- * <p>
- * permission "java.util.PropertyPermission" "test.src.path", "read";
- * permission java.io.FilePermission
- * "${test.src}/../../../../lib/testlibrary/jdk/testlibrary/testkeys", "read";
- * The exact path above depends on the location of the test.
- */
- static class SimpleSSLContext {
-
- private final SSLContext ssl;
-
- /**
- * Loads default keystore from SimpleSSLContext source directory
- */
- public SimpleSSLContext() throws IOException {
- String paths = System.getProperty("test.src.path");
- StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
- boolean securityExceptions = false;
- SSLContext sslContext = null;
- while (st.hasMoreTokens()) {
- String path = st.nextToken();
- try {
- File f = new File(path, "../../../../lib/testlibrary/jdk/testlibrary/testkeys");
- if (f.exists()) {
- try (FileInputStream fis = new FileInputStream(f)) {
- sslContext = init(fis);
- break;
- }
- }
- } catch (SecurityException e) {
- // catch and ignore because permission only required
- // for one entry on path (at most)
- securityExceptions = true;
- }
- }
- if (securityExceptions) {
- System.out.println("SecurityExceptions thrown on loading testkeys");
- }
- ssl = sslContext;
- }
-
- private SSLContext init(InputStream i) throws IOException {
- try {
- char[] passphrase = "passphrase".toCharArray();
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(i, passphrase);
-
- KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
- kmf.init(ks, passphrase);
-
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
- tmf.init(ks);
-
- SSLContext ssl = SSLContext.getInstance("TLS");
- ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- return ssl;
- } catch (KeyManagementException | KeyStoreException |
- UnrecoverableKeyException | CertificateException |
- NoSuchAlgorithmException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public SSLContext get() {
- return ssl;
- }
- }
-
private static void sleep(int millis) {
try {
Thread.sleep(millis);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SimpleSSLContext.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+package jdk.internal.net.http;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.StringTokenizer;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+
+/**
+ * Creates a simple usable SSLContext for SSLSocketFactory
+ * or a HttpsServer using a default keystore in the test tree.
+ * <p>
+ * Using this class with a security manager requires the following
+ * permissions to be granted:
+ * <p>
+ * permission "java.util.PropertyPermission" "test.src.path", "read";
+ * permission java.io.FilePermission "/path/to/test/lib/jdk/test/lib/testkeys", "read";
+ * The exact path above depends on the location of the test.
+ */
+public class SimpleSSLContext {
+
+ private final SSLContext ssl;
+
+ /**
+ * Loads default keystore from SimpleSSLContext source directory
+ */
+ public SimpleSSLContext() throws IOException {
+ String paths = System.getProperty("test.src.path");
+ StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
+ boolean securityExceptions = false;
+ SSLContext sslContext = null;
+ while (st.hasMoreTokens()) {
+ String path = st.nextToken();
+ try {
+ File f = new File(path, "../../../../../lib/jdk/test/lib/net/testkeys");
+ if (f.exists()) {
+ try (FileInputStream fis = new FileInputStream(f)) {
+ sslContext = init(fis);
+ break;
+ }
+ }
+ } catch (SecurityException e) {
+ // catch and ignore because permission only required
+ // for one entry on path (at most)
+ securityExceptions = true;
+ }
+ }
+ if (securityExceptions) {
+ System.out.println("SecurityExceptions thrown on loading testkeys");
+ }
+ ssl = sslContext;
+ }
+
+ private SSLContext init(InputStream i) throws IOException {
+ try {
+ char[] passphrase = "passphrase".toCharArray();
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ ks.load(i, passphrase);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX");
+ kmf.init(ks, passphrase);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ SSLContext ssl = SSLContext.getInstance("TLS");
+ ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ return ssl;
+ } catch (KeyManagementException | KeyStoreException |
+ UnrecoverableKeyException | CertificateException |
+ NoSuchAlgorithmException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+
+ public SSLContext get() {
+ return ssl;
+ }
+}
\ No newline at end of file
--- a/test/jdk/java/time/tck/java/time/format/TCKInstantPrinterParser.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/time/tck/java/time/format/TCKInstantPrinterParser.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -69,12 +69,18 @@
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
import java.time.format.ResolverStyle;
import java.time.temporal.TemporalAccessor;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+/*
+ * @test
+ * @bug 8166138
+ */
+
/**
* Test DateTimeFormatterBuilder.appendInstant().
*/
@@ -200,7 +206,10 @@
{0, 0, "1970-01-01T00:00:00Z"},
{0, 0, "1970-01-01T00:00:00.0Z"},
{0, 0, "1970-01-01T00:00:00.000Z"},
- {0, 0, "1970-01-01T00:00:00.000000000Z"},
+
+ {0, 0, "1970-01-01T00:00:00+00:00"},
+ {0, 0, "1970-01-01T05:30:00+05:30"},
+ {0, 0, "1970-01-01T01:00:00.0+01:00"},
{-1, 0, "1969-12-31T23:59:59Z"},
{1, 0, "1970-01-01T00:00:01Z"},
@@ -208,16 +217,22 @@
{3600, 0, "1970-01-01T01:00:00Z"},
{86400, 0, "1970-01-02T00:00:00Z"},
+ {-1, 0, "1969-12-31T23:59:59+00:00"},
+ {1, 0, "1970-01-01T05:30:01+05:30"},
+ {60, 0, "1969-12-31T19:01:00-05:00"},
+ {3600, 0, "1970-01-01T06:30:00+05:30"},
+ {86400, 0, "1970-01-01T19:00:00-05:00"},
+
{182, 234000000, "1970-01-01T00:03:02.234Z"},
{182, 234000000, "1970-01-01T00:03:02.2340Z"},
{182, 234000000, "1970-01-01T00:03:02.23400Z"},
{182, 234000000, "1970-01-01T00:03:02.234000Z"},
- {182, 234000000, "1970-01-01T00:03:02.234000000Z"},
- {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-01T23:59:59.123456789Z"},
+ {182, 234000000, "1970-01-01T00:03:02.234+00:00"},
+ {182, 234000000, "1970-01-01T05:33:02.2340+05:30"},
+ {182, 234000000, "1969-12-31T19:03:02.23400-05:00"},
+ {182, 234000000, "1970-01-01T00:03:02.234000+00:00"},
- {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"},
- {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"},
};
}
@@ -230,22 +245,46 @@
assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
}
- @Test(dataProvider="parseDigits")
+ @DataProvider(name="parseNineDigits")
+ Object[][] data_parse_ninedigits() {
+ return new Object[][] {
+ {0, 0, "1970-01-01T00:00:00.000000000Z"},
+ {0, 0, "1970-01-01T05:30:00.000000000+05:30"},
+
+ {182, 234000000, "1970-01-01T00:03:02.234000000Z"},
+ {182, 234000000, "1970-01-01T01:03:02.234000000+01:00"},
+
+ {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-01T23:59:59.123456789Z"},
+ {((23 * 60) + 59) * 60 + 59, 123456789, "1970-01-02T05:29:59.123456789+05:30"},
+
+ {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999Z"},
+ {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000Z"},
+ {Instant.MAX.getEpochSecond(), 999999999, "+1000000000-12-31T23:59:59.999999999+00:00"},
+ {Instant.MIN.getEpochSecond(), 0, "-1000000000-01-01T00:00:00.000000000+00:00"},
+ };
+ }
+
+ @Test(dataProvider="parseNineDigits")
public void test_parse_digitsNine(long instantSecs, int nano, String input) {
DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(9).toFormatter();
- if (input.charAt(input.length() - 11) == '.') {
- Instant expected = Instant.ofEpochSecond(instantSecs, nano);
- assertEquals(f.parse(input, Instant::from), expected);
- assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO);
- assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
- } else {
- try {
- f.parse(input, Instant::from);
- fail();
- } catch (DateTimeException ex) {
- // expected
- }
- }
+ Instant expected = Instant.ofEpochSecond(instantSecs, nano);
+ assertEquals(f.parse(input, Instant::from), expected);
+ assertEquals(f.parse(input).query(DateTimeFormatter.parsedExcessDays()), Period.ZERO);
+ assertEquals(f.parse(input).query(DateTimeFormatter.parsedLeapSecond()), Boolean.FALSE);
+ }
+
+ @DataProvider(name="parseMaxMinInstant")
+ Object[][] data_parse_MaxMinInstant() {
+ return new Object[][] {
+ {"+1000000000-12-31T23:59:59.999999999-01:00"},
+ {"-1000000000-01-01T00:00:00.000000000+01:00"}
+ };
+ }
+
+ @Test(dataProvider="parseMaxMinInstant", expectedExceptions=DateTimeParseException.class)
+ public void test_invalid_Instant(String input) {
+ DateTimeFormatter f = new DateTimeFormatterBuilder().appendInstant(-1).toFormatter();
+ f.parse(input, Instant::from);
}
@Test
@@ -283,4 +322,12 @@
new DateTimeFormatterBuilder().appendInstant(10);
}
+ //------------------------------------------------------------------------
+ @Test
+ public void test_equality() {
+ Instant instant1 = Instant.parse("2018-09-12T22:15:51+05:30");
+ Instant instant2 = Instant.parse("2018-09-12T16:45:51Z");
+ assertEquals(instant2, instant1);
+ }
+
}
--- a/test/jdk/java/util/jar/JarFile/Constructor.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/util/jar/JarFile/Constructor.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018 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
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 4842702
+ * @bug 4842702 8211765
* @summary Check that constructors throw specified exceptions
* @author Martin Buchholz
*/
@@ -63,5 +63,13 @@
try { Unreached (new JarFile (new File ("NoSuchJar.jar"))); }
catch (IOException e) {}
+
+ // Test that an IOExcception is thrown when an invalid charater
+ // is part of the path on Windows and Unix
+ final String invalidOSPath = System.getProperty("os.name")
+ .startsWith("Windows") ? "C:\\*" : "foo\u0000bar";
+
+ try { Unreached (new JarFile (invalidOSPath)); }
+ catch (IOException e) {}
}
}
--- a/test/jdk/java/util/jar/JarFile/mrjar/TestVersionedStream.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/java/util/jar/JarFile/mrjar/TestVersionedStream.java Tue Oct 16 14:26:22 2018 +0530
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8163798 8189611
+ * @bug 8163798 8189611 8211728
* @summary basic tests for multi-release jar versioned streams
* @library /test/lib
* @modules jdk.jartool/sun.tools.jar java.base/jdk.internal.util.jar
@@ -82,7 +82,8 @@
"v10/p/Foo.class",
"v10/q/Bar.class",
"v" + LATEST_VERSION + "/p/Bar.class",
- "v" + LATEST_VERSION + "/p/Foo.class"
+ "v" + LATEST_VERSION + "/p/Foo.class",
+ "v" + LATEST_VERSION + "/META-INF/Foo.class"
);
jar("cf mmr.jar -C base . " +
@@ -224,6 +225,11 @@
throw new UncheckedIOException(x);
}
});
+
+ if (!unversionedEntryNames.contains("META-INF/Foo.class") ||
+ versionedNames.indexOf("META-INF/Foo.class") != -1) {
+ Assert.fail("versioned META-INF/Foo.class test failed");
+ }
}
}
--- a/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java Tue Oct 16 14:26:22 2018 +0530
@@ -30,7 +30,7 @@
*
* @run main ItxtUtf8Test
*
- * @run main/othervm/timeout=10 -Xmx4m ItxtUtf8Test truncate
+ * @run main/othervm/timeout=10 -Xmx6m ItxtUtf8Test truncate
*/
import java.awt.image.BufferedImage;
--- a/test/jdk/javax/naming/module/RunBasic.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/RunBasic.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,8 +27,10 @@
import jdk.test.lib.process.ProcessTools;
import java.io.IOException;
+import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -65,6 +67,8 @@
private static final List<String> JAVA_CMDS;
+ static final String HOST_NAME = InetAddress.getLoopbackAddress().getHostName();
+
static {
String javaPath = JDKToolFinder.getJDKTool("java");
@@ -85,6 +89,8 @@
prepareModule("test", "--module-source-path",
Path.of(TEST_SRC, "src").toString());
+ System.out.println("Hostname: [" + HOST_NAME + "]");
+
// run tests
runTest("java.desktop", "test.StoreObject");
runTest("person", "test.StorePerson");
@@ -98,9 +104,12 @@
private static void prepareModule(String mod, String... opts)
throws IOException {
System.out.println("Preparing the '" + mod + "' module...");
+ long start = System.nanoTime();
makeDir("mods", mod);
CompilerUtils.compile(Path.of(TEST_SRC, "src", mod),
Path.of("mods", (mod.equals("test") ? "" : mod)), opts);
+ Duration duration = Duration.ofNanos(System.nanoTime() - start);
+ System.out.println("completed: duration - " + duration );
}
private static void makeDir(String first, String... more)
@@ -111,7 +120,7 @@
private static void runTest(String desc, String clsName) throws Throwable {
System.out.println("Running with the '" + desc + "' module...");
runJava("-Dtest.src=" + TEST_SRC, "-p", "mods", "-m", "test/" + clsName,
- "ldap://localhost/dc=ie,dc=oracle,dc=com");
+ "ldap://" + HOST_NAME + "/dc=ie,dc=oracle,dc=com");
}
private static void runJava(String... opts) throws Throwable {
--- a/test/jdk/javax/naming/module/src/test/test/ConnectWithAuthzId.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/ConnectWithAuthzId.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,6 +29,7 @@
package test;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -40,12 +41,18 @@
public class ConnectWithAuthzId {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") +
"/src/test/test/ConnectWithAuthzId.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -68,67 +75,69 @@
* Launch the LDAP server with the ConnectWithAuthzId.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
-
- /*
- * Connect to the LDAP directory
- */
-
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=ie,dc=oracle,dc=com");
- env.put(Context.SECURITY_CREDENTIALS, "changeit");
- env.put(LdapContext.CONTROL_FACTORIES,
- "org.example.authz.AuthzIdResponseControlFactory");
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
-
- System.out.println("ConnectWithAuthzId: connecting to " + ldapUri);
- LdapContext ctx = null;
- Control[] connectionControls = { new AuthzIdRequestControl(false) };
-
- try {
- ctx = new InitialLdapContext(env, connectionControls);
- System.out.println("ConnectWithAuthzId: connected");
- // Retrieve the response controls
- Control[] responseControls = ctx.getResponseControls();
- if (responseControls != null) {
- for (Control responseControl : responseControls) {
- System.out.println("ConnectWithAuthzId: received response" +
- " control: " + responseControl.getID());
- if (responseControl instanceof AuthzIdResponseControl) {
- AuthzIdResponseControl authzId =
- (AuthzIdResponseControl)responseControl;
- System.out.println("ConnectWithAuthzId: identity is " +
- authzId.getIdentity());
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
}
}
+ }).start();
+
+ /*
+ * Connect to the LDAP directory
+ */
+
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
}
- } catch (NamingException e) {
- System.err.println("ConnectWithAuthzId: error connecting " + e);
- } finally {
- if (ctx != null) {
- ctx.close();
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=ie,dc=oracle,dc=com");
+ env.put(Context.SECURITY_CREDENTIALS, "changeit");
+ env.put(LdapContext.CONTROL_FACTORIES,
+ "org.example.authz.AuthzIdResponseControlFactory");
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
+
+ System.out.println("ConnectWithAuthzId: connecting to " + ldapUri);
+ LdapContext ctx = null;
+ Control[] connectionControls = { new AuthzIdRequestControl(false) };
+
+ try {
+ ctx = new InitialLdapContext(env, connectionControls);
+ System.out.println("ConnectWithAuthzId: connected");
+ // Retrieve the response controls
+ Control[] responseControls = ctx.getResponseControls();
+ if (responseControls != null) {
+ for (Control responseControl : responseControls) {
+ System.out.println("ConnectWithAuthzId: received response" +
+ " control: " + responseControl.getID());
+ if (responseControl instanceof AuthzIdResponseControl) {
+ AuthzIdResponseControl authzId =
+ (AuthzIdResponseControl)responseControl;
+ System.out.println("ConnectWithAuthzId: identity is " +
+ authzId.getIdentity());
+ }
+ }
+ }
+ } catch (NamingException e) {
+ System.err.println("ConnectWithAuthzId: error connecting " + e);
+ } finally {
+ if (ctx != null) {
+ ctx.close();
+ }
}
}
}
--- a/test/jdk/javax/naming/module/src/test/test/ConnectWithFoo.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/ConnectWithFoo.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,6 +28,7 @@
package test;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -38,11 +39,17 @@
public class ConnectWithFoo {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/ConnectWithFoo.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -65,48 +72,50 @@
* Launch the LDAP server with the ConnectWithFoo.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- /*
- * Connect to the LDAP directory
- */
+ /*
+ * Connect to the LDAP directory
+ */
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
- System.out.println("ConnectWithFoo: connecting to " + ldapUri);
- LdapContext ctx = null;
- Control[] connectionControls = { new FooControl(false) };
+ System.out.println("ConnectWithFoo: connecting to " + ldapUri);
+ LdapContext ctx = null;
+ Control[] connectionControls = { new FooControl(false) };
- try {
- ctx = new InitialLdapContext(env, connectionControls);
- System.out.println("ConnectWithFoo: connected");
- } catch (NamingException e) {
- System.err.println("ConnectWithFoo: error connecting " + e);
- } finally {
- if (ctx != null) {
- ctx.close();
+ try {
+ ctx = new InitialLdapContext(env, connectionControls);
+ System.out.println("ConnectWithFoo: connected");
+ } catch (NamingException e) {
+ System.err.println("ConnectWithFoo: error connecting " + e);
+ } finally {
+ if (ctx != null) {
+ ctx.close();
+ }
}
}
}
--- a/test/jdk/javax/naming/module/src/test/test/ReadByUrl.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/ReadByUrl.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,6 +28,7 @@
package test;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -36,11 +37,17 @@
public class ReadByUrl {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/ReadByUrl.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -63,50 +70,52 @@
* Launch the LDAP server with the ReadByUrl.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- /*
- * Connect to the LDAP directory
- */
+ /*
+ * Connect to the LDAP directory
+ */
- Hashtable<String,Object> env = new Hashtable<>();
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI("ldapv4", null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ Hashtable<String,Object> env = new Hashtable<>();
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI("ldapv4", null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
- // URL context factory location for 'ldapv4://'
- env.put(Context.URL_PKG_PREFIXES, "org.example");
+ // URL context factory location for 'ldapv4://'
+ env.put(Context.URL_PKG_PREFIXES, "org.example");
- System.out.println("ReadByUrl: connecting to " + ldapUri);
- DirContext ctx = null;
+ System.out.println("ReadByUrl: connecting to " + ldapUri);
+ DirContext ctx = null;
- try {
- ctx = new InitialDirContext(env);
- System.out.println("ReadByUrl: connected");
- DirContext entry = (DirContext) ctx.lookup(ldapUri.toString());
- entry.close();
- } catch (NamingException e) {
- System.err.println("ReadByUrl: error connecting " + e);
- } finally {
- if (ctx != null) {
- ctx.close();
+ try {
+ ctx = new InitialDirContext(env);
+ System.out.println("ReadByUrl: connected");
+ DirContext entry = (DirContext) ctx.lookup(ldapUri.toString());
+ entry.close();
+ } catch (NamingException e) {
+ System.err.println("ReadByUrl: error connecting " + e);
+ } finally {
+ if (ctx != null) {
+ ctx.close();
+ }
}
}
}
--- a/test/jdk/javax/naming/module/src/test/test/StoreFruit.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/StoreFruit.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,6 +29,7 @@
package test;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -38,18 +39,24 @@
public class StoreFruit {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/StoreFruit.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
/*
* Process arguments
*/
-
int argc = args.length;
if ((argc < 1) ||
((argc == 1) && (args[0].equalsIgnoreCase("-help")))) {
@@ -58,97 +65,98 @@
System.err.println(" <ldapurl> is the LDAP URL of the parent entry\n");
System.err.println("example:");
System.err.println(" java StoreFruit ldap://oasis/o=airius.com");
- return;
+ return;
}
/*
* Launch the LDAP server with the StoreFruit.ldap capture file
*/
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
-
- /*
- * Store fruit objects in the LDAP directory
- */
+ /*
+ * Store fruit objects in the LDAP directory
+ */
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
- System.out.println("StoreFruit: connecting to " + ldapUri);
- DirContext ctx = new InitialDirContext(env);
- Fruit fruit = null;
- String dn = "cn=myfruit";
- String dn2 = "cn=myapple";
+ System.out.println("StoreFruit: connecting to " + ldapUri);
+ DirContext ctx = new InitialDirContext(env);
+ Fruit fruit = null;
+ String dn = "cn=myfruit";
+ String dn2 = "cn=myapple";
- try {
- fruit = new Fruit("orange");
- ctx.bind(dn, fruit);
- System.out.println("StoreFruit: created entry '" + dn + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StoreFruit: entry '" + dn +
- "' already exists");
- cleanup(ctx, (String)null);
- return;
- }
+ try {
+ fruit = new Fruit("orange");
+ ctx.bind(dn, fruit);
+ System.out.println("StoreFruit: created entry '" + dn + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StoreFruit: entry '" + dn +
+ "' already exists");
+ cleanup(ctx, (String)null);
+ return;
+ }
- try {
- ctx.bind(dn2, new Fruit("apple"));
- System.out.println("StoreFruit: created entry '" + dn2 + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StoreFruit: entry '" + dn2 +
- "' already exists");
- cleanup(ctx, dn);
- return;
- }
+ try {
+ ctx.bind(dn2, new Fruit("apple"));
+ System.out.println("StoreFruit: created entry '" + dn2 + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StoreFruit: entry '" + dn2 +
+ "' already exists");
+ cleanup(ctx, dn);
+ return;
+ }
+
+ /*
+ * Retrieve fruit objects from the LDAP directory
+ */
- /*
- * Retrieve fruit objects from the LDAP directory
- */
+ try {
+ Fruit fruit2 = (Fruit) ctx.lookup(dn);
+ System.out.println("StoreFruit: retrieved object: " + fruit2);
+ } catch (NamingException e) {
+ System.err.println("StoreFruit: error retrieving entry '" +
+ dn + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
+ }
- try {
- Fruit fruit2 = (Fruit) ctx.lookup(dn);
- System.out.println("StoreFruit: retrieved object: " + fruit2);
- } catch (NamingException e) {
- System.err.println("StoreFruit: error retrieving entry '" +
- dn + "' " + e);
- e.printStackTrace();
+ try {
+ Fruit fruit3 = (Fruit) ctx.lookup(dn2);
+ System.out.println("StoreFruit: retrieved object: " + fruit3);
+ } catch (NamingException e) {
+ System.err.println("StoreFruit: error retrieving entry '" +
+ dn2 + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
+ }
+
cleanup(ctx, dn, dn2);
- return;
}
-
- try {
- Fruit fruit3 = (Fruit) ctx.lookup(dn2);
- System.out.println("StoreFruit: retrieved object: " + fruit3);
- } catch (NamingException e) {
- System.err.println("StoreFruit: error retrieving entry '" +
- dn2 + "' " + e);
- e.printStackTrace();
- cleanup(ctx, dn, dn2);
- return;
- }
-
- cleanup(ctx, dn, dn2);
}
/*
--- a/test/jdk/javax/naming/module/src/test/test/StoreObject.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/StoreObject.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -30,6 +30,7 @@
package test;
import java.awt.event.ActionEvent;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -37,11 +38,17 @@
public class StoreObject {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/StoreObject.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -64,89 +71,91 @@
* Launch the LDAP server with the StoreObject.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- /*
- * Store objects in the LDAP directory
- */
+ /*
+ * Store objects in the LDAP directory
+ */
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
- System.out.println("StoreObject: connecting to " + ldapUri);
- DirContext ctx = new InitialDirContext(env);
- String dn = "cn=myevent";
- String dn2 = "cn=myevent2";
+ System.out.println("StoreObject: connecting to " + ldapUri);
+ DirContext ctx = new InitialDirContext(env);
+ String dn = "cn=myevent";
+ String dn2 = "cn=myevent2";
- try {
- ctx.bind(dn, new ActionEvent("", 1, "Hello1"));
- System.out.println("StoreObject: created entry '" + dn + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StoreObject: entry '" + dn +
- "' already exists");
- cleanup(ctx, (String)null);
- return;
- }
+ try {
+ ctx.bind(dn, new ActionEvent("", 1, "Hello1"));
+ System.out.println("StoreObject: created entry '" + dn + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StoreObject: entry '" + dn +
+ "' already exists");
+ cleanup(ctx, (String)null);
+ return;
+ }
- try {
- ctx.bind(dn2, new ActionEvent("", 2, "Hello2"));
- System.out.println("StoreObject: created entry '" + dn2 + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StoreObject: entry '" + dn2 +
- "' already exists");
- cleanup(ctx, dn);
- return;
- }
+ try {
+ ctx.bind(dn2, new ActionEvent("", 2, "Hello2"));
+ System.out.println("StoreObject: created entry '" + dn2 + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StoreObject: entry '" + dn2 +
+ "' already exists");
+ cleanup(ctx, dn);
+ return;
+ }
- /*
- * Retrieve objects from the LDAP directory
- */
+ /*
+ * Retrieve objects from the LDAP directory
+ */
- try {
- ActionEvent b = (ActionEvent) ctx.lookup(dn);
- System.out.println("StoreObject: retrieved object: " + b);
- } catch (NamingException e) {
- System.err.println("StoreObject: error retrieving entry '" +
- dn + "' " + e);
- e.printStackTrace();
- cleanup(ctx, dn, dn2);
- return;
- }
+ try {
+ ActionEvent b = (ActionEvent) ctx.lookup(dn);
+ System.out.println("StoreObject: retrieved object: " + b);
+ } catch (NamingException e) {
+ System.err.println("StoreObject: error retrieving entry '" +
+ dn + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
+ }
- try {
- ActionEvent t = (ActionEvent) ctx.lookup(dn2);
- System.out.println("StoreObject: retrieved object: " + t);
- } catch (NamingException e) {
- System.err.println("StoreObject: error retrieving entry '" +
- dn2 + "' " + e);
- e.printStackTrace();
+ try {
+ ActionEvent t = (ActionEvent) ctx.lookup(dn2);
+ System.out.println("StoreObject: retrieved object: " + t);
+ } catch (NamingException e) {
+ System.err.println("StoreObject: error retrieving entry '" +
+ dn2 + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
+ }
+
cleanup(ctx, dn, dn2);
- return;
+ ctx.close();
}
-
- cleanup(ctx, dn, dn2);
- ctx.close();
}
/*
--- a/test/jdk/javax/naming/module/src/test/test/StorePerson.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/StorePerson.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -31,6 +31,7 @@
package test;
+import java.io.PrintStream;
import java.net.*;
import java.util.*;
import javax.naming.*;
@@ -40,11 +41,17 @@
public class StorePerson {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/StorePerson.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -67,115 +74,116 @@
* Launch the LDAP server with the StorePerson.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
+ try (ServerSocket serverSocket = new ServerSocket()) {
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- /*
- * Store Person objects in the LDAP directory
- */
+ /*
+ * Store Person objects in the LDAP directory
+ */
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
- // Specify the factory classname explicitly
- env.put(Context.STATE_FACTORIES, "org.example.person.PersonFactory");
- env.put(Context.OBJECT_FACTORIES, "org.example.person.PersonFactory");
+ // Specify the factory classname explicitly
+ env.put(Context.STATE_FACTORIES, "org.example.person.PersonFactory");
+ env.put(Context.OBJECT_FACTORIES, "org.example.person.PersonFactory");
- System.out.println("StorePerson: connecting to " + ldapUri);
- DirContext ctx = new InitialDirContext(env);
- Person person = null;
- String name = "John Smith";
- String dn = "cn=" + name;
+ System.out.println("StorePerson: connecting to " + ldapUri);
+ DirContext ctx = new InitialDirContext(env);
+ Person person = null;
+ String name = "John Smith";
+ String dn = "cn=" + name;
- try {
- person = new Person(name, "Smith");
- person.setMailAddress("jsmith@smith.com");
- ctx.bind(dn, person);
- System.out.println("StorePerson: created entry '" + dn + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StorePerson: entry '" + dn +
- "' already exists");
- cleanup(ctx, (String)null);
- return;
- }
+ try {
+ person = new Person(name, "Smith");
+ person.setMailAddress("jsmith@smith.com");
+ ctx.bind(dn, person);
+ System.out.println("StorePerson: created entry '" + dn + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StorePerson: entry '" + dn +
+ "' already exists");
+ cleanup(ctx, (String)null);
+ return;
+ }
- name = "Jill Smyth";
- String dn2 = "cn=" + name;
- Person person2 = new Person(name, "Smyth");
- person2.setMailAddress("jsmyth@smith.com");
+ name = "Jill Smyth";
+ String dn2 = "cn=" + name;
+ Person person2 = new Person(name, "Smyth");
+ person2.setMailAddress("jsmyth@smith.com");
- try {
- ctx.bind(dn2, person2);
- System.out.println("StorePerson: created entry '" + dn2 + "'");
- } catch (NameAlreadyBoundException e) {
- System.err.println("StorePerson: entry '" + dn2 +
- "' already exists");
- cleanup(ctx, dn);
- return;
- }
-
- /*
- * Retrieve Person objects from the LDAP directory
- */
-
- try {
- Person person3 = (Person) ctx.lookup(dn);
- System.out.println("StorePerson: retrieved object: " + person3);
- if (person.getAttributes().equals(person3.getAttributes())) {
- System.out.println(
- "StorePerson: retrieved person matches original");
- } else {
- System.out.println(
- "StorePerson: retrieved person does NOT match original");
+ try {
+ ctx.bind(dn2, person2);
+ System.out.println("StorePerson: created entry '" + dn2 + "'");
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StorePerson: entry '" + dn2 +
+ "' already exists");
+ cleanup(ctx, dn);
+ return;
}
- } catch (NamingException e) {
- System.err.println("StorePerson: error retrieving entry '" +
- dn + "' " + e);
- e.printStackTrace();
- cleanup(ctx, dn, dn2);
- return;
- }
+
+ /*
+ * Retrieve Person objects from the LDAP directory
+ */
- try {
- Person person4 = (Person) ctx.lookup(dn2);
- System.out.println("StorePerson: retrieved object: " + person4);
- if (person2.getAttributes().equals(person4.getAttributes())) {
- System.out.println(
- "StorePerson: retrieved person matches original");
- } else {
- System.out.println(
- "StorePerson: retrieved person does NOT match original");
+ try {
+ Person person3 = (Person) ctx.lookup(dn);
+ System.out.println("StorePerson: retrieved object: " + person3);
+ if (person.getAttributes().equals(person3.getAttributes())) {
+ System.out.println(
+ "StorePerson: retrieved person matches original");
+ } else {
+ System.out.println(
+ "StorePerson: retrieved person does NOT match original");
+ }
+ } catch (NamingException e) {
+ System.err.println("StorePerson: error retrieving entry '" +
+ dn + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
}
- } catch (NamingException e) {
- System.err.println("StorePerson: error retrieving entry '" +
- dn2 + "' " + e);
- e.printStackTrace();
+
+ try {
+ Person person4 = (Person) ctx.lookup(dn2);
+ System.out.println("StorePerson: retrieved object: " + person4);
+ if (person2.getAttributes().equals(person4.getAttributes())) {
+ System.out.println(
+ "StorePerson: retrieved person matches original");
+ } else {
+ System.out.println(
+ "StorePerson: retrieved person does NOT match original");
+ }
+ } catch (NamingException e) {
+ System.err.println("StorePerson: error retrieving entry '" +
+ dn2 + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn, dn2);
+ return;
+ }
+
cleanup(ctx, dn, dn2);
- return;
}
-
- cleanup(ctx, dn, dn2);
- return;
}
/*
--- a/test/jdk/javax/naming/module/src/test/test/StoreRemote.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/naming/module/src/test/test/StoreRemote.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -40,11 +40,17 @@
public class StoreRemote {
+ static {
+ final PrintStream out = new PrintStream(System.out, true);
+ final PrintStream err = new PrintStream(System.err, true);
+
+ System.setOut(out);
+ System.setErr(err);
+ }
+
// LDAP capture file
private static final String LDAP_CAPTURE_FILE =
System.getProperty("test.src") + "/src/test/test/StoreRemote.ldap";
- // LDAPServer socket
- private static ServerSocket serverSocket;
public static void main(String[] args) throws Exception {
@@ -67,77 +73,79 @@
* Launch the LDAP server with the StoreRemote.ldap capture file
*/
- serverSocket = new ServerSocket(0);
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
- } catch (Exception e) {
- System.out.println("ERROR: unable to launch LDAP server");
- e.printStackTrace();
- }
- }
- }).start();
-
- /*
- * Store a Remote object in the LDAP directory
- */
+ try (ServerSocket serverSocket = new ServerSocket()){
+ serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+ } catch (Exception e) {
+ System.out.println("ERROR: unable to launch LDAP server");
+ e.printStackTrace();
+ }
+ }
+ }).start();
- Hashtable<String,Object> env = new Hashtable<>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- URI ldapUri = new URI(args[0]);
- if (ldapUri.getPort() == -1) {
- ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
- serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
- }
- env.put(Context.PROVIDER_URL, ldapUri.toString());
- if (args[args.length - 1].equalsIgnoreCase("-trace")) {
- env.put("com.sun.jndi.ldap.trace.ber", System.out);
- }
+ /*
+ * Store a Remote object in the LDAP directory
+ */
- System.out.println("StoreRemote: connecting to " + ldapUri);
- DirContext ctx = new InitialDirContext(env);
- String dn = "cn=myremote";
+ Hashtable<String,Object> env = new Hashtable<>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory");
+ URI ldapUri = new URI(args[0]);
+ if (ldapUri.getPort() == -1) {
+ ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+ serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+ }
+ env.put(Context.PROVIDER_URL, ldapUri.toString());
+ if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+ env.put("com.sun.jndi.ldap.trace.ber", System.out);
+ }
+
+ System.out.println("StoreRemote: connecting to " + ldapUri);
+ DirContext ctx = new InitialDirContext(env);
+ String dn = "cn=myremote";
- try {
- Hello hello = new HelloImpl();
- ctx.bind(dn, hello);
- System.out.println("StoreRemote: created entry '" + dn + "'");
+ try {
+ Hello hello = new HelloImpl();
+ ctx.bind(dn, hello);
+ System.out.println("StoreRemote: created entry '" + dn + "'");
- // Explicitly release the RMI object
- UnicastRemoteObject.unexportObject(hello, true);
+ // Explicitly release the RMI object
+ UnicastRemoteObject.unexportObject(hello, true);
- } catch (NameAlreadyBoundException e) {
- System.err.println("StoreRemote: entry '" + dn +
- "' already exists");
- cleanup(ctx, (String)null);
- return;
- }
+ } catch (NameAlreadyBoundException e) {
+ System.err.println("StoreRemote: entry '" + dn +
+ "' already exists");
+ cleanup(ctx, (String)null);
+ return;
+ }
- /*
- * Retrieve the Remote object from the LDAP directory
- */
+ /*
+ * Retrieve the Remote object from the LDAP directory
+ */
- try {
- Hello obj = (Hello) ctx.lookup(dn);
- System.out.println("StoreRemote: retrieved object: " + obj);
- System.out.println("StoreRemote: calling Hello.sayHello()...\n" +
- obj.sayHello());
+ try {
+ Hello obj = (Hello) ctx.lookup(dn);
+ System.out.println("StoreRemote: retrieved object: " + obj);
+ System.out.println("StoreRemote: calling Hello.sayHello()...\n" +
+ obj.sayHello());
- // Explicitly release the RMI object
- UnicastRemoteObject.unexportObject(obj, true);
+ // Explicitly release the RMI object
+ UnicastRemoteObject.unexportObject(obj, true);
- } catch (NamingException e) {
- System.err.println("StoreRemote: error retrieving entry '" +
- dn + "' " + e);
- e.printStackTrace();
+ } catch (NamingException e) {
+ System.err.println("StoreRemote: error retrieving entry '" +
+ dn + "' " + e);
+ e.printStackTrace();
+ cleanup(ctx, dn);
+ return;
+ }
+
cleanup(ctx, dn);
- return;
}
-
- cleanup(ctx, dn);
}
/*
--- a/test/jdk/javax/net/ssl/HttpsURLConnection/Equals.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/javax/net/ssl/HttpsURLConnection/Equals.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,9 +24,9 @@
/**
* @test
* @bug 8055299
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.httpserver
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @run main/othervm -Djavax.net.debug=ssl,handshake,record Equals
*/
import com.sun.net.httpserver.*;
@@ -34,7 +34,7 @@
import java.io.*;
import javax.net.ssl.*;
import java.util.concurrent.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class Equals {
--- a/test/jdk/jdk/modules/open/Basic.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/jdk/modules/open/Basic.java Tue Oct 16 14:26:22 2018 +0530
@@ -98,6 +98,9 @@
ctor.setAccessible(true);
ctor.newInstance();
+ // Class::newInstance
+ clazz.newInstance();
+
// method handles
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
findNoArgConstructorAndInvoke(clazz, MethodHandles.lookup());
@@ -122,6 +125,12 @@
ctor.setAccessible(true);
ctor.newInstance();
+ // Class::newInstance
+ try {
+ clazz.newInstance();
+ assertTrue(false);
+ } catch (IllegalAccessException expected) { }
+
// method handles
try {
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
@@ -150,6 +159,9 @@
ctor.setAccessible(true);
ctor.newInstance();
+ // Class::newInstance
+ clazz.newInstance();
+
// method handles
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
findNoArgConstructorAndInvoke(clazz, MethodHandles.lookup());
@@ -174,6 +186,12 @@
ctor.setAccessible(true);
ctor.newInstance();
+ // Class::newInstance
+ try {
+ clazz.newInstance();
+ assertTrue(false);
+ } catch (IllegalAccessException expected) { }
+
// method handles
try {
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
@@ -200,6 +218,7 @@
// core reflection
Class<?> clazz = q.PublicType.class;
clazz.getConstructor().newInstance();
+ clazz.newInstance();
// method handles
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
@@ -226,6 +245,12 @@
ctor.setAccessible(true);
ctor.newInstance();
+ // Class::newInstance
+ try {
+ clazz.newInstance();
+ assertTrue(false);
+ } catch (IllegalAccessException expected) { }
+
// method handles
try {
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
@@ -256,6 +281,12 @@
assertTrue(false);
} catch (InaccessibleObjectException expected) { }
+ // Class::newInstance
+ try {
+ clazz.newInstance();
+ assertTrue(false);
+ } catch (IllegalAccessException expected) { }
+
// method handles
try {
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
@@ -288,6 +319,12 @@
assertTrue(false);
} catch (InaccessibleObjectException expected) { }
+ // Class::newInstance
+ try {
+ clazz.newInstance();
+ assertTrue(false);
+ } catch (IllegalAccessException expected) { }
+
// method handles
try {
findNoArgConstructorAndInvoke(clazz, MethodHandles.publicLookup());
--- a/test/jdk/lib/security/CheckBlacklistedCerts.java Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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.
- */
-
-/*
- * @test
- * @bug 8011402
- * @summary Move blacklisting certificate logic from hard code to data
- * @modules java.base/sun.security.util
- */
-
-import sun.security.util.UntrustedCertificates;
-
-import java.io.*;
-import java.security.KeyStore;
-import java.security.cert.*;
-import java.util.*;
-
-public class CheckBlacklistedCerts {
- public static void main(String[] args) throws Exception {
-
- String home = System.getProperty("java.home");
- boolean failed = false;
-
- // Root CAs should always be trusted
- File file = new File(home, "lib/security/cacerts");
- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- try (FileInputStream fis = new FileInputStream(file)) {
- ks.load(fis, null);
- }
- System.out.println("Check for cacerts: " + ks.size());
- for (String alias: Collections.list(ks.aliases())) {
- X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
- if (UntrustedCertificates.isUntrusted(cert)) {
- System.out.print(alias + " is untrusted");
- failed = true;
- }
- }
-
- // All certs in the pem files
- Set<Certificate> blacklisted = new HashSet<>();
-
- // Assumes the full src is available
- File[] blacklists = {
- new File(System.getProperty("test.src"),
- "../../../make/data/blacklistedcertsconverter/blacklisted.certs.pem"),
- new File(System.getProperty("test.src"),
- "../../../make/closed/data/blacklistedcertsconverter/blacklisted.certs.pem")
- };
-
- // Is this an OPENJDK build?
- String prop = System.getProperty("java.runtime.name");
- if (prop != null && prop.startsWith("OpenJDK")) {
- System.out.println("This is a OpenJDK build.");
- blacklists = Arrays.copyOf(blacklists, 1);
- }
-
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- for (File blacklist: blacklists) {
- System.out.print("Check for " + blacklist + ": ");
- if (!blacklist.exists()) {
- System.out.println("does not exist");
- } else {
- try (FileInputStream fis = new FileInputStream(blacklist)) {
- Collection<? extends Certificate> certs
- = cf.generateCertificates(fis);
- System.out.println(certs.size());
- for (Certificate c: certs) {
- blacklisted.add(c);
- X509Certificate cert = ((X509Certificate)c);
- if (!UntrustedCertificates.isUntrusted(cert)) {
- System.out.println(cert.getSubjectDN() + " is trusted");
- failed = true;
- }
- }
- }
- }
- }
-
- // Check the blacklisted.certs file itself
- file = new File(home, "lib/security/blacklisted.certs");
- System.out.print("Check for " + file + ": ");
- try (BufferedReader reader = new BufferedReader(
- new InputStreamReader(new FileInputStream(file)))) {
- int acount = 0;
- int ccount = 0;
- while (true) {
- String line = reader.readLine();
- if (line == null) break;
- if (line.startsWith("Algorithm")) {
- acount++;
- } else if (!line.isEmpty() && !line.startsWith("#")) {
- ccount++;
- }
- }
- System.out.println(acount + " algs, " + ccount + " certs" );
- if (acount != 1) {
- System.out.println("There are " + acount + " algorithms");
- failed = true;
- }
- if (ccount != blacklisted.size()
- && !blacklisted.isEmpty()) {
- System.out.println("Wrong blacklisted.certs size: "
- + ccount + " fingerprints, "
- + blacklisted.size() + " certs");
- failed = true;
- }
- }
-
- if (failed) {
- throw new Exception("Failed");
- }
- }
-}
--- a/test/jdk/lib/security/cacerts/VerifyCACerts.java Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, 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.
- *
- */
-
-/**
- * @test
- * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452
- * 8209506 8210432
- * @summary Check root CA entries in cacerts file
- */
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.KeyStore;
-import java.security.MessageDigest;
-import java.security.cert.*;
-import java.util.*;
-
-public class VerifyCACerts {
-
- private static final String CACERTS
- = System.getProperty("java.home") + File.separator + "lib"
- + File.separator + "security" + File.separator + "cacerts";
-
- // The numbers of certs now.
- private static final int COUNT = 93;
-
- // map of cert alias to SHA-256 fingerprint
- private static final Map<String, String> FINGERPRINT_MAP
- = new HashMap<String, String>() {
- {
- put("actalisauthenticationrootca [jdk]",
- "55:92:60:84:EC:96:3A:64:B9:6E:2A:BE:01:CE:0B:A8:6A:64:FB:FE:BC:C7:AA:B5:AF:C1:55:B3:7F:D7:60:66");
- put("buypassclass2ca [jdk]",
- "9A:11:40:25:19:7C:5B:B9:5D:94:E6:3D:55:CD:43:79:08:47:B6:46:B2:3C:DF:11:AD:A4:A0:0E:FF:15:FB:48");
- put("buypassclass3ca [jdk]",
- "ED:F7:EB:BC:A2:7A:2A:38:4D:38:7B:7D:40:10:C6:66:E2:ED:B4:84:3E:4C:29:B4:AE:1D:5B:93:32:E6:B2:4D");
- put("camerfirmachambersca [jdk]",
- "06:3E:4A:FA:C4:91:DF:D3:32:F3:08:9B:85:42:E9:46:17:D8:93:D7:FE:94:4E:10:A7:93:7E:E2:9D:96:93:C0");
- put("camerfirmachambersignca [jdk]",
- "13:63:35:43:93:34:A7:69:80:16:A0:D3:24:DE:72:28:4E:07:9D:7B:52:20:BB:8F:BD:74:78:16:EE:BE:BA:CA");
- put("camerfirmachamberscommerceca [jdk]",
- "0C:25:8A:12:A5:67:4A:EF:25:F2:8B:A7:DC:FA:EC:EE:A3:48:E5:41:E6:F5:CC:4E:E6:3B:71:B3:61:60:6A:C3");
- put("certumca [jdk]",
- "D8:E0:FE:BC:1D:B2:E3:8D:00:94:0F:37:D2:7D:41:34:4D:99:3E:73:4B:99:D5:65:6D:97:78:D4:D8:14:36:24");
- put("certumtrustednetworkca [jdk]",
- "5C:58:46:8D:55:F5:8E:49:7E:74:39:82:D2:B5:00:10:B6:D1:65:37:4A:CF:83:A7:D4:A3:2D:B7:68:C4:40:8E");
- put("chunghwaepkirootca [jdk]",
- "C0:A6:F4:DC:63:A2:4B:FD:CF:54:EF:2A:6A:08:2A:0A:72:DE:35:80:3E:2F:F5:FF:52:7A:E5:D8:72:06:DF:D5");
- put("comodorsaca [jdk]",
- "52:F0:E1:C4:E5:8E:C6:29:29:1B:60:31:7F:07:46:71:B8:5D:7E:A8:0D:5B:07:27:34:63:53:4B:32:B4:02:34");
- put("comodoaaaca [jdk]",
- "D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4");
- put("comodoeccca [jdk]",
- "17:93:92:7A:06:14:54:97:89:AD:CE:2F:8F:34:F7:F0:B6:6D:0F:3A:E3:A3:B8:4D:21:EC:15:DB:BA:4F:AD:C7");
- put("usertrustrsaca [jdk]",
- "E7:93:C9:B0:2F:D8:AA:13:E2:1C:31:22:8A:CC:B0:81:19:64:3B:74:9C:89:89:64:B1:74:6D:46:C3:D4:CB:D2");
- put("usertrusteccca [jdk]",
- "4F:F4:60:D5:4B:9C:86:DA:BF:BC:FC:57:12:E0:40:0D:2B:ED:3F:BC:4D:4F:BD:AA:86:E0:6A:DC:D2:A9:AD:7A");
- put("utnuserfirstobjectca [jdk]",
- "6F:FF:78:E4:00:A7:0C:11:01:1C:D8:59:77:C4:59:FB:5A:F9:6A:3D:F0:54:08:20:D0:F4:B8:60:78:75:E5:8F");
- put("utnuserfirstclientauthemailca [jdk]",
- "43:F2:57:41:2D:44:0D:62:74:76:97:4F:87:7D:A8:F1:FC:24:44:56:5A:36:7A:E6:0E:DD:C2:7A:41:25:31:AE");
- put("utnuserfirsthardwareca [jdk]",
- "6E:A5:47:41:D0:04:66:7E:ED:1B:48:16:63:4A:A3:A7:9E:6E:4B:96:95:0F:82:79:DA:FC:8D:9B:D8:81:21:37");
- put("addtrustclass1ca [jdk]",
- "8C:72:09:27:9A:C0:4E:27:5E:16:D0:7F:D3:B7:75:E8:01:54:B5:96:80:46:E3:1F:52:DD:25:76:63:24:E9:A7");
- put("addtrustexternalca [jdk]",
- "68:7F:A4:51:38:22:78:FF:F0:C8:B1:1F:8D:43:D5:76:67:1C:6E:B2:BC:EA:B4:13:FB:83:D9:65:D0:6D:2F:F2");
- put("addtrustqualifiedca [jdk]",
- "80:95:21:08:05:DB:4B:BC:35:5E:44:28:D8:FD:6E:C2:CD:E3:AB:5F:B9:7A:99:42:98:8E:B8:F4:DC:D0:60:16");
- put("baltimorecybertrustca [jdk]",
- "16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB");
- put("digicertglobalrootca [jdk]",
- "43:48:A0:E9:44:4C:78:CB:26:5E:05:8D:5E:89:44:B4:D8:4F:96:62:BD:26:DB:25:7F:89:34:A4:43:C7:01:61");
- put("digicertglobalrootg2 [jdk]",
- "CB:3C:CB:B7:60:31:E5:E0:13:8F:8D:D3:9A:23:F9:DE:47:FF:C3:5E:43:C1:14:4C:EA:27:D4:6A:5A:B1:CB:5F");
- put("digicertglobalrootg3 [jdk]",
- "31:AD:66:48:F8:10:41:38:C7:38:F3:9E:A4:32:01:33:39:3E:3A:18:CC:02:29:6E:F9:7C:2A:C9:EF:67:31:D0");
- put("digicerttrustedrootg4 [jdk]",
- "55:2F:7B:DC:F1:A7:AF:9E:6C:E6:72:01:7F:4F:12:AB:F7:72:40:C7:8E:76:1A:C2:03:D1:D9:D2:0A:C8:99:88");
- put("digicertassuredidrootca [jdk]",
- "3E:90:99:B5:01:5E:8F:48:6C:00:BC:EA:9D:11:1E:E7:21:FA:BA:35:5A:89:BC:F1:DF:69:56:1E:3D:C6:32:5C");
- put("digicertassuredidg2 [jdk]",
- "7D:05:EB:B6:82:33:9F:8C:94:51:EE:09:4E:EB:FE:FA:79:53:A1:14:ED:B2:F4:49:49:45:2F:AB:7D:2F:C1:85");
- put("digicertassuredidg3 [jdk]",
- "7E:37:CB:8B:4C:47:09:0C:AB:36:55:1B:A6:F4:5D:B8:40:68:0F:BA:16:6A:95:2D:B1:00:71:7F:43:05:3F:C2");
- put("digicerthighassuranceevrootca [jdk]",
- "74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF");
- put("geotrustglobalca [jdk]",
- "FF:85:6A:2D:25:1D:CD:88:D3:66:56:F4:50:12:67:98:CF:AB:AA:DE:40:79:9C:72:2D:E4:D2:B5:DB:36:A7:3A");
- put("geotrustprimaryca [jdk]",
- "37:D5:10:06:C5:12:EA:AB:62:64:21:F1:EC:8C:92:01:3F:C5:F8:2A:E9:8E:E5:33:EB:46:19:B8:DE:B4:D0:6C");
- put("geotrustprimarycag2 [jdk]",
- "5E:DB:7A:C4:3B:82:A0:6A:87:61:E8:D7:BE:49:79:EB:F2:61:1F:7D:D7:9B:F9:1C:1C:6B:56:6A:21:9E:D7:66");
- put("geotrustprimarycag3 [jdk]",
- "B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4");
- put("geotrustuniversalca [jdk]",
- "A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12");
- put("gtecybertrustglobalca [jdk]",
- "A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36");
- put("thawteprimaryrootca [jdk]",
- "8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F");
- put("thawteprimaryrootcag2 [jdk]",
- "A4:31:0D:50:AF:18:A6:44:71:90:37:2A:86:AF:AF:8B:95:1F:FB:43:1D:83:7F:1E:56:88:B4:59:71:ED:15:57");
- put("thawteprimaryrootcag3 [jdk]",
- "4B:03:F4:58:07:AD:70:F2:1B:FC:2C:AE:71:C9:FD:E4:60:4C:06:4C:F5:FF:B6:86:BA:E5:DB:AA:D7:FD:D3:4C");
- put("thawtepremiumserverca [jdk]",
- "3F:9F:27:D5:83:20:4B:9E:09:C8:A3:D2:06:6C:4B:57:D3:A2:47:9C:36:93:65:08:80:50:56:98:10:5D:BC:E9");
- put("verisigntsaca [jdk]",
- "CB:6B:05:D9:E8:E5:7C:D8:82:B1:0B:4D:B7:0D:E4:BB:1D:E4:2B:A4:8A:7B:D0:31:8B:63:5B:F6:E7:78:1A:9D");
- put("verisignclass2g2ca [jdk]",
- "3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1");
- put("verisignclass3ca [jdk]",
- "A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05");
- put("verisignclass3g2ca [jdk]",
- "83:CE:3C:12:29:68:8A:59:3D:48:5F:81:97:3C:0F:91:95:43:1E:DA:37:CC:5E:36:43:0E:79:C7:A8:88:63:8B");
- put("verisignuniversalrootca [jdk]",
- "23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C");
- put("verisignclass3g3ca [jdk]",
- "EB:04:CF:5E:B1:F3:9A:FA:76:2F:2B:B1:20:F2:96:CB:A5:20:C1:B9:7D:B1:58:95:65:B8:1C:B9:A1:7B:72:44");
- put("verisignclass3g4ca [jdk]",
- "69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79");
- put("verisignclass3g5ca [jdk]",
- "9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF");
- put("certplusclass2primaryca [jdk]",
- "0F:99:3C:8A:EF:97:BA:AF:56:87:14:0E:D5:9A:D1:82:1B:B4:AF:AC:F0:AA:9A:58:B5:D5:7A:33:8A:3A:FB:CB");
- put("certplusclass3pprimaryca [jdk]",
- "CC:C8:94:89:37:1B:AD:11:1C:90:61:9B:EA:24:0A:2E:6D:AD:D9:9F:9F:6E:1D:4D:41:E5:8E:D6:DE:3D:02:85");
- put("keynectisrootca [jdk]",
- "42:10:F1:99:49:9A:9A:C3:3C:8D:E0:2B:A6:DB:AA:14:40:8B:DD:8A:6E:32:46:89:C1:92:2D:06:97:15:A3:32");
- put("dtrustclass3ca2 [jdk]",
- "49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1");
- put("dtrustclass3ca2ev [jdk]",
- "EE:C5:49:6B:98:8C:E9:86:25:B9:34:09:2E:EC:29:08:BE:D0:B0:F3:16:C2:D4:73:0C:84:EA:F1:F3:D3:48:81");
- put("identrustdstx3 [jdk]",
- "06:87:26:03:31:A7:24:03:D9:09:F1:05:E6:9B:CF:0D:32:E1:BD:24:93:FF:C6:D9:20:6D:11:BC:D6:77:07:39");
- put("identrustpublicca [jdk]",
- "30:D0:89:5A:9A:44:8A:26:20:91:63:55:22:D1:F5:20:10:B5:86:7A:CA:E1:2C:78:EF:95:8F:D4:F4:38:9F:2F");
- put("identrustcommercial [jdk]",
- "5D:56:49:9B:E4:D2:E0:8B:CF:CA:D0:8A:3E:38:72:3D:50:50:3B:DE:70:69:48:E4:2F:55:60:30:19:E5:28:AE");
- put("letsencryptisrgx1 [jdk]",
- "96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6");
- put("luxtrustglobalrootca [jdk]",
- "A1:B2:DB:EB:64:E7:06:C6:16:9E:3C:41:18:B2:3B:AA:09:01:8A:84:27:66:6D:8B:F0:E2:88:91:EC:05:19:50");
- put("quovadisrootca [jdk]",
- "A4:5E:DE:3B:BB:F0:9C:8A:E1:5C:72:EF:C0:72:68:D6:93:A2:1C:99:6F:D5:1E:67:CA:07:94:60:FD:6D:88:73");
- put("quovadisrootca1g3 [jdk]",
- "8A:86:6F:D1:B2:76:B5:7E:57:8E:92:1C:65:82:8A:2B:ED:58:E9:F2:F2:88:05:41:34:B7:F1:F4:BF:C9:CC:74");
- put("quovadisrootca2 [jdk]",
- "85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86");
- put("quovadisrootca2g3 [jdk]",
- "8F:E4:FB:0A:F9:3A:4D:0D:67:DB:0B:EB:B2:3E:37:C7:1B:F3:25:DC:BC:DD:24:0E:A0:4D:AF:58:B4:7E:18:40");
- put("quovadisrootca3 [jdk]",
- "18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35");
- put("quovadisrootca3g3 [jdk]",
- "88:EF:81:DE:20:2E:B0:18:45:2E:43:F8:64:72:5C:EA:5F:BD:1F:C2:D9:D2:05:73:07:09:C5:D8:B8:69:0F:46");
- put("secomscrootca1 [jdk]",
- "E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C");
- put("secomscrootca2 [jdk]",
- "51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6");
- put("swisssigngoldg2ca [jdk]",
- "62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95");
- put("swisssignplatinumg2ca [jdk]",
- "3B:22:2E:56:67:11:E9:92:30:0D:C0:B1:5A:B9:47:3D:AF:DE:F8:C8:4D:0C:EF:7D:33:17:B4:C1:82:1D:14:36");
- put("swisssignsilverg2ca [jdk]",
- "BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5");
- put("soneraclass2ca [jdk]",
- "79:08:B4:03:14:C1:38:10:0B:51:8D:07:35:80:7F:FB:FC:F8:51:8A:00:95:33:71:05:BA:38:6B:15:3D:D9:27");
- put("securetrustca [jdk]",
- "F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73");
- put("xrampglobalca [jdk]",
- "CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2");
- put("godaddyrootg2ca [jdk]",
- "45:14:0B:32:47:EB:9C:C8:C5:B4:F0:D7:B5:30:91:F7:32:92:08:9E:6E:5A:63:E2:74:9D:D3:AC:A9:19:8E:DA");
- put("godaddyclass2ca [jdk]",
- "C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4");
- put("starfieldclass2ca [jdk]",
- "14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58");
- put("starfieldrootg2ca [jdk]",
- "2C:E1:CB:0B:F9:D2:F9:E1:02:99:3F:BE:21:51:52:C3:B2:DD:0C:AB:DE:1C:68:E5:31:9B:83:91:54:DB:B7:F5");
- put("entrustrootcaec1 [jdk]",
- "02:ED:0E:B2:8C:14:DA:45:16:5C:56:67:91:70:0D:64:51:D7:FB:56:F0:B2:AB:1D:3B:8E:B0:70:E5:6E:DF:F5");
- put("entrust2048ca [jdk]",
- "6D:C4:71:72:E0:1C:BC:B0:BF:62:58:0D:89:5F:E2:B8:AC:9A:D4:F8:73:80:1E:0C:10:B9:C8:37:D2:1E:B1:77");
- put("entrustrootcag2 [jdk]",
- "43:DF:57:74:B0:3E:7F:EF:5F:E4:0D:93:1A:7B:ED:F1:BB:2E:6B:42:73:8C:4E:6D:38:41:10:3D:3A:A7:F3:39");
- put("entrustevca [jdk]",
- "73:C1:76:43:4F:1B:C6:D5:AD:F4:5B:0E:76:E7:27:28:7C:8D:E5:76:16:C1:E6:E6:14:1A:2B:2C:BC:7D:8E:4C");
- put("affirmtrustnetworkingca [jdk]",
- "0A:81:EC:5A:92:97:77:F1:45:90:4A:F3:8D:5D:50:9F:66:B5:E2:C5:8F:CD:B5:31:05:8B:0E:17:F3:F0:B4:1B");
- put("affirmtrustpremiumca [jdk]",
- "70:A7:3F:7F:37:6B:60:07:42:48:90:45:34:B1:14:82:D5:BF:0E:69:8E:CC:49:8D:F5:25:77:EB:F2:E9:3B:9A");
- put("affirmtrustcommercialca [jdk]",
- "03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7");
- put("affirmtrustpremiumeccca [jdk]",
- "BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23");
- put("deutschetelekomrootca2 [jdk]",
- "B6:19:1A:50:D0:C3:97:7F:7D:A9:9B:CD:AA:C8:6A:22:7D:AE:B9:67:9E:C7:0B:A3:B0:C9:D9:22:71:C1:70:D3");
- put("ttelesecglobalrootclass3ca [jdk]",
- "FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD");
- put("ttelesecglobalrootclass2ca [jdk]",
- "91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52");
- put("starfieldservicesrootg2ca [jdk]",
- "56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5");
- put("globalsignca [jdk]",
- "EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99");
- put("globalsignr3ca [jdk]",
- "CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B");
- put("globalsigneccrootcar5 [jdk]",
- "17:9F:BC:14:8A:3D:D0:0F:D2:4E:A1:34:58:CC:43:BF:A7:F5:9C:81:82:D7:83:A5:13:F6:EB:EC:10:0C:89:24");
- put("globalsigneccrootcar4 [jdk]",
- "BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C");
- put("globalsignr2ca [jdk]",
- "CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E");
- put("teliasonerarootcav1 [jdk]",
- "DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89");
- }
- };
-
- // Exception list to 90 days expiry policy
- // No error will be reported if certificate in this list expires
- private static final HashSet<String> EXPIRY_EXC_ENTRIES
- = new HashSet<String>(Arrays.asList(
- "gtecybertrustglobalca [jdk]"
- ));
-
- // Ninety days in milliseconds
- private static final long NINETY_DAYS = 7776000000L;
-
- private static boolean atLeastOneFailed = false;
-
- private static MessageDigest md;
-
- public static void main(String[] args) throws Exception {
- System.out.println("cacerts file: " + CACERTS);
- md = MessageDigest.getInstance("SHA-256");
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(new FileInputStream(CACERTS), "changeit".toCharArray());
-
- // check the count of certs inside
- if (ks.size() != COUNT) {
- atLeastOneFailed = true;
- System.err.println("ERROR: " + ks.size() + " entries, should be "
- + COUNT);
- }
-
- // check that all entries in the map are in the keystore
- for (String alias : FINGERPRINT_MAP.keySet()) {
- if (!ks.isCertificateEntry(alias)) {
- atLeastOneFailed = true;
- System.err.println("ERROR: " + alias + " is not in cacerts");
- }
- }
-
- // pull all the trusted self-signed CA certs out of the cacerts file
- // and verify their signatures
- Enumeration<String> aliases = ks.aliases();
- while (aliases.hasMoreElements()) {
- String alias = aliases.nextElement();
- System.out.println("\nVerifying " + alias);
- if (!ks.isCertificateEntry(alias)) {
- atLeastOneFailed = true;
- System.err.println("ERROR: " + alias
- + " is not a trusted cert entry");
- }
- X509Certificate cert = (X509Certificate) ks.getCertificate(alias);
- if (!checkFingerprint(alias, cert)) {
- atLeastOneFailed = true;
- System.err.println("ERROR: " + alias + " SHA-256 fingerprint is incorrect");
- }
- // Make sure cert can be self-verified
- try {
- cert.verify(cert.getPublicKey());
- } catch (Exception e) {
- atLeastOneFailed = true;
- System.err.println("ERROR: cert cannot be verified:"
- + e.getMessage());
- }
-
- // Make sure cert is not expired or not yet valid
- try {
- cert.checkValidity();
- } catch (CertificateExpiredException cee) {
- if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
- atLeastOneFailed = true;
- System.err.println("ERROR: cert is expired");
- }
- } catch (CertificateNotYetValidException cne) {
- atLeastOneFailed = true;
- System.err.println("ERROR: cert is not yet valid");
- }
-
- // If cert is within 90 days of expiring, mark as failure so
- // that cert can be scheduled to be removed/renewed.
- Date notAfter = cert.getNotAfter();
- if (notAfter.getTime() - System.currentTimeMillis() < NINETY_DAYS) {
- if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
- atLeastOneFailed = true;
- System.err.println("ERROR: cert \"" + alias + "\" expiry \""
- + notAfter.toString() + "\" will expire within 90 days");
- }
- }
- }
-
- if (atLeastOneFailed) {
- throw new Exception("At least one cacert test failed");
- }
- }
-
- private static boolean checkFingerprint(String alias, Certificate cert)
- throws Exception {
- String fingerprint = FINGERPRINT_MAP.get(alias);
- if (fingerprint == null) {
- // no entry for alias
- return true;
- }
- System.out.println("Checking fingerprint of " + alias);
- byte[] digest = md.digest(cert.getEncoded());
- return fingerprint.equals(toHexString(digest));
- }
-
- private static String toHexString(byte[] block) {
- StringBuilder buf = new StringBuilder();
- int len = block.length;
- for (int i = 0; i < len; i++) {
- buf.append(String.format("%02X", block[i]));
- if (i < len - 1) {
- buf.append(":");
- }
- }
- return buf.toString();
- }
-}
--- a/test/jdk/lib/testlibrary/ModuleTargetHelper.java Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2017, 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.InputStream;
-import java.io.IOException;
-import java.lang.module.ModuleReader;
-import java.lang.module.ModuleReference;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import jdk.internal.module.ModuleInfo;
-import jdk.internal.module.ModuleInfo.Attributes;
-
-public class ModuleTargetHelper {
- private ModuleTargetHelper() {}
-
- public static final class ModuleTarget {
- private String targetPlatform;
-
- public ModuleTarget(String targetPlatform) {
- this.targetPlatform = targetPlatform;
- }
-
- public String targetPlatform() {
- return targetPlatform;
- }
- }
-
- public static ModuleTarget getJavaBaseTarget() throws IOException {
- Path p = Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
- try (InputStream in = Files.newInputStream(p)) {
- return read(in);
- }
- }
-
- public static ModuleTarget read(InputStream in) throws IOException {
- ModuleInfo.Attributes attrs = ModuleInfo.read(in, null);
- if (attrs.target() != null) {
- return new ModuleTarget(attrs.target().targetPlatform());
- } else {
- return null;
- }
- }
-
- public static ModuleTarget read(ModuleReference modRef) throws IOException {
- ModuleReader reader = modRef.open();
- try (InputStream in = reader.open("module-info.class").get()) {
- return read(in);
- } finally {
- reader.close();
- }
- }
-}
--- a/test/jdk/lib/testlibrary/ModuleUtils.java Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2015, 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.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReader;
-import java.lang.module.ModuleReference;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-
-
-/**
- * This class consists exclusively of static utility methods that are useful
- * for creating tests for modules.
- */
-
-public final class ModuleUtils {
- private ModuleUtils() { }
-
-
- /**
- * Returns a ModuleFinder that finds modules with the given module
- * descriptors.
- */
- static ModuleFinder finderOf(ModuleDescriptor... descriptors) {
-
- // Create a ModuleReference for each module
- Map<String, ModuleReference> namesToReference = new HashMap<>();
-
- for (ModuleDescriptor descriptor : descriptors) {
- String name = descriptor.name();
-
- URI uri = URI.create("module:/" + name);
-
- ModuleReference mref = new ModuleReference(descriptor, uri) {
- @Override
- public ModuleReader open() {
- throw new UnsupportedOperationException();
- }
- };
-
- namesToReference.put(name, mref);
- }
-
- return new ModuleFinder() {
- @Override
- public Optional<ModuleReference> find(String name) {
- Objects.requireNonNull(name);
- return Optional.ofNullable(namesToReference.get(name));
- }
- @Override
- public Set<ModuleReference> findAll() {
- return new HashSet<>(namesToReference.values());
- }
- };
- }
-
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/SimpleSSLContext.java Mon Oct 15 10:29:06 2018 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2005, 2016, 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.
- */
-
-package jdk.testlibrary;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.io.*;
-import java.net.*;
-import java.security.*;
-import java.security.cert.*;
-import javax.net.ssl.*;
-
-/**
- * Creates a simple usable SSLContext for SSLSocketFactory
- * or a HttpsServer using either a given keystore or a default
- * one in the test tree.
- *
- * Using this class with a security manager requires the following
- * permissions to be granted:
- *
- * permission "java.util.PropertyPermission" "test.src.path", "read";
- * permission java.io.FilePermission
- * "${test.src}/../../../lib/testlibrary/jdk/testlibrary/testkeys", "read";
- * The exact path above depends on the location of the test.
- */
-public class SimpleSSLContext {
-
- SSLContext ssl;
-
- /**
- * loads default keystore from SimpleSSLContext
- * source directory
- */
- public SimpleSSLContext() throws IOException {
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- String paths = System.getProperty("test.src.path");
- StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
- boolean securityExceptions = false;
- while (st.hasMoreTokens()) {
- String path = st.nextToken();
- try {
- File f = new File(path, "jdk/testlibrary/testkeys");
- if (f.exists()) {
- try (FileInputStream fis = new FileInputStream(f)) {
- init(fis);
- return null;
- }
- }
- } catch (SecurityException e) {
- // catch and ignore because permission only required
- // for one entry on path (at most)
- securityExceptions = true;
- }
- }
- if (securityExceptions) {
- System.err.println("SecurityExceptions thrown on loading testkeys");
- }
- return null;
- }
- });
- } catch (PrivilegedActionException pae) {
- Throwable t = pae.getCause() != null ? pae.getCause() : pae;
- if (t instanceof IOException)
- throw (IOException)t;
- if (t instanceof RuntimeException)
- throw (RuntimeException)t;
- if (t instanceof Error)
- throw (Error)t;
- throw new RuntimeException(t);
- }
- }
-
- /**
- * loads default keystore from given directory
- */
- public SimpleSSLContext(String dir) throws IOException {
- String file = dir+"/testkeys";
- try (FileInputStream fis = new FileInputStream(file)) {
- init(fis);
- }
- }
-
- private void init(InputStream i) throws IOException {
- try {
- char[] passphrase = "passphrase".toCharArray();
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(i, passphrase);
-
- KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
- kmf.init(ks, passphrase);
-
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
- tmf.init(ks);
-
- ssl = SSLContext.getInstance("TLS");
- ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- } catch (KeyManagementException e) {
- throw new RuntimeException(e.getMessage());
- } catch (KeyStoreException e) {
- throw new RuntimeException(e.getMessage());
- } catch (UnrecoverableKeyException e) {
- throw new RuntimeException(e.getMessage());
- } catch (CertificateException e) {
- throw new RuntimeException(e.getMessage());
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public SSLContext get() {
- return ssl;
- }
-}
Binary file test/jdk/lib/testlibrary/jdk/testlibrary/testkeys has changed
--- a/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -54,7 +54,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.button.ButtonDemo
- * @run testng ButtonDemoScreenshotTest
+ * @run testng/timeout=600 ButtonDemoScreenshotTest
*/
@Listeners(GuiTestListener.class)
public class ButtonDemoScreenshotTest {
--- a/test/jdk/sanity/client/SwingSet/src/ButtonDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ButtonDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -56,7 +56,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.button.ButtonDemo
- * @run testng ButtonDemoTest
+ * @run testng/timeout=600 ButtonDemoTest
*/
@Listeners(GuiTestListener.class)
public class ButtonDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/ComboBoxDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ComboBoxDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -45,7 +45,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.combobox.ComboBoxDemo
- * @run testng ComboBoxDemoTest
+ * @run testng/timeout=600 ComboBoxDemoTest
*/
@Listeners(GuiTestListener.class)
public class ComboBoxDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/DialogDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/DialogDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -27,6 +27,7 @@
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JDialog;
+import javax.swing.UIManager;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
import static org.jemmy2ext.JemmyExt.isIconified;
@@ -54,15 +55,16 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.dialog.DialogDemo
- * @run testng DialogDemoTest
+ * @run testng/timeout=600 DialogDemoTest
*/
@Listeners(GuiTestListener.class)
public class DialogDemoTest {
private final ComponentChooser jDialogClassChooser = new ByClassChooser(JDialog.class);
- @Test
- public void test() throws Exception {
+ @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+ public void test(String lookAndFeel) throws Exception {
+ UIManager.setLookAndFeel(lookAndFeel);
new ClassReference(DialogDemo.class.getCanonicalName()).startApplication();
JFrameOperator mainFrame = new JFrameOperator(DIALOG_DEMO_TITLE);
JDialogOperator dialog = new JDialogOperator(DIALOG_TITLE);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/SwingSet/src/EditorPaneDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2018, 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 static com.sun.swingset3.demos.editorpane.EditorPaneDemo.DEMO_TITLE;
+import static com.sun.swingset3.demos.editorpane.EditorPaneDemo.SOURCE_FILES;
+import static org.jemmy2ext.JemmyExt.EXACT_STRING_COMPARATOR;
+
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeListener;
+import java.net.URL;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.swing.UIManager;
+
+import org.jemmy2ext.JemmyExt;
+import org.jtregext.GuiTestListener;
+import org.netbeans.jemmy.ClassReference;
+import org.netbeans.jemmy.image.ImageTool;
+import org.netbeans.jemmy.operators.JEditorPaneOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.swingset3.demos.editorpane.EditorPaneDemo;
+
+/*
+ * @test
+ * @key headful
+ * @summary Verifies SwingSet3 EditorPaneDemo by navigating and and validating
+ * the page contents in all pages
+ *
+ * @library /sanity/client/lib/jemmy/src
+ * @library /sanity/client/lib/Extensions/src
+ * @library /sanity/client/lib/SwingSet3/src
+ * @modules java.desktop
+ * java.logging
+ * @build org.jemmy2ext.JemmyExt
+ * @build com.sun.swingset3.demos.editorpane.EditorPaneDemo
+ * @run testng/timeout=600 EditorPaneDemoTest
+ */
+@Listeners(GuiTestListener.class)
+public class EditorPaneDemoTest {
+
+ private final static String PROPERTY_NAME_PAGE = "page";
+ private final static String INDEX_PAGE_NAME = "index.html";
+ private final static String TEXT_IN_INDEX_PAGE = "Octavo Corporation";
+ private final static Dimension INDEX_IMAGE_DIMENSION = new Dimension(550, 428);
+ private final static Dimension imageDimensions[] = {new Dimension(320, 342),
+ new Dimension(420, 290), new Dimension(381, 384),
+ new Dimension(316, 498), new Dimension(481 ,325),
+ new Dimension(516, 445)};
+ private final static String REFERENCE_NAMES[] =
+ {"title", "king", "preface", "seaweed", "ant", "bug"};
+ private final static String TEXTS_IN_PAGES[] =
+ {"Physiological Descriptions", "ROBERT HOOKE",
+ "Mankind above other Creatures", "Area A B C D",
+ "Observ. XLIX", "Cylinder F F F"};
+ private final AtomicReference<URL> newPageURL = new AtomicReference<>();
+
+ /**
+ * Testing the navigation through all html pages in EditorPaneDemo by
+ * clicking on different references and validating the page contents.
+ *
+ * @throws Exception
+ */
+ @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+ public void test(String lookAndFeel) throws Exception {
+ UIManager.setLookAndFeel(lookAndFeel);
+ new ClassReference(EditorPaneDemo.class.getCanonicalName()).startApplication();
+
+ JFrameOperator frameOperator = new JFrameOperator(DEMO_TITLE);
+ frameOperator.setComparator(EXACT_STRING_COMPARATOR);
+ PropertyChangeListener pageChangeListener =
+ event -> newPageURL.set((URL) event.getNewValue());
+ JEditorPaneOperator editorPaneOperator = new JEditorPaneOperator(frameOperator);
+
+ try {
+ editorPaneOperator.addPropertyChangeListener(
+ PROPERTY_NAME_PAGE, pageChangeListener);
+ // Validation of initial or index page
+ URL indexURL = getPageURL(INDEX_PAGE_NAME);
+ editorPaneOperator.waitStateOnQueue(comp
+ -> indexURL.equals(editorPaneOperator.getPage()));
+ checkImage(editorPaneOperator, INDEX_IMAGE_DIMENSION, INDEX_PAGE_NAME);
+ checkTextPresence(editorPaneOperator, TEXT_IN_INDEX_PAGE);
+
+ // Clicking on different references and validating pages by selecting
+ // unique texts in each page
+ for (int i = 0; i < REFERENCE_NAMES.length; i++) {
+ editorPaneOperator.clickOnReference(REFERENCE_NAMES[i]);
+ validatePage(editorPaneOperator, i);
+ }
+ } finally {
+ editorPaneOperator.removePropertyChangeListener(
+ PROPERTY_NAME_PAGE, pageChangeListener);
+ }
+ }
+
+ private void checkTextPresence(
+ JEditorPaneOperator editorPaneOperator, String text) {
+ editorPaneOperator.selectText(text);
+ editorPaneOperator.waitStateOnQueue(comp
+ -> text.equals(editorPaneOperator.getSelectedText()));
+ }
+
+ private void validatePage(JEditorPaneOperator editorPaneOperator,
+ int i) throws Exception {
+ URL expectedPageURL = getPageURL(REFERENCE_NAMES[i] + ".html");
+ editorPaneOperator.waitStateOnQueue(comp
+ -> expectedPageURL.equals(newPageURL.get()));
+ checkImage(editorPaneOperator, imageDimensions[i], REFERENCE_NAMES[i]);
+ checkTextPresence(editorPaneOperator, TEXTS_IN_PAGES[i]);
+ }
+
+ private void checkImage(JEditorPaneOperator editorPaneOperator,
+ Dimension imageDim, String pageName) throws Exception {
+ // Captures image screen shot and checking some 10 pixels from inner
+ // area of the image are not default background color
+ Point compLoc = editorPaneOperator.getLocationOnScreen();
+ Insets insets = editorPaneOperator.getInsets();
+ Rectangle imageRect = new Rectangle(new Point(compLoc.x + insets.left,
+ compLoc.y + insets.top), imageDim);
+ final int xGap = 100, yGap = 40, columns = 2, rows = 5;
+ editorPaneOperator.waitState(comp -> {
+ BufferedImage capturedImage = ImageTool.getImage(imageRect);
+ int x = 0, y = 0, i = 0, j;
+ for (; i < columns; i++) {
+ x += xGap;
+ y = 0;
+ for (j = 0; j < rows; j++) {
+ y += yGap;
+ if(capturedImage.getRGB(x, y) ==
+ editorPaneOperator.getBackground().getRGB()) {
+ // saving image for failure case
+ JemmyExt.save(capturedImage, "capturedimage_" + pageName + "_" +
+ UIManager.getLookAndFeel().getClass().getSimpleName() + ".png");
+ return false;
+ }
+ }
+ }
+ return true;
+ });
+ }
+
+ /**
+ * Gets the URL corresponding to a page name
+ *
+ * @param pageName : name of the page
+ * @return : URL corresponding to page
+ */
+ private URL getPageURL(String pageName) {
+ String url = null;
+ for (String sourceFile : SOURCE_FILES) {
+ if(sourceFile.endsWith(pageName)) {
+ url = sourceFile;
+ }
+ }
+ return getClass().getResource(url);
+ }
+}
--- a/test/jdk/sanity/client/SwingSet/src/FrameDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/FrameDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -86,7 +86,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.frame.FrameDemo
- * @run testng FrameDemoTest
+ * @run testng/timeout=600 FrameDemoTest
*/
@Listeners(GuiTestListener.class)
public class FrameDemoTest {
@@ -293,4 +293,4 @@
});
}
-}
\ No newline at end of file
+}
--- a/test/jdk/sanity/client/SwingSet/src/GridBagLayoutDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/GridBagLayoutDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -51,7 +51,7 @@
* @modules java.desktop
* java.logging
* @build com.sun.swingset3.demos.gridbaglayout.GridBagLayoutDemo
- * @run testng GridBagLayoutDemoTest
+ * @run testng/timeout=600 GridBagLayoutDemoTest
*/
@Listeners(GuiTestListener.class)
--- a/test/jdk/sanity/client/SwingSet/src/ListDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ListDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -56,7 +56,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.list.ListDemo
- * @run testng ListDemoTest
+ * @run testng/timeout=600 ListDemoTest
*/
@Listeners(GuiTestListener.class)
public class ListDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/OptionPaneDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/OptionPaneDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -55,7 +55,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.optionpane.OptionPaneDemo
- * @run testng OptionPaneDemoTest
+ * @run testng/timeout=600 OptionPaneDemoTest
*/
@Listeners(GuiTestListener.class)
public class OptionPaneDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ProgressBarDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -49,7 +49,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.progressbar.ProgressBarDemo
- * @run testng/timeout=240 ProgressBarDemoTest
+ * @run testng/timeout=1200 ProgressBarDemoTest
*/
@Listeners(GuiTestListener.class)
public class ProgressBarDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/ScrollPaneDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ScrollPaneDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -45,7 +45,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.scrollpane.ScrollPaneDemo
- * @run testng ScrollPaneDemoTest
+ * @run testng/timeout=600 ScrollPaneDemoTest
*/
@Listeners(GuiTestListener.class)
public class ScrollPaneDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/SpinnerDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/SpinnerDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -47,7 +47,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.spinner.SpinnerDemo
- * @run testng SpinnerDemoTest
+ * @run testng/timeout=600 SpinnerDemoTest
*/
@Listeners(GuiTestListener.class)
public class SpinnerDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,6 +27,7 @@
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ToolTipManager;
+import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import org.jtregext.GuiTestListener;
@@ -58,7 +59,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build SwingSet2
- * @run testng SwingSet2DemoTest
+ * @run testng/timeout=600 SwingSet2DemoTest
*/
@Listeners(GuiTestListener.class)
public class SwingSet2DemoTest {
@@ -74,8 +75,9 @@
*
* @throws Exception
*/
- @Test
- public void test() throws Exception {
+ @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+ public void test(String lookAndFeel) throws Exception {
+ UIManager.setLookAndFeel(lookAndFeel);
new ClassReference(SwingSet2.class.getCanonicalName()).startApplication();
JFrameOperator frameOperator = new JFrameOperator(SwingSet2.FRAME_TITLE);
@@ -192,4 +194,4 @@
}
}
-}
\ No newline at end of file
+}
--- a/test/jdk/sanity/client/SwingSet/src/TabbedPaneDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/TabbedPaneDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -48,7 +48,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo
- * @run testng TabbedPaneDemoTest
+ * @run testng/timeout=600 TabbedPaneDemoTest
*/
@Listeners(GuiTestListener.class)
public class TabbedPaneDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/TableDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/TableDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -64,7 +64,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.table.TableDemo
- * @run testng TableDemoTest
+ * @run testng/timeout=600 TableDemoTest
*/
@Listeners(GuiTestListener.class)
public class TableDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -65,7 +65,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.textfield.TextFieldDemo
- * @run testng TextFieldDemoTest
+ * @run testng/timeout=600 TextFieldDemoTest
*/
@Listeners(GuiTestListener.class)
public class TextFieldDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/ToggleButtonDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ToggleButtonDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -61,7 +61,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.togglebutton.ToggleButtonDemo
- * @run testng ToggleButtonDemoTest
+ * @run testng/timeout=600 ToggleButtonDemoTest
*/
@Listeners(GuiTestListener.class)
public class ToggleButtonDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/ToolTipDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/ToolTipDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -61,7 +61,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.tooltip.ToolTipDemo
- * @run testng ToolTipDemoTest
+ * @run testng/timeout=600 ToolTipDemoTest
*/
@Listeners(GuiTestListener.class)
public class ToolTipDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/TreeDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/TreeDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -56,7 +56,7 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.tree.TreeDemo
- * @run testng TreeDemoTest
+ * @run testng/timeout=600 TreeDemoTest
*/
@Listeners(GuiTestListener.class)
public class TreeDemoTest {
--- a/test/jdk/sanity/client/SwingSet/src/WindowDemoTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/WindowDemoTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -26,6 +26,7 @@
import static com.sun.swingset3.demos.window.WindowDemo.*;
import static org.jemmy2ext.JemmyExt.*;
import static org.testng.AssertJUnit.*;
+import javax.swing.UIManager;
import org.testng.annotations.Test;
import org.netbeans.jemmy.ClassReference;
import org.netbeans.jemmy.operators.JButtonOperator;
@@ -48,13 +49,14 @@
* java.logging
* @build org.jemmy2ext.JemmyExt
* @build com.sun.swingset3.demos.window.WindowDemo
- * @run testng WindowDemoTest
+ * @run testng/timeout=600 WindowDemoTest
*/
@Listeners(GuiTestListener.class)
public class WindowDemoTest {
- @Test
- public void test() throws Exception {
+ @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+ public void test(String lookAndFeel) throws Exception {
+ UIManager.setLookAndFeel(lookAndFeel);
new ClassReference(WindowDemo.class.getCanonicalName()).startApplication();
--- a/test/jdk/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/lib/Extensions/src/org/jemmy2ext/JemmyExt.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -48,6 +48,7 @@
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JWindow;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.TitledBorder;
@@ -340,19 +341,21 @@
* full dump and a screenshot of the whole screen.
*/
public static void captureAll() {
- PNGEncoder.captureScreen("failure.png", PNGEncoder.COLOR_MODE);
+ String lookAndFeelClassName = UIManager.getLookAndFeel().getClass().getSimpleName();
+ PNGEncoder.captureScreen("failure_" + lookAndFeelClassName + ".png", PNGEncoder.COLOR_MODE);
try {
- Dumper.dumpAll("dumpAll.xml");
+ Dumper.dumpAll("dumpAll_" + lookAndFeelClassName + ".xml");
} catch (FileNotFoundException ex) {
Logger.getLogger(JemmyExt.class.getName()).log(Level.SEVERE, null, ex);
}
- captureWindows();
+ captureWindows(lookAndFeelClassName);
}
/**
* Captures each showing window image using Window.paint() method.
+ * @param lookAndFeelClassName
*/
- private static void captureWindows() {
+ private static void captureWindows(String lookAndFeelClassName) {
try {
EventQueue.invokeAndWait(() -> {
Window[] windows = Window.getWindows();
@@ -367,7 +370,8 @@
g.dispose();
try {
- ImageIO.write(img, "png", new File("window" + index++ + ".png"));
+ ImageIO.write(img, "png", new File("window_" + lookAndFeelClassName
+ + "_" + index++ + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -406,7 +410,7 @@
Window[] windows = Window.getWindows();
int windowCount = 0;
for (Window w : windows) {
- if (w.getClass().equals(JWindow.class)) {
+ if (w.getClass().equals(JWindow.class) && ((JWindow)w).isShowing()) {
windowCount++;
}
}
@@ -427,7 +431,7 @@
Window[] windows = Window.getWindows();
int windowIndex = 0;
for (Window w : windows) {
- if (w.getClass().equals(JWindow.class)) {
+ if (w.getClass().equals(JWindow.class) && ((JWindow)w).isShowing()) {
if (windowIndex == index) {
return (JWindow) w;
}
@@ -565,7 +569,7 @@
@Override
public boolean checkComponent(Component comp) {
- return comp.getClass().equals(clazz);
+ return comp.getClass().equals(clazz) && comp.isShowing();
}
@Override
--- a/test/jdk/sanity/client/lib/SwingSet2/src/SwingSet2.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sanity/client/lib/SwingSet2/src/SwingSet2.java Tue Oct 16 14:26:22 2018 +0530
@@ -323,8 +323,6 @@
"FileMenu.exit_accessible_description", new ExitAction(this)
);
- // Create these menu items for the first SwingSet only.
- if (numSSs == 0) {
// ***** create laf switcher menu
lafMenu = (JMenu) menuBar.add(new JMenu(getString("LafMenu.laf_label")));
lafMenu.setMnemonic(getMnemonic("LafMenu.laf_mnemonic"));
@@ -432,7 +430,6 @@
"OptionsMenu.dragEnabled_mnemonic",
"OptionsMenu.dragEnabled_accessible_description",
new DragSupportAction());
- }
// ***** create the multiscreen menu, if we have multiple screens
GraphicsDevice[] screens = GraphicsEnvironment.
@@ -1258,4 +1255,4 @@
return className;
}
}
-}
\ No newline at end of file
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/EditorPaneDemo.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+package com.sun.swingset3.demos.editorpane;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JViewport;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLFrameHyperlinkEvent;
+
+import com.sun.swingset3.DemoProperties;
+
+/**
+ * EditorPane Demo (was HTMLDemo in SwingSet2)
+ */
+@DemoProperties(
+ value = "JEditorPane Demo",
+ category = "Text",
+ description = "Demonstrates JEditorPane, a text component which supports display and editing of rich text formats (such as HTML)",
+ sourceFiles = {
+ "com/sun/swingset3/demos/editorpane/EditorPaneDemo.java",
+ "com/sun/swingset3/demos/editorpane/book/ant.html",
+ "com/sun/swingset3/demos/editorpane/book/bug.html",
+ "com/sun/swingset3/demos/editorpane/book/index.html",
+ "com/sun/swingset3/demos/editorpane/book/king.html",
+ "com/sun/swingset3/demos/editorpane/book/preface.html",
+ "com/sun/swingset3/demos/editorpane/book/seaweed.html",
+ "com/sun/swingset3/demos/editorpane/book/title.html",
+ "com/sun/swingset3/demos/editorpane/book/editorpane/back.jpg",
+ "com/sun/swingset3/demos/editorpane/book/editorpane/forward.jpg",
+ "com/sun/swingset3/demos/editorpane/book/editorpane/header.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/ant.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/book.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/bug.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/bug2.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/COPYRIGHT",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/crest.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/king.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/micro.jpg",
+ "com/sun/swingset3/demos/editorpane/book/Octavo/seaweed.jpg",
+ "com/sun/swingset3/demos/editorpane/resources/EditorPaneDemo.properties",
+ "com/sun/swingset3/demos/editorpane/resources/images/EditorPaneDemo.gif"
+ }
+)
+public class EditorPaneDemo extends JPanel {
+
+ public static final String DEMO_TITLE = EditorPaneDemo.class.getAnnotation(DemoProperties.class).value();
+ public static final String[] SOURCE_FILES = EditorPaneDemo.class.getAnnotation(DemoProperties.class).sourceFiles();
+ private JEditorPane html;
+
+ /**
+ * main method allows us to run as a standalone demo.
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame(EditorPaneDemo.class.getAnnotation(DemoProperties.class).value());
+
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.getContentPane().add(new EditorPaneDemo());
+ frame.setPreferredSize(new Dimension(800, 600));
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ /**
+ * EditorPaneDemo Constructor
+ */
+ public EditorPaneDemo() {
+ setLayout(new BorderLayout());
+
+ try {
+ URL url;
+ // System.getProperty("user.dir") +
+ // System.getProperty("file.separator");
+ String path = null;
+ try {
+ path = "book/index.html";
+ url = getClass().getResource(path);
+ } catch (Exception e) {
+ System.err.println("Failed to open " + path);
+ url = null;
+ }
+
+ if (url != null) {
+ html = new JEditorPane(url);
+ html.setEditable(false);
+ html.addHyperlinkListener(createHyperLinkListener());
+
+ JScrollPane scroller = new JScrollPane();
+ JViewport vp = scroller.getViewport();
+ vp.add(html);
+ add(scroller, BorderLayout.CENTER);
+ }
+ } catch (MalformedURLException e) {
+ System.out.println("Malformed URL: " + e);
+ } catch (IOException e) {
+ System.out.println("IOException: " + e);
+ }
+ }
+
+ private HyperlinkListener createHyperLinkListener() {
+ return new HyperlinkListener() {
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (e instanceof HTMLFrameHyperlinkEvent) {
+ ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
+ (HTMLFrameHyperlinkEvent) e);
+ } else {
+ try {
+ html.setPage(e.getURL());
+ } catch (IOException ioe) {
+ System.out.println("IOE: " + ioe);
+ }
+ }
+ }
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/CREDITS Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,2 @@
+Images and text in the SwingSet3 EditorPane demo are used by permission of Octavo
+Corporation and are sourced from Rare Book Room (rarebookroom.org).
\ No newline at end of file
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/ant.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/book.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/bug.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/bug2.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/crest.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/king.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/micro.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/Octavo/seaweed.jpg has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/ant.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,121 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/ant.jpg" width="481" height="325">
+<h1 align="center"><br>
+ Observ. XLIX. Of an Ant or Pismire.<br>
+</h1>
+<p align="center"> </p>
+<blockquote>
+ <blockquote>
+ <p><font size="4">This was a creature, more troublesom to be drawn, then any
+ of the rest, for I could not, for a good while, think of a way to make it
+ suffer its body to ly quiet in a natural posture; but whil'st it was alive,
+ if its feet were fetter'd in Wax or Glew, it would so twist and wind its body,
+ that I could not any wayes get a good view of it; and if I killed it, its
+ body was so little, that I did often spoile the shape of it, before I could
+ throughly view it: for this is the nature of these minute Bodies, that as
+ soon, almost, as ever their life is destroy'd, their parts immediately shrivel,
+ and lose their beauty; and so is it also with small Plants, as I instanced
+ before, in the description of Moss. </font></p>
+ <p><font size="4">And thence also is the reason of the variations in the beards
+ of wild Oats, and in those of Muskgrass seed, that their bodies, being exceeding
+ small, those small variations which are made in the surfaces of all bodies,
+ almost upon every change of Air, especially if the body be porous, do here
+ become sensible, where the whole body is so small, that it is almost nothing
+ but surface; for as in vegetable substances, I see no great reason to think,
+ that the moisture of the Aire (that, sticking to a wreath'd beard, does make
+ it untwist) should evaporate, or exhale away, any faster then the moisture
+ of other bodies, but rather that the avolation from, or access of moisture
+ to, the surfaces of bodies being much the same, those bodies become most
+ sensible of it, which have the least proportion of body to their surface.
+ </font></p>
+ <p><font size="4">So is it also with Animal substances; the dead body of an
+ Ant, or such little creature, does almost instantly shrivel and dry, and
+ your object shall be quite another thing, before you can half delineate
+ it, which proceeds not from the extraordinary exhalation, but from the small
+ proportion of body and juices, to the usual drying of bodies in the Air,
+ especially if warm. </font></p>
+ <p><font size="4">For which inconvenience, where I could not otherwise remove
+ it, I thought of this expedient. I took the creature, I had design'd to delineate,
+ and put it into a drop of very well rectified spirit of Wine, this I found
+ would presently dispatch, as it were, the Animal, and being taken out of
+ it, and lay'd on a paper,the spirit of Wine would immediately fly away,
+ and leave the Animal dry, in its natural posture, or at least, in a constitution,
+ that it might easily with a pin be plac'd, in what posture you desired to
+ draw it, and the limbs would so remain, without either moving, or shriveling.
+ </font></p>
+ <p><font size="4">And thus I dealt with this Ant, which I have here delineated,
+ which was one of many, of a very large kind, that inhabited under the Roots
+ of a Tree, from whence they would sally out in great parties, and make most
+ grievous havock of the Flowers and Fruits, in the ambient Garden, and return back
+ again very expertly, by the same wayes and paths they went. </font></p>
+ <p><font size="4">It was more then half the bigness of an Earwig, of a dark
+ brown, or reddish colour, with long legs, on the hinder of which it would
+ stand up, and raise its head as high as it could above the ground, that it
+ might stare the further about it, just after the same manner as I have also
+ observ'd a hunting Spider to do: and putting my finger towards them, they
+ have at first all run towards it, till almost at it; and then they would stand
+ round about it, at a certain distance, and smell, as it were, and consider
+ whether they should any of them venture any further, till one more bold then
+ the rest venturing to climb it, all the rest, if I would have suffered them,
+ would have immediately followed : much such other seemingly rational actions
+ I have observ'd in this little Vermine with much pleasure, which would be
+ too long to be here related; those that desire more of them may satisfie
+ their curiosity in Ligons History of the Barbadoes. </font></p>
+ <p><font size="4">Having insnar'd several of these into a small Box, I made
+ choice of the tallest grown among them, and separating it from the rest,
+ I gave it a Gill of Brandy, or Spirit of Wine, which after a while e'en knock'd
+ him down dead drunk, so that he became moveless, though at first putting
+ in he struggled for a pretty while very much, till at last, certain bubbles
+ issuing out of his mouth, it ceased to move; this (because I had before found
+ them quickly to recover again, if they were taken out presently) I suffered
+ to lye above an hour in the Spirit; and after I had taken it out, and put
+ its body and legs into a natural posture, remained moveless about an hour;
+ but then, upon a sudden, as if it had been awaken out of a drunken sleep,
+ it suddenly reviv'd and ran away; being caught, and serv'd as before, he
+ for a while continued struggling and striving, till at last there issued
+ several bubbles out of its mouth, and then, tanquam animam expirasset, he
+ remained moveless for a good while ; but at length again recovering, it was
+ again redipt, and suffered to lye some hours in the Spirit; notwithstanding
+ which, after it had layen dry some three or four hours, it again recovered
+ life and motion: Which kind of Experiments, if prosecuted, which they highly
+ deserve, seem to me of no inconsiderable use towards the invention of the
+ Latent Scheme, (as the Noble Ve rulam calls it) or the hidden, unknown Texture
+ of Bodies. </font></p>
+ <p><font size="4">Of what Figure this Creature appear'd through the Microscope,
+ the 32. Scheme (though not so carefully graven as it ought) will represent
+ to the eye, namely, That it had a large head A A, at the upper end of which
+ were two protuberant eyes, pearl'd like those of a Fly, but smaller B B;
+ of the Nose, or foremost part, issued two horns C C, of a shape sufficiently
+ differing from those of a blew Fly, though indeed they seem to be both the
+ same kind of Organ, and to serve for a kind of smelling; beyond these were
+ two indented jaws D D, which he open'd sideways, and was able to gape them
+ asunder very wide; and the ends of them being armed with teeth, which meeting
+ went between each other, it was able to grasp and hold a heavy body, three
+ or four times the bulk and weight of its own body: It had only six legs,
+ shap'd like those of a Fly, which, as I shewed before, is an Argument that
+ it is a winged Insect, and though I could not perceive any sign of them in
+ the middle part of its body (which seem'd to consist of three joints or pieces
+ E F G, out of which sprung two legs, yet 'tis known that there are of them
+ that have long wings, and fly up and down in the air. </font></p>
+ <p><font size="4">The third and last part of its body I I I was bigger and
+ larger then the other two, unto which it was joyn'd by a very small middle,
+ and had a kind of loose shell, or another distinct part of its body H, which
+ seem'd to be interpos'd, and to keep the thorax and belly from touching.
+ The whole body was cas'd over with a very strong armour, and the belly I
+ I I was covered likewise with multitudes of small white shining brisles;
+ the legs, horns, head, and middle parts of its body were bestruck with hairs
+ also, but smaller and darker. </font></p>
+ </blockquote>
+ <p> </p>
+ <p><a href="seaweed.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="bug.html" name="bug"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+ <p> </p>
+ <p> </p>
+</blockquote>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/bug.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,128 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/bug.jpg" width="516" height="445">
+<br>
+<h1 align="center">Observ. LIV. Of a Louse.<br>
+</h1>
+<p align="center"> </p>
+<blockquote>
+ <blockquote>
+ <p><font size="4">This is a Creature so officious, that 'twill be known to
+ every one at one time or other, so busie, and so impudent, that it will
+ be intruding it self in every ones company, and so proud and aspiring withall,
+ that it fears not to trample on the best, and affects nothing so much as
+ a Crown; feeds and lives very high, and that makes it so saucy, as to pull
+ any one by the ears that comes in its way, and will never be quiet till
+ it has drawn blood: it is troubled at nothing so much as at a man that scratches
+ his head, as knowing that man is plotting and contriving some mischief against
+ it, and that makes it oftentime sculk into some meaner and lower place, and
+ run behind a mans back, though it go very much against the hair; which ill
+ conditions of it having made it better known then trusted, would exempt me
+ from making any further description of it, did not my faithful Mercury, my
+ Microscope, bring me other information of it. </font></p>
+ <p><font size="4">For this has discovered to me, by means of a very bright light
+ cast on it, that it is a Creature of a very odd shape ; it has a head shap'd
+ like that exprest in 35. Scheme marked with A, which seems almost Conical,
+ but is a little flatted on the upper and under sides, at the biggest part
+ of which, on either side behind the head (as it were, being the place where
+ other Creatures ears stand) are placed its two black shining goggle eyes
+ B B, looking backwards, and fenced round with several small cilia or hairs
+ that incompass it, so that it seems this Creature has no very good foresight:
+ It does not seem to have any eyelids, and therefore perhaps its eyes were
+ so placed, that it might the better cleanse them with its forelegs; and perhaps
+ this may be the reason, why they so much avoid and run from the light behind
+ them, for being made to live in the shady and dark recesses of the hair,
+ and thence probably their eye having a great aperture, the open and clear
+ light, especially that of the Sun, must needs very much offend them; to secure
+ these eyes from receiving any injury from the hairs through which it passes,
+ it has two horns that grow before it, in the place where one would have thought
+ the eyes should be; each of these C C have four joynts, which are fringed,
+ as 'twere, with small brisles, from which to the tip of its snout D, the
+ head seems very round and tapering, ending in a very sharp nose D, which
+ seems to have a small hole, and to be the passage through which he sucks
+ the blood. </font></p>
+ <p> </p>
+ <p><img src="Octavo/bug2.jpg" width="537" height="348"></p>
+ <p><font size="4">Now whereas it if be plac'd on its back, with its belly
+ upwards, as it is in the 35. Scheme, it seems in several Positions to have
+ a resemblance of chaps, or jaws, as is represented in the Figure by E E,
+ yet in other postures those dark strokes disappear; and having kept several
+ of them in a box for two or three dayes, so that for all that time they had
+ nothing to feed on, I found, upon letting onecreep on my hand, that it immediately
+ fell to sucking, and did neither seem to thrust its nose very deep into the
+ skin, nor to open any kind of mouth, but I could plainly perceive a small
+ current of blood, which came directly from its snout, and past into its belly;
+ and about A there seem'd a contrivance, somewhat resembling a Pump, pair
+ of Bellows, or Heart, for by a very swift systole and diastole the blood
+ seem'd drawn from the nose, and forced into the body. </font></p>
+ <p><font size="4">It did not seem at all, though I viewed it a good while as
+ it was sucking, to thrust more of its nose into the skin then the very snout
+ D, nor did it cause the least discernable pain, and yet the blood seem'd
+ to run through its head very quick and freely, so that it seems there is
+ no part of the skin but the blood is dispers'd into, nay, even into the
+ cuticula; for had it thrust its whole nose in from D to C C, it would not
+ have amounted to the supposed thickness of that tegument, the length of
+ the nose being not more then a three hundredth part of an inch. </font></p>
+ <p><font size="4">It has six legs, covered with a very transparent shell,
+ and joynted exactly like a Crab's, or Lobster's; each leg is divided into
+ six parts by these joynts, and those have here and there several small hairs;
+ and at the end of each leg it has two claws, very properly adapted for its
+ peculiar use, being thereby inabled to walk very securely both on the skin
+ and hair; and indeed this contrivance of the feet is very curious, and could
+ not be made more commodiously and compendiously, for performing both these
+ requisite motions, of walking and climbing up the hair of a mans head, then
+ it is : for, by having the lesser claw (a) set so much short of the bigger
+ (b) when it walks on the skin the shorter touches not, and then the feet
+ are the same with those of a Mite, and several other small Insects, but by
+ means of the small joynts of the longer claw it can bend it round, and so
+ with both claws take hold of a hair, in the manner represented in the Figure,
+ the long transparent Cylinder F F F, being a Man's hair held by it. </font></p>
+ <p><font size="4">The Thorax seem'd cas'd with another kind of substance then
+ the belly, namely, with a thin transparent horny substance, which upon the fasting
+ of the Creature did not grow flaccid; through this I could plainly see the
+ blood, suck'd from my hand, to be variously distributed, and mov'd to and
+ fro; and about G there seem'd a pretty big white substance, which seem'd
+ to be moved within its thorax; besides, there appear'd very many small milk-white
+ vessels, which crost over the breast between the legs, out of which, on
+ either side, are many small branchings, these seem'd to be the veins and
+ arteries, for that which is analogus to blood in all Insects is milk-white.
+ </font></p>
+ <p><font size="4">The belly is covered with a transparent substance likewise,
+ but more resembling a skin then a shell, for 'tis grain'd all over the belly
+ just like the skin in the palms of a man's hand, and when the belly is empty,
+ grows very flaccid and wrinkled ; at the upper end of this is placed the
+ stomach H H, and perhaps also the white spot I I may be the liver, or pancreas,
+ which by the peristaltick motion of the guts, is a little mov'd to and fro,
+ not with a systole and diastole, but rather with a thronging or justling
+ motion. </font></p>
+ <p><font size="4">Viewing one of these Creatures, after it had fasted two
+ dayes, all the hinder part was lank and flaccid, and the white spot I I
+ hardly mov'd, most of the white branchings disappear'd, and most also of
+ the redness or sucked blood in the guts, the peristaltick motion of which
+ was scarce discernable; but upon the suffering it to suck, it presently
+ fill'd the skin of the belly, and of the six scolop'd embosments on either side,
+ as full as it could be stuft ; the stomach and guts were as full as they
+ could hold; the peristaltick motion of the gut grew quick, and the justling
+ motion of I I accordingly ; multitudes of milk-white vessels seem'd quickly
+ filled, and turgid, which were perhaps the veins and arteries, and the Creature
+ was so greedy, that though it could not contain more, yet it continued sucking
+ as fast as ever, and as fast emptying it self behind : the digestion of this
+ Creature must needs be very quick, for though I perceiv'd the blood thicker
+ and blacker when suck'd, yet, when in the guts, it was of a very lovely
+ ruby colour, and that part of it, which was digested into the veins, seemed
+ white; whence it appears, that a further digestion of blood may make it
+ milk, at least of a resembling colour : What is else observable in the figure
+ of this Creature, maybe seen by the 35. Scheme.</font></p>
+ </blockquote>
+ <p> </p>
+ <p><a href="ant.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="index.html" name="index"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+ <p> </p>
+ <p> </p>
+</blockquote>
+</body>
+</html>
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/editorpane/back.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/editorpane/forward.jpg has changed
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/editorpane/header.jpg has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/index.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,41 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body bgcolor="#FFFFFF">
+<img src="Octavo/book.jpg" width="550" height="428">
+<p> </p>
+<p align="center"><img src="editorpane/header.jpg" width="363" height="171"></p>
+<p align="center"> </p>
+<p align="center"> </p>
+<blockquote>
+ <h3><b><a href="title.html" name="title">Title Page</a></b></h3>
+ <h3><b><a href="king.html">To The King</a></b></h3>
+ <h3><b><a href="preface.html">The Preface</a></b></h3>
+ <h3><a href="seaweed.html">Of the curious texture of Sea-weeds</a></h3>
+ <h3><a href="ant.html">Of an Ant or Pismire</a></h3>
+ <h3><a href="bug.html">Of a Louse</a> <br>
+ <br>
+ <br>
+ </h3>
+ <p><font color="#990000" size="4">Images and text used by permission of Octavo
+ Corporation (www.octavo.com),<br>
+ </font><font color="#990000" size="4">(c) 1999 Octavo Corporation. All
+ rights reserved.</font> <br>
+ <br>
+ <br>
+ <font size="2">Octavo Corporation is a publisher of rare
+ books and manuscripts with digital tools and formats through partnerships
+ with libraries, museums, and individuals. Using high-resolution digital imaging
+ technology, Octavo releases digital rare books on CD-ROM as Adobe PDF files
+ which can be viewed on and printed from almost any computing platform. You
+ can view each page and the binding on your computer screen, zoom in to view
+ detail up to 800% in some cases, and search, copy and paste the "live" text
+ placed invisibly behind the page images which is available for selected Editions.
+ Also included in each edition is the work's collation and provenance, as well
+ as commentary by a noted expert in its field. </font></p>
+</blockquote>
+<p> </p>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/king.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,44 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/king.jpg" width="420" height="290">
+<p align="center"> </p>
+<blockquote> <font size="4">Do here most humbly lay this small Present at Your
+ Majesties Royal feet. And though it comes accompany'd with two disadvantages,
+ the meanness of the Author, and of the Subject; yet in both I am incouraged
+ by the greatness of your Mercy and your Knowledge. </font>
+<p><font size="4">By the one I am taught , that you can forgive the most presumptuous
+ Offendors: And by the other, that you will not esteem the least work of Nature,
+ or Art, unworthy your Observation. </font></p>
+ <p><font size="4">Amidst the many felicities that have accompani'd your Majesties
+ happy Restauration and Government, it is none of the least considerable, that
+ Philosophy and Experimental Learning have prosper'd under your Royal Patronage.</font></p>
+ <p><font size="4">And as the calm prosperity of your Reign has given us the
+ leisure to follow these Studies of quiet and retirement, so it is just, that
+ the Fruits of them should, by way of acknowledgement, be return'd to your
+ Majesty. There are, Sir, several other of your Subjects, of your Royal Society,
+ now busie about Nobler matters: The Improvement of Manufactures and Agriculture,
+ the Increase of Commerce, the Advantage of Navigation: In all which they are
+ assisted by your Majesties Incouragement and Example. </font></p>
+ <p><font size="4">Amidst all those greater Designs, I here presume to bring
+ in that which is more proportionable to the smalness of my Abilities, and
+ to offer some of the least of all visible things, to that Mighty King, that
+ has establisht an Empire over the best of all Invisible things of this World,
+ the Minds o f Men.</font></p>
+ <blockquote>
+ <p align="right"> </p>
+ </blockquote>
+ <p align="right"><i><font size="5">Your Majesties most humble</font></i></p>
+ <p align="right"><font size="5"><i> and most obedient</i></font></p>
+ <p align="right"><font size="5"><i> Subject and Servant,</i></font></p>
+ <p align="right"> </p>
+ <p align="right"><b><font size="5">ROBERT HOOKE .</font></b></p>
+ <p align="right"> </p>
+ <p align="right"><a href="title.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="preface.html" name="preface"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+</blockquote>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/preface.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,116 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/micro.jpg" width="381" height="384">
+<div align="center">
+ <p> </p>
+ <h1 align="center">THE PREFACE</h1>
+ </div>
+<div align="right">
+ <p align="left"> </p>
+ <p> </p>
+</div>
+<blockquote>
+ <div align="left">
+ <p><font size="5"> <font size="4">It is the great prerogative of Mankind above
+ other Creatures, that we are not only able to behold the works of Nature,
+ or barely to sustein our lives by them, but we have also the power of considering,
+ comparing, altering, assisting, and improving them to various uses. </font></font></p>
+ <p><font size="4">And as this is the peculiar priviledge of humane Nature
+ in general, so is it capable of being so far advanced by the helps of Art,
+ and Experience, as to make some Men excel others in their Observations,
+ and Deductions, almost as much as they do Beasts. </font></p>
+ <p><font size="4">By the addition of such artificial Instruments and methods,
+ there may be, in some manner, a reparation made for the mischiefs, and imperfection,
+ mankind has drawn upon itself, by negligence, and intemperance, and a wilful
+ and superstitious deserting the Prescripts and Rules of Nature, whereby
+ every man, both from a deriv'd corruption, innate and born with him, and
+ from his breeding and converse with men, is very subject to slip into all
+ sorts of errors. </font></p>
+ <p><font size="4">The only way which now remains for us to recover some degree
+ of those former perfections, seems to be, by rectifying the operations of
+ the Sense, the Memory, and Reason, since upon the evidence, the strength,
+ the integrity, and the right correspondence of all these, all the light,
+ by which our actions are to be guided, is to be renewed, and all our command
+ over things is to be establisht.</font></p>
+ <p><font size="4"> It is therefore most worthy of our consideration, to recollect
+ their several defects, that so we may the better understand how to supply
+ them, and by what assistances we may inlarge their power, and secure them
+ in performing their particular duties.</font></p>
+ <p><font size="4">As for the actions of our Senses, we cannot but observe
+ them to be in many particulars much outdone by those of other Creatures,
+ and when at best, to be far short of the perfection they seem capable of
+ : And these infirmities of the Senses arise from a double cause, either
+ from the disproportion of the Object to the Organ, whereby an infinite number
+ of things can never enter into them, or else from error in the Perception,
+ that many things, which come within their reach, are not received in a right
+ manner. </font></p>
+ <p><font size="4">The like frailties are to be found in the Memory; we often
+ let many things slip away from us, which deserve to be retain'd; and of
+ those which we treasure up, a great part is either frivolous or false ;
+ and if good, and substantial, either in tract of time obliterated, or at
+ best so overwhelmed and buried under more frothy notions, that when there
+ is need of them, they are in vain sought for. </font></p>
+ <p><font size="4">The two main foundations being so deceivable, it is no wonder,
+ that all the succeeding works which we build upon them, of arguing, concluding,
+ defining, judging, and all the other degrees of Reason, are lyable to the
+ same imperfection, being, at best, either vain, or uncertain: So that the
+ errors of the understanding are answerable to the two other, being defective
+ both in the quantity and goodness of its knowledge; for the limits, to which
+ our thoughts are confind, are small in respect of the vast extent of Nature
+ it self; some parts of it are too large to be comprehended, and some too
+ little to be perceived. </font></p>
+ <p><font size="4">And from thence it must follow, that not having a full sensation
+ of the Object, we must be very lame and imperfect in our conceptions about
+ it, and in all the propositions which we build upon it; hence we often take
+ the shadow of things for the substance, small appearances for good similitudes,
+ similitudes for definitions; and even many of those, which we think to be
+ the most solid definitions, are rather expressions of our own misguided
+ apprehensions then of the true nature of the things themselves. </font></p>
+ <p><font size="4">The effects of these imperfections are manifested in different
+ ways, according to the temper and disposition of the several minds of men,
+ some they incline to gross ignorance and stupidity, and others to a presumptuous
+ imposing on other mens Opinions, and a confident dogmatizing on matters,
+ whereof there is no assurance to be given. </font></p>
+ <p><font size="4">Thus all the uncertainty, and mistakes of humane actions,
+ proceed either from the narrowness and wandring of our Senses, from the
+ slipperiness or delusion of our Memory, from the confinement or rashness
+ of our Understanding, so that 'tis no wonder, that our power over natural
+ causes and effects is so slowly improvd, seeing we are not only to contend
+ with the obscurity and difficulty of the things whereon we work and think,
+ but even the forces of our own minds conspire to betray us. </font></p>
+ <p><font size="4">These being the dangers in the process of humane Reason,
+ the remedies of them all can only proceed from the real, the mechanical,
+ the experimental Philosophy, which has this advantage over the Philosophy
+ of discourse and disputation, that whereas that chiefly aims at the subtilty
+ of its Deductions and Conclusions, without much regard to the first groundwork,
+ which ought to be well laid on the Sense and Memory ; so this intends the
+ right ordering of them all, and the making them serviceable to each other.
+ </font></p>
+ <p><font size="4">The first thing to be undertaken in this weighty work, is
+ a watchfulness over the failings and an inlargement of the dominion, of
+ the Senses. To which end it is requisite, first, That there should be a
+ scrupulous choice, and a strict examination, of the reality, constancy,
+ and certainty of the Particulars that we admit: This is the first rise whereon
+ truth is to begin, and here the most severe, and most impartial diligence,
+ must be imployed ; the storing up of all, without any regard to evidence
+ or use, will only tend to darkness and confusion. </font></p>
+ <p><font size="4">We must not therefore esteem the riches of our Philosophical
+ treasure by the number only, but chiefly by the weight; the most vulgar
+ Instances are not to be neglected, but above all, the most instructive are
+ to be entertain'd: the footsteps of Nature are to be trac'd, not only in
+ her ordinary course,but when she seems to be put to her shifts, to make
+ many doublings and turnings, and to use some kind of art in indeavouring
+ to avoid our discovery. </font></p>
+ <p> </p>
+ <p><a href="king.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="seaweed.html" name="seaweed"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+ <p> </p>
+ <p> </p>
+ </div>
+</blockquote>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/seaweed.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,62 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/seaweed.jpg" width="316" height="498">
+<h1 align="center"><br>
+ Observ. XXIII. Of the curious texture of Sea-weeds.<br>
+</h1>
+<p align="center"> </p>
+<blockquote>
+ <p><font size="4">For curiosity and beauty, I have not among all the Plants
+ or Vegetables I have yet observ'd, seen any one comparable to this Sea-weed
+ I have here describ'd, of which I am able to say very little more then what
+ is represented by the second Figure of the ninth Scheme: Namely, that it is
+ a Plant which grows upon the Rocks under the water, and increases and spreads
+ it self into a great tuft, which is not onely handsomely branch'd into several
+ leaves, but the whole surface of the Plant is cover'd over with a most curious
+ kind of carv'd work, which consists of a texture much resembling a Honeycomb;
+ for the whole surface on both sides is cover'd over with a multitude of very
+ small holes, being no bigger then so many holes made with the point of a small
+ Pinn, and rang'd in the neatest and most delicate order imaginable, they being
+ plac'd in the manner of a Quincunx, or very much like the rows of the eyes
+ of a Fly, the rows or orders being very regular, which way soever they are
+ observ'd: what the texture was, as it appear'd through a pretty bigg Magnifying
+ Microscope, I have here adjoin'd in the first Figure of the 14. Scheme. which
+ round Area A B C D represents a part of the surface about one eighth part
+ of an Inch in Diameter: Those little holes, which to the eye look'd round,
+ like so many little spots, here appear'd very regularly shap'd holes, representing
+ almost the shape of the sole of a round toed shoe, the hinder part of which,
+ is, as it were, trod on or cover'd by the toe of that next below it; these
+ holes seem'd wall'd about with a very thin and transparent substance, looking
+ of a pale straw-colour; from the edge of which, against the middle of each
+ hole, were sprouted out four small transparent straw-colour'd Thorns, which
+ seem'd to protect and cover those cavities, from either side two; neer the
+ root of this Plant, were sprouted out several small branches of a kind of
+ bastard Coralline, curiously branch'd, though small. </font></p>
+ <p><font size="4">And to confirm this, having lately the opportunity of viewing
+ the large Plant (if I may so call it) of a Sponge petrify'd, of which I made
+ mention in the last Observation, I found, that each of the Branches or Figures
+ of it, did, by the range of its pores, exhibit just such a texture, the rows
+ of pores crossing one another, much after the manner as the rows of eyes do
+ which are describ'd in the 26. Scheme : Coralline also, and several sorts of
+ white Coral, I have with a Microscope observ'd very curiously shap'd. And
+ I doubt not, but that he that shall observe these several kinds of Plants that
+ grow upon Rocks, which the Sea sometimes overflows, and those heaps of others
+ which are vomited out of it upon the shore, may find multitudes of little
+ Plants, and other bodies, which like this will afford very beautifull objects
+ for the Microscope ; and this Specimen here is adjoin'd onely to excite their
+ curiosities who have opportunity of observing to examine and collect what
+ they find worthy their notice; for the Sea, among terrestrial bodies, is also
+ a prolifick mother, and affords as many Instances of spontaneous generations
+ as either the Air or Earth.</font></p>
+ <p> </p>
+ <p><a href="preface.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="ant.html" name="ant"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+ <p> </p>
+ <p> </p>
+</blockquote>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/book/title.html Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,37 @@
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<img src="Octavo/crest.jpg" width="320" height="342">
+<h1 align="center"><font size="+1"><b><font size="+4" color="#990033"><br>
+ MICROGRAPHIA:</font><font size="+4"> </font></b></font></h1>
+<p align="center"><b>OR SOME </b></p>
+<p align="center"><font size="5">Physiological Descriptions </font></p>
+<p align="center"><b>O F</b></p>
+<p align="center"> <font size="6"><b><font color="#9F1040">MINUTE BODIES</font></b></font></p>
+<p align="center"> <b>MADE BY </b></p>
+<p align="center"><font size="5" color="#9F1040">MAGNIFYING GLASSES. </font></p>
+<p align="center"><b>WITH </b></p>
+<p align="center"><b><font color="#990033">OBSERVATIONS</font></b> and <b><font color="#9F1040">INQUIRIES</font></b>
+ thereupon.</p>
+<p align="center"> By <font color="#990033"><i><b>R. HOOKE</b></i></font><b><i>
+ ,</i></b> Fellow of the <font color="#990033">ROYAL SOCIETY</font> .</p>
+<blockquote>
+ <blockquote>
+ <blockquote>
+ <p align="center"><i>LONDON</i>, Printed by <font color="#990033"><i>Jo.
+ Martyn</i>,</font> and <font color="#990033"><i>Ja. Allestry,</i></font>
+ Printers to the <font color="#990033">ROYAL SOCIETY </font>, and are to
+ be sold at their Shop at the Bell in S. Paul's Church-yard. <font color="#990000">M
+ D C L X V.</font></p>
+ <p align="center"><font color="#990000"><br>
+ </font></p>
+ </blockquote>
+ <p><a href="index.html"><img src="editorpane/back.jpg" width="146" height="40" align="left" border="0"></a><a href="king.html" name="king"><img src="editorpane/forward.jpg" width="196" height="40" align="right" border="0"></a></p>
+ </blockquote>
+</blockquote>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/resources/EditorPaneDemo.properties Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,6 @@
+### Html Demo ###
+
+EditorPaneDemo.accessible_description=This demo shows how to display html text using the JEditorPane component.
+EditorPaneDemo.tooltip=JEditorPane HTML demo
+EditorPaneDemo.name=JEditorPane HTML Demo
+EditorPaneDemo.filename=swing.html
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/editorpane/resources/images/EditorPaneDemo.gif has changed
--- a/test/jdk/sun/net/ftp/FtpURLConnectionLeak.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sun/net/ftp/FtpURLConnectionLeak.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -30,7 +30,6 @@
* @run main FtpURLConnectionLeak
*/
import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
@@ -44,27 +43,26 @@
int port = server.getLocalPort();
server.start();
URL url = new URL("ftp://localhost:" + port + "/filedoesNotExist.txt");
- for (int i = 0; i < 3; i++) {
- try {
- InputStream stream = url.openStream();
- } catch (FileNotFoundException expectedFirstTimeAround) {
- // should always reach this point since the path does not exist
- } catch (IOException expected) {
- System.out.println("caught expected " + expected);
- int times = 1;
- do {
- // give some time to close the connection...
- System.out.println("sleeping... " + times);
- Thread.sleep(times * 1000);
- } while (server.activeClientsCount() > 0 && times++ < 5);
+ try (server) {
+ for (int i = 0; i < 3; i++) {
+ try {
+ InputStream stream = url.openStream();
+ } catch (FileNotFoundException expected) {
+ // should always reach this point since the path does not exist
+ System.out.println("caught expected " + expected);
+ int times = 1;
+ do {
+ // give some time to close the connection...
+ System.out.println("sleeping... " + times);
+ Thread.sleep(times * 1000);
+ } while (server.activeClientsCount() > 0 && times++ < 5);
- if (server.activeClientsCount() > 0) {
- server.killClients();
- throw new RuntimeException("URLConnection didn't close the" +
- " FTP connection on FileNotFoundException");
+ if (server.activeClientsCount() > 0) {
+ server.killClients();
+ throw new RuntimeException("URLConnection didn't close the" +
+ " FTP connection on FileNotFoundException");
+ }
}
- } finally {
- server.terminate();
}
}
}
--- a/test/jdk/sun/net/www/ftptest/FtpCommandHandler.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sun/net/www/ftptest/FtpCommandHandler.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -442,8 +442,14 @@
// cmd.setSoTimeout(2000);
in = new BufferedReader(new InputStreamReader(cmd.getInputStream()));
out = new PrintStream(cmd.getOutputStream(), true, "ISO8859_1");
+ // Below corrupted message style was intentional to test 8151586, please
+ // make sure each message line not broken ftp communication (such as for
+ // message line lenght >=4, the 4th char required '-' to allow
+ // implementation thinks that it has seen multi-line reply '###-'
+ // sequence), otherwise it will affect normal ftp tests which depends
+ // on this.
out.println("---------------------------------\n220 Java FTP test server"
- + " (j2se 6.0) ready.\n \n Please send commands\n"
+ + " (j2se 6.0) ready.\n \n - Please send commands\n"
+ "-----------------------------\n\n\n");
out.flush();
if (auth.authType() == 0) // No auth needed
--- a/test/jdk/sun/net/www/ftptest/FtpServer.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sun/net/www/ftptest/FtpServer.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -47,7 +47,7 @@
*
*/
-public class FtpServer extends Thread {
+public class FtpServer extends Thread implements AutoCloseable {
private ServerSocket listener = null;
private FtpFileSystemHandler fsh = null;
private FtpAuthHandler auth = null;
@@ -134,4 +134,13 @@
}
}
+
+ @Override
+ public void close() throws Exception {
+ terminate();
+ listener.close();
+ if (activeClientsCount() > 0) {
+ killClients();
+ }
+ }
}
--- a/test/jdk/sun/net/www/protocol/http/RedirectOnPost.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/sun/net/www/protocol/http/RedirectOnPost.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -23,9 +23,9 @@
/**
* @test
- * @library /lib/testlibrary/
+ * @library /test/lib
* @modules jdk.httpserver
- * @build jdk.testlibrary.SimpleSSLContext
+ * @build jdk.test.lib.net.SimpleSSLContext
* @compile RedirectOnPost.java
* @run main/othervm RedirectOnPost
* @bug 8029127
@@ -38,7 +38,7 @@
import com.sun.net.httpserver.*;
import java.util.concurrent.*;
import javax.net.ssl.*;
-import jdk.testlibrary.SimpleSSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
public class RedirectOnPost {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/lib/CheckBlacklistedCerts.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2013, 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8011402 8211969
+ * @summary Move blacklisting certificate logic from hard code to data
+ * @modules java.base/sun.security.util
+ */
+
+import sun.security.util.UntrustedCertificates;
+
+import java.io.*;
+import java.security.KeyStore;
+import java.security.cert.*;
+import java.util.*;
+
+public class CheckBlacklistedCerts {
+ public static void main(String[] args) throws Exception {
+
+ String home = System.getProperty("java.home");
+ boolean failed = false;
+
+ // Root CAs should always be trusted
+ File file = new File(home, "lib/security/cacerts");
+ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ try (FileInputStream fis = new FileInputStream(file)) {
+ ks.load(fis, null);
+ }
+ System.out.println("Check for cacerts: " + ks.size());
+ for (String alias: Collections.list(ks.aliases())) {
+ X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
+ if (UntrustedCertificates.isUntrusted(cert)) {
+ System.out.print(alias + " is untrusted");
+ failed = true;
+ }
+ }
+
+ // All certs in the pem files
+ Set<Certificate> blacklisted = new HashSet<>();
+
+ // Assumes the full src is available
+ File blacklist = new File(System.getProperty("test.src"),
+ "../../../../../make/data/blacklistedcertsconverter/blacklisted.certs.pem");
+
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ try (FileInputStream fis = new FileInputStream(blacklist)) {
+ Collection<? extends Certificate> certs
+ = cf.generateCertificates(fis);
+ System.out.println(certs.size());
+ for (Certificate c: certs) {
+ blacklisted.add(c);
+ X509Certificate cert = ((X509Certificate)c);
+ if (!UntrustedCertificates.isUntrusted(cert)) {
+ System.out.println(cert.getSubjectDN() + " is trusted");
+ failed = true;
+ }
+ }
+ }
+
+ // Check the blacklisted.certs file itself
+ file = new File(home, "lib/security/blacklisted.certs");
+ System.out.print("Check for " + file + ": ");
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(new FileInputStream(file)))) {
+ int acount = 0;
+ int ccount = 0;
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) break;
+ if (line.startsWith("Algorithm")) {
+ acount++;
+ } else if (!line.isEmpty() && !line.startsWith("#")) {
+ ccount++;
+ }
+ }
+ System.out.println(acount + " algs, " + ccount + " certs" );
+ if (acount != 1) {
+ System.out.println("There are " + acount + " algorithms");
+ failed = true;
+ }
+ if (ccount != blacklisted.size()
+ && !blacklisted.isEmpty()) {
+ System.out.println("Wrong blacklisted.certs size: "
+ + ccount + " fingerprints, "
+ + blacklisted.size() + " certs");
+ failed = true;
+ }
+ }
+
+ if (failed) {
+ throw new Exception("Failed");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 2017, 2018, 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.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452
+ * 8209506 8210432
+ * @summary Check root CA entries in cacerts file
+ */
+import java.io.File;
+import java.io.FileInputStream;
+import java.security.KeyStore;
+import java.security.MessageDigest;
+import java.security.cert.*;
+import java.util.*;
+
+public class VerifyCACerts {
+
+ private static final String CACERTS
+ = System.getProperty("java.home") + File.separator + "lib"
+ + File.separator + "security" + File.separator + "cacerts";
+
+ // The numbers of certs now.
+ private static final int COUNT = 93;
+
+ // map of cert alias to SHA-256 fingerprint
+ private static final Map<String, String> FINGERPRINT_MAP
+ = new HashMap<String, String>() {
+ {
+ put("actalisauthenticationrootca [jdk]",
+ "55:92:60:84:EC:96:3A:64:B9:6E:2A:BE:01:CE:0B:A8:6A:64:FB:FE:BC:C7:AA:B5:AF:C1:55:B3:7F:D7:60:66");
+ put("buypassclass2ca [jdk]",
+ "9A:11:40:25:19:7C:5B:B9:5D:94:E6:3D:55:CD:43:79:08:47:B6:46:B2:3C:DF:11:AD:A4:A0:0E:FF:15:FB:48");
+ put("buypassclass3ca [jdk]",
+ "ED:F7:EB:BC:A2:7A:2A:38:4D:38:7B:7D:40:10:C6:66:E2:ED:B4:84:3E:4C:29:B4:AE:1D:5B:93:32:E6:B2:4D");
+ put("camerfirmachambersca [jdk]",
+ "06:3E:4A:FA:C4:91:DF:D3:32:F3:08:9B:85:42:E9:46:17:D8:93:D7:FE:94:4E:10:A7:93:7E:E2:9D:96:93:C0");
+ put("camerfirmachambersignca [jdk]",
+ "13:63:35:43:93:34:A7:69:80:16:A0:D3:24:DE:72:28:4E:07:9D:7B:52:20:BB:8F:BD:74:78:16:EE:BE:BA:CA");
+ put("camerfirmachamberscommerceca [jdk]",
+ "0C:25:8A:12:A5:67:4A:EF:25:F2:8B:A7:DC:FA:EC:EE:A3:48:E5:41:E6:F5:CC:4E:E6:3B:71:B3:61:60:6A:C3");
+ put("certumca [jdk]",
+ "D8:E0:FE:BC:1D:B2:E3:8D:00:94:0F:37:D2:7D:41:34:4D:99:3E:73:4B:99:D5:65:6D:97:78:D4:D8:14:36:24");
+ put("certumtrustednetworkca [jdk]",
+ "5C:58:46:8D:55:F5:8E:49:7E:74:39:82:D2:B5:00:10:B6:D1:65:37:4A:CF:83:A7:D4:A3:2D:B7:68:C4:40:8E");
+ put("chunghwaepkirootca [jdk]",
+ "C0:A6:F4:DC:63:A2:4B:FD:CF:54:EF:2A:6A:08:2A:0A:72:DE:35:80:3E:2F:F5:FF:52:7A:E5:D8:72:06:DF:D5");
+ put("comodorsaca [jdk]",
+ "52:F0:E1:C4:E5:8E:C6:29:29:1B:60:31:7F:07:46:71:B8:5D:7E:A8:0D:5B:07:27:34:63:53:4B:32:B4:02:34");
+ put("comodoaaaca [jdk]",
+ "D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4");
+ put("comodoeccca [jdk]",
+ "17:93:92:7A:06:14:54:97:89:AD:CE:2F:8F:34:F7:F0:B6:6D:0F:3A:E3:A3:B8:4D:21:EC:15:DB:BA:4F:AD:C7");
+ put("usertrustrsaca [jdk]",
+ "E7:93:C9:B0:2F:D8:AA:13:E2:1C:31:22:8A:CC:B0:81:19:64:3B:74:9C:89:89:64:B1:74:6D:46:C3:D4:CB:D2");
+ put("usertrusteccca [jdk]",
+ "4F:F4:60:D5:4B:9C:86:DA:BF:BC:FC:57:12:E0:40:0D:2B:ED:3F:BC:4D:4F:BD:AA:86:E0:6A:DC:D2:A9:AD:7A");
+ put("utnuserfirstobjectca [jdk]",
+ "6F:FF:78:E4:00:A7:0C:11:01:1C:D8:59:77:C4:59:FB:5A:F9:6A:3D:F0:54:08:20:D0:F4:B8:60:78:75:E5:8F");
+ put("utnuserfirstclientauthemailca [jdk]",
+ "43:F2:57:41:2D:44:0D:62:74:76:97:4F:87:7D:A8:F1:FC:24:44:56:5A:36:7A:E6:0E:DD:C2:7A:41:25:31:AE");
+ put("utnuserfirsthardwareca [jdk]",
+ "6E:A5:47:41:D0:04:66:7E:ED:1B:48:16:63:4A:A3:A7:9E:6E:4B:96:95:0F:82:79:DA:FC:8D:9B:D8:81:21:37");
+ put("addtrustclass1ca [jdk]",
+ "8C:72:09:27:9A:C0:4E:27:5E:16:D0:7F:D3:B7:75:E8:01:54:B5:96:80:46:E3:1F:52:DD:25:76:63:24:E9:A7");
+ put("addtrustexternalca [jdk]",
+ "68:7F:A4:51:38:22:78:FF:F0:C8:B1:1F:8D:43:D5:76:67:1C:6E:B2:BC:EA:B4:13:FB:83:D9:65:D0:6D:2F:F2");
+ put("addtrustqualifiedca [jdk]",
+ "80:95:21:08:05:DB:4B:BC:35:5E:44:28:D8:FD:6E:C2:CD:E3:AB:5F:B9:7A:99:42:98:8E:B8:F4:DC:D0:60:16");
+ put("baltimorecybertrustca [jdk]",
+ "16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB");
+ put("digicertglobalrootca [jdk]",
+ "43:48:A0:E9:44:4C:78:CB:26:5E:05:8D:5E:89:44:B4:D8:4F:96:62:BD:26:DB:25:7F:89:34:A4:43:C7:01:61");
+ put("digicertglobalrootg2 [jdk]",
+ "CB:3C:CB:B7:60:31:E5:E0:13:8F:8D:D3:9A:23:F9:DE:47:FF:C3:5E:43:C1:14:4C:EA:27:D4:6A:5A:B1:CB:5F");
+ put("digicertglobalrootg3 [jdk]",
+ "31:AD:66:48:F8:10:41:38:C7:38:F3:9E:A4:32:01:33:39:3E:3A:18:CC:02:29:6E:F9:7C:2A:C9:EF:67:31:D0");
+ put("digicerttrustedrootg4 [jdk]",
+ "55:2F:7B:DC:F1:A7:AF:9E:6C:E6:72:01:7F:4F:12:AB:F7:72:40:C7:8E:76:1A:C2:03:D1:D9:D2:0A:C8:99:88");
+ put("digicertassuredidrootca [jdk]",
+ "3E:90:99:B5:01:5E:8F:48:6C:00:BC:EA:9D:11:1E:E7:21:FA:BA:35:5A:89:BC:F1:DF:69:56:1E:3D:C6:32:5C");
+ put("digicertassuredidg2 [jdk]",
+ "7D:05:EB:B6:82:33:9F:8C:94:51:EE:09:4E:EB:FE:FA:79:53:A1:14:ED:B2:F4:49:49:45:2F:AB:7D:2F:C1:85");
+ put("digicertassuredidg3 [jdk]",
+ "7E:37:CB:8B:4C:47:09:0C:AB:36:55:1B:A6:F4:5D:B8:40:68:0F:BA:16:6A:95:2D:B1:00:71:7F:43:05:3F:C2");
+ put("digicerthighassuranceevrootca [jdk]",
+ "74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF");
+ put("geotrustglobalca [jdk]",
+ "FF:85:6A:2D:25:1D:CD:88:D3:66:56:F4:50:12:67:98:CF:AB:AA:DE:40:79:9C:72:2D:E4:D2:B5:DB:36:A7:3A");
+ put("geotrustprimaryca [jdk]",
+ "37:D5:10:06:C5:12:EA:AB:62:64:21:F1:EC:8C:92:01:3F:C5:F8:2A:E9:8E:E5:33:EB:46:19:B8:DE:B4:D0:6C");
+ put("geotrustprimarycag2 [jdk]",
+ "5E:DB:7A:C4:3B:82:A0:6A:87:61:E8:D7:BE:49:79:EB:F2:61:1F:7D:D7:9B:F9:1C:1C:6B:56:6A:21:9E:D7:66");
+ put("geotrustprimarycag3 [jdk]",
+ "B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4");
+ put("geotrustuniversalca [jdk]",
+ "A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12");
+ put("gtecybertrustglobalca [jdk]",
+ "A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36");
+ put("thawteprimaryrootca [jdk]",
+ "8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F");
+ put("thawteprimaryrootcag2 [jdk]",
+ "A4:31:0D:50:AF:18:A6:44:71:90:37:2A:86:AF:AF:8B:95:1F:FB:43:1D:83:7F:1E:56:88:B4:59:71:ED:15:57");
+ put("thawteprimaryrootcag3 [jdk]",
+ "4B:03:F4:58:07:AD:70:F2:1B:FC:2C:AE:71:C9:FD:E4:60:4C:06:4C:F5:FF:B6:86:BA:E5:DB:AA:D7:FD:D3:4C");
+ put("thawtepremiumserverca [jdk]",
+ "3F:9F:27:D5:83:20:4B:9E:09:C8:A3:D2:06:6C:4B:57:D3:A2:47:9C:36:93:65:08:80:50:56:98:10:5D:BC:E9");
+ put("verisigntsaca [jdk]",
+ "CB:6B:05:D9:E8:E5:7C:D8:82:B1:0B:4D:B7:0D:E4:BB:1D:E4:2B:A4:8A:7B:D0:31:8B:63:5B:F6:E7:78:1A:9D");
+ put("verisignclass2g2ca [jdk]",
+ "3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1");
+ put("verisignclass3ca [jdk]",
+ "A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05");
+ put("verisignclass3g2ca [jdk]",
+ "83:CE:3C:12:29:68:8A:59:3D:48:5F:81:97:3C:0F:91:95:43:1E:DA:37:CC:5E:36:43:0E:79:C7:A8:88:63:8B");
+ put("verisignuniversalrootca [jdk]",
+ "23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C");
+ put("verisignclass3g3ca [jdk]",
+ "EB:04:CF:5E:B1:F3:9A:FA:76:2F:2B:B1:20:F2:96:CB:A5:20:C1:B9:7D:B1:58:95:65:B8:1C:B9:A1:7B:72:44");
+ put("verisignclass3g4ca [jdk]",
+ "69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79");
+ put("verisignclass3g5ca [jdk]",
+ "9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF");
+ put("certplusclass2primaryca [jdk]",
+ "0F:99:3C:8A:EF:97:BA:AF:56:87:14:0E:D5:9A:D1:82:1B:B4:AF:AC:F0:AA:9A:58:B5:D5:7A:33:8A:3A:FB:CB");
+ put("certplusclass3pprimaryca [jdk]",
+ "CC:C8:94:89:37:1B:AD:11:1C:90:61:9B:EA:24:0A:2E:6D:AD:D9:9F:9F:6E:1D:4D:41:E5:8E:D6:DE:3D:02:85");
+ put("keynectisrootca [jdk]",
+ "42:10:F1:99:49:9A:9A:C3:3C:8D:E0:2B:A6:DB:AA:14:40:8B:DD:8A:6E:32:46:89:C1:92:2D:06:97:15:A3:32");
+ put("dtrustclass3ca2 [jdk]",
+ "49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1");
+ put("dtrustclass3ca2ev [jdk]",
+ "EE:C5:49:6B:98:8C:E9:86:25:B9:34:09:2E:EC:29:08:BE:D0:B0:F3:16:C2:D4:73:0C:84:EA:F1:F3:D3:48:81");
+ put("identrustdstx3 [jdk]",
+ "06:87:26:03:31:A7:24:03:D9:09:F1:05:E6:9B:CF:0D:32:E1:BD:24:93:FF:C6:D9:20:6D:11:BC:D6:77:07:39");
+ put("identrustpublicca [jdk]",
+ "30:D0:89:5A:9A:44:8A:26:20:91:63:55:22:D1:F5:20:10:B5:86:7A:CA:E1:2C:78:EF:95:8F:D4:F4:38:9F:2F");
+ put("identrustcommercial [jdk]",
+ "5D:56:49:9B:E4:D2:E0:8B:CF:CA:D0:8A:3E:38:72:3D:50:50:3B:DE:70:69:48:E4:2F:55:60:30:19:E5:28:AE");
+ put("letsencryptisrgx1 [jdk]",
+ "96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6");
+ put("luxtrustglobalrootca [jdk]",
+ "A1:B2:DB:EB:64:E7:06:C6:16:9E:3C:41:18:B2:3B:AA:09:01:8A:84:27:66:6D:8B:F0:E2:88:91:EC:05:19:50");
+ put("quovadisrootca [jdk]",
+ "A4:5E:DE:3B:BB:F0:9C:8A:E1:5C:72:EF:C0:72:68:D6:93:A2:1C:99:6F:D5:1E:67:CA:07:94:60:FD:6D:88:73");
+ put("quovadisrootca1g3 [jdk]",
+ "8A:86:6F:D1:B2:76:B5:7E:57:8E:92:1C:65:82:8A:2B:ED:58:E9:F2:F2:88:05:41:34:B7:F1:F4:BF:C9:CC:74");
+ put("quovadisrootca2 [jdk]",
+ "85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86");
+ put("quovadisrootca2g3 [jdk]",
+ "8F:E4:FB:0A:F9:3A:4D:0D:67:DB:0B:EB:B2:3E:37:C7:1B:F3:25:DC:BC:DD:24:0E:A0:4D:AF:58:B4:7E:18:40");
+ put("quovadisrootca3 [jdk]",
+ "18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35");
+ put("quovadisrootca3g3 [jdk]",
+ "88:EF:81:DE:20:2E:B0:18:45:2E:43:F8:64:72:5C:EA:5F:BD:1F:C2:D9:D2:05:73:07:09:C5:D8:B8:69:0F:46");
+ put("secomscrootca1 [jdk]",
+ "E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C");
+ put("secomscrootca2 [jdk]",
+ "51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6");
+ put("swisssigngoldg2ca [jdk]",
+ "62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95");
+ put("swisssignplatinumg2ca [jdk]",
+ "3B:22:2E:56:67:11:E9:92:30:0D:C0:B1:5A:B9:47:3D:AF:DE:F8:C8:4D:0C:EF:7D:33:17:B4:C1:82:1D:14:36");
+ put("swisssignsilverg2ca [jdk]",
+ "BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5");
+ put("soneraclass2ca [jdk]",
+ "79:08:B4:03:14:C1:38:10:0B:51:8D:07:35:80:7F:FB:FC:F8:51:8A:00:95:33:71:05:BA:38:6B:15:3D:D9:27");
+ put("securetrustca [jdk]",
+ "F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73");
+ put("xrampglobalca [jdk]",
+ "CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2");
+ put("godaddyrootg2ca [jdk]",
+ "45:14:0B:32:47:EB:9C:C8:C5:B4:F0:D7:B5:30:91:F7:32:92:08:9E:6E:5A:63:E2:74:9D:D3:AC:A9:19:8E:DA");
+ put("godaddyclass2ca [jdk]",
+ "C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4");
+ put("starfieldclass2ca [jdk]",
+ "14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58");
+ put("starfieldrootg2ca [jdk]",
+ "2C:E1:CB:0B:F9:D2:F9:E1:02:99:3F:BE:21:51:52:C3:B2:DD:0C:AB:DE:1C:68:E5:31:9B:83:91:54:DB:B7:F5");
+ put("entrustrootcaec1 [jdk]",
+ "02:ED:0E:B2:8C:14:DA:45:16:5C:56:67:91:70:0D:64:51:D7:FB:56:F0:B2:AB:1D:3B:8E:B0:70:E5:6E:DF:F5");
+ put("entrust2048ca [jdk]",
+ "6D:C4:71:72:E0:1C:BC:B0:BF:62:58:0D:89:5F:E2:B8:AC:9A:D4:F8:73:80:1E:0C:10:B9:C8:37:D2:1E:B1:77");
+ put("entrustrootcag2 [jdk]",
+ "43:DF:57:74:B0:3E:7F:EF:5F:E4:0D:93:1A:7B:ED:F1:BB:2E:6B:42:73:8C:4E:6D:38:41:10:3D:3A:A7:F3:39");
+ put("entrustevca [jdk]",
+ "73:C1:76:43:4F:1B:C6:D5:AD:F4:5B:0E:76:E7:27:28:7C:8D:E5:76:16:C1:E6:E6:14:1A:2B:2C:BC:7D:8E:4C");
+ put("affirmtrustnetworkingca [jdk]",
+ "0A:81:EC:5A:92:97:77:F1:45:90:4A:F3:8D:5D:50:9F:66:B5:E2:C5:8F:CD:B5:31:05:8B:0E:17:F3:F0:B4:1B");
+ put("affirmtrustpremiumca [jdk]",
+ "70:A7:3F:7F:37:6B:60:07:42:48:90:45:34:B1:14:82:D5:BF:0E:69:8E:CC:49:8D:F5:25:77:EB:F2:E9:3B:9A");
+ put("affirmtrustcommercialca [jdk]",
+ "03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7");
+ put("affirmtrustpremiumeccca [jdk]",
+ "BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23");
+ put("deutschetelekomrootca2 [jdk]",
+ "B6:19:1A:50:D0:C3:97:7F:7D:A9:9B:CD:AA:C8:6A:22:7D:AE:B9:67:9E:C7:0B:A3:B0:C9:D9:22:71:C1:70:D3");
+ put("ttelesecglobalrootclass3ca [jdk]",
+ "FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD");
+ put("ttelesecglobalrootclass2ca [jdk]",
+ "91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52");
+ put("starfieldservicesrootg2ca [jdk]",
+ "56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5");
+ put("globalsignca [jdk]",
+ "EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99");
+ put("globalsignr3ca [jdk]",
+ "CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B");
+ put("globalsigneccrootcar5 [jdk]",
+ "17:9F:BC:14:8A:3D:D0:0F:D2:4E:A1:34:58:CC:43:BF:A7:F5:9C:81:82:D7:83:A5:13:F6:EB:EC:10:0C:89:24");
+ put("globalsigneccrootcar4 [jdk]",
+ "BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C");
+ put("globalsignr2ca [jdk]",
+ "CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E");
+ put("teliasonerarootcav1 [jdk]",
+ "DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89");
+ }
+ };
+
+ // Exception list to 90 days expiry policy
+ // No error will be reported if certificate in this list expires
+ private static final HashSet<String> EXPIRY_EXC_ENTRIES
+ = new HashSet<String>(Arrays.asList(
+ "gtecybertrustglobalca [jdk]"
+ ));
+
+ // Ninety days in milliseconds
+ private static final long NINETY_DAYS = 7776000000L;
+
+ private static boolean atLeastOneFailed = false;
+
+ private static MessageDigest md;
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("cacerts file: " + CACERTS);
+ md = MessageDigest.getInstance("SHA-256");
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(new FileInputStream(CACERTS), "changeit".toCharArray());
+
+ // check the count of certs inside
+ if (ks.size() != COUNT) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: " + ks.size() + " entries, should be "
+ + COUNT);
+ }
+
+ // check that all entries in the map are in the keystore
+ for (String alias : FINGERPRINT_MAP.keySet()) {
+ if (!ks.isCertificateEntry(alias)) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: " + alias + " is not in cacerts");
+ }
+ }
+
+ // pull all the trusted self-signed CA certs out of the cacerts file
+ // and verify their signatures
+ Enumeration<String> aliases = ks.aliases();
+ while (aliases.hasMoreElements()) {
+ String alias = aliases.nextElement();
+ System.out.println("\nVerifying " + alias);
+ if (!ks.isCertificateEntry(alias)) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: " + alias
+ + " is not a trusted cert entry");
+ }
+ X509Certificate cert = (X509Certificate) ks.getCertificate(alias);
+ if (!checkFingerprint(alias, cert)) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: " + alias + " SHA-256 fingerprint is incorrect");
+ }
+ // Make sure cert can be self-verified
+ try {
+ cert.verify(cert.getPublicKey());
+ } catch (Exception e) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: cert cannot be verified:"
+ + e.getMessage());
+ }
+
+ // Make sure cert is not expired or not yet valid
+ try {
+ cert.checkValidity();
+ } catch (CertificateExpiredException cee) {
+ if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: cert is expired");
+ }
+ } catch (CertificateNotYetValidException cne) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: cert is not yet valid");
+ }
+
+ // If cert is within 90 days of expiring, mark as failure so
+ // that cert can be scheduled to be removed/renewed.
+ Date notAfter = cert.getNotAfter();
+ if (notAfter.getTime() - System.currentTimeMillis() < NINETY_DAYS) {
+ if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
+ atLeastOneFailed = true;
+ System.err.println("ERROR: cert \"" + alias + "\" expiry \""
+ + notAfter.toString() + "\" will expire within 90 days");
+ }
+ }
+ }
+
+ if (atLeastOneFailed) {
+ throw new Exception("At least one cacert test failed");
+ }
+ }
+
+ private static boolean checkFingerprint(String alias, Certificate cert)
+ throws Exception {
+ String fingerprint = FINGERPRINT_MAP.get(alias);
+ if (fingerprint == null) {
+ // no entry for alias
+ return true;
+ }
+ System.out.println("Checking fingerprint of " + alias);
+ byte[] digest = md.digest(cert.getEncoded());
+ return fingerprint.equals(toHexString(digest));
+ }
+
+ private static String toHexString(byte[] block) {
+ StringBuilder buf = new StringBuilder();
+ int len = block.length;
+ for (int i = 0; i < len; i++) {
+ buf.append(String.format("%02X", block[i]));
+ if (i < len - 1) {
+ buf.append(":");
+ }
+ }
+ return buf.toString();
+ }
+}
--- a/test/jdk/tools/jimage/JImageExtractTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/tools/jimage/JImageExtractTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -27,7 +27,7 @@
* @library /test/lib
* @modules jdk.jlink/jdk.tools.jimage
* @build jdk.test.lib.Asserts
- * @run main/othervm JImageExtractTest
+ * @run main/othervm/timeout=300 JImageExtractTest
*/
import java.io.IOException;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/ModuleTargetHelper.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017, 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.InputStream;
+import java.io.IOException;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import jdk.internal.module.ModuleInfo;
+import jdk.internal.module.ModuleInfo.Attributes;
+
+public class ModuleTargetHelper {
+ private ModuleTargetHelper() {}
+
+ public static final class ModuleTarget {
+ private String targetPlatform;
+
+ public ModuleTarget(String targetPlatform) {
+ this.targetPlatform = targetPlatform;
+ }
+
+ public String targetPlatform() {
+ return targetPlatform;
+ }
+ }
+
+ public static ModuleTarget getJavaBaseTarget() throws IOException {
+ Path p = Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
+ try (InputStream in = Files.newInputStream(p)) {
+ return read(in);
+ }
+ }
+
+ public static ModuleTarget read(InputStream in) throws IOException {
+ ModuleInfo.Attributes attrs = ModuleInfo.read(in, null);
+ if (attrs.target() != null) {
+ return new ModuleTarget(attrs.target().targetPlatform());
+ } else {
+ return null;
+ }
+ }
+
+ public static ModuleTarget read(ModuleReference modRef) throws IOException {
+ ModuleReader reader = modRef.open();
+ try (InputStream in = reader.open("module-info.class").get()) {
+ return read(in);
+ } finally {
+ reader.close();
+ }
+ }
+}
--- a/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/SystemModulesTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -42,7 +42,6 @@
/**
* @test
* @bug 8142968 8173381
- * @library /lib/testlibrary
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
* @modules java.base/jdk.internal.org.objectweb.asm
--- a/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -44,7 +44,7 @@
/**
* @test
* @bug 8142968 8173381 8174740
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler jdk.jlink
* @modules java.base/jdk.internal.module
* @modules java.base/jdk.internal.org.objectweb.asm
--- a/test/jdk/tools/jmod/hashes/HashesTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/tools/jmod/hashes/HashesTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -237,6 +237,28 @@
.forEach(mn -> assertTrue(ht.hashes(mn) == null));
}
+ @Test
+ public static void upgradeableModule() throws IOException {
+ Path mpath = Paths.get(System.getProperty("java.home"), "jmods");
+ if (!Files.exists(mpath)) {
+ return;
+ }
+
+ Path dest = Paths.get("test4");
+ HashesTest ht = new HashesTest(dest);
+ ht.makeModule("m1");
+ ht.makeModule("java.compiler", "m1");
+ ht.makeModule("m2", "java.compiler");
+
+ ht.makeJmod("m1");
+ ht.makeJmod("m2");
+ ht.makeJmod("java.compiler",
+ "--module-path",
+ ht.lib.toString() + File.pathSeparator + mpath,
+ "--hash-modules", "java\\.(?!se)|^m.*");
+
+ ht.checkHashes("java.compiler", "m2");
+ }
@Test
public static void testImageJmods() throws IOException {
--- a/test/jdk/tools/launcher/modules/addexports/AddExportsTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/jdk/tools/launcher/modules/addexports/AddExportsTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -24,7 +24,8 @@
/**
* @test
* @library /test/lib
- * @modules jdk.compiler
+ * @modules java.compiler
+ * jdk.compiler
* @build AddExportsTest jdk.test.lib.compiler.CompilerUtils
* @run testng AddExportsTest
* @summary Basic tests for java --add-exports
@@ -51,12 +52,15 @@
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
private static final Path MODS_DIR = Paths.get("mods");
+ private static final Path UPGRADE_MODS_DIRS = Paths.get("upgrademods");
// test module m1 that uses Unsafe
private static final String TEST1_MODULE = "m1";
private static final String TEST1_MAIN_CLASS = "jdk.test1.Main";
-
+ // test module m2 uses java.compiler internals
+ private static final String TEST2_MODULE = "m2";
+ private static final String TEST2_MAIN_CLASS = "jdk.test2.Main";
// test module m3 uses m4 internals
private static final String TEST3_MODULE = "m3";
@@ -74,7 +78,19 @@
"--add-exports", "java.base/jdk.internal.misc=m1");
assertTrue(compiled, "module " + TEST1_MODULE + " did not compile");
+ // javac -d upgrademods/java.compiler src/java.compiler/**
+ compiled = CompilerUtils.compile(
+ SRC_DIR.resolve("java.compiler"),
+ UPGRADE_MODS_DIRS.resolve("java.compiler"));
+ assertTrue(compiled, "module java.compiler did not compile");
+ // javac --upgrade-module-path upgrademods -d mods/m2 src/m2/**
+ compiled = CompilerUtils.compile(
+ SRC_DIR.resolve(TEST2_MODULE),
+ MODS_DIR.resolve(TEST2_MODULE),
+ "--upgrade-module-path", UPGRADE_MODS_DIRS.toString(),
+ "--add-exports", "java.compiler/javax.tools.internal=m2");
+ assertTrue(compiled, "module " + TEST2_MODULE + " did not compile");
// javac -d mods/m3 src/m3/**
compiled = CompilerUtils.compile(
@@ -146,7 +162,25 @@
assertTrue(exitValue == 0);
}
+ /**
+ * Test --add-exports with upgraded module
+ */
+ public void testWithUpgradedModule() throws Exception {
+ // java --add-exports java.compiler/javax.tools.internal=m2
+ // --upgrade-module-path upgrademods --module-path mods -m ...
+ String mid = TEST2_MODULE + "/" + TEST2_MAIN_CLASS;
+ int exitValue = executeTestJava(
+ "--add-exports", "java.compiler/javax.tools.internal=m2",
+ "--upgrade-module-path", UPGRADE_MODS_DIRS.toString(),
+ "--module-path", MODS_DIR.toString(),
+ "-m", mid)
+ .outputTo(System.out)
+ .errorTo(System.out)
+ .getExitValue();
+
+ assertTrue(exitValue == 0);
+ }
/**
* Test --add-exports with module that is added to the set of root modules
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/java.compiler/javax/annotation/processing/Generated.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+package javax.annotation.processing;
+
+public interface Generated {
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/java.compiler/javax/tools/ToolsHelper.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+package javax.tools;
+
+public class ToolsHelper {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/java.compiler/javax/tools/internal/Helper.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+package javax.tools.internal;
+
+public class Helper {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/java.compiler/module-info.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+module java.compiler {
+ exports javax.tools;
+ exports javax.annotation.processing;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/m2/jdk/test2/Main.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2015, 2018, 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.
+ */
+
+package jdk.test2;
+
+import javax.tools.internal.Helper;
+
+public class Main {
+ public static void main(String[] args) {
+ Helper h = new Helper();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/modules/addexports/src/m2/module-info.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015, 2018, 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.
+ */
+
+module m2 {
+ requires java.compiler;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testSerialTag/TestSerialTag.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8207214
+ * @summary Test package-level at-serial tags
+ * @library /tools/lib ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester toolbox.ToolBox
+ * @run main TestSerialTag
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+import toolbox.ToolBox;
+
+public class TestSerialTag extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestSerialTag tester = new TestSerialTag();
+ tester.runTests(m -> new Object[] { Path.of(m.getName()) });
+ }
+
+ private final ToolBox tb;
+
+ TestSerialTag() {
+ tb = new ToolBox();
+ }
+
+ @Test
+ public void testCombo(Path base) throws IOException {
+ boolean[] moduleValues = { false, true };
+ String[] tagValues = { "", "@serial include", "@serial exclude" };
+ for (boolean module : moduleValues ) {
+ for (String tag : tagValues ) {
+ String name = (module ? "module-" : "")
+ + (tag.isEmpty() ? "default" : tag.replace("@serial ", ""));
+ Path dir = base.resolve(name);
+ test(dir, module, tag);
+ }
+ }
+
+ }
+
+ void test(Path base, boolean module, String tag) throws IOException {
+ out.println("Test: module:" + module + ", tag:" + tag);
+
+ Path srcDir = generateSource(base, module, tag);
+
+ Path outDir = base.resolve("out");
+ if (module) {
+ javadoc("-d", outDir.toString(),
+ "--module-source-path", srcDir.toString(),
+ "--module", "m");
+ } else {
+ javadoc("-d", outDir.toString(),
+ "-sourcepath", srcDir.toString(),
+ "p", "q");
+ }
+ checkExit(Exit.OK);
+
+ boolean expectLink = !tag.equals("@serial exclude");
+ checkSeeSerializedForm(module, expectLink);
+ }
+
+ /**
+ * Generates source for a test case.
+ * Two classes are generated, in two different packages.
+ * One package has a variable at-serial tag to test;
+ * The other package is a control and always has no special tag.
+ *
+ * @param base the working directory for the test case
+ * @param module whether or not to enclose the packages in a module
+ * @param tag the at-serial tag to be tested
+ * @return the directory in which the source was created
+ */
+ Path generateSource(Path base, boolean module, String tag) throws IOException {
+ Path srcDir = base.resolve("src");
+
+ Path dir;
+ if (module) {
+ dir = srcDir.resolve("m");
+ tb.writeJavaFiles(dir,
+ "module m { exports p; exports q; }");
+ } else {
+ dir = srcDir;
+ }
+
+ tb.writeJavaFiles(dir,
+ "/** This is package p;\n * " + tag + "\n */\n"
+ + "package p;",
+ "/** This is class p.C1;\n */\n"
+ + "package p; public class C1 implements java.io.Serializable { }",
+ "/** This is package q;\n */\n"
+ + "package q;",
+ "/** This is class q.C2;\n */\n"
+ + "package q; public class C2 implements java.io.Serializable { }"
+ );
+
+ return srcDir;
+ }
+
+ /**
+ * Checks the link to the serialized form page,
+ * and whether classes are documented on that page.
+ *
+ * @param module whether or not the output is module-oriented
+ * @param b whether or not class p.C1 should be documented as serializable
+ */
+ void checkSeeSerializedForm(boolean module, boolean b) {
+ String prefix = module ? "m/" : "";
+
+ checkOutput(prefix + "p/C1.html", b,
+ "serialized-form.html");
+ checkOutput("serialized-form.html", b,
+ "C1");
+
+ checkOutput(prefix + "q/C2.html", true,
+ "serialized-form.html");
+ checkOutput("serialized-form.html", true,
+ "C2");
+ }
+}
+
--- a/test/langtools/tools/javac/T8152616.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/langtools/tools/javac/T8152616.java Tue Oct 16 14:26:22 2018 +0530
@@ -25,8 +25,8 @@
* @test
* @bug 8152616
* @summary Unit test for corner case of PrettyPrinting when SourceOutput is false
- * @run compile --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED T8152616.java
- * @run main T8152616
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.tree
*/
import java.io.File;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/VarInImplicitLambda.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+// key: compiler.misc.feature.var.syntax.in.implicit.lambda
+// key: compiler.err.feature.not.supported.in.source.plural
+// options: -source 10 -Xlint:-options
+
+import java.util.function.*;
+
+class VarInImplicitLambda {
+ IntBinaryOperator f2 = (var x, y) -> x + y;
+}
--- a/test/langtools/tools/javac/lambda/LambdaParserTest.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/langtools/tools/javac/lambda/LambdaParserTest.java Tue Oct 16 14:26:22 2018 +0530
@@ -107,8 +107,8 @@
}
enum SourceKind {
- SOURCE_9("9"),
- SOURCE_10("10");
+ SOURCE_10("10"),
+ SOURCE_11("11");
String sourceNumber;
@@ -121,9 +121,9 @@
IMPLICIT_1("", ExplicitKind.IMPLICIT),
IMPLICIT_2("var", ExplicitKind.IMPLICIT_VAR),
- EXPLIICT_SIMPLE("A", ExplicitKind.EXPLICIT),
- EXPLIICT_SIMPLE_ARR1("A[]", ExplicitKind.EXPLICIT),
- EXPLIICT_SIMPLE_ARR2("A[][]", ExplicitKind.EXPLICIT),
+ EXPLICIT_SIMPLE("A", ExplicitKind.EXPLICIT),
+ EXPLICIT_SIMPLE_ARR1("A[]", ExplicitKind.EXPLICIT),
+ EXPLICIT_SIMPLE_ARR2("A[][]", ExplicitKind.EXPLICIT),
EXPLICIT_VARARGS("A...", ExplicitKind.EXPLICIT),
EXPLICIT_GENERIC1("A<X>", ExplicitKind.EXPLICIT),
EXPLICIT_GENERIC2("A<? extends X, ? super Y>", ExplicitKind.EXPLICIT),
@@ -157,13 +157,7 @@
}
ExplicitKind explicitKind(SourceKind sk) {
- switch (explicitKind) {
- case IMPLICIT_VAR:
- return (sk == SourceKind.SOURCE_9) ?
- ExplicitKind.EXPLICIT : ExplicitKind.IMPLICIT_VAR;
- default:
- return explicitKind;
- }
+ return explicitKind;
}
}
@@ -299,6 +293,15 @@
errorExpected |= pn == LambdaParameterName.UNDERSCORE &&
lk.arity() > 0;
+ for (int i = 0; i < lk.arity(); i++) {
+ if (!lk.isShort() &&
+ pks[i].explicitKind(sk) == LambdaParameterKind.ExplicitKind.IMPLICIT_VAR &&
+ sk == SourceKind.SOURCE_10) {
+ errorExpected = true;
+ break;
+ }
+ }
+
if (errorExpected != res.hasErrors()) {
fail("invalid diagnostics for source:\n" +
res.compilationInfo() +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/T8209407/VerifierErrorInnerPlusLambda.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8209407
+ * @summary VerifyError is thrown for inner class with lambda
+ */
+
+import java.util.function.Supplier;
+
+public class VerifierErrorInnerPlusLambda {
+ public static void main(String[] args) {
+ Object a = new Object();
+ class Local { Object ref = a; }
+ new Object() {
+ void unused() {
+ Supplier<Local> s = () -> new Local();
+ }
+ };
+ }
+}
--- a/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.java Tue Oct 16 14:26:22 2018 +0530
@@ -3,6 +3,7 @@
* @bug 8198512 8199327
* @summary compiler support for local-variable syntax for lambda parameters
* @compile/fail/ref=VarInImplicitLambdaNegTest01.out -XDrawDiagnostics VarInImplicitLambdaNegTest01.java
+ * @compile/fail/ref=VarInImplicitLambdaNegTest01_source10.out -source 10 -XDrawDiagnostics VarInImplicitLambdaNegTest01.java
*/
import java.util.function.*;
--- a/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.out Mon Oct 15 10:29:06 2018 +0530
+++ b/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.out Tue Oct 16 14:26:22 2018 +0530
@@ -1,6 +1,6 @@
-VarInImplicitLambdaNegTest01.java:11:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.var.and.implicit.not.allowed)
VarInImplicitLambdaNegTest01.java:12:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.var.and.implicit.not.allowed)
-VarInImplicitLambdaNegTest01.java:13:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.var.and.explicit.not.allowed)
-VarInImplicitLambdaNegTest01.java:14:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.implicit.and.explicit.not.allowed)
-VarInImplicitLambdaNegTest01.java:16:52: compiler.err.var.not.allowed.array
+VarInImplicitLambdaNegTest01.java:13:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.var.and.implicit.not.allowed)
+VarInImplicitLambdaNegTest01.java:14:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.var.and.explicit.not.allowed)
+VarInImplicitLambdaNegTest01.java:15:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.implicit.and.explicit.not.allowed)
+VarInImplicitLambdaNegTest01.java:17:52: compiler.err.var.not.allowed.array
5 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01_source10.out Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,6 @@
+- compiler.warn.source.no.bootclasspath: 10
+VarInImplicitLambdaNegTest01.java:12:36: compiler.err.feature.not.supported.in.source.plural: (compiler.misc.feature.var.syntax.in.implicit.lambda), 10, 11
+VarInImplicitLambdaNegTest01.java:15:28: compiler.err.invalid.lambda.parameter.declaration: (compiler.misc.implicit.and.explicit.not.allowed)
+VarInImplicitLambdaNegTest01.java:17:52: compiler.err.var.not.allowed.here
+3 errors
+1 warning
--- a/test/lib/jdk/test/lib/Platform.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/lib/jdk/test/lib/Platform.java Tue Oct 16 14:26:22 2018 +0530
@@ -325,6 +325,19 @@
}
}
+ public static boolean isDefaultCDSArchiveSupported() {
+ return (is64bit() &&
+ isServer() &&
+ (isLinux() ||
+ isOSX() ||
+ isSolaris() ||
+ isWindows()) &&
+ !isZero() &&
+ !isMinimal() &&
+ !isAArch64() &&
+ !isARM());
+ }
+
/*
* This should match the #if condition in ClassListParser::load_class_from_source().
*/
--- a/test/lib/jdk/test/lib/SecurityTools.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/lib/jdk/test/lib/SecurityTools.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -28,7 +28,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -36,10 +35,23 @@
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
+/**
+ * Run security tools (including jarsigner and keytool) in a new process.
+ * The en_US locale is always used so a test can always match output to
+ * English text. {@code /dev/urandom} is used as entropy source so tool will
+ * not block because of entropy scarcity. {@code -Jvm-options} is supported
+ * as an argument.
+ */
public class SecurityTools {
+ /**
+ * The response file name for keytool. Use {@link #setResponse} to
+ * create one. Do NOT manipulate it directly.
+ */
public static final String RESPONSE_FILE = "security_tools_response.txt";
+ private SecurityTools() {}
+
private static ProcessBuilder getProcessBuilder(String tool, List<String> args) {
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(tool)
.addVMArg("-Duser.language=en")
@@ -57,8 +69,13 @@
return new ProcessBuilder(launcher.getCommand());
}
- // keytool
-
+ /**
+ * Runs keytool.
+ *
+ * @param args arguments to keytool
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer keytool(List<String> args)
throws Exception {
@@ -77,15 +94,46 @@
}
}
- // Only call this if there is no white space in every argument
+ /**
+ * Runs keytool.
+ *
+ * @param args arguments to keytool in a single string. Only call this if
+ * there is no white space inside an argument. This string will
+ * be split with {@code \s+}.
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer keytool(String args) throws Exception {
return keytool(args.split("\\s+"));
}
+ /**
+ * Runs keytool.
+ *
+ * @param args arguments to keytool
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer keytool(String... args) throws Exception {
return keytool(List.of(args));
}
+
+ /**
+ * Sets the responses (user input) for keytool.
+ * <p>
+ * For example, if keytool requires entering a password twice, call
+ * {@code setResponse("password", "password")}. Do NOT append a newline
+ * character to each response. If there are useless responses at the end,
+ * they will be discarded silently. If there are less responses than
+ * necessary, keytool will read EOF. The responses will be written into
+ * {@linkplain #RESPONSE_FILE a local file} and will only be used by the
+ * next keytool run. After the run, the file is removed. Calling this
+ * method will always overwrite the previous response file (if exists).
+ *
+ * @param responses response to keytool
+ * @throws IOException if there is an error
+ */
public static void setResponse(String... responses) throws IOException {
String text;
if (responses.length > 0) {
@@ -97,8 +145,13 @@
Files.write(Paths.get(RESPONSE_FILE), text.getBytes());
}
- // jarsigner
-
+ /**
+ * Runs jarsigner.
+ *
+ * @param args arguments to jarsigner
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer jarsigner(List<String> args)
throws Exception {
return execute(getProcessBuilder("jarsigner", args));
@@ -118,12 +171,27 @@
}
}
- // Only call this if there is no white space in every argument
+ /**
+ * Runs jarsigner.
+ *
+ * @param args arguments to jarsigner in a single string. Only call this if
+ * there is no white space inside an argument. This string will
+ * be split with {@code \s+}.
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer jarsigner(String args) throws Exception {
return jarsigner(args.split("\\s+"));
}
+ /**
+ * Runs jarsigner.
+ *
+ * @param args arguments to jarsigner
+ * @return an {@link OutputAnalyzer} object
+ * @throws Exception if there is an error
+ */
public static OutputAnalyzer jarsigner(String... args) throws Exception {
return jarsigner(List.of(args));
}
--- a/test/lib/jdk/test/lib/apps/LingeredApp.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/lib/jdk/test/lib/apps/LingeredApp.java Tue Oct 16 14:26:22 2018 +0530
@@ -26,9 +26,6 @@
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
@@ -43,7 +40,6 @@
import java.util.stream.Collectors;
import java.util.UUID;
import jdk.test.lib.process.OutputBuffer;
-import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.StreamPumper;
/**
@@ -137,6 +133,14 @@
}
/**
+ * @return the LingeredApp's output.
+ * Can be called after the app is run.
+ */
+ public String getProcessStdout() {
+ return stdoutBuffer.toString();
+ }
+
+ /**
*
* @return OutputBuffer object for the LingeredApp's output. Can only be called
* after LingeredApp has exited.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/net/SimpleSSLContext.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+package jdk.test.lib.net;
+
+import java.util.*;
+import java.io.*;
+import java.security.*;
+import java.security.cert.*;
+import javax.net.ssl.*;
+
+/**
+ * Creates a simple usable SSLContext for SSLSocketFactory
+ * or a HttpsServer using either a given keystore or a default
+ * one in the test tree.
+ *
+ * Using this class with a security manager requires the following
+ * permissions to be granted:
+ *
+ * permission "java.util.PropertyPermission" "test.src.path", "read";
+ * permission java.io.FilePermission "/path/to/test/lib/jdk/test/lib/testkeys", "read";
+ * The exact path above depends on the location of the test.
+ */
+public class SimpleSSLContext {
+
+ SSLContext ssl;
+
+ /**
+ * loads default keystore from SimpleSSLContext
+ * source directory
+ */
+ public SimpleSSLContext() throws IOException {
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ String paths = System.getProperty("test.src.path");
+ StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
+ boolean securityExceptions = false;
+ while (st.hasMoreTokens()) {
+ String path = st.nextToken();
+ try {
+ File f = new File(path, "jdk/test/lib/net/testkeys");
+ if (f.exists()) {
+ try (FileInputStream fis = new FileInputStream(f)) {
+ init(fis);
+ return null;
+ }
+ }
+ } catch (SecurityException e) {
+ // catch and ignore because permission only required
+ // for one entry on path (at most)
+ securityExceptions = true;
+ }
+ }
+ if (securityExceptions) {
+ System.err.println("SecurityExceptions thrown on loading testkeys");
+ }
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException pae) {
+ Throwable t = pae.getCause() != null ? pae.getCause() : pae;
+ if (t instanceof IOException)
+ throw (IOException)t;
+ if (t instanceof RuntimeException)
+ throw (RuntimeException)t;
+ if (t instanceof Error)
+ throw (Error)t;
+ throw new RuntimeException(t);
+ }
+ }
+
+ /**
+ * loads default keystore from given directory
+ */
+ public SimpleSSLContext(String dir) throws IOException {
+ String file = dir + "/testkeys";
+ try (FileInputStream fis = new FileInputStream(file)) {
+ init(fis);
+ }
+ }
+
+ private void init(InputStream i) throws IOException {
+ try {
+ char[] passphrase = "passphrase".toCharArray();
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ ks.load(i, passphrase);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX");
+ kmf.init(ks, passphrase);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+ tmf.init(ks);
+
+ ssl = SSLContext.getInstance("TLS");
+ ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ } catch (KeyManagementException | KeyStoreException |
+ UnrecoverableKeyException | CertificateException |
+ NoSuchAlgorithmException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+
+ public SSLContext get() {
+ return ssl;
+ }
+}
Binary file test/lib/jdk/test/lib/net/testkeys has changed
--- a/test/lib/jdk/test/lib/util/JarUtils.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/lib/jdk/test/lib/util/JarUtils.java Tue Oct 16 14:26:22 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -222,6 +222,7 @@
* be either updated or added. The files in the 2nd group
* will be removed. If no "-" exists, all files belong to
* the 1st group.
+ * @throws IOException if there is an error
*/
@Deprecated
public static void updateJar(String src, String dest, String... files)
@@ -259,7 +260,7 @@
* Value can be Path, byte[] or String. If key exists in
* src but value is Boolean FALSE. The entry is removed.
* Existing entries in src not a key is unmodified.
- * @throws IOException
+ * @throws IOException if there is an error
*/
@Deprecated
public static void updateJar(String src, String dest,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/util/ModuleUtils.java Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.test.lib.util;
+
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+
+
+/**
+ * This class consists exclusively of static utility methods that are useful
+ * for creating tests for modules.
+ */
+
+public final class ModuleUtils {
+ private ModuleUtils() { }
+
+
+ /**
+ * Returns a ModuleFinder that finds modules with the given module
+ * descriptors.
+ */
+ public static ModuleFinder finderOf(ModuleDescriptor... descriptors) {
+
+ // Create a ModuleReference for each module
+ Map<String, ModuleReference> namesToReference = new HashMap<>();
+
+ for (ModuleDescriptor descriptor : descriptors) {
+ String name = descriptor.name();
+
+ URI uri = URI.create("module:/" + name);
+
+ ModuleReference mref = new ModuleReference(descriptor, uri) {
+ @Override
+ public ModuleReader open() {
+ throw new UnsupportedOperationException();
+ }
+ };
+
+ namesToReference.put(name, mref);
+ }
+
+ return new ModuleFinder() {
+ @Override
+ public Optional<ModuleReference> find(String name) {
+ Objects.requireNonNull(name);
+ return Optional.ofNullable(namesToReference.get(name));
+ }
+ @Override
+ public Set<ModuleReference> findAll() {
+ return new HashSet<>(namesToReference.values());
+ }
+ };
+ }
+
+}
--- a/test/lib/sun/hotspot/WhiteBox.java Mon Oct 15 10:29:06 2018 +0530
+++ b/test/lib/sun/hotspot/WhiteBox.java Tue Oct 16 14:26:22 2018 +0530
@@ -512,6 +512,8 @@
public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
// Sharing & archiving
+ public native String getDefaultArchivePath();
+ public native boolean isSharingEnabled();
public native boolean isShared(Object o);
public native boolean isSharedClass(Class<?> c);
public native boolean areSharedStringsIgnored();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/make/TestCompileCommands.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -0,0 +1,54 @@
+
+# Copyright (c) 2018, 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.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+default: all
+
+COMPILE_COMMANDS := $(OUTPUTDIR)/compile_commands.json
+
+# Perform basic compile_commands.json validation:
+# - should start with [ and end with ]
+# - should contain at least one entry (opening {)
+# - last entry should not have a trailing comma (end with })
+verify-compile-commands-json:
+ $(HEAD) -n 1 $(COMPILE_COMMANDS) | $(GREP) -q -e "^\[$$"
+ $(TAIL) -1 $(COMPILE_COMMANDS) | $(GREP) -q -e "^\]$$"
+ $(HEAD) -n 2 $(COMPILE_COMMANDS) | $(GREP) -q -e "{"
+ $(TAIL) -2 $(COMPILE_COMMANDS) | $(GREP) -q -e "}$$"
+
+# Ensure that no native shared library for hotspot was created during the
+# build. Checking hotspot only since on Windows the jdk folders are prepopulated
+# with CRT DLLs. Also note that this test requires a clean build folder.
+verify-no-shared-libraries:
+ $(FIND) $(OUTPUTDIR)/hotspot -type f -name "*$(SHARED_LIBRARY_SUFFIX)" \
+ -exec false {} +
+
+TEST_TARGETS += verify-compile-commands-json verify-no-shared-libraries
+
+all: $(TEST_TARGETS)
+
+.PHONY: default all verify-compile-commands
--- a/test/make/TestMake.gmk Mon Oct 15 10:29:06 2018 +0530
+++ b/test/make/TestMake.gmk Tue Oct 16 14:26:22 2018 +0530
@@ -39,7 +39,10 @@
test-idea:
+$(MAKE) -f TestIdea.gmk $(TEST_SUBTARGET)
+test-compile-commands:
+ +$(MAKE) -f TestCompileCommands.gmk $(TEST_SUBTARGET)
+
all: make-base java-compilation copy-files test-idea
-.PHONY: default all make-base java-compilation copy-files test-idea
+.PHONY: default all make-base java-compilation copy-files test-idea test-compile-commands