From c611ad6fb936de27158e4d65c6c34f0d86352d7d Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 13 Sep 2018 21:12:22 +0200 Subject: [PATCH 01/41] 8210702: Remove dtrace mapfiles Reviewed-by: erikj --- make/hotspot/lib/CompileDtraceLibraries.gmk | 10 ++- make/mapfiles/libjsound/mapfile-vers | 83 ------------------- make/mapfiles/libjvm_db/mapfile-vers | 38 --------- make/mapfiles/libjvm_dtrace/mapfile-vers | 37 --------- .../solaris/native/libjvm_db/libjvm_db.h | 9 +- .../solaris/native/libjvm_dtrace/jvm_dtrace.h | 12 +-- 6 files changed, 17 insertions(+), 172 deletions(-) delete mode 100644 make/mapfiles/libjsound/mapfile-vers delete mode 100644 make/mapfiles/libjvm_db/mapfile-vers delete mode 100644 make/mapfiles/libjvm_dtrace/mapfile-vers diff --git a/make/hotspot/lib/CompileDtraceLibraries.gmk b/make/hotspot/lib/CompileDtraceLibraries.gmk index 391f1355472..185b64053ae 100644 --- a/make/hotspot/lib/CompileDtraceLibraries.gmk +++ b/make/hotspot/lib/CompileDtraceLibraries.gmk @@ -25,6 +25,10 @@ ifeq ($(call check-jvm-feature, dtrace), true) ifeq ($(OPENJDK_TARGET_OS), solaris) + JNI_INCLUDE_FLAGS := \ + -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \ + -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \ + # ############################################################################ # Build the stand-alone dtrace libraries. @@ -34,10 +38,9 @@ ifeq ($(call check-jvm-feature, dtrace), true) NAME := jvm_dtrace, \ OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \ - CFLAGS := -m64 -G -mt -KPIC, \ + CFLAGS := $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \ LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \ LIBS := $(LIBDL) -lthread -ldoor, \ - MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \ OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \ )) @@ -48,9 +51,8 @@ ifeq ($(call check-jvm-feature, dtrace), true) NAME := jvm_db, \ OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \ SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \ - CFLAGS := -I$(DTRACE_GENSRC_DIR) -m64 -G -mt -KPIC, \ + CFLAGS := -I$(DTRACE_GENSRC_DIR) $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \ LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \ - MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \ OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \ )) diff --git a/make/mapfiles/libjsound/mapfile-vers b/make/mapfiles/libjsound/mapfile-vers deleted file mode 100644 index 97e3d793e3a..00000000000 --- a/make/mapfiles/libjsound/mapfile-vers +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - Java_com_sun_media_sound_DirectAudioDevice_nAvailable; - Java_com_sun_media_sound_DirectAudioDevice_nClose; - Java_com_sun_media_sound_DirectAudioDevice_nFlush; - Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; - Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; - Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; - Java_com_sun_media_sound_DirectAudioDevice_nOpen; - Java_com_sun_media_sound_DirectAudioDevice_nRead; - Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; - Java_com_sun_media_sound_DirectAudioDevice_nService; - Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nStart; - Java_com_sun_media_sound_DirectAudioDevice_nStop; - Java_com_sun_media_sound_DirectAudioDevice_nWrite; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; - Java_com_sun_media_sound_MidiInDevice_nClose; - Java_com_sun_media_sound_MidiInDevice_nGetMessages; - Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiInDevice_nOpen; - Java_com_sun_media_sound_MidiInDevice_nStart; - Java_com_sun_media_sound_MidiInDevice_nStop; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiOutDevice_nClose; - Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiOutDevice_nOpen; - Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; - Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; - Java_com_sun_media_sound_Platform_nIsBigEndian; - Java_com_sun_media_sound_PortMixer_nClose; - Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlGetIntValue; - Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlSetIntValue; - Java_com_sun_media_sound_PortMixer_nGetControls; - Java_com_sun_media_sound_PortMixer_nGetPortCount; - Java_com_sun_media_sound_PortMixer_nGetPortName; - Java_com_sun_media_sound_PortMixer_nGetPortType; - Java_com_sun_media_sound_PortMixer_nOpen; - Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; - Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; - local: - *; -}; diff --git a/make/mapfiles/libjvm_db/mapfile-vers b/make/mapfiles/libjvm_db/mapfile-vers deleted file mode 100644 index 9ee418d01a2..00000000000 --- a/make/mapfiles/libjvm_db/mapfile-vers +++ /dev/null @@ -1,38 +0,0 @@ -# - -# -# Copyright (c) 2005, 2008, 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. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - Jagent_create; - Jagent_destroy; - Jframe_iter; - #Jget_vframe; - #Jlookup_by_regs; - local: - *; -}; diff --git a/make/mapfiles/libjvm_dtrace/mapfile-vers b/make/mapfiles/libjvm_dtrace/mapfile-vers deleted file mode 100644 index f9aaa19ba9d..00000000000 --- a/make/mapfiles/libjvm_dtrace/mapfile-vers +++ /dev/null @@ -1,37 +0,0 @@ -# - -# -# Copyright (c) 2006, 2008, 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. -# -# - -# Define library interface for JVM-DTrace interface - -SUNWprivate_1.1 { - global: - jvm_attach; - jvm_get_last_error; - jvm_enable_dtprobes; - jvm_detach; - local: - *; -}; diff --git a/src/java.base/solaris/native/libjvm_db/libjvm_db.h b/src/java.base/solaris/native/libjvm_db/libjvm_db.h index d1c5a5ee074..b3be14e192f 100644 --- a/src/java.base/solaris/native/libjvm_db/libjvm_db.h +++ b/src/java.base/solaris/native/libjvm_db/libjvm_db.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, 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 @@ -26,6 +26,7 @@ #define OS_SOLARIS_DTRACE_LIBJVM_DB_H #include +#include "jni.h" #ifdef __cplusplus extern "C" { @@ -35,7 +36,7 @@ typedef struct jvm_agent jvm_agent_t; #define JVM_DB_VERSION 1 -jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers); +JNIEXPORT jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers); /* * Called from Jframe_iter() for each java frame. If it returns 0, then @@ -57,9 +58,9 @@ typedef int java_stack_f(void *cld, const prgregset_t regs, const char* name, in * frames were found, or if there was some unrecoverable error. Otherwise, * returns the last value returned from 'func'. */ -int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld); +JNIEXPORT int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld); -void Jagent_destroy(jvm_agent_t *J); +JNIEXPORT void Jagent_destroy(jvm_agent_t *J); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h b/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h index edc6dbdfc3b..a951d65d8f6 100644 --- a/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h +++ b/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, 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 @@ -36,7 +36,7 @@ extern "C" { #endif #include - +#include "jni.h" struct _jvm_t; typedef struct _jvm_t jvm_t; @@ -44,10 +44,10 @@ typedef struct _jvm_t jvm_t; /* Attach to the given JVM process. Returns NULL on failure. jvm_get_last_error() returns last error message. */ -jvm_t* jvm_attach(pid_t pid); +JNIEXPORT jvm_t* jvm_attach(pid_t pid); /* Returns the last error message from this library or NULL if none. */ -const char* jvm_get_last_error(); +JNIEXPORT const char* jvm_get_last_error(); /* few well-known probe type constants for 'probe_types' param below */ @@ -68,7 +68,7 @@ const char* jvm_get_last_error(); * On success, this returns number of probe_types enabled. * On failure, jvm_get_last_error() returns the last error message. */ -int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types); +JNIEXPORT int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types); /* Note: There is no jvm_disable_dtprobes function. Probes are automatically * disabled when there are no more clients requiring those probes. @@ -77,7 +77,7 @@ int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_type /* Detach the given JVM. Returns 0 on success, -1 on failure. * jvm_get_last_error() returns the last error message. */ -int jvm_detach(jvm_t* jvm); +JNIEXPORT int jvm_detach(jvm_t* jvm); #ifdef __cplusplus } From 26ff7d58db64f18b370d5c2c0658c08c330deb72 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 13 Sep 2018 21:14:04 +0200 Subject: [PATCH 02/41] 8207264: solaris-sparcv9-cmp-baseline fails Reviewed-by: erikj, prr --- make/scripts/compare_exceptions.sh.incl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/make/scripts/compare_exceptions.sh.incl b/make/scripts/compare_exceptions.sh.incl index 6327040964d..24e71418b8e 100644 --- a/make/scripts/compare_exceptions.sh.incl +++ b/make/scripts/compare_exceptions.sh.incl @@ -350,13 +350,11 @@ if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ] MAX_KNOWN_DIS_DIFF_SIZE="3000" - # On slowdebug the disassembly can differ randomly. - if [ "$DEBUG_LEVEL" = "slowdebug" ]; then - ACCEPTED_DIS_DIFF=" - ./lib/libfontmanager.so - ./lib/server/libjvm.so - " - fi + ACCEPTED_DIS_DIFF=" + ./lib/libfontmanager.so + ./lib/libsaproc.so + ./lib/server/libjvm.so + " SKIP_FULLDUMP_DIFF="true" From 85b57de9cebe7eec615ed05710e5d3a6c6b8c430 Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Thu, 13 Sep 2018 13:03:50 -0700 Subject: [PATCH 03/41] 8210665: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[R-U] tests Remove JNI_ENV and JVMTI_ENV macros from jvmti/[R-U] tests Reviewed-by: cjplummer, sspitsyn --- .../redefclass020/redefclass020.cpp | 24 +----- .../redefclass021/redefclass021.cpp | 24 +----- .../redefclass022/redefclass022.cpp | 24 +----- .../redefclass023/redefclass023.cpp | 24 +----- .../redefclass024/redefclass024.cpp | 24 +----- .../redefclass025/redefclass025.cpp | 24 +----- .../redefclass026/redefclass026.cpp | 24 +----- .../redefclass027/redefclass027.cpp | 41 ++------- .../redefclass031/redefclass031.cpp | 24 +----- .../agentthr001/agentthr001.cpp | 24 +----- .../agentthr002/agentthr002.cpp | 18 +--- .../agentthr003/agentthr003.cpp | 18 +--- .../SetBreakpoint/setbrk002/setbrk002.cpp | 21 +---- .../SetBreakpoint/setbrk003/setbrk003.cpp | 21 +---- .../SetBreakpoint/setbrk005/setbrk005.cpp | 21 +---- .../SetBreakpoint/setbrk007/setbrk007.cpp | 21 +---- .../SetBreakpoint/setbrk008/setbrk008.cpp | 21 +---- .../setnotif001/setnotif001.cpp | 23 +---- .../setfldw001/setfldw001.cpp | 28 ++----- .../setfldw002/setfldw002.cpp | 21 +---- .../setfldw003/setfldw003.cpp | 28 ++----- .../setfldw004/setfldw004.cpp | 28 ++----- .../setfldw005/setfldw005.cpp | 28 ++----- .../setfldw006/setfldw006.cpp | 26 ++---- .../setfmodw001/setfmodw001.cpp | 30 ++----- .../setfmodw002/setfmodw002.cpp | 21 +---- .../setfmodw003/setfmodw003.cpp | 26 +----- .../setfmodw004/setfmodw004.cpp | 26 +----- .../setfmodw005/setfmodw005.cpp | 37 ++------- .../setfmodw006/setfmodw006.cpp | 28 ++----- .../setjniftab001/setjniftab001.cpp | 83 +++++-------------- .../setjniftab002/setjniftab002.cpp | 33 +------- .../setlocal001/setlocal001.cpp | 37 ++------- .../setlocal002/setlocal002.cpp | 22 +---- .../setlocal003/setlocal003.cpp | 21 +---- .../setlocal004/setlocal004.cpp | 21 +---- .../StopThread/stopthrd006/stopthrd006.cpp | 18 +--- .../ThreadEnd/threadend001/threadend001.cpp | 20 +---- .../threadstart001/threadstart001.cpp | 20 +---- .../threadstart003/threadstart003.cpp | 21 +---- .../jvmti/VMDeath/vmdeath001/vmdeath001.cpp | 22 ----- .../nsk/jvmti/VMInit/vminit001/vminit001.cpp | 18 +--- .../GF06/gf06t001/gf06t001.cpp | 20 +---- .../JI03/ji03t001/ji03t001.cpp | 49 +++-------- .../JI03/ji03t002/ji03t002.cpp | 77 +++++------------ .../JI03/ji03t003/ji03t003.cpp | 69 +++++---------- .../JI03/ji03t004/ji03t004.cpp | 78 +++++------------ .../JI05/ji05t001/ji05t001.cpp | 67 ++++----------- .../JI06/ji06t001/ji06t001.cpp | 82 +++++------------- .../earlyretbase/earlyretbase.cpp | 21 +---- 50 files changed, 264 insertions(+), 1283 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp index 439b8695125..955fd841aaa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass020_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> add method capability check ...\n"); @@ -145,6 +129,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass020_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp index 340700aa612..e44872125f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass021_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> delete method capability check ...\n"); @@ -144,6 +128,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass021_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp index bff034cd37c..e931801f560 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass022_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> change fields capability check ...\n"); @@ -145,6 +129,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass022_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp index c56469e9273..4d118e726d3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass023_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> change implemented interface capability check ...\n"); @@ -145,6 +129,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass023_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp index c432f07e6c6..41c4a849275 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass024_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> change class modifiers capability check ...\n"); @@ -145,6 +129,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass024_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp index 4d1311a765a..ee5b364dc7e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass025_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> change method modifiers capability check ...\n"); @@ -145,6 +129,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass025_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp index 0daa1901e17..68366880a65 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -117,10 +103,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass026_check(JNIEnv *env, jclass cls, } classDef.klass = clazz; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL); + classDef.class_byte_count = env->GetArrayLength(bytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); if (printdump == JNI_TRUE) { printf(">>> changed class name check ...\n"); @@ -142,6 +126,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass026_check(JNIEnv *env, jclass cls, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp index e596123c89c..e784af2bc58 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp @@ -28,21 +28,8 @@ #include "JVMTITools.h" #include "jni_tools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -311,10 +298,8 @@ void redefine(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { jvmtiError err; classDef.klass = cls; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL); + classDef.class_byte_count = env->GetArrayLength(classBytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses %d\n", redefinesCount); @@ -615,8 +600,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -713,24 +697,21 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, !caps.can_get_line_numbers || !caps.can_access_local_variables) return; - classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes)); + classBytes = (jbyteArray) env->NewGlobalRef(bytes); - midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz), - "run", "()V"); + midRun = env->GetMethodID(clazz, "run", "()V"); if (midRun == NULL) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; } - mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz), - "method1", "(I)V"); + mid1 = env->GetMethodID(clazz, "method1", "(I)V"); if (mid1 == NULL) { printf("Cannot find Method ID for method1\n"); result = STATUS_FAILED; } - mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz), - "method2", "(I)V"); + mid2 = env->GetMethodID(clazz, "method2", "(I)V"); if (mid2 == NULL) { printf("Cannot find Method ID for method2\n"); result = STATUS_FAILED; @@ -755,8 +736,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } } - fid1 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, clazz), - "staticInt", "I"); + fid1 = env->GetStaticFieldID(clazz, "staticInt", "I"); if (fid1 == NULL) { printf("Cannot find Field ID for staticInt\n"); result = STATUS_FAILED; @@ -781,8 +761,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } } - fid2 = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, clazz), - "instanceInt", "I"); + fid2 = env->GetFieldID(clazz, "instanceInt", "I"); if (fid2 == NULL) { printf("Cannot find Field ID for instanceInt\n"); result = STATUS_FAILED; @@ -848,6 +827,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp index 0b24f5b20c1..88b26a5b235 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define STATUS_FAILED 2 #define PASSED 0 @@ -90,8 +77,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jint res; jvmtiError err; - if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti), - JVMTI_VERSION_1_1)) != JNI_OK) { + if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) { printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res); return JNI_ERR; } @@ -163,10 +149,8 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; - classDef.class_byte_count = - JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes)); - classDef.class_bytes = (unsigned char *) - JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL); + classDef.class_byte_count = env->GetArrayLength(classBytes); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); set_watch_ev(1); /* watch JVMTI events */ @@ -201,6 +185,4 @@ Java_nsk_jvmti_RedefineClasses_redefclass031r_nativeMethod(JNIEnv * pEnv, jclass } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp index 59126fe4a45..4fd205eea9e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -61,9 +48,9 @@ jthread jthr(JNIEnv *env) { jmethodID cid; jthread res; - thrClass = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, "java/lang/Thread")); - cid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, thrClass), "", "()V"); - res = JNI_ENV_PTR(env)->NewObject(JNI_ENV_ARG(env, thrClass), cid); + thrClass = env->FindClass("java/lang/Thread"); + cid = env->GetMethodID(thrClass, "", "()V"); + res = env->NewObject(thrClass, cid); return res; } @@ -257,8 +244,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -337,6 +323,4 @@ Java_nsk_jvmti_RunAgentThread_agentthr001_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp index 1654a1ec459..b66836e8ed3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -69,8 +56,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -172,6 +158,4 @@ Java_nsk_jvmti_RunAgentThread_agentthr002_check(JNIEnv *env, jclass cls, jthread return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp index 6e92a02d6f4..607b9f00557 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -68,8 +55,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -145,6 +131,4 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp index 3a867cd0e9a..5bee6195805 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -120,8 +106,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { return result; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); + mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); if (mid == NULL) { printf("Cannot find method run\n"); return STATUS_FAILED; @@ -157,6 +142,4 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp index f75d0df6a05..b996ed3f021 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -119,8 +105,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { return result; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "check", "()I"); + mid = env->GetStaticMethodID(cls, "check", "()I"); if (mid == NULL) { printf("Cannot find method check\n"); return STATUS_FAILED; @@ -139,6 +124,4 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp index b414b24212e..462cbe0417b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -119,8 +105,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { return result; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "trial", "()I"); + mid = env->GetStaticMethodID(cls, "trial", "()I"); if (mid == NULL) { printf("Cannot find method trial\n"); return STATUS_FAILED; @@ -146,6 +131,4 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp index 4a15b8cdb23..79b93a9fbf7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -119,8 +105,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { return result; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "checkPoint", "()V"); + mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); if (mid == 0) { printf("Cannot find Method ID for method checkPoint\n"); return STATUS_FAILED; @@ -143,6 +128,4 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp index ac39922bcd4..7dcdce09ac3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -133,8 +120,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -192,8 +178,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, return; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - exp_name, exp_sig); + mid = env->GetStaticMethodID(cls, exp_name, exp_sig); if (mid == NULL) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; @@ -234,6 +219,4 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp index 663601cda37..dc9aca7c5cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -132,8 +119,7 @@ void setWatches(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { jfieldID fid; jmethodID mid; - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "meth01", "(I)V"); + mid = env->GetStaticMethodID(cls, "meth01", "(I)V"); err = jvmti->SetBreakpoint(mid, 0); if (err == JVMTI_ERROR_NONE) { enable(jvmti_env, JVMTI_EVENT_BREAKPOINT); @@ -143,7 +129,7 @@ void setWatches(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { TranslateError(err), err); } - fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), "fld", "I"); + fid = env->GetStaticFieldID(cls, "fld", "I"); if (caps.can_generate_field_access_events) { err = jvmti->SetFieldAccessWatch(cls, fid); if (err == JVMTI_ERROR_NONE) { @@ -322,8 +308,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(enbl_scale, 0, SCALE_SIZE); memset(ev_scale, 0, SCALE_SIZE); - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -429,6 +414,4 @@ Java_nsk_jvmti_SetEventNotificationMode_setnotif001_getRes(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp index 018cf33b867..a01c295a55f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -74,7 +61,7 @@ void setWatch(JNIEnv *env, jint ind) { jclass cls; field fld = fields[ind]; - cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fld.klass)); + cls = env->FindClass(fld.klass); if (cls == NULL) { printf("Cannot find class \"%s\"\n", fld.klass); result = STATUS_FAILED; @@ -82,11 +69,9 @@ void setWatch(JNIEnv *env, jint ind) { } if (fld.fid == NULL) { if (fld.stat) { - fields[ind].fid = JNI_ENV_PTR(env)-> - GetStaticFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig); + fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { - fields[ind].fid = JNI_ENV_PTR(env)-> - GetFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig); + fields[ind].fid = env->GetFieldID(cls, fld.name, fld.sig); } } @@ -147,8 +132,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -210,7 +194,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw001_touchfld0(JNIEnv *env, jint val; setWatch(env, (jint)0); - val = JNI_ENV_PTR(env)->GetIntField(JNI_ENV_ARG(env, obj), fields[0].fid); + val = env->GetIntField(obj, fields[0].fid); } JNIEXPORT void JNICALL @@ -236,6 +220,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw001_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp index 9fed43f551d..11161cffd8a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -71,8 +58,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -127,8 +113,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw002_check(JNIEnv *env, jclass cls) { jvmtiError err; jfieldID fid; - fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld1", "I"); + fid = env->GetStaticFieldID(cls, "fld1", "I"); if (!caps.can_generate_field_access_events) { err = jvmti->SetFieldAccessWatch(cls, fid); @@ -170,6 +155,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw002_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp index 38ff8b18c73..07e897f5738 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -83,8 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -135,12 +121,10 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getReady(JNIEnv *env, jclass cls) return; } - fids[0] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld0", "I"); - fids[1] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld1", "I"); - fids[2] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld2", "I"); - fids[3] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld3", "I"); + fids[0] = env->GetStaticFieldID(cls, "fld0", "I"); + fids[1] = env->GetStaticFieldID(cls, "fld1", "I"); + fids[2] = env->GetFieldID(cls, "fld2", "I"); + fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { if (fids[i] == NULL) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); @@ -185,6 +169,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp index 336a0d9cbdb..45374d31fac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -83,8 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -141,12 +127,10 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getReady(JNIEnv *env, jclass cls) return; } - fids[0] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld0", "I"); - fids[1] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld1", "I"); - fids[2] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld2", "I"); - fids[3] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld3", "I"); + fids[0] = env->GetStaticFieldID(cls, "fld0", "I"); + fids[1] = env->GetStaticFieldID(cls, "fld1", "I"); + fids[2] = env->GetFieldID(cls, "fld2", "I"); + fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { if (fids[i] == NULL) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); @@ -191,6 +175,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp index 5a136757bac..2fb1f4aa8ba 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -108,8 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -168,13 +154,11 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) for (i = 0; i < sizeof(fields) / sizeof(field); i++) { if (fields[i].stat == JNI_TRUE) { - fields[i].fid = JNI_ENV_PTR(env)-> - GetStaticFieldID(JNI_ENV_ARG(env, cls), - fields[i].name, fields[i].sig); + fields[i].fid = env-> GetStaticFieldID( + cls, fields[i].name, fields[i].sig); } else { - fields[i].fid = JNI_ENV_PTR(env)-> - GetFieldID(JNI_ENV_ARG(env, cls), - fields[i].name, fields[i].sig); + fields[i].fid = env->GetFieldID( + cls, fields[i].name, fields[i].sig); } if (fields[i].fid == NULL) { printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0", @@ -220,6 +204,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp index 599b7c870a6..8d0309d9ceb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -120,8 +107,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -190,11 +176,11 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, } for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watches[i].is_static == JNI_TRUE) { - watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID( - JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetStaticFieldID( + cls, watches[i].f_name, watches[i].f_sig); } else { - watches[i].fid = JNI_ENV_PTR(env)->GetFieldID( - JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetFieldID( + cls, watches[i].f_name, watches[i].f_sig); } err = jvmti->SetFieldAccessWatch(cls, watches[i].fid); if (err == JVMTI_ERROR_NONE) { @@ -243,6 +229,4 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_check(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp index e6bf872145a..d2ddd47d717 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -73,16 +60,12 @@ void setWatch(JNIEnv *env, jint ind) { jclass cls; jvmtiError err; - cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fields[ind].klass)); + cls = env->FindClass(fields[ind].klass); if (fields[ind].fid == NULL) { if (fields[ind].stat) { - fields[ind].fid = - JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - fields[ind].name, fields[ind].sig); + fields[ind].fid = env->GetStaticFieldID(cls, fields[ind].name, fields[ind].sig); } else { - fields[ind].fid = - JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), - fields[ind].name, fields[ind].sig); + fields[ind].fid = env->GetFieldID(cls, fields[ind].name, fields[ind].sig); } } @@ -143,8 +126,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -204,7 +186,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw001_touchfld0(JNIEnv *env, jclass cls) { setWatch(env, (jint)0); - JNI_ENV_PTR(env)->SetIntField(JNI_ENV_ARG(env, cls), fields[0].fid, (jint)2000); + env->SetIntField(cls, fields[0].fid, (jint)2000); } JNIEXPORT void JNICALL @@ -231,6 +213,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw001_getRes(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp index 373c240bf40..6b302d99744 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -71,8 +58,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -128,8 +114,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, jvmtiError err; jfieldID fid; - fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - "fld1", "I"); + fid = env->GetStaticFieldID(cls, "fld1", "I"); if (!caps.can_generate_field_modification_events) { err = jvmti->SetFieldModificationWatch(cls, fid); @@ -171,6 +156,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp index 0fb787a0c18..98391a1bf08 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -101,8 +88,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -156,13 +142,9 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getReady(JNIEnv *env, for (i = 0; i < sizeof(flds) / sizeof(field); i++) { if (flds[i].stat == JNI_TRUE) { - flds[i].fid = - JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, "I"); + flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, "I"); } else { - flds[i].fid = - JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, "I"); + flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } if (flds[i].fid == NULL) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); @@ -224,6 +206,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getRes(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp index fa1c7905281..40d76f9a77b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -101,8 +88,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -154,13 +140,9 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getR for (i = 0; i < sizeof(flds) / sizeof(field); i++) { if (flds[i].stat == JNI_TRUE) { - flds[i].fid = - JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, "I"); + flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, "I"); } else { - flds[i].fid = - JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, "I"); + flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } if (flds[i].fid == NULL) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); @@ -222,6 +204,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getRes(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp index c499a97d980..aa6281ddeb6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -90,9 +77,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, actual_sig = sig; actual_val = new_value; if (actual_sig == 'L') { - actual_val.l = - JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env, - actual_val.l)); + actual_val.l = env->NewGlobalRef(actual_val.l); } if (printdump == JNI_TRUE) { printf(">>> FieldModification, field: 0x%p", actual_fid); @@ -152,8 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -216,8 +200,8 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, flds[3].val.f = 654.321F; flds[4].val.d = 123456.654321; flds[5].val.d = 654321.123456; - flds[6].val.l = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj1)); - flds[7].val.l = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj2)); + flds[6].val.l = env->NewGlobalRef(obj1); + flds[7].val.l = env->NewGlobalRef(obj2); flds[8].val.z = JNI_TRUE; flds[9].val.z = JNI_FALSE; flds[10].val.b = 123; @@ -228,13 +212,9 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, flds[15].val.c = 0xdcba; for (i = 0; i < sizeof(flds) / sizeof(field); i++) { if (flds[i].stat == JNI_TRUE) { - flds[i].fid = - JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, flds[i].sig); + flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, flds[i].sig); } else { - flds[i].fid = - JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), - flds[i].name, flds[i].sig); + flds[i].fid = env->GetFieldID(cls, flds[i].name, flds[i].sig); } if (flds[i].fid == NULL) { printf("Unable to set modification watch on %s fld%" PRIuPTR ", fieldID=0", @@ -330,8 +310,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_check(JNIEnv *env, } break; case 'L': - if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, actual_val.l), - flds[ind].val.l) != JNI_TRUE) { + if (!env->IsSameObject(actual_val.l, flds[ind].val.l)) { result = STATUS_FAILED; if (!flag_err) { printf("Field %s fld%d thrown error:\n", flds[ind].descr, ind); @@ -398,6 +377,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getRes(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp index 2668f5a277b..d4a12313458 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp @@ -28,21 +28,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -120,8 +107,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -184,13 +170,11 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, } for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watches[i].is_static == JNI_TRUE) { - watches[i].fid = - JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), - watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetStaticFieldID( + cls, watches[i].f_name, watches[i].f_sig); } else { - watches[i].fid = - JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), - watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetFieldID( + cls, watches[i].f_name, watches[i].f_sig); } err = jvmti->SetFieldModificationWatch(cls, watches[i].fid); if (err == JVMTI_ERROR_NONE) { @@ -240,6 +224,4 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_check(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp index 130477157fe..39024b6dd97 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp @@ -32,27 +32,8 @@ #include "JVMTITools.h" #include "native_thread.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -140,16 +121,14 @@ void doRedirect(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } if (verbose) printf("doRedirect: the JNI function table obtained successfully\n"); @@ -163,8 +142,7 @@ void doRedirect(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } if (verbose) @@ -181,8 +159,7 @@ void doRestore(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to restore original JNI function table")); + env->FatalError("failed to restore original JNI function table"); } if (verbose) printf("doRestore: the original JNI function table is restored successfully\n"); @@ -191,24 +168,22 @@ void doRestore(JNIEnv *env) { void doExec(JNIEnv *env, int thrNum) { jint res; - if ((res = JNI_ENV_PTR(env)-> - MonitorEnter(JNI_ENV_ARG(env, clsObj))) != 0) { + if ((res = env->MonitorEnter(clsObj)) != 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: MonitorEnter() returns %d for thread #%d\n", __FILE__, __LINE__, res, thrNum); } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: exception occured for thread #%d\n", __FILE__, __LINE__, thrNum); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); } if (verbose) printf("\ndoExec: thread #%d entered the monitor\n", thrNum); - if ((res = JNI_ENV_PTR(env)-> - MonitorExit(JNI_ENV_ARG(env, clsObj))) != 0) { + if ((res = env->MonitorExit(clsObj)) != 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: MonitorExit() returns %d for thread #%d\n", __FILE__, __LINE__, res, thrNum); @@ -246,9 +221,7 @@ static int waitingThread(void *context) { if (verbose) printf("\nwaitingThread: thread #%d started\n\tattaching the thread to the VM ...\n", indx); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n", __FILE__, __LINE__, res); return STATUS_FAILED; @@ -258,9 +231,7 @@ static int waitingThread(void *context) { doExec(env, indx); - if ((res = - JNI_ENV_PTR(vm)->DetachCurrentThread( - JNI_ENV_ARG1(vm))) != 0) { + if ((res = vm->DetachCurrentThread()) != 0) { printf("(%s,%d): TEST FAILURE: waitingThread: DetachCurrentThread() returns: %d\n", __FILE__, __LINE__, res); return STATUS_FAILED; @@ -276,22 +247,19 @@ static jobject getObjectFromField(JNIEnv *env, jobject obj) { jfieldID fid; jclass _objCls; - _objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj)); + _objCls = env->GetObjectClass(obj); if (verbose) printf("\ngetObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n", javaField, classSig); - if ((fid = JNI_ENV_PTR(env)->GetFieldID( - JNI_ENV_ARG(env, _objCls), javaField, classSig)) == 0) { + if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: failed to get ID for the field \"%s\"\n", __FILE__, __LINE__, javaField); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get ID for the java field")); + env->FatalError("failed to get ID for the java field"); } - return JNI_ENV_PTR(env)->GetObjectField( - JNI_ENV_ARG(env, obj), fid); + return env->GetObjectField(obj, fid); } void startThreads() { @@ -358,12 +326,10 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) return STATUS_FAILED; } - if ((clsObj = JNI_ENV_PTR(env)->NewGlobalRef( - JNI_ENV_ARG(env, getObjectFromField(env, obj)))) == NULL) { + if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) { printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n", __FILE__, __LINE__, classSig); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to create a new global reference")); + env->FatalError("failed to create a new global reference"); } doRedirect(env); @@ -385,18 +351,14 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) if (verbose) printf("\nb) Checking the assertion inside main thread detached and attached again ...\n\ndetaching the main thread ...\n"); - if ((res = - JNI_ENV_PTR(vm)->DetachCurrentThread( - JNI_ENV_ARG1(vm))) != 0) + if ((res = vm->DetachCurrentThread()) != 0) printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\ \tcheck with the detached main thread skipped\n", __FILE__, __LINE__, res); else { if (verbose) printf("\nattaching the main thread again ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &nextEnv), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) { printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n", __FILE__, __LINE__, res); return STATUS_FAILED; @@ -422,7 +384,7 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) waitThreads(); checkCall(2, 0, "new threads"); - JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG((nextEnv==NULL)? env:nextEnv, clsObj)); + env->DeleteGlobalRef(clsObj); return result; } @@ -448,8 +410,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -467,6 +428,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp index 8ad50c2f1ff..2bbefa154ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp @@ -27,27 +27,7 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -98,9 +78,7 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab002_check(JNIEnv *env, jobject obj) only since JDK 1.2 */ if (verbose) printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n"); - if ((res = - JNI_ENV_PTR(vm)->DetachCurrentThread( - JNI_ENV_ARG1(vm))) != JNI_OK) + if ((res = vm->DetachCurrentThread()) != JNI_OK) printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\ \tcheck with the detached main thread skipped\n", __FILE__, __LINE__, res); @@ -109,9 +87,7 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab002_check(JNIEnv *env, jobject obj) if (verbose) printf("\nattaching the main thread back ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &nextEnv), (void *) 0)) != JNI_OK) { + if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != JNI_OK) { printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n", __FILE__, __LINE__, res); return STATUS_FAILED; @@ -141,8 +117,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -153,6 +128,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp index 805191f1add..64d0a3787bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -270,8 +257,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if ( res != JNI_OK || jvmti == NULL ) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; @@ -330,23 +316,18 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getMethReady(JNIEnv *env, if (!caps.can_access_local_variables || !caps.can_generate_breakpoint_events) return; - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "checkPoint", "()V"); - mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls), - "meth01", "()D"); - mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls), - "meth02", "(I)V"); - mid3 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "meth03", "()V"); - mid4 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "meth04", "(IJSDCFBZ)V"); + mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); + mid1 = env->GetMethodID(cls, "meth01", "()D"); + mid2 = env->GetMethodID(cls, "meth02", "(I)V"); + mid3 = env->GetStaticMethodID(cls, "meth03", "()V"); + mid4 = env->GetStaticMethodID(cls, "meth04", "(IJSDCFBZ)V"); if (mid == 0 || mid1 == 0 || mid2 == 0 || mid3 == 0 || mid4 == 0) { printf("Cannot find Method ID for a method\n"); } floatVal = f; doubleVal = d; - objVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, o)); - arrVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, a)); + objVal = env->NewGlobalRef(o); + arrVal = env->NewGlobalRef(a); err = jvmti->SetBreakpoint(mid, 0); if (err != JVMTI_ERROR_NONE) { @@ -369,6 +350,4 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp index c6049fe891e..e5bfb579360 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -122,8 +108,8 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre return result; } - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); + mid = env->GetStaticMethodID( + cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); if (mid == NULL) { printf("Cannot find method \"run\"\n"); return STATUS_FAILED; @@ -299,6 +285,4 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp index 42817ea4e43..144a6614a9e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -156,8 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -215,8 +201,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { if (!caps.can_access_local_variables || !caps.can_generate_breakpoint_events) return; - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "checkPoint", "()V"); + mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); if (mid == NULL) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; @@ -244,6 +229,4 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp index fb6365d4aa6..0fb6ac13f5f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -161,8 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -220,8 +206,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getReady(JNIEnv *env, jclass cls) { if (!caps.can_access_local_variables || !caps.can_generate_breakpoint_events) return; - mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), - "checkPoint", "()V"); + mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); if (mid == 0) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; @@ -249,6 +234,4 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getRes(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp index dffdcaa6c9c..89f43810c1f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,8 +57,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -144,6 +130,4 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp index 77ca8fba6d7..ff9eb3753a4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -99,8 +86,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -127,7 +113,7 @@ Java_nsk_jvmti_ThreadEnd_threadend001_getReady(JNIEnv *env, return; } - prefix = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name), NULL); + prefix = env->GetStringUTFChars(name, NULL); if (prefix == NULL) { printf("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; @@ -170,6 +156,4 @@ Java_nsk_jvmti_ThreadEnd_threadend001_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp index d8fa212942e..6e892bb2936 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -99,8 +86,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -127,7 +113,7 @@ Java_nsk_jvmti_ThreadStart_threadstart001_getReady(JNIEnv *env, return; } - prefix = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name), NULL); + prefix = env->GetStringUTFChars(name, NULL); if (prefix == NULL) { printf("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; @@ -170,6 +156,4 @@ Java_nsk_jvmti_ThreadStart_threadstart001_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp index 4cd50d5e111..8d5c42dee54 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -113,8 +100,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -166,8 +152,7 @@ Java_nsk_jvmti_ThreadStart_threadstart003_check(JNIEnv *env, return STATUS_FAILED; } - threadName = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name), - NULL); + threadName = env->GetStringUTFChars(name, NULL); if (threadName == NULL) { printf("Failed to copy UTF-8 string!\n"); return STATUS_FAILED; @@ -288,6 +273,4 @@ Java_nsk_jvmti_ThreadStart_threadstart003_check(JNIEnv *env, return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp index 0ad3511e7a4..dadf59c3d6e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp @@ -33,27 +33,7 @@ #include "JVMTITools.h" #include "jvmti_tools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -121,6 +101,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp index ae7dc4054fa..7480242377a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -149,8 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printdump = JNI_TRUE; } - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -197,6 +183,4 @@ Java_nsk_jvmti_VMInit_vminit001_check(JNIEnv *env, jclass cls) { return result; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp index b8b794408c4..676bd776bd1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp @@ -28,23 +28,8 @@ #include "jni_tools.h" #include "jvmti_tools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_ARG1(x) -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_ARG1(x) x -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif /* ============================================================================= */ @@ -201,8 +186,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; NSK_DISPLAY0("Create first JVMTI env.\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti_1), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti_1, JVMTI_VERSION_1_1); if (res < 0) { NSK_COMPLAIN0("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -254,6 +238,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* ============================================================================= */ -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp index 83342aad368..9c3b94e02c1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp @@ -30,27 +30,7 @@ #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -70,11 +50,11 @@ int call_count = 0; jint JNICALL MyGetVersion(JNIEnv *env) { call_count++; - if (verbose) + if (verbose) { printf("\nMyGetVersion: the function called successfully: getVer_count=%d\n", call_count); - return - orig_jni_functions->GetVersion(env); + } + return orig_jni_functions->GetVersion(env); } void doRedirect(JNIEnv *env) { @@ -87,8 +67,7 @@ void doRedirect(JNIEnv *env) { JVMTI_ERROR_NONE) { printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); result = STATUS_FAILED; } @@ -96,8 +75,7 @@ void doRedirect(JNIEnv *env) { JVMTI_ERROR_NONE) { printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); result = STATUS_FAILED; } if (verbose) @@ -109,8 +87,7 @@ void doRedirect(JNIEnv *env) { JVMTI_ERROR_NONE) { printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); result = STATUS_FAILED; } @@ -127,8 +104,7 @@ void doRestore(JNIEnv *env) { JVMTI_ERROR_NONE) { printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to restore original JNI function table")); + env->FatalError("failed to restore original JNI function table"); result = STATUS_FAILED; } if (verbose) @@ -148,7 +124,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t001_check(JNIEnv *env, jcla if (verbose) printf("\na) invoking the original function GetVersion() ...\n"); - ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env)); + ver = env->GetVersion(); if (verbose) printf("JNIenv version=%d\n", ver); @@ -158,7 +134,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t001_check(JNIEnv *env, jcla if (verbose) printf("\nb) invoking the redirected function GetVersion() ...\n"); - ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env)); + ver = env->GetVersion(); if (call_count == 1) { if (verbose) @@ -177,7 +153,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t001_check(JNIEnv *env, jcla if (verbose) printf("\nc) invoking the restored function GetVersion ...\n"); - ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env)); + ver = env->GetVersion(); if (call_count == 0) { if (verbose) @@ -213,8 +189,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -223,6 +198,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp index e512ac68494..75e82406f4a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp @@ -31,27 +31,7 @@ #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -123,16 +103,14 @@ void doRedirect(JNIEnv *env, jclass cls) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } if (verbose) printf("doRedirect: the JNI function table obtained successfully\n"); @@ -142,33 +120,29 @@ void doRedirect(JNIEnv *env, jclass cls) { printf("\ndoRedirect: obtaining method ID for \"%s %s\"...\n", meth_info[i].m_name, meth_info[i].m_sign); if (meth_info[i].inst) { /* an instance method */ - meth_info[i].mid = JNI_ENV_PTR(env)->GetMethodID( - JNI_ENV_ARG(env, cls), - meth_info[i].m_name, meth_info[i].m_sign); + meth_info[i].mid = env->GetMethodID( + cls, meth_info[i].m_name, meth_info[i].m_sign); } else { /* a static method */ - meth_info[i].mid = JNI_ENV_PTR(env)->GetStaticMethodID( - JNI_ENV_ARG(env, cls), - meth_info[i].m_name, meth_info[i].m_sign); + meth_info[i].mid = env->GetStaticMethodID( + cls, meth_info[i].m_name, meth_info[i].m_sign); } if (meth_info[i].mid == NULL) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: failed to get the ID for the method \"%s %s\"\n", __FILE__, __LINE__, meth_info[i].m_name, meth_info[i].m_sign); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get the ID for a method")); + env->FatalError("failed to get the ID for a method"); } if (verbose) printf("\ndoRedirect: obtaining field ID for \"%s\"...\n", meth_info[i].f_name); - if ((meth_info[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID( - JNI_ENV_ARG(env, cls), meth_info[i].f_name, "I")) == 0) { + if ((meth_info[i].fid = env->GetStaticFieldID( + cls, meth_info[i].f_name, "I")) == 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get ID for the field %s\n", __FILE__, __LINE__, meth_info[i].f_name); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "cannot get field ID")); + env->FatalError("cannot get field ID"); } switch(i) { @@ -190,8 +164,7 @@ void doRedirect(JNIEnv *env, jclass cls) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } if (verbose) @@ -208,16 +181,14 @@ void doRestore(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to restore original JNI function table")); + env->FatalError("failed to restore original JNI function table"); } if (verbose) printf("doRestore: the original JNI function table is restored successfully\n"); } int getFieldVal(JNIEnv *env, jclass cls, jfieldID fid) { - return JNI_ENV_PTR(env)->GetStaticIntField( - JNI_ENV_ARG(env, cls), fid); + return env->GetStaticIntField(cls, fid); } void doCall(JNIEnv *env, jobject obj, jclass objCls, const char *msg) { @@ -233,27 +204,26 @@ void doCall(JNIEnv *env, jobject obj, jclass objCls, const char *msg) { dVal = env->CallStaticDoubleMethod(objCls, meth_info[i].mid, 73); break; case 1: - JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG(env, obj), - meth_info[i].mid); + env->CallVoidMethod(obj, meth_info[i].mid); break; } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during the execution of the %s method\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); } meth_info[i].java_calls = getFieldVal(env, objCls, meth_info[i].fid); - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during getting value of the %s fieldn", __FILE__, __LINE__, meth_info[i].f_name); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); } } @@ -306,7 +276,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t002_check(JNIEnv *env, jobj return STATUS_FAILED; } - objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj)); + objCls = env->GetObjectClass(obj); /* 1: check the JNI function table interception */ if (verbose) @@ -345,8 +315,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -355,6 +324,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp index a9adfea4afe..21e499f38fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp @@ -31,27 +31,7 @@ #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -128,16 +108,14 @@ void doRedirect(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } if (verbose) printf("doRedirect: the JNI function table obtained successfully\n"); @@ -153,8 +131,7 @@ void doRedirect(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } if (verbose) @@ -171,8 +148,7 @@ void doRestore(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to restore original JNI function table")); + env->FatalError("failed to restore original JNI function table"); } if (verbose) printf("doRestore: the original JNI function table is restored successfully\n"); @@ -181,19 +157,18 @@ void doRestore(JNIEnv *env) { void doExc(JNIEnv *env, jthrowable thrw, jclass thrCls, const char *msg) { jint res; - if ((res = JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, thrCls), msg)) != 0) { + if ((res = env->ThrowNew(thrCls, msg)) != 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to throw new exception\n", __FILE__, __LINE__); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to failed to throw new exception")); + env->FatalError("failed to failed to throw new exception"); } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { if (verbose) printf("\nCHECK PASSED: exception %s thrown by ThrowNew()\n\tis detected by ExceptionOccurred() successfully\n", msg); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionClear(); } else { result = STATUS_FAILED; @@ -201,19 +176,18 @@ void doExc(JNIEnv *env, jthrowable thrw, jclass thrCls, const char *msg) { __FILE__, __LINE__, msg); } - if ((res = JNI_ENV_PTR(env)->Throw(JNI_ENV_ARG(env, thrw))) != 0) { + if ((res = env->Throw(thrw)) != 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to throw exception\n", __FILE__, __LINE__); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to failed to throw new exception")); + env->FatalError("failed to failed to throw new exception"); } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { if (verbose) printf("(%s,%d): CHECK PASSED: exception %s thrown by Throw()\n\tis detected by ExceptionOccurred() successfully\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionClear(); } else { result = STATUS_FAILED; @@ -285,13 +259,12 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t003_check(JNIEnv *env, jobj return STATUS_FAILED; } - objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj)); + objCls = env->GetObjectClass(obj); if (verbose) printf("\ncheck: obtaining field ID for \"name=%s signature=%s\"...\n", javaField, excClassSig); - if ((fid = JNI_ENV_PTR(env)->GetFieldID( - JNI_ENV_ARG(env, objCls), javaField, excClassSig)) == 0) { + if ((fid = env->GetFieldID(objCls, javaField, excClassSig)) == 0) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get ID for the field \"%s\"\n", __FILE__, __LINE__, javaField); @@ -301,13 +274,12 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t003_check(JNIEnv *env, jobj if (verbose) printf("check: obtaining the value of the field \"%s\"...\n", javaField); - thrwObj = (jthrowable) JNI_ENV_PTR(env)->GetObjectField( - JNI_ENV_ARG(env, obj), fid); + thrwObj = (jthrowable) env->GetObjectField(obj, fid); if (verbose) printf("check: obtaining the class of the object for \"%s\"...\n", javaField); - thrw = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thrwObj)); + thrw = env->GetObjectClass(thrwObj); /* 1: check the JNI function table interception */ if (verbose) @@ -323,8 +295,8 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t003_check(JNIEnv *env, jobj doExc(env, thrwObj, thrw, "restored"); checkCall(2, 0, 0, 0); - JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, thrw)); - JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, thrwObj)); + env->DeleteLocalRef(thrw); + env->DeleteLocalRef(thrwObj); return result; } @@ -349,8 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -359,6 +330,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp index 6c826ede465..131f52e9dd3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp @@ -31,27 +31,7 @@ #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -98,21 +78,17 @@ void doRedirect(JNIEnv *env) { if (verbose) printf("\ndoRedirect: obtaining the JNI function table ...\n"); - if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } - if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } if (verbose) printf("doRedirect: the JNI function table obtained successfully\n"); @@ -127,8 +103,7 @@ void doRedirect(JNIEnv *env) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } if (verbose) @@ -140,13 +115,11 @@ void doRestore(JNIEnv *env) { if (verbose) printf("\ndoRestore: restoring the original JNI function table ...\n"); - if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n", __FILE__, __LINE__, TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to restore original JNI function table")); + env->FatalError("failed to restore original JNI function table"); } if (verbose) printf("doRestore: the original JNI function table is restored successfully\n"); @@ -157,42 +130,40 @@ void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) jobject newObj; va_list args; va_start(args, msg); - if ((allObj = JNI_ENV_PTR(env)->AllocObject(JNI_ENV_ARG(env, allCls))) + if ((allObj = env->AllocObject(allCls)) == NULL) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to failed to call AllocObject()")); + env->FatalError("failed to failed to call AllocObject()"); } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); } - newObj = JNI_ENV_PTR(env)->NewObjectV(JNI_ENV_ARG(env, allCls), ctorId, args); + newObj = env->NewObjectV(allCls, ctorId, args); if (newObj == NULL) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s NewObjectV()\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to failed to call NewObjectV()")); + env->FatalError("failed to failed to call NewObjectV()"); } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n", __FILE__, __LINE__, msg); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); } va_end(args); - JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, allObj)); - JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, newObj)); + env->DeleteLocalRef(allObj); + env->DeleteLocalRef(newObj); } void checkCall(int step, int exAllObjCalls, int exNewObjCalls) { @@ -240,15 +211,13 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t004_check(JNIEnv *env, jobj return STATUS_FAILED; } - if ((objCls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, classSig))) - == NULL) { + if ((objCls = env->FindClass(classSig)) == NULL) { printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n", __FILE__, __LINE__, classSig); return STATUS_FAILED; } - if ((ctorId = JNI_ENV_PTR(env)->GetMethodID( - JNI_ENV_ARG(env, objCls), "", "()V")) + if ((ctorId = env->GetMethodID(objCls, "", "()V")) == NULL) { printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n", __FILE__, __LINE__); @@ -292,8 +261,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (verbose) printf("verbose mode on\n"); - res = JNI_ENV_PTR(jvm)-> - GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; @@ -302,6 +270,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp index a551349b582..24886e3b6e1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp @@ -34,27 +34,7 @@ #include "jvmti_tools.h" #include "native_thread.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -119,21 +99,17 @@ static void doRedirect(JNIEnv *env, jvmtiEnv *jvmti, int indx) { NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n", (indx==0)?"first":"second"); - if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n", (indx==0)?"first":"second", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } - if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n", (indx==0)?"first":"second", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } NSK_DISPLAY1("%s JVMTI env: doRedirect: the JNI function table obtained successfully\n\ @@ -142,13 +118,11 @@ static void doRedirect(JNIEnv *env, jvmtiEnv *jvmti, int indx) { redir_jni_functions[indx]->GetVersion = (indx==0)?MyGetVersionA:MyGetVersionB; - if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) != - JVMTI_ERROR_NONE) { + if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n", (indx==0)?"first":"second", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } NSK_DISPLAY1("%s JVMTI env: doRedirect: the functions are overwritten successfully\n", @@ -158,8 +132,7 @@ static void doRedirect(JNIEnv *env, jvmtiEnv *jvmti, int indx) { static void provokeIntercept(JNIEnv *env, const char *name) { jint res; - res = JNI_ENV_PTR(env)-> - GetVersion(JNI_ENV_ARG1(env)); + res = env->GetVersion(); NSK_DISPLAY2("\nGetVersion() called by the agent %s returns %d\n", name, res); } @@ -198,10 +171,8 @@ static int initAgent(int indx) { thrstarted[indx] = redir[indx] = redir_calls[indx] = 0; - NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", - (indx==0)?"A":"B"); - res = JNI_ENV_PTR(vm)-> - GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti[indx]), JVMTI_VERSION_1_1); + NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx==0)?"A":"B"); + res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti[indx] == NULL) { NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n", (indx==0)?"A":"B"); @@ -230,8 +201,7 @@ static int initAgent(int indx) { NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n", (indx==0)?"A":"B"); - if ((err = jvmti[indx]->SetEventNotificationMode( - JVMTI_ENABLE, + if ((err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)) != JVMTI_ERROR_NONE) { /* enable event globally */ NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n", (indx==0)?"A":"B", TranslateError(err)); @@ -282,11 +252,8 @@ static int agentA(void *context) { int exitCode = PASSED; NSK_DISPLAY0("\nthe agent A started\n\tattaching the thread to the VM ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { - NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", - res); + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { + NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res); exit(STATUS_FAILED); } @@ -333,7 +300,7 @@ static int agentA(void *context) { NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n", exitCode); - if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + if ((res = vm->DetachCurrentThread()) != 0) { NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res); } return exitCode; @@ -347,9 +314,7 @@ static int agentB(void *context) { int exitCode = PASSED; NSK_DISPLAY0("\nthe agent B started\n\tattaching the thread to the VM ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res); exit(STATUS_FAILED); @@ -396,7 +361,7 @@ static int agentB(void *context) { NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n", exitCode); - if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) { + if ((res = vm->DetachCurrentThread()) != 0) { NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res); } return exitCode; @@ -470,6 +435,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp index 7264c2db9fa..fcc26f07f4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp @@ -34,27 +34,7 @@ #include "jvmti_tools.h" #include "native_thread.h" -#ifdef __cplusplus extern "C" { -#endif - -#ifndef JNI_ENV_ARG - #ifdef __cplusplus - #define JNI_ENV_ARG(x, y) y - #define JNI_ENV_PTR(x) x - #else - #define JNI_ENV_ARG(x, y) x, y - #define JNI_ENV_PTR(x) (*x) - #endif -#endif - -#ifndef JNI_ENV_ARG1 - #ifdef __cplusplus - #define JNI_ENV_ARG1(x) - #else - #define JNI_ENV_ARG1(x) x - #endif -#endif #define PASSED 0 #define STATUS_FAILED 2 @@ -65,7 +45,7 @@ extern "C" { // Helper for thread detach and terminate #define THREAD_return(status) \ do { \ - int res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm)); \ + int res = vm->DetachCurrentThread(); \ if (res != 0) \ NSK_COMPLAIN1("TEST WARNING: DetachCurrentThread() returns: %d\n", res); \ else \ @@ -128,17 +108,16 @@ jint JNICALL MyMonitorEnter(JNIEnv *env, jobject obj) { static jint enterMonitor(JNIEnv *env, const char *thr) { jint result; - if ((result = JNI_ENV_PTR(env)-> - MonitorEnter(JNI_ENV_ARG(env, clsObj))) != 0) { + if ((result = env->MonitorEnter(clsObj)) != 0) { NSK_COMPLAIN2("TEST FAILURE: %s: MonitorEnter() returns: %d\n", thr, result); return STATUS_FAILED; } - if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) { + if (env->ExceptionOccurred()) { NSK_COMPLAIN1("TEST FAILURE: %s: exception occured\n", thr); - JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env)); - JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env)); + env->ExceptionDescribe(); + env->ExceptionClear(); return STATUS_FAILED; } @@ -148,8 +127,7 @@ static jint enterMonitor(JNIEnv *env, const char *thr) { static jint exitMonitor(JNIEnv *env, const char *thr) { jint result; - if ((result = JNI_ENV_PTR(env)-> - MonitorExit(JNI_ENV_ARG(env, clsObj))) != 0) { + if ((result = env->MonitorExit(clsObj)) != 0) { NSK_COMPLAIN2("TEST FAILURE: %s: MonitorExit() returns: %d\n", thr, result); return STATUS_FAILED; @@ -167,16 +145,14 @@ static void doRedirect(JNIEnv *env) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: failed to get original JNI function table: %s\n", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get original JNI function table")); + env->FatalError("failed to get original JNI function table"); } if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: failed to get redirected JNI function table: %s\n", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get redirected JNI function table")); + env->FatalError("failed to get redirected JNI function table"); } NSK_DISPLAY0("doRedirect: the JNI function table obtained successfully\n\ @@ -189,8 +165,7 @@ static void doRedirect(JNIEnv *env) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: failed to set new JNI function table: %s\n", TranslateError(err)); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to set new JNI function table")); + env->FatalError("failed to set new JNI function table"); } NSK_DISPLAY0("doRedirect: the functions are overwritten successfully\n"); @@ -222,9 +197,7 @@ static int waitingThread(void *context) { NSK_DISPLAY1("waitingThread: thread #%d started\n\ \tattaching the thread to the VM ...\n", indx); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { NSK_COMPLAIN1("TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n", res); return STATUS_FAILED; @@ -255,9 +228,7 @@ static int ownerThread(void *context) { int tries = 0; NSK_DISPLAY0("ownerThread: thread started\n\tattaching the thread to the VM ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { NSK_COMPLAIN1("TEST FAILURE: ownerThread: AttachCurrentThread() returns: %d\n", res); return STATUS_FAILED; @@ -277,8 +248,7 @@ static int ownerThread(void *context) { if (tries > TRIES) { NSK_COMPLAIN1("TEST FAILED: ownerThread: time exceed after %d attempts\n", TRIES); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "ownerThread: time exceed")); + env->FatalError("ownerThread: time exceed"); } } while(releaseMon != 1); @@ -298,9 +268,7 @@ static int redirectorThread(void *context) { int tries = 0; NSK_DISPLAY0("redirectorThread: thread started\n\tattaching the thread to the VM ...\n"); - if ((res = - JNI_ENV_PTR(vm)->AttachCurrentThread( - JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) { + if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) { NSK_COMPLAIN1("TEST FAILURE: redirectorThread: AttachCurrentThread() returns: %d\n", res); return STATUS_FAILED; @@ -320,21 +288,18 @@ static jobject getObjectFromField(JNIEnv *env, jobject obj) { jfieldID fid; jclass _objCls; - _objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj)); + _objCls = env->GetObjectClass(obj); NSK_DISPLAY2("getObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n", javaField, classSig); - if ((fid = JNI_ENV_PTR(env)->GetFieldID( - JNI_ENV_ARG(env, _objCls), javaField, classSig)) == 0) { + if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILURE: failed to get ID for the field \"%s\"\n", javaField); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to get ID for the java field")); + env->FatalError("failed to get ID for the java field"); } - return JNI_ENV_PTR(env)->GetObjectField( - JNI_ENV_ARG(env, obj), fid); + return env->GetObjectField(obj, fid); } JNIEXPORT jint JNICALL @@ -355,12 +320,10 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj } /* prepare the testing */ - if ((clsObj = JNI_ENV_PTR(env)->NewGlobalRef( - JNI_ENV_ARG(env, getObjectFromField(env, obj)))) == NULL) { + if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) { NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n", classSig); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - "failed to create a new global reference")); + env->FatalError("failed to create a new global reference"); } NSK_DISPLAY0("starting monitor owner thread ...\n"); @@ -377,8 +340,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj if (tries > TRIES) { NSK_COMPLAIN1("TEST FAILURE: the monitor is still not entered by the owner thread after %d attempts\n", TRIES); - JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env, - " the monitor is still not entered by the owner thread")); + env->FatalError(" the monitor is still not entered by the owner thread"); } } while(monEntered != 1); @@ -483,7 +445,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj free(waitThr[i]); } - JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env, clsObj)); + env->DeleteGlobalRef(clsObj); NSK_DISPLAY0("<<<\n\n"); NSK_DISPLAY0(">>> TEST CASE c) Checking number of the intercepted calls ...\n"); @@ -523,6 +485,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_OK; } -#ifdef __cplusplus } -#endif diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp index 5c8bc58c184..cb6ab014961 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp @@ -27,21 +27,8 @@ #include "agent_common.h" #include "JVMTITools.h" -#ifdef __cplusplus extern "C" { -#endif -#ifndef JNI_ENV_ARG - -#ifdef __cplusplus -#define JNI_ENV_ARG(x, y) y -#define JNI_ENV_PTR(x) x -#else -#define JNI_ENV_ARG(x,y) x, y -#define JNI_ENV_PTR(x) (*x) -#endif - -#endif #define STATUS_FAILED 2 #define PASSED 0 @@ -174,8 +161,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_doForceEarlyReturn(JNIEnv *env printf(">>>>>>>> Invoke ForceEarlyReturn()\n"); printf("Before call to GetMethodID(%s, %s)\n", name_exp, sig_exp); - midActiveMethod = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, targCls), - name_exp, sig_exp); + midActiveMethod = env->GetMethodID(targCls, name_exp, sig_exp); if (midActiveMethod == NULL) { printf("Cannot find Method ID for method %s\n", name_exp); RETURN_FAILED; @@ -211,8 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1_1); + res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; @@ -288,6 +273,4 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_check(JNIEnv *env, jclass cls) return errCode; } -#ifdef __cplusplus } -#endif From 009cd15a1bf44a300569df0dc6ac833e95a6736a Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Thu, 13 Sep 2018 13:41:17 -0700 Subject: [PATCH 04/41] 8209167: Use CLDR's time zone mappings for Windows Reviewed-by: erikj, rriggs, ihse --- make/copy/Copy-java.base.gmk | 4 +- make/gensrc/GensrcCLDR.gmk | 22 +- .../tools/cldrconverter/CLDRConverter.java | 50 +++- .../cldrconverter/WinZonesParseHandler.java | 68 ++++++ make/lib/Lib-java.base.gmk | 11 + src/java.base/windows/conf/tzmappings | 226 ------------------ .../windows/native/libjava/TimeZone_md.c | 84 +++---- 7 files changed, 176 insertions(+), 289 deletions(-) create mode 100644 make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java delete mode 100644 src/java.base/windows/conf/tzmappings diff --git a/make/copy/Copy-java.base.gmk b/make/copy/Copy-java.base.gmk index 5c771bddb44..04885e3469b 100644 --- a/make/copy/Copy-java.base.gmk +++ b/make/copy/Copy-java.base.gmk @@ -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 @@ -31,7 +31,7 @@ $(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk)) ################################################################################ -ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),) +ifeq ($(OPENJDK_TARGET_OS), aix) TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf diff --git a/make/gensrc/GensrcCLDR.gmk b/make/gensrc/GensrcCLDR.gmk index 870cabe5501..2f742782637 100644 --- a/make/gensrc/GensrcCLDR.gmk +++ b/make/gensrc/GensrcCLDR.gmk @@ -37,9 +37,17 @@ CLDR_BASE_LOCALES := "en-US" ZONENAME_TEMPLATE := $(TOPDIR)/src/java.base/share/classes/java/time/format/ZoneName.java.template TZDATA_DIR := $(TOPDIR)/make/data/tzdata -$(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \ - $(wildcard $(CLDRSRCDIR)/common/main/en*.xml) \ - $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \ +# tzmappings generation for Windows. +# Since the rule is shared with CLDR_BASEMETAINFO_FILE target, note that +# just removing the target tzmappings will not recreate the tzmappings file. +ifeq ($(OPENJDK_TARGET_OS), windows) + CLDR_WINTZMAPPINGS := $(GENSRC_BASEDIR)/windows/conf/tzmappings + $(CLDR_WINTZMAPPINGS): $(CLDR_BASEMETAINFO_FILE) +endif + +$(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \ + $(wildcard $(CLDRSRCDIR)/main/en*.xml) \ + $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \ $(ZONENAME_TEMPLATE) \ $(BUILD_TOOLS_JDK) $(MKDIR) -p $(GENSRC_BASEDIR) @@ -50,14 +58,14 @@ $(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \ -zntempfile $(ZONENAME_TEMPLATE) \ -tzdatadir $(TZDATA_DIR) -$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \ - $(wildcard $(CLDRSRCDIR)/common/main/*.xml) \ - $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \ +$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \ + $(wildcard $(CLDRSRCDIR)/main/*.xml) \ + $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \ $(BUILD_TOOLS_JDK) $(MKDIR) -p $(GENSRC_DIR) $(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \ -baselocales $(CLDR_BASE_LOCALES) \ -o $(GENSRC_DIR) -GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE) +GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE) $(CLDR_WINTZMAPPINGS) GENSRC_JDK_LOCALEDATA += $(CLDR_METAINFO_FILE) diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java index bc406881d00..0ecb7eb6f59 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -69,6 +69,7 @@ public class CLDRConverter { private static String METAZONES_SOURCE_FILE; private static String LIKELYSUBTAGS_SOURCE_FILE; private static String TIMEZONE_SOURCE_FILE; + private static String WINZONES_SOURCE_FILE; static String DESTINATION_DIR = "build/gensrc"; static final String LOCALE_NAME_PREFIX = "locale.displayname."; @@ -91,6 +92,7 @@ public class CLDRConverter { private static SupplementDataParseHandler handlerSuppl; private static LikelySubtagsParseHandler handlerLikelySubtags; + private static WinZonesParseHandler handlerWinZones; static SupplementalMetadataParseHandler handlerSupplMeta; static NumberingSystemsParseHandler handlerNumbering; static MetaZonesParseHandler handlerMetaZones; @@ -241,6 +243,7 @@ public class CLDRConverter { METAZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/metaZones.xml"; TIMEZONE_SOURCE_FILE = CLDR_BASE + "/bcp47/timezone.xml"; SPPL_META_SOURCE_FILE = CLDR_BASE + "/supplemental/supplementalMetadata.xml"; + WINZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/windowsZones.xml"; if (BASE_LOCALES.isEmpty()) { setupBaseLocales("en-US"); @@ -255,9 +258,12 @@ public class CLDRConverter { List bundles = readBundleList(); convertBundles(bundles); - // Generate java.time.format.ZoneName.java if (isBaseModule) { + // Generate java.time.format.ZoneName.java generateZoneName(); + + // Generate Windows tzmappings + generateWindowsTZMappings(); } } @@ -432,6 +438,10 @@ public class CLDRConverter { // Currently interested in deprecated time zone ids and language aliases. handlerSupplMeta = new SupplementalMetadataParseHandler(); parseLDMLFile(new File(SPPL_META_SOURCE_FILE), handlerSupplMeta); + + // Parse windowsZones + handlerWinZones = new WinZonesParseHandler(); + parseLDMLFile(new File(WINZONES_SOURCE_FILE), handlerWinZones); } // Parsers for data in "bcp47" directory @@ -1088,4 +1098,42 @@ public class CLDRConverter { throw new UncheckedIOException(e); } } + + // Generate tzmappings for Windows. The format is: + // + // (Windows Zone Name):(REGION):(Java TZID) + // + // where: + // Windows Zone Name: arbitrary time zone name string used in Windows + // REGION: ISO3166 or UN M.49 code + // Java TZID: Java's time zone ID + // + // Note: the entries are alphabetically sorted, *except* the "world" region + // code, i.e., "001". It should be the last entry for the same windows time + // zone name entries. (cf. TimeZone_md.c) + private static void generateWindowsTZMappings() throws Exception { + Files.createDirectories(Paths.get(DESTINATION_DIR, "windows", "conf")); + Files.write(Paths.get(DESTINATION_DIR, "windows", "conf", "tzmappings"), + handlerWinZones.keySet().stream() + .map(k -> k + ":" + handlerWinZones.get(k) + ":") + .sorted(new Comparator() { + public int compare(String t1, String t2) { + String[] s1 = t1.split(":"); + String[] s2 = t2.split(":"); + if (s1[0].equals(s2[0])) { + if (s1[1].equals("001")) { + return 1; + } else if (s2[1].equals("001")) { + return -1; + } else { + return s1[1].compareTo(s2[1]); + } + } else { + return s1[0].compareTo(s2[0]); + } + } + }) + .collect(Collectors.toList()), + StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); + } } diff --git a/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java b/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java new file mode 100644 index 00000000000..a584358f0cb --- /dev/null +++ b/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java @@ -0,0 +1,68 @@ +/* + * 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 build.tools.cldrconverter; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Handles parsing of files in Locale Data Markup Language for + * windowsZones.xml + */ + +class WinZonesParseHandler extends AbstractLDMLHandler { + @Override + public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException { + // avoid HTTP traffic to unicode.org + if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) { + return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString()); + } + return null; + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + switch (qName) { + case "mapZone": + String zoneName = attributes.getValue("other"); + String territory = attributes.getValue("territory"); + String javatz = attributes.getValue("type").replaceFirst("\\s.*", ""); + put(zoneName + ":" + territory, javatz); + pushIgnoredContainer(qName); + break; + default: + // treat anything else as a container + pushContainer(qName, attributes); + break; + } + } +} diff --git a/make/lib/Lib-java.base.gmk b/make/lib/Lib-java.base.gmk index 2c5c08d999d..0139771f9bb 100644 --- a/make/lib/Lib-java.base.gmk +++ b/make/lib/Lib-java.base.gmk @@ -195,3 +195,14 @@ ifeq ($(STATIC_BUILD), true) TARGETS += $(JAVA_BASE_EXPORT_SYMBOL_FILE) endif + +################################################################################ +# Copy tzmappings file for Windows + +ifeq ($(OPENJDK_TARGET_OS), windows) + $(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \ + FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \ + DEST := $(call FindLibDirForModule, $(MODULE)), \ + )) + TARGETS += $(COPY_TZMAPPINGS) +endif diff --git a/src/java.base/windows/conf/tzmappings b/src/java.base/windows/conf/tzmappings deleted file mode 100644 index 28917ae0cc9..00000000000 --- a/src/java.base/windows/conf/tzmappings +++ /dev/null @@ -1,226 +0,0 @@ -# -# This file describes mapping information between Windows and Java -# time zones. -# Format: Each line should include a colon separated fields of Windows -# time zone registry key, time zone mapID, locale (which is most -# likely used in the time zone), and Java time zone ID. Blank lines -# and lines that start with '#' are ignored. Data lines must be sorted -# by mapID (ASCII order). -# -# NOTE -# This table format is not a public interface of any Java -# platforms. No applications should depend on this file in any form. -# -# This table has been generated by a program and should not be edited -# manually. -# -Romance:-1,64::Europe/Paris: -Romance Standard Time:-1,64::Europe/Paris: -Warsaw:-1,65::Europe/Warsaw: -Central Europe:-1,66::Europe/Prague: -Central Europe Standard Time:-1,66::Europe/Prague: -Prague Bratislava:-1,66::Europe/Prague: -W. Central Africa Standard Time:-1,66:AO:Africa/Luanda: -FLE:-1,67:FI:Europe/Helsinki: -FLE Standard Time:-1,67:FI:Europe/Helsinki: -GFT:-1,67::Europe/Athens: -GFT Standard Time:-1,67::Europe/Athens: -GTB:-1,67::Europe/Athens: -GTB Standard Time:-1,67::Europe/Athens: -Israel:-1,70::Asia/Jerusalem: -Israel Standard Time:-1,70::Asia/Jerusalem: -Arab:-1,71::Asia/Riyadh: -Arab Standard Time:-1,71::Asia/Riyadh: -Arabic Standard Time:-1,71:IQ:Asia/Baghdad: -E. Africa:-1,71:KE:Africa/Nairobi: -E. Africa Standard Time:-1,71:KE:Africa/Nairobi: -Saudi Arabia:-1,71::Asia/Riyadh: -Saudi Arabia Standard Time:-1,71::Asia/Riyadh: -Iran:-1,72::Asia/Tehran: -Iran Standard Time:-1,72::Asia/Tehran: -Afghanistan:-1,73::Asia/Kabul: -Afghanistan Standard Time:-1,73::Asia/Kabul: -India:-1,74::Asia/Calcutta: -India Standard Time:-1,74::Asia/Calcutta: -Myanmar Standard Time:-1,74::Asia/Rangoon: -Nepal Standard Time:-1,74::Asia/Katmandu: -Sri Lanka:-1,74:LK:Asia/Colombo: -Sri Lanka Standard Time:-1,74:LK:Asia/Colombo: -Beijing:-1,75::Asia/Shanghai: -China:-1,75::Asia/Shanghai: -China Standard Time:-1,75::Asia/Shanghai: -AUS Central:-1,76::Australia/Darwin: -AUS Central Standard Time:-1,76::Australia/Darwin: -Cen. Australia:-1,76::Australia/Adelaide: -Cen. Australia Standard Time:-1,76::Australia/Adelaide: -Vladivostok:-1,77::Asia/Vladivostok: -Vladivostok Standard Time:-1,77::Asia/Vladivostok: -West Pacific:-1,77:GU:Pacific/Guam: -West Pacific Standard Time:-1,77:GU:Pacific/Guam: -E. South America:-1,80::America/Sao_Paulo: -E. South America Standard Time:-1,80::America/Sao_Paulo: -Greenland Standard Time:-1,80:GL:America/Godthab: -Newfoundland:-1,81::America/St_Johns: -Newfoundland Standard Time:-1,81::America/St_Johns: -Pacific SA:-1,82::America/Santiago: -Pacific SA Standard Time:-1,82::America/Santiago: -SA Western:-1,82:BO:America/La_Paz: -SA Western Standard Time:-1,82:BO:America/La_Paz: -SA Pacific:-1,83::America/Bogota: -SA Pacific Standard Time:-1,83::America/Bogota: -US Eastern:-1,84::America/Indianapolis: -US Eastern Standard Time:-1,84::America/Indianapolis: -Central America Standard Time:-1,85::America/Regina: -Mexico:-1,85::America/Mexico_City: -Mexico Standard Time:-1,85::America/Mexico_City: -Canada Central:-1,86::America/Regina: -Canada Central Standard Time:-1,86::America/Regina: -US Mountain:-1,87::America/Phoenix: -US Mountain Standard Time:-1,87::America/Phoenix: -GMT:0,1::Europe/London: -GMT Standard Time:0,1::Europe/London: -Ekaterinburg:10,11::Asia/Yekaterinburg: -Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg: -West Asia:10,11:UZ:Asia/Tashkent: -West Asia Standard Time:10,11:UZ:Asia/Tashkent: -Central Asia:12,13::Asia/Almaty: -Central Asia Standard Time:12,13::Asia/Almaty: -N. Central Asia Standard Time:12,13::Asia/Novosibirsk: -Bangkok:14,15::Asia/Bangkok: -Bangkok Standard Time:14,15::Asia/Bangkok: -North Asia Standard Time:14,15::Asia/Krasnoyarsk: -SE Asia:14,15::Asia/Bangkok: -SE Asia Standard Time:14,15::Asia/Bangkok: -North Asia East Standard Time:16,17:RU:Asia/Irkutsk: -Singapore:16,17:SG:Asia/Singapore: -Singapore Standard Time:16,17:SG:Asia/Singapore: -Taipei:16,17::Asia/Taipei: -Taipei Standard Time:16,17::Asia/Taipei: -W. Australia:16,17:AU:Australia/Perth: -W. Australia Standard Time:16,17:AU:Australia/Perth: -Korea:18,19:KR:Asia/Seoul: -Korea Standard Time:18,19:KR:Asia/Seoul: -Tokyo:18,19::Asia/Tokyo: -Tokyo Standard Time:18,19::Asia/Tokyo: -Yakutsk:18,19:RU:Asia/Yakutsk: -Yakutsk Standard Time:18,19:RU:Asia/Yakutsk: -Central European:2,3:CS:Europe/Belgrade: -Central European Standard Time:2,3:CS:Europe/Belgrade: -W. Europe:2,3::Europe/Berlin: -W. Europe Standard Time:2,3::Europe/Berlin: -Tasmania:20,-1::Australia/Hobart: -Tasmania Standard Time:20,-1::Australia/Hobart: -AUS Eastern:20,21::Australia/Sydney: -AUS Eastern Standard Time:20,21::Australia/Sydney: -E. Australia:20,21::Australia/Brisbane: -E. Australia Standard Time:20,21::Australia/Brisbane: -Sydney Standard Time:20,21::Australia/Sydney: -Tasmania Standard Time:20,65::Australia/Hobart: -Central Pacific:22,23::Pacific/Guadalcanal: -Central Pacific Standard Time:22,23::Pacific/Guadalcanal: -Dateline:24,25::GMT-1200: -Dateline Standard Time:24,25::GMT-1200: -Fiji:24,25::Pacific/Fiji: -Fiji Standard Time:24,25::Pacific/Fiji: -Samoa:26,27::Pacific/Apia: -Samoa Standard Time:26,27::Pacific/Apia: -Hawaiian:28,29::Pacific/Honolulu: -Hawaiian Standard Time:28,29::Pacific/Honolulu: -Alaskan:30,31::America/Anchorage: -Alaskan Standard Time:30,31::America/Anchorage: -Pacific:32,33::America/Los_Angeles: -Pacific Standard Time:32,33::America/Los_Angeles: -Mexico Standard Time 2:34,35:MX:America/Chihuahua: -Mountain:34,35::America/Denver: -Mountain Standard Time:34,35::America/Denver: -Central:36,37::America/Chicago: -Central Standard Time:36,37::America/Chicago: -Eastern:38,39::America/New_York: -Eastern Standard Time:38,39::America/New_York: -E. Europe:4,5::EET: -E. Europe Standard Time:4,5::EET: -Egypt:4,68::Africa/Cairo: -Egypt Standard Time:4,68::Africa/Cairo: -South Africa:4,69::Africa/Harare: -South Africa Standard Time:4,69::Africa/Harare: -Atlantic:40,41::America/Halifax: -Atlantic Standard Time:40,41::America/Halifax: -SA Eastern:42,43:GF:America/Cayenne: -SA Eastern Standard Time:42,43:GF:America/Cayenne: -Mid-Atlantic:44,45::Atlantic/South_Georgia: -Mid-Atlantic Standard Time:44,45::Atlantic/South_Georgia: -Azores:46,47::Atlantic/Azores: -Azores Standard Time:46,47::Atlantic/Azores: -Cape Verde Standard Time:46,47::Atlantic/Cape_Verde: -Russian:6,7::Europe/Moscow: -Russian Standard Time:6,7::Europe/Moscow: -New Zealand:78,79::Pacific/Auckland: -New Zealand Standard Time:78,79::Pacific/Auckland: -Tonga Standard Time:78,79::Pacific/Tongatapu: -Arabian:8,9::Asia/Muscat: -Arabian Standard Time:8,9::Asia/Muscat: -Caucasus:8,9:AM:Asia/Yerevan: -Caucasus Standard Time:8,9:AM:Asia/Yerevan: -GMT Standard Time:88,89::GMT: -Greenwich:88,89::GMT: -Greenwich Standard Time:88,89::GMT: -Aleutian Standard Time:900,900:US:America/Adak: -Altai Standard Time:901,901::Asia/Barnaul: -Argentina Standard Time:902,902::America/Buenos_Aires: -Armenian Standard Time:903,903:AM:Asia/Yerevan: -Astrakhan Standard Time:904,904::Europe/Astrakhan: -Aus Central W. Standard Time:905,905::Australia/Eucla: -Azerbaijan Standard Time:906,906:AZ:Asia/Baku: -Bahia Standard Time:907,907::America/Bahia: -Bangladesh Standard Time:908,908::Asia/Dhaka: -Belarus Standard Time:909,909:BY:Europe/Minsk: -Bougainville Standard Time:910,910::Pacific/Bougainville: -Central Brazilian Standard Time:911,911:BR:America/Cuiaba: -Central Standard Time (Mexico):912,912::America/Mexico_City: -Chatham Islands Standard Time:913,913::Pacific/Chatham: -Cuba Standard Time:914,914:CU:America/Havana: -Easter Island Standard Time:915,915:CL:Pacific/Easter: -Eastern Standard Time (Mexico):916,916::America/Cancun: -Georgian Standard Time:917,917:GE:Asia/Tbilisi: -Haiti Standard Time:918,918:HT:America/Port-au-Prince: -Jordan Standard Time:919,919:JO:Asia/Amman: -Kaliningrad Standard Time:920,920:RU:Europe/Kaliningrad: -Kamchatka Standard Time:921,921:RU:Asia/Kamchatka: -Libya Standard Time:922,922:LY:Africa/Tripoli: -Line Islands Standard Time:923,923::Pacific/Kiritimati: -Lord Howe Standard Time:924,924::Australia/Lord_Howe: -Magadan Standard Time:925,925::Asia/Magadan: -Marquesas Standard Time:926,926::Pacific/Marquesas: -Mauritius Standard Time:927,927:MU:Indian/Mauritius: -Middle East Standard Time:928,928:LB:Asia/Beirut: -Montevideo Standard Time:929,929:UY:America/Montevideo: -Morocco Standard Time:930,930:MA:Africa/Casablanca: -Mountain Standard Time (Mexico):931,931:MX:America/Chihuahua: -Namibia Standard Time:932,932:NA:Africa/Windhoek: -Norfolk Standard Time:933,933::Pacific/Norfolk: -North Korea Standard Time:934,934:KP:Asia/Pyongyang: -Pacific Standard Time (Mexico):935,935:MX:America/Tijuana: -Pakistan Standard Time:936,936::Asia/Karachi: -Paraguay Standard Time:937,937:PY:America/Asuncion: -Russia Time Zone 10:938,938::Asia/Srednekolymsk: -Russia Time Zone 11:939,939::Asia/Anadyr: -Russia Time Zone 3:940,940::Europe/Samara: -Saint Pierre Standard Time:941,941:PM:America/Miquelon: -Sakhalin Standard Time:942,942::Asia/Sakhalin: -Syria Standard Time:943,943:SY:Asia/Damascus: -Tocantins Standard Time:944,944::America/Araguaina: -Tomsk Standard Time:945,945::Asia/Tomsk: -Transbaikal Standard Time:946,946::Asia/Chita: -Turkey Standard Time:947,947::Asia/Istanbul: -Turks And Caicos Standard Time:948,948:TC:America/Grand_Turk: -UTC+12:949,949::GMT+1200: -UTC-02:950,950::GMT-0200: -UTC-08:951,951::GMT-0800: -UTC-09:952,952::GMT-0900: -UTC-11:953,953::GMT-1100: -UTC:954,954::UTC: -Ulaanbaatar Standard Time:955,955::Asia/Ulaanbaatar: -Venezuela Standard Time:956,956::America/Caracas: -W. Mongolia Standard Time:957,957::Asia/Hovd: -West Bank Standard Time:958,958::Asia/Gaza: -Western Brazilian Standard Time:959,959:BR:America/Rio_Branco: diff --git a/src/java.base/windows/native/libjava/TimeZone_md.c b/src/java.base/windows/native/libjava/TimeZone_md.c index d46b3c3b57d..061600c87a3 100644 --- a/src/java.base/windows/native/libjava/TimeZone_md.c +++ b/src/java.base/windows/native/libjava/TimeZone_md.c @@ -36,6 +36,7 @@ #define MAX_ZONE_CHAR 256 #define MAX_MAPID_LENGTH 32 +#define MAX_REGION_LENGTH 4 #define NT_TZ_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones" #define WIN_TZ_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones" @@ -145,7 +146,7 @@ static void customZoneName(LONG bias, char *buffer) { /* * Gets the current time zone entry in the "Time Zones" registry. */ -static int getWinTimeZone(char *winZoneName, char *winMapID) +static int getWinTimeZone(char *winZoneName) { DYNAMIC_TIME_ZONE_INFORMATION dtzi; DWORD timeType; @@ -231,7 +232,6 @@ static int getWinTimeZone(char *winZoneName, char *winMapID) WCHAR stdNameInReg[MAX_ZONE_CHAR]; TziValue tempTzi; WCHAR *stdNamePtr = tzi.StandardName; - DWORD valueSize; int onlyMapID; timeType = GetTimeZoneInformation(&tzi); @@ -372,24 +372,7 @@ static int getWinTimeZone(char *winZoneName, char *winMapID) (void) RegCloseKey(hSubKey); } - /* - * Get the "MapID" value of the registry to be able to eliminate - * duplicated key names later. - */ - valueSize = MAX_MAPID_LENGTH; - ret = RegQueryValueExA(hSubKey, "MapID", NULL, &valueType, winMapID, &valueSize); - (void) RegCloseKey(hSubKey); (void) RegCloseKey(hKey); - - if (ret != ERROR_SUCCESS) { - /* - * Vista doesn't have mapID. VALUE_UNKNOWN should be returned - * only for Windows NT. - */ - if (onlyMapID == 1) { - return VALUE_UNKNOWN; - } - } } return VALUE_KEY; @@ -410,24 +393,17 @@ static int getWinTimeZone(char *winZoneName, char *winMapID) * Index values for the mapping table. */ #define TZ_WIN_NAME 0 -#define TZ_MAPID 1 -#define TZ_REGION 2 -#define TZ_JAVA_NAME 3 +#define TZ_REGION 1 +#define TZ_JAVA_NAME 2 -#define TZ_NITEMS 4 /* number of items (fields) */ +#define TZ_NITEMS 3 /* number of items (fields) */ /* * Looks up the mapping table (tzmappings) and returns a Java time * zone ID (e.g., "America/Los_Angeles") if found. Otherwise, NULL is * returned. - * - * value_type is one of the following values: - * VALUE_KEY for exact key matching - * VALUE_MAPID for MapID (this is - * required for the old Windows, such as NT 4.0 SP3). */ -static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName, - char *mapID) +static char *matchJavaTZ(const char *java_home_dir, char *tzName) { int line; int IDmatched = 0; @@ -436,9 +412,22 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName char *items[TZ_NITEMS]; char *mapFileName; char lineBuffer[MAX_ZONE_CHAR * 4]; - int noMapID = *mapID == '\0'; /* no mapID on Vista and later */ int offset = 0; const char* errorMessage = "unknown error"; + char region[MAX_REGION_LENGTH]; + + // Get the user's location + if (GetGeoInfo(GetUserGeoID(GEOCLASS_NATION), + GEO_ISO2, region, MAX_REGION_LENGTH, 0) == 0) { + // If GetGeoInfo fails, fallback to LCID's country + LCID lcid = GetUserDefaultLCID(); + if (GetLocaleInfo(lcid, + LOCALE_SISO3166CTRYNAME, region, MAX_REGION_LENGTH) == 0 && + GetLocaleInfo(lcid, + LOCALE_SISO3166CTRYNAME2, region, MAX_REGION_LENGTH) == 0) { + region[0] = '\0'; + } + } mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1); if (mapFileName == NULL) { @@ -494,28 +483,20 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName goto illegal_format; } - if (noMapID || strcmp(mapID, items[TZ_MAPID]) == 0) { + /* + * We need to scan items until the + * exact match is found or the end of data is detected. + */ + if (strcmp(items[TZ_WIN_NAME], tzName) == 0) { /* - * When there's no mapID, we need to scan items until the - * exact match is found or the end of data is detected. + * Found the time zone in the mapping table. + * Check the region code and select the appropriate entry */ - if (!noMapID) { - IDmatched = 1; - } - if (strcmp(items[TZ_WIN_NAME], tzName) == 0) { - /* - * Found the time zone in the mapping table. - */ + if (strcmp(items[TZ_REGION], region) == 0 || + strcmp(items[TZ_REGION], "001") == 0) { javaTZName = _strdup(items[TZ_JAVA_NAME]); break; } - } else { - if (IDmatched == 1) { - /* - * No need to look up the mapping table further. - */ - break; - } } } fclose(fp); @@ -535,19 +516,16 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName char *findJavaTZ_md(const char *java_home_dir) { char winZoneName[MAX_ZONE_CHAR]; - char winMapID[MAX_MAPID_LENGTH]; char *std_timezone = NULL; int result; - winMapID[0] = 0; - result = getWinTimeZone(winZoneName, winMapID); + result = getWinTimeZone(winZoneName); if (result != VALUE_UNKNOWN) { if (result == VALUE_GMTOFFSET) { std_timezone = _strdup(winZoneName); } else { - std_timezone = matchJavaTZ(java_home_dir, result, - winZoneName, winMapID); + std_timezone = matchJavaTZ(java_home_dir, winZoneName); if (std_timezone == NULL) { std_timezone = getGMTOffsetID(); } From 7f806d6abd9d5484ed52e703c33818f85458c490 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 13 Sep 2018 15:27:21 -0700 Subject: [PATCH 05/41] 8210220: [AOT] jdwp test cases are failing with error # ERROR: TEST FAILED: Cought IOException while receiving event packet Don't register AOT method if corresponding java method has breakpoints. Reviewed-by: dlong --- src/hotspot/share/aot/aotCodeHeap.cpp | 24 +++++++++++---------- src/hotspot/share/aot/aotCodeHeap.hpp | 4 +--- src/hotspot/share/aot/aotCompiledMethod.cpp | 10 --------- src/hotspot/share/aot/aotCompiledMethod.hpp | 5 ----- src/hotspot/share/aot/aotLoader.cpp | 9 -------- src/hotspot/share/aot/aotLoader.hpp | 7 +----- 6 files changed, 15 insertions(+), 44 deletions(-) diff --git a/src/hotspot/share/aot/aotCodeHeap.cpp b/src/hotspot/share/aot/aotCodeHeap.cpp index c7d24bcae65..7108839e905 100644 --- a/src/hotspot/share/aot/aotCodeHeap.cpp +++ b/src/hotspot/share/aot/aotCodeHeap.cpp @@ -38,6 +38,7 @@ #include "oops/method.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vm_operations.hpp" @@ -298,15 +299,25 @@ AOTCodeHeap::AOTCodeHeap(AOTLib* lib) : void AOTCodeHeap::publish_aot(const methodHandle& mh, AOTMethodData* method_data, int code_id) { // The method may be explicitly excluded by the user. // Or Interpreter uses an intrinsic for this method. - if (CompilerOracle::should_exclude(mh) || !AbstractInterpreter::can_be_compiled(mh)) { + // Or method has breakpoints. + if (CompilerOracle::should_exclude(mh) || + !AbstractInterpreter::can_be_compiled(mh) || + (mh->number_of_breakpoints() > 0)) { return; } + // Make sure no break points were set in the method in case of a safepoint + // in the following code until aot code is registered. + NoSafepointVerifier nsv; address code = method_data->_code; const char* name = method_data->_name; aot_metadata* meta = method_data->_meta; if (meta->scopes_pcs_begin() == meta->scopes_pcs_end()) { + // Switch off NoSafepointVerifier because log_info() may cause safepoint + // and it is fine because aot code will not be registered here. + PauseNoSafepointVerifier pnsv(&nsv); + // When the AOT compiler compiles something big we fail to generate metadata // in CodeInstaller::gather_metadata. In that case the scopes_pcs_begin == scopes_pcs_end. // In all successful cases we always have 2 entries of scope pcs. @@ -343,6 +354,7 @@ void AOTCodeHeap::publish_aot(const methodHandle& mh, AOTMethodData* method_data #endif Method::set_code(mh, aot); if (PrintAOT || (PrintCompilation && PrintAOT)) { + PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already aot->print_on(tty, NULL); } // Publish oop only after we are visible to CompiledMethodIterator @@ -918,16 +930,6 @@ int AOTCodeHeap::verify_icholder_relocations() { } #endif -void AOTCodeHeap::flush_evol_dependents_on(InstanceKlass* dependee) { - for (int index = 0; index < _method_count; index++) { - if (_code_to_aot[index]._state != in_use) { - continue; // Skip uninitialized entries. - } - AOTCompiledMethod* aot = _code_to_aot[index]._aot; - aot->flush_evol_dependents_on(dependee); - } -} - void AOTCodeHeap::metadata_do(void f(Metadata*)) { for (int index = 0; index < _method_count; index++) { if (_code_to_aot[index]._state != in_use) { diff --git a/src/hotspot/share/aot/aotCodeHeap.hpp b/src/hotspot/share/aot/aotCodeHeap.hpp index 3d2afe93ce8..694adfea8cb 100644 --- a/src/hotspot/share/aot/aotCodeHeap.hpp +++ b/src/hotspot/share/aot/aotCodeHeap.hpp @@ -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 @@ -283,8 +283,6 @@ public: DEBUG_ONLY( int verify_icholder_relocations(); ) - void flush_evol_dependents_on(InstanceKlass* dependee); - void alive_methods_do(void f(CompiledMethod* nm)); #ifndef PRODUCT diff --git a/src/hotspot/share/aot/aotCompiledMethod.cpp b/src/hotspot/share/aot/aotCompiledMethod.cpp index 8c3ae8bdd59..528ffd9bf27 100644 --- a/src/hotspot/share/aot/aotCompiledMethod.cpp +++ b/src/hotspot/share/aot/aotCompiledMethod.cpp @@ -243,16 +243,6 @@ bool AOTCompiledMethod::make_entrant() { } #endif // TIERED -// We don't have full dependencies for AOT methods, so flushing is -// more conservative than for nmethods. -void AOTCompiledMethod::flush_evol_dependents_on(InstanceKlass* dependee) { - if (is_java_method()) { - clear_inline_caches(); - mark_for_deoptimization(); - make_not_entrant(); - } -} - // Iterate over metadata calling this function. Used by RedefineClasses // Copied from nmethod::metadata_do void AOTCompiledMethod::metadata_do(void f(Metadata*)) { diff --git a/src/hotspot/share/aot/aotCompiledMethod.hpp b/src/hotspot/share/aot/aotCompiledMethod.hpp index a0219606681..47049afe2a6 100644 --- a/src/hotspot/share/aot/aotCompiledMethod.hpp +++ b/src/hotspot/share/aot/aotCompiledMethod.hpp @@ -238,11 +238,6 @@ private: address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } -#ifdef HOTSWAP - // Flushing and deoptimization in case of evolution - void flush_evol_dependents_on(InstanceKlass* dependee); -#endif // HOTSWAP - virtual void metadata_do(void f(Metadata*)); bool metadata_got_contains(Metadata **p) { diff --git a/src/hotspot/share/aot/aotLoader.cpp b/src/hotspot/share/aot/aotLoader.cpp index b3cad5859fb..8bfe282b851 100644 --- a/src/hotspot/share/aot/aotLoader.cpp +++ b/src/hotspot/share/aot/aotLoader.cpp @@ -101,15 +101,6 @@ void AOTLoader::metadata_do(void f(Metadata*)) { } } -// Flushing and deoptimization in case of evolution -void AOTLoader::flush_evol_dependents_on(InstanceKlass* dependee) { - // make non entrant and mark for deoptimization - FOR_ALL_AOT_HEAPS(heap) { - (*heap)->flush_evol_dependents_on(dependee); - } - Deoptimization::deoptimize_dependents(); -} - /** * List of core modules for which we search for shared libraries. */ diff --git a/src/hotspot/share/aot/aotLoader.hpp b/src/hotspot/share/aot/aotLoader.hpp index 8a162e57e37..ea55919bc84 100644 --- a/src/hotspot/share/aot/aotLoader.hpp +++ b/src/hotspot/share/aot/aotLoader.hpp @@ -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 @@ -68,11 +68,6 @@ public: NOT_PRODUCT( static void print_statistics() NOT_AOT_RETURN; ) -#ifdef HOTSWAP - // Flushing and deoptimization in case of evolution - static void flush_evol_dependents_on(InstanceKlass* dependee) NOT_AOT_RETURN; -#endif // HOTSWAP - static bool reconcile_dynamic_invoke(InstanceKlass* holder, int index, Method* adapter_method, Klass *appendix_klass) NOT_AOT({ return true; }); }; From f2b9a3e5b96a9f28ce69da05e58c03310794a7f7 Mon Sep 17 00:00:00 2001 From: Gary Adams Date: Thu, 13 Sep 2018 07:54:38 -0400 Subject: [PATCH 06/41] 8210252: com/sun/jdi/DebuggerThreadTest.java fails with NPE Reviewed-by: cjplummer, sspitsyn --- test/jdk/com/sun/jdi/DebuggerThreadTest.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/jdk/com/sun/jdi/DebuggerThreadTest.java b/test/jdk/com/sun/jdi/DebuggerThreadTest.java index 496f023539a..45cfb3c15b0 100644 --- a/test/jdk/com/sun/jdi/DebuggerThreadTest.java +++ b/test/jdk/com/sun/jdi/DebuggerThreadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, 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 @@ -66,6 +66,7 @@ public class DebuggerThreadTest extends TestScaffold { * Move to top ThreadGroup and dump all threads. */ public void dumpThreads() { + int finishedThreads = 0; ThreadGroup tg = Thread.currentThread().getThreadGroup(); ThreadGroup parent = tg.getParent(); while (parent != null) { @@ -77,7 +78,14 @@ public class DebuggerThreadTest extends TestScaffold { int gotThreads = tg.enumerate(list, true); for (int i = 0; i < Math.min(gotThreads, list.length); i++){ Thread t = list[i]; - String groupName = t.getThreadGroup().getName(); + ThreadGroup tga = t.getThreadGroup(); + String groupName; + if (tga == null) { + groupName = ""; + finishedThreads++ ; + } else { + groupName = tga.getName(); + } System.out.println("Thread [" + i + "] group = '" + groupName + @@ -89,7 +97,10 @@ public class DebuggerThreadTest extends TestScaffold { failure("FAIL: non-daemon thread '" + t.getName() + "' found in ThreadGroup '" + groupName + "'"); } - + } + if (finishedThreads > 0 ) { + failure("FAIL: " + finishedThreads + + " threads completed while VM suspended."); } } From 5de8b5c59a0eb1eee4d525f3b3a172a4e0267dd6 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 13 Sep 2018 17:11:04 -0700 Subject: [PATCH 07/41] 8209916: NPE in SupportedGroupsExtension Reviewed-by: jnimeh, wetmore --- .../sun/security/ssl/SupportedGroupsExtension.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java index cb52a700eb4..ad17f1a4e90 100644 --- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java @@ -27,7 +27,6 @@ package sun.security.ssl; import java.io.IOException; import java.nio.ByteBuffer; -import java.security.AccessController; import java.security.AlgorithmConstraints; import java.security.AlgorithmParameters; import java.security.CryptoPrimitive; @@ -672,6 +671,11 @@ final class SupportedGroupsExtension { } AlgorithmParameters params = namedGroupParams.get(namedGroup); + if (params == null) { + throw new RuntimeException( + "Not a supported EC named group: " + namedGroup); + } + try { return params.getParameterSpec(ECGenParameterSpec.class); } catch (InvalidParameterSpecException ipse) { @@ -687,6 +691,11 @@ final class SupportedGroupsExtension { } AlgorithmParameters params = namedGroupParams.get(namedGroup); + if (params == null) { + throw new RuntimeException( + "Not a supported DH named group: " + namedGroup); + } + try { return params.getParameterSpec(DHParameterSpec.class); } catch (InvalidParameterSpecException ipse) { @@ -739,7 +748,7 @@ final class SupportedGroupsExtension { namedGroupParams.get(namedGroup)); } - // Is there any supported group permitted by the constraints? + // Is the named group supported? static boolean isSupported(NamedGroup namedGroup) { for (NamedGroup group : supportedNamedGroups) { if (namedGroup.id == group.id) { @@ -757,6 +766,7 @@ final class SupportedGroupsExtension { for (NamedGroup namedGroup : requestedNamedGroups) { if ((namedGroup.type == type) && namedGroup.isAvailable(negotiatedProtocol) && + isSupported(namedGroup) && constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, From 8b3c1810d2ca8e6b7d9483f7e857f623e58ab6e3 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Thu, 13 Sep 2018 15:29:44 -0700 Subject: [PATCH 08/41] 8193037: package-info annotations are not reported when annotation processing is enabled Reviewed-by: jjg --- .../JavacProcessingEnvironment.java | 5 +- .../ClassAnnotations/ClassAnnotations.java | 33 +++++++++ .../ClassAnnotations/Processor.java | 39 +++++++++++ .../ClassAnnotations/package-info.java | 21 ++++++ .../PackageInfo/Overwrite/Overwrite.java | 32 +++++++++ .../PackageInfo/Overwrite/Processor.java | 68 +++++++++++++++++++ .../PackageInfo/Overwrite/package-info.java | 21 ++++++ 7 files changed, 216 insertions(+), 3 deletions(-) create mode 100644 test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/ClassAnnotations.java create mode 100644 test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/Processor.java create mode 100644 test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/package-info.java create mode 100644 test/langtools/tools/javac/processing/PackageInfo/Overwrite/Overwrite.java create mode 100644 test/langtools/tools/javac/processing/PackageInfo/Overwrite/Processor.java create mode 100644 test/langtools/tools/javac/processing/PackageInfo/Overwrite/package-info.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index adfd7d1ddf7..cf500cb5043 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -1536,13 +1536,12 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea JCCompilationUnit topLevel; public void visitTopLevel(JCCompilationUnit node) { if (node.packge != null) { - if (node.packge.package_info != null) { + if (isPkgInfo(node.sourcefile, Kind.SOURCE)) { node.packge.package_info.reset(); } node.packge.reset(); } - boolean isModuleInfo = node.sourcefile.isNameCompatible("module-info", Kind.SOURCE); - if (isModuleInfo) { + if (isModuleInfo(node.sourcefile, Kind.SOURCE)) { node.modle.reset(); node.modle.completer = sym -> modules.enter(List.of(node), node.modle.module_info); node.modle.module_info.reset(); diff --git a/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/ClassAnnotations.java b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/ClassAnnotations.java new file mode 100644 index 00000000000..b97e5773564 --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/ClassAnnotations.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +/** + * @test + * @bug 8193037 + * @summary ensure annotations on package-infos loaded from the classpath are reported on all + * processing rounds + * @library /tools/javac/lib + * @modules java.compiler jdk.compiler + * @build Processor + * @compile package-info.java + * @compile -processor Processor ClassAnnotations.java + */ +package p; + +public class ClassAnnotations {} diff --git a/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/Processor.java b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/Processor.java new file mode 100644 index 00000000000..b6bba171e3d --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/Processor.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +import java.util.Set; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; + +@SupportedAnnotationTypes("*") +public class Processor extends JavacTestingAbstractProcessor { + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + PackageElement p = processingEnv.getElementUtils().getPackageElement("p"); + // Ensure that the annotations on the package-info for p are present during all annotation + // processing rounds. + if (p.getAnnotationMirrors().isEmpty()) { + throw new AssertionError("expected package annotations"); + } + return false; + } +} diff --git a/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/package-info.java b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/package-info.java new file mode 100644 index 00000000000..973f0eef70a --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +@Deprecated +package p; diff --git a/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Overwrite.java b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Overwrite.java new file mode 100644 index 00000000000..1150b95dcf3 --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Overwrite.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +/** + * @test + * @bug 8193037 + * @summary ensure package-infos are reset between annotation processing rounds + * @library /tools/javac/lib + * @modules java.compiler jdk.compiler + * @build Processor + * @compile package-info.java + * @compile -processor Processor Overwrite.java + */ +package p; + +public class Overwrite {} diff --git a/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Processor.java b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Processor.java new file mode 100644 index 00000000000..6c1e75b518b --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Processor.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOError; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Set; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; + +@SupportedAnnotationTypes("*") +public class Processor extends JavacTestingAbstractProcessor { + + boolean first = true; + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (first) { + // Annotations are present on the initial package-info loaded from the classpath. + PackageElement p = processingEnv.getElementUtils().getPackageElement("p"); + if (p.getAnnotationMirrors().isEmpty()) { + throw new AssertionError( + "expected package annotations: " + p.getAnnotationMirrors()); + } + // Overwrite the package-info with a new unannotated package-info. + try (OutputStream os = + processingEnv + .getFiler() + .createSourceFile("p.package-info") + .openOutputStream()) { + os.write("package p;".getBytes(UTF_8)); + } catch (IOException e) { + throw new IOError(e); + } + first = false; + } + // The package-info's symbol should be reset between rounds, and when annotation + // processing is over the package-info should be unannotated. + PackageElement p = processingEnv.getElementUtils().getPackageElement("p"); + if (roundEnv.processingOver()) { + if (!p.getAnnotationMirrors().isEmpty()) { + throw new AssertionError( + "expected no package annotations: " + p.getAnnotationMirrors()); + } + } + return false; + } +} diff --git a/test/langtools/tools/javac/processing/PackageInfo/Overwrite/package-info.java b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/package-info.java new file mode 100644 index 00000000000..973f0eef70a --- /dev/null +++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018, Google 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. + */ + +@Deprecated +package p; From 07392d976ad5e00763fb28b614aa7631d232544a Mon Sep 17 00:00:00 2001 From: Amy Lu Date: Fri, 14 Sep 2018 13:18:52 +0800 Subject: [PATCH 09/41] 8209772: Refactor shell test java/util/ServiceLoader/basic/basic.sh to java Reviewed-by: alanb --- .../basic/ServiceLoaderBasicTest.java | 162 ++++++++++++++++++ .../java/util/ServiceLoader/basic/basic.sh | 156 ----------------- 2 files changed, 162 insertions(+), 156 deletions(-) create mode 100644 test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java delete mode 100644 test/jdk/java/util/ServiceLoader/basic/basic.sh diff --git a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java new file mode 100644 index 00000000000..6f54cd8ba76 --- /dev/null +++ b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java @@ -0,0 +1,162 @@ +/* + * 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 4640520 6354623 7198496 + * @summary Unit test for java.util.ServiceLoader + * @library /lib/testlibrary /test/lib + * @build JarUtils jdk.test.lib.process.* + * Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider + * @run testng ServiceLoaderBasicTest + */ + + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static java.nio.file.StandardOpenOption.CREATE; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static java.util.Arrays.asList; + +public class ServiceLoaderBasicTest { + + private static final String METAINFO = "META-INF/services/FooService"; + private static final Path XTEST_CONFIG = Path.of("x.test").resolve(METAINFO); + private static final Path XMETA_CONFIG = Path.of("x.meta").resolve(METAINFO); + private static final Path P2JAR = Path.of("p2.jar"); + private static final Path P2DUPJAR = Path.of("p2dup.jar"); + private static final Path P3JAR = Path.of("x.ext", "p3.jar"); + + private static final String XTEST = File.pathSeparator + "x.test"; + private static final String XMETA = File.pathSeparator + "x.meta"; + private static final String P2 = File.pathSeparator + P2JAR.toString(); + private static final String P2DUP = File.pathSeparator + P2DUPJAR.toString(); + private static final String P3 = File.pathSeparator + P3JAR.toString(); + + private static final String XTEST_CP = Utils.TEST_CLASS_PATH + XTEST; + private static final String P2_CP = Utils.TEST_CLASS_PATH + P2; + private static final String P2DUP_CP = P2_CP + P2DUP; + private static final String P3P2_CP = Utils.TEST_CLASS_PATH + P3 + P2; + private static final String XTESTP2_CP = XTEST_CP + P2; + private static final String P3XTEST_CP = Utils.TEST_CLASS_PATH + P3 + XTEST; + private static final String P3XTESTP2_CP = P3XTEST_CP + P2; + private static final String XMETA_CP = Utils.TEST_CLASS_PATH + XMETA; + private static final String XMETAXTEST_CP = XMETA_CP + XTEST; + private static final String XTESTXMETA_CP = XTEST_CP + XMETA; + private static final String XTESTXMETAP2_CP = XTESTXMETA_CP + P2; + + @BeforeClass + public void initialize() throws Exception { + createProviderConfig(XTEST_CONFIG, "FooProvider1"); + createProviderConfig(XMETA_CONFIG, "FooProvider42"); + createJar(P2JAR, "FooProvider2", List.of("FooProvider2")); + createJar(P3JAR, "FooProvider3", List.of("FooProvider3", "FooService")); + Files.copy(P2JAR, P2DUPJAR, REPLACE_EXISTING); + } + + @DataProvider + public Object[][] testCases() { + return new Object[][]{ + // CLI options, Test, Runtime arguments + // Success cases + {List.of("-cp", XTESTP2_CP, "Basic")}, + {List.of("-cp", XTEST_CP, "Load", "FooProvider1")}, + {List.of("-cp", P2_CP, "Load", "FooProvider2")}, + {List.of("-cp", P2DUP_CP, "Load", "FooProvider2")}, + {List.of("-cp", P3P2_CP, "Load", "FooProvider3", "FooProvider2")}, + {List.of("-cp", XTESTP2_CP, "Load", "FooProvider1", "FooProvider2")}, + {List.of("-cp", P3XTEST_CP, "Load", "FooProvider3", "FooProvider1")}, + {List.of("-cp", P3XTESTP2_CP, "Load", "FooProvider3", + "FooProvider1", + "FooProvider2")}, + // Failures followed by successes + {List.of("-cp", XTESTXMETA_CP, "Load", "FooProvider1", "fail")}, + {List.of("-cp", XMETAXTEST_CP, "Load", "fail", "FooProvider1")}, + {List.of("-cp", XTESTXMETAP2_CP, "Load", "FooProvider1", "fail", "FooProvider2")} + }; + } + + @DataProvider + public Object[][] negativeTestCases() { + return new Object[][]{ + {"blah blah"}, + {"9234"}, + {"X!"}, + {"BarProvider"}, + {"FooProvider42"} + }; + } + + @Test(dataProvider = "testCases") + public void testProvider(List args) throws Throwable { + runJava(args); + } + + @Test(dataProvider = "negativeTestCases") + public void testBadProvider(String providerName) throws Throwable { + Files.write(XMETA_CONFIG, providerName.getBytes()); + runJava(List.of("-cp", XMETA_CP, "Load", "fail")); + } + + private void runJava(List opts) throws Throwable { + List cmds = new ArrayList<>(); + cmds.add(JDKToolFinder.getJDKTool("java")); + cmds.addAll(asList(Utils.getTestJavaOpts())); + cmds.addAll(opts); + + ProcessTools.executeCommand(cmds.stream() + .filter(t -> !t.isEmpty()) + .toArray(String[]::new)) + .shouldHaveExitValue(0); + } + + private void createProviderConfig(Path config, String providerName) throws Exception { + Files.createDirectories(config.getParent()); + Files.write(config, providerName.getBytes(), CREATE); + } + + private void createJar(Path jar, String provider, List files) throws Exception { + Path xdir = Path.of(provider); + createProviderConfig(xdir.resolve(METAINFO), provider); + + for (String f : files) { + Path source = Path.of(Utils.TEST_CLASSES, f + ".class"); + Path target = xdir.resolve(source.getFileName()); + Files.copy(source, target, REPLACE_EXISTING); + } + JarUtils.createJarFile(jar, xdir); + } + +} diff --git a/test/jdk/java/util/ServiceLoader/basic/basic.sh b/test/jdk/java/util/ServiceLoader/basic/basic.sh deleted file mode 100644 index 1a3a34864d2..00000000000 --- a/test/jdk/java/util/ServiceLoader/basic/basic.sh +++ /dev/null @@ -1,156 +0,0 @@ -# -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# @test -# @bug 4640520 6354623 7198496 -# @summary Unit test for java.util.ServiceLoader -# -# @build Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider -# @run shell basic.sh - -# Command-line usage: sh basic.sh /path/to/build - -if [ -z "$TESTJAVA" ]; then - if [ $# -lt 1 ]; then exit 1; fi - TESTJAVA="$1"; shift - COMPILEJAVA="${TESTJAVA}" - TESTSRC="`pwd`" - TESTCLASSES="`pwd`" -fi - -JAVA="$TESTJAVA/bin/java" -JAR="$COMPILEJAVA/bin/jar" - -OS=`uname -s` -case "$OS" in - SunOS | Darwin | AIX ) - FS='/' - SEP=':' ;; - Linux ) - FS='/' - SEP=':' ;; - * ) - FS='\\' - SEP='\;' ;; -esac - -JARD=x.jar -EXTD=x.ext -TESTD=x.test -P3JAR=${EXTD}${FS}p3.jar - -if [ \! -d $EXTD ]; then - # Initialize - echo Initializing... - rm -rf $JARD $EXTD $TESTD - mkdir -p $JARD $EXTD $TESTD - - for n in 2 3; do - rm -rf $JARD/*; mkdir -p $JARD/META-INF/services - echo FooProvider$n \ - >$JARD/META-INF/services/FooService - cp $TESTCLASSES/FooProvider$n.class $JARD - if [ $n = 3 ]; then - cp $TESTCLASSES/FooService.class $JARD - fi - (cd $JARD; "$JAR" ${TESTTOOLVMOPTS} -cf ../p$n.jar *) - done - - cp p2.jar p2dup.jar - mv p3.jar $EXTD - - cp $TESTCLASSES/Load.class $TESTD - cp $TESTCLASSES/FooService.class $TESTD - cp $TESTCLASSES/FooProvider1.class $TESTD - mkdir -p $TESTD/META-INF/services - echo FooProvider1 \ - >$TESTD/META-INF/services/FooService - - # This gives us: - # $TESTD: FooProvider1 - # . : FooProvider2, in p2.jar - # $EXTD: FooProvider3, in p3.jar - -fi - -failures=0 - -go() { - echo '' - cp="$1"; shift - if [ -z "$cp" ]; then cp="$TESTCLASSES"; else cp="$TESTCLASSES$SEP$cp"; fi - vmargs="$1"; shift - sh -xc "'$JAVA' ${TESTVMOPTS} -cp $cp $vmargs $T $*" 2>&1 - if [ $? != 0 ]; then failures=`expr $failures + 1`; fi -} - - -# Java-level tests - -T=Basic -go ".${SEP}$TESTD${SEP}p2.jar" "" - -# Success cases - -T=Load - -go "$TESTD" "" FooProvider1 - -go ".${SEP}p2.jar" "" FooProvider2 - -go ".${SEP}p2.jar${SEP}p2dup.jar" "" FooProvider2 - -go "${P3JAR}${SEP}p2.jar" "" FooProvider3 FooProvider2 - -go "$TESTD${SEP}p2.jar" "" FooProvider1 FooProvider2 - -go "${P3JAR}${SEP}$TESTD" "" FooProvider3 FooProvider1 - -go "${P3JAR}${SEP}$TESTD${SEP}p2.jar" "" \ - FooProvider3 FooProvider1 FooProvider2 - -# Failure cases - -mkdir -p x.meta/META-INF/services - -# Simple failures -for p in FooProvider42 'blah blah' 9234 'X!' BarProvider; do - echo $p >x.meta/META-INF/services/FooService - go ".${SEP}x.meta" "" fail -done - -# Failures followed by successes -echo FooProvider42 >x.meta/META-INF/services/FooService -go "$TESTD${SEP}x.meta" "" FooProvider1 fail -go "x.meta${SEP}$TESTD" "" fail FooProvider1 -go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "" \ - FooProvider1 fail FooProvider2 - - -# Summary - -echo '' -if [ $failures -gt 0 ]; - then echo "$failures case(s) failed"; - else echo "All cases passed"; fi -exit $failures From acb7acc64ffdc6a6b61774f1b1f7d3f9a7a4e1fb Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Thu, 13 Sep 2018 22:45:12 -0700 Subject: [PATCH 10/41] 8210478: Update Graal Reviewed-by: kvn --- .../src/jdk/tools/jaotc/AOTCompiledClass.java | 2 +- .../management/HotSpotGraalRuntimeMBean.java | 68 +++-- .../share/classes/module-info.java | 1 + .../compiler/asm/amd64/AMD64Assembler.java | 264 +++++++++++------- .../asm/amd64/AMD64BaseAssembler.java | 17 +- .../core/test/CheckGraalInvariants.java | 4 +- .../compiler/core/test/NewInstanceTest.java | 164 +++++++++++ .../core/test/ea/EscapeAnalysisTest.java | 18 ++ .../compiler/core/CompilationWrapper.java | 165 ++++++----- .../compiler/core/GraalCompilerOptions.java | 3 +- .../compiler/debug/test/DebugContextTest.java | 19 +- .../debug/DiagnosticsOutputDirectory.java | 5 +- .../graalvm/compiler/debug/PathUtilities.java | 13 +- .../hotspot/test/CompilationWrapperTest.java | 90 ++++-- .../compiler/hotspot/test/GraalOSRTest.java | 57 ---- .../test/HotSpotGraalManagementTest.java | 11 +- .../compiler/hotspot/HotSpotBackend.java | 10 +- .../hotspot/HotSpotGraalCompiler.java | 1 + .../hotspot/HotSpotGraalRuntimeProvider.java | 3 +- .../compiler/hotspot/JVMCIVersionCheck.java | 2 +- .../meta/HotSpotHostForeignCallsProvider.java | 10 +- .../replacements/NewObjectSnippets.java | 4 +- .../compiler/hotspot/stubs/NewArrayStub.java | 122 -------- .../hotspot/stubs/NewInstanceStub.java | 109 -------- .../compiler/hotspot/stubs/SnippetStub.java | 8 +- .../compiler/hotspot/stubs/StubOptions.java | 11 +- .../compiler/java/BciBlockMapping.java | 12 + .../graalvm/compiler/java/BytecodeParser.java | 41 +-- .../graalvm/compiler/nodes/GraphEncoder.java | 7 +- .../compiler/nodes/StructuredGraph.java | 56 +++- .../compiler/nodes/java/InstanceOfNode.java | 8 +- .../compiler/nodes/java/NewInstanceNode.java | 2 +- .../compiler/nodes/java/StoreIndexedNode.java | 2 +- .../compiler/options/OptionsParser.java | 16 +- .../common/ConditionalEliminationPhase.java | 31 +- .../phases/common/inlining/InliningUtil.java | 9 +- .../jmx/HotSpotMBeanOperationProvider.java | 33 +++ .../compiler/phases/tiers/PhaseContext.java | 11 +- .../replacements/test/PEGraphDecoderTest.java | 2 +- .../replacements/CachingPEGraphDecoder.java | 17 +- .../replacements/IntrinsicGraphBuilder.java | 2 +- .../compiler/replacements/PEGraphDecoder.java | 11 +- .../replacements/ReplacementsImpl.java | 10 +- .../replacements/SnippetTemplate.java | 2 +- .../replacements/nodes/MacroNode.java | 2 +- .../src/org/graalvm/graphio/GraphOutput.java | 6 +- 46 files changed, 817 insertions(+), 644 deletions(-) create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java delete mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java delete mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/jmx/HotSpotMBeanOperationProvider.java diff --git a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java index d63115bd370..9bd0b27fb06 100644 --- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java +++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff --git a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java index ff523397cf5..c17047ffef1 100644 --- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java +++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java @@ -24,6 +24,7 @@ package org.graalvm.compiler.hotspot.management; +import org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -49,6 +50,7 @@ import org.graalvm.compiler.hotspot.HotSpotGraalRuntime; import org.graalvm.compiler.options.OptionDescriptor; import org.graalvm.compiler.options.OptionDescriptors; import org.graalvm.compiler.options.OptionsParser; +import org.graalvm.compiler.serviceprovider.GraalServices; /** * MBean used to access properties and operations of a {@link HotSpotGraalRuntime} instance. @@ -170,11 +172,32 @@ final class HotSpotGraalRuntimeMBean implements DynamicMBean { if (DEBUG) { System.out.printf("invoke: %s%s%n", actionName, Arrays.asList(params)); } - Object retvalue = runtime.invokeManagementAction(actionName, params); + Object retvalue = null; + if ("dumpMethod".equals(actionName)) { + retvalue = runtime.invokeManagementAction(actionName, params); + } else { + boolean found = false; + for (HotSpotMBeanOperationProvider p : GraalServices.load(HotSpotMBeanOperationProvider.class)) { + List info = new ArrayList<>(); + p.registerOperations(MBeanOperationInfo.class, info); + for (MBeanOperationInfo op : info) { + if (actionName.equals(op.getName())) { + retvalue = p.invoke(actionName, params, signature); + found = true; + break; + } + } + } + if (!found) { + throw new MBeanException(new IllegalStateException("Cannot find operation " + actionName)); + } + } if (DEBUG) { System.out.printf("invoke: %s%s = %s%n", actionName, Arrays.asList(params), retvalue); } return retvalue; + } catch (MBeanException ex) { + throw ex; } catch (Exception ex) { throw new ReflectionException(ex); } @@ -198,30 +221,35 @@ final class HotSpotGraalRuntimeMBean implements DynamicMBean { return o1.getName().compareTo(o2.getName()); } }); - MBeanOperationInfo[] ops = { - new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ - new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), - new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), - }, "void", MBeanOperationInfo.ACTION), - new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ - new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), - new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), - new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"), - }, "void", MBeanOperationInfo.ACTION), - new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ - new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), - new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), - new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"), - new MBeanParameterInfo("host", "java.lang.String", "The host where the IGV tool is running at"), - new MBeanParameterInfo("port", "int", "The port where the IGV tool is listening at"), - }, "void", MBeanOperationInfo.ACTION) - }; + List opts = new ArrayList<>(); + opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ + new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), + new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), + }, "void", MBeanOperationInfo.ACTION)); + opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ + new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), + new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), + new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"), + }, "void", MBeanOperationInfo.ACTION)); + opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{ + new MBeanParameterInfo("className", "java.lang.String", "Class to observe"), + new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"), + new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"), + new MBeanParameterInfo("host", "java.lang.String", "The host where the IGV tool is running at"), + new MBeanParameterInfo("port", "int", "The port where the IGV tool is listening at"), + }, "void", MBeanOperationInfo.ACTION)); + + for (HotSpotMBeanOperationProvider p : GraalServices.load(HotSpotMBeanOperationProvider.class)) { + p.registerOperations(MBeanOperationInfo.class, opts); + } return new MBeanInfo( HotSpotGraalRuntimeMBean.class.getName(), "Graal", attrs.toArray(new MBeanAttributeInfo[attrs.size()]), - null, ops, null); + null, + opts.toArray(new MBeanOperationInfo[opts.size()]), + null); } private static EconomicMap getOptionDescriptors() { diff --git a/src/jdk.internal.vm.compiler/share/classes/module-info.java b/src/jdk.internal.vm.compiler/share/classes/module-info.java index d39463c7a6c..d0e0e58ae0e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/module-info.java +++ b/src/jdk.internal.vm.compiler/share/classes/module-info.java @@ -74,6 +74,7 @@ module jdk.internal.vm.compiler { jdk.aot, jdk.internal.vm.compiler.management; exports org.graalvm.compiler.phases to jdk.aot; + exports org.graalvm.compiler.phases.common.jmx to jdk.internal.vm.compiler.management; exports org.graalvm.compiler.phases.tiers to jdk.aot; exports org.graalvm.compiler.printer to jdk.aot; exports org.graalvm.compiler.runtime to jdk.aot; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java index 2297239f8dc..85ff283fc3e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java @@ -52,6 +52,8 @@ import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.SD; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.SS; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.WORD; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128; +import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256; +import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F3A; @@ -78,7 +80,6 @@ import org.graalvm.compiler.debug.GraalError; import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64.CPUFeature; -import jdk.vm.ci.amd64.AMD64Kind; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.Register.RegisterCategory; import jdk.vm.ci.code.TargetDescription; @@ -893,7 +894,7 @@ public class AMD64Assembler extends AMD64BaseAssembler { } } - private enum AVXOpAssertion { + private enum VEXOpAssertion { AVX1(CPUFeature.AVX, CPUFeature.AVX), AVX1_2(CPUFeature.AVX, CPUFeature.AVX2), AVX2(CPUFeature.AVX2, CPUFeature.AVX2), @@ -903,23 +904,25 @@ public class AMD64Assembler extends AMD64BaseAssembler { XMM_CPU(CPUFeature.AVX, null, XMM, null, CPU, null), XMM_XMM_CPU(CPUFeature.AVX, null, XMM, XMM, CPU, null), CPU_XMM(CPUFeature.AVX, null, CPU, null, XMM, null), - AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, CPU, null, XMM, null); + AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, CPU, null, XMM, null), + BMI1(CPUFeature.BMI1, null, CPU, CPU, CPU, null), + BMI2(CPUFeature.BMI2, null, CPU, CPU, CPU, null); - private final CPUFeature avx128feature; - private final CPUFeature avx256feature; + private final CPUFeature l128feature; + private final CPUFeature l256feature; private final RegisterCategory rCategory; private final RegisterCategory vCategory; private final RegisterCategory mCategory; private final RegisterCategory imm8Category; - AVXOpAssertion(CPUFeature avx128feature, CPUFeature avx256feature) { - this(avx128feature, avx256feature, XMM, XMM, XMM, XMM); + VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature) { + this(l128feature, l256feature, XMM, XMM, XMM, XMM); } - AVXOpAssertion(CPUFeature avx128feature, CPUFeature avx256feature, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory, RegisterCategory imm8Category) { - this.avx128feature = avx128feature; - this.avx256feature = avx256feature; + VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory, RegisterCategory imm8Category) { + this.l128feature = l128feature; + this.l256feature = l256feature; this.rCategory = rCategory; this.vCategory = vCategory; this.mCategory = mCategory; @@ -927,16 +930,20 @@ public class AMD64Assembler extends AMD64BaseAssembler { } public boolean check(AMD64 arch, AVXSize size, Register r, Register v, Register m) { - return check(arch, size, r, v, m, null); + return check(arch, getLFlag(size), r, v, m, null); } public boolean check(AMD64 arch, AVXSize size, Register r, Register v, Register m, Register imm8) { - switch (size) { - case XMM: - assert avx128feature != null && arch.getFeatures().contains(avx128feature) : "emitting illegal 128 bit instruction"; + return check(arch, getLFlag(size), r, v, m, imm8); + } + + public boolean check(AMD64 arch, int l, Register r, Register v, Register m, Register imm8) { + switch (l) { + case L128: + assert l128feature != null && arch.getFeatures().contains(l128feature) : "emitting illegal 128 bit instruction"; break; - case YMM: - assert avx256feature != null && arch.getFeatures().contains(avx256feature) : "emitting illegal 256 bit instruction"; + case L256: + assert l256feature != null && arch.getFeatures().contains(l256feature) : "emitting illegal 256 bit instruction"; break; } if (r != null) { @@ -957,9 +964,9 @@ public class AMD64Assembler extends AMD64BaseAssembler { public boolean supports(EnumSet features, AVXSize avxSize) { switch (avxSize) { case XMM: - return avx128feature != null && features.contains(avx128feature); + return l128feature != null && features.contains(l128feature); case YMM: - return avx256feature != null && features.contains(avx256feature); + return l256feature != null && features.contains(l256feature); default: throw GraalError.shouldNotReachHere(); } @@ -976,9 +983,9 @@ public class AMD64Assembler extends AMD64BaseAssembler { protected final int op; private final String opcode; - protected final AVXOpAssertion assertion; + protected final VEXOpAssertion assertion; - protected VexOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + protected VexOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { this.pp = pp; this.mmmmm = mmmmm; this.w = w; @@ -987,10 +994,6 @@ public class AMD64Assembler extends AMD64BaseAssembler { this.assertion = assertion; } - public boolean isSupported(AMD64Assembler vasm, AMD64Kind kind) { - return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), AVXKind.getRegisterSize(kind)); - } - public final boolean isSupported(AMD64Assembler vasm, AVXSize size) { return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), size); } @@ -1006,14 +1009,14 @@ public class AMD64Assembler extends AMD64BaseAssembler { */ public static class VexRROp extends VexOp { // @formatter:off - public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, AVXOpAssertion.AVX1_128ONLY); + public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, VEXOpAssertion.AVX1_128ONLY); // @formatter:on protected VexRROp(String opcode, int pp, int mmmmm, int w, int op) { - this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1); } - protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1031,10 +1034,10 @@ public class AMD64Assembler extends AMD64BaseAssembler { */ public static class VexRMOp extends VexRROp { // @formatter:off - public static final VexRMOp VCVTTSS2SI = new VexRMOp("VCVTTSS2SI", P_F3, M_0F, W0, 0x2C, AVXOpAssertion.CPU_XMM); - public static final VexRMOp VCVTTSS2SQ = new VexRMOp("VCVTTSS2SQ", P_F3, M_0F, W1, 0x2C, AVXOpAssertion.CPU_XMM); - public static final VexRMOp VCVTTSD2SI = new VexRMOp("VCVTTSD2SI", P_F2, M_0F, W0, 0x2C, AVXOpAssertion.CPU_XMM); - public static final VexRMOp VCVTTSD2SQ = new VexRMOp("VCVTTSD2SQ", P_F2, M_0F, W1, 0x2C, AVXOpAssertion.CPU_XMM); + public static final VexRMOp VCVTTSS2SI = new VexRMOp("VCVTTSS2SI", P_F3, M_0F, W0, 0x2C, VEXOpAssertion.CPU_XMM); + public static final VexRMOp VCVTTSS2SQ = new VexRMOp("VCVTTSS2SQ", P_F3, M_0F, W1, 0x2C, VEXOpAssertion.CPU_XMM); + public static final VexRMOp VCVTTSD2SI = new VexRMOp("VCVTTSD2SI", P_F2, M_0F, W0, 0x2C, VEXOpAssertion.CPU_XMM); + public static final VexRMOp VCVTTSD2SQ = new VexRMOp("VCVTTSD2SQ", P_F2, M_0F, W1, 0x2C, VEXOpAssertion.CPU_XMM); public static final VexRMOp VCVTPS2PD = new VexRMOp("VCVTPS2PD", P_, M_0F, WIG, 0x5A); public static final VexRMOp VCVTPD2PS = new VexRMOp("VCVTPD2PS", P_66, M_0F, WIG, 0x5A); public static final VexRMOp VCVTDQ2PS = new VexRMOp("VCVTDQ2PS", P_, M_0F, WIG, 0x5B); @@ -1042,14 +1045,14 @@ public class AMD64Assembler extends AMD64BaseAssembler { public static final VexRMOp VCVTTPD2DQ = new VexRMOp("VCVTTPD2DQ", P_66, M_0F, WIG, 0xE6); public static final VexRMOp VCVTDQ2PD = new VexRMOp("VCVTDQ2PD", P_F3, M_0F, WIG, 0xE6); public static final VexRMOp VBROADCASTSS = new VexRMOp("VBROADCASTSS", P_66, M_0F38, W0, 0x18); - public static final VexRMOp VBROADCASTSD = new VexRMOp("VBROADCASTSD", P_66, M_0F38, W0, 0x19, AVXOpAssertion.AVX1_256ONLY); - public static final VexRMOp VBROADCASTF128 = new VexRMOp("VBROADCASTF128", P_66, M_0F38, W0, 0x1A, AVXOpAssertion.AVX1_256ONLY); - public static final VexRMOp VPBROADCASTI128 = new VexRMOp("VPBROADCASTI128", P_66, M_0F38, W0, 0x5A, AVXOpAssertion.AVX2_256ONLY); - public static final VexRMOp VPBROADCASTB = new VexRMOp("VPBROADCASTB", P_66, M_0F38, W0, 0x78, AVXOpAssertion.AVX2); - public static final VexRMOp VPBROADCASTW = new VexRMOp("VPBROADCASTW", P_66, M_0F38, W0, 0x79, AVXOpAssertion.AVX2); - public static final VexRMOp VPBROADCASTD = new VexRMOp("VPBROADCASTD", P_66, M_0F38, W0, 0x58, AVXOpAssertion.AVX2); - public static final VexRMOp VPBROADCASTQ = new VexRMOp("VPBROADCASTQ", P_66, M_0F38, W0, 0x59, AVXOpAssertion.AVX2); - public static final VexRMOp VPMOVMSKB = new VexRMOp("VPMOVMSKB", P_66, M_0F, WIG, 0xD7, AVXOpAssertion.AVX1_2_CPU_XMM); + public static final VexRMOp VBROADCASTSD = new VexRMOp("VBROADCASTSD", P_66, M_0F38, W0, 0x19, VEXOpAssertion.AVX1_256ONLY); + public static final VexRMOp VBROADCASTF128 = new VexRMOp("VBROADCASTF128", P_66, M_0F38, W0, 0x1A, VEXOpAssertion.AVX1_256ONLY); + public static final VexRMOp VPBROADCASTI128 = new VexRMOp("VPBROADCASTI128", P_66, M_0F38, W0, 0x5A, VEXOpAssertion.AVX2_256ONLY); + public static final VexRMOp VPBROADCASTB = new VexRMOp("VPBROADCASTB", P_66, M_0F38, W0, 0x78, VEXOpAssertion.AVX2); + public static final VexRMOp VPBROADCASTW = new VexRMOp("VPBROADCASTW", P_66, M_0F38, W0, 0x79, VEXOpAssertion.AVX2); + public static final VexRMOp VPBROADCASTD = new VexRMOp("VPBROADCASTD", P_66, M_0F38, W0, 0x58, VEXOpAssertion.AVX2); + public static final VexRMOp VPBROADCASTQ = new VexRMOp("VPBROADCASTQ", P_66, M_0F38, W0, 0x59, VEXOpAssertion.AVX2); + public static final VexRMOp VPMOVMSKB = new VexRMOp("VPMOVMSKB", P_66, M_0F, WIG, 0xD7, VEXOpAssertion.AVX1_2_CPU_XMM); public static final VexRMOp VPMOVSXBW = new VexRMOp("VPMOVSXBW", P_66, M_0F38, WIG, 0x20); public static final VexRMOp VPMOVSXBD = new VexRMOp("VPMOVSXBD", P_66, M_0F38, WIG, 0x21); public static final VexRMOp VPMOVSXBQ = new VexRMOp("VPMOVSXBQ", P_66, M_0F38, WIG, 0x22); @@ -1072,10 +1075,10 @@ public class AMD64Assembler extends AMD64BaseAssembler { // @formatter:on protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op) { - this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1); } - protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1103,17 +1106,17 @@ public class AMD64Assembler extends AMD64BaseAssembler { public static final VexMoveOp VMOVUPD = new VexMoveOp("VMOVUPD", P_66, M_0F, WIG, 0x10, 0x11); public static final VexMoveOp VMOVSS = new VexMoveOp("VMOVSS", P_F3, M_0F, WIG, 0x10, 0x11); public static final VexMoveOp VMOVSD = new VexMoveOp("VMOVSD", P_F2, M_0F, WIG, 0x10, 0x11); - public static final VexMoveOp VMOVD = new VexMoveOp("VMOVD", P_66, M_0F, W0, 0x6E, 0x7E, AVXOpAssertion.XMM_CPU); - public static final VexMoveOp VMOVQ = new VexMoveOp("VMOVQ", P_66, M_0F, W1, 0x6E, 0x7E, AVXOpAssertion.XMM_CPU); + public static final VexMoveOp VMOVD = new VexMoveOp("VMOVD", P_66, M_0F, W0, 0x6E, 0x7E, VEXOpAssertion.XMM_CPU); + public static final VexMoveOp VMOVQ = new VexMoveOp("VMOVQ", P_66, M_0F, W1, 0x6E, 0x7E, VEXOpAssertion.XMM_CPU); // @formatter:on private final int opReverse; private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse) { - this(opcode, pp, mmmmm, w, op, opReverse, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1); } - private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, AVXOpAssertion assertion) { + private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); this.opReverse = opReverse; } @@ -1142,13 +1145,13 @@ public class AMD64Assembler extends AMD64BaseAssembler { */ public static final class VexRMIOp extends VexOp implements VexRRIOp { // @formatter:off - public static final VexRMIOp VPERMQ = new VexRMIOp("VPERMQ", P_66, M_0F3A, W1, 0x00, AVXOpAssertion.AVX2_256ONLY); - public static final VexRMIOp VPSHUFLW = new VexRMIOp("VPSHUFLW", P_F2, M_0F, WIG, 0x70, AVXOpAssertion.AVX1_2); - public static final VexRMIOp VPSHUFHW = new VexRMIOp("VPSHUFHW", P_F3, M_0F, WIG, 0x70, AVXOpAssertion.AVX1_2); - public static final VexRMIOp VPSHUFD = new VexRMIOp("VPSHUFD", P_66, M_0F, WIG, 0x70, AVXOpAssertion.AVX1_2); + public static final VexRMIOp VPERMQ = new VexRMIOp("VPERMQ", P_66, M_0F3A, W1, 0x00, VEXOpAssertion.AVX2_256ONLY); + public static final VexRMIOp VPSHUFLW = new VexRMIOp("VPSHUFLW", P_F2, M_0F, WIG, 0x70, VEXOpAssertion.AVX1_2); + public static final VexRMIOp VPSHUFHW = new VexRMIOp("VPSHUFHW", P_F3, M_0F, WIG, 0x70, VEXOpAssertion.AVX1_2); + public static final VexRMIOp VPSHUFD = new VexRMIOp("VPSHUFD", P_66, M_0F, WIG, 0x70, VEXOpAssertion.AVX1_2); // @formatter:on - private VexRMIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + private VexRMIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1175,15 +1178,15 @@ public class AMD64Assembler extends AMD64BaseAssembler { */ public static final class VexMRIOp extends VexOp implements VexRRIOp { // @formatter:off - public static final VexMRIOp VEXTRACTF128 = new VexMRIOp("VEXTRACTF128", P_66, M_0F3A, W0, 0x19, AVXOpAssertion.AVX1_256ONLY); - public static final VexMRIOp VEXTRACTI128 = new VexMRIOp("VEXTRACTI128", P_66, M_0F3A, W0, 0x39, AVXOpAssertion.AVX2_256ONLY); - public static final VexMRIOp VPEXTRB = new VexMRIOp("VPEXTRB", P_66, M_0F3A, W0, 0x14, AVXOpAssertion.XMM_CPU); - public static final VexMRIOp VPEXTRW = new VexMRIOp("VPEXTRW", P_66, M_0F3A, W0, 0x15, AVXOpAssertion.XMM_CPU); - public static final VexMRIOp VPEXTRD = new VexMRIOp("VPEXTRD", P_66, M_0F3A, W0, 0x16, AVXOpAssertion.XMM_CPU); - public static final VexMRIOp VPEXTRQ = new VexMRIOp("VPEXTRQ", P_66, M_0F3A, W1, 0x16, AVXOpAssertion.XMM_CPU); + public static final VexMRIOp VEXTRACTF128 = new VexMRIOp("VEXTRACTF128", P_66, M_0F3A, W0, 0x19, VEXOpAssertion.AVX1_256ONLY); + public static final VexMRIOp VEXTRACTI128 = new VexMRIOp("VEXTRACTI128", P_66, M_0F3A, W0, 0x39, VEXOpAssertion.AVX2_256ONLY); + public static final VexMRIOp VPEXTRB = new VexMRIOp("VPEXTRB", P_66, M_0F3A, W0, 0x14, VEXOpAssertion.XMM_CPU); + public static final VexMRIOp VPEXTRW = new VexMRIOp("VPEXTRW", P_66, M_0F3A, W0, 0x15, VEXOpAssertion.XMM_CPU); + public static final VexMRIOp VPEXTRD = new VexMRIOp("VPEXTRD", P_66, M_0F3A, W0, 0x16, VEXOpAssertion.XMM_CPU); + public static final VexMRIOp VPEXTRQ = new VexMRIOp("VPEXTRQ", P_66, M_0F3A, W1, 0x16, VEXOpAssertion.XMM_CPU); // @formatter:on - private VexMRIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + private VexMRIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1210,12 +1213,12 @@ public class AMD64Assembler extends AMD64BaseAssembler { */ public static class VexRVMROp extends VexOp { // @formatter:off - public static final VexRVMROp VPBLENDVB = new VexRVMROp("VPBLENDVB", P_66, M_0F3A, W0, 0x4C, AVXOpAssertion.AVX1_2); - public static final VexRVMROp VPBLENDVPS = new VexRVMROp("VPBLENDVPS", P_66, M_0F3A, W0, 0x4A, AVXOpAssertion.AVX1); - public static final VexRVMROp VPBLENDVPD = new VexRVMROp("VPBLENDVPD", P_66, M_0F3A, W0, 0x4B, AVXOpAssertion.AVX1); + public static final VexRVMROp VPBLENDVB = new VexRVMROp("VPBLENDVB", P_66, M_0F3A, W0, 0x4C, VEXOpAssertion.AVX1_2); + public static final VexRVMROp VPBLENDVPS = new VexRVMROp("VPBLENDVPS", P_66, M_0F3A, W0, 0x4A, VEXOpAssertion.AVX1); + public static final VexRVMROp VPBLENDVPD = new VexRVMROp("VPBLENDVPD", P_66, M_0F3A, W0, 0x4B, VEXOpAssertion.AVX1); // @formatter:on - protected VexRVMROp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + protected VexRVMROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1275,43 +1278,43 @@ public class AMD64Assembler extends AMD64BaseAssembler { public static final VexRVMOp VMAXSD = new VexRVMOp("VMAXSD", P_F2, M_0F, WIG, 0x5F); public static final VexRVMOp VADDSUBPS = new VexRVMOp("VADDSUBPS", P_F2, M_0F, WIG, 0xD0); public static final VexRVMOp VADDSUBPD = new VexRVMOp("VADDSUBPD", P_66, M_0F, WIG, 0xD0); - public static final VexRVMOp VPAND = new VexRVMOp("VPAND", P_66, M_0F, WIG, 0xDB, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPOR = new VexRVMOp("VPOR", P_66, M_0F, WIG, 0xEB, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPXOR = new VexRVMOp("VPXOR", P_66, M_0F, WIG, 0xEF, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPADDB = new VexRVMOp("VPADDB", P_66, M_0F, WIG, 0xFC, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPADDW = new VexRVMOp("VPADDW", P_66, M_0F, WIG, 0xFD, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPADDD = new VexRVMOp("VPADDD", P_66, M_0F, WIG, 0xFE, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPADDQ = new VexRVMOp("VPADDQ", P_66, M_0F, WIG, 0xD4, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPMULHUW = new VexRVMOp("VPMULHUW", P_66, M_0F, WIG, 0xE4, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPMULHW = new VexRVMOp("VPMULHW", P_66, M_0F, WIG, 0xE5, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPMULLW = new VexRVMOp("VPMULLW", P_66, M_0F, WIG, 0xD5, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPMULLD = new VexRVMOp("VPMULLD", P_66, M_0F38, WIG, 0x40, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPSUBB = new VexRVMOp("VPSUBB", P_66, M_0F, WIG, 0xF8, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPSUBW = new VexRVMOp("VPSUBW", P_66, M_0F, WIG, 0xF9, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPSUBD = new VexRVMOp("VPSUBD", P_66, M_0F, WIG, 0xFA, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPSUBQ = new VexRVMOp("VPSUBQ", P_66, M_0F, WIG, 0xFB, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPSHUFB = new VexRVMOp("VPSHUFB", P_66, M_0F38, WIG, 0x00, AVXOpAssertion.AVX1_2); + public static final VexRVMOp VPAND = new VexRVMOp("VPAND", P_66, M_0F, WIG, 0xDB, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPOR = new VexRVMOp("VPOR", P_66, M_0F, WIG, 0xEB, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPXOR = new VexRVMOp("VPXOR", P_66, M_0F, WIG, 0xEF, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPADDB = new VexRVMOp("VPADDB", P_66, M_0F, WIG, 0xFC, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPADDW = new VexRVMOp("VPADDW", P_66, M_0F, WIG, 0xFD, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPADDD = new VexRVMOp("VPADDD", P_66, M_0F, WIG, 0xFE, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPADDQ = new VexRVMOp("VPADDQ", P_66, M_0F, WIG, 0xD4, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPMULHUW = new VexRVMOp("VPMULHUW", P_66, M_0F, WIG, 0xE4, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPMULHW = new VexRVMOp("VPMULHW", P_66, M_0F, WIG, 0xE5, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPMULLW = new VexRVMOp("VPMULLW", P_66, M_0F, WIG, 0xD5, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPMULLD = new VexRVMOp("VPMULLD", P_66, M_0F38, WIG, 0x40, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPSUBB = new VexRVMOp("VPSUBB", P_66, M_0F, WIG, 0xF8, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPSUBW = new VexRVMOp("VPSUBW", P_66, M_0F, WIG, 0xF9, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPSUBD = new VexRVMOp("VPSUBD", P_66, M_0F, WIG, 0xFA, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPSUBQ = new VexRVMOp("VPSUBQ", P_66, M_0F, WIG, 0xFB, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPSHUFB = new VexRVMOp("VPSHUFB", P_66, M_0F38, WIG, 0x00, VEXOpAssertion.AVX1_2); public static final VexRVMOp VCVTSD2SS = new VexRVMOp("VCVTSD2SS", P_F2, M_0F, WIG, 0x5A); public static final VexRVMOp VCVTSS2SD = new VexRVMOp("VCVTSS2SD", P_F3, M_0F, WIG, 0x5A); - public static final VexRVMOp VCVTSI2SD = new VexRVMOp("VCVTSI2SD", P_F2, M_0F, W0, 0x2A, AVXOpAssertion.XMM_XMM_CPU); - public static final VexRVMOp VCVTSQ2SD = new VexRVMOp("VCVTSQ2SD", P_F2, M_0F, W1, 0x2A, AVXOpAssertion.XMM_XMM_CPU); - public static final VexRVMOp VCVTSI2SS = new VexRVMOp("VCVTSI2SS", P_F3, M_0F, W0, 0x2A, AVXOpAssertion.XMM_XMM_CPU); - public static final VexRVMOp VCVTSQ2SS = new VexRVMOp("VCVTSQ2SS", P_F3, M_0F, W1, 0x2A, AVXOpAssertion.XMM_XMM_CPU); - public static final VexRVMOp VPCMPEQB = new VexRVMOp("VPCMPEQB", P_66, M_0F, WIG, 0x74, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPEQW = new VexRVMOp("VPCMPEQW", P_66, M_0F, WIG, 0x75, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPEQD = new VexRVMOp("VPCMPEQD", P_66, M_0F, WIG, 0x76, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPEQQ = new VexRVMOp("VPCMPEQQ", P_66, M_0F38, WIG, 0x29, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPGTB = new VexRVMOp("VPCMPGTB", P_66, M_0F, WIG, 0x64, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPGTW = new VexRVMOp("VPCMPGTW", P_66, M_0F, WIG, 0x65, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPGTD = new VexRVMOp("VPCMPGTD", P_66, M_0F, WIG, 0x66, AVXOpAssertion.AVX1_2); - public static final VexRVMOp VPCMPGTQ = new VexRVMOp("VPCMPGTQ", P_66, M_0F38, WIG, 0x37, AVXOpAssertion.AVX1_2); + public static final VexRVMOp VCVTSI2SD = new VexRVMOp("VCVTSI2SD", P_F2, M_0F, W0, 0x2A, VEXOpAssertion.XMM_XMM_CPU); + public static final VexRVMOp VCVTSQ2SD = new VexRVMOp("VCVTSQ2SD", P_F2, M_0F, W1, 0x2A, VEXOpAssertion.XMM_XMM_CPU); + public static final VexRVMOp VCVTSI2SS = new VexRVMOp("VCVTSI2SS", P_F3, M_0F, W0, 0x2A, VEXOpAssertion.XMM_XMM_CPU); + public static final VexRVMOp VCVTSQ2SS = new VexRVMOp("VCVTSQ2SS", P_F3, M_0F, W1, 0x2A, VEXOpAssertion.XMM_XMM_CPU); + public static final VexRVMOp VPCMPEQB = new VexRVMOp("VPCMPEQB", P_66, M_0F, WIG, 0x74, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPEQW = new VexRVMOp("VPCMPEQW", P_66, M_0F, WIG, 0x75, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPEQD = new VexRVMOp("VPCMPEQD", P_66, M_0F, WIG, 0x76, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPEQQ = new VexRVMOp("VPCMPEQQ", P_66, M_0F38, WIG, 0x29, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPGTB = new VexRVMOp("VPCMPGTB", P_66, M_0F, WIG, 0x64, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPGTW = new VexRVMOp("VPCMPGTW", P_66, M_0F, WIG, 0x65, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPGTD = new VexRVMOp("VPCMPGTD", P_66, M_0F, WIG, 0x66, VEXOpAssertion.AVX1_2); + public static final VexRVMOp VPCMPGTQ = new VexRVMOp("VPCMPGTQ", P_66, M_0F38, WIG, 0x37, VEXOpAssertion.AVX1_2); // @formatter:on private VexRVMOp(String opcode, int pp, int mmmmm, int w, int op) { - this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1); } - protected VexRVMOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + protected VexRVMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1330,6 +1333,65 @@ public class AMD64Assembler extends AMD64BaseAssembler { } } + public static final class VexGeneralPurposeRVMOp extends VexOp { + // @formatter:off + public static final VexGeneralPurposeRVMOp ANDN = new VexGeneralPurposeRVMOp("ANDN", P_, M_0F38, WIG, 0xF2, VEXOpAssertion.BMI1); + public static final VexGeneralPurposeRVMOp MULX = new VexGeneralPurposeRVMOp("MULX", P_F2, M_0F38, WIG, 0xF6, VEXOpAssertion.BMI2); + public static final VexGeneralPurposeRVMOp PDEP = new VexGeneralPurposeRVMOp("PDEP", P_F2, M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2); + public static final VexGeneralPurposeRVMOp PEXT = new VexGeneralPurposeRVMOp("PEXT", P_F3, M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2); + // @formatter:on + + private VexGeneralPurposeRVMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { + super(opcode, pp, mmmmm, w, op, assertion); + } + + public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) { + assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, src2, null); + assert size == AVXSize.DWORD || size == AVXSize.QWORD; + asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1); + asm.emitByte(op); + asm.emitModRM(dst, src2); + } + + public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2) { + assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, null, null); + assert size == AVXSize.DWORD || size == AVXSize.QWORD; + asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1); + asm.emitByte(op); + asm.emitOperandHelper(dst, src2, 0); + } + } + + public static final class VexGeneralPurposeRMVOp extends VexOp { + // @formatter:off + public static final VexGeneralPurposeRMVOp BEXTR = new VexGeneralPurposeRMVOp("BEXTR", P_, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI1); + public static final VexGeneralPurposeRMVOp BZHI = new VexGeneralPurposeRMVOp("BZHI", P_, M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2); + public static final VexGeneralPurposeRMVOp SARX = new VexGeneralPurposeRMVOp("SARX", P_F3, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2); + public static final VexGeneralPurposeRMVOp SHRX = new VexGeneralPurposeRMVOp("SHRX", P_F2, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2); + public static final VexGeneralPurposeRMVOp SHLX = new VexGeneralPurposeRMVOp("SHLX", P_66, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2); + // @formatter:on + + private VexGeneralPurposeRMVOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { + super(opcode, pp, mmmmm, w, op, assertion); + } + + public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) { + assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, src1, null); + assert size == AVXSize.DWORD || size == AVXSize.QWORD; + asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1); + asm.emitByte(op); + asm.emitModRM(dst, src1); + } + + public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src1, Register src2) { + assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, null, null); + assert size == AVXSize.DWORD || size == AVXSize.QWORD; + asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1); + asm.emitByte(op); + asm.emitOperandHelper(dst, src1, 0); + } + } + /** * VEX-encoded shift instructions with an operand order of either RVM or VMI. */ @@ -1349,7 +1411,7 @@ public class AMD64Assembler extends AMD64BaseAssembler { private final int r; private VexShiftOp(String opcode, int pp, int mmmmm, int w, int op, int immOp, int r) { - super(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1_2); + super(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1_2); this.immOp = immOp; this.r = r; } @@ -1368,17 +1430,17 @@ public class AMD64Assembler extends AMD64BaseAssembler { // @formatter:off public static final VexMaskMoveOp VMASKMOVPS = new VexMaskMoveOp("VMASKMOVPS", P_66, M_0F38, W0, 0x2C, 0x2E); public static final VexMaskMoveOp VMASKMOVPD = new VexMaskMoveOp("VMASKMOVPD", P_66, M_0F38, W0, 0x2D, 0x2F); - public static final VexMaskMoveOp VPMASKMOVD = new VexMaskMoveOp("VPMASKMOVD", P_66, M_0F38, W0, 0x8C, 0x8E, AVXOpAssertion.AVX2); - public static final VexMaskMoveOp VPMASKMOVQ = new VexMaskMoveOp("VPMASKMOVQ", P_66, M_0F38, W1, 0x8C, 0x8E, AVXOpAssertion.AVX2); + public static final VexMaskMoveOp VPMASKMOVD = new VexMaskMoveOp("VPMASKMOVD", P_66, M_0F38, W0, 0x8C, 0x8E, VEXOpAssertion.AVX2); + public static final VexMaskMoveOp VPMASKMOVQ = new VexMaskMoveOp("VPMASKMOVQ", P_66, M_0F38, W1, 0x8C, 0x8E, VEXOpAssertion.AVX2); // @formatter:on private final int opReverse; private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse) { - this(opcode, pp, mmmmm, w, op, opReverse, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1); } - private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, AVXOpAssertion assertion) { + private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); this.opReverse = opReverse; } @@ -1405,15 +1467,15 @@ public class AMD64Assembler extends AMD64BaseAssembler { // @formatter:off public static final VexRVMIOp VSHUFPS = new VexRVMIOp("VSHUFPS", P_, M_0F, WIG, 0xC6); public static final VexRVMIOp VSHUFPD = new VexRVMIOp("VSHUFPD", P_66, M_0F, WIG, 0xC6); - public static final VexRVMIOp VINSERTF128 = new VexRVMIOp("VINSERTF128", P_66, M_0F3A, W0, 0x18, AVXOpAssertion.AVX1_256ONLY); - public static final VexRVMIOp VINSERTI128 = new VexRVMIOp("VINSERTI128", P_66, M_0F3A, W0, 0x38, AVXOpAssertion.AVX2_256ONLY); + public static final VexRVMIOp VINSERTF128 = new VexRVMIOp("VINSERTF128", P_66, M_0F3A, W0, 0x18, VEXOpAssertion.AVX1_256ONLY); + public static final VexRVMIOp VINSERTI128 = new VexRVMIOp("VINSERTI128", P_66, M_0F3A, W0, 0x38, VEXOpAssertion.AVX2_256ONLY); // @formatter:on private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op) { - this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1); + this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1); } - private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) { + private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) { super(opcode, pp, mmmmm, w, op, assertion); } @@ -1528,7 +1590,7 @@ public class AMD64Assembler extends AMD64BaseAssembler { } private VexFloatCompareOp(String opcode, int pp, int mmmmm, int w, int op) { - super(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1); + super(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1); } public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2, Predicate p) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java index 0fec4564d56..e7ac25a746a 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java @@ -37,7 +37,7 @@ import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.Z1; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256; -import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LIG; +import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38; import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F3A; @@ -748,7 +748,7 @@ public abstract class AMD64BaseAssembler extends Assembler { public static final class VEXPrefixConfig { public static final int L128 = 0; public static final int L256 = 1; - public static final int LIG = 0; + public static final int LZ = 0; public static final int W0 = 0; public static final int W1 = 1; @@ -849,10 +849,10 @@ public abstract class AMD64BaseAssembler extends Assembler { protected final void emitVEX(int l, int pp, int mmmmm, int w, int rxb, int vvvv) { assert ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX) : "emitting VEX prefix on a CPU without AVX support"; - assert l == L128 || l == L256 || l == LIG : "invalid value for VEX.L"; + assert l == L128 || l == L256 : "invalid value for VEX.L"; assert pp == P_ || pp == P_66 || pp == P_F3 || pp == P_F2 : "invalid value for VEX.pp"; assert mmmmm == M_0F || mmmmm == M_0F38 || mmmmm == M_0F3A : "invalid value for VEX.m-mmmm"; - assert w == W0 || w == W1 || w == WIG : "invalid value for VEX.W"; + assert w == W0 || w == W1 : "invalid value for VEX.W"; assert (rxb & 0x07) == rxb : "invalid value for VEX.RXB"; assert (vvvv & 0x0F) == vvvv : "invalid value for VEX.vvvv"; @@ -887,7 +887,7 @@ public abstract class AMD64BaseAssembler extends Assembler { } } - private static int getLFlag(AVXSize size) { + public static int getLFlag(AVXSize size) { switch (size) { case XMM: return L128; @@ -896,7 +896,7 @@ public abstract class AMD64BaseAssembler extends Assembler { case ZMM: return L512; default: - return LIG; + return LZ; } } @@ -910,6 +910,7 @@ public abstract class AMD64BaseAssembler extends Assembler { protected static final class EVEXPrefixConfig { public static final int L512 = 2; + public static final int LIG = 0; public static final int Z0 = 0x0; public static final int Z1 = 0x1; @@ -1013,10 +1014,10 @@ public abstract class AMD64BaseAssembler extends Assembler { private void emitEVEX(int l, int pp, int mm, int w, int rxb, int reg, int vvvvv, int z, int b, int aaa) { assert ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX512F) : "emitting EVEX prefix on a CPU without AVX512 support"; - assert l == L128 || l == L256 || l == L512 || l == LIG : "invalid value for EVEX.L'L"; + assert l == L128 || l == L256 || l == L512 : "invalid value for EVEX.L'L"; assert pp == P_ || pp == P_66 || pp == P_F3 || pp == P_F2 : "invalid value for EVEX.pp"; assert mm == M_0F || mm == M_0F38 || mm == M_0F3A : "invalid value for EVEX.mm"; - assert w == W0 || w == W1 || w == WIG : "invalid value for EVEX.W"; + assert w == W0 || w == W1 : "invalid value for EVEX.W"; assert (rxb & 0x07) == rxb : "invalid value for EVEX.RXB"; assert (reg & 0x1F) == reg : "invalid value for EVEX.R'"; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java index f6d21cd60c8..2e71b7fc228 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java @@ -41,6 +41,7 @@ import java.util.concurrent.TimeUnit; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import org.graalvm.compiler.api.replacements.MethodSubstitution; import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; import org.graalvm.compiler.api.replacements.Snippet.NonNullParameter; @@ -279,7 +280,8 @@ public class CheckGraalInvariants extends GraalCompilerTest { executor.execute(() -> { try (DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER)) { ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); - StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build(); + boolean isSubstitution = method.getAnnotation(Snippet.class) != null || method.getAnnotation(MethodSubstitution.class) != null; + StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).setIsSubstitution(isSubstitution).build(); try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) { checkMethod(method); graphBuilderSuite.apply(graph, context); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java new file mode 100644 index 00000000000..39f6c3c0e81 --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java @@ -0,0 +1,164 @@ +/* + * 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 org.graalvm.compiler.core.test; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Constructor; + +import org.graalvm.compiler.java.GraphBuilderPhase; +import org.graalvm.compiler.nodes.DeoptimizeNode; +import org.graalvm.compiler.nodes.StructuredGraph; +import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; +import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration; +import org.graalvm.compiler.nodes.java.NewInstanceNode; +import org.graalvm.compiler.options.OptionValues; +import org.graalvm.compiler.phases.OptimisticOptimizations; +import org.junit.Assert; +import org.junit.Test; + +import jdk.vm.ci.meta.ResolvedJavaMethod; + +public class NewInstanceTest extends GraalCompilerTest { + public static class Template { + public Object o = new CCCC(); + } + + /** + * 1. Concrete class, should produce normal {@link NewInstanceNode} + */ + public static class CCCC { + + } + + /** + * 2. The test will replace references to {@link CCCC} in the {@link Template} to {@link AAAA} + */ + public abstract static class AAAA { + + } + + /** + * 3. The test will replace references to {@link CCCC} in the {@link Template} to {@link IIII} + */ + public interface IIII { + + } + + private StructuredGraph parseAndProcess(Class cl) { + Constructor[] constructors = cl.getConstructors(); + Assert.assertTrue(constructors.length == 1); + final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]); + OptionValues options = getInitialOptions(); + StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options, null, javaMethod), AllowAssumptions.YES).method(javaMethod).build(); + + GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins()).withUnresolvedIsError(false); + new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), getProviders().getConstantFieldProvider(), conf, + OptimisticOptimizations.ALL, null).apply(graph); + return graph; + } + + private void checkGraph(Class cl, int newInstanceNodeCount, int deoptimizeNodeCount) { + StructuredGraph graph = parseAndProcess(cl); + Assert.assertEquals(newInstanceNodeCount, graph.getNodes().filter(NewInstanceNode.class).count()); + Assert.assertEquals(deoptimizeNodeCount, graph.getNodes().filter(DeoptimizeNode.class).count()); + } + + /** + * Use a custom class loader to generate classes, substitute class names at the allocation site. + */ + @Test + public void test1() throws ClassNotFoundException { + checkGraph(Template.class, 1, 0); + ClassTemplateLoader loader1 = new ClassTemplateLoader("CCCC", "AAAA"); + checkGraph(loader1.findClass("Template"), 0, 1); + ClassTemplateLoader loader2 = new ClassTemplateLoader("CCCC", "IIII"); + checkGraph(loader2.findClass("Template"), 0, 1); + } + + private static class ClassTemplateLoader extends ClassLoader { + private final String find; + private final String replace; + + ClassTemplateLoader(String find, String replace) { + assert find.length() == replace.length(); + this.find = find; + this.replace = replace; + } + + @Override + protected Class findClass(final String name) throws ClassNotFoundException { + // copy classfile to byte array + byte[] classData = null; + try { + InputStream is = NewInstanceTest.class.getResourceAsStream("NewInstanceTest$" + name + ".class"); + assert is != null; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + byte[] buf = new byte[1024]; + int size; + while ((size = is.read(buf, 0, buf.length)) != -1) { + baos.write(buf, 0, size); + } + baos.flush(); + classData = baos.toByteArray(); + } catch (IOException e) { + Assert.fail("can't access class: " + name); + } + + // replace all occurrences of the template in classfile + int index = -1; + while ((index = indexOfTemplate(classData, index + 1, find)) != -1) { + replaceTemplate(classData, index, replace); + } + + Class c = defineClass(null, classData, 0, classData.length); + return c; + } + + private static int indexOfTemplate(byte[] b, int index, String find) { + for (int i = index; i < b.length; i++) { + boolean match = true; + for (int j = i; j < i + find.length(); j++) { + if (b[j] != (byte) find.charAt(j - i)) { + match = false; + break; + } + } + if (match) { + return i; + } + } + return -1; + } + + private static void replaceTemplate(byte[] b, int index, String replace) { + for (int i = index; i < index + replace.length(); i++) { + b[i] = (byte) replace.charAt(i - index); + } + } + } +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java index fcd4d052707..3af913d859b 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java @@ -27,6 +27,7 @@ package org.graalvm.compiler.core.test.ea; import java.util.List; import org.graalvm.compiler.graph.Node; +import org.graalvm.compiler.graph.iterators.NodeIterable; import org.graalvm.compiler.loop.DefaultLoopPolicies; import org.graalvm.compiler.loop.phases.LoopFullUnrollPhase; import org.graalvm.compiler.loop.phases.LoopPeelingPhase; @@ -492,4 +493,21 @@ public class EscapeAnalysisTest extends EATestBase { public void testDeoptMonitor() { test("testDeoptMonitorSnippet", new Object(), 0); } + + @Test + public void testInterfaceArrayAssignment() { + prepareGraph("testInterfaceArrayAssignmentSnippet", false); + NodeIterable returns = graph.getNodes().filter(ReturnNode.class); + assertTrue(returns.count() == 1); + assertFalse(returns.first().result().isConstant()); + } + + private interface TestInterface { + } + + public static boolean testInterfaceArrayAssignmentSnippet() { + Object[] array = new TestInterface[1]; + array[0] = new Object(); + return array[0] == null; + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java index 65be1021c86..a4da251fd7d 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java @@ -41,6 +41,7 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Map; +import org.graalvm.compiler.debug.DebugCloseable; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.DiagnosticsOutputDirectory; import org.graalvm.compiler.debug.PathUtilities; @@ -181,15 +182,64 @@ public abstract class CompilationWrapper { actionKey = CompilationFailureAction; causeType = "failure"; } - ExceptionAction action = lookupAction(initialOptions, actionKey, cause); + synchronized (CompilationFailureAction) { + // Serialize all compilation failure handling. + // This prevents retry compilation storms and interleaving + // of compilation exception messages. + // It also allows for reliable testing of CompilationWrapper + // by avoiding a race whereby retry compilation output from a + // forced crash (i.e., use of GraalCompilerOptions.CrashAt) + // is truncated. - action = adjustAction(initialOptions, actionKey, action); + ExceptionAction action = lookupAction(initialOptions, actionKey, cause); - if (action == ExceptionAction.Silent) { - return handleException(cause); - } + action = adjustAction(initialOptions, actionKey, action); - if (action == ExceptionAction.Print) { + if (action == ExceptionAction.Silent) { + return handleException(cause); + } + + if (action == ExceptionAction.Print) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (PrintStream ps = new PrintStream(baos)) { + ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this); + cause.printStackTrace(ps); + ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n", + causeType, + actionKey.getName(), ExceptionAction.Silent, + actionKey.getName(), ExceptionAction.Silent); + ps.printf("To capture more information for diagnosing or reporting a compilation %s, " + + "set %s to %s or %s (e.g., -Dgraal.%s=%s).%n", + causeType, + actionKey.getName(), ExceptionAction.Diagnose, + ExceptionAction.ExitVM, + actionKey.getName(), ExceptionAction.Diagnose); + } + TTY.print(baos.toString()); + return handleException(cause); + } + + // action is Diagnose or ExitVM + + if (Dump.hasBeenSet(initialOptions)) { + // If dumping is explicitly enabled, Graal is being debugged + // so don't interfere with what the user is expecting to see. + return handleException(cause); + } + + String dir = this.outputDirectory.getPath(); + if (dir == null) { + return handleException(cause); + } + String dumpName = PathUtilities.sanitizeFileName(toString()); + File dumpPath = new File(dir, dumpName); + dumpPath.mkdirs(); + if (!dumpPath.exists()) { + TTY.println("Warning: could not create diagnostics directory " + dumpPath); + return handleException(cause); + } + + String message; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (PrintStream ps = new PrintStream(baos)) { ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this); @@ -198,63 +248,16 @@ public abstract class CompilationWrapper { causeType, actionKey.getName(), ExceptionAction.Silent, actionKey.getName(), ExceptionAction.Silent); - ps.printf("To capture more information for diagnosing or reporting a compilation %s, " + - "set %s to %s or %s (e.g., -Dgraal.%s=%s).%n", + ps.printf("To print a message for a compilation %s without retrying the compilation, " + + "set %s to %s (e.g., -Dgraal.%s=%s).%n", causeType, - actionKey.getName(), ExceptionAction.Diagnose, - ExceptionAction.ExitVM, - actionKey.getName(), ExceptionAction.Diagnose); + actionKey.getName(), ExceptionAction.Print, + actionKey.getName(), ExceptionAction.Print); + ps.println("Retrying compilation of " + this); + message = baos.toString(); } - synchronized (CompilationFailureAction) { - // Synchronize to prevent compilation exception - // messages from interleaving. - TTY.println(baos.toString()); - } - return handleException(cause); - } - // action is Diagnose or ExitVM - - if (Dump.hasBeenSet(initialOptions)) { - // If dumping is explicitly enabled, Graal is being debugged - // so don't interfere with what the user is expecting to see. - return handleException(cause); - } - - String dir = this.outputDirectory.getPath(); - if (dir == null) { - return handleException(cause); - } - String dumpName = PathUtilities.sanitizeFileName(toString()); - File dumpPath = new File(dir, dumpName); - dumpPath.mkdirs(); - if (!dumpPath.exists()) { - TTY.println("Warning: could not create diagnostics directory " + dumpPath); - return handleException(cause); - } - - String message; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (PrintStream ps = new PrintStream(baos)) { - ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this); - cause.printStackTrace(ps); - ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n", - causeType, - actionKey.getName(), ExceptionAction.Silent, - actionKey.getName(), ExceptionAction.Silent); - ps.printf("To print a message for a compilation %s without retrying the compilation, " + - "set %s to %s (e.g., -Dgraal.%s=%s).%n", - causeType, - actionKey.getName(), ExceptionAction.Print, - actionKey.getName(), ExceptionAction.Print); - ps.println("Retrying compilation of " + this); - message = baos.toString(); - } - - synchronized (CompilationFailureAction) { - // Synchronize here to serialize retry compilations. This - // mitigates retry compilation storms. - TTY.println(message); + TTY.print(message); File retryLogFile = new File(dumpPath, "retry.log"); try (PrintStream ps = new PrintStream(new FileOutputStream(retryLogFile))) { ps.print(message); @@ -267,7 +270,7 @@ public abstract class CompilationWrapper { MethodFilter, null, DumpPath, dumpPath.getPath()); - try (DebugContext retryDebug = createRetryDebugContext(retryOptions)) { + try (DebugContext retryDebug = createRetryDebugContext(retryOptions); DebugCloseable s = retryDebug.disableIntercept()) { T res = performCompilation(retryDebug); maybeExitVM(action); return res; @@ -283,16 +286,8 @@ public abstract class CompilationWrapper { private void maybeExitVM(ExceptionAction action) { if (action == ExitVM) { - synchronized (ExceptionAction.class) { - try { - // Give other compiler threads a chance to flush - // error handling output. - ExceptionAction.class.wait(2000); - } catch (InterruptedException e) { - } - TTY.println("Exiting VM after retry compilation of " + this); - System.exit(-1); - } + TTY.println("Exiting VM after retry compilation of " + this); + System.exit(-1); } } @@ -303,22 +298,24 @@ public abstract class CompilationWrapper { private ExceptionAction adjustAction(OptionValues initialOptions, EnumOptionKey actionKey, ExceptionAction initialAction) { ExceptionAction action = initialAction; int maxProblems = MaxCompilationProblemsPerAction.getValue(initialOptions); - synchronized (problemsHandledPerAction) { - while (action != ExceptionAction.Silent) { - int problems = problemsHandledPerAction.getOrDefault(action, 0); - if (problems >= maxProblems) { - if (problems == maxProblems) { - TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", actionKey, action, action.quieter(), - MaxCompilationProblemsPerAction, maxProblems); - // Ensure that the message above is only printed once - problemsHandledPerAction.put(action, problems + 1); + if (action != ExceptionAction.ExitVM) { + synchronized (problemsHandledPerAction) { + while (action != ExceptionAction.Silent) { + int problems = problemsHandledPerAction.getOrDefault(action, 0); + if (problems >= maxProblems) { + if (problems == maxProblems) { + TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", actionKey, action, action.quieter(), + MaxCompilationProblemsPerAction, maxProblems); + // Ensure that the message above is only printed once + problemsHandledPerAction.put(action, problems + 1); + } + action = action.quieter(); + } else { + break; } - action = action.quieter(); - } else { - break; } + problemsHandledPerAction.put(action, problemsHandledPerAction.getOrDefault(action, 0) + 1); } - problemsHandledPerAction.put(action, problemsHandledPerAction.getOrDefault(action, 0) + 1); } return action; } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java index 19b7197c99c..f6c86539f68 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java @@ -50,7 +50,8 @@ public class GraalCompilerOptions { "The accepted values are the same as for CompilationBailoutAction.", type = OptionType.User) public static final EnumOptionKey CompilationFailureAction = new EnumOptionKey<>(ExceptionAction.Diagnose); @Option(help = "The maximum number of compilation failures or bailouts to handle with the action specified " + - "by CompilationFailureAction or CompilationBailoutAction before changing to a less verbose action.", type = OptionType.User) + "by CompilationFailureAction or CompilationBailoutAction before changing to a less verbose action. " + + "This does not apply to the ExitVM action.", type = OptionType.User) public static final OptionKey MaxCompilationProblemsPerAction = new OptionKey<>(2); @Option(help = "Alias for CompilationFailureAction=ExitVM.", type = OptionType.User) public static final OptionKey ExitVMOnException = new OptionKey<>(false); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java index 162814def96..12f4d6cd1ef 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java @@ -27,14 +27,16 @@ package org.graalvm.compiler.debug.test; import static org.graalvm.compiler.debug.DebugContext.NO_DESCRIPTION; import static org.graalvm.compiler.debug.DebugContext.NO_GLOBAL_METRIC_VALUES; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.io.PrintStream; import java.util.Arrays; import java.util.Collections; import java.util.Formatter; import java.util.List; +import java.util.stream.Collectors; import jdk.internal.vm.compiler.collections.EconomicMap; import org.graalvm.compiler.debug.Assertions; @@ -158,14 +160,13 @@ public class DebugContextTest { } } } - DataInputStream in = new DataInputStream(getClass().getResourceAsStream(getClass().getSimpleName() + ".testLogging.input")); - byte[] buf = new byte[in.available()]; - in.readFully(buf); - String threadLabel = "[thread:" + Thread.currentThread().getId() + "]"; - String expect = new String(buf).replace("[thread:1]", threadLabel); - - String log = setup.logOutput.toString(); - Assert.assertEquals(expect, log); + String expected; + try (BufferedReader input = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(getClass().getSimpleName() + ".testLogging.input")))) { + String threadLabel = "[thread:" + Thread.currentThread().getId() + "]"; + expected = input.lines().collect(Collectors.joining(System.lineSeparator(), "", System.lineSeparator())).replace("[thread:1]", threadLabel); + } + String logged = setup.logOutput.toString(); + Assert.assertEquals(expected, logged); } @Test diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java index 260914b207e..ae6dba54049 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java @@ -84,7 +84,10 @@ public class DiagnosticsOutputDirectory { } } } - return CLOSED.equals(path) ? null : path; + if (CLOSED.equals(path)) { + TTY.println("Warning: Graal diagnostic directory already closed"); + } + return path; } /** diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java index 759986746a5..d0ef6bb2525 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java @@ -24,8 +24,11 @@ package org.graalvm.compiler.debug; +import static java.nio.file.LinkOption.NOFOLLOW_LINKS; + import java.io.File; import java.io.IOException; +import java.nio.file.AccessDeniedException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.InvalidPathException; @@ -118,7 +121,15 @@ public class PathUtilities { if (createDirectory) { return Files.createDirectory(result); } else { - return Files.createFile(result); + try { + return Files.createFile(result); + } catch (AccessDeniedException e) { + /* + * Thrown on Windows if a directory with the same name already exists, so + * convert it to FileAlreadyExistsException if that's the case. + */ + throw Files.isDirectory(result, NOFOLLOW_LINKS) ? new FileAlreadyExistsException(e.getFile()) : e; + } } } catch (FileAlreadyExistsException e) { uniqueTag = "_" + dumpCounter++; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java index e0f23825747..87d42c47441 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java @@ -54,11 +54,13 @@ public class CompilationWrapperTest extends GraalCompilerTest { */ @Test public void testVMCompilation1() throws IOException, InterruptedException { - testHelper(Collections.emptyList(), Arrays.asList("-XX:+BootstrapJVMCI", + testHelper(Collections.emptyList(), Arrays.asList("-XX:-TieredCompilation", "-XX:+UseJVMCICompiler", "-Dgraal.CompilationFailureAction=ExitVM", - "-Dgraal.CrashAt=Object.*,String.*", - "-version")); + "-Dgraal.CrashAt=TestProgram.*", + "-Xcomp", + "-XX:CompileCommand=compileonly,*/TestProgram.print*", + TestProgram.class.getName())); } /** @@ -67,11 +69,13 @@ public class CompilationWrapperTest extends GraalCompilerTest { */ @Test public void testVMCompilation2() throws IOException, InterruptedException { - testHelper(Collections.emptyList(), Arrays.asList("-XX:+BootstrapJVMCI", + testHelper(Collections.emptyList(), Arrays.asList("-XX:-TieredCompilation", "-XX:+UseJVMCICompiler", "-Dgraal.ExitVMOnException=true", - "-Dgraal.CrashAt=Object.*,String.*", - "-version")); + "-Dgraal.CrashAt=TestProgram.*", + "-Xcomp", + "-XX:CompileCommand=compileonly,*/TestProgram.print*", + TestProgram.class.getName())); } static class Probe { @@ -105,23 +109,36 @@ public class CompilationWrapperTest extends GraalCompilerTest { */ @Test public void testVMCompilation3() throws IOException, InterruptedException { - final int maxProblems = 4; - Probe[] probes = { - new Probe("Retrying compilation of", maxProblems) { - @Override - String test() { - return actualOccurrences > 0 && actualOccurrences <= maxProblems ? null : String.format("expected occurrences to be in [1 .. %d]", maxProblems); - } - }, - new Probe("adjusting CompilationFailureAction from Diagnose to Print", 1), - new Probe("adjusting CompilationFailureAction from Print to Silent", 1), + final int maxProblems = 2; + Probe retryingProbe = new Probe("Retrying compilation of", maxProblems) { + @Override + String test() { + return actualOccurrences > 0 && actualOccurrences <= maxProblems ? null : String.format("expected occurrences to be in [1 .. %d]", maxProblems); + } }; - testHelper(Arrays.asList(probes), Arrays.asList("-XX:+BootstrapJVMCI", + Probe adjustmentProbe = new Probe("adjusting CompilationFailureAction from Diagnose to Print", 1) { + @Override + String test() { + if (retryingProbe.actualOccurrences >= maxProblems) { + if (actualOccurrences == 0) { + return "expected at least one occurrence"; + } + } + return null; + } + }; + Probe[] probes = { + retryingProbe, + adjustmentProbe + }; + testHelper(Arrays.asList(probes), Arrays.asList("-XX:-TieredCompilation", "-XX:+UseJVMCICompiler", "-Dgraal.CompilationFailureAction=Diagnose", "-Dgraal.MaxCompilationProblemsPerAction=" + maxProblems, - "-Dgraal.CrashAt=Object.*,String.*", - "-version")); + "-Dgraal.CrashAt=TestProgram.*", + "-Xcomp", + "-XX:CompileCommand=compileonly,*/TestProgram.print*", + TestProgram.class.getName())); } /** @@ -246,3 +263,38 @@ public class CompilationWrapperTest extends GraalCompilerTest { } } } + +class TestProgram { + public static void main(String[] args) { + printHello1(); + printWorld1(); + printHello2(); + printWorld2(); + printHello3(); + printWorld3(); + } + + private static void printHello1() { + System.out.println("Hello1"); + } + + private static void printWorld1() { + System.out.println("World1"); + } + + private static void printHello2() { + System.out.println("Hello2"); + } + + private static void printWorld2() { + System.out.println("World2"); + } + + private static void printHello3() { + System.out.println("Hello3"); + } + + private static void printWorld3() { + System.out.println("World3"); + } +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java index 8a6759859ca..e7cf2cfec1c 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java @@ -28,9 +28,6 @@ import org.graalvm.compiler.api.directives.GraalDirectives; import org.junit.Assert; import org.junit.Test; -import jdk.vm.ci.meta.ProfilingInfo; -import jdk.vm.ci.meta.ResolvedJavaMethod; - /** * Test on-stack-replacement with Graal. The test manually triggers a Graal OSR-compilation which is * later invoked when hitting the backedge counter overflow. @@ -103,58 +100,4 @@ public class GraalOSRTest extends GraalOSRTestBase { GraalDirectives.controlFlowAnchor(); return ret; } - - @Test - public void testOSR04() { - testFunnyOSR("testDoWhile", GraalOSRTest::testDoWhile); - } - - @Test - public void testOSR05() { - testFunnyOSR("testDoWhileLocked", GraalOSRTest::testDoWhileLocked); - } - - /** - * Because of a bug in C1 profile collection HotSpot can sometimes request an OSR compilation - * for a backedge which isn't ever taken. This test synthetically creates that situation. - */ - private void testFunnyOSR(String name, Runnable warmup) { - ResolvedJavaMethod method = getResolvedJavaMethod(name); - int iterations = 0; - while (true) { - ProfilingInfo profilingInfo = method.getProfilingInfo(); - if (profilingInfo.isMature()) { - break; - } - - warmup.run(); - if (iterations++ % 1000 == 0) { - System.err.print('.'); - } - if (iterations > 200000) { - throw new AssertionError("no profile"); - } - } - compileOSR(getInitialOptions(), method); - Result result = executeExpected(method, null); - checkResult(result); - } - - private static boolean repeatLoop; - - public static ReturnValue testDoWhile() { - do { - sideEffect++; - } while (repeatLoop); - return ReturnValue.SUCCESS; - } - - public static synchronized ReturnValue testDoWhileLocked() { - // synchronized (GraalOSRTest.class) { - do { - sideEffect++; - } while (repeatLoop); - // } - return ReturnValue.SUCCESS; - } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java index 184f2080945..3b93165dce1 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java @@ -358,14 +358,17 @@ public class HotSpotGraalManagementTest { assertNotNull("Info is found", info); final MBeanOperationInfo[] arr = info.getOperations(); - assertEquals("Currently three overloads", 3, arr.length); MBeanOperationInfo dumpOp = null; + int dumpMethodCount = 0; for (int i = 0; i < arr.length; i++) { - assertEquals("dumpMethod", arr[i].getName()); - if (arr[i].getSignature().length == 3) { - dumpOp = arr[i]; + if ("dumpMethod".equals(arr[i].getName())) { + if (arr[i].getSignature().length == 3) { + dumpOp = arr[i]; + } + dumpMethodCount++; } } + assertEquals("Currently three overloads", 3, dumpMethodCount); assertNotNull("three args variant (as used by VisualVM) found", dumpOp); MBeanAttributeInfo dumpPath = findAttributeInfo("DumpPath", info); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java index 30603ed5156..3ffa610a363 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java @@ -26,6 +26,10 @@ package org.graalvm.compiler.hotspot; import java.util.EnumSet; +import jdk.internal.vm.compiler.collections.EconomicMap; +import jdk.internal.vm.compiler.collections.EconomicSet; +import jdk.internal.vm.compiler.collections.Equivalence; +import jdk.internal.vm.compiler.collections.MapCursor; import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; @@ -66,10 +70,6 @@ import org.graalvm.compiler.options.OptionType; import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.phases.tiers.SuitesProvider; import org.graalvm.compiler.word.Word; -import jdk.internal.vm.compiler.collections.EconomicMap; -import jdk.internal.vm.compiler.collections.EconomicSet; -import jdk.internal.vm.compiler.collections.Equivalence; -import jdk.internal.vm.compiler.collections.MapCursor; import jdk.internal.vm.compiler.word.Pointer; import jdk.vm.ci.code.CompilationRequest; @@ -286,7 +286,7 @@ public abstract class HotSpotBackend extends Backend implements FrameMap.Referen /** * New array stub. */ - public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class, boolean.class); + public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class); /** * New instance stub. diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java index 06b6a9113cd..98d634c7957 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java @@ -227,6 +227,7 @@ public class HotSpotGraalCompiler implements GraalJVMCICompiler { method(substMethod). compilationId(compilationId). recordInlinedMethods(bytecodeProvider.shouldRecordMethodDependencies()). + setIsSubstitution(true). build(); // @formatter:on try (DebugContext.Scope scope = debug.scope("GetIntrinsicGraph", graph)) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java index ab3edfac663..1bd00c65944 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java @@ -93,7 +93,8 @@ public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvid DiagnosticsOutputDirectory getOutputDirectory(); /** - * Gets the map used to count compilation problems at each {@link ExceptionAction} level. + * Gets the map used to count compilation problems at each {@link ExceptionAction} level. All + * updates and queries to the map should be synchronized. */ Map getCompilationProblemsPerAction(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java index 0876f824a89..7b9f45761b7 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java @@ -131,7 +131,7 @@ class JVMCIVersionCheck { return; } } else { - // Graal is compatible with all JDK versions as of 9 GA. + // Graal is compatible with all JDK versions as of 11 GA. } } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java index 6ae3d1b3021..4afc1f71c02 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java @@ -85,8 +85,6 @@ import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1W import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPRECALL; import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.VALIDATE_OBJECT; import static org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub.EXCEPTION_HANDLER_FOR_PC; -import static org.graalvm.compiler.hotspot.stubs.NewArrayStub.NEW_ARRAY_C; -import static org.graalvm.compiler.hotspot.stubs.NewInstanceStub.NEW_INSTANCE_C; import static org.graalvm.compiler.hotspot.stubs.StubUtil.VM_MESSAGE_C; import static org.graalvm.compiler.hotspot.stubs.UnwindExceptionToCallerStub.EXCEPTION_HANDLER_FOR_RETURN_ADDRESS; import static org.graalvm.compiler.nodes.java.ForeignCallDescriptors.REGISTER_FINALIZER; @@ -119,8 +117,6 @@ import org.graalvm.compiler.hotspot.stubs.DivisionByZeroExceptionStub; import org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub; import org.graalvm.compiler.hotspot.stubs.IntegerExactOverflowExceptionStub; import org.graalvm.compiler.hotspot.stubs.LongExactOverflowExceptionStub; -import org.graalvm.compiler.hotspot.stubs.NewArrayStub; -import org.graalvm.compiler.hotspot.stubs.NewInstanceStub; import org.graalvm.compiler.hotspot.stubs.NullPointerExceptionStub; import org.graalvm.compiler.hotspot.stubs.OutOfBoundsExceptionStub; import org.graalvm.compiler.hotspot.stubs.Stub; @@ -280,8 +276,6 @@ public abstract class HotSpotHostForeignCallsProvider extends HotSpotForeignCall registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any()); registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any()); - registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any()); - registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any()); CreateExceptionStub.registerForeignCalls(c, this); @@ -292,8 +286,8 @@ public abstract class HotSpotHostForeignCallsProvider extends HotSpotForeignCall registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS); registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); - link(new NewInstanceStub(options, providers, registerStubCall(NEW_INSTANCE, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION))); - link(new NewArrayStub(options, providers, registerStubCall(NEW_ARRAY, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION))); + 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); 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))); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java index 615449fde81..a7946c78b8f 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java @@ -331,14 +331,14 @@ public class NewObjectSnippets implements Snippets { } result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters); } else { - result = newArray(HotSpotBackend.NEW_ARRAY, hub, length, fillContents); + result = newArray(HotSpotBackend.NEW_ARRAY, 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, boolean fillContents); + 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); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java deleted file mode 100644 index 42615bc3fcf..00000000000 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2012, 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 org.graalvm.compiler.hotspot.stubs; - -import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeMask; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeShift; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeMask; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeShift; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperLog2ElementSizeMask; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperLog2ElementSizeShift; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readLayoutHelper; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.handlePendingException; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject; - -import org.graalvm.compiler.api.replacements.Fold; -import org.graalvm.compiler.api.replacements.Snippet; -import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; -import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; -import org.graalvm.compiler.graph.Node.ConstantNodeParameter; -import org.graalvm.compiler.graph.Node.NodeIntrinsic; -import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage; -import org.graalvm.compiler.hotspot.meta.HotSpotProviders; -import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode; -import org.graalvm.compiler.hotspot.replacements.NewObjectSnippets; -import org.graalvm.compiler.hotspot.word.KlassPointer; -import org.graalvm.compiler.options.OptionValues; -import org.graalvm.compiler.word.Word; - -import jdk.vm.ci.code.Register; - -/** - * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is - * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails. - * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++ - * runtime to complete the allocation. - */ -public class NewArrayStub extends SnippetStub { - - public NewArrayStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) { - super("newArray", options, providers, linkage); - } - - @Override - protected Object[] makeConstArgs() { - int count = method.getSignature().getParameterCount(false); - Object[] args = new Object[count]; - assert checkConstArg(2, "threadRegister"); - assert checkConstArg(3, "options"); - args[2] = providers.getRegisters().getThreadRegister(); - args[3] = options; - return args; - } - - @Fold - static boolean logging(OptionValues options) { - return StubOptions.TraceNewArrayStub.getValue(options); - } - - /** - * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to - * -XX:-UseTLAB). - * - * @param hub the hub of the object to be allocated - * @param length the length of the array - */ - @Snippet - private static Object newArray(KlassPointer hub, int length, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options) { - int layoutHelper = readLayoutHelper(hub); - int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift(INJECTED_VMCONFIG)) & layoutHelperLog2ElementSizeMask(INJECTED_VMCONFIG); - int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift(INJECTED_VMCONFIG)) & layoutHelperHeaderSizeMask(INJECTED_VMCONFIG); - int elementKind = (layoutHelper >> layoutHelperElementTypeShift(INJECTED_VMCONFIG)) & layoutHelperElementTypeMask(INJECTED_VMCONFIG); - int sizeInBytes = arrayAllocationSize(length, headerSize, log2ElementSize); - if (logging(options)) { - printf("newArray: element kind %d\n", elementKind); - printf("newArray: array length %d\n", length); - printf("newArray: array size %d\n", sizeInBytes); - printf("newArray: hub=%p\n", hub.asWord().rawValue()); - } - - Word thread = registerAsWord(threadRegister); - if (logging(options)) { - printf("newArray: calling new_array_c\n"); - } - - newArrayC(NEW_ARRAY_C, thread, hub, length); - handlePendingException(thread, true, true); - return verifyObject(getAndClearObjectResult(thread)); - } - - public static final ForeignCallDescriptor NEW_ARRAY_C = newDescriptor(NewArrayStub.class, "newArrayC", void.class, Word.class, KlassPointer.class, int.class); - - @NodeIntrinsic(StubForeignCallNode.class) - public static native void newArrayC(@ConstantNodeParameter ForeignCallDescriptor newArrayC, Word thread, KlassPointer hub, int length); -} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java deleted file mode 100644 index 6ea9edaa869..00000000000 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012, 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 org.graalvm.compiler.hotspot.stubs; - -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult; -import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.handlePendingException; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf; -import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject; - -import org.graalvm.compiler.api.replacements.Fold; -import org.graalvm.compiler.api.replacements.Snippet; -import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; -import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; -import org.graalvm.compiler.graph.Node.ConstantNodeParameter; -import org.graalvm.compiler.graph.Node.NodeIntrinsic; -import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage; -import org.graalvm.compiler.hotspot.meta.HotSpotProviders; -import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode; -import org.graalvm.compiler.hotspot.replacements.NewObjectSnippets; -import org.graalvm.compiler.hotspot.word.KlassPointer; -import org.graalvm.compiler.options.OptionValues; -import org.graalvm.compiler.word.Word; - -import jdk.vm.ci.code.Register; - -/** - * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is - * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails. - * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++ - * runtime for to complete the allocation. - */ -public class NewInstanceStub extends SnippetStub { - - public NewInstanceStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) { - super("newInstance", options, providers, linkage); - } - - @Override - protected Object[] makeConstArgs() { - int count = method.getSignature().getParameterCount(false); - Object[] args = new Object[count]; - assert checkConstArg(1, "threadRegister"); - assert checkConstArg(2, "options"); - args[1] = providers.getRegisters().getThreadRegister(); - args[2] = options; - return args; - } - - @Fold - static boolean logging(OptionValues options) { - return StubOptions.TraceNewInstanceStub.getValue(options); - } - - /** - * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to - * -XX:-UseTLAB). - * - * @param hub the hub of the object to be allocated - */ - @Snippet - private static Object newInstance(KlassPointer hub, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options) { - /* - * The type is known to be an instance so Klass::_layout_helper is the instance size as a - * raw number - */ - Word thread = registerAsWord(threadRegister); - if (logging(options)) { - printf("newInstance: calling new_instance_c\n"); - } - - newInstanceC(NEW_INSTANCE_C, thread, hub); - handlePendingException(thread, true, true); - return verifyObject(getAndClearObjectResult(thread)); - } - - @Fold - static boolean forceSlowPath(OptionValues options) { - return StubOptions.ForceUseOfNewInstanceStub.getValue(options); - } - - public static final ForeignCallDescriptor NEW_INSTANCE_C = newDescriptor(NewInstanceStub.class, "newInstanceC", void.class, Word.class, KlassPointer.class); - - @NodeIntrinsic(StubForeignCallNode.class) - public static native void newInstanceC(@ConstantNodeParameter ForeignCallDescriptor newInstanceC, Word thread, KlassPointer hub); -} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java index f680188ac94..0ed4d5a3530 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java @@ -107,9 +107,15 @@ public abstract class SnippetStub extends Stub implements Snippets { plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(makeConstArgs(), metaAccess, snippetReflection)); GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins); + // @formatter:off // Stubs cannot have optimistic assumptions since they have // to be valid for the entire run of the VM. - final StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).compilationId(compilationId).build(); + final StructuredGraph graph = new StructuredGraph.Builder(options, debug). + method(method). + compilationId(compilationId). + setIsSubstitution(true). + build(); + // @formatter:on try (DebugContext.Scope outer = debug.scope("SnippetStub", graph)) { graph.disableUnsafeAccessTracking(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java index 2d56364f171..bae8b7b9eb0 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java @@ -25,8 +25,8 @@ package org.graalvm.compiler.hotspot.stubs; import org.graalvm.compiler.options.Option; -import org.graalvm.compiler.options.OptionType; import org.graalvm.compiler.options.OptionKey; +import org.graalvm.compiler.options.OptionType; //JaCoCo Exclude @@ -43,14 +43,5 @@ public class StubOptions { @Option(help = "Trace execution of the stub that routes an exception to a handler in the calling frame.", type = OptionType.Debug) static final OptionKey TraceUnwindStub = new OptionKey<>(false); - - @Option(help = "Trace execution of slow path stub for array allocation.", type = OptionType.Debug) - static final OptionKey TraceNewArrayStub = new OptionKey<>(false); - - @Option(help = "Trace execution of slow path stub for non-array object allocation.", type = OptionType.Debug) - static final OptionKey TraceNewInstanceStub = new OptionKey<>(false); - - @Option(help = "Force non-array object allocation to always use the slow path.", type = OptionType.Debug) - static final OptionKey ForceUseOfNewInstanceStub = new OptionKey<>(false); //@formatter:on } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java index 4ea669ab235..08c112ead14 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java @@ -26,6 +26,7 @@ package org.graalvm.compiler.java; import static org.graalvm.compiler.bytecode.Bytecodes.AALOAD; import static org.graalvm.compiler.bytecode.Bytecodes.AASTORE; +import static org.graalvm.compiler.bytecode.Bytecodes.ANEWARRAY; import static org.graalvm.compiler.bytecode.Bytecodes.ARETURN; import static org.graalvm.compiler.bytecode.Bytecodes.ARRAYLENGTH; import static org.graalvm.compiler.bytecode.Bytecodes.ATHROW; @@ -78,6 +79,8 @@ import static org.graalvm.compiler.bytecode.Bytecodes.LDIV; import static org.graalvm.compiler.bytecode.Bytecodes.LOOKUPSWITCH; import static org.graalvm.compiler.bytecode.Bytecodes.LREM; import static org.graalvm.compiler.bytecode.Bytecodes.LRETURN; +import static org.graalvm.compiler.bytecode.Bytecodes.MULTIANEWARRAY; +import static org.graalvm.compiler.bytecode.Bytecodes.NEW; import static org.graalvm.compiler.bytecode.Bytecodes.PUTFIELD; import static org.graalvm.compiler.bytecode.Bytecodes.PUTSTATIC; import static org.graalvm.compiler.bytecode.Bytecodes.RET; @@ -679,10 +682,19 @@ public final class BciBlockMapping { case SALOAD: case ARRAYLENGTH: case CHECKCAST: + case NEW: + case ANEWARRAY: + case MULTIANEWARRAY: case PUTSTATIC: case GETSTATIC: case PUTFIELD: case GETFIELD: { + /* + * All bytecodes that can trigger lazy class initialization via a + * ClassInitializationPlugin (allocations, static field access) must be listed + * because the class initializer is allowed to throw an exception, which + * requires proper exception handling. + */ ExceptionDispatchBlock handler = handleExceptions(blockMap, bci); if (handler != null) { current = null; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java index 0cb8fcc6d3b..a64c75a39f9 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java @@ -3369,29 +3369,25 @@ public class BytecodeParser implements GraphBuilderContext { NodeSourcePosition currentPosition = graph.currentNodeSourcePosition(); if (isNeverExecutedCode(probability)) { - if (!graph.isOSR() || getParent() != null || graph.getEntryBCI() != trueBlock.startBci) { - NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition() - ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), falseBlock.startBci) - : null; - append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true, survivingSuccessorPosition)); - if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) { - profilingPlugin.profileGoto(this, method, bci(), falseBlock.startBci, stateBefore); - } - appendGoto(falseBlock); - return; + NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition() + ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), falseBlock.startBci) + : null; + append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true, survivingSuccessorPosition)); + if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) { + profilingPlugin.profileGoto(this, method, bci(), falseBlock.startBci, stateBefore); } + appendGoto(falseBlock); + return; } else if (isNeverExecutedCode(1 - probability)) { - if (!graph.isOSR() || getParent() != null || graph.getEntryBCI() != falseBlock.startBci) { - NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition() - ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), trueBlock.startBci) - : null; - append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false, survivingSuccessorPosition)); - if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) { - profilingPlugin.profileGoto(this, method, bci(), trueBlock.startBci, stateBefore); - } - appendGoto(trueBlock); - return; + NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition() + ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), trueBlock.startBci) + : null; + append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false, survivingSuccessorPosition)); + if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) { + profilingPlugin.profileGoto(this, method, bci(), trueBlock.startBci, stateBefore); } + appendGoto(trueBlock); + return; } if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) { @@ -4116,6 +4112,11 @@ public class BytecodeParser implements GraphBuilderContext { return; } ResolvedJavaType resolvedType = (ResolvedJavaType) type; + if (resolvedType.isAbstract() || resolvedType.isInterface()) { + handleUnresolvedNewInstance(type); + return; + } + ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin(); if (!resolvedType.isInitialized() && classInitializationPlugin == null) { handleUnresolvedNewInstance(type); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java index 6566148ed4e..b3e334c8580 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java @@ -436,7 +436,12 @@ public class GraphEncoder { @SuppressWarnings("try") public static boolean verifyEncoding(StructuredGraph originalGraph, EncodedGraph encodedGraph, Architecture architecture) { DebugContext debug = originalGraph.getDebug(); - StructuredGraph decodedGraph = new StructuredGraph.Builder(originalGraph.getOptions(), debug, AllowAssumptions.YES).method(originalGraph.method()).build(); + // @formatter:off + StructuredGraph decodedGraph = new StructuredGraph.Builder(originalGraph.getOptions(), debug, AllowAssumptions.YES). + method(originalGraph.method()). + setIsSubstitution(originalGraph.isSubstitution()). + build(); + // @formatter:off if (originalGraph.trackNodeSourcePosition()) { decodedGraph.setTrackNodeSourcePosition(); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java index 23cd70175c0..aabebe46569 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java @@ -40,6 +40,8 @@ import jdk.internal.vm.compiler.collections.EconomicMap; import jdk.internal.vm.compiler.collections.EconomicSet; import jdk.internal.vm.compiler.collections.Equivalence; import jdk.internal.vm.compiler.collections.UnmodifiableEconomicMap; +import org.graalvm.compiler.api.replacements.MethodSubstitution; +import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.core.common.CancellationBailoutException; import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.GraalOptions; @@ -187,6 +189,7 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { private Cancellable cancellable = null; private final DebugContext debug; private NodeSourcePosition callerContext; + private boolean isSubstitution; /** * Creates a builder for a graph. @@ -217,6 +220,14 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { return this; } + /** + * @see StructuredGraph#isSubstitution + */ + public Builder setIsSubstitution(boolean flag) { + this.isSubstitution = flag; + return this; + } + public ResolvedJavaMethod getMethod() { return rootMethod; } @@ -303,8 +314,22 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { public StructuredGraph build() { List inlinedMethods = recordInlinedMethods ? new ArrayList<>() : null; - return new StructuredGraph(name, rootMethod, entryBCI, assumptions, speculationLog, useProfilingInfo, inlinedMethods, - trackNodeSourcePosition, compilationId, options, debug, cancellable, callerContext); + // @formatter:off + return new StructuredGraph(name, + rootMethod, + entryBCI, + assumptions, + speculationLog, + useProfilingInfo, + isSubstitution, + inlinedMethods, + trackNodeSourcePosition, + compilationId, + options, + debug, + cancellable, + callerContext); + // @formatter:on } } @@ -323,6 +348,8 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { private boolean isAfterExpandLogic = false; private final boolean useProfilingInfo; private final Cancellable cancellable; + private final boolean isSubstitution; + /** * The assumptions made while constructing and transforming this graph. */ @@ -369,6 +396,7 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { Assumptions assumptions, SpeculationLog speculationLog, boolean useProfilingInfo, + boolean isSubstitution, List methods, SourcePositionTracking trackNodeSourcePosition, CompilationIdentifier compilationId, @@ -386,6 +414,8 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { this.methods = methods; this.speculationLog = speculationLog; this.useProfilingInfo = useProfilingInfo; + this.isSubstitution = isSubstitution; + assert checkIsSubstitutionInvariants(method, isSubstitution); this.trackNodeSourcePosition = trackNodeSourcePosition; assert trackNodeSourcePosition != null; this.cancellable = cancellable; @@ -393,6 +423,18 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { this.callerContext = context; } + private static boolean checkIsSubstitutionInvariants(ResolvedJavaMethod method, boolean isSubstitution) { + if (method != null) { + if (method.getAnnotation(Snippet.class) != null || method.getAnnotation(MethodSubstitution.class) != null) { + assert isSubstitution : "Graph for method " + method.format("%H.%n(%p)") + + " annotated by " + Snippet.class.getName() + " or " + + MethodSubstitution.class.getName() + + " must have its `isSubstitution` field set to true"; + } + } + return true; + } + public void setLastSchedule(ScheduleResult result) { lastSchedule = result; } @@ -535,6 +577,7 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { assumptions == null ? null : new Assumptions(), speculationLog, useProfilingInfo, + isSubstitution, methods != null ? new ArrayList<>(methods) : null, trackNodeSourcePosition, newCompilationId, @@ -858,6 +901,15 @@ public final class StructuredGraph extends Graph implements JavaMethodContext { return useProfilingInfo; } + /** + * Returns true if this graph is built without parsing the {@linkplain #method() root method} or + * if the root method is annotated by {@link Snippet} or {@link MethodSubstitution}. This is + * preferred over querying annotations directly as querying annotations can cause class loading. + */ + public boolean isSubstitution() { + return isSubstitution; + } + /** * Gets the profiling info for the {@linkplain #method() root method} of this graph. */ diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java index 690060feac3..4f1dad75ab8 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java @@ -61,7 +61,7 @@ import jdk.vm.ci.meta.TriState; public class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtualizable { public static final NodeClass TYPE = NodeClass.create(InstanceOfNode.class); - private ObjectStamp checkedStamp; + private final ObjectStamp checkedStamp; private JavaTypeProfile profile; @OptionalInput(Anchor) protected AnchoringNode anchor; @@ -77,6 +77,7 @@ public class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtu this.anchor = anchor; assert (profile == null) || (anchor != null) : "profiles must be anchored"; assert checkedStamp != null; + assert type() != null; } public static LogicNode createAllowNull(TypeReference type, ValueNode object, JavaTypeProfile profile, AnchoringNode anchor) { @@ -217,11 +218,6 @@ public class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtu return checkedStamp; } - public void strengthenCheckedStamp(ObjectStamp newCheckedStamp) { - assert this.checkedStamp.join(newCheckedStamp).equals(newCheckedStamp) : "stamp can only improve"; - this.checkedStamp = newCheckedStamp; - } - @Override public TriState implies(boolean thisNegated, LogicNode other) { if (other instanceof InstanceOfNode) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java index a31c87a7f34..d6c8e9f2621 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java @@ -60,7 +60,7 @@ public class NewInstanceNode extends AbstractNewObjectNode implements Virtualiza protected NewInstanceNode(NodeClass c, ResolvedJavaType type, boolean fillContents, FrameState stateBefore) { super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)), fillContents, stateBefore); - assert !type.isArray() && !type.isInterface() && !type.isPrimitive(); + assert !type.isArray() && !type.isInterface() && !type.isPrimitive() && !type.isAbstract(); this.instanceClass = type; } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java index 04c1b57f3c5..a03cfa60d4c 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java @@ -98,7 +98,7 @@ public final class StoreIndexedNode extends AccessIndexedNode implements StateSp VirtualArrayNode virtual = (VirtualArrayNode) alias; if (idx >= 0 && idx < virtual.entryCount()) { ResolvedJavaType componentType = virtual.type().getComponentType(); - if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null || + if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.isJavaLangObject() || (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) { tool.setVirtualEntry(virtual, idx, value()); tool.delete(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java index 98cd5d6e0fa..c44ddd71431 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java @@ -32,7 +32,6 @@ import java.util.ServiceLoader; import jdk.internal.vm.compiler.collections.EconomicMap; import jdk.internal.vm.compiler.collections.MapCursor; -import org.graalvm.util.CollectionsUtil; /** * This class contains methods for parsing Graal options and matching them against a set of @@ -45,20 +44,21 @@ public class OptionsParser { * {@link OptionDescriptors} providers. */ public static Iterable getOptionsLoader() { - ServiceLoader graalLoader = ServiceLoader.load(OptionDescriptors.class, OptionDescriptors.class.getClassLoader()); boolean java8OrEarlier = System.getProperty("java.specification.version").compareTo("1.9") < 0; + ClassLoader loader; if (java8OrEarlier) { - return graalLoader; + // On JDK 8, Graal and its extensions are loaded by same class loader. + loader = OptionDescriptors.class.getClassLoader(); } else { /* * The Graal module (i.e., jdk.internal.vm.compiler) is loaded by the platform class - * loader on JDK 9. Other modules that extend Graal or are Graal dependencies (such as - * Truffle) are supplied via --module-path which means they are loaded by the app class - * loader. As such, we need to search the app class loader path as well. + * loader as of JDK 9. Modules that depend on and extend Graal are loaded by the app + * class loader. As such, we need to start the provider search at the app class loader + * instead of the platform class loader. */ - ServiceLoader truffleLoader = ServiceLoader.load(OptionDescriptors.class, ClassLoader.getSystemClassLoader()); - return CollectionsUtil.concat(graalLoader, truffleLoader); + loader = ClassLoader.getSystemClassLoader(); } + return ServiceLoader.load(OptionDescriptors.class, loader); } /** diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java index 4c8bd748264..d6c0bd4c456 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java @@ -56,7 +56,6 @@ import org.graalvm.compiler.nodes.AbstractBeginNode; import org.graalvm.compiler.nodes.AbstractMergeNode; import org.graalvm.compiler.nodes.BinaryOpLogicNode; import org.graalvm.compiler.nodes.ConditionAnchorNode; -import org.graalvm.compiler.nodes.DeoptimizeNode; import org.graalvm.compiler.nodes.DeoptimizingGuard; import org.graalvm.compiler.nodes.EndNode; import org.graalvm.compiler.nodes.FixedGuardNode; @@ -64,6 +63,7 @@ import org.graalvm.compiler.nodes.FixedNode; import org.graalvm.compiler.nodes.FixedWithNextNode; import org.graalvm.compiler.nodes.GuardNode; import org.graalvm.compiler.nodes.IfNode; +import org.graalvm.compiler.nodes.LogicConstantNode; import org.graalvm.compiler.nodes.LogicNode; import org.graalvm.compiler.nodes.LoopExitNode; import org.graalvm.compiler.nodes.MergeNode; @@ -335,11 +335,18 @@ public class ConditionalEliminationPhase extends BasePhase { if (result != node.isNegated()) { node.replaceAndDelete(guard.asNode()); } else { - DeoptimizeNode deopt = node.graph().add(new DeoptimizeNode(node.getAction(), node.getReason(), node.getSpeculation())); + /* + * Don't kill this branch immediately because `killCFG` can have complex + * implications in the presence of loops: it might replace or delete nodes in + * other branches or even above the kill point. Instead of killing immediately, + * just leave the graph in a state that is easy to simplify by a subsequent + * canonicalizer phase. + */ + FixedGuardNode deopt = new FixedGuardNode(LogicConstantNode.forBoolean(result, node.graph()), node.getReason(), node.getAction(), node.getSpeculation(), node.isNegated(), + node.getNodeSourcePosition()); AbstractBeginNode beginNode = (AbstractBeginNode) node.getAnchor(); - FixedNode next = beginNode.next(); - beginNode.setNext(deopt); - GraphUtil.killCFG(next); + graph.addAfterFixed(beginNode, node.graph().add(deopt)); + } return true; })) { @@ -354,10 +361,8 @@ public class ConditionalEliminationPhase extends BasePhase { GraphUtil.unlinkFixedNode(node); GraphUtil.killWithUnusedFloatingInputs(node); } else { - DeoptimizeNode deopt = node.graph().add(new DeoptimizeNode(node.getAction(), node.getReason(), node.getSpeculation())); - deopt.setStateBefore(node.stateBefore()); - node.replaceAtPredecessor(deopt); - GraphUtil.killCFG(node); + node.setCondition(LogicConstantNode.forBoolean(result, node.graph()), node.isNegated()); + // Don't kill this branch immediately, see `processGuard`. } debug.log("Kill fixed guard guard"); return true; @@ -368,11 +373,10 @@ public class ConditionalEliminationPhase extends BasePhase { protected void processIf(IfNode node) { tryProveCondition(node.condition(), (guard, result, guardedValueStamp, newInput) -> { + node.setCondition(LogicConstantNode.forBoolean(result, node.graph())); AbstractBeginNode survivingSuccessor = node.getSuccessor(result); survivingSuccessor.replaceAtUsages(InputType.Guard, guard.asNode()); - survivingSuccessor.replaceAtPredecessor(null); - node.replaceAtPredecessor(survivingSuccessor); - GraphUtil.killCFG(node); + // Don't kill the other branch immediately, see `processGuard`. counterIfsKilled.increment(debug); return true; }); @@ -524,8 +528,7 @@ public class ConditionalEliminationPhase extends BasePhase { if (input == null) { input = valueAt; } - ValueNode valueNode = graph.maybeAddOrUnique(PiNode.create(input, curBestStamp, (ValueNode) infoElement.guard)); - valueAt = valueNode; + valueAt = graph.maybeAddOrUnique(PiNode.create(input, curBestStamp, (ValueNode) infoElement.guard)); } newPhi.addInput(valueAt); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java index 12414a8b205..ed9be9f4040 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java @@ -41,7 +41,6 @@ import jdk.internal.vm.compiler.collections.Equivalence; import jdk.internal.vm.compiler.collections.UnmodifiableEconomicMap; import jdk.internal.vm.compiler.collections.UnmodifiableMapCursor; import org.graalvm.compiler.api.replacements.MethodSubstitution; -import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.core.common.GraalOptions; import org.graalvm.compiler.core.common.type.Stamp; import org.graalvm.compiler.core.common.type.StampFactory; @@ -674,12 +673,12 @@ public class InliningUtil extends ValueMergeUtil { @SuppressWarnings("try") private static void updateSourcePositions(Invoke invoke, StructuredGraph inlineGraph, UnmodifiableEconomicMap duplicates, boolean isSub, Mark mark) { FixedNode invokeNode = invoke.asNode(); - boolean isSubstitution = isSub || inlineGraph.method().getAnnotation(MethodSubstitution.class) != null || inlineGraph.method().getAnnotation(Snippet.class) != null; StructuredGraph invokeGraph = invokeNode.graph(); - assert !invokeGraph.trackNodeSourcePosition() || inlineGraph.trackNodeSourcePosition() || - isSubstitution : String.format("trackNodeSourcePosition mismatch %s %s != %s %s", invokeGraph, invokeGraph.trackNodeSourcePosition(), inlineGraph, - inlineGraph.trackNodeSourcePosition()); if (invokeGraph.trackNodeSourcePosition() && invoke.stateAfter() != null) { + boolean isSubstitution = isSub || inlineGraph.isSubstitution(); + assert !invokeGraph.trackNodeSourcePosition() || inlineGraph.trackNodeSourcePosition() || + isSubstitution : String.format("trackNodeSourcePosition mismatch %s %s != %s %s", invokeGraph, invokeGraph.trackNodeSourcePosition(), inlineGraph, + inlineGraph.trackNodeSourcePosition()); final NodeSourcePosition invokePos = invoke.asNode().getNodeSourcePosition(); updateSourcePosition(invokeGraph, duplicates, mark, invokePos, isSubstitution); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/jmx/HotSpotMBeanOperationProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/jmx/HotSpotMBeanOperationProvider.java new file mode 100644 index 00000000000..00e88c92977 --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/jmx/HotSpotMBeanOperationProvider.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2011, 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 org.graalvm.compiler.phases.common.jmx; + +import java.util.Collection; + +public interface HotSpotMBeanOperationProvider { + void registerOperations(Class clazz, Collection ops); + + Object invoke(String actionName, Object[] params, String[] signature); +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java index 3c360bb216b..b100913a04e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java @@ -32,6 +32,7 @@ import org.graalvm.compiler.phases.util.Providers; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.MetaAccessProvider; +import org.graalvm.compiler.core.common.spi.ForeignCallsProvider; public class PhaseContext { @@ -41,19 +42,22 @@ public class PhaseContext { private final LoweringProvider lowerer; private final Replacements replacements; private final StampProvider stampProvider; + private final ForeignCallsProvider foreignCalls; public PhaseContext(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider, LoweringProvider lowerer, Replacements replacements, - StampProvider stampProvider) { + StampProvider stampProvider, ForeignCallsProvider foreignCalls) { this.metaAccess = metaAccess; this.constantReflection = constantReflection; this.constantFieldProvider = constantFieldProvider; this.lowerer = lowerer; this.replacements = replacements; this.stampProvider = stampProvider; + this.foreignCalls = foreignCalls; } public PhaseContext(Providers providers) { - this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getConstantFieldProvider(), providers.getLowerer(), providers.getReplacements(), providers.getStampProvider()); + this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getConstantFieldProvider(), providers.getLowerer(), providers.getReplacements(), providers.getStampProvider(), + providers.getForeignCalls()); } public MetaAccessProvider getMetaAccess() { @@ -80,4 +84,7 @@ public class PhaseContext { return stampProvider; } + public ForeignCallsProvider getForeignCalls() { + return foreignCalls; + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java index b1f7a915af8..965de19ea07 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java @@ -140,7 +140,7 @@ public class PEGraphDecoderTest extends GraalCompilerTest { CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES, null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null, null, null); - decoder.decode(testMethod, false); + decoder.decode(testMethod, false, false); debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph"); targetGraph.verify(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java index 051a591ec41..7831bc9600e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java @@ -83,9 +83,15 @@ public class CachingPEGraphDecoder extends PEGraphDecoder { } @SuppressWarnings("try") - private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider) { - StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).useProfilingInfo(false).trackNodeSourcePosition( - graphBuilderConfig.trackNodeSourcePosition()).method(method).build(); + private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution) { + // @formatter:off + StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions). + useProfilingInfo(false). + trackNodeSourcePosition(graphBuilderConfig.trackNodeSourcePosition()). + method(method). + setIsSubstitution(isSubstitution). + build(); + // @formatter:on try (DebugContext.Scope scope = debug.scope("createGraph", graphToEncode)) { IntrinsicContext initialIntrinsicContext = intrinsicBytecodeProvider != null ? new IntrinsicContext(originalMethod, method, intrinsicBytecodeProvider, INLINE_AFTER_PARSING) : null; GraphBuilderPhase.Instance graphBuilderPhaseInstance = createGraphBuilderPhaseInstance(initialIntrinsicContext); @@ -110,10 +116,11 @@ public class CachingPEGraphDecoder extends PEGraphDecoder { } @Override - protected EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean trackNodeSourcePosition) { + protected EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution, + boolean trackNodeSourcePosition) { EncodedGraph result = graphCache.get(method); if (result == null && method.hasBytecodes()) { - result = createGraph(method, originalMethod, intrinsicBytecodeProvider); + result = createGraph(method, originalMethod, intrinsicBytecodeProvider, isSubstitution); } return result; } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java index da2ddbea326..89984b11fd0 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java @@ -94,7 +94,7 @@ public class IntrinsicGraphBuilder implements GraphBuilderContext, Receiver { this.stampProvider = stampProvider; this.code = code; this.method = code.getMethod(); - this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).build(); + this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).setIsSubstitution(true).build(); this.graph.setTrackNodeSourcePosition(); this.invokeBci = invokeBci; this.lastInstr = graph.start(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java index cb491a99138..9e978c24d6b 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java @@ -551,8 +551,8 @@ public abstract class PEGraphDecoder extends SimplifyingGraphDecoder { } } - public void decode(ResolvedJavaMethod method, boolean trackNodeSourcePosition) { - PEMethodScope methodScope = new PEMethodScope(graph, null, null, lookupEncodedGraph(method, null, null, trackNodeSourcePosition), method, null, 0, loopExplosionPlugin, null); + public void decode(ResolvedJavaMethod method, boolean isSubstitution, boolean trackNodeSourcePosition) { + PEMethodScope methodScope = new PEMethodScope(graph, null, null, lookupEncodedGraph(method, null, null, isSubstitution, trackNodeSourcePosition), method, null, 0, loopExplosionPlugin, null); decode(createInitialLoopScope(methodScope, null)); cleanupGraph(methodScope); @@ -783,7 +783,9 @@ public abstract class PEGraphDecoder extends SimplifyingGraphDecoder { return null; } ResolvedJavaMethod inlineMethod = inlineInfo.getMethodToInline(); - EncodedGraph graphToInline = lookupEncodedGraph(inlineMethod, inlineInfo.getOriginalMethod(), inlineInfo.getIntrinsicBytecodeProvider(), graph.trackNodeSourcePosition()); + ResolvedJavaMethod originalMethod = inlineInfo.getOriginalMethod(); + boolean isSubstitution = originalMethod != null && !originalMethod.equals(inlineMethod); + EncodedGraph graphToInline = lookupEncodedGraph(inlineMethod, originalMethod, inlineInfo.getIntrinsicBytecodeProvider(), isSubstitution, graph.trackNodeSourcePosition()); if (graphToInline == null) { return null; } @@ -1052,7 +1054,8 @@ public abstract class PEGraphDecoder extends SimplifyingGraphDecoder { } } - protected abstract EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean trackNodeSourcePosition); + protected abstract EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution, + boolean trackNodeSourcePosition); @Override protected void handleFixedNode(MethodScope s, LoopScope loopScope, int nodeOrderId, FixedNode node) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java index f620cd50dbf..bace1411231 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java @@ -429,10 +429,16 @@ public class ReplacementsImpl implements Replacements, InlineInvokePlugin { @SuppressWarnings("try") protected StructuredGraph buildInitialGraph(DebugContext debug, BytecodeProvider bytecodeProvider, final ResolvedJavaMethod methodToParse, Object[] args, boolean trackNodeSourcePosition, NodeSourcePosition replaceePosition) { + // @formatter:off // Replacements cannot have optimistic assumptions since they have // to be valid for the entire run of the VM. - final StructuredGraph graph = new StructuredGraph.Builder(replacements.options, debug).method(methodToParse).trackNodeSourcePosition(trackNodeSourcePosition).callerContext( - replaceePosition).build(); + final StructuredGraph graph = new StructuredGraph.Builder(replacements.options, debug). + method(methodToParse). + trackNodeSourcePosition(trackNodeSourcePosition). + callerContext(replaceePosition). + setIsSubstitution(true). + build(); + // @formatter:on // Replacements are not user code so they do not participate in unsafe access // tracking diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java index 84b1cadf17b..57f9ba7c1f4 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java @@ -723,7 +723,7 @@ public class SnippetTemplate { // Copy snippet graph, replacing constant parameters with given arguments final StructuredGraph snippetCopy = new StructuredGraph.Builder(options, debug).name(snippetGraph.name).method(snippetGraph.method()).trackNodeSourcePosition( - snippetGraph.trackNodeSourcePosition()).build(); + snippetGraph.trackNodeSourcePosition()).setIsSubstitution(true).build(); assert !GraalOptions.TrackNodeSourcePosition.getValue(options) || snippetCopy.trackNodeSourcePosition(); if (providers.getCodeCache() != null && providers.getCodeCache().shouldDebugNonSafepoints()) { snippetCopy.setTrackNodeSourcePosition(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java index cb863dc6300..7a56cf8c058 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java @@ -155,7 +155,7 @@ public abstract class MacroNode extends FixedWithNextNode implements Lowerable, @SuppressWarnings("try") protected StructuredGraph lowerReplacement(final StructuredGraph replacementGraph, LoweringTool tool) { final PhaseContext c = new PhaseContext(tool.getMetaAccess(), tool.getConstantReflection(), tool.getConstantFieldProvider(), tool.getLowerer(), tool.getReplacements(), - tool.getStampProvider()); + tool.getStampProvider(), null); if (!graph().hasValueProxies()) { new RemoveValueProxyPhase().apply(replacementGraph); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java index 3e5af7eeac4..13945a1e520 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java @@ -211,9 +211,9 @@ public final class GraphOutput implements Closeable { *

* Both GraphOutput (the {@code parent} and the returned one) has to be used in * synchronization - e.g. only one - * {@link #beginGroup(java.lang.Object, java.lang.String, java.lang.String, java.lang.Object, int, java.util.Map) - * begin}, {@link #endGroup() end} of group or - * {@link #print(java.lang.Object, java.util.Map, int, java.lang.String, java.lang.Object...) + * {@link GraphOutput#beginGroup(java.lang.Object, java.lang.String, java.lang.String, java.lang.Object, int, java.util.Map) + * begin}, {@link GraphOutput#endGroup() end} of group or + * {@link GraphOutput#print(java.lang.Object, java.util.Map, int, java.lang.String, java.lang.Object...) * printing} can be on at a given moment. * * @param parent the output to inherit {@code channel} and protocol version from From 99eee041ba0b1eaa26b88851432a0278381e60f3 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 14 Sep 2018 09:16:51 +0200 Subject: [PATCH 11/41] 8210731: PropertiesParser does not produce reproducible output Reviewed-by: mchung, jjg, erikj --- .../langtools/tools/propertiesparser/PropertiesParser.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/make/langtools/tools/propertiesparser/PropertiesParser.java b/make/langtools/tools/propertiesparser/PropertiesParser.java index 2cb4689a0df..f03c8bafc34 100644 --- a/make/langtools/tools/propertiesparser/PropertiesParser.java +++ b/make/langtools/tools/propertiesparser/PropertiesParser.java @@ -30,7 +30,7 @@ import propertiesparser.gen.ClassGenerator; import java.io.File; import java.io.PrintStream; -import java.util.HashMap; +import java.util.TreeMap; import java.util.Map; /** Translates a .properties file into a .java file containing an enum-like Java class @@ -96,12 +96,13 @@ public class PropertiesParser { } private Map parseOptions(String args[]) { - Map optionsMap = new HashMap<>(args.length); + /* Use TreeMap to guarantee stable forEach iteration */ + Map optionsMap = new TreeMap<>(); for ( int i = 0; i < args.length ; i++ ) { if ( "-compile".equals(args[i]) && i+2 < args.length ) { optionsMap.put(args[++i], args[++i]); } else { - return new HashMap<>(); + return new TreeMap<>(); } } return optionsMap; From ee43c985d4958b3c61ef428785618e37e9159827 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Thu, 13 Sep 2018 11:07:40 +0200 Subject: [PATCH 12/41] 8210703: vmStructs.cpp compiled with -O0 Reviewed-by: erikj, ihse --- make/hotspot/lib/JvmOverrideFiles.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk index f436a9451ee..cd37fda6ef2 100644 --- a/make/hotspot/lib/JvmOverrideFiles.gmk +++ b/make/hotspot/lib/JvmOverrideFiles.gmk @@ -30,7 +30,7 @@ $(eval $(call IncludeCustomExtension, hotspot/lib/JvmOverrideFiles.gmk)) # status for individual files on specific platforms. ifeq ($(TOOLCHAIN_TYPE), gcc) - BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0 + BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized From 8eb4ba001caf1a59c8662b05d4a089a9b95444ef Mon Sep 17 00:00:00 2001 From: Dmitrij Pochepko Date: Fri, 14 Sep 2018 14:24:00 +0300 Subject: [PATCH 13/41] 8210461: AArch64: Math.cos intrinsic gives incorrect results Reviewed-by: aph --- .../aarch64/macroAssembler_aarch64_trig.cpp | 2 +- .../compiler/intrinsics/math/Test8210461.java | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/compiler/intrinsics/math/Test8210461.java diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp index 77ec511d7db..47e17985b9d 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp @@ -1004,7 +1004,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 br(LT, Z_IS_LESS_THAN_TWO24B); fmuld(v1, v18, v17); // twon24*z frintzd(v1, v1); // v1 = (double)(int)(v1) - fmaddd(v2, v10, v1, v18); + fmsubd(v2, v10, v1, v18); fcvtzdw(tmp3, v1); // (int)fw fcvtzdw(tmp2, v2); // double to int strw(tmp2, Address(iqBase, jz, Address::lsl(2))); diff --git a/test/hotspot/jtreg/compiler/intrinsics/math/Test8210461.java b/test/hotspot/jtreg/compiler/intrinsics/math/Test8210461.java new file mode 100644 index 00000000000..2fb4b59a095 --- /dev/null +++ b/test/hotspot/jtreg/compiler/intrinsics/math/Test8210461.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, Cavium (by BELLSOFT). 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 8210461 + * @summary Math cos instrinsic returns incorrect result for large value + * + * @run main/othervm compiler.intrinsics.math.Test8210461 + */ + +package compiler.intrinsics.math; + +import java.util.Arrays; + +public class Test8210461 { + private static final double[] testCases = new double[] { + 1647100.0d, + 16471000.0d, + 164710000.0d + }; + + public static void main(String[] args) { + Arrays.stream(testCases).forEach(Test8210461::test); + } + + private static void test(double arg) { + double strictResult = StrictMath.cos(arg); + double mathResult = Math.cos(arg); + if (Math.abs(strictResult - mathResult) > Math.ulp(strictResult)) + throw new AssertionError(mathResult + " while expecting " + strictResult); + } +} From 9a9df3cd76890e5558dc52bbc00639dbf8d3ea52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Fri, 14 Sep 2018 14:45:31 +0200 Subject: [PATCH 14/41] 8209914: javadoc search sometimes generates bad URIs Reviewed-by: jjg --- .../doclets/formats/html/resources/search.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js index f6a87873f31..06b2aa84318 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js @@ -132,24 +132,18 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { } else { label = item.l; } - $li = $("

  • ").appendTo(ul); + var li = $("
  • ").appendTo(ul); if (item.category === catSearchTags) { if (item.d) { - $("").attr("href", "#") - .html(label + " (" + item.h + ")
    " - + item.d + "
    ") - .appendTo($li); + li.html(label + " (" + item.h + ")
    " + + item.d + "
    "); } else { - $("
    ").attr("href", "#") - .html(label + " (" + item.h + ")") - .appendTo($li); + li.html(label + " (" + item.h + ")"); } } else { - $("").attr("href", "#") - .html(label) - .appendTo($li); + li.html(label); } - return $li; + return li; } }); $(function() { @@ -328,6 +322,7 @@ $(function() { } else { window.location.href = pathtoroot + url; } + $("#search").focus(); } } }); From fd2acd92844428b3ca51db65a84065b1f5526646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Fri, 14 Sep 2018 14:44:11 +0200 Subject: [PATCH 15/41] 8209163: SA: Show Object Histogram asserts with ZGC Reviewed-by: ysuenaga, jcbeyler --- .../share/classes/sun/jvm/hotspot/oops/ObjectHeap.java | 5 +++++ .../sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java | 1 + 2 files changed, 6 insertions(+) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java index da4671e8f04..18ad1f91e66 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java @@ -37,6 +37,7 @@ import sun.jvm.hotspot.gc.shared.*; import sun.jvm.hotspot.gc.epsilon.*; import sun.jvm.hotspot.gc.g1.*; import sun.jvm.hotspot.gc.parallel.*; +import sun.jvm.hotspot.gc.z.*; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; @@ -366,6 +367,10 @@ public class ObjectHeap { } else if (heap instanceof G1CollectedHeap) { G1CollectedHeap g1h = (G1CollectedHeap) heap; g1h.heapRegionIterate(lrc); + } else if (heap instanceof ZCollectedHeap) { + // Operation (currently) not supported with ZGC. Print + // a warning and leave the list of live regions empty. + System.err.println("Warning: Operation not supported with ZGC"); } else if (heap instanceof EpsilonHeap) { EpsilonHeap eh = (EpsilonHeap) heap; liveRegions.add(eh.space().top()); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java index 276a88f88eb..2a241389127 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java @@ -50,6 +50,7 @@ public class ProgressiveHeapVisitor implements HeapVisitor { this.usedSize = usedSize; visitedSize = 0; userHeapVisitor.prologue(usedSize); + thunk.heapIterationFractionUpdate(0.0); } public boolean doObj(Oop obj) { From 97f10c27d82ea4a08769225c65c3dc337ddaf227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Fri, 14 Sep 2018 14:44:11 +0200 Subject: [PATCH 16/41] 8210710: Rename ThreadLocalAllocBuffer::myThread() to thread() Reviewed-by: rkennke, tschatzl --- .../gc/shared/threadLocalAllocBuffer.cpp | 28 +++++++++---------- .../gc/shared/threadLocalAllocBuffer.hpp | 2 +- .../shared/threadLocalAllocBuffer.inline.hpp | 5 ++-- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp index 89a7da4346f..31a752a6a30 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -69,12 +69,12 @@ void ThreadLocalAllocBuffer::accumulate_statistics_before_gc() { } void ThreadLocalAllocBuffer::accumulate_statistics() { - Thread* thread = myThread(); - size_t capacity = Universe::heap()->tlab_capacity(thread); - size_t used = Universe::heap()->tlab_used(thread); + Thread* thr = thread(); + size_t capacity = Universe::heap()->tlab_capacity(thr); + size_t used = Universe::heap()->tlab_used(thr); _gc_waste += (unsigned)remaining(); - size_t total_allocated = thread->allocated_bytes(); + size_t total_allocated = thr->allocated_bytes(); size_t allocated_since_last_gc = total_allocated - _allocated_before_last_gc; _allocated_before_last_gc = total_allocated; @@ -119,7 +119,7 @@ void ThreadLocalAllocBuffer::make_parsable(bool retire, bool zap) { invariants(); if (retire) { - myThread()->incr_allocated_bytes(used_bytes()); + thread()->incr_allocated_bytes(used_bytes()); } Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap); @@ -150,7 +150,7 @@ void ThreadLocalAllocBuffer::resize() { // Compute the next tlab size using expected allocation amount assert(ResizeTLAB, "Should not call this otherwise"); size_t alloc = (size_t)(_allocation_fraction.average() * - (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize)); + (Universe::heap()->tlab_capacity(thread()) / HeapWordSize)); size_t new_size = alloc / _target_refills; new_size = MIN2(MAX2(new_size, min_size()), max_size()); @@ -159,7 +159,7 @@ void ThreadLocalAllocBuffer::resize() { log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]" " refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT, - p2i(myThread()), myThread()->osthread()->thread_id(), + p2i(thread()), thread()->osthread()->thread_id(), _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size); set_desired_size(aligned_new_size); @@ -211,7 +211,7 @@ void ThreadLocalAllocBuffer::initialize() { // thread is initialized before the heap is. The initialization for // this thread is redone in startup_initialization below. if (Universe::heap() != NULL) { - size_t capacity = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize; + size_t capacity = Universe::heap()->tlab_capacity(thread()) / HeapWordSize; double alloc_frac = desired_size() * target_refills() / (double) capacity; _allocation_fraction.sample(alloc_frac); } @@ -274,7 +274,7 @@ size_t ThreadLocalAllocBuffer::initial_desired_size() { // Initial size is a function of the average number of allocating threads. unsigned nof_threads = global_stats()->allocating_threads_avg(); - init_sz = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) / + init_sz = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) / (nof_threads * target_refills()); init_sz = align_object_size(init_sz); } @@ -288,7 +288,7 @@ void ThreadLocalAllocBuffer::print_stats(const char* tag) { return; } - Thread* thrd = myThread(); + Thread* thrd = thread(); size_t waste = _gc_waste + _slow_refill_waste + _fast_refill_waste; double waste_percent = percent_of(waste, _allocated_size); size_t tlab_used = Universe::heap()->tlab_used(thrd); @@ -322,7 +322,7 @@ void ThreadLocalAllocBuffer::verify() { void ThreadLocalAllocBuffer::set_sample_end() { size_t heap_words_remaining = pointer_delta(_end, _top); - size_t bytes_until_sample = myThread()->heap_sampler().bytes_until_sample(); + size_t bytes_until_sample = thread()->heap_sampler().bytes_until_sample(); size_t words_until_sample = bytes_until_sample / HeapWordSize; if (heap_words_remaining > words_until_sample) { @@ -334,10 +334,8 @@ void ThreadLocalAllocBuffer::set_sample_end() { } } -Thread* ThreadLocalAllocBuffer::myThread() { - return (Thread*)(((char *)this) + - in_bytes(start_offset()) - - in_bytes(Thread::tlab_start_offset())); +Thread* ThreadLocalAllocBuffer::thread() { + return (Thread*)(((char*)this) + in_bytes(start_offset()) - in_bytes(Thread::tlab_start_offset())); } void ThreadLocalAllocBuffer::set_back_allocation_end() { diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp index 052eecdd210..b9547ee7c79 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -101,7 +101,7 @@ private: void print_stats(const char* tag); - Thread* myThread(); + Thread* thread(); // statistics diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp index 11430e8777f..a0bf20bda90 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp @@ -57,8 +57,7 @@ inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) { // Compute the size for the new TLAB. // The "last" tlab may be smaller to reduce fragmentation. // unsafe_max_tlab_alloc is just a hint. - const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) / - HeapWordSize; + const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(thread()) / HeapWordSize; size_t new_tlab_size = MIN3(available_size, desired_size() + align_object_size(obj_size), max_size()); // Make sure there's enough room for object and filler int[]. @@ -92,7 +91,7 @@ void ThreadLocalAllocBuffer::record_slow_allocation(size_t obj_size) { " obj: " SIZE_FORMAT " free: " SIZE_FORMAT " waste: " SIZE_FORMAT, - "slow", p2i(myThread()), myThread()->osthread()->thread_id(), + "slow", p2i(thread()), thread()->osthread()->thread_id(), obj_size, free(), refill_waste_limit()); } From 26af771191b43b68df85f7da7d998f7a48680974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Fri, 14 Sep 2018 14:44:11 +0200 Subject: [PATCH 17/41] 8210711: Remove unused offset getters in ThreadLocalAllocBuffer Reviewed-by: rkennke, tschatzl, mdoerr --- .../share/gc/shared/threadLocalAllocBuffer.hpp | 12 +++--------- src/hotspot/share/runtime/thread.hpp | 18 ++++-------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp index b9547ee7c79..4ade6090c80 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -192,15 +192,9 @@ public: // Code generation support static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } - static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end ); } - static ByteSize top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _top ); } - static ByteSize pf_top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top ); } - static ByteSize size_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _desired_size ); } - static ByteSize refill_waste_limit_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _refill_waste_limit ); } - - static ByteSize number_of_refills_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _number_of_refills ); } - static ByteSize fast_refill_waste_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _fast_refill_waste ); } - static ByteSize slow_allocations_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _slow_allocations ); } + static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end); } + static ByteSize top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _top); } + static ByteSize pf_top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top); } void verify(); }; diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 8e98c4eb08e..ce25684a034 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -698,20 +698,10 @@ protected: static ByteSize polling_page_offset() { return byte_offset_of(Thread, _polling_page); } -#define TLAB_FIELD_OFFSET(name) \ - static ByteSize tlab_##name##_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); } - - TLAB_FIELD_OFFSET(start) - TLAB_FIELD_OFFSET(end) - TLAB_FIELD_OFFSET(top) - TLAB_FIELD_OFFSET(pf_top) - TLAB_FIELD_OFFSET(size) // desired_size - TLAB_FIELD_OFFSET(refill_waste_limit) - TLAB_FIELD_OFFSET(number_of_refills) - TLAB_FIELD_OFFSET(fast_refill_waste) - TLAB_FIELD_OFFSET(slow_allocations) - -#undef TLAB_FIELD_OFFSET + static ByteSize tlab_start_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::start_offset(); } + static ByteSize tlab_end_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::end_offset(); } + static ByteSize tlab_top_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::top_offset(); } + static ByteSize tlab_pf_top_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::pf_top_offset(); } static ByteSize allocated_bytes_offset() { return byte_offset_of(Thread, _allocated_bytes); } From 0f8cbbc54c12548ba6dc13cf27149da20e6d67e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Fri, 14 Sep 2018 14:44:11 +0200 Subject: [PATCH 18/41] 8210714: ZGC: ZWeakRootsIterator should no longer call reset/finish_dead_counter() Reviewed-by: eosterlund --- src/hotspot/share/gc/z/zRootsIterator.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index 751d2685383..a129a827d4b 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -252,12 +252,10 @@ ZWeakRootsIterator::ZWeakRootsIterator() : _jfr_weak(this) { assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); ZStatTimer timer(ZSubPhasePauseWeakRootsSetup); - StringTable::reset_dead_counter(); } ZWeakRootsIterator::~ZWeakRootsIterator() { ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown); - StringTable::finish_dead_counter(); } void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl) { From 73cda6e99e0483a6e03a094a0335ccee9ae47b63 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 14 Sep 2018 16:56:09 +0100 Subject: [PATCH 19/41] 8208780: (se) test SelectWithConsumer.testReadableAndWriteable(): failure Reviewed-by: bpb --- .../channels/Selector/SelectWithConsumer.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java b/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java index 67cdc2dce35..85d26609fb1 100644 --- a/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java +++ b/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 8199433 + * @bug 8199433 8208780 * @run testng SelectWithConsumer * @summary Unit test for Selector select(Consumer), select(Consumer,long) and * selectNow(Consumer) @@ -62,9 +62,19 @@ public class SelectWithConsumer { var interestOps = key.interestOps(); var notifiedOps = new AtomicInteger(); + if (expectedOps == 0) { + // ensure select(Consumer) does not block indefinitely + sel.wakeup(); + } else { + // ensure that the channel is ready for all expected operations + sel.select(); + while ((key.readyOps() & interestOps) != expectedOps) { + Thread.sleep(100); + sel.select(); + } + } + // select(Consumer) - if (expectedOps == 0) - sel.wakeup(); // ensure select does not block notifiedOps.set(0); int n = sel.select(k -> { assertTrue(Thread.currentThread() == callerThread); From b16e5584abcae18fdcc4494f88189daffb7fbdce Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 14 Sep 2018 09:00:22 -0700 Subject: [PATCH 20/41] 8210741: Typo in Java API documentation of java.nio.file.Paths Reviewed-by: alanb, rriggs --- src/java.base/share/classes/java/nio/file/Paths.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/nio/file/Paths.java b/src/java.base/share/classes/java/nio/file/Paths.java index 4f177bac5c0..216fef4ae99 100644 --- a/src/java.base/share/classes/java/nio/file/Paths.java +++ b/src/java.base/share/classes/java/nio/file/Paths.java @@ -73,7 +73,8 @@ public final class Paths { * Converts the given URI to a {@link Path} object. * * @implSpec - * This method simply invokes {@link Path#of(URI) * Path.of(URI)} with the given parameter. + * This method simply invokes {@link Path#of(URI) Path.of(URI)} with the + * given parameter. * * @param uri * the URI to convert From bad4a92e55444bd0ecffb73fb9965e82c97993f4 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 14 Sep 2018 12:10:28 -0400 Subject: [PATCH 21/41] 8210559: ClassLoaderData Symbols can leak Unrefcount the symbol names when the CLD is destroyed Reviewed-by: lfoltan, jiangli, iklam --- src/hotspot/share/classfile/classLoaderData.cpp | 8 ++++++++ src/hotspot/share/prims/whitebox.cpp | 11 ++++++++++- .../hotspot/jtreg/runtime/ClassUnload/UnloadTest.java | 11 ++++++++++- .../jtreg/runtime/testlibrary/ClassUnloadCommon.java | 4 ++-- test/lib/sun/hotspot/WhiteBox.java | 1 + 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp index 9a964d4a53b..4338c1608da 100644 --- a/src/hotspot/share/classfile/classLoaderData.cpp +++ b/src/hotspot/share/classfile/classLoaderData.cpp @@ -769,6 +769,14 @@ ClassLoaderData::~ClassLoaderData() { if (_deallocate_list != NULL) { delete _deallocate_list; } + + // Decrement refcounts of Symbols if created. + if (_name != NULL) { + _name->decrement_refcount(); + } + if (_name_and_id != NULL) { + _name_and_id->decrement_refcount(); + } } // Returns true if this class loader data is for the app class loader diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index c57461a8472..23f5da27f73 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -178,6 +178,15 @@ WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name)) return closure.found(); WB_END +WB_ENTRY(jint, WB_GetSymbolRefcount(JNIEnv* env, jobject unused, jstring name)) + oop h_name = JNIHandles::resolve(name); + if (h_name == NULL) return false; + Symbol* sym = java_lang_String::as_symbol(h_name, CHECK_0); + TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return + return (jint)sym->refcount(); +WB_END + + WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) { #if INCLUDE_JVMTI ResourceMark rm; @@ -1982,7 +1991,6 @@ WB_ENTRY(jint, WB_ProtectionDomainRemovedCount(JNIEnv* env, jobject o)) return (jint) SystemDictionary::pd_cache_table()->removed_entries_count(); WB_END - #define CC (char*) static JNINativeMethod methods[] = { @@ -1996,6 +2004,7 @@ static JNINativeMethod methods[] = { {CC"getHeapSpaceAlignment", CC"()J", (void*)&WB_GetHeapSpaceAlignment}, {CC"getHeapAlignment", CC"()J", (void*)&WB_GetHeapAlignment}, {CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive }, + {CC"getSymbolRefcount", CC"(Ljava/lang/String;)I", (void*)&WB_GetSymbolRefcount }, {CC"parseCommandLine0", CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;", (void*) &WB_ParseCommandLine diff --git a/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java b/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java index 972d2ea014e..ef1d29eeba6 100644 --- a/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java +++ b/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java @@ -23,6 +23,7 @@ /* * @test UnloadTest + * @bug 8210559 * @requires vm.opt.final.ClassUnloading * @modules java.base/jdk.internal.misc * @library /runtime/testlibrary /test/lib @@ -30,7 +31,7 @@ * @build sun.hotspot.WhiteBox test.Empty * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UnloadTest + * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xlog:class+unload=debug UnloadTest */ import sun.hotspot.WhiteBox; @@ -60,8 +61,16 @@ public class UnloadTest { ClassUnloadCommon.failIf(!wb.isClassAlive(className), "should be live here"); + String loaderName = cl.getName(); + int loadedRefcount = wb.getSymbolRefcount(loaderName); + System.out.println("Refcount of symbol " + loaderName + " is " + loadedRefcount); + cl = null; c = null; o = null; ClassUnloadCommon.triggerUnloading(); ClassUnloadCommon.failIf(wb.isClassAlive(className), "should have been unloaded"); + + int unloadedRefcount = wb.getSymbolRefcount(loaderName); + System.out.println("Refcount of symbol " + loaderName + " is " + unloadedRefcount); + ClassUnloadCommon.failIf(unloadedRefcount != (loadedRefcount - 1), "Refcount must be decremented"); } } diff --git a/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java b/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java index 33e2d6c56ea..254411efeeb 100644 --- a/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java +++ b/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java @@ -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 @@ -73,7 +73,7 @@ public class ClassUnloadCommon { .map(Paths::get) .map(ClassUnloadCommon::toURL) .toArray(URL[]::new); - return new URLClassLoader(urls) { + return new URLClassLoader("ClassUnloadCommonClassLoader", urls, new ClassUnloadCommon().getClass().getClassLoader()) { @Override public Class loadClass(String cn, boolean resolve) throws ClassNotFoundException diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java index e167a8e24d3..d3ce3b7b80d 100644 --- a/test/lib/sun/hotspot/WhiteBox.java +++ b/test/lib/sun/hotspot/WhiteBox.java @@ -103,6 +103,7 @@ public class WhiteBox { return isClassAlive0(name.replace('.', '/')); } private native boolean isClassAlive0(String name); + public native int getSymbolRefcount(String name); private native boolean isMonitorInflated0(Object obj); public boolean isMonitorInflated(Object obj) { From 71b9664abbae125506a2021da4bdc44f8d1472c7 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Fri, 14 Sep 2018 12:53:07 -0400 Subject: [PATCH 22/41] 8098798: Thread.join(ms) on Linux still affected by changes to the time-of-day clock 8210004: Thread.sleep(millis, nanos) timeout returns early Reviewed-by: martin, igerasim --- .../share/classes/java/lang/Thread.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index aad0f4eae07..a4d3e21e4b5 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -35,6 +35,7 @@ import java.util.Map; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.LockSupport; import jdk.internal.misc.TerminatingThreadLocal; @@ -332,7 +333,7 @@ class Thread implements Runnable { "nanosecond timeout value out of range"); } - if (nanos >= 500000 || (nanos != 0 && millis == 0)) { + if (nanos > 0 && millis < Long.MAX_VALUE) { millis++; } @@ -1291,28 +1292,23 @@ class Thread implements Runnable { * interrupted status of the current thread is * cleared when this exception is thrown. */ - public final synchronized void join(long millis) + public final synchronized void join(final long millis) throws InterruptedException { - long base = System.currentTimeMillis(); - long now = 0; - - if (millis < 0) { - throw new IllegalArgumentException("timeout value is negative"); - } - - if (millis == 0) { + if (millis > 0) { + if (isAlive()) { + final long startTime = System.nanoTime(); + long delay = millis; + do { + wait(delay); + } while (isAlive() && (delay = millis - + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)) > 0); + } + } else if (millis == 0) { while (isAlive()) { wait(0); } } else { - while (isAlive()) { - long delay = millis - now; - if (delay <= 0) { - break; - } - wait(delay); - now = System.currentTimeMillis() - base; - } + throw new IllegalArgumentException("timeout value is negative"); } } @@ -1353,7 +1349,7 @@ class Thread implements Runnable { "nanosecond timeout value out of range"); } - if (nanos >= 500000 || (nanos != 0 && millis == 0)) { + if (nanos > 0 && millis < Long.MAX_VALUE) { millis++; } From d4612426ceb0150d86cfb278d51004cf6e243209 Mon Sep 17 00:00:00 2001 From: Abdul Kolarkunnu Date: Tue, 11 Sep 2018 22:16:47 -0700 Subject: [PATCH 23/41] 8210056: Enable different look and feel tests in SwingSet3 demo test TextFieldDemoTest Reviewed-by: serb --- .../client/SwingSet/src/TextFieldDemoTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java index 8fde9ff230b..b94bdb0b8a1 100644 --- a/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java +++ b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java @@ -32,6 +32,7 @@ import java.util.Calendar; import java.util.Date; import java.util.Locale; import javax.swing.JFormattedTextField; +import javax.swing.UIManager; import static org.jemmy2ext.JemmyExt.*; @@ -69,9 +70,9 @@ import static org.testng.AssertJUnit.*; @Listeners(GuiTestListener.class) public class TextFieldDemoTest { - @Test - public void test() throws Exception { - + @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class) + public void test(String lookAndFeel) throws Exception { + UIManager.setLookAndFeel(lookAndFeel); new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication(); JFrameOperator frame = new JFrameOperator(DEMO_TITLE); @@ -144,11 +145,12 @@ public class TextFieldDemoTest { }); // Check non-matching passwords + final Color backgroundColor = UIManager.getColor("TextField.background"); password2.typeText("passwereertegrs"); password1.waitState(new ComponentChooser() { public boolean checkComponent(Component comp) { - return password1.getBackground().equals(Color.white) && - password2.getBackground().equals(Color.white); + return password1.getBackground().equals(backgroundColor) && + password2.getBackground().equals(backgroundColor); } public String getDescription() { return "Passwords not to match"; From fcc414655bfdc8f3cd691bea14f043981116ceab Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Fri, 14 Sep 2018 11:17:25 -0700 Subject: [PATCH 24/41] 8190737: use unicode version of the canonicalize() function to handle long path on windows Also calling CreateFileW in zip_util.c to handle long path Reviewed-by: sherman, iklam --- src/hotspot/os/windows/include/jvm_md.h | 2 +- src/java.base/share/native/libzip/zip_util.c | 42 ++++++++-- .../windows/native/libjava/canonicalize_md.c | 80 +++++++++++++------ .../windows/native/libjava/io_util_md.h | 2 +- .../jtreg/runtime/LoadClass/LongBCP.java | 18 +++++ 5 files changed, 111 insertions(+), 33 deletions(-) diff --git a/src/hotspot/os/windows/include/jvm_md.h b/src/hotspot/os/windows/include/jvm_md.h index e047137c783..4baba320855 100644 --- a/src/hotspot/os/windows/include/jvm_md.h +++ b/src/hotspot/os/windows/include/jvm_md.h @@ -63,7 +63,7 @@ typedef struct { #include /* For uintptr_t */ #include -#define JVM_MAXPATHLEN _MAX_PATH +#define JVM_MAXPATHLEN 1024 #define JVM_R_OK 4 #define JVM_W_OK 2 diff --git a/src/java.base/share/native/libzip/zip_util.c b/src/java.base/share/native/libzip/zip_util.c index 76c40747bb2..f129e4548e5 100644 --- a/src/java.base/share/native/libzip/zip_util.c +++ b/src/java.base/share/native/libzip/zip_util.c @@ -100,6 +100,9 @@ DEF_STATIC_JNI_OnLoad static ZFILE ZFILE_Open(const char *fname, int flags) { #ifdef WIN32 + WCHAR *wfname, *wprefixed_fname; + size_t converted_chars, fname_length; + jlong fhandle; const DWORD access = (flags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) : (flags & O_WRONLY) ? GENERIC_WRITE : @@ -121,14 +124,37 @@ ZFILE_Open(const char *fname, int flags) { FILE_ATTRIBUTE_NORMAL; const DWORD flagsAndAttributes = maybeWriteThrough | maybeDeleteOnClose; - return (jlong) CreateFile( - fname, /* Wide char path name */ - access, /* Read and/or write permission */ - sharing, /* File sharing flags */ - NULL, /* Security attributes */ - disposition, /* creation disposition */ - flagsAndAttributes, /* flags and attributes */ - NULL); + fname_length = strlen(fname); + if (fname_length < MAX_PATH) { + return (jlong)CreateFile( + fname, /* path name in multibyte char */ + access, /* Read and/or write permission */ + sharing, /* File sharing flags */ + NULL, /* Security attributes */ + disposition, /* creation disposition */ + flagsAndAttributes, /* flags and attributes */ + NULL); + } else { + if ((wfname = (WCHAR*)malloc((fname_length + 1) * sizeof(WCHAR))) == NULL) + return (jlong)INVALID_HANDLE_VALUE; + + if (mbstowcs_s(&converted_chars, wfname, fname_length + 1, fname, fname_length) != 0) { + free(wfname); + return (jlong)INVALID_HANDLE_VALUE; + } + wprefixed_fname = getPrefixed(wfname, (int)fname_length); + fhandle = (jlong)CreateFileW( + wprefixed_fname, /* Wide char path name */ + access, /* Read and/or write permission */ + sharing, /* File sharing flags */ + NULL, /* Security attributes */ + disposition, /* creation disposition */ + flagsAndAttributes, /* flags and attributes */ + NULL); + free(wfname); + free(wprefixed_fname); + return fhandle; + } #else return open(fname, flags, 0); #endif diff --git a/src/java.base/windows/native/libjava/canonicalize_md.c b/src/java.base/windows/native/libjava/canonicalize_md.c index ba0d08624e3..b51919e77e4 100644 --- a/src/java.base/windows/native/libjava/canonicalize_md.c +++ b/src/java.base/windows/native/libjava/canonicalize_md.c @@ -225,6 +225,8 @@ lastErrorReportable() return 1; } +int wcanonicalize(WCHAR *orig_path, WCHAR *result, int size); + /* Convert a pathname to canonical form. The input orig_path is assumed to have been converted to native form already, via JVM_NativePath(). This is necessary because _fullpath() rejects duplicate separator characters on @@ -237,6 +239,38 @@ canonicalize(char *orig_path, char *result, int size) HANDLE h; char path[1024]; /* Working copy of path */ char *src, *dst, *dend; + wchar_t *worig_path, *wresult; + size_t converted_chars = 0; + + /* handle long path with length >= MAX_PATH */ + if (strlen(orig_path) >= MAX_PATH) { + if ((worig_path = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL) + return -1; + + if (mbstowcs_s(&converted_chars, worig_path, (size_t)size, orig_path, (size_t)(size - 1)) != 0) { + free(worig_path); + return -1; + } + + if ((wresult = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL) + return -1; + + if (wcanonicalize(worig_path, wresult, size) != 0) { + free(worig_path); + free(wresult); + return -1; + } + + if (wcstombs_s(&converted_chars, result, (size_t)size, wresult, (size_t)(size - 1)) != 0) { + free(worig_path); + free(wresult); + return -1; + } + + free(worig_path); + free(wresult); + return 0; + } /* Reject paths that contain wildcards */ if (wild(orig_path)) { @@ -245,15 +279,15 @@ canonicalize(char *orig_path, char *result, int size) } /* Collapse instances of "foo\.." and ensure absoluteness. Note that - contrary to the documentation, the _fullpath procedure does not require - the drive to be available. It also does not reliably change all - occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */ - if(!_fullpath(path, orig_path, sizeof(path))) { + contrary to the documentation, the _fullpath procedure does not require + the drive to be available. It also does not reliably change all + occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */ + if (!_fullpath(path, orig_path, sizeof(path))) { return -1; } /* Correction for Win95: _fullpath may leave a trailing "\\" - on a UNC pathname */ + on a UNC pathname */ if ((path[0] == '\\') && (path[1] == '\\')) { char *p = path + strlen(path); if ((p[-1] == '\\') && !islb(p[-2])) { @@ -281,16 +315,16 @@ canonicalize(char *orig_path, char *result, int size) char *p; p = nextsep(src + 2); /* Skip past host name */ if (!*p) { - /* A UNC pathname must begin with "\\\\host\\share", - so reject this path as invalid if there is no share name */ + /* A UNC pathname must begin with "\\\\host\\share", + so reject this path as invalid if there is no share name */ errno = EINVAL; return -1; - } - p = nextsep(p + 1); /* Skip past share name */ - if (!(dst = cp(dst, dend, '\0', src, p))) { - return -1; - } - src = p; + } + p = nextsep(p + 1); /* Skip past share name */ + if (!(dst = cp(dst, dend, '\0', src, p))) { + return -1; + } + src = p; } else { /* Invalid path */ errno = EINVAL; @@ -309,11 +343,11 @@ canonicalize(char *orig_path, char *result, int size) } /* At this point we have copied either a drive specifier ("z:") or a UNC - prefix ("\\\\host\\share") to the result buffer, and src points to the - first byte of the remainder of the path. We now scan through the rest - of the path, looking up each prefix in order to find the true name of - the last element of each prefix, thereby computing the full true name of - the original path. */ + prefix ("\\\\host\\share") to the result buffer, and src points to the + first byte of the remainder of the path. We now scan through the rest + of the path, looking up each prefix in order to find the true name of + the last element of each prefix, thereby computing the full true name of + the original path. */ while (*src) { char *p = nextsep(src + 1); /* Find next separator */ char c = *p; @@ -325,8 +359,8 @@ canonicalize(char *orig_path, char *result, int size) /* Lookup succeeded; append true name to result and continue */ FindClose(h); if (!(dst = cp(dst, dend, '\\', - fd.cFileName, - fd.cFileName + strlen(fd.cFileName)))) { + fd.cFileName, + fd.cFileName + strlen(fd.cFileName)))) { return -1; } src = p; @@ -344,8 +378,8 @@ canonicalize(char *orig_path, char *result, int size) } if (dst >= dend) { - errno = ENAMETOOLONG; - return -1; + errno = ENAMETOOLONG; + return -1; } *dst = '\0'; return 0; @@ -587,7 +621,7 @@ wcanonicalizeWithPrefix(WCHAR *canonicalPrefix, WCHAR *pathWithCanonicalPrefix, */ /* copy \\?\ or \\?\UNC\ to the front of path*/ -WCHAR* +__declspec(dllexport) WCHAR* getPrefixed(const WCHAR* path, int pathlen) { WCHAR* pathbuf = (WCHAR*)malloc((pathlen + 10) * sizeof (WCHAR)); if (pathbuf != 0) { diff --git a/src/java.base/windows/native/libjava/io_util_md.h b/src/java.base/windows/native/libjava/io_util_md.h index d0a811794da..9779672f738 100644 --- a/src/java.base/windows/native/libjava/io_util_md.h +++ b/src/java.base/windows/native/libjava/io_util_md.h @@ -38,7 +38,7 @@ */ WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE); WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id); -WCHAR* getPrefixed(const WCHAR* path, int pathlen); +__declspec(dllexport) WCHAR* getPrefixed(const WCHAR* path, int pathlen); WCHAR* currentDir(int di); int currentDirLength(const WCHAR* path, int pathlen); int handleAvailable(FD fd, jlong *pbytes); diff --git a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java index bbd5be294af..7dccaec4dae 100644 --- a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java +++ b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java @@ -29,6 +29,7 @@ * @library /test/lib * @modules java.base/jdk.internal.misc * java.management + * jdk.jartool/sun.tools.jar * @run main LongBCP */ @@ -84,6 +85,23 @@ public class LongBCP { output.shouldContain("Hello World") .shouldHaveExitValue(0); + // create a hello.jar + sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar"); + String helloJar = destDir.toString() + File.separator + "hello.jar"; + if (!jarTool.run(new String[] + {"-cf", helloJar, "-C", destDir.toString(), "Hello.class"})) { + throw new RuntimeException("Could not write the Hello jar file"); + } + + // run with long bootclasspath to hello.jar + bootCP = "-Xbootclasspath/a:" + helloJar; + pb = ProcessTools.createJavaProcessBuilder( + bootCP, "Hello"); + + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Hello World") + .shouldHaveExitValue(0); + // relative path tests // We currently cannot handle relative path specified in the // -Xbootclasspath/a on windows. From 18199b887f8f364c8d35704349e5eebc9dec0f00 Mon Sep 17 00:00:00 2001 From: Gary Adams Date: Thu, 13 Sep 2018 07:46:41 -0400 Subject: [PATCH 25/41] 8208468: [TESTBUG] nsk/jdb/locals/locals002: fails with "Prompt is not received during ... milliseconds" Reviewed-by: cjplummer, amenkov --- .../jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java index 7e0625ae806..9faa8853b40 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java @@ -81,7 +81,7 @@ public class locals002a { int[] arrVar ) { - System.out.println("Arguments but no locals"); // locals002.BREAKPOINT_LINE1 + int x = 3; // locals002.BREAKPOINT_LINE1 } static void allKindsOfLocals() { @@ -97,6 +97,6 @@ public class locals002a { int[] arrVar = new int[5]; for (int j = 0; j < 5 ; j++) arrVar[j] = j; - System.out.println("Locals but no arguments"); // locals002.BREAKPOINT_LINE2 + int x = 4; // locals002.BREAKPOINT_LINE2 } } From 05ed45cef1eb1c5b157e1ac2751d8e185a63e231 Mon Sep 17 00:00:00 2001 From: Man Cao Date: Fri, 14 Sep 2018 08:48:36 -0700 Subject: [PATCH 26/41] 8210724: Change the verbosity threshold of logging for [oopstorage,ref] Improve logging verbosity levels in oopStorage.cpp Reviewed-by: kbarrett, sjohanss --- src/hotspot/share/gc/shared/oopStorage.cpp | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/hotspot/share/gc/shared/oopStorage.cpp b/src/hotspot/share/gc/shared/oopStorage.cpp index ac66a13375c..ad1e10799e2 100644 --- a/src/hotspot/share/gc/shared/oopStorage.cpp +++ b/src/hotspot/share/gc/shared/oopStorage.cpp @@ -429,20 +429,20 @@ oop* OopStorage::allocate() { // Failed to make new block, no other thread made a block // available while the mutex was released, and didn't get // one from a deferred update either, so return failure. - log_info(oopstorage, ref)("%s: failed block allocation", name()); + log_debug(oopstorage, blocks)("%s: failed block allocation", name()); return NULL; } } } else { // Add new block to storage. - log_info(oopstorage, blocks)("%s: new block " PTR_FORMAT, name(), p2i(block)); + log_debug(oopstorage, blocks)("%s: new block " PTR_FORMAT, name(), p2i(block)); // Add new block to the _active_array, growing if needed. if (!_active_array->push(block)) { if (expand_active_array()) { guarantee(_active_array->push(block), "push failed after expansion"); } else { - log_info(oopstorage, blocks)("%s: failed active array expand", name()); + log_debug(oopstorage, blocks)("%s: failed active array expand", name()); Block::delete_block(*block); return NULL; } @@ -472,7 +472,7 @@ oop* OopStorage::allocate() { log_debug(oopstorage, blocks)("%s: block full " PTR_FORMAT, name(), p2i(block)); _allocation_list.unlink(*block); } - log_info(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result)); + log_trace(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result)); return result; } @@ -484,8 +484,8 @@ bool OopStorage::expand_active_array() { assert_lock_strong(_allocation_mutex); ActiveArray* old_array = _active_array; size_t new_size = 2 * old_array->size(); - log_info(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT, - name(), new_size); + log_debug(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT, + name(), new_size); ActiveArray* new_array = ActiveArray::create(new_size, AllocFailStrategy::RETURN_NULL); if (new_array == NULL) return false; new_array->copy_from(old_array); @@ -676,7 +676,7 @@ void OopStorage::release(const oop* ptr) { check_release_entry(ptr); Block* block = find_block_or_null(ptr); assert(block != NULL, "%s: invalid release " PTR_FORMAT, name(), p2i(ptr)); - log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptr)); + log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptr)); block->release_entries(block->bitmask_for_entry(ptr), &_deferred_updates); Atomic::dec(&_allocation_count); } @@ -687,7 +687,7 @@ void OopStorage::release(const oop* const* ptrs, size_t size) { check_release_entry(ptrs[i]); Block* block = find_block_or_null(ptrs[i]); assert(block != NULL, "%s: invalid release " PTR_FORMAT, name(), p2i(ptrs[i])); - log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptrs[i])); + log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptrs[i])); size_t count = 0; uintx releasing = 0; for ( ; i < size; ++i) { @@ -696,7 +696,7 @@ void OopStorage::release(const oop* const* ptrs, size_t size) { // If entry not in block, finish block and resume outer loop with entry. if (!block->contains(entry)) break; // Add entry to releasing bitmap. - log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(entry)); + log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(entry)); uintx entry_bitmask = block->bitmask_for_entry(entry); assert((releasing & entry_bitmask) == 0, "Duplicate entry: " PTR_FORMAT, p2i(entry)); @@ -740,7 +740,7 @@ OopStorage::OopStorage(const char* name, void OopStorage::delete_empty_block(const Block& block) { assert(block.is_empty(), "discarding non-empty block"); - log_info(oopstorage, blocks)("%s: delete empty block " PTR_FORMAT, name(), p2i(&block)); + log_debug(oopstorage, blocks)("%s: delete empty block " PTR_FORMAT, name(), p2i(&block)); Block::delete_block(block); } @@ -933,11 +933,11 @@ bool OopStorage::BasicParState::claim_next_segment(IterationData* data) { } bool OopStorage::BasicParState::finish_iteration(const IterationData* data) const { - log_debug(oopstorage, blocks, stats) - ("Parallel iteration on %s: blocks = " SIZE_FORMAT - ", processed = " SIZE_FORMAT " (%2.f%%)", - _storage->name(), _block_count, data->_processed, - percent_of(data->_processed, _block_count)); + log_info(oopstorage, blocks, stats) + ("Parallel iteration on %s: blocks = " SIZE_FORMAT + ", processed = " SIZE_FORMAT " (%2.f%%)", + _storage->name(), _block_count, data->_processed, + percent_of(data->_processed, _block_count)); return false; } From a6d0d079574b33e322e787cac8bd7d7a0e34b3f8 Mon Sep 17 00:00:00 2001 From: Gustavo Romero Date: Fri, 14 Sep 2018 15:32:22 -0400 Subject: [PATCH 27/41] 8209972: [GRAAL] Don't run RTM tests with Graal Reviewed-by: kvn, goetz --- test/hotspot/jtreg/TEST.ROOT | 2 +- ...kingStatisticsOptionOnSupportedConfig.java | 4 +-- ...ngStatisticsOptionOnUnsupportedConfig.java | 4 +-- .../rtm/cli/TestRTMAbortThresholdOption.java | 2 +- .../TestRTMLockingCalculationDelayOption.java | 2 +- .../cli/TestRTMLockingThresholdOption.java | 2 +- .../rtm/cli/TestRTMRetryCountOption.java | 2 +- .../rtm/cli/TestRTMSpinLoopCountOption.java | 2 +- ...lCountIncrRateOptionOnSupportedConfig.java | 4 +-- ...estUseRTMDeoptOptionOnSupportedConfig.java | 2 +- ...tUseRTMDeoptOptionOnUnsupportedConfig.java | 4 +-- ...MForStackLocksOptionOnSupportedConfig.java | 4 +-- ...orStackLocksOptionOnUnsupportedConfig.java | 4 +-- ...tUseRTMLockingOptionOnSupportedConfig.java | 6 ++--- ...stUseRTMLockingOptionOnUnsupportedCPU.java | 4 +-- ...tUseRTMLockingOptionWithBiasedLocking.java | 4 +-- .../cli/TestUseRTMXendForLockBusyOption.java | 2 +- .../rtm/locking/TestRTMAbortRatio.java | 2 +- .../rtm/locking/TestRTMAbortThreshold.java | 2 +- .../rtm/locking/TestRTMAfterNonRTMDeopt.java | 2 +- .../locking/TestRTMDeoptOnHighAbortRatio.java | 2 +- .../locking/TestRTMDeoptOnLowAbortRatio.java | 2 +- .../TestRTMLockingCalculationDelay.java | 2 +- .../rtm/locking/TestRTMLockingThreshold.java | 2 +- .../rtm/locking/TestRTMRetryCount.java | 2 +- .../rtm/locking/TestRTMSpinLoopCount.java | 2 +- .../locking/TestRTMTotalCountIncrRate.java | 2 +- .../locking/TestUseRTMAfterLockInflation.java | 2 +- .../compiler/rtm/locking/TestUseRTMDeopt.java | 4 +-- .../locking/TestUseRTMForInflatedLocks.java | 2 +- .../rtm/locking/TestUseRTMForStackLocks.java | 2 +- .../locking/TestUseRTMXendForLockBusy.java | 2 +- .../TestNoRTMLockElidingOption.java | 2 +- .../TestUseRTMLockElidingOption.java | 2 +- .../TestPrintPreciseRTMLockingStatistics.java | 2 +- test/jtreg-ext/requires/VMProps.java | 26 ++++++------------- 36 files changed, 54 insertions(+), 64 deletions(-) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 3b5e1b9b1f3..fc2e655d1bc 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -56,7 +56,7 @@ requires.properties= \ vm.hasSAandCanAttach \ vm.hasJFR \ vm.rtm.cpu \ - vm.rtm.os \ + vm.rtm.compiler \ vm.aot \ vm.cds \ vm.cds.custom.loaders \ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java index 5a05b5a6b0c..7800fd2ca22 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify PrintPreciseRTMLockingStatistics on CPUs with + * @summary Verify PrintPreciseRTMLockingStatistics on CPUs and OSs with * rtm support and on VM with rtm locking support, * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java index 76e380c3934..de289f2f108 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify PrintPreciseRTMLockingStatistics on CPUs without + * @summary Verify PrintPreciseRTMLockingStatistics on CPUs or OSs without * rtm support and/or unsupported VM. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os) + * @requires !vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java index c314e68dcd7..e6e4893065a 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestRTMAbortThresholdOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java index d8823501397..119be8b985a 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestRTMLockingCalculationDelayOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java index 532e61e69b5..a00c408565b 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestRTMLockingThresholdOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java index 8a472ec1bcb..d87f6399f0c 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestRTMRetryCountOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java index 15868ff12ed..ddfa4573088 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestRTMSpinLoopCountOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java index 4ceae005539..3d7023f2680 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify RTMTotalCountIncrRate option processing on CPU with + * @summary Verify RTMTotalCountIncrRate option processing on CPU and OS with * rtm support and on VM with rtm locking support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java index 3f66ab39568..44467ceac56 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java index da1a207d16c..37035712e4e 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify UseRTMDeopt option processing on CPUs without rtm support + * @summary Verify UseRTMDeopt option processing on CPUs or OSs without rtm support * or on VMs without rtm locking support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os) + * @requires !vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java index f52d8561db5..2d232cb11ed 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify UseRTMForStackLocks option processing on CPU with + * @summary Verify UseRTMForStackLocks option processing on CPU and OS with * rtm support when VM supports rtm locking. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java index 49bfdb0ba7f..16c29d78e1d 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify UseRTMForStackLocks option processing on CPUs without + * @summary Verify UseRTMForStackLocks option processing on CPUs or OSs without * rtm support and/or on VMs without rtm locking support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os) + * @requires !vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java index 7ed1c3de26a..54fd18d938d 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify UseRTMLocking option processing on CPU with rtm support and - * on VM with rtm-locking support. + * @summary Verify UseRTMLocking option processing on CPU and OS with rtm support and + * on VM with rtm locking support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java index f45c8cda89e..d6c45b6c42e 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java @@ -24,12 +24,12 @@ /** * @test * @bug 8031320 - * @summary Verify UseRTMLocking option processing on CPU without + * @summary Verify UseRTMLocking option processing on CPUs without * rtm support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires (!vm.rtm.cpu) & (vm.flavor == "server" & !vm.emulatedClient) + * @requires !vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java index f133ccc405b..8fe96a19825 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java @@ -25,11 +25,11 @@ * @test * @bug 8031320 * @summary Verify processing of UseRTMLocking and UseBiasedLocking - * options combination on CPU and VM with rtm support. + * options combination on CPU, OS, and VM with rtm support. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java index bf94689be6c..49a5ca169db 100644 --- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java +++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * + * @requires vm.rtm.compiler * @run main/othervm compiler.rtm.cli.TestUseRTMXendForLockBusyOption */ diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java index fe510beb150..b119d022957 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java index 6288d7e9e99..d7ba8e98b29 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index f8a0c7b994c..0de4b1aeadf 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -31,7 +31,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java index cc60c6b30ed..9e70aaf7fad 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index 944e7a98890..804ce7b005d 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java index af3df7c3a5b..dfa6db5932b 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java index 626c840545e..51d0bca935b 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java index ae492d76c76..a1a80e13e3d 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java index 3f641e0f7e9..13119a24c78 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index f25517a759c..df211cae4d5 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java index 8f9d4c6128f..62d21936261 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java index b839f863889..4b4489fb4ff 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java @@ -25,11 +25,11 @@ * @test * @bug 8031320 * @summary Verify that UseRTMDeopt affects uncommon trap installation in - * copmpiled methods with synchronized block. + * compiled methods with synchronized block. * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java index 805599c18ec..4fb403b1d18 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java index 425d1c3bd26..bf1f2e75fa7 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java @@ -28,7 +28,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java index 0f2a1da6dc3..74265f96ebb 100644 --- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java +++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java index 34646f9b0bd..16ee3712133 100644 --- a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java +++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java @@ -29,7 +29,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java index 43c9a884927..f46b730ca2b 100644 --- a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java +++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java @@ -30,7 +30,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java index fc6b58f048a..77ead587a16 100644 --- a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java +++ b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java @@ -31,7 +31,7 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os + * @requires vm.rtm.cpu & vm.rtm.compiler * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index ee078dfa31e..04ae39c46be 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -84,7 +84,7 @@ public class VMProps implements Callable> { map.put("vm.hasJFR", vmHasJFR()); map.put("vm.cpu.features", cpuFeatures()); map.put("vm.rtm.cpu", vmRTMCPU()); - map.put("vm.rtm.os", vmRTMOS()); + map.put("vm.rtm.compiler", vmRTMCompiler()); map.put("vm.aot", vmAOT()); // vm.cds is true if the VM is compiled with cds support. map.put("vm.cds", vmCDS()); @@ -131,8 +131,6 @@ public class VMProps implements Callable> { } } - - /** * @return VM type value extracted from the "java.vm.name" property. */ @@ -301,24 +299,16 @@ public class VMProps implements Callable> { } /** - * @return true if VM runs RTM supported OS and false otherwise. + * @return true if compiler in use supports RTM and false otherwise. */ - protected String vmRTMOS() { - boolean isRTMOS = true; + protected String vmRTMCompiler() { + boolean isRTMCompiler = false; - if (Platform.isAix()) { - // Actually, this works since AIX 7.1.3.30, but os.version property - // is set to 7.1. - isRTMOS = (Platform.getOsVersionMajor() > 7) || - (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1); - - } else if (Platform.isLinux()) { - if (Platform.isPPC()) { - isRTMOS = (Platform.getOsVersionMajor() > 4) || - (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1); - } + if (Compiler.isC2Enabled() && + (Platform.isX86() || Platform.isX64() || Platform.isPPC())) { + isRTMCompiler = true; } - return "" + isRTMOS; + return "" + isRTMCompiler; } /** From 8b28ad6efe68b076bdbd6ca0043a0fddd8847230 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 14 Sep 2018 14:02:57 -0700 Subject: [PATCH 28/41] 8210732: remove jdk.testlibrary.Utils Reviewed-by: alanb, jcbeyler --- .../Dictionary/ProtectionDomainCacheTest.java | 5 +- test/jdk/com/sun/jdi/BadHandshakeTest.java | 5 +- .../com/sun/jdi/BasicJDWPConnectionTest.java | 3 +- test/jdk/com/sun/jdi/DoubleAgentTest.java | 4 +- test/jdk/com/sun/jdi/ExclusiveBind.java | 5 +- test/jdk/com/sun/tools/attach/RunnerUtil.java | 2 +- .../tools/attach/StartManagementAgent.java | 5 +- .../ClipboardInterVMTest.java | 6 +- .../forNameLeak/ClassForNameLeak.java | 5 +- .../lang/Thread/ThreadStateController.java | 2 +- .../PremainClass/NoPremainAgentTest.java | 5 +- .../PremainClass/PremainClassTest.java | 5 +- .../PremainClass/ZeroArgPremainAgentTest.java | 5 +- .../invoke/LFCaching/LambdaFormTestCase.java | 2 +- .../MethodHandles/CatchExceptionTest.java | 2 +- .../invoke/MethodHandlesAsCollectorTest.java | 2 +- .../invoke/MethodHandlesCastFailureTest.java | 2 +- .../lang/invoke/MethodHandlesGeneralTest.java | 2 +- .../MethodHandlesInsertArgumentsTest.java | 2 +- .../invoke/MethodHandlesInvokersTest.java | 2 +- .../MethodHandlesPermuteArgumentsTest.java | 2 +- .../MethodHandlesSpreadArgumentsTest.java | 2 +- .../jdk/java/lang/invoke/PermuteArgsTest.java | 2 +- .../invoke/TestCatchExceptionWithVarargs.java | 2 +- .../java/lang/invoke/VarargsArrayTest.java | 2 +- .../lib/CodeCacheOverflowProcessor.java | 4 +- .../MemoryMXBean/LowMemoryTest.java | 6 +- .../lang/management/MemoryMXBean/RunUtil.java | 2 +- .../java/net/MulticastSocket/MultiDead.java | 4 +- .../java/net/httpclient/security/Driver.java | 5 +- .../channels/FileChannel/LoopingTruncate.java | 6 +- .../java/nio/channels/Selector/Wakeup.java | 4 +- .../CancelledProducerConsumerLoops.java | 4 +- .../concurrent/BlockingQueue/Interrupt.java | 4 +- .../MultipleProducersSingleConsumerLoops.java | 4 +- .../BlockingQueue/ProducerConsumerLoops.java | 4 +- .../SingleProducerMultipleConsumerLoops.java | 4 +- .../concurrent/CompletableFuture/Basic.java | 4 +- .../ConcurrentHashMap/MapLoops.java | 4 +- .../ConcurrentQueueLoops.java | 4 +- .../util/concurrent/CyclicBarrier/Basic.java | 4 +- .../concurrent/Exchanger/ExchangeLoops.java | 4 +- .../ExecutorCompletionServiceLoops.java | 4 +- .../concurrent/Executors/AutoShutdown.java | 4 +- .../FutureTask/BlockingTaskExecutor.java | 4 +- .../FutureTask/CancelledFutureLoops.java | 4 +- .../concurrent/FutureTask/DoneMeansDone.java | 4 +- .../DelayOverflow.java | 4 +- .../ZeroCorePoolSize.java | 4 +- .../ZeroCoreThreads.java | 4 +- .../ThreadPoolExecutor/CoreThreadTimeOut.java | 4 +- .../concurrent/ThreadPoolExecutor/Custom.java | 4 +- .../FlakyThreadFactory.java | 4 +- .../ThreadPoolExecutor/SelfInterrupt.java | 4 +- .../ThreadPoolExecutor/ThreadRestarts.java | 4 +- .../ThreadPoolExecutor/TimeOutShrink.java | 4 +- .../concurrent/forkjoin/SubmissionTest.java | 4 +- .../locks/Lock/CheckedLockLoops.java | 4 +- .../locks/Lock/TimedAcquireLeak.java | 4 +- .../ReentrantLock/LockOncePerThreadLoops.java | 4 +- .../SimpleReentrantLockLoops.java | 4 +- .../locks/ReentrantLock/TimeoutLockLoops.java | 4 +- .../locks/ReentrantReadWriteLock/Count.java | 4 +- .../ReentrantReadWriteLock/MapLoops.java | 4 +- .../concurrent/locks/StampedLock/Basic.java | 4 +- .../monitor/GaugeMonitorDeadlockTest.java | 4 +- .../management/monitor/StartStopTest.java | 5 +- .../mxbean/MXBeanWeirdParamTest.java | 3 +- .../connection/DefaultAgentFilterTest.java | 5 +- .../mandatory/loading/MethodResultTest.java | 4 +- .../security/AuthorizationTest.java | 3 +- .../management/security/SecurityTest.java | 3 +- .../testlibrary/jdk/testlibrary/Utils.java | 295 ------------------ .../MonitoredVm/TestPollingInterval.java | 2 +- .../sun/management/jdp/DynamicLauncher.java | 2 +- .../management/jdp/PortAlreadyInUseTest.java | 2 +- .../bootstrap/AbstractFilePermissionTest.java | 4 +- .../bootstrap/LocalManagementTest.java | 5 +- .../jmxremote/bootstrap/RmiBootstrapTest.java | 2 +- .../jmxremote/bootstrap/RmiBootstrapTest.sh | 4 +- .../bootstrap/RmiRegistrySslTest.java | 5 +- .../bootstrap/RmiRegistrySslTestApp.java | 2 +- .../bootstrap/RmiSslBootstrapTest.sh | 4 +- .../jmxremote/startstop/JMXStartStopTest.java | 5 +- .../ssl/SSLEngineImpl/SSLEngineKeyLimit.java | 4 +- .../ssl/SSLSocketImpl/SSLSocketKeyLimit.java | 4 +- test/jdk/sun/tools/jcmd/TestJcmdDefaults.java | 2 +- test/jdk/sun/tools/jcmd/TestJcmdSanity.java | 2 +- .../sun/tools/jhsdb/BasicLauncherTest.java | 4 +- .../jhsdb/heapconfig/JMapHeapConfigTest.java | 3 +- .../jhsdb/heapconfig/TmtoolTestScenario.java | 2 +- test/jdk/sun/tools/jps/JpsHelper.java | 2 +- .../tools/jstack/DeadlockDetectionTest.java | 4 +- .../sun/tools/jstatd/JstatGCUtilParser.java | 2 +- test/jdk/sun/tools/jstatd/JstatdTest.java | 2 +- 95 files changed, 159 insertions(+), 475 deletions(-) delete mode 100644 test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java diff --git a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java index 2ec1df1ef6a..a14cc39c545 100644 --- a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java +++ b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java @@ -27,7 +27,8 @@ * @summary Call Class.forName() on the system classloader from a class loaded * from a custom classloader, using the current class's protection domain. * @library /test/jdk/lib/testlibrary - * @build jdk.testlibrary.Utils JarUtils + * @library /test/lib + * @build jdk.test.lib.Utils JarUtils * @build ClassForName ProtectionDomainCacheTest * @run main/othervm/policy=test.policy -XX:+UnlockDiagnosticVMOptions -XX:VerifySubSet=dictionary -XX:+VerifyAfterGC -Xlog:gc+verify=debug,protectiondomain=trace,class+unload:gc.log -Djava.security.manager ProtectionDomainCacheTest */ @@ -39,7 +40,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * Create .jar, load ClassForName from .jar using a URLClassLoader diff --git a/test/jdk/com/sun/jdi/BadHandshakeTest.java b/test/jdk/com/sun/jdi/BadHandshakeTest.java index 8e76b6314ec..7e85d4fa7e8 100644 --- a/test/jdk/com/sun/jdi/BadHandshakeTest.java +++ b/test/jdk/com/sun/jdi/BadHandshakeTest.java @@ -36,18 +36,17 @@ import java.util.Iterator; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.test.lib.process.ProcessTools; /* @test * @bug 6306165 6432567 * @summary Check that a bad handshake doesn't cause a debuggee to abort - * @library /lib/testlibrary * @library /test/lib * * @modules java.management * jdk.jdi - * @build jdk.testlibrary.* VMConnection BadHandshakeTest Exit0 + * @build VMConnection BadHandshakeTest Exit0 * @run driver BadHandshakeTest */ public class BadHandshakeTest { diff --git a/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java index 9270c053178..3207348cdfa 100644 --- a/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java +++ b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java @@ -24,7 +24,6 @@ /* * @test * @summary Smoke test for JDWP hardening - * @library /lib/testlibrary * @library /test/lib * @run driver BasicJDWPConnectionTest */ @@ -37,7 +36,7 @@ import java.net.Socket; import java.net.SocketException; import jdk.test.lib.apps.LingeredApp; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import java.util.ArrayList; import java.util.List; diff --git a/test/jdk/com/sun/jdi/DoubleAgentTest.java b/test/jdk/com/sun/jdi/DoubleAgentTest.java index 7eb286bda6d..a5da2e8091f 100644 --- a/test/jdk/com/sun/jdi/DoubleAgentTest.java +++ b/test/jdk/com/sun/jdi/DoubleAgentTest.java @@ -23,16 +23,14 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* @test * @bug 6354345 * @summary Check that multiple -agentlib statements in command line fails * - * @library /lib/testlibrary * @library /test/lib * @modules java.management - * @build jdk.testlibrary.* * @build DoubleAgentTest Exit0 * @run driver DoubleAgentTest */ diff --git a/test/jdk/com/sun/jdi/ExclusiveBind.java b/test/jdk/com/sun/jdi/ExclusiveBind.java index 3977891fe29..e7e715a873a 100644 --- a/test/jdk/com/sun/jdi/ExclusiveBind.java +++ b/test/jdk/com/sun/jdi/ExclusiveBind.java @@ -25,12 +25,11 @@ * @bug 4531526 * @summary Test that more than one debuggee cannot bind to same port * at the same time. - * @library /lib/testlibrary * @library /test/lib * * @modules java.management * jdk.jdi - * @build jdk.testlibrary.* VMConnection ExclusiveBind HelloWorld + * @build VMConnection ExclusiveBind HelloWorld * @run driver ExclusiveBind */ import java.net.ServerSocket; @@ -46,7 +45,7 @@ import java.util.Iterator; import java.util.concurrent.TimeUnit; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ExclusiveBind { /* diff --git a/test/jdk/com/sun/tools/attach/RunnerUtil.java b/test/jdk/com/sun/tools/attach/RunnerUtil.java index 136bd158f0b..92f1a951d07 100644 --- a/test/jdk/com/sun/tools/attach/RunnerUtil.java +++ b/test/jdk/com/sun/tools/attach/RunnerUtil.java @@ -28,7 +28,7 @@ import java.util.Arrays; import jdk.test.lib.thread.ProcessThread; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * Utility functions for test runners. diff --git a/test/jdk/com/sun/tools/attach/StartManagementAgent.java b/test/jdk/com/sun/tools/attach/StartManagementAgent.java index 403c0b3669c..0bc62b4a223 100644 --- a/test/jdk/com/sun/tools/attach/StartManagementAgent.java +++ b/test/jdk/com/sun/tools/attach/StartManagementAgent.java @@ -34,19 +34,18 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import jdk.test.lib.thread.ProcessThread; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent * - * @library /lib/testlibrary * @library /test/lib * @modules java.management * jdk.attach * jdk.jartool/sun.tools.jar * - * @run build jdk.testlibrary.* Application SimpleProvider jdk.testlibrary.* + * @run build Application SimpleProvider * @run main/timeout=300 StartManagementAgent */ diff --git a/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java b/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java index 339d2e1a72b..12c752a8789 100644 --- a/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java +++ b/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java @@ -27,12 +27,12 @@ @bug 8071668 @summary Check whether clipboard see changes from external process after taking ownership @author Anton Nashatyrev: area=datatransfer - @library /lib/testlibrary - @build jdk.testlibrary.Utils + @library /test/lib + @build jdk.test.lib.Utils @run main ClipboardInterVMTest */ -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import java.awt.*; import java.awt.datatransfer.*; diff --git a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java index af3d83d4e86..6053dfe2ff2 100644 --- a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java +++ b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java @@ -27,7 +27,8 @@ * @summary Call Class.forName() on the system classloader from a class loaded * from a custom classloader. * @library /lib/testlibrary - * @build jdk.testlibrary.Utils JarUtils + * @library /test/lib + * @build jdk.test.lib.Utils JarUtils * @build ClassForName ClassForNameLeak * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak */ @@ -48,7 +49,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * Create .jar, load ClassForName from .jar using a URLClassLoader diff --git a/test/jdk/java/lang/Thread/ThreadStateController.java b/test/jdk/java/lang/Thread/ThreadStateController.java index d644a1a9ece..68d8b659cd5 100644 --- a/test/jdk/java/lang/Thread/ThreadStateController.java +++ b/test/jdk/java/lang/Thread/ThreadStateController.java @@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; import jdk.test.lib.LockFreeLogger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * ThreadStateController allows a thread to request this thread to transition diff --git a/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java b/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java index 81e7d303823..5048d2132d2 100644 --- a/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java +++ b/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java @@ -23,17 +23,16 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test * @bug 6289149 * @summary test when the agent's class is missing the premain() function. - * @library /lib/testlibrary * @library /test/lib * @modules java.management * java.instrument - * @run build jdk.testlibrary.* DummyMain + * @run build DummyMain * @run shell ../MakeJAR3.sh NoPremainAgent * @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest */ diff --git a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java index 4ff0e9245bb..b59b69d3c75 100644 --- a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java +++ b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java @@ -23,16 +23,15 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test * @bug 5055293 * @summary Test non ascii characters in the Premain-Class attribute. - * @library /lib/testlibrary * @library /test/lib * @modules java.management - * @run build jdk.testlibrary.* DummyMain + * @run build DummyMain * @run main PremainClassTest */ public class PremainClassTest { diff --git a/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java b/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java index 4f32f3c0254..ecffe835ece 100644 --- a/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java +++ b/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java @@ -23,17 +23,16 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test * @bug 6289149 * @summary test when the agent's class has a zero arg premain() function. - * @library /lib/testlibrary * @library /test/lib * @modules java.management * java.instrument - * @run build jdk.testlibrary.* DummyMain + * @run build DummyMain * @run shell ../MakeJAR3.sh ZeroArgPremainAgent * @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest */ diff --git a/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java index 1bce3484110..182260dd1b3 100644 --- a/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java +++ b/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java @@ -22,7 +22,7 @@ */ import jdk.test.lib.TimeLimitedRunner; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; import test.java.lang.invoke.lib.Helper; diff --git a/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java index de2bec2c198..b1c9d902640 100644 --- a/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java +++ b/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java @@ -25,7 +25,7 @@ package test.java.lang.invoke.MethodHandles; import jdk.test.lib.TimeLimitedRunner; import jdk.testlibrary.Asserts; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; import test.java.lang.invoke.lib.Helper; diff --git a/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java index 6b816f89c11..aed10489e49 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesAsCollectorTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java index 479bd2d14db..f6a46df36f3 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesCastFailureTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java index cd859c8809a..0c1a887e763 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesGeneralTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java index 4245ce29ec6..07bcdffae2a 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesInsertArgumentsTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java index 589881a2b9f..2a1bfe876b7 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesInvokersTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java index 912a2b9256c..085ff908f60 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesPermuteArgumentsTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java index b0b6f4a3d3e..4c869dce9d0 100644 --- a/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java +++ b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile MethodHandlesTest.java MethodHandlesSpreadArgumentsTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * -XX:-VerifyDependencies diff --git a/test/jdk/java/lang/invoke/PermuteArgsTest.java b/test/jdk/java/lang/invoke/PermuteArgsTest.java index e175102eb80..9b73b39329f 100644 --- a/test/jdk/java/lang/invoke/PermuteArgsTest.java +++ b/test/jdk/java/lang/invoke/PermuteArgsTest.java @@ -23,7 +23,7 @@ /* @test * @summary unit tests for method handles which permute their arguments - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest */ diff --git a/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java b/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java index 9701cee7f10..698cb7cea11 100644 --- a/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java +++ b/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java @@ -24,7 +24,7 @@ /* * @test * @bug 8019184 - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @summary MethodHandles.catchException() fails when methods have 8 args + varargs * @run main TestCatchExceptionWithVarargs */ diff --git a/test/jdk/java/lang/invoke/VarargsArrayTest.java b/test/jdk/java/lang/invoke/VarargsArrayTest.java index c898bb59f2d..d368a2aad6b 100644 --- a/test/jdk/java/lang/invoke/VarargsArrayTest.java +++ b/test/jdk/java/lang/invoke/VarargsArrayTest.java @@ -34,7 +34,7 @@ import java.util.Collections; * @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int), * MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int) * @modules java.base/sun.invoke.util - * @library /lib/testlibrary /java/lang/invoke/common + * @library /test/lib /java/lang/invoke/common * @compile/module=java.base java/lang/invoke/MethodHandleHelper.java * @run main/bootclasspath VarargsArrayTest * @run main/bootclasspath/othervm -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250 diff --git a/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java b/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java index 0cd353897bc..9dfa1f2592f 100644 --- a/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java +++ b/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java @@ -23,7 +23,7 @@ package test.java.lang.invoke.lib; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * Helper class used to catch and process VirtualMachineError with message "Out @@ -36,7 +36,7 @@ public class CodeCacheOverflowProcessor { /** * Checks if an instance of Throwable is caused by VirtualMachineError with * message "Out of space in CodeCache". May be used as filter in method - * {@code jdk.testlibrary.Utils.filterException}. + * {@code jdk.test.lib.Utils.filterException}. * * @param t - Throwable to check. * @return true if Throwable is caused by VME, false otherwise. diff --git a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java index 69a51e2030d..7b8a6c052d7 100644 --- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java +++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java @@ -32,9 +32,9 @@ * @requires vm.gc == "null" * @requires vm.opt.ExplicitGCInvokesConcurrent != "true" * @requires vm.opt.DisableExplicitGC != "true" - * @library /lib/testlibrary/ /test/lib + * @library /test/lib * - * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil + * @build LowMemoryTest MemoryUtil RunUtil * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest @@ -47,7 +47,7 @@ import javax.management.*; import javax.management.openmbean.CompositeData; import jdk.test.lib.JDKToolFinder; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import sun.hotspot.code.Compiler; diff --git a/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java b/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java index bf6cab95cfb..e94bc6c3c2c 100644 --- a/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java +++ b/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java @@ -31,7 +31,7 @@ import java.util.Arrays; import jdk.test.lib.JDKToolFinder; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class RunUtil { diff --git a/test/jdk/java/net/MulticastSocket/MultiDead.java b/test/jdk/java/net/MulticastSocket/MultiDead.java index 5c616e0bc77..91d58567952 100644 --- a/test/jdk/java/net/MulticastSocket/MultiDead.java +++ b/test/jdk/java/net/MulticastSocket/MultiDead.java @@ -25,9 +25,7 @@ * @test * @bug 8072466 * @summary Deadlock when initializing MulticastSocket and DatagramSocket - * @library /lib/testlibrary * @library /test/lib - * @build jdk.testlibrary.* * @run main/othervm MultiDead */ @@ -38,7 +36,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.CountDownLatch; import static java.util.concurrent.TimeUnit.MILLISECONDS; import jdk.test.lib.JDKToolLauncher; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class MultiDead { private static final int THREAD_PAIR_COUNT = 4; diff --git a/test/jdk/java/net/httpclient/security/Driver.java b/test/jdk/java/net/httpclient/security/Driver.java index 04e4d3774a8..e09612361fb 100644 --- a/test/jdk/java/net/httpclient/security/Driver.java +++ b/test/jdk/java/net/httpclient/security/Driver.java @@ -25,10 +25,11 @@ * @test * @bug 8087112 * @library /lib/testlibrary/ + * @library /test/lib * @modules java.net.http * java.logging * jdk.httpserver - * @build jdk.testlibrary.SimpleSSLContext jdk.testlibrary.Utils + * @build jdk.testlibrary.SimpleSSLContext jdk.test.lib.Utils * @compile ../../../../com/sun/net/httpserver/LogFilter.java * @compile ../../../../com/sun/net/httpserver/FileServerHandler.java * @compile ../ProxyServer.java @@ -55,7 +56,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * Driver for tests diff --git a/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java index 3855b2c47ad..5f2e414f937 100644 --- a/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java +++ b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java @@ -25,8 +25,8 @@ * @test * @bug 8137121 8137230 * @summary (fc) Infinite loop FileChannel.truncate - * @library /lib/testlibrary - * @build jdk.testlibrary.Utils + * @library /test/lib + * @build jdk.test.lib.Utils * @run main/othervm/timeout=300 LoopingTruncate */ @@ -37,7 +37,7 @@ import java.nio.file.Files; import java.nio.file.Path; import static java.nio.file.StandardOpenOption.*; import java.util.concurrent.TimeUnit; -import static jdk.testlibrary.Utils.adjustTimeout; +import static jdk.test.lib.Utils.adjustTimeout; public class LoopingTruncate { diff --git a/test/jdk/java/nio/channels/Selector/Wakeup.java b/test/jdk/java/nio/channels/Selector/Wakeup.java index 8caacbbb8c5..f43a8cce4dc 100644 --- a/test/jdk/java/nio/channels/Selector/Wakeup.java +++ b/test/jdk/java/nio/channels/Selector/Wakeup.java @@ -24,7 +24,7 @@ /* @test * @bug 6405995 * @summary Unit test for selector wakeup and interruption - * @library .. /lib/testlibrary/ + * @library .. /test/lib */ import java.io.*; @@ -44,7 +44,7 @@ public class Wakeup { } static class Sleeper extends TestThread { - private static final long TIMEOUT = jdk.testlibrary.Utils.adjustTimeout(20_000); + private static final long TIMEOUT = jdk.test.lib.Utils.adjustTimeout(20_000); // barrier is used to synchronize sleeper thread and checking // thread which is the main thread: when go() get to the end, diff --git a/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java b/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java index ae5548c9fb9..e9ed9608995 100644 --- a/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary Checks for responsiveness of blocking queues to cancellation. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -56,7 +56,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class CancelledProducerConsumerLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java b/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java index ddeeb0ed774..e96aa9b9758 100644 --- a/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java @@ -26,7 +26,7 @@ * @bug 6384064 * @summary Check proper handling of interrupts * @author Martin Buchholz - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -41,7 +41,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledThreadPoolExecutor; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class Interrupt { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java b/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java index 076521266d0..1ffff543301 100644 --- a/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary multiple producers and single consumer using blocking queues - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -52,7 +52,7 @@ import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.atomic.AtomicInteger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class MultipleProducersSingleConsumerLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java b/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java index 454a58facef..9ea23980740 100644 --- a/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary multiple producers and consumers using blocking queues - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -52,7 +52,7 @@ import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.atomic.AtomicInteger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ProducerConsumerLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java b/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java index d1810680dd9..6f672ef7181 100644 --- a/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary check ordering for blocking queues with 1 producer and multiple consumers - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -51,7 +51,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.SynchronousQueue; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class SingleProducerMultipleConsumerLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/CompletableFuture/Basic.java b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java index 140114eddd3..72f9a2b017d 100644 --- a/test/jdk/java/util/concurrent/CompletableFuture/Basic.java +++ b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java @@ -35,7 +35,7 @@ * @test * @bug 8005696 * @summary Basic tests for CompletableFuture - * @library /lib/testlibrary/ + * @library /test/lib * @run main Basic * @run main/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 Basic * @author Chris Hegarty @@ -56,7 +56,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class Basic { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java index 028dabb00dd..923776a86fc 100644 --- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java @@ -41,7 +41,7 @@ * inserts it, and if present, with probability premove it removes * it. (pinsert and premove are expressed as percentages to simplify * parsing from command line.) - * @library /lib/testlibrary/ + * @library /test/lib * @run main/timeout=1600 MapLoops */ @@ -54,7 +54,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class MapLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java b/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java index 3c8d72e4bb5..a5fd574051c 100644 --- a/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java +++ b/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 6785442 * @summary Checks that a set of threads can repeatedly get and modify items - * @library /lib/testlibrary/ + * @library /test/lib * @run main ConcurrentQueueLoops 8 123456 */ @@ -58,7 +58,7 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.atomic.AtomicInteger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ConcurrentQueueLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java b/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java index 7bf93b3c168..8310e4adc4b 100644 --- a/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java +++ b/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java @@ -25,7 +25,7 @@ * @test * @bug 6253848 6366811 * @summary Basic tests for CyclicBarrier - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz, David Holmes */ @@ -39,7 +39,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class Basic { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java b/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java index f2ef41a9475..84093f1248b 100644 --- a/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java +++ b/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary checks to make sure a pipeline of exchangers passes data. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -44,7 +44,7 @@ import java.util.concurrent.CyclicBarrier; import java.util.concurrent.Exchanger; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ExchangeLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java b/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java index c8133368b05..d4597df0255 100644 --- a/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java +++ b/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4965960 * @summary Exercise ExecutorCompletionService - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -44,7 +44,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ExecutorCompletionServiceLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/Executors/AutoShutdown.java b/test/jdk/java/util/concurrent/Executors/AutoShutdown.java index 95dd38c02cc..579a5c8da85 100644 --- a/test/jdk/java/util/concurrent/Executors/AutoShutdown.java +++ b/test/jdk/java/util/concurrent/Executors/AutoShutdown.java @@ -25,7 +25,7 @@ * @test * @bug 6399443 * @summary Check for auto-shutdown and gc of singleThreadExecutors - * @library /lib/testlibrary/ + * @library /test/lib * @run main/othervm/timeout=1000 AutoShutdown * @author Martin Buchholz */ @@ -41,7 +41,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class AutoShutdown { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java index ab4cc7f2ebb..69ea9f645cd 100644 --- a/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java +++ b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java @@ -26,7 +26,7 @@ * @bug 6431315 * @summary ExecutorService.invokeAll might hang * @author Martin Buchholz - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -37,7 +37,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * Adapted from Doug Lea, which was... diff --git a/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java b/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java index b6c645e6018..7874b437243 100644 --- a/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java +++ b/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java @@ -37,7 +37,7 @@ * @summary Checks for responsiveness of futures to cancellation. * Runs under the assumption that ITERS computations require more than * TIMEOUT msecs to complete. - * @library /lib/testlibrary/ + * @library /test/lib * @run main/timeout=2000 CancelledFutureLoops */ @@ -52,7 +52,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.locks.ReentrantLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public final class CancelledFutureLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java b/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java index 38239f72e24..329365f5ecd 100644 --- a/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java +++ b/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java @@ -36,7 +36,7 @@ * @bug 8073704 * @summary Checks that once isDone() returns true, * get() never throws InterruptedException or TimeoutException - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -52,7 +52,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class DoneMeansDone { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java index 071f7b51b15..9bfaf0bfd3e 100644 --- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java +++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java @@ -35,7 +35,7 @@ * @test * @bug 6725789 * @summary Check for long overflow in task time comparison. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.DAYS; @@ -45,7 +45,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledThreadPoolExecutor; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class DelayOverflow { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java index 23ce8bb0e95..eec696103fc 100644 --- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java +++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java @@ -26,14 +26,14 @@ * @bug 7091003 * @summary ScheduledExecutorService never executes Runnable * with corePoolSize of zero - * @library /lib/testlibrary/ + * @library /test/lib * @author Chris Hegarty */ import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.ScheduledThreadPoolExecutor; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * Verify that tasks can be run even with a core pool size of 0. diff --git a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java index 44ccbb36ff2..95abd5b444d 100644 --- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java +++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java @@ -35,7 +35,7 @@ * @test * @bug 8022642 8065320 8129861 * @summary Ensure relative sanity when zero core threads - * @library /lib/testlibrary/ + * @library /test/lib * @modules java.base/java.util.concurrent:open */ @@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; import java.util.function.BooleanSupplier; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ZeroCoreThreads { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java index 0bbb5141224..06961f84085 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java @@ -25,7 +25,7 @@ * @test * @bug 6233235 6268386 * @summary Test allowsCoreThreadTimeOut - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz */ @@ -37,7 +37,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class CoreThreadTimeOut { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java index a1a21655b88..b1faaa48a12 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java @@ -25,7 +25,7 @@ * @test * @bug 6277663 * @summary Test TPE extensibility framework - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz */ @@ -41,7 +41,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BooleanSupplier; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class Custom { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java index df30367f59a..67225383453 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java @@ -35,7 +35,7 @@ /* * @test * @summary Should be able to shutdown a pool when worker creation failed. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -44,7 +44,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class FlakyThreadFactory { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java index c93ed9bf4f9..11c4b463312 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java @@ -25,7 +25,7 @@ * @test * @bug 6576792 * @summary non-idle worker threads should not be interrupted - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -34,7 +34,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class SelfInterrupt { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java index 1a51d583e20..aedcad0181b 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java @@ -36,7 +36,7 @@ * @test * @summary Only one thread should be created when a thread needs to * be kept alive to service a delayed task waiting in the queue. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -44,7 +44,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class ThreadRestarts { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java b/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java index 007c52c8cb1..d318de6faa2 100644 --- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java @@ -25,7 +25,7 @@ * @test * @bug 6458662 * @summary poolSize might shrink below corePoolSize after timeout - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz */ @@ -34,7 +34,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class TimeOutShrink { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java b/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java index 24ffd259217..46d40846968 100644 --- a/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java +++ b/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java @@ -23,13 +23,13 @@ import java.util.concurrent.ForkJoinPool; import java.util.concurrent.atomic.AtomicBoolean; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test * @bug 8078490 * @summary Test submission and execution of task without joining - * @library /lib/testlibrary/ + * @library /test/lib */ public class SubmissionTest { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java b/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java index ba7116c27b2..66649a88c65 100644 --- a/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java +++ b/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary basic safety and liveness of ReentrantLocks, and other locks based on them - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -48,7 +48,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public final class CheckedLockLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java b/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java index 74b50624df0..01a2a5b9ee4 100644 --- a/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java +++ b/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java @@ -25,7 +25,7 @@ * @test * @bug 6460501 6236036 6500694 6490770 * @summary Repeated failed timed waits shouldn't leak memory - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz */ @@ -56,7 +56,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class TimedAcquireLeak { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java b/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java index 43963e3554e..150ab03f502 100644 --- a/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java +++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -45,7 +45,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.locks.ReentrantLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public final class LockOncePerThreadLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java b/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java index 85e403970d5..cfc3fc6a95f 100644 --- a/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java +++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 * @summary multiple threads using a single lock - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -45,7 +45,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.ThreadLocalRandom; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public final class SimpleReentrantLockLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java b/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java index d0b9ff1c1e4..4eaff09bf1d 100644 --- a/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java +++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java @@ -35,7 +35,7 @@ * @test * @bug 4486658 5031862 8140471 * @summary Checks for responsiveness of locks to timeouts. - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -46,7 +46,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public final class TimeoutLockLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java index e6e094ac76b..fcd11c9b0b8 100644 --- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java +++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java @@ -25,7 +25,7 @@ * @test * @bug 6207928 6328220 6378321 6625723 * @summary Recursive lock invariant sanity checks - * @library /lib/testlibrary/ + * @library /test/lib * @author Martin Buchholz */ @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; // I am the Cownt, and I lahve to cownt. public class Count { diff --git a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java index aec57e0cbd0..69b863fde14 100644 --- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java +++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java @@ -41,7 +41,7 @@ * inserts it, and if present, with probability premove it removes * it. (pinsert and premove are expressed as percentages to simplify * parsing from command line.) - * @library /lib/testlibrary/ + * @library /test/lib */ import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -51,7 +51,7 @@ import java.util.SplittableRandom; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class MapLoops { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java b/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java index ea90f3c03de..75bf3d5a28f 100644 --- a/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java +++ b/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java @@ -35,7 +35,7 @@ * @test * @bug 8005697 * @summary Basic tests for StampedLock - * @library /lib/testlibrary/ + * @library /test/lib * @author Chris Hegarty */ @@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.StampedLock; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class Basic { static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); diff --git a/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java b/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java index b6e3469ba78..cf23561a9eb 100644 --- a/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java +++ b/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java @@ -28,7 +28,7 @@ * or notif delivered. * @author Eamonn McManus * - * @library /lib/testlibrary + * @library /test/lib * * @run clean GaugeMonitorDeadlockTest * @run build GaugeMonitorDeadlockTest @@ -50,7 +50,7 @@ import javax.management.ObjectName; import javax.management.monitor.GaugeMonitor; import javax.management.monitor.GaugeMonitorMBean; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class GaugeMonitorDeadlockTest { private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY}; diff --git a/test/jdk/javax/management/monitor/StartStopTest.java b/test/jdk/javax/management/monitor/StartStopTest.java index 82ff1619874..c98e2ac769a 100644 --- a/test/jdk/javax/management/monitor/StartStopTest.java +++ b/test/jdk/javax/management/monitor/StartStopTest.java @@ -28,9 +28,8 @@ * monitors are started and stopped in a loop. * @author Luis-Miguel Alventosa * - * @library /lib/testlibrary + * @library /test/lib * - * @build jdk.testlibrary.* * @run clean StartStopTest * @run build StartStopTest * @run main/othervm/timeout=300 StartStopTest 1 @@ -56,7 +55,7 @@ import javax.management.monitor.Monitor; import javax.management.monitor.MonitorNotification; import javax.management.monitor.StringMonitor; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class StartStopTest { static int maxPoolSize; diff --git a/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java b/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java index d4d6eaffee6..ff6856d3cf7 100644 --- a/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java +++ b/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java @@ -28,7 +28,6 @@ * All the communication should be done via Open Types * @author Olivier Lagneau * @modules java.management.rmi - * @library /lib/testlibrary * @library /test/lib * @compile Basic.java * @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest @@ -121,7 +120,7 @@ public class MXBeanWeirdParamTest { private List buildCommandLine() { List opts = new ArrayList<>(); opts.add(JDKToolFinder.getJDKTool("java")); - opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); + opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts())); // We need to set WEIRD_PARAM propertty on the client-side opts.add("-DWEIRD_PARAM"); opts.add("-cp"); diff --git a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java index b1fa4fcefd8..9dc217eaa7c 100644 --- a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java +++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java @@ -24,12 +24,11 @@ /* * @test * @bug 8159377 - * @library /lib/testlibrary * @library /test/lib * @summary Tests ObjectFilter on default agent * @author Harsha Wardhana B * @modules java.management - * @build jdk.testlibrary.* DefaultAgentFilterTest + * @build DefaultAgentFilterTest * @run main/othervm/timeout=600 -XX:+UsePerfData DefaultAgentFilterTest */ import java.io.EOFException; @@ -56,7 +55,7 @@ import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class DefaultAgentFilterTest { diff --git a/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java b/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java index ce70611a1f6..493305b70fc 100644 --- a/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java +++ b/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java @@ -27,7 +27,7 @@ * @summary Tests client default class loader used before JSR 160 loader * @author Eamonn McManus * - * @library /lib/testlibrary + * @library /test/lib * * @run clean MethodResultTest * @run build MethodResultTest @@ -40,7 +40,7 @@ import java.net.*; import java.util.*; import javax.management.*; import javax.management.remote.*; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* This test checks that the class loader that is used to deserialize diff --git a/test/jdk/javax/management/security/AuthorizationTest.java b/test/jdk/javax/management/security/AuthorizationTest.java index 8708c5df1df..4eade30aa50 100644 --- a/test/jdk/javax/management/security/AuthorizationTest.java +++ b/test/jdk/javax/management/security/AuthorizationTest.java @@ -27,7 +27,6 @@ * @summary Checks various authentication behavior from remote jmx client * @author Olivier Lagneau * @modules java.management.rmi - * @library /lib/testlibrary * @library /test/lib * @compile Simple.java * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials @@ -177,7 +176,7 @@ public class AuthorizationTest { private List buildCommandLine(String args[]) { List opts = new ArrayList<>(); opts.add(JDKToolFinder.getJDKTool("java")); - opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); + opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts())); String usernameValue = System.getProperty(USERNAME_PROPERTY); if (usernameValue != null) { diff --git a/test/jdk/javax/management/security/SecurityTest.java b/test/jdk/javax/management/security/SecurityTest.java index 16835991afc..835c340dd99 100644 --- a/test/jdk/javax/management/security/SecurityTest.java +++ b/test/jdk/javax/management/security/SecurityTest.java @@ -27,7 +27,6 @@ * @summary Checks various secure ways of connecting from remote jmx client * @author Olivier Lagneau * @modules java.management.rmi - * @library /lib/testlibrary * @library /test/lib * @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials @@ -398,7 +397,7 @@ public class SecurityTest { List opts = new ArrayList<>(); opts.add(JDKToolFinder.getJDKTool("java")); - opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); + opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts())); // We need to forward some properties to the client side opts.add("-Dtest.src=" + System.getProperty("test.src")); diff --git a/test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java b/test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java deleted file mode 100644 index a24315ea8f9..00000000000 --- a/test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java +++ /dev/null @@ -1,295 +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. - */ - -package jdk.testlibrary; - -import static jdk.testlibrary.Asserts.assertTrue; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; -import java.util.Arrays; -import java.util.Collections; -import java.util.regex.Pattern; -import java.util.regex.Matcher; -import java.util.concurrent.TimeUnit; -import java.util.function.BooleanSupplier; -import java.util.function.Function; - -/** - * Common library for various test helper functions. - * - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/jdk/test/lib} - */ -@Deprecated -public final class Utils { - - /** - * Returns the sequence used by operating system to separate lines. - */ - public static final String NEW_LINE = System.getProperty("line.separator"); - - /** - * Returns the value of 'test.vm.opts'system property. - */ - public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim(); - - /** - * Returns the value of 'test.java.opts'system property. - */ - public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim(); - - /** - * Returns the value of 'test.timeout.factor' system property - * converted to {@code double}. - */ - public static final double TIMEOUT_FACTOR; - static { - String toFactor = System.getProperty("test.timeout.factor", "1.0"); - TIMEOUT_FACTOR = Double.parseDouble(toFactor); - } - - /** - * Returns the value of JTREG default test timeout in milliseconds - * converted to {@code long}. - */ - public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120); - - private Utils() { - // Private constructor to prevent class instantiation - } - - /** - * Returns the list of VM options. - * - * @return List of VM options - */ - public static List getVmOptions() { - return Arrays.asList(safeSplitString(VM_OPTIONS)); - } - - /** - * Returns the list of VM options with -J prefix. - * - * @return The list of VM options with -J prefix - */ - public static List getForwardVmOptions() { - String[] opts = safeSplitString(VM_OPTIONS); - for (int i = 0; i < opts.length; i++) { - opts[i] = "-J" + opts[i]; - } - return Arrays.asList(opts); - } - - /** - * Returns the default JTReg arguments for a jvm running a test. - * This is the combination of JTReg arguments test.vm.opts and test.java.opts. - * @return An array of options, or an empty array if no opptions. - */ - public static String[] getTestJavaOpts() { - List opts = new ArrayList(); - Collections.addAll(opts, safeSplitString(VM_OPTIONS)); - Collections.addAll(opts, safeSplitString(JAVA_OPTIONS)); - return opts.toArray(new String[0]); - } - - /** - * Combines given arguments with default JTReg arguments for a jvm running a test. - * This is the combination of JTReg arguments test.vm.opts and test.java.opts - * @return The combination of JTReg test java options and user args. - */ - public static String[] addTestJavaOpts(String... userArgs) { - List opts = new ArrayList(); - Collections.addAll(opts, getTestJavaOpts()); - Collections.addAll(opts, userArgs); - return opts.toArray(new String[0]); - } - - /** - * Removes any options specifying which GC to use, for example "-XX:+UseG1GC". - * Removes any options matching: -XX:(+/-)Use*GC - * Used when a test need to set its own GC version. Then any - * GC specified by the framework must first be removed. - * @return A copy of given opts with all GC options removed. - */ - private static final Pattern useGcPattern = Pattern.compile( - "(?:\\-XX\\:[\\+\\-]Use.+GC)" - + "|(?:\\-Xconcgc)"); - public static List removeGcOpts(List opts) { - List optsWithoutGC = new ArrayList(); - for (String opt : opts) { - if (useGcPattern.matcher(opt).matches()) { - System.out.println("removeGcOpts: removed " + opt); - } else { - optsWithoutGC.add(opt); - } - } - return optsWithoutGC; - } - - /** - * Splits a string by white space. - * Works like String.split(), but returns an empty array - * if the string is null or empty. - */ - private static String[] safeSplitString(String s) { - if (s == null || s.trim().isEmpty()) { - return new String[] {}; - } - return s.trim().split("\\s+"); - } - - /** - * @return The full command line for the ProcessBuilder. - */ - public static String getCommandLine(ProcessBuilder pb) { - StringBuilder cmd = new StringBuilder(); - for (String s : pb.command()) { - cmd.append(s).append(" "); - } - return cmd.toString(); - } - - /** - * Returns the free port on the local host. - * - * @return The port number - * @throws IOException if an I/O error occurs when opening the socket - */ - public static int getFreePort() throws IOException { - try (ServerSocket serverSocket = - new ServerSocket(0, 5, InetAddress.getLoopbackAddress());) { - return serverSocket.getLocalPort(); - } - } - - /** - * Returns the name of the local host. - * - * @return The host name - * @throws UnknownHostException if IP address of a host could not be determined - */ - public static String getHostname() throws UnknownHostException { - InetAddress inetAddress = InetAddress.getLocalHost(); - String hostName = inetAddress.getHostName(); - - assertTrue((hostName != null && !hostName.isEmpty()), - "Cannot get hostname"); - - return hostName; - } - - /** - * Adjusts the provided timeout value for the TIMEOUT_FACTOR - * @param tOut the timeout value to be adjusted - * @return The timeout value adjusted for the value of "test.timeout.factor" - * system property - */ - public static long adjustTimeout(long tOut) { - return Math.round(tOut * Utils.TIMEOUT_FACTOR); - } - - /** - * Wait for condition to be true - * - * @param condition, a condition to wait for - */ - public static final void waitForCondition(BooleanSupplier condition) { - waitForCondition(condition, -1L, 100L); - } - - /** - * Wait until timeout for condition to be true - * - * @param condition, a condition to wait for - * @param timeout a time in milliseconds to wait for condition to be true - * specifying -1 will wait forever - * @return condition value, to determine if wait was successfull - */ - public static final boolean waitForCondition(BooleanSupplier condition, - long timeout) { - return waitForCondition(condition, timeout, 100L); - } - - /** - * Wait until timeout for condition to be true for specified time - * - * @param condition, a condition to wait for - * @param timeout a time in milliseconds to wait for condition to be true, - * specifying -1 will wait forever - * @param sleepTime a time to sleep value in milliseconds - * @return condition value, to determine if wait was successfull - */ - public static final boolean waitForCondition(BooleanSupplier condition, - long timeout, long sleepTime) { - long startTime = System.currentTimeMillis(); - while (!(condition.getAsBoolean() || (timeout != -1L - && ((System.currentTimeMillis() - startTime) > timeout)))) { - try { - Thread.sleep(sleepTime); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Error(e); - } - } - return condition.getAsBoolean(); - } - - /** - * Interface same as java.lang.Runnable but with - * method {@code run()} able to throw any Throwable. - */ - public static interface ThrowingRunnable { - void run() throws Throwable; - } - - /** - * Filters out an exception that may be thrown by the given - * test according to the given filter. - * - * @param test - method that is invoked and checked for exception. - * @param filter - function that checks if the thrown exception matches - * criteria given in the filter's implementation. - * @return - exception that matches the filter if it has been thrown or - * {@code null} otherwise. - * @throws Throwable - if test has thrown an exception that does not - * match the filter. - */ - public static Throwable filterException(ThrowingRunnable test, - Function filter) throws Throwable { - try { - test.run(); - } catch (Throwable t) { - if (filter.apply(t)) { - return t; - } else { - throw t; - } - } - return null; - } -} diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java index 35482604c44..fed2b7cfc45 100644 --- a/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java +++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.List; import jdk.testlibrary.Asserts; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.test.lib.apps.LingeredApp; import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitoredHost; diff --git a/test/jdk/sun/management/jdp/DynamicLauncher.java b/test/jdk/sun/management/jdp/DynamicLauncher.java index e54e8a7b9b2..73223f2a178 100644 --- a/test/jdk/sun/management/jdp/DynamicLauncher.java +++ b/test/jdk/sun/management/jdp/DynamicLauncher.java @@ -24,7 +24,7 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import java.util.UUID; diff --git a/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java b/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java index 628ce68ed93..e83d4429d72 100644 --- a/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java +++ b/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java @@ -23,7 +23,7 @@ import jdk.test.lib.process.OutputAnalyzer; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import java.io.IOException; import java.net.ServerSocket; diff --git a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java index 4a755808e5d..ed1094f1d09 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java @@ -161,10 +161,10 @@ public abstract class AbstractFilePermissionTest { private int doTest() throws Exception { for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; ++i) { - final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.testlibrary.Utils.getFreePort(); + final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.test.lib.Utils.getFreePort(); List command = new ArrayList<>(); - command.addAll(jdk.testlibrary.Utils.getVmOptions()); + command.addAll(jdk.test.lib.Utils.getVmOptions()); command.add(mp); command.add(pp); command.add("-cp"); diff --git a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java index 734790ea4ad..e24365105d1 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicReference; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * @test @@ -38,13 +38,12 @@ import jdk.testlibrary.Utils; * TestManager will attempt a connection to the address obtained from * both agent properties and jvmstat buffer. * - * @library /lib/testlibrary * @library /test/lib * @modules java.management * jdk.attach * jdk.management.agent/jdk.internal.agent * - * @build jdk.testlibrary.* TestManager TestApplication + * @build TestManager TestApplication * @run main/othervm/timeout=300 LocalManagementTest */ public class LocalManagementTest { diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java index d8ff35256e3..fab0faebb41 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java @@ -635,7 +635,7 @@ public class RmiBootstrapTest { for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; i++) { try { - int port = jdk.testlibrary.Utils.getFreePort(); + int port = jdk.test.lib.Utils.getFreePort(); final String path; try { path=(file==null)?null:file.getCanonicalPath(); diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh index f767505b020..4550598e00c 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh @@ -27,9 +27,9 @@ # @key intermittent # @summary Test RMI Bootstrap # -# @library /lib/testlibrary +# @library /test/lib # -# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest +# @build TestLogger Utils RmiBootstrapTest # @run shell/timeout=300 RmiBootstrapTest.sh # Define the Java class test name diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java index f19e9286859..2756d008e77 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java @@ -23,7 +23,7 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -43,10 +43,9 @@ import java.util.regex.Pattern; * @summary Test that RMI registry uses SSL. * @author Luis-Miguel Alventosa, Taras Ledkov * - * @library /lib/testlibrary * @library /test/lib * - * @build jdk.testlibrary.* RmiRegistrySslTestApp + * @build RmiRegistrySslTestApp * @run main/timeout=300 RmiRegistrySslTest */ public class RmiRegistrySslTest { diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java index 33e008636b9..eb9db5869b1 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java @@ -24,7 +24,7 @@ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import javax.rmi.ssl.SslRMIClientSocketFactory; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class RmiRegistrySslTestApp { diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh b/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh index 67ae17b51bc..d8793c33be9 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh @@ -26,9 +26,9 @@ # @bug 6528083 # @summary Test RMI Bootstrap with SSL # -# @library /lib/testlibrary +# @library /test/lib # -# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest +# @build TestLogger Utils RmiBootstrapTest # @run shell/timeout=300 RmiSslBootstrapTest.sh # Define the Java class test name diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java index 9afc6865b1b..283cccd8397 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -45,7 +45,7 @@ import javax.management.remote.*; import javax.net.ssl.SSLHandshakeException; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.internal.agent.Agent; import jdk.internal.agent.AgentConfigurationError; import jdk.internal.agent.ConnectorAddressLink; @@ -57,13 +57,12 @@ import jdk.internal.agent.ConnectorAddressLink; * @summary Makes sure that enabling/disabling the management agent through JCMD * achieves the desired results * - * @library /lib/testlibrary * @library /test/lib * @modules java.management * java.rmi * jdk.management.agent/jdk.internal.agent * - * @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd + * @build JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest */ public class JMXStartStopTest { diff --git a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java index 039bbefc180..0552a752019 100644 --- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java @@ -24,7 +24,7 @@ /* * @test * @bug 8164879 - * @library /lib/testlibrary ../../ + * @library ../../ * @library /test/lib * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property * start a new handshake sequence to renegotiate the symmetric key with an @@ -56,7 +56,7 @@ import java.util.Arrays; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class SSLEngineKeyLimit { diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java index bfd84ad2303..3a31cd3e4a4 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java @@ -24,7 +24,7 @@ /* * @test * @bug 8164879 - * @library /lib/testlibrary ../../ + * @library ../../ * @library /test/lib * @modules java.base/sun.security.util * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property @@ -58,7 +58,7 @@ import java.util.Arrays; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import sun.security.util.HexDumpEncoder; public class SSLSocketKeyLimit { diff --git a/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java index e43653c5446..98efa09198c 100644 --- a/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java +++ b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java @@ -30,7 +30,7 @@ import java.nio.file.Paths; import java.util.List; import jdk.test.lib.process.OutputAnalyzer; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test diff --git a/test/jdk/sun/tools/jcmd/TestJcmdSanity.java b/test/jdk/sun/tools/jcmd/TestJcmdSanity.java index 88711f3ce73..a04c837a682 100644 --- a/test/jdk/sun/tools/jcmd/TestJcmdSanity.java +++ b/test/jdk/sun/tools/jcmd/TestJcmdSanity.java @@ -32,7 +32,7 @@ import java.util.List; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /* * @test diff --git a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java index 667ed0e3d03..64d95514446 100644 --- a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java +++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java @@ -25,9 +25,7 @@ * @test * @summary Basic test for jhsdb launcher * @library /test/lib - * @library /lib/testlibrary * @requires vm.hasSAandCanAttach - * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* * @run main BasicLauncherTest */ @@ -45,7 +43,7 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.Platform; import jdk.test.lib.JDKToolLauncher; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class BasicLauncherTest { diff --git a/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java b/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java index baeba425f43..aaa0af7f41a 100644 --- a/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java +++ b/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java @@ -29,7 +29,7 @@ import java.util.List; import java.util.Map; import jdk.test.lib.apps.LingeredApp; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.test.lib.Platform; /** @@ -39,7 +39,6 @@ import jdk.test.lib.Platform; * * @requires vm.hasSAandCanAttach * @library /test/lib - * @library /lib/testlibrary * @modules java.management * jdk.hotspot.agent/sun.jvm.hotspot * diff --git a/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java b/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java index 7793c295305..19d36408651 100644 --- a/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java +++ b/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java @@ -34,7 +34,7 @@ import java.util.logging.Logger; import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.JDKToolLauncher; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; public class TmtoolTestScenario { diff --git a/test/jdk/sun/tools/jps/JpsHelper.java b/test/jdk/sun/tools/jps/JpsHelper.java index 72a87c43892..4f8463e599f 100644 --- a/test/jdk/sun/tools/jps/JpsHelper.java +++ b/test/jdk/sun/tools/jps/JpsHelper.java @@ -39,7 +39,7 @@ import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.testlibrary.Asserts; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; /** * The helper class for running jps utility and verifying output from it diff --git a/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java index fb352fa3dc0..56ed1fbddf1 100644 --- a/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java +++ b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java @@ -31,7 +31,7 @@ import jdk.test.lib.Platform; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.test.lib.JDKToolLauncher; /** @@ -39,8 +39,6 @@ import jdk.test.lib.JDKToolLauncher; * @summary Test deadlock detection * @requires vm.hasSAandCanAttach * @library /test/lib - * @library /lib/testlibrary - * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* jdk.test.lib.Platform * @build DeadlockDetectionTest * @run main DeadlockDetectionTest diff --git a/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java b/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java index d6e12775668..a10a7eababc 100644 --- a/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java +++ b/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java @@ -23,7 +23,7 @@ import java.util.Arrays; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import static jdk.testlibrary.Asserts.*; import java.text.NumberFormat; diff --git a/test/jdk/sun/tools/jstatd/JstatdTest.java b/test/jdk/sun/tools/jstatd/JstatdTest.java index e4362b3380c..9b23ffa35b0 100644 --- a/test/jdk/sun/tools/jstatd/JstatdTest.java +++ b/test/jdk/sun/tools/jstatd/JstatdTest.java @@ -30,7 +30,7 @@ import java.util.Arrays; import jdk.test.lib.thread.ProcessThread; import static jdk.testlibrary.Asserts.*; -import jdk.testlibrary.Utils; +import jdk.test.lib.Utils; import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; From 2e5e01b53cb4d7ba1398b2799014447b0af8b8d5 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Fri, 14 Sep 2018 20:30:28 -0700 Subject: [PATCH 29/41] 8210785: Trivial typo fix in X509ExtendedKeyManager javadoc Reviewed-by: xuelei --- .../share/classes/javax/net/ssl/X509ExtendedKeyManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java index a28cc6f0b41..ee3d20a789f 100644 --- a/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java +++ b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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,7 +31,7 @@ import java.security.Principal; * Abstract class that provides for extension of the X509KeyManager * interface. *

    - * Methods in this class should be overriden to provide actual + * Methods in this class should be overridden to provide actual * implementations. * * @since 1.5 From 12bac3a02d7b0f17da78d5ee810fd2742ec43ba6 Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Fri, 14 Sep 2018 22:35:44 -0700 Subject: [PATCH 30/41] 8210676: Remove some unused Label variables Reviewed-by: kvn, dholmes, njian, aph --- .../cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 1 - .../cpu/aarch64/c1_MacroAssembler_aarch64.cpp | 2 +- .../cpu/aarch64/c1_Runtime1_aarch64.cpp | 2 +- .../cpu/aarch64/macroAssembler_aarch64.cpp | 2 +- .../cpu/aarch64/stubGenerator_aarch64.cpp | 10 +++++----- .../templateInterpreterGenerator_aarch64.cpp | 2 +- src/hotspot/cpu/arm/arm.ad | 6 +++--- src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp | 3 +-- src/hotspot/cpu/arm/macroAssembler_arm.cpp | 2 +- src/hotspot/cpu/arm/methodHandles_arm.cpp | 1 - src/hotspot/cpu/arm/sharedRuntime_arm.cpp | 6 +++--- src/hotspot/cpu/ppc/stubGenerator_ppc.cpp | 5 ++--- src/hotspot/cpu/ppc/templateTable_ppc_64.cpp | 3 +-- src/hotspot/cpu/s390/macroAssembler_s390.cpp | 2 +- src/hotspot/cpu/s390/stubGenerator_s390.cpp | 5 ----- src/hotspot/cpu/s390/templateTable_s390.cpp | 1 - .../cpu/sparc/macroAssembler_sparc.cpp | 4 +--- src/hotspot/cpu/sparc/vtableStubs_sparc.cpp | 1 - src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp | 3 --- src/hotspot/cpu/x86/c1_Runtime1_x86.cpp | 2 +- src/hotspot/cpu/x86/interp_masm_x86.cpp | 7 ++++--- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 19 ++++++++++++------- .../cpu/x86/macroAssembler_x86_cos.cpp | 6 ++---- .../cpu/x86/macroAssembler_x86_exp.cpp | 2 +- .../cpu/x86/macroAssembler_x86_log.cpp | 2 +- .../cpu/x86/macroAssembler_x86_log10.cpp | 2 +- .../cpu/x86/macroAssembler_x86_sin.cpp | 4 ++-- .../cpu/x86/macroAssembler_x86_tan.cpp | 9 ++++----- src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp | 7 ++++++- src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 4 ++-- .../x86/templateInterpreterGenerator_x86.cpp | 2 +- src/hotspot/cpu/x86/templateTable_x86.cpp | 6 ++++-- 32 files changed, 63 insertions(+), 70 deletions(-) diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 02a145382d0..5bec85a1da0 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -1569,7 +1569,6 @@ void LIR_Assembler::emit_compare_and_swap(LIR_OpCompareAndSwap* op) { } Register newval = as_reg(op->new_value()); Register cmpval = as_reg(op->cmp_value()); - Label succeed, fail, around; if (op->code() == lir_cas_obj) { if (UseCompressedOops) { diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp index ccc7050b92c..9204a116c32 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp @@ -64,7 +64,7 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr const int aligned_mask = BytesPerWord -1; const int hdr_offset = oopDesc::mark_offset_in_bytes(); assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different"); - Label done, fail; + Label done; int null_check_offset = -1; verify_oop(obj); diff --git a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp index 93d47d51497..a0919d8bf35 100644 --- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp @@ -615,7 +615,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { // Runtime will return true if the nmethod has been deoptimized during // the patching process. In that case we must do a deopt reexecute instead. - Label reexecuteEntry, cont; + Label cont; __ cbz(r0, cont); // have we deoptimized? diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 406d7e55ab9..2a23147ba86 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5431,7 +5431,7 @@ void MacroAssembler::zero_words(Register ptr, Register cnt) BLOCK_COMMENT("zero_words {"); cmp(cnt, (u1)zero_words_block_size); - Label around, done, done16; + Label around; br(LO, around); { RuntimeAddress zero_blocks = RuntimeAddress(StubRoutines::aarch64::zero_blocks()); diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index 304aa0a2f10..8c53caa8146 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -634,7 +634,7 @@ class StubGenerator: public StubCodeGenerator { // r11 < MacroAssembler::zero_words_block_size. address generate_zero_blocks() { - Label store_pair, loop_store_pair, done; + Label done; Label base_aligned; Register base = r10, cnt = r11; @@ -1039,7 +1039,7 @@ class StubGenerator: public StubCodeGenerator { int direction = is_backwards ? -1 : 1; int unit = wordSize * direction; - Label Lpair, Lword, Lint, Lshort, Lbyte; + Label Lword, Lint, Lshort, Lbyte; assert(granularity && granularity <= sizeof (jlong), "Impossible granularity in copy_memory_small"); @@ -1096,7 +1096,7 @@ class StubGenerator: public StubCodeGenerator { // <= 96 bytes do inline. Direction doesn't matter because we always // load all the data before writing anything - Label copy4, copy8, copy16, copy32, copy80, copy128, copy_big, finish; + Label copy4, copy8, copy16, copy32, copy80, copy_big, finish; const Register t2 = r5, t3 = r6, t4 = r7, t5 = r8; const Register t6 = r9, t7 = r10, t8 = r11, t9 = r12; const Register send = r17, dend = r18; @@ -1966,7 +1966,7 @@ class StubGenerator: public StubCodeGenerator { address int_copy_entry, address oop_copy_entry, address long_copy_entry, address checkcast_copy_entry) { - Label L_failed, L_failed_0, L_objArray; + Label L_failed, L_objArray; Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs; // Input registers @@ -4366,7 +4366,7 @@ class StubGenerator: public StubCodeGenerator { Register ch1 = rscratch1, ch2 = rscratch2, first = tmp3; __ push(spilled_regs, sp); - Label L_LOOP, L_LOOP_PROCEED, L_SMALL, L_HAS_ZERO, L_SMALL_MATCH_LOOP, + Label L_LOOP, L_LOOP_PROCEED, L_SMALL, L_HAS_ZERO, L_HAS_ZERO_LOOP, L_CMP_LOOP, L_CMP_LOOP_NOMATCH, L_SMALL_PROCEED, L_SMALL_HAS_ZERO_LOOP, L_SMALL_CMP_LOOP_NOMATCH, L_SMALL_CMP_LOOP, L_POST_LOOP, L_CMP_LOOP_LAST_CMP, L_HAS_ZERO_LOOP_NOMATCH, diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index 45fcaa36358..0e27faa6f52 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -1450,7 +1450,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // and result handler will pick it up { - Label no_oop, not_weak, store_result; + Label no_oop; __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); __ cmp(t, result_handler); __ br(Assembler::NE, no_oop); diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index 7cc789f599d..173930f993c 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2008, 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 @@ -1639,7 +1639,7 @@ encode %{ %} enc_class enc_String_Equals(R0RegP str1, R1RegP str2, R2RegI cnt, iRegI result, iRegI tmp1, iRegI tmp2) %{ - Label Lword_loop, Lpost_word, Lchar, Lchar_loop, Ldone, Lequal; + Label Lchar, Lchar_loop, Ldone, Lequal; MacroAssembler _masm(&cbuf); Register str1_reg = $str1$$Register; @@ -1701,7 +1701,7 @@ encode %{ %} enc_class enc_Array_Equals(R0RegP ary1, R1RegP ary2, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI result) %{ - Label Lvector, Ldone, Lloop, Lequal; + Label Ldone, Lloop, Lequal; MacroAssembler _masm(&cbuf); Register ary1_reg = $ary1$$Register; diff --git a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp index bc605711570..623f29e3a16 100644 --- a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -370,7 +370,6 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, } assert(oopDesc::mark_offset_in_bytes() == 0, "Required by atomic instructions"); - Label retry; // Load displaced header and object from the lock ldr(hdr, Address(disp_hdr, mark_offset)); diff --git a/src/hotspot/cpu/arm/macroAssembler_arm.cpp b/src/hotspot/cpu/arm/macroAssembler_arm.cpp index a6732515cbf..f5318a58a5d 100644 --- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp @@ -260,7 +260,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, add(count_temp, count_temp, 1); - Label L_loop, L_setnz_and_fail, L_fail; + Label L_loop, L_fail; // Top of search loop bind(L_loop); diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp index b53967a18d7..841258058df 100644 --- a/src/hotspot/cpu/arm/methodHandles_arm.cpp +++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp @@ -446,7 +446,6 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm, } // given intf, index, and recv klass, dispatch to the implementation method - Label L_no_such_interface; __ lookup_interface_method(temp1_recv_klass, temp3_intf, // note: next two args must be the same: rbx_index, rbx_method, diff --git a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp index 7922682f9eb..e98d223357e 100644 --- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp +++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -1566,7 +1566,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, const Register disp_hdr = AARCH64_ONLY(R22) NOT_AARCH64(altFP_7_11); const Register tmp = AARCH64_ONLY(R23) NOT_AARCH64(R8); - Label slow_lock, slow_lock_biased, lock_done, fast_lock, leave; + Label slow_lock, slow_lock_biased, lock_done, fast_lock; if (method->is_synchronized()) { // The first argument is a handle to sync object (a class or an instance) __ ldr(sync_obj, Address(R1)); @@ -1686,7 +1686,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ b(reguard, eq); __ bind(reguard_done); - Label slow_unlock, unlock_done, retry; + Label slow_unlock, unlock_done; if (method->is_synchronized()) { __ ldr(sync_obj, Address(sync_handle)); diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index 32ddef48424..4bcd22e0a7e 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -2758,7 +2758,6 @@ class StubGenerator: public StubCodeGenerator { Label L_doLast; Label L_do44; Label L_do52; - Label L_do60; Register from = R3_ARG1; // source array address Register to = R4_ARG2; // destination array address @@ -3296,8 +3295,8 @@ class StubGenerator: public StubCodeGenerator { const Register cs = R27; // Labels - Label SKIP_LSHIFT, SKIP_DIAGONAL_SUM, SKIP_ADDONE, SKIP_MULADD, SKIP_LOOP_SQUARE; - Label LOOP_LSHIFT, LOOP_DIAGONAL_SUM, LOOP_ADDONE, LOOP_MULADD, LOOP_SQUARE; + Label SKIP_LSHIFT, SKIP_DIAGONAL_SUM, SKIP_ADDONE, SKIP_LOOP_SQUARE; + Label LOOP_LSHIFT, LOOP_DIAGONAL_SUM, LOOP_ADDONE, LOOP_SQUARE; // Save non-volatile regs (frameless). int current_offs = -8; diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp index b1411b0fcec..08b23e2ac0b 100644 --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp @@ -3880,7 +3880,6 @@ void TemplateTable::multianewarray() { void TemplateTable::arraylength() { transition(atos, itos); - Label LnoException; __ verify_oop(R17_tos); __ null_check_throw(R17_tos, arrayOopDesc::length_offset_in_bytes(), R11_scratch1); __ lwa(R17_tos, arrayOopDesc::length_offset_in_bytes(), R17_tos); @@ -4081,7 +4080,7 @@ void TemplateTable::monitorenter() { found_same_obj = CCR1, reached_limit = CCR6; { - Label Lloop, Lentry; + Label Lloop; Register Rlimit = Rcurrent_monitor; // Set up search loop - start with topmost monitor. diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.cpp b/src/hotspot/cpu/s390/macroAssembler_s390.cpp index 14decd9be76..7494b33c48b 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp @@ -3079,7 +3079,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register Rsubklass, // Input registers must not overlap. // Also check for R1 which is explicitely used here. assert_different_registers(Z_R1, Rsubklass, Rsuperklass, Rarray_ptr, Rlength); - NearLabel L_fallthrough, L_loop; + NearLabel L_fallthrough; int label_nulls = 0; if (L_success == NULL) { L_success = &L_fallthrough; label_nulls++; } if (L_failure == NULL) { L_failure = &L_fallthrough; label_nulls++; } diff --git a/src/hotspot/cpu/s390/stubGenerator_s390.cpp b/src/hotspot/cpu/s390/stubGenerator_s390.cpp index 6c9ea091daa..b67271bdcbc 100644 --- a/src/hotspot/cpu/s390/stubGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp @@ -285,11 +285,6 @@ class StubGenerator: public StubCodeGenerator { // Just pop the topmost frame ... // - Label ret_is_object; - Label ret_is_long; - Label ret_is_float; - Label ret_is_double; - // Restore frame pointer. __ z_lg(r_entryframe_fp, _z_abi(callers_sp), Z_SP); // Pop frame. Done here to minimize stalls. diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp index 430624799fb..aa51caa59a9 100644 --- a/src/hotspot/cpu/s390/templateTable_s390.cpp +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp @@ -3785,7 +3785,6 @@ void TemplateTable::_new() { Label slow_case; Label done; Label initialize_header; - Label allocate_shared; BLOCK_COMMENT("TemplateTable::_new {"); __ get_2_byte_integer_at_bcp(offset/*dest*/, 1, InterpreterMacroAssembler::Unsigned); diff --git a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp index 26843c6f719..881a1a8c7ca 100644 --- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp +++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp @@ -2648,8 +2648,6 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, inc_counter((address) counters->total_entry_count_addr(), Rmark, Rscratch); } - Label Egress ; - // Aggressively avoid the Store-before-CAS penalty // Defer the store into box->dhw until after the CAS Label IsInflated, Recursive ; @@ -4171,7 +4169,7 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Regi Label L_main_loop_prologue; Label L_fold_512b, L_fold_512b_loop, L_fold_128b; Label L_fold_tail, L_fold_tail_loop; - Label L_8byte_fold_loop, L_8byte_fold_check; + Label L_8byte_fold_check; const Register tmp[CRC32_TMP_REG_NUM] = {L0, L1, L2, L3, L4, L5, L6, G1, I0, I1, I2, I3, I4, I5, I7, O4, O5, G3}; diff --git a/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp b/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp index bd94b7a3d36..1b4d30524a1 100644 --- a/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp +++ b/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp @@ -166,7 +166,6 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { Register G3_Klass = G3_scratch; Register G5_icholder = G5; // Passed in as an argument Register G4_interface = G4_scratch; - Label search; // Entry arguments: // G5_interface: Interface diff --git a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp index 2094909e0e3..f05b5581cc4 100644 --- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp @@ -1778,7 +1778,6 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L __ bind(profile_cast_success); __ mov_metadata(mdo, md->constant_encoding()); __ load_klass(recv, obj); - Label update_done; type_profile_helper(mdo, md, data, recv, success); __ jmp(*success); @@ -1861,7 +1860,6 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) { __ bind(profile_cast_success); __ mov_metadata(mdo, md->constant_encoding()); __ load_klass(recv, value); - Label update_done; type_profile_helper(mdo, md, data, recv, &done); __ jmpb(done); @@ -3048,7 +3046,6 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) { // if we don't know anything, just go through the generic arraycopy if (default_type == NULL) { - Label done; // save outgoing arguments on stack in case call to System.arraycopy is needed // HACK ALERT. This code used to push the parameters in a hardwired fashion // for interpreter calling conventions. Now we have to do it in new style conventions. diff --git a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp index f9d915166a2..2f5155f1cc6 100644 --- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp +++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp @@ -957,7 +957,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { // Runtime will return true if the nmethod has been deoptimized during // the patching process. In that case we must do a deopt reexecute instead. - Label reexecuteEntry, cont; + Label cont; __ testptr(rax, rax); // have we deoptimized? __ jcc(Assembler::equal, cont); // no diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index b17dceed991..6b96a849a89 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -170,7 +170,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) { assert_different_registers(mdp, ret, tmp, _bcp_register); if (ProfileInterpreter && MethodData::profile_return()) { - Label profile_continue, done; + Label profile_continue; test_method_data_pointer(mdp, profile_continue); @@ -204,7 +204,7 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) { if (ProfileInterpreter && MethodData::profile_parameters()) { - Label profile_continue, done; + Label profile_continue; test_method_data_pointer(mdp, profile_continue); @@ -1703,12 +1703,12 @@ void InterpreterMacroAssembler::record_item_in_profile_helper(Register item, Reg bind(next_test); if (test_for_null_also) { - Label found_null; // Failed the equality check on item[n]... Test for null. testptr(reg2, reg2); if (start_row == last_row) { // The only thing left to do is handle the null case. if (non_profiled_offset >= 0) { + Label found_null; jccb(Assembler::zero, found_null); // Item did not match any saved item and there is no empty row for it. // Increment total counter to indicate polymorphic case. @@ -1720,6 +1720,7 @@ void InterpreterMacroAssembler::record_item_in_profile_helper(Register item, Reg } break; } + Label found_null; // Since null is rare, make it be the branch-taken case. jcc(Assembler::zero, found_null); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index d883ec7c034..f6f1604a4f9 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -7982,7 +7982,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned, Register rtmp, XMMRegister xtmp) { ShortBranchVerifier sbv(this); assert_different_registers(to, value, count, rtmp); - Label L_exit, L_skip_align1, L_skip_align2, L_fill_byte; + Label L_exit; Label L_fill_2_bytes, L_fill_4_bytes; int shift = -1; @@ -8017,8 +8017,10 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned, cmpl(count, 2<= 2) { - Label L_chars_8_check, L_copy_8_chars, L_copy_8_chars_exit; + Label L_copy_8_chars, L_copy_8_chars_exit; Label L_chars_16_check, L_copy_16_chars, L_copy_16_chars_exit; if (UseAVX >= 2) { @@ -8812,9 +8815,8 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register length, Register log2_array_indxscale, Register result, Register tmp1, Register tmp2, XMMRegister rymm0, XMMRegister rymm1, XMMRegister rymm2){ assert(UseSSE42Intrinsics, "SSE4.2 must be enabled."); - Label VECTOR64_LOOP, VECTOR64_TAIL, VECTOR64_NOT_EQUAL, VECTOR32_TAIL; - Label VECTOR32_LOOP, VECTOR16_LOOP, VECTOR8_LOOP, VECTOR4_LOOP; - Label VECTOR16_TAIL, VECTOR8_TAIL, VECTOR4_TAIL; + Label VECTOR16_LOOP, VECTOR8_LOOP, VECTOR4_LOOP; + Label VECTOR8_TAIL, VECTOR4_TAIL; Label VECTOR32_NOT_EQUAL, VECTOR16_NOT_EQUAL, VECTOR8_NOT_EQUAL, VECTOR4_NOT_EQUAL; Label SAME_TILL_END, DONE; Label BYTES_LOOP, BYTES_TAIL, BYTES_NOT_EQUAL; @@ -8827,6 +8829,8 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register if ((UseAVX > 2) && VM_Version::supports_avx512vlbw()) { + Label VECTOR64_LOOP, VECTOR64_NOT_EQUAL, VECTOR32_TAIL; + set_vector_masking(); // opening of the stub context for programming mask registers cmpq(length, 64); jcc(Assembler::less, VECTOR32_TAIL); @@ -8848,7 +8852,7 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register testq(tmp1, tmp1); jcc(Assembler::zero, SAME_TILL_END); - bind(VECTOR64_TAIL); + //bind(VECTOR64_TAIL); // AVX512 code to compare upto 63 byte vectors. // Save k1 kmovql(k3, k1); @@ -8881,6 +8885,7 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register jcc(Assembler::less, VECTOR4_TAIL); if (UseAVX >= 2) { + Label VECTOR16_TAIL, VECTOR32_LOOP; cmpq(length, 16); jcc(Assembler::equal, VECTOR16_LOOP); @@ -9231,7 +9236,7 @@ void MacroAssembler::lshift_by_1(Register x, Register len, Register z, Register */ void MacroAssembler::square_to_len(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register rdxReg, Register raxReg) { - Label L_second_loop, L_second_loop_exit, L_third_loop, L_third_loop_exit, fifth_loop, fifth_loop_exit, L_last_x, L_multiply; + Label L_second_loop, L_second_loop_exit, L_third_loop, L_third_loop_exit, L_last_x, L_multiply; push(tmp1); push(tmp2); push(tmp3); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp index 1446f4bd2c9..38a43666074 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp @@ -185,7 +185,7 @@ void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; - Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_3, B1_4, B1_5, start; + Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_4, start; assert_different_registers(r8, r9, r10, r11, eax, ecx, edx); @@ -756,9 +756,7 @@ ATTRIBUTE_ALIGNED(16) juint _static_const_table_cos[] = void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + Label start; assert_different_registers(tmp, eax, ecx, edx); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp index 4863b3ee507..ae85c0be877 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp @@ -483,7 +483,7 @@ void MacroAssembler::fast_exp(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + Label L_2TAG_PACKET_12_0_2, start; assert_different_registers(tmp, eax, ecx, edx); jmp(start); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp index d914d828f60..b1edeaf9d6f 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp @@ -186,7 +186,7 @@ void MacroAssembler::fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; Label L_2TAG_PACKET_8_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + Label B1_3, B1_5, start; assert_different_registers(tmp1, tmp2, eax, ecx, edx); jmp(start); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp index 35190673d9b..1478da29a49 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp @@ -198,7 +198,7 @@ ATTRIBUTE_ALIGNED(16) juint _coeff_log10[] = void MacroAssembler::fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r11) { Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, B1_2, B1_3, B1_4, B1_5, start; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, B1_2, B1_3, B1_5, start; assert_different_registers(r11, eax, ecx, edx); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp index a87d7cd0320..4ba4bf6eddb 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp @@ -383,7 +383,7 @@ void MacroAssembler::fast_sin(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; Label L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1; - Label L_2TAG_PACKET_12_0_1, B1_1, B1_2, B1_4, start; + Label L_2TAG_PACKET_12_0_1, B1_4, start; assert_different_registers(tmp1, tmp2, tmp3, tmp4, eax, ebx, ecx, edx); address ONEHALF = StubRoutines::x86::_ONEHALF_addr(); @@ -1673,7 +1673,7 @@ void MacroAssembler::libm_sincos_huge(XMMRegister xmm0, XMMRegister xmm1, Regist Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23; Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34; - Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46; + Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_46; assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp index 59323617753..2822eaa7ebf 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp @@ -501,7 +501,7 @@ void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; - Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1, B1_2, B1_3, B1_4, B1_5, start; + Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1, B1_2, B1_4, start; address ONEHALF = (address)_ONEHALF_tan; address MUL16 = (address)_MUL16; @@ -1089,7 +1089,7 @@ void MacroAssembler::libm_tancot_huge(XMMRegister xmm0, XMMRegister xmm1, Regist Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23; Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34; - Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46; + Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_43; assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); @@ -1966,9 +1966,8 @@ ATTRIBUTE_ALIGNED(16) juint _static_const_table_tan[] = void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + Label L_2TAG_PACKET_4_0_2; + Label start; assert_different_registers(tmp, eax, ecx, edx); diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 43e24185b15..aa4177367fe 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -3492,8 +3492,13 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t // No exception case __ bind(noException); - Label no_adjust, bail, no_prefix, not_special; + Label no_adjust; +#ifdef ASSERT + Label bail; +#endif if (SafepointMechanism::uses_thread_local_poll() && !cause_return) { + Label no_prefix, not_special; + // If our stashed return pc was modified by the runtime we avoid touching it __ cmpptr(rbx, Address(rbp, wordSize)); __ jccb(Assembler::notEqual, no_adjust); diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index f8b79a54991..20573a42228 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -1906,7 +1906,7 @@ class StubGenerator: public StubCodeGenerator { StubCodeMark mark(this, "StubRoutines", name); address start = __ pc(); - Label L_copy_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit; + Label L_copy_bytes, L_copy_8_bytes, L_exit; const Register from = rdi; // source array address const Register to = rsi; // destination array address const Register count = rdx; // elements count @@ -3848,7 +3848,7 @@ class StubGenerator: public StubCodeGenerator { Label L__incCounter[3][6]; //for 6 blocks Label L__incCounter_single[3]; //for single block, key128, key192, key256 Label L_processTail_insr[3], L_processTail_4_insr[3], L_processTail_2_insr[3], L_processTail_1_insr[3], L_processTail_exit_insr[3]; - Label L_processTail_extr[3], L_processTail_4_extr[3], L_processTail_2_extr[3], L_processTail_1_extr[3], L_processTail_exit_extr[3]; + Label L_processTail_4_extr[3], L_processTail_2_extr[3], L_processTail_1_extr[3], L_processTail_exit_extr[3]; Label L_exit; diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index df363de0be9..f3af291d12c 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -1171,7 +1171,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // and result handler will pick it up { - Label no_oop, not_weak, store_result; + Label no_oop; __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize)); __ jcc(Assembler::notEqual, no_oop); diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index e73945e16c4..7743d459722 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -2875,7 +2875,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr const Address field(obj, off, Address::times_1, 0*wordSize); - Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble; + Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj; __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift); // Make sure we don't need to mask edx after the above shift @@ -2981,6 +2981,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ bind(notFloat); #ifdef ASSERT + Label notDouble; __ cmpl(flags, dtos); __ jcc(Assembler::notEqual, notDouble); #endif @@ -3132,7 +3133,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr NOT_LP64( const Address hi(obj, off, Address::times_1, 1*wordSize);) Label notByte, notBool, notInt, notShort, notChar, - notLong, notFloat, notObj, notDouble; + notLong, notFloat, notObj; __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift); @@ -3286,6 +3287,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr __ bind(notFloat); #ifdef ASSERT + Label notDouble; __ cmpl(flags, dtos); __ jcc(Assembler::notEqual, notDouble); #endif From 8ef50b1dc3f46e506f51246fcc1301e9ffa689e1 Mon Sep 17 00:00:00 2001 From: Bernard Blaser Date: Sat, 15 Sep 2018 22:16:16 +0200 Subject: [PATCH 31/41] 8183548: Comma-expressions shouldn't use any temporary variable Uses enhanced let-expressions allowing multiple statements Reviewed-by: vromero --- .../com/sun/tools/javac/comp/Lower.java | 4 +++- .../tools/javac/desugar/BoxingAndSuper.java | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index c27f0dd17d1..9faffe19c5e 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -2057,7 +2057,9 @@ public class Lower extends TreeTranslator { // evaluate and discard the first expression, then evaluate the second. JCExpression makeComma(final JCExpression expr1, final JCExpression expr2) { - return abstractRval(expr1, discarded -> expr2); + JCExpression res = make.LetExpr(List.of(make.Exec(expr1)), expr2); + res.type = expr2.type; + return res; } /************************************************************************** diff --git a/test/langtools/tools/javac/desugar/BoxingAndSuper.java b/test/langtools/tools/javac/desugar/BoxingAndSuper.java index 6efad1f3838..885855a2c2e 100644 --- a/test/langtools/tools/javac/desugar/BoxingAndSuper.java +++ b/test/langtools/tools/javac/desugar/BoxingAndSuper.java @@ -100,7 +100,7 @@ public class BoxingAndSuper { "p.Test.dump()java.lang.Integer\n" + "{\n" + " return (let /*synthetic*/ final Integer $le0 = (Integer)super.i " + - "in (let /*synthetic*/ final Integer $le1 = super.i = Integer.valueOf((int)(super.i.intValue() + 1)) " + + "in (let super.i = Integer.valueOf((int)(super.i.intValue() + 1)); " + "in $le0));\n" + "}\n"); //qualified super, same package: @@ -121,7 +121,7 @@ public class BoxingAndSuper { "p.Test.Inner.dump()java.lang.Integer\n" + "{\n" + " return (let /*synthetic*/ final Integer $le0 = (Integer)Test.access$001(this$0) " + - "in (let /*synthetic*/ final Integer $le1 = Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))) " + + "in (let Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))); " + "in $le0));\n" + "}\n" + "p.Test.access$001(p.Test)java.lang.Integer\n" + @@ -152,7 +152,7 @@ public class BoxingAndSuper { "p1.Test.dump()java.lang.Integer\n" + "{\n" + " return (let /*synthetic*/ final Integer $le0 = (Integer)super.i " + - "in (let /*synthetic*/ final Integer $le1 = super.i = Integer.valueOf((int)(super.i.intValue() + 1)) " + + "in (let super.i = Integer.valueOf((int)(super.i.intValue() + 1)); " + "in $le0));\n" + "}\n"); //qualified super, different packages: @@ -173,7 +173,7 @@ public class BoxingAndSuper { "p1.Test.Inner.dump()java.lang.Integer\n" + "{\n" + " return (let /*synthetic*/ final Integer $le0 = (Integer)Test.access$001(this$0) " + - "in (let /*synthetic*/ final Integer $le1 = Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))) " + + "in (let Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))); " + "in $le0));\n" + "}\n" + "p1.Test.access$001(p1.Test)java.lang.Integer\n" + @@ -201,8 +201,8 @@ public class BoxingAndSuper { String expected = "Test.dump()void\n" + "{\n" + - " (let /*synthetic*/ final Integer $le0 = i in (let /*synthetic*/ final Integer $le1 = i = Integer.valueOf((int)(i.intValue() + 1)) in $le0));\n" + - " (let /*synthetic*/ final Integer $le2 = (Integer)this.i in (let /*synthetic*/ final Integer $le3 = this.i = Integer.valueOf((int)(this.i.intValue() + 1)) in $le2));\n" + + " (let /*synthetic*/ final Integer $le0 = i in (let i = Integer.valueOf((int)(i.intValue() + 1)); in $le0));\n" + + " (let /*synthetic*/ final Integer $le1 = (Integer)this.i in (let this.i = Integer.valueOf((int)(this.i.intValue() + 1)); in $le1));\n" + "}\n"; runTest(code, expected); //qualified this: @@ -219,8 +219,8 @@ public class BoxingAndSuper { "Test.Inner1.Inner2.dump()java.lang.Integer\n" + "{\n" + " return (let /*synthetic*/ final Integer $le0 = (Integer)this$1.this$0.i" + - " in (let /*synthetic*/ final Integer $le1 = this$1.this$0.i = " + - "Integer.valueOf((int)(this$1.this$0.i.intValue() + 1)) " + + " in (let this$1.this$0.i = " + + "Integer.valueOf((int)(this$1.this$0.i.intValue() + 1)); " + "in $le0));\n" + "}\n" ); @@ -329,7 +329,8 @@ public class BoxingAndSuper { LetExpr le = (LetExpr) tree; for (JCStatement var : le.defs) { - letExprRemap.put(((JCVariableDecl) var).name.toString(), "$le" + i++); + if (var.hasTag(Tag.VARDEF)) + letExprRemap.put(((JCVariableDecl) var).name.toString(), "$le" + i++); } } return super.visitOther(node, p); From a07102bc7fc97bce972a49b6c47d81b0e80cc683 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Sat, 15 Sep 2018 13:53:43 -0700 Subject: [PATCH 32/41] 8210787: Object.wait(long, int) throws inappropriate IllegalArgumentException Reviewed-by: martin, rriggs --- .../share/classes/java/lang/Object.java | 4 +- test/jdk/java/lang/Object/WaitTooLong.java | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 test/jdk/java/lang/Object/WaitTooLong.java diff --git a/src/java.base/share/classes/java/lang/Object.java b/src/java.base/share/classes/java/lang/Object.java index 0ccdc6b738c..421fcc27f93 100644 --- a/src/java.base/share/classes/java/lang/Object.java +++ b/src/java.base/share/classes/java/lang/Object.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -455,7 +455,7 @@ public class Object { "nanosecond timeout value out of range"); } - if (nanos > 0) { + if (nanos > 0 && timeoutMillis < Long.MAX_VALUE) { timeoutMillis++; } diff --git a/test/jdk/java/lang/Object/WaitTooLong.java b/test/jdk/java/lang/Object/WaitTooLong.java new file mode 100644 index 00000000000..b77b1f4d5a7 --- /dev/null +++ b/test/jdk/java/lang/Object/WaitTooLong.java @@ -0,0 +1,46 @@ +/* + * 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 8210787 + * @summary Object.wait(long, int) throws inappropriate IllegalArgumentException + */ + +public class WaitTooLong { + public static void main(String[] args) { + test(0); + test(1); + test(500000); + test(999999); + } + + static void test(int nanos) { + try { + WaitTooLong.class.wait(Long.MAX_VALUE, nanos); + } catch (IllegalMonitorStateException expected) { + } catch (IllegalArgumentException | InterruptedException unexpected) { + throw new RuntimeException("Unexpected", unexpected); + } + } +} From 27e26fbdd761989c2807dcc3b84de13688edd38c Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Sat, 15 Sep 2018 22:02:08 -0700 Subject: [PATCH 33/41] 8210786: Typo s/overriden/overridden/ in several places Reviewed-by: weijun --- src/java.base/share/classes/java/security/Identity.java | 4 ++-- src/java.base/share/classes/java/security/Provider.java | 6 +++--- src/java.base/share/classes/java/security/Security.java | 4 ++-- .../share/classes/java/text/RuleBasedCollator.java | 6 +++--- src/java.base/share/classes/java/util/Random.java | 4 ++-- src/java.base/share/classes/java/util/StringJoiner.java | 4 ++-- .../share/classes/javax/crypto/CipherInputStream.java | 4 ++-- .../share/classes/javax/crypto/CipherOutputStream.java | 4 ++-- .../share/classes/javax/net/ssl/HttpsURLConnection.java | 4 ++-- .../share/classes/javax/net/ssl/SSLServerSocket.java | 4 ++-- .../unix/classes/sun/net/www/protocol/file/Handler.java | 4 ++-- .../windows/classes/sun/net/www/protocol/file/Handler.java | 4 ++-- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/java.base/share/classes/java/security/Identity.java b/src/java.base/share/classes/java/security/Identity.java index c1163cdb45d..30062b28c04 100644 --- a/src/java.base/share/classes/java/security/Identity.java +++ b/src/java.base/share/classes/java/security/Identity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -351,7 +351,7 @@ public abstract class Identity implements Principal, Serializable { /** * Tests for equality between the specified identity and this identity. - * This method should be overriden by subclasses to test for equality. + * This method should be overridden by subclasses to test for equality. * The default behavior is to return true if the names and public keys * are equal. * diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index 83ce4ff9aa2..324de1bf9a4 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -1318,7 +1318,7 @@ public abstract class Provider extends Properties { * {@code "putProviderProperty."+name}, where {@code name} is * the provider name, to see if it's ok to set this provider's property * values. If the default implementation of {@code checkSecurityAccess} - * is used (that is, that method is not overriden), then this results in + * is used (that is, that method is not overridden), then this results in * a call to the security manager's {@code checkPermission} method with * a {@code SecurityPermission("putProviderProperty."+name)} * permission. @@ -1410,7 +1410,7 @@ public abstract class Provider extends Properties { * the provider name, to see if it's ok to remove this provider's * properties. If the default implementation of * {@code checkSecurityAccess} is used (that is, that method is not - * overriden), then this results in a call to the security manager's + * overridden), then this results in a call to the security manager's * {@code checkPermission} method with a * {@code SecurityPermission("removeProviderProperty."+name)} * permission. diff --git a/src/java.base/share/classes/java/security/Security.java b/src/java.base/share/classes/java/security/Security.java index e551ebe90f5..7cb4fd892ca 100644 --- a/src/java.base/share/classes/java/security/Security.java +++ b/src/java.base/share/classes/java/security/Security.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -422,7 +422,7 @@ public final class Security { * method is called with the string {@code "removeProvider."+name} * to see if it's ok to remove the provider. * If the default implementation of {@code checkSecurityAccess} - * is used (i.e., that method is not overriden), then this will result in + * is used (i.e., that method is not overridden), then this will result in * a call to the security manager's {@code checkPermission} method * with a {@code SecurityPermission("removeProvider."+name)} * permission. diff --git a/src/java.base/share/classes/java/text/RuleBasedCollator.java b/src/java.base/share/classes/java/text/RuleBasedCollator.java index c8140a5efa0..c0bad4d5816 100644 --- a/src/java.base/share/classes/java/text/RuleBasedCollator.java +++ b/src/java.base/share/classes/java/text/RuleBasedCollator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, 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 @@ -348,7 +348,7 @@ public class RuleBasedCollator extends Collator{ * Compares the character data stored in two different strings based on the * collation rules. Returns information about whether a string is less * than, greater than or equal to another string in a language. - * This can be overriden in a subclass. + * This can be overridden in a subclass. * * @exception NullPointerException if source or target is null. */ @@ -567,7 +567,7 @@ public class RuleBasedCollator extends Collator{ /** * Transforms the string into a series of characters that can be compared * with CollationKey.compareTo. This overrides java.text.Collator.getCollationKey. - * It can be overriden in a subclass. + * It can be overridden in a subclass. */ public synchronized CollationKey getCollationKey(String source) { diff --git a/src/java.base/share/classes/java/util/Random.java b/src/java.base/share/classes/java/util/Random.java index f9c3c75252f..5098592dfd9 100644 --- a/src/java.base/share/classes/java/util/Random.java +++ b/src/java.base/share/classes/java/util/Random.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, 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 @@ -136,7 +136,7 @@ class Random implements java.io.Serializable { if (getClass() == Random.class) this.seed = new AtomicLong(initialScramble(seed)); else { - // subclass might have overriden setSeed + // subclass might have overridden setSeed this.seed = new AtomicLong(); setSeed(seed); } diff --git a/src/java.base/share/classes/java/util/StringJoiner.java b/src/java.base/share/classes/java/util/StringJoiner.java index c72d5a213bd..39edba182e0 100644 --- a/src/java.base/share/classes/java/util/StringJoiner.java +++ b/src/java.base/share/classes/java/util/StringJoiner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, 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 @@ -77,7 +77,7 @@ public final class StringJoiner { private int len; /** - * When overriden by the user to be non-null via {@link setEmptyValue}, the + * When overridden by the user to be non-null via {@link setEmptyValue}, the * string returned by toString() when no elements have yet been added. * When null, prefix + suffix is used as the empty value. */ diff --git a/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/src/java.base/share/classes/javax/crypto/CipherInputStream.java index 54ad9611e2d..60d6f1a1859 100644 --- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -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 @@ -52,7 +52,7 @@ import javax.crypto.IllegalBlockSizeException; * method counts only data that have been processed by the encapsulated Cipher. * *

    It is crucial for a programmer using this class not to use - * methods that are not defined or overriden in this class (such as a + * methods that are not defined or overridden in this class (such as a * new method or constructor that is later added to one of the super * classes), because the design and implementation of those methods * are unlikely to have considered security impact with regard to diff --git a/src/java.base/share/classes/javax/crypto/CipherOutputStream.java b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java index 30c9c53553c..fbc4356c40d 100644 --- a/src/java.base/share/classes/javax/crypto/CipherOutputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java @@ -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 @@ -53,7 +53,7 @@ import java.io.*; * alternative to using this class. * *

    It is crucial for a programmer using this class not to use - * methods that are not defined or overriden in this class (such as a + * methods that are not defined or overridden in this class (such as a * new method or constructor that is later added to one of the super * classes), because the design and implementation of those methods * are unlikely to have considered security impact with regard to diff --git a/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java index 7d93ef274c6..c962b41f6fa 100644 --- a/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java +++ b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, 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 @@ -46,7 +46,7 @@ import java.security.cert.X509Certificate; * However, the implementations can be replaced on a per-class (static) or * per-instance basis. All new HttpsURLConnections instances * will be assigned - * the "default" static values at instance creation, but they can be overriden + * the "default" static values at instance creation, but they can be overridden * by calling the appropriate per-instance set method(s) before * connecting. * diff --git a/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java index a306117031f..cb0a500608f 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java @@ -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 @@ -48,7 +48,7 @@ import java.net.*; * authentication is necessary, and whether created sockets should * begin handshaking in client or server mode. The state * inherited by the created SSLSocket can be - * overriden by calling the appropriate methods. + * overridden by calling the appropriate methods. * * @see java.net.ServerSocket * @see SSLSocket diff --git a/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java b/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java index ce280dc455a..18706ac4b9a 100644 --- a/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java +++ b/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -105,7 +105,7 @@ public class Handler extends URLStreamHandler { return uc; } - // Template method to be overriden by Java Plug-in. [stanleyh] + // Template method to be overridden by Java Plug-in. [stanleyh] // protected URLConnection createFileURLConnection(URL u, File file) { diff --git a/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java b/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java index c2cb1d17f5d..534721ad7a0 100644 --- a/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java +++ b/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, 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 @@ -124,7 +124,7 @@ public class Handler extends URLStreamHandler { } /** - * Template method to be overriden by Java Plug-in. [stanleyh] + * Template method to be overridden by Java Plug-in. [stanleyh] */ protected URLConnection createFileURLConnection(URL url, File file) { return new FileURLConnection(url, file); From 46159b4d04125e40d8ac1dce7c9955440f3ab8ca Mon Sep 17 00:00:00 2001 From: Chris Yin Date: Mon, 17 Sep 2018 13:49:55 +0800 Subject: [PATCH 34/41] 8210695: Create test to cover JDK-8205330 InitialDirContext ctor sometimes throws NPE if the server has sent a disconnection Reviewed-by: vtewari, dfuchs, chegar --- .../com/sun/jndi/ldap/DisconnectNPETest.java | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java diff --git a/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java b/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java new file mode 100644 index 00000000000..65e7d468300 --- /dev/null +++ b/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java @@ -0,0 +1,193 @@ +/* + * 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 javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.Hashtable; + +/* + * @test + * @bug 8205330 + * @summary Test that If a connection has already been established and then + * the LDAP directory server sends an (unsolicited) + * "Notice of Disconnection", make sure client handle it correctly, + * no NPE been thrown. + * @run main/othervm DisconnectNPETest + */ + +public class DisconnectNPETest { + // Normally the NPE bug should be hit less than 100 times run, but just in + // case, we set repeat count to 1000 here. + private static final int REPEAT_COUNT = 1000; + + public static void main(String[] args) throws IOException { + new DisconnectNPETest().run(); + } + + private ServerSocket serverSocket; + private Hashtable env; + private TestLDAPServer server; + + private void initRes() throws IOException { + serverSocket = new ServerSocket(0, 0, InetAddress.getLoopbackAddress()); + server = new TestLDAPServer(); + server.start(); + } + + private void initTest() { + env = new Hashtable<>(); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, String.format("ldap://%s:%d/", + InetAddress.getLoopbackAddress().getHostName(), + serverSocket.getLocalPort())); + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + env.put(Context.SECURITY_PRINCIPAL, + "cn=8205330,ou=Client6,ou=Vendor1,o=IMC,c=US"); + env.put(Context.SECURITY_CREDENTIALS, "secret123"); + } + + private void run() throws IOException { + initRes(); + initTest(); + int count = 0; + try { + while (count < REPEAT_COUNT) { + count++; + InitialDirContext context = null; + try { + context = new InitialDirContext(env); + } catch (NamingException ne) { + System.out.println("(" + count + "/" + REPEAT_COUNT + + ") It's ok to get NamingException: " + ne); + // for debug + ne.printStackTrace(System.out); + } finally { + cleanupContext(context); + } + } + } finally { + System.out.println("Test count: " + count + "/" + REPEAT_COUNT); + cleanupTest(); + } + } + + private void cleanupTest() { + if (server != null) { + server.stopServer(); + } + cleanupClosableRes(serverSocket); + } + + private void cleanupContext(DirContext context) { + if (context != null) { + try { + context.close(); + } catch (NamingException e) { + // ignore + } + } + } + + private static void cleanupClosableRes(Closeable res) { + if (res != null) { + try { + res.close(); + } catch (Exception e) { + // ignore + } + } + } + + class TestLDAPServer extends Thread { + private volatile boolean isRunning; + + TestLDAPServer() { + isRunning = true; + } + + private void stopServer() { + isRunning = false; + } + + @Override + public void run() { + try { + while (isRunning) { + Socket clientSocket = serverSocket.accept(); + Thread handler = new Thread( + new LDAPServerHandler(clientSocket)); + handler.start(); + } + } catch (IOException e) { + if (isRunning) { + throw new RuntimeException(e); + } + } + } + } + + static class LDAPServerHandler implements Runnable { + // "Notice of Disconnection" message + private static final byte[] DISCONNECT_MSG = { 0x30, 0x4C, 0x02, 0x01, + 0x00, 0x78, 0x47, 0x0A, 0x01, 0x34, 0x04, 0x00, 0x04, 0x28, + 0x55, 0x4E, 0x41, 0x56, 0x41, 0x49, 0x4C, 0x41, 0x42, 0x4C, + 0x45, 0x3A, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x64, + 0x69, 0x73, 0x63, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x21, + (byte) 0x8A, 0x16, 0x31, 0x2E, 0x33, 0x2E, 0x36, 0x2E, 0x31, + 0x2E, 0x34, 0x2E, 0x31, 0x2E, 0x31, 0x34, 0x36, 0x36, 0x2E, + 0x32, 0x30, 0x30, 0x33, 0x36 }; + private static final byte[] BIND_RESPONSE = { 0x30, 0x0C, 0x02, 0x01, + 0x01, 0x61, 0x07, 0x0A, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00 }; + private final Socket clientSocket; + + private LDAPServerHandler(final Socket clientSocket) { + this.clientSocket = clientSocket; + } + + @Override + public void run() { + try (clientSocket; + OutputStream out = clientSocket.getOutputStream(); + InputStream in = clientSocket.getInputStream()) { + if (in.read() > 0) { + in.skip(in.available()); + out.write(BIND_RESPONSE); + out.write(DISCONNECT_MSG); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} From 3cbb33f0e922d9cebfa7279f99f200f552304015 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 17 Sep 2018 14:52:44 +0800 Subject: [PATCH 35/41] 8210736: jdk/javax/xml/crypto/dsig/GenerationTests.java slow on linux Reviewed-by: alanb --- test/jdk/javax/xml/crypto/dsig/GenerationTests.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java index 973fe1f046c..560179a8c0e 100644 --- a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java +++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java @@ -24,7 +24,7 @@ /** * @test * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949 - * 8046724 8079693 8177334 8205507 + * 8046724 8079693 8177334 8205507 8210736 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @modules java.base/sun.security.util * java.base/sun.security.x509 @@ -32,7 +32,7 @@ * jdk.httpserver/com.sun.net.httpserver * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java - * @run main/othervm/timeout=300 GenerationTests + * @run main/othervm/timeout=300 -Dsun.net.httpserver.nodelay=true GenerationTests * @author Sean Mullan */ @@ -51,7 +51,6 @@ import java.security.KeyStore; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; -import java.security.SecureRandom; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509CRL; From 6b8fd447ccdee4b0a26243ce9673ee3edbe8bb23 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Fri, 14 Sep 2018 14:47:50 +0200 Subject: [PATCH 36/41] 8210647: libsaproc is being compiled without optimization Compile with high optimization instead of none. Reviewed-by: erikj, jgeorge, sballal --- make/lib/Lib-jdk.hotspot.agent.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/lib/Lib-jdk.hotspot.agent.gmk b/make/lib/Lib-jdk.hotspot.agent.gmk index f198f5eeaf4..21d0d7cd437 100644 --- a/make/lib/Lib-jdk.hotspot.agent.gmk +++ b/make/lib/Lib-jdk.hotspot.agent.gmk @@ -52,7 +52,7 @@ endif $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \ NAME := saproc, \ - OPTIMIZATION := NONE, \ + OPTIMIZATION := HIGH, \ DISABLED_WARNINGS_microsoft := 4267, \ DISABLED_WARNINGS_gcc := sign-compare, \ DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \ From 36873c3c7b5cf56dac2b6c776377f9634bc6fadc Mon Sep 17 00:00:00 2001 From: Rachna Goel Date: Mon, 17 Sep 2018 14:16:31 +0530 Subject: [PATCH 37/41] 8210490: TimeZone.getDisplayName given Locale.US doesn't always honor the Locale Specified locale for formatting.. Reviewed-by: naoto --- .../cldr/CLDRTimeZoneNameProviderImpl.java | 2 +- .../util/TimeZone/CLDRDisplayNamesTest.java | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java index fa7a05f060c..e829889b3df 100644 --- a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java +++ b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java @@ -281,7 +281,7 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl { .replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d")) .replaceFirst("m+", "\\%2\\$02d"); return MessageFormat.format(gmtFormat, - String.format(hourFormat, offset / 60, offset % 60)); + String.format(l, hourFormat, offset / 60, offset % 60)); } } } diff --git a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java index c55cbfaf317..85c70f36b4a 100644 --- a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java +++ b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java @@ -21,9 +21,9 @@ * questions. */ -/* + /* * @test - * @bug 8005471 8008577 8129881 8130845 8136518 8181157 + * @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490 * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest * @summary Make sure that localized time zone names of CLDR are used @@ -51,7 +51,7 @@ public class CLDRDisplayNamesTest { "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", "GMT-07:00", //"\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6642\u9593", - //"PT" + //"PT" }, { "zh-CN", @@ -60,7 +60,7 @@ public class CLDRDisplayNamesTest { "\u5317\u7f8e\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "GMT-07:00", //"\u5317\u7f8e\u592a\u5e73\u6d0b\u65f6\u95f4", - //"PT", + //"PT", }, { "de-DE", @@ -69,7 +69,7 @@ public class CLDRDisplayNamesTest { "Nordamerikanische Westk\u00fcsten-Sommerzeit", "GMT-07:00", //"Nordamerikanische Westk\u00fcstenzeit", - //"PT", + //"PT", }, }; @@ -86,7 +86,7 @@ public class CLDRDisplayNamesTest { String name = tz.getDisplayName(daylight, style, locale); if (!data[i].equals(name)) { System.err.printf("error: got '%s' expected '%s' (style=%d, daylight=%s, locale=%s)%n", - name, data[i], style, daylight, locale); + name, data[i], style, daylight, locale); errors++; } } @@ -117,6 +117,17 @@ public class CLDRDisplayNamesTest { Locale.setDefault(originalLocale); } + // for 8210490 + // Check that TimeZone.getDisplayName should honor passed locale parameter, + // even if default locale is set to some other locale. + Locale.setDefault(Locale.forLanguageTag("ar-PK")); + TimeZone zi = TimeZone.getTimeZone("Etc/GMT-5"); + String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US); + Locale.setDefault(originalLocale); + if (!displayName.equals("GMT+05:00")) { + System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); + errors++; + } if (errors > 0) { throw new RuntimeException("test failed"); } From ee0ac147a226b006986b42274ed76fd073e181c3 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 17 Sep 2018 11:49:20 +0200 Subject: [PATCH 38/41] 8193561: Cyclic hierarchy causes a NullPointerException when setting DEFAULT flag When marking interface as having default methods, use .owner as it is always defined. Reviewed-by: mcimadamore --- .../com/sun/tools/javac/comp/MemberEnter.java | 2 +- .../langtools/tools/javac/cycle/T8193561.java | 21 +++++++++++++++++++ test/langtools/tools/javac/cycle/T8193561.out | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/langtools/tools/javac/cycle/T8193561.java create mode 100644 test/langtools/tools/javac/cycle/T8193561.out diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 5e7e0678dd3..8076454e217 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -183,7 +183,7 @@ public class MemberEnter extends JCTree.Visitor { //if this is a default method, add the DEFAULT flag to the enclosing interface if ((tree.mods.flags & DEFAULT) != 0) { - m.enclClass().flags_field |= DEFAULT; + m.owner.flags_field |= DEFAULT; } Env localEnv = methodEnv(tree, env); diff --git a/test/langtools/tools/javac/cycle/T8193561.java b/test/langtools/tools/javac/cycle/T8193561.java new file mode 100644 index 00000000000..ba29b442761 --- /dev/null +++ b/test/langtools/tools/javac/cycle/T8193561.java @@ -0,0 +1,21 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8193561 + * @summary Verify that there is no crash for default methods in mutually dependent interfaces + * @compile/fail/ref=T8193561.out -XDrawDiagnostics T8193561.java + */ +package p; + +interface T8193561 extends p.T8193561.I { + + interface I extends T8193561 { + default boolean m() { + return false; + } + } + + default boolean m() { + return false; + } + +} diff --git a/test/langtools/tools/javac/cycle/T8193561.out b/test/langtools/tools/javac/cycle/T8193561.out new file mode 100644 index 00000000000..bb1a5ddf06a --- /dev/null +++ b/test/langtools/tools/javac/cycle/T8193561.out @@ -0,0 +1,2 @@ +T8193561.java:9:1: compiler.err.cyclic.inheritance: p.T8193561 +1 error From b1375858c646c512fc5d20a25923b2951adfc2a8 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Mon, 17 Sep 2018 10:53:56 +0200 Subject: [PATCH 39/41] 8210416: [linux] Poor StrictMath performance due to non-optimized compilation Compile fdlibm with -O2 -ffp-contract=off on gcc/clang arches. Reviewed-by: aph, erikj, dholmes, darcy, ihse --- make/autoconf/flags-cflags.m4 | 14 ++++++++++++++ make/autoconf/spec.gmk.in | 1 + make/lib/CoreLibraries.gmk | 21 ++++++--------------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 887440c190a..9d7fa90e021 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -373,6 +373,20 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS], FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_]) + COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off" + # Check that the compiler supports -ffp-contract=off flag + # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty + # otherwise. + # These flags are required for GCC-based builds of + # fdlibm with optimization without losing precision. + # Notably, -ffp-contract=off needs to be added for GCC >= 4.6. + if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then + FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}], + IF_TRUE: [FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}], + IF_FALSE: [FDLIBM_CFLAGS=""]) + fi + AC_SUBST(FDLIBM_CFLAGS) + # Tests are only ever compiled for TARGET CFLAGS_TESTLIB="$CFLAGS_JDKLIB" CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB" diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 0af9c1deb86..091ec67c4a2 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -450,6 +450,7 @@ CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@ LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@ LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@ +FDLIBM_CFLAGS := @FDLIBM_CFLAGS@ JVM_CFLAGS := @JVM_CFLAGS@ JVM_LDFLAGS := @JVM_LDFLAGS@ JVM_ASFLAGS := @JVM_ASFLAGS@ diff --git a/make/lib/CoreLibraries.gmk b/make/lib/CoreLibraries.gmk index d4c5eacd1fa..b7c49866514 100644 --- a/make/lib/CoreLibraries.gmk +++ b/make/lib/CoreLibraries.gmk @@ -39,20 +39,15 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) BUILD_LIBFDLIBM_OPTIMIZATION := HIGH endif -ifeq ($(OPENJDK_TARGET_OS), linux) - ifeq ($(OPENJDK_TARGET_CPU), ppc64) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), ppc64le) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), s390x) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), aarch64) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - endif +# If FDLIBM_CFLAGS is non-empty we know that we can optimize +# fdlibm when adding those extra C flags. Currently GCC, +# and clang only. +ifneq ($(FDLIBM_CFLAGS), ) + BUILD_LIBFDLIBM_OPTIMIZATION := LOW endif LIBFDLIBM_SRC := $(TOPDIR)/src/java.base/share/native/libfdlibm -LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) +LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) $(FDLIBM_CFLAGS) ifneq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \ @@ -64,10 +59,6 @@ ifneq ($(OPENJDK_TARGET_OS), macosx) CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \ CFLAGS_windows_debug := -DLOGGING, \ CFLAGS_aix := -qfloat=nomaf, \ - CFLAGS_linux_ppc64 := -ffp-contract=off, \ - CFLAGS_linux_ppc64le := -ffp-contract=off, \ - CFLAGS_linux_s390x := -ffp-contract=off, \ - CFLAGS_linux_aarch64 := -ffp-contract=off, \ DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \ DISABLED_WARNINGS_microsoft := 4146 4244 4018, \ ARFLAGS := $(ARFLAGS), \ From f4e1502e038825a44737e1d2c737780352d6e2df Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 17 Sep 2018 08:37:47 -0700 Subject: [PATCH 40/41] 8210596: jshell does not support raw string literals Reviewed-by: jlahoda, jlaskey --- .../jdk/jshell/CompletenessAnalyzer.java | 2 + .../jdk/jshell/MaskCommentsAndModifiers.java | 42 ++++++++++++++++--- .../jdk/jshell/SourceCodeAnalysisImpl.java | 3 +- .../jdk/jshell/ToolLocalSimpleTest.java | 5 +++ test/langtools/jdk/jshell/ToolSimpleTest.java | 18 +++++++- 5 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java index bd510016e36..713169d79bc 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java @@ -31,6 +31,7 @@ import com.sun.tools.javac.parser.ScannerFactory; import com.sun.tools.javac.parser.Tokens.Token; import com.sun.tools.javac.parser.Tokens.TokenKind; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.DiagnosticSource; import com.sun.tools.javac.util.JCDiagnostic; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; @@ -121,6 +122,7 @@ class CompletenessAnalyzer { private CaLog(Context context, PrintWriter pw) { super(context, pw); + this.source = DiagnosticSource.NO_SOURCE; } @Override diff --git a/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java b/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java index 3cf80d1c2e7..387de9b8e8f 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java @@ -67,7 +67,7 @@ class MaskCommentsAndModifiers { private boolean maskModifiers; // Does the string end with an unclosed '/*' style comment? - private boolean openComment = false; + private boolean openToken = false; MaskCommentsAndModifiers(String s, boolean maskModifiers) { this.str = s; @@ -88,8 +88,8 @@ class MaskCommentsAndModifiers { return sbMask.toString(); } - boolean endsWithOpenComment() { - return openComment; + boolean endsWithOpenToken() { + return openToken; } /****** private implementation methods ******/ @@ -142,7 +142,7 @@ class MaskCommentsAndModifiers { private void next() { switch (c) { case '\'': - case '"': + case '"': { maskModifiers = false; write(c); int match = c; @@ -154,6 +154,38 @@ class MaskCommentsAndModifiers { } write(c); // write match // line-end break; + } + case '`': { // RawString + maskModifiers = false; + int backtickCount = 0; + do { + write(c); + ++backtickCount; + read(); + } while (c == '`'); + while (true) { + if (c == '`') { + int cnt = 0; + do { + write(c); + ++cnt; + read(); + } while (c == '`'); + if (cnt == backtickCount) { + unread(); + break; + } + } else { + write(c); + if (c < 0) { + openToken = true; + break; + } + read(); + } + } + break; + } case '/': read(); switch (c) { @@ -166,7 +198,7 @@ class MaskCommentsAndModifiers { prevc = c; } writeMask(c); - openComment = c < 0; + openToken = c < 0; break; case '/': writeMask('/'); diff --git a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java index 5b7624e2240..f43d378610c 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java @@ -25,7 +25,6 @@ package jdk.jshell; -import jdk.jshell.SourceCodeAnalysis.Completeness; import com.sun.source.tree.AssignmentTree; import com.sun.source.tree.ClassTree; import com.sun.source.tree.CompilationUnitTree; @@ -170,7 +169,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis { @Override public CompletionInfo analyzeCompletion(String srcInput) { MaskCommentsAndModifiers mcm = new MaskCommentsAndModifiers(srcInput, false); - if (mcm.endsWithOpenComment()) { + if (mcm.endsWithOpenToken()) { proc.debug(DBG_COMPA, "Incomplete (open comment): %s\n", srcInput); return new CompletionInfoImpl(DEFINITELY_INCOMPLETE, null, srcInput + '\n'); } diff --git a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java index 73ac634be21..6e67ea95a5a 100644 --- a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java +++ b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java @@ -85,4 +85,9 @@ public class ToolLocalSimpleTest extends ToolSimpleTest { ); } + @Test + public void testRawString() { + // can't set --enable-preview for local, ignore + } + } diff --git a/test/langtools/jdk/jshell/ToolSimpleTest.java b/test/langtools/jdk/jshell/ToolSimpleTest.java index dfe5009e29e..265c3873d17 100644 --- a/test/langtools/jdk/jshell/ToolSimpleTest.java +++ b/test/langtools/jdk/jshell/ToolSimpleTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 + * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 * @summary Simple jshell tool tests * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -74,6 +74,22 @@ public class ToolSimpleTest extends ReplToolTesting { ); } + @Test + public void testRawString() { + test(false, new String[]{"--enable-preview", "--no-startup"}, + (a) -> assertCommand(a, "String s = `abc`", "s ==> \"abc\""), + (a) -> assertCommand(a, "String a = `abc", ""), + (a) -> assertCommand(a, "def`", "a ==> \"abc\\ndef\""), + (a) -> assertCommand(a, "String bj = ``Hi, `Bob` and ```Jim```.``", "bj ==> \"Hi, `Bob` and ```Jim```.\""), + (a) -> assertCommand(a, "String hw = ````````````", ""), + (a) -> assertCommand(a, "Hello, world", ""), + (a) -> assertCommand(a, "````````````;", "hw ==> \"\\nHello, world\\n\""), + (a) -> assertCommand(a, "String uc = `\\u000d\\u000a`", "uc ==> \"\\\\u000d\\\\u000a\""), + (a) -> assertCommand(a, "String es = `\\(.\\)\\1`", "es ==> \"\\\\(.\\\\)\\\\1\""), + (a) -> assertCommand(a, "String end = `abc`+`def`+`ghi`", "end ==> \"abcdefghi\"") + ); + } + @Test public void testLessThan() { test( From fddc4b8ccb8df5b15a92530fb1628e13452067ed Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Mon, 17 Sep 2018 09:07:40 -0700 Subject: [PATCH 41/41] 8210726: Fix up a few minor nits forgotten by JDK-8210665 Minor changes to 4 tests to make one-liners Reviewed-by: cjplummer, iignatyev, sspitsyn --- .../nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp | 6 ++---- .../nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp | 6 ++---- .../SetFieldModificationWatch/setfmodw006/setfmodw006.cpp | 6 ++---- .../nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp index 2fb1f4aa8ba..50fd33d6cd2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp @@ -154,11 +154,9 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) for (i = 0; i < sizeof(fields) / sizeof(field); i++) { if (fields[i].stat == JNI_TRUE) { - fields[i].fid = env-> GetStaticFieldID( - cls, fields[i].name, fields[i].sig); + fields[i].fid = env->GetStaticFieldID(cls, fields[i].name, fields[i].sig); } else { - fields[i].fid = env->GetFieldID( - cls, fields[i].name, fields[i].sig); + fields[i].fid = env->GetFieldID(cls, fields[i].name, fields[i].sig); } if (fields[i].fid == NULL) { printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp index 8d0309d9ceb..01f4f19e1e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp @@ -176,11 +176,9 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, } for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watches[i].is_static == JNI_TRUE) { - watches[i].fid = env->GetStaticFieldID( - cls, watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetStaticFieldID(cls, watches[i].f_name, watches[i].f_sig); } else { - watches[i].fid = env->GetFieldID( - cls, watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } err = jvmti->SetFieldAccessWatch(cls, watches[i].fid); if (err == JVMTI_ERROR_NONE) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp index d4a12313458..da74e1a92ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp @@ -170,11 +170,9 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, } for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watches[i].is_static == JNI_TRUE) { - watches[i].fid = env->GetStaticFieldID( - cls, watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetStaticFieldID(cls, watches[i].f_name, watches[i].f_sig); } else { - watches[i].fid = env->GetFieldID( - cls, watches[i].f_name, watches[i].f_sig); + watches[i].fid = env->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } err = jvmti->SetFieldModificationWatch(cls, watches[i].fid); if (err == JVMTI_ERROR_NONE) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp index e5bfb579360..a2dbb7b9698 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp @@ -108,8 +108,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre return result; } - mid = env->GetStaticMethodID( - cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); + mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); if (mid == NULL) { printf("Cannot find method \"run\"\n"); return STATUS_FAILED;