--- old/make/autoconf/flags.m4 2017-12-04 21:40:10.076750682 +0100 +++ new/make/autoconf/flags.m4 2017-12-04 21:40:09.796750678 +0100 @@ -1166,7 +1166,9 @@ -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \ -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \ -I${TOPDIR}/src/java.base/share/native/libjava \ - -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava" + -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava \ + -I${TOPDIR}/src/hotspot/share/include \ + -I${TOPDIR}/src/hotspot/os/${HOTSPOT_$1_OS_TYPE}/include" # The shared libraries are compiled using the picflag. $2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \ --- old/make/autoconf/platform.m4 2017-12-04 21:40:10.736750693 +0100 +++ new/make/autoconf/platform.m4 2017-12-04 21:40:10.460750688 +0100 @@ -388,13 +388,6 @@ OPENJDK_$1_CPU_JLI="amd64" fi - if test "x$OPENJDK_$1_OS" = xmacosx; then - OPENJDK_$1_OS_EXPORT_DIR=macosx - else - OPENJDK_$1_OS_EXPORT_DIR=${OPENJDK_$1_OS_TYPE} - fi - AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR) - # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles # Macosx is osx and x86_64 is x64 if test "x$OPENJDK_$1_OS" = xmacosx; then --- old/make/autoconf/spec.gmk.in 2017-12-04 21:40:11.380750703 +0100 +++ new/make/autoconf/spec.gmk.in 2017-12-04 21:40:11.104750699 +0100 @@ -78,7 +78,6 @@ OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@ OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@ OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@ -OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@ HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@ HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@ --- old/make/copy/Copy-java.base.gmk 2017-12-04 21:40:12.028750713 +0100 +++ new/make/copy/Copy-java.base.gmk 2017-12-04 21:40:11.752750709 +0100 @@ -28,24 +28,6 @@ $(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk)) ################################################################################ -# -# Copy exported header files to outputdir. -# -TARGETS += \ - $(INCLUDE_DST_DIR)/jni.h \ - $(INCLUDE_DST_DIR)/jvmticmlr.h \ - $(INCLUDE_DST_DIR)/classfile_constants.h \ - $(INCLUDE_DST_OS_DIR)/jni_md.h \ - # - -$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/java.base/share/native/include/%.h - $(call install-file) - -$(INCLUDE_DST_OS_DIR)/%.h: \ - $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include/%.h - $(call install-file) - -################################################################################ ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),) --- old/make/copy/Copy-java.desktop.gmk 2017-12-04 21:40:12.668750724 +0100 +++ new/make/copy/Copy-java.desktop.gmk 2017-12-04 21:40:12.388750719 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -29,20 +29,6 @@ ################################################################################ -TARGETS += \ - $(INCLUDE_DST_DIR)/jawt.h \ - $(INCLUDE_DST_OS_DIR)/jawt_md.h \ - # - -$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/java.desktop/share/native/include/%.h - $(call install-file) - -$(INCLUDE_DST_OS_DIR)/%.h: \ - $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include/%.h - $(call install-file) - -################################################################################ - ifneq ($(FREETYPE_BUNDLE_LIB_PATH), ) # We need to bundle the freetype library, so it will be available at runtime # as well as link time. --- old/make/copy/Copy-jdk.accessibility.gmk 2017-12-04 21:40:13.312750734 +0100 +++ new/make/copy/Copy-jdk.accessibility.gmk 2017-12-04 21:40:13.040750729 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2104, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -23,19 +23,7 @@ # questions. # -include CopyCommon.gmk - ################################################################################ +# Include CopyCommon.gmk to get exported header files to be properly copied. -ifeq ($(OPENJDK_TARGET_OS), windows) - TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \ - $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \ - $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h - - $(INCLUDE_DST_OS_DIR)/bridge/%: \ - $(TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/% - $(install-file) - -endif - -################################################################################ +include CopyCommon.gmk --- old/make/copy/Copy-jdk.jdwp.agent.gmk 2017-12-04 21:40:13.960750744 +0100 +++ new/make/copy/Copy-jdk.jdwp.agent.gmk 2017-12-04 21:40:13.680750740 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 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 @@ -23,13 +23,7 @@ # questions. # -include CopyCommon.gmk - ################################################################################ +# Include CopyCommon.gmk to get exported header files to be properly copied. -TARGETS := $(INCLUDE_DST_DIR)/jdwpTransport.h - -$(INCLUDE_DST_DIR)/%.h: $(TOPDIR)/src/jdk.jdwp.agent/share/native/include/%.h - $(call install-file) - -################################################################################ +include CopyCommon.gmk --- old/make/copy/CopyCommon.gmk 2017-12-04 21:40:14.600750754 +0100 +++ new/make/copy/CopyCommon.gmk 2017-12-04 21:40:14.328750750 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -23,15 +23,49 @@ # questions. # -INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE) LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE) LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE) -INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/$(OPENJDK_TARGET_OS) +################################################################################ +# +# Copy exported include headers files to output directory, if present. +# + +INCLUDE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE) + +$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \ + SRC := $(TOPDIR)/src/$(MODULE)/share/native/include, \ + DEST := $(INCLUDE_TARGET_DIR), \ + FILES := $(wildcard \ + $(TOPDIR)/src/$(MODULE)/share/native/include/* \ + $(TOPDIR)/src/$(MODULE)/share/native/include/*/*), \ +)) + +TARGETS += $(COPY_EXPORTED_INCLUDE) +# For historical reasons, the OS include directories have odd names. +INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS) ifeq ($(OPENJDK_TARGET_OS), windows) - INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/win32 + INCLUDE_TARGET_OS_SUBDIR := win32 else ifeq ($(OPENJDK_TARGET_OS), macosx) - INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/darwin + INCLUDE_TARGET_OS_SUBDIR := darwin endif + +# Use the most specific of OS and OS_TYPE. +ifneq ($(wildcard $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include/*), ) + INCLUDE_SOURCE_OS_SUBDIR := $(OPENJDK_TARGET_OS) +else + INCLUDE_SOURCE_OS_SUBDIR := $(OPENJDK_TARGET_OS_TYPE) +endif + +$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \ + SRC := $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include, \ + DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \ + FILES := $(wildcard \ + $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include/* \ + $(TOPDIR)/src/$(MODULE)/$(INCLUDE_SOURCE_OS_SUBDIR)/native/include/*/*), \ +)) + +TARGETS += $(COPY_EXPORTED_INCLUDE_OS) + --- old/make/gensrc/GensrcX11Wrappers.gmk 2017-12-04 21:40:15.244750765 +0100 +++ new/make/gensrc/GensrcX11Wrappers.gmk 2017-12-04 21:40:14.964750760 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 @@ -92,8 +92,10 @@ endif SIZER_CFLAGS := \ + -I${TOPDIR}/src/hotspot/share/include \ + -I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \ -I$(TOPDIR)/src/java.base/share/native/include \ - -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \ + -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \ -I$(TOPDIR)/src/java.base/share/native/libjava \ -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ --- old/make/hotspot/lib/CompileJvm.gmk 2017-12-04 21:40:15.888750775 +0100 +++ new/make/hotspot/lib/CompileJvm.gmk 2017-12-04 21:40:15.608750770 +0100 @@ -57,9 +57,10 @@ $(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \ -I$(JVM_VARIANT_OUTPUTDIR)/gensrc \ -I$(TOPDIR)/src/hotspot/share/precompiled \ + -I$(TOPDIR)/src/hotspot/share/include \ + -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \ -I$(TOPDIR)/src/java.base/share/native/include \ -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \ - -I$(TOPDIR)/src/java.management/share/native/include \ -I$(TOPDIR)/src/java.base/share/native/libjimage \ # --- old/make/hotspot/lib/CompileLibjsig.gmk 2017-12-04 21:40:16.528750785 +0100 +++ new/make/hotspot/lib/CompileLibjsig.gmk 2017-12-04 21:40:16.256750781 +0100 @@ -57,7 +57,7 @@ endif else ifeq ($(OPENJDK_TARGET_OS), solaris) - LIBJSIG_CFLAGS := -m64 -KPIC -mt -I $(TOPDIR)/src/java.base/unix/native/include + LIBJSIG_CFLAGS := -m64 -KPIC -mt -I $(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include LIBJSIG_LDFLAGS := -m64 -mt -xnolib LIBJSIG_LIBS := $(LIBDL) --- old/make/lib/Lib-java.management.gmk 2017-12-04 21:40:17.176750795 +0100 +++ new/make/lib/Lib-java.management.gmk 2017-12-04 21:40:16.896750791 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -30,8 +30,8 @@ ################################################################################ -LIBMANAGEMENT_SRC += $(TOPDIR)/src/java.management/share/native/libmanagement -LIBMANAGEMENT_CFLAGS := -I$(TOPDIR)/src/java.management/share/native/include \ +LIBMANAGEMENT_SRC += $(TOPDIR)/src/java.management/share/native/libmanagement +LIBMANAGEMENT_CFLAGS := -I$(TOPDIR)/src/hotspot/share/include \ $(addprefix -I,$(LIBMANAGEMENT_SRC)) \ -I$(SUPPORT_OUTPUTDIR)/headers/java.management \ $(LIBJAVA_HEADER_FLAGS) \ --- old/src/java.base/unix/native/include/jvm_md.h 2017-12-04 21:40:17.936750807 +0100 +++ /dev/null 2017-11-09 09:28:37.261712036 +0100 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#ifndef _JAVASOFT_JVM_MD_H_ -#define _JAVASOFT_JVM_MD_H_ - -/* - * This file is currently collecting system-specific dregs for the - * JNI conversion, which should be sorted out later. - */ - -#include /* For DIR */ -#include /* For MAXPATHLEN */ -#include /* For F_OK, R_OK, W_OK */ -#include /* For ptrdiff_t */ -#include /* For uintptr_t */ - -#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} -#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} -#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"} -#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"} -#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"} -#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} - -#define JNI_LIB_PREFIX "lib" -#ifdef __APPLE__ -#define JNI_LIB_SUFFIX ".dylib" -#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX -#else -#define JNI_LIB_SUFFIX ".so" -#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX "." VERSION -#endif -#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX - -#if defined(AIX) || defined(SOLARIS) -#define JVM_MAXPATHLEN MAXPATHLEN -#else -// Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may -// cause problems if JVM and the rest of JDK are built on different -// Linux releases. Here we define JVM_MAXPATHLEN to be MAXPATHLEN + 1, -// so buffers declared in VM are always >= 4096. -#define JVM_MAXPATHLEN MAXPATHLEN + 1 -#endif - -#define JVM_R_OK R_OK -#define JVM_W_OK W_OK -#define JVM_X_OK X_OK -#define JVM_F_OK F_OK - -/* - * File I/O - */ - -#include -#include -#include -#include -#include - -/* Signals */ - -#include // for socklen_t - -#define JVM_SIGINT SIGINT -#define JVM_SIGTERM SIGTERM - -#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */ -#ifdef SOLARIS -#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */ -#endif // SOLARIS -#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */ -#define SHUTDOWN2_SIGNAL SIGINT -#define SHUTDOWN3_SIGNAL SIGTERM - -/* With 1.4.1 libjsig added versioning: used in os_solaris.cpp and jsig.c */ -#define JSIG_VERSION_1_4_1 0x30140100 - -#endif /* !_JAVASOFT_JVM_MD_H_ */ --- /dev/null 2017-11-09 09:28:37.261712036 +0100 +++ new/src/hotspot/os/posix/include/jvm_md.h 2017-12-04 21:40:17.548750801 +0100 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef _JAVASOFT_JVM_MD_H_ +#define _JAVASOFT_JVM_MD_H_ + +/* + * This file is currently collecting system-specific dregs for the + * JNI conversion, which should be sorted out later. + */ + +#include /* For DIR */ +#include /* For MAXPATHLEN */ +#include /* For F_OK, R_OK, W_OK */ +#include /* For ptrdiff_t */ +#include /* For uintptr_t */ + +#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} +#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} +#define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"} +#define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"} +#define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"} +#define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} + +#define JNI_LIB_PREFIX "lib" +#ifdef __APPLE__ +#define JNI_LIB_SUFFIX ".dylib" +#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX +#else +#define JNI_LIB_SUFFIX ".so" +#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX "." VERSION +#endif +#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX + +#if defined(AIX) || defined(SOLARIS) +#define JVM_MAXPATHLEN MAXPATHLEN +#else +// Hack: MAXPATHLEN is 4095 on some Linux and 4096 on others. This may +// cause problems if JVM and the rest of JDK are built on different +// Linux releases. Here we define JVM_MAXPATHLEN to be MAXPATHLEN + 1, +// so buffers declared in VM are always >= 4096. +#define JVM_MAXPATHLEN MAXPATHLEN + 1 +#endif + +#define JVM_R_OK R_OK +#define JVM_W_OK W_OK +#define JVM_X_OK X_OK +#define JVM_F_OK F_OK + +/* + * File I/O + */ + +#include +#include +#include +#include +#include + +/* Signals */ + +#include // for socklen_t + +#define JVM_SIGINT SIGINT +#define JVM_SIGTERM SIGTERM + +#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */ +#ifdef SOLARIS +#define ASYNC_SIGNAL SIGJVM2 /* Event-based suspend/resume support */ +#endif // SOLARIS +#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */ +#define SHUTDOWN2_SIGNAL SIGINT +#define SHUTDOWN3_SIGNAL SIGTERM + +/* With 1.4.1 libjsig added versioning: used in os_solaris.cpp and jsig.c */ +#define JSIG_VERSION_1_4_1 0x30140100 + +#endif /* !_JAVASOFT_JVM_MD_H_ */ --- old/src/java.base/windows/native/include/jvm_md.h 2017-12-04 21:40:18.508750816 +0100 +++ /dev/null 2017-11-09 09:28:37.261712036 +0100 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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. - */ - -#ifndef _JAVASOFT_JVM_MD_H_ -#define _JAVASOFT_JVM_MD_H_ - -/* - * This file is currently collecting system-specific dregs for the - * JNI conversion, which should be sorted out later. - */ - -#include -#include -#include - -#include "jni.h" - -typedef int socklen_t; - -#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"} -#define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"} -#define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"} -#define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"} -#define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"} -#define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"} - -#define JNI_LIB_PREFIX "" -#define JNI_LIB_SUFFIX ".dll" - -struct dirent { - char d_name[MAX_PATH]; -}; - -typedef struct { - struct dirent dirent; - char *path; - HANDLE handle; - WIN32_FIND_DATA find_data; -} DIR; - -#include /* For uintptr_t */ -#include - -#define JVM_MAXPATHLEN _MAX_PATH - -#define JVM_R_OK 4 -#define JVM_W_OK 2 -#define JVM_X_OK 1 -#define JVM_F_OK 0 - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEXPORT void * JNICALL -JVM_GetThreadInterruptEvent(); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -/* - * File I/O - */ - -#include -#include -#include -#include -#include - -/* Signals */ - -#define JVM_SIGINT SIGINT -#define JVM_SIGTERM SIGTERM - -#define SHUTDOWN1_SIGNAL SIGINT /* Shutdown Hooks support. */ -#define SHUTDOWN2_SIGNAL SIGTERM - -#endif /* !_JAVASOFT_JVM_MD_H_ */ --- /dev/null 2017-11-09 09:28:37.261712036 +0100 +++ new/src/hotspot/os/windows/include/jvm_md.h 2017-12-04 21:40:18.128750810 +0100 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1997, 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. 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. + */ + +#ifndef _JAVASOFT_JVM_MD_H_ +#define _JAVASOFT_JVM_MD_H_ + +/* + * This file is currently collecting system-specific dregs for the + * JNI conversion, which should be sorted out later. + */ + +#include +#include +#include + +#include "jni.h" + +typedef int socklen_t; + +#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"} +#define JNI_ONUNLOAD_SYMBOLS {"_JNI_OnUnload@8", "JNI_OnUnload"} +#define JVM_ONLOAD_SYMBOLS {"_JVM_OnLoad@12", "JVM_OnLoad"} +#define AGENT_ONLOAD_SYMBOLS {"_Agent_OnLoad@12", "Agent_OnLoad"} +#define AGENT_ONUNLOAD_SYMBOLS {"_Agent_OnUnload@4", "Agent_OnUnload"} +#define AGENT_ONATTACH_SYMBOLS {"_Agent_OnAttach@12", "Agent_OnAttach"} + +#define JNI_LIB_PREFIX "" +#define JNI_LIB_SUFFIX ".dll" + +struct dirent { + char d_name[MAX_PATH]; +}; + +typedef struct { + struct dirent dirent; + char *path; + HANDLE handle; + WIN32_FIND_DATA find_data; +} DIR; + +#include /* For uintptr_t */ +#include + +#define JVM_MAXPATHLEN _MAX_PATH + +#define JVM_R_OK 4 +#define JVM_W_OK 2 +#define JVM_X_OK 1 +#define JVM_F_OK 0 + +#ifdef __cplusplus +extern "C" { +#endif + +JNIEXPORT void * JNICALL +JVM_GetThreadInterruptEvent(); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +/* + * File I/O + */ + +#include +#include +#include +#include +#include + +/* Signals */ + +#define JVM_SIGINT SIGINT +#define JVM_SIGTERM SIGTERM + +#define SHUTDOWN1_SIGNAL SIGINT /* Shutdown Hooks support. */ +#define SHUTDOWN2_SIGNAL SIGTERM + +#endif /* !_JAVASOFT_JVM_MD_H_ */ --- old/src/java.management/share/native/include/jmm.h 2017-12-04 21:40:19.084750826 +0100 +++ /dev/null 2017-11-09 09:28:37.261712036 +0100 @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. 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. - */ - -#ifndef _JAVA_JMM_H_ -#define _JAVA_JMM_H_ - -/* - * This is a private interface used by JDK for JVM monitoring - * and management. - * - * Bump the version number when either of the following happens: - * - * 1. There is a change in functions in JmmInterface. - * - * 2. There is a change in the contract between VM and Java classes. - */ - -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - JMM_VERSION_1 = 0x20010000, - JMM_VERSION_1_0 = 0x20010000, - JMM_VERSION_1_1 = 0x20010100, // JDK 6 - JMM_VERSION_1_2 = 0x20010200, // JDK 7 - JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA - JMM_VERSION_1_2_2 = 0x20010202, - JMM_VERSION_2 = 0x20020000, // JDK 10 - JMM_VERSION = 0x20020000 -}; - -typedef struct { - unsigned int isLowMemoryDetectionSupported : 1; - unsigned int isCompilationTimeMonitoringSupported : 1; - unsigned int isThreadContentionMonitoringSupported : 1; - unsigned int isCurrentThreadCpuTimeSupported : 1; - unsigned int isOtherThreadCpuTimeSupported : 1; - unsigned int isObjectMonitorUsageSupported : 1; - unsigned int isSynchronizerUsageSupported : 1; - unsigned int isThreadAllocatedMemorySupported : 1; - unsigned int isRemoteDiagnosticCommandsSupported : 1; - unsigned int : 22; -} jmmOptionalSupport; - -typedef enum { - JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */ - JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */ - JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */ - JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */ - JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */ - JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */ - JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */ - JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ - JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ - JMM_GC_COUNT = 10, /* Total number of collections */ - JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */ - - JMM_INTERNAL_ATTRIBUTE_INDEX = 100, - JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ - JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */ - JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */ - JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */ - JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */ - JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */ - JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */ - JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */ - JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */ - JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */ - JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */ - JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */ - JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */ - JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */ - JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */ - JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */ - JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */ - - JMM_OS_ATTRIBUTE_INDEX = 200, - JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */ - JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */ - - JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */ -} jmmLongAttribute; - -typedef enum { - JMM_VERBOSE_GC = 21, - JMM_VERBOSE_CLASS = 22, - JMM_THREAD_CONTENTION_MONITORING = 23, - JMM_THREAD_CPU_TIME = 24, - JMM_THREAD_ALLOCATED_MEMORY = 25 -} jmmBoolAttribute; - - -enum { - JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000, - JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000 -}; - -#define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000 - -typedef enum { - JMM_STAT_PEAK_THREAD_COUNT = 801, - JMM_STAT_THREAD_CONTENTION_COUNT = 802, - JMM_STAT_THREAD_CONTENTION_TIME = 803, - JMM_STAT_THREAD_CONTENTION_STAT = 804, - JMM_STAT_PEAK_POOL_USAGE = 805, - JMM_STAT_GC_STAT = 806 -} jmmStatisticType; - -typedef enum { - JMM_USAGE_THRESHOLD_HIGH = 901, - JMM_USAGE_THRESHOLD_LOW = 902, - JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903, - JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904 -} jmmThresholdType; - -/* Should match what is allowed in globals.hpp */ -typedef enum { - JMM_VMGLOBAL_TYPE_UNKNOWN = 0, - JMM_VMGLOBAL_TYPE_JBOOLEAN = 1, - JMM_VMGLOBAL_TYPE_JSTRING = 2, - JMM_VMGLOBAL_TYPE_JLONG = 3, - JMM_VMGLOBAL_TYPE_JDOUBLE = 4 -} jmmVMGlobalType; - -typedef enum { - JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */ - JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */ - JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */ - JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */ - JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */ - JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */ - JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7, /* Set via attach */ - JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */ -} jmmVMGlobalOrigin; - -typedef struct { - jstring name; - jvalue value; - jmmVMGlobalType type; /* Data type */ - jmmVMGlobalOrigin origin; /* Default or non-default value */ - unsigned int writeable : 1; /* dynamically writeable */ - unsigned int external : 1; /* external supported interface */ - unsigned int reserved : 30; - void *reserved1; - void *reserved2; -} jmmVMGlobal; - -typedef struct { - const char* name; - char type; - const char* description; -} jmmExtAttributeInfo; - -/* Caller has to set the following fields before calling GetLastGCStat - * o usage_before_gc - array of MemoryUsage objects - * o usage_after_gc - array of MemoryUsage objects - * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array - * o gc_ext_attribtue_values - array of jvalues - */ -typedef struct { - jlong gc_index; /* Index of the collections */ - jlong start_time; /* Start time of the GC */ - jlong end_time; /* End time of the GC */ - jobjectArray usage_before_gc; /* Memory usage array before GC */ - jobjectArray usage_after_gc; /* Memory usage array after GC */ - jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */ - jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */ - jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */ - /* -1 indicates gc_ext_attribute_values is not big enough */ -} jmmGCStat; - -typedef struct { - const char* name; /* Name of the diagnostic command */ - const char* description; /* Short description */ - const char* impact; /* Impact on the JVM */ - const char* permission_class; /* Class name of the required permission if any */ - const char* permission_name; /* Permission name of the required permission if any */ - const char* permission_action; /* Action name of the required permission if any*/ - int num_arguments; /* Number of supported options or arguments */ - jboolean enabled; /* True if the diagnostic command can be invoked, false otherwise*/ -} dcmdInfo; - -typedef struct { - const char* name; /* Option/Argument name*/ - const char* description; /* Short description */ - const char* type; /* Type: STRING, BOOLEAN, etc. */ - const char* default_string; /* Default value in a parsable string */ - jboolean mandatory; /* True if the option/argument is mandatory */ - jboolean option; /* True if it is an option, false if it is an argument */ - /* (see diagnosticFramework.hpp for option/argument definitions) */ - jboolean multiple; /* True is the option can be specified several time */ - int position; /* Expected position for this argument (this field is */ - /* meaningless for options) */ -} dcmdArgInfo; - -typedef struct jmmInterface_1_ { - void* reserved1; - void* reserved2; - - jint (JNICALL *GetVersion) (JNIEnv *env); - - jint (JNICALL *GetOptionalSupport) (JNIEnv *env, - jmmOptionalSupport* support_ptr); - - jint (JNICALL *GetThreadInfo) (JNIEnv *env, - jlongArray ids, - jint maxDepth, - jobjectArray infoArray); - - jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr); - - jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool); - - jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool); - jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool); - - void (JNICALL *GetThreadAllocatedMemory) - (JNIEnv *env, - jlongArray ids, - jlongArray sizeArray); - - jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap); - - jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att); - jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att); - jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag); - - jint (JNICALL *GetLongAttributes) (JNIEnv *env, - jobject obj, - jmmLongAttribute* atts, - jint count, - jlong* result); - - jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env); - - // Not used in JDK 6 or JDK 7 - jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id); - - jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env); - jint (JNICALL *GetVMGlobals) (JNIEnv *env, - jobjectArray names, - jmmVMGlobal *globals, - jint count); - - jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env, - jobjectArray names, - jlongArray times); - - jboolean (JNICALL *ResetStatistic) (JNIEnv *env, - jvalue obj, - jmmStatisticType type); - - void (JNICALL *SetPoolSensor) (JNIEnv *env, - jobject pool, - jmmThresholdType type, - jobject sensor); - - jlong (JNICALL *SetPoolThreshold) (JNIEnv *env, - jobject pool, - jmmThresholdType type, - jlong threshold); - jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool); - - jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env, - jobject mgr, - jmmExtAttributeInfo *ext_info, - jint count); - void (JNICALL *GetLastGCStat) (JNIEnv *env, - jobject mgr, - jmmGCStat *gc_stat); - - jlong (JNICALL *GetThreadCpuTimeWithKind) - (JNIEnv *env, - jlong thread_id, - jboolean user_sys_cpu_time); - void (JNICALL *GetThreadCpuTimesWithKind) - (JNIEnv *env, - jlongArray ids, - jlongArray timeArray, - jboolean user_sys_cpu_time); - - jint (JNICALL *DumpHeap0) (JNIEnv *env, - jstring outputfile, - jboolean live); - jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env, - jboolean object_monitors_only); - void (JNICALL *SetVMGlobal) (JNIEnv *env, - jstring flag_name, - jvalue new_value); - void* reserved6; - jobjectArray (JNICALL *DumpThreads) (JNIEnv *env, - jlongArray ids, - jboolean lockedMonitors, - jboolean lockedSynchronizers, - jint maxDepth); - void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env, - jobject mgr, - jboolean enabled); - jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env); - void (JNICALL *GetDiagnosticCommandInfo) - (JNIEnv *env, - jobjectArray cmds, - dcmdInfo *infoArray); - void (JNICALL *GetDiagnosticCommandArgumentsInfo) - (JNIEnv *env, - jstring commandName, - dcmdArgInfo *infoArray); - jstring (JNICALL *ExecuteDiagnosticCommand) - (JNIEnv *env, - jstring command); - void (JNICALL *SetDiagnosticFrameworkNotificationEnabled) - (JNIEnv *env, - jboolean enabled); -} JmmInterface; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVA_JMM_H_ */ --- /dev/null 2017-11-09 09:28:37.261712036 +0100 +++ new/src/hotspot/share/include/jmm.h 2017-12-04 21:40:18.704750820 +0100 @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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. + */ + +#ifndef _JAVA_JMM_H_ +#define _JAVA_JMM_H_ + +/* + * This is a private interface used by JDK for JVM monitoring + * and management. + * + * Bump the version number when either of the following happens: + * + * 1. There is a change in functions in JmmInterface. + * + * 2. There is a change in the contract between VM and Java classes. + */ + +#include "jni.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + JMM_VERSION_1 = 0x20010000, + JMM_VERSION_1_0 = 0x20010000, + JMM_VERSION_1_1 = 0x20010100, // JDK 6 + JMM_VERSION_1_2 = 0x20010200, // JDK 7 + JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA + JMM_VERSION_1_2_2 = 0x20010202, + JMM_VERSION_2 = 0x20020000, // JDK 10 + JMM_VERSION = 0x20020000 +}; + +typedef struct { + unsigned int isLowMemoryDetectionSupported : 1; + unsigned int isCompilationTimeMonitoringSupported : 1; + unsigned int isThreadContentionMonitoringSupported : 1; + unsigned int isCurrentThreadCpuTimeSupported : 1; + unsigned int isOtherThreadCpuTimeSupported : 1; + unsigned int isObjectMonitorUsageSupported : 1; + unsigned int isSynchronizerUsageSupported : 1; + unsigned int isThreadAllocatedMemorySupported : 1; + unsigned int isRemoteDiagnosticCommandsSupported : 1; + unsigned int : 22; +} jmmOptionalSupport; + +typedef enum { + JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */ + JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */ + JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */ + JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */ + JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */ + JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */ + JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */ + JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ + JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ + JMM_GC_COUNT = 10, /* Total number of collections */ + JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */ + + JMM_INTERNAL_ATTRIBUTE_INDEX = 100, + JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ + JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */ + JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */ + JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */ + JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */ + JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */ + JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */ + JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */ + JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */ + JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */ + JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */ + JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */ + JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */ + JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */ + JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */ + JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */ + JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */ + + JMM_OS_ATTRIBUTE_INDEX = 200, + JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */ + JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */ + + JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */ +} jmmLongAttribute; + +typedef enum { + JMM_VERBOSE_GC = 21, + JMM_VERBOSE_CLASS = 22, + JMM_THREAD_CONTENTION_MONITORING = 23, + JMM_THREAD_CPU_TIME = 24, + JMM_THREAD_ALLOCATED_MEMORY = 25 +} jmmBoolAttribute; + + +enum { + JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000, + JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000 +}; + +#define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000 + +typedef enum { + JMM_STAT_PEAK_THREAD_COUNT = 801, + JMM_STAT_THREAD_CONTENTION_COUNT = 802, + JMM_STAT_THREAD_CONTENTION_TIME = 803, + JMM_STAT_THREAD_CONTENTION_STAT = 804, + JMM_STAT_PEAK_POOL_USAGE = 805, + JMM_STAT_GC_STAT = 806 +} jmmStatisticType; + +typedef enum { + JMM_USAGE_THRESHOLD_HIGH = 901, + JMM_USAGE_THRESHOLD_LOW = 902, + JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903, + JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904 +} jmmThresholdType; + +/* Should match what is allowed in globals.hpp */ +typedef enum { + JMM_VMGLOBAL_TYPE_UNKNOWN = 0, + JMM_VMGLOBAL_TYPE_JBOOLEAN = 1, + JMM_VMGLOBAL_TYPE_JSTRING = 2, + JMM_VMGLOBAL_TYPE_JLONG = 3, + JMM_VMGLOBAL_TYPE_JDOUBLE = 4 +} jmmVMGlobalType; + +typedef enum { + JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */ + JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */ + JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */ + JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */ + JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */ + JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */ + JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND = 7, /* Set via attach */ + JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */ +} jmmVMGlobalOrigin; + +typedef struct { + jstring name; + jvalue value; + jmmVMGlobalType type; /* Data type */ + jmmVMGlobalOrigin origin; /* Default or non-default value */ + unsigned int writeable : 1; /* dynamically writeable */ + unsigned int external : 1; /* external supported interface */ + unsigned int reserved : 30; + void *reserved1; + void *reserved2; +} jmmVMGlobal; + +typedef struct { + const char* name; + char type; + const char* description; +} jmmExtAttributeInfo; + +/* Caller has to set the following fields before calling GetLastGCStat + * o usage_before_gc - array of MemoryUsage objects + * o usage_after_gc - array of MemoryUsage objects + * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array + * o gc_ext_attribtue_values - array of jvalues + */ +typedef struct { + jlong gc_index; /* Index of the collections */ + jlong start_time; /* Start time of the GC */ + jlong end_time; /* End time of the GC */ + jobjectArray usage_before_gc; /* Memory usage array before GC */ + jobjectArray usage_after_gc; /* Memory usage array after GC */ + jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */ + jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */ + jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */ + /* -1 indicates gc_ext_attribute_values is not big enough */ +} jmmGCStat; + +typedef struct { + const char* name; /* Name of the diagnostic command */ + const char* description; /* Short description */ + const char* impact; /* Impact on the JVM */ + const char* permission_class; /* Class name of the required permission if any */ + const char* permission_name; /* Permission name of the required permission if any */ + const char* permission_action; /* Action name of the required permission if any*/ + int num_arguments; /* Number of supported options or arguments */ + jboolean enabled; /* True if the diagnostic command can be invoked, false otherwise*/ +} dcmdInfo; + +typedef struct { + const char* name; /* Option/Argument name*/ + const char* description; /* Short description */ + const char* type; /* Type: STRING, BOOLEAN, etc. */ + const char* default_string; /* Default value in a parsable string */ + jboolean mandatory; /* True if the option/argument is mandatory */ + jboolean option; /* True if it is an option, false if it is an argument */ + /* (see diagnosticFramework.hpp for option/argument definitions) */ + jboolean multiple; /* True is the option can be specified several time */ + int position; /* Expected position for this argument (this field is */ + /* meaningless for options) */ +} dcmdArgInfo; + +typedef struct jmmInterface_1_ { + void* reserved1; + void* reserved2; + + jint (JNICALL *GetVersion) (JNIEnv *env); + + jint (JNICALL *GetOptionalSupport) (JNIEnv *env, + jmmOptionalSupport* support_ptr); + + jint (JNICALL *GetThreadInfo) (JNIEnv *env, + jlongArray ids, + jint maxDepth, + jobjectArray infoArray); + + jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr); + + jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool); + + jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool); + jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool); + + void (JNICALL *GetThreadAllocatedMemory) + (JNIEnv *env, + jlongArray ids, + jlongArray sizeArray); + + jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap); + + jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att); + jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att); + jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag); + + jint (JNICALL *GetLongAttributes) (JNIEnv *env, + jobject obj, + jmmLongAttribute* atts, + jint count, + jlong* result); + + jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env); + + // Not used in JDK 6 or JDK 7 + jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id); + + jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env); + jint (JNICALL *GetVMGlobals) (JNIEnv *env, + jobjectArray names, + jmmVMGlobal *globals, + jint count); + + jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env, + jobjectArray names, + jlongArray times); + + jboolean (JNICALL *ResetStatistic) (JNIEnv *env, + jvalue obj, + jmmStatisticType type); + + void (JNICALL *SetPoolSensor) (JNIEnv *env, + jobject pool, + jmmThresholdType type, + jobject sensor); + + jlong (JNICALL *SetPoolThreshold) (JNIEnv *env, + jobject pool, + jmmThresholdType type, + jlong threshold); + jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool); + + jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env, + jobject mgr, + jmmExtAttributeInfo *ext_info, + jint count); + void (JNICALL *GetLastGCStat) (JNIEnv *env, + jobject mgr, + jmmGCStat *gc_stat); + + jlong (JNICALL *GetThreadCpuTimeWithKind) + (JNIEnv *env, + jlong thread_id, + jboolean user_sys_cpu_time); + void (JNICALL *GetThreadCpuTimesWithKind) + (JNIEnv *env, + jlongArray ids, + jlongArray timeArray, + jboolean user_sys_cpu_time); + + jint (JNICALL *DumpHeap0) (JNIEnv *env, + jstring outputfile, + jboolean live); + jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env, + jboolean object_monitors_only); + void (JNICALL *SetVMGlobal) (JNIEnv *env, + jstring flag_name, + jvalue new_value); + void* reserved6; + jobjectArray (JNICALL *DumpThreads) (JNIEnv *env, + jlongArray ids, + jboolean lockedMonitors, + jboolean lockedSynchronizers, + jint maxDepth); + void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env, + jobject mgr, + jboolean enabled); + jobjectArray (JNICALL *GetDiagnosticCommands) (JNIEnv *env); + void (JNICALL *GetDiagnosticCommandInfo) + (JNIEnv *env, + jobjectArray cmds, + dcmdInfo *infoArray); + void (JNICALL *GetDiagnosticCommandArgumentsInfo) + (JNIEnv *env, + jstring commandName, + dcmdArgInfo *infoArray); + jstring (JNICALL *ExecuteDiagnosticCommand) + (JNIEnv *env, + jstring command); + void (JNICALL *SetDiagnosticFrameworkNotificationEnabled) + (JNIEnv *env, + jboolean enabled); +} JmmInterface; + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* !_JAVA_JMM_H_ */ --- old/src/java.base/share/native/include/jvm.h 2017-12-04 21:40:19.660750835 +0100 +++ /dev/null 2017-11-09 09:28:37.261712036 +0100 @@ -1,1328 +0,0 @@ -/* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. 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. - */ - -#ifndef _JAVASOFT_JVM_H_ -#define _JAVASOFT_JVM_H_ - -#include - -#include "jni.h" -#include "jvm_md.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This file contains additional functions exported from the VM. - * These functions are complementary to the standard JNI support. - * There are three parts to this file: - * - * First, this file contains the VM-related functions needed by native - * libraries in the standard Java API. For example, the java.lang.Object - * class needs VM-level functions that wait for and notify monitors. - * - * Second, this file contains the functions and constant definitions - * needed by the byte code verifier and class file format checker. - * These functions allow the verifier and format checker to be written - * in a VM-independent way. - * - * Third, this file contains various I/O and network operations needed - * by the standard Java I/O and network APIs. - */ - -/* - * Bump the version number when either of the following happens: - * - * 1. There is a change in JVM_* functions. - * - * 2. There is a change in the contract between VM and Java classes. - * For example, if the VM relies on a new private field in Thread - * class. - */ - -#define JVM_INTERFACE_VERSION 5 - -JNIEXPORT jint JNICALL -JVM_GetInterfaceVersion(void); - -/************************************************************************* - PART 1: Functions for Native Libraries - ************************************************************************/ -/* - * java.lang.Object - */ -JNIEXPORT jint JNICALL -JVM_IHashCode(JNIEnv *env, jobject obj); - -JNIEXPORT void JNICALL -JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms); - -JNIEXPORT void JNICALL -JVM_MonitorNotify(JNIEnv *env, jobject obj); - -JNIEXPORT void JNICALL -JVM_MonitorNotifyAll(JNIEnv *env, jobject obj); - -JNIEXPORT jobject JNICALL -JVM_Clone(JNIEnv *env, jobject obj); - -/* - * java.lang.String - */ -JNIEXPORT jstring JNICALL -JVM_InternString(JNIEnv *env, jstring str); - -/* - * java.lang.System - */ -JNIEXPORT jlong JNICALL -JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); - -JNIEXPORT jlong JNICALL -JVM_NanoTime(JNIEnv *env, jclass ignored); - -JNIEXPORT jlong JNICALL -JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs); - -JNIEXPORT void JNICALL -JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, - jobject dst, jint dst_pos, jint length); - -JNIEXPORT jobject JNICALL -JVM_InitProperties(JNIEnv *env, jobject p); - - -/* - * java.lang.Runtime - */ -JNIEXPORT void JNICALL -JVM_Halt(jint code); - -JNIEXPORT void JNICALL -JVM_GC(void); - -/* Returns the number of real-time milliseconds that have elapsed since the - * least-recently-inspected heap object was last inspected by the garbage - * collector. - * - * For simple stop-the-world collectors this value is just the time - * since the most recent collection. For generational collectors it is the - * time since the oldest generation was most recently collected. Other - * collectors are free to return a pessimistic estimate of the elapsed time, or - * simply the time since the last full collection was performed. - * - * Note that in the presence of reference objects, a given object that is no - * longer strongly reachable may have to be inspected multiple times before it - * can be reclaimed. - */ -JNIEXPORT jlong JNICALL -JVM_MaxObjectInspectionAge(void); - -JNIEXPORT jlong JNICALL -JVM_TotalMemory(void); - -JNIEXPORT jlong JNICALL -JVM_FreeMemory(void); - -JNIEXPORT jlong JNICALL -JVM_MaxMemory(void); - -JNIEXPORT jint JNICALL -JVM_ActiveProcessorCount(void); - -JNIEXPORT void * JNICALL -JVM_LoadLibrary(const char *name); - -JNIEXPORT void JNICALL -JVM_UnloadLibrary(void * handle); - -JNIEXPORT void * JNICALL -JVM_FindLibraryEntry(void *handle, const char *name); - -JNIEXPORT jboolean JNICALL -JVM_IsSupportedJNIVersion(jint version); - -JNIEXPORT jobjectArray JNICALL -JVM_GetVmArguments(JNIEnv *env); - - -/* - * java.lang.Throwable - */ -JNIEXPORT void JNICALL -JVM_FillInStackTrace(JNIEnv *env, jobject throwable); - -/* - * java.lang.StackTraceElement - */ -JNIEXPORT void JNICALL -JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable); - -JNIEXPORT void JNICALL -JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo); - -/* - * java.lang.StackWalker - */ -enum { - JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2, - JVM_STACKWALK_GET_CALLER_CLASS = 0x04, - JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20, - JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100 -}; - -JNIEXPORT jobject JNICALL -JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode, - jint skip_frames, jint frame_count, jint start_index, - jobjectArray frames); - -JNIEXPORT jint JNICALL -JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor, - jint frame_count, jint start_index, - jobjectArray frames); - -/* - * java.lang.Thread - */ -JNIEXPORT void JNICALL -JVM_StartThread(JNIEnv *env, jobject thread); - -JNIEXPORT void JNICALL -JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); - -JNIEXPORT jboolean JNICALL -JVM_IsThreadAlive(JNIEnv *env, jobject thread); - -JNIEXPORT void JNICALL -JVM_SuspendThread(JNIEnv *env, jobject thread); - -JNIEXPORT void JNICALL -JVM_ResumeThread(JNIEnv *env, jobject thread); - -JNIEXPORT void JNICALL -JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); - -JNIEXPORT void JNICALL -JVM_Yield(JNIEnv *env, jclass threadClass); - -JNIEXPORT void JNICALL -JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis); - -JNIEXPORT jobject JNICALL -JVM_CurrentThread(JNIEnv *env, jclass threadClass); - -JNIEXPORT jint JNICALL -JVM_CountStackFrames(JNIEnv *env, jobject thread); - -JNIEXPORT void JNICALL -JVM_Interrupt(JNIEnv *env, jobject thread); - -JNIEXPORT jboolean JNICALL -JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted); - -JNIEXPORT jboolean JNICALL -JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj); - -JNIEXPORT void JNICALL -JVM_DumpAllStacks(JNIEnv *env, jclass unused); - -JNIEXPORT jobjectArray JNICALL -JVM_GetAllThreads(JNIEnv *env, jclass dummy); - -JNIEXPORT void JNICALL -JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name); - -/* getStackTrace() and getAllStackTraces() method */ -JNIEXPORT jobjectArray JNICALL -JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads); - -/* - * java.lang.SecurityManager - */ -JNIEXPORT jobjectArray JNICALL -JVM_GetClassContext(JNIEnv *env); - -/* - * java.lang.Package - */ -JNIEXPORT jstring JNICALL -JVM_GetSystemPackage(JNIEnv *env, jstring name); - -JNIEXPORT jobjectArray JNICALL -JVM_GetSystemPackages(JNIEnv *env); - -/* - * java.lang.ref.Reference - */ -JNIEXPORT jobject JNICALL -JVM_GetAndClearReferencePendingList(JNIEnv *env); - -JNIEXPORT jboolean JNICALL -JVM_HasReferencePendingList(JNIEnv *env); - -JNIEXPORT void JNICALL -JVM_WaitForReferencePendingList(JNIEnv *env); - -/* - * java.io.ObjectInputStream - */ -JNIEXPORT jobject JNICALL -JVM_LatestUserDefinedLoader(JNIEnv *env); - -/* - * java.lang.reflect.Array - */ -JNIEXPORT jint JNICALL -JVM_GetArrayLength(JNIEnv *env, jobject arr); - -JNIEXPORT jobject JNICALL -JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); - -JNIEXPORT jvalue JNICALL -JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); - -JNIEXPORT void JNICALL -JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); - -JNIEXPORT void JNICALL -JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, - unsigned char vCode); - -JNIEXPORT jobject JNICALL -JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); - -JNIEXPORT jobject JNICALL -JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); - -/* - * java.lang.Class and java.lang.ClassLoader - */ - -#define JVM_CALLER_DEPTH -1 - -/* - * Returns the immediate caller class of the native method invoking - * JVM_GetCallerClass. The Method.invoke and other frames due to - * reflection machinery are skipped. - * - * The depth parameter must be -1 (JVM_DEPTH). The caller is expected - * to be marked with sun.reflect.CallerSensitive. The JVM will throw - * an error if it is not marked propertly. - */ -JNIEXPORT jclass JNICALL -JVM_GetCallerClass(JNIEnv *env, int depth); - - -/* - * Find primitive classes - * utf: class name - */ -JNIEXPORT jclass JNICALL -JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); - - -/* - * Find a class from a boot class loader. Returns NULL if class not found. - */ -JNIEXPORT jclass JNICALL -JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); - -/* - * Find a class from a given class loader. Throws ClassNotFoundException. - * name: name of class - * init: whether initialization is done - * loader: class loader to look up the class. This may not be the same as the caller's - * class loader. - * caller: initiating class. The initiating class may be null when a security - * manager is not installed. - */ -JNIEXPORT jclass JNICALL -JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init, - jobject loader, jclass caller); - -/* - * Find a class from a given class. - */ -JNIEXPORT jclass JNICALL -JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, - jclass from); - -/* Find a loaded class cached by the VM */ -JNIEXPORT jclass JNICALL -JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name); - -/* Define a class */ -JNIEXPORT jclass JNICALL -JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, - jsize len, jobject pd); - -/* Define a class with a source (added in JDK1.5) */ -JNIEXPORT jclass JNICALL -JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, - const jbyte *buf, jsize len, jobject pd, - const char *source); - -/* - * Module support funcions - */ - -/* - * Define a module with the specified packages and bind the module to the - * given class loader. - * module: module to define - * is_open: specifies if module is open (currently ignored) - * version: the module version - * location: the module location - * packages: list of packages in the module - * num_packages: number of packages in the module - */ -JNIEXPORT void JNICALL -JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version, - jstring location, const char* const* packages, jsize num_packages); - -/* - * Set the boot loader's unnamed module. - * module: boot loader's unnamed module - */ -JNIEXPORT void JNICALL -JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module); - -/* - * Do a qualified export of a package. - * from_module: module containing the package to export - * package: name of the package to export - * to_module: module to export the package to - */ -JNIEXPORT void JNICALL -JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module); - -/* - * Do an export of a package to all unnamed modules. - * from_module: module containing the package to export - * package: name of the package to export to all unnamed modules - */ -JNIEXPORT void JNICALL -JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package); - -/* - * Do an unqualified export of a package. - * from_module: module containing the package to export - * package: name of the package to export - */ -JNIEXPORT void JNICALL -JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package); - -/* - * Add a module to the list of modules that a given module can read. - * from_module: module requesting read access - * source_module: module that from_module wants to read - */ -JNIEXPORT void JNICALL -JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module); - -/* - * Reflection support functions - */ - -JNIEXPORT jstring JNICALL -JVM_GetClassName(JNIEnv *env, jclass cls); - -JNIEXPORT jobjectArray JNICALL -JVM_GetClassInterfaces(JNIEnv *env, jclass cls); - -JNIEXPORT jboolean JNICALL -JVM_IsInterface(JNIEnv *env, jclass cls); - -JNIEXPORT jobjectArray JNICALL -JVM_GetClassSigners(JNIEnv *env, jclass cls); - -JNIEXPORT void JNICALL -JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers); - -JNIEXPORT jobject JNICALL -JVM_GetProtectionDomain(JNIEnv *env, jclass cls); - -JNIEXPORT jboolean JNICALL -JVM_IsArrayClass(JNIEnv *env, jclass cls); - -JNIEXPORT jboolean JNICALL -JVM_IsPrimitiveClass(JNIEnv *env, jclass cls); - -JNIEXPORT jint JNICALL -JVM_GetClassModifiers(JNIEnv *env, jclass cls); - -JNIEXPORT jobjectArray JNICALL -JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); - -JNIEXPORT jclass JNICALL -JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); - -JNIEXPORT jstring JNICALL -JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass); - -/* Generics support (JDK 1.5) */ -JNIEXPORT jstring JNICALL -JVM_GetClassSignature(JNIEnv *env, jclass cls); - -/* Annotations support (JDK 1.5) */ -JNIEXPORT jbyteArray JNICALL -JVM_GetClassAnnotations(JNIEnv *env, jclass cls); - -/* Type use annotations support (JDK 1.8) */ - -JNIEXPORT jbyteArray JNICALL -JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); - -JNIEXPORT jbyteArray JNICALL -JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); - -JNIEXPORT jbyteArray JNICALL -JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); - -/* - * New (JDK 1.4) reflection implementation - */ - -JNIEXPORT jobjectArray JNICALL -JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly); - -JNIEXPORT jobjectArray JNICALL -JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly); - -JNIEXPORT jobjectArray JNICALL -JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly); - -/* Differs from JVM_GetClassModifiers in treatment of inner classes. - This returns the access flags for the class as specified in the - class file rather than searching the InnerClasses attribute (if - present) to find the source-level access flags. Only the values of - the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be - valid. */ -JNIEXPORT jint JNICALL -JVM_GetClassAccessFlags(JNIEnv *env, jclass cls); - -/* The following two reflection routines are still needed due to startup time issues */ -/* - * java.lang.reflect.Method - */ -JNIEXPORT jobject JNICALL -JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0); - -/* - * java.lang.reflect.Constructor - */ -JNIEXPORT jobject JNICALL -JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0); - -/* - * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5) - */ - -JNIEXPORT jobject JNICALL -JVM_GetClassConstantPool(JNIEnv *env, jclass cls); - -JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize -(JNIEnv *env, jobject unused, jobject jcpool); - -JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt -(JNIEnv *env, jobject obj, jobject unused, jint index); - -JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt -(JNIEnv *env, jobject obj, jobject unused, jint index); - -JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt -(JNIEnv *env, jobject obj, jobject unused, jint index); - -JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt -(JNIEnv *env, jobject unused, jobject jcpool, jint index); - -/* - * Parameter reflection - */ - -JNIEXPORT jobjectArray JNICALL -JVM_GetMethodParameters(JNIEnv *env, jobject method); - -/* - * java.security.* - */ - -JNIEXPORT jobject JNICALL -JVM_DoPrivileged(JNIEnv *env, jclass cls, - jobject action, jobject context, jboolean wrapException); - -JNIEXPORT jobject JNICALL -JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls); - -JNIEXPORT jobject JNICALL -JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls); - -/* - * Signal support, used to implement the shutdown sequence. Every VM must - * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts - * (^C) and the latter for external termination (kill, system shutdown, etc.). - * Other platform-dependent signal values may also be supported. - */ - -JNIEXPORT void * JNICALL -JVM_RegisterSignal(jint sig, void *handler); - -JNIEXPORT jboolean JNICALL -JVM_RaiseSignal(jint sig); - -JNIEXPORT jint JNICALL -JVM_FindSignal(const char *name); - -/* - * Retrieve the assertion directives for the specified class. - */ -JNIEXPORT jboolean JNICALL -JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls); - -/* - * Retrieve the assertion directives from the VM. - */ -JNIEXPORT jobject JNICALL -JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused); - -/* - * java.util.concurrent.atomic.AtomicLong - */ -JNIEXPORT jboolean JNICALL -JVM_SupportsCX8(void); - -/* - * com.sun.dtrace.jsdt support - */ - -#define JVM_TRACING_DTRACE_VERSION 1 - -/* - * Structure to pass one probe description to JVM - */ -typedef struct { - jmethodID method; - jstring function; - jstring name; - void* reserved[4]; // for future use -} JVM_DTraceProbe; - -/** - * Encapsulates the stability ratings for a DTrace provider field - */ -typedef struct { - jint nameStability; - jint dataStability; - jint dependencyClass; -} JVM_DTraceInterfaceAttributes; - -/* - * Structure to pass one provider description to JVM - */ -typedef struct { - jstring name; - JVM_DTraceProbe* probes; - jint probe_count; - JVM_DTraceInterfaceAttributes providerAttributes; - JVM_DTraceInterfaceAttributes moduleAttributes; - JVM_DTraceInterfaceAttributes functionAttributes; - JVM_DTraceInterfaceAttributes nameAttributes; - JVM_DTraceInterfaceAttributes argsAttributes; - void* reserved[4]; // for future use -} JVM_DTraceProvider; - -/* - * Get the version number the JVM was built with - */ -JNIEXPORT jint JNICALL -JVM_DTraceGetVersion(JNIEnv* env); - -/* - * Register new probe with given signature, return global handle - * - * The version passed in is the version that the library code was - * built with. - */ -JNIEXPORT jlong JNICALL -JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name, - jint providers_count, JVM_DTraceProvider* providers); - -/* - * Check JSDT probe - */ -JNIEXPORT jboolean JNICALL -JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method); - -/* - * Destroy custom DOF - */ -JNIEXPORT void JNICALL -JVM_DTraceDispose(JNIEnv* env, jlong activation_handle); - -/* - * Check to see if DTrace is supported by OS - */ -JNIEXPORT jboolean JNICALL -JVM_DTraceIsSupported(JNIEnv* env); - -/************************************************************************* - PART 2: Support for the Verifier and Class File Format Checker - ************************************************************************/ -/* - * Return the class name in UTF format. The result is valid - * until JVM_ReleaseUTf is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetClassNameUTF(JNIEnv *env, jclass cb); - -/* - * Returns the constant pool types in the buffer provided by "types." - */ -JNIEXPORT void JNICALL -JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types); - -/* - * Returns the number of Constant Pool entries. - */ -JNIEXPORT jint JNICALL -JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb); - -/* - * Returns the number of *declared* fields or methods. - */ -JNIEXPORT jint JNICALL -JVM_GetClassFieldsCount(JNIEnv *env, jclass cb); - -JNIEXPORT jint JNICALL -JVM_GetClassMethodsCount(JNIEnv *env, jclass cb); - -/* - * Returns the CP indexes of exceptions raised by a given method. - * Places the result in the given buffer. - * - * The method is identified by method_index. - */ -JNIEXPORT void JNICALL -JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index, - unsigned short *exceptions); -/* - * Returns the number of exceptions raised by a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index); - -/* - * Returns the byte code sequence of a given method. - * Places the result in the given buffer. - * - * The method is identified by method_index. - */ -JNIEXPORT void JNICALL -JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index, - unsigned char *code); - -/* - * Returns the length of the byte code sequence of a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index); - -/* - * A structure used to a capture exception table entry in a Java method. - */ -typedef struct { - jint start_pc; - jint end_pc; - jint handler_pc; - jint catchType; -} JVM_ExceptionTableEntryType; - -/* - * Returns the exception table entry at entry_index of a given method. - * Places the result in the given buffer. - * - * The method is identified by method_index. - */ -JNIEXPORT void JNICALL -JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index, - jint entry_index, - JVM_ExceptionTableEntryType *entry); - -/* - * Returns the length of the exception table of a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index); - -/* - * Returns the modifiers of a given field. - * The field is identified by field_index. - */ -JNIEXPORT jint JNICALL -JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index); - -/* - * Returns the modifiers of a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index); - -/* - * Returns the number of local variables of a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index); - -/* - * Returns the number of arguments (including this pointer) of a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index); - -/* - * Returns the maximum amount of stack (in words) used by a given method. - * The method is identified by method_index. - */ -JNIEXPORT jint JNICALL -JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index); - -/* - * Is a given method a constructor. - * The method is identified by method_index. - */ -JNIEXPORT jboolean JNICALL -JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index); - -/* - * Is the given method generated by the VM. - * The method is identified by method_index. - */ -JNIEXPORT jboolean JNICALL -JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index); - -/* - * Returns the name of a given method in UTF format. - * The result remains valid until JVM_ReleaseUTF is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the signature of a given method in UTF format. - * The result remains valid until JVM_ReleaseUTF is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the name of the field referred to at a given constant pool - * index. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the name of the method referred to at a given constant pool - * index. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the signature of the method referred to at a given constant pool - * index. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the signature of the field referred to at a given constant pool - * index. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the class name referred to at a given constant pool index. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the class name referred to at a given constant pool index. - * - * The constant pool entry must refer to a CONSTANT_Fieldref. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the class name referred to at a given constant pool index. - * - * The constant pool entry must refer to CONSTANT_Methodref or - * CONSTANT_InterfaceMethodref. - * - * The result is in UTF format and remains valid until JVM_ReleaseUTF - * is called. - * - * The caller must treat the string as a constant and not modify it - * in any way. - */ -JNIEXPORT const char * JNICALL -JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index); - -/* - * Returns the modifiers of a field in calledClass. The field is - * referred to in class cb at constant pool entry index. - * - * The caller must treat the string as a constant and not modify it - * in any way. - * - * Returns -1 if the field does not exist in calledClass. - */ -JNIEXPORT jint JNICALL -JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); - -/* - * Returns the modifiers of a method in calledClass. The method is - * referred to in class cb at constant pool entry index. - * - * Returns -1 if the method does not exist in calledClass. - */ -JNIEXPORT jint JNICALL -JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); - -/* - * Releases the UTF string obtained from the VM. - */ -JNIEXPORT void JNICALL -JVM_ReleaseUTF(const char *utf); - -/* - * Compare if two classes are in the same package. - */ -JNIEXPORT jboolean JNICALL -JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2); - -/* Get classfile constants */ -#include "classfile_constants.h" - -/* - * A function defined by the byte-code verifier and called by the VM. - * This is not a function implemented in the VM. - * - * Returns JNI_FALSE if verification fails. A detailed error message - * will be places in msg_buf, whose length is specified by buf_len. - */ -typedef jboolean (*verifier_fn_t)(JNIEnv *env, - jclass cb, - char * msg_buf, - jint buf_len); - - -/* - * Support for a VM-independent class format checker. - */ -typedef struct { - unsigned long code; /* byte code */ - unsigned long excs; /* exceptions */ - unsigned long etab; /* catch table */ - unsigned long lnum; /* line number */ - unsigned long lvar; /* local vars */ -} method_size_info; - -typedef struct { - unsigned int constants; /* constant pool */ - unsigned int fields; - unsigned int methods; - unsigned int interfaces; - unsigned int fields2; /* number of static 2-word fields */ - unsigned int innerclasses; /* # of records in InnerClasses attr */ - - method_size_info clinit; /* memory used in clinit */ - method_size_info main; /* used everywhere else */ -} class_size_info; - -/* - * Functions defined in libjava.so to perform string conversions. - * - */ - -typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str); - -typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b); - -/* This is the function defined in libjava.so that performs class - * format checks. This functions fills in size information about - * the class file and returns: - * - * 0: good - * -1: out of memory - * -2: bad format - * -3: unsupported version - * -4: bad class name - */ - -typedef jint (*check_format_fn_t)(char *class_name, - unsigned char *data, - unsigned int data_size, - class_size_info *class_size, - char *message_buffer, - jint buffer_length, - jboolean measure_only, - jboolean check_relaxed); - -#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ - JVM_ACC_FINAL | \ - JVM_ACC_SUPER | \ - JVM_ACC_INTERFACE | \ - JVM_ACC_ABSTRACT | \ - JVM_ACC_ANNOTATION | \ - JVM_ACC_ENUM | \ - JVM_ACC_SYNTHETIC) - -#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ - JVM_ACC_PRIVATE | \ - JVM_ACC_PROTECTED | \ - JVM_ACC_STATIC | \ - JVM_ACC_FINAL | \ - JVM_ACC_VOLATILE | \ - JVM_ACC_TRANSIENT | \ - JVM_ACC_ENUM | \ - JVM_ACC_SYNTHETIC) - -#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ - JVM_ACC_PRIVATE | \ - JVM_ACC_PROTECTED | \ - JVM_ACC_STATIC | \ - JVM_ACC_FINAL | \ - JVM_ACC_SYNCHRONIZED | \ - JVM_ACC_BRIDGE | \ - JVM_ACC_VARARGS | \ - JVM_ACC_NATIVE | \ - JVM_ACC_ABSTRACT | \ - JVM_ACC_STRICT | \ - JVM_ACC_SYNTHETIC) - -/* - * This is the function defined in libjava.so to perform path - * canonicalization. VM call this function before opening jar files - * to load system classes. - * - */ - -typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); - -/************************************************************************* - PART 3: I/O and Network Support - ************************************************************************/ - -/* - * Convert a pathname into native format. This function does syntactic - * cleanup, such as removing redundant separator characters. It modifies - * the given pathname string in place. - */ -JNIEXPORT char * JNICALL -JVM_NativePath(char *); - -/* - * The standard printing functions supported by the Java VM. (Should they - * be renamed to JVM_* in the future? - */ - -/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3), - * respectively, with the following differences: - * - The string written to str is always zero-terminated, also in case of - * truncation (count is too small to hold the result string), unless count - * is 0. In case of truncation count-1 characters are written and '\0' - * appendend. - * - If count is too small to hold the whole string, -1 is returned across - * all platforms. */ - -JNIEXPORT int -jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); - -JNIEXPORT int -jio_snprintf(char *str, size_t count, const char *fmt, ...); - -JNIEXPORT int -jio_fprintf(FILE *, const char *fmt, ...); - -JNIEXPORT int -jio_vfprintf(FILE *, const char *fmt, va_list args); - - -JNIEXPORT void * JNICALL -JVM_RawMonitorCreate(void); - -JNIEXPORT void JNICALL -JVM_RawMonitorDestroy(void *mon); - -JNIEXPORT jint JNICALL -JVM_RawMonitorEnter(void *mon); - -JNIEXPORT void JNICALL -JVM_RawMonitorExit(void *mon); - -/* - * java.lang.management support - */ -JNIEXPORT void* JNICALL -JVM_GetManagement(jint version); - -/* - * com.sun.tools.attach.VirtualMachine support - * - * Initialize the agent properties with the properties maintained in the VM. - */ -JNIEXPORT jobject JNICALL -JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); - -JNIEXPORT jstring JNICALL -JVM_GetTemporaryDirectory(JNIEnv *env); - -/* Generics reflection support. - * - * Returns information about the given class's EnclosingMethod - * attribute, if present, or null if the class had no enclosing - * method. - * - * If non-null, the returned array contains three elements. Element 0 - * is the java.lang.Class of which the enclosing method is a member, - * and elements 1 and 2 are the java.lang.Strings for the enclosing - * method's name and descriptor, respectively. - */ -JNIEXPORT jobjectArray JNICALL -JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); - -/* ========================================================================= - * The following defines a private JVM interface that the JDK can query - * for the JVM version and capabilities. sun.misc.Version defines - * the methods for getting the VM version and its capabilities. - * - * When a new bit is added, the following should be updated to provide - * access to the new capability: - * HS: JVM_GetVersionInfo and Abstract_VM_Version class - * SDK: Version class - * - * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for - * JVM to query for the JDK version and capabilities. - * - * When a new bit is added, the following should be updated to provide - * access to the new capability: - * HS: JDK_Version class - * SDK: JDK_GetVersionInfo0 - * - * ========================================================================== - */ -typedef struct { - unsigned int jvm_version; /* Encoded $VNUM as specified by JEP-223 */ - unsigned int patch_version : 8; /* JEP-223 patch version */ - unsigned int reserved3 : 8; - unsigned int reserved1 : 16; - unsigned int reserved2; - - /* The following bits represents JVM supports that JDK has dependency on. - * JDK can use these bits to determine which JVM version - * and support it has to maintain runtime compatibility. - * - * When a new bit is added in a minor or update release, make sure - * the new bit is also added in the main/baseline. - */ - unsigned int is_attach_supported : 1; - unsigned int : 31; - unsigned int : 32; - unsigned int : 32; -} jvm_version_info; - -#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) -#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) -#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8) -#define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) - -JNIEXPORT void JNICALL -JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size); - -typedef struct { - unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */ - unsigned int patch_version : 8; /* JEP-223 patch version */ - unsigned int reserved3 : 8; - unsigned int reserved1 : 16; - unsigned int reserved2; - - /* The following bits represents new JDK supports that VM has dependency on. - * VM implementation can use these bits to determine which JDK version - * and support it has to maintain runtime compatibility. - * - * When a new bit is added in a minor or update release, make sure - * the new bit is also added in the main/baseline. - */ - unsigned int thread_park_blocker : 1; - unsigned int post_vm_init_hook_enabled : 1; - unsigned int pending_list_uses_discovered_field : 1; - unsigned int : 29; - unsigned int : 32; - unsigned int : 32; -} jdk_version_info; - -#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) -#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) -#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8) -#define JDK_VERSION_BUILD(version) ((version & 0x000000FF)) - -/* - * This is the function JDK_GetVersionInfo0 defined in libjava.so - * that is dynamically looked up by JVM. - */ -typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size); - -/* - * This structure is used by the launcher to get the default thread - * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a - * version of 1.1. As it is not supported otherwise, it has been removed - * from jni.h - */ -typedef struct JDK1_1InitArgs { - jint version; - - char **properties; - jint checkSource; - jint nativeStackSize; - jint javaStackSize; - jint minHeapSize; - jint maxHeapSize; - jint verifyMode; - char *classpath; - - jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); - void (JNICALL *exit)(jint code); - void (JNICALL *abort)(void); - - jint enableClassGC; - jint enableVerboseGC; - jint disableAsyncGC; - jint verbose; - jboolean debugging; - jint debugPort; -} JDK1_1InitArgs; - - -#ifdef __cplusplus -} /* extern "C" */ - -#endif /* __cplusplus */ - -#endif /* !_JAVASOFT_JVM_H_ */ --- /dev/null 2017-11-09 09:28:37.261712036 +0100 +++ new/src/hotspot/share/include/jvm.h 2017-12-04 21:40:19.276750829 +0100 @@ -0,0 +1,1328 @@ +/* + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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. + */ + +#ifndef _JAVASOFT_JVM_H_ +#define _JAVASOFT_JVM_H_ + +#include + +#include "jni.h" +#include "jvm_md.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file contains additional functions exported from the VM. + * These functions are complementary to the standard JNI support. + * There are three parts to this file: + * + * First, this file contains the VM-related functions needed by native + * libraries in the standard Java API. For example, the java.lang.Object + * class needs VM-level functions that wait for and notify monitors. + * + * Second, this file contains the functions and constant definitions + * needed by the byte code verifier and class file format checker. + * These functions allow the verifier and format checker to be written + * in a VM-independent way. + * + * Third, this file contains various I/O and network operations needed + * by the standard Java I/O and network APIs. + */ + +/* + * Bump the version number when either of the following happens: + * + * 1. There is a change in JVM_* functions. + * + * 2. There is a change in the contract between VM and Java classes. + * For example, if the VM relies on a new private field in Thread + * class. + */ + +#define JVM_INTERFACE_VERSION 5 + +JNIEXPORT jint JNICALL +JVM_GetInterfaceVersion(void); + +/************************************************************************* + PART 1: Functions for Native Libraries + ************************************************************************/ +/* + * java.lang.Object + */ +JNIEXPORT jint JNICALL +JVM_IHashCode(JNIEnv *env, jobject obj); + +JNIEXPORT void JNICALL +JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms); + +JNIEXPORT void JNICALL +JVM_MonitorNotify(JNIEnv *env, jobject obj); + +JNIEXPORT void JNICALL +JVM_MonitorNotifyAll(JNIEnv *env, jobject obj); + +JNIEXPORT jobject JNICALL +JVM_Clone(JNIEnv *env, jobject obj); + +/* + * java.lang.String + */ +JNIEXPORT jstring JNICALL +JVM_InternString(JNIEnv *env, jstring str); + +/* + * java.lang.System + */ +JNIEXPORT jlong JNICALL +JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); + +JNIEXPORT jlong JNICALL +JVM_NanoTime(JNIEnv *env, jclass ignored); + +JNIEXPORT jlong JNICALL +JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs); + +JNIEXPORT void JNICALL +JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, + jobject dst, jint dst_pos, jint length); + +JNIEXPORT jobject JNICALL +JVM_InitProperties(JNIEnv *env, jobject p); + + +/* + * java.lang.Runtime + */ +JNIEXPORT void JNICALL +JVM_Halt(jint code); + +JNIEXPORT void JNICALL +JVM_GC(void); + +/* Returns the number of real-time milliseconds that have elapsed since the + * least-recently-inspected heap object was last inspected by the garbage + * collector. + * + * For simple stop-the-world collectors this value is just the time + * since the most recent collection. For generational collectors it is the + * time since the oldest generation was most recently collected. Other + * collectors are free to return a pessimistic estimate of the elapsed time, or + * simply the time since the last full collection was performed. + * + * Note that in the presence of reference objects, a given object that is no + * longer strongly reachable may have to be inspected multiple times before it + * can be reclaimed. + */ +JNIEXPORT jlong JNICALL +JVM_MaxObjectInspectionAge(void); + +JNIEXPORT jlong JNICALL +JVM_TotalMemory(void); + +JNIEXPORT jlong JNICALL +JVM_FreeMemory(void); + +JNIEXPORT jlong JNICALL +JVM_MaxMemory(void); + +JNIEXPORT jint JNICALL +JVM_ActiveProcessorCount(void); + +JNIEXPORT void * JNICALL +JVM_LoadLibrary(const char *name); + +JNIEXPORT void JNICALL +JVM_UnloadLibrary(void * handle); + +JNIEXPORT void * JNICALL +JVM_FindLibraryEntry(void *handle, const char *name); + +JNIEXPORT jboolean JNICALL +JVM_IsSupportedJNIVersion(jint version); + +JNIEXPORT jobjectArray JNICALL +JVM_GetVmArguments(JNIEnv *env); + + +/* + * java.lang.Throwable + */ +JNIEXPORT void JNICALL +JVM_FillInStackTrace(JNIEnv *env, jobject throwable); + +/* + * java.lang.StackTraceElement + */ +JNIEXPORT void JNICALL +JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable); + +JNIEXPORT void JNICALL +JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo); + +/* + * java.lang.StackWalker + */ +enum { + JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2, + JVM_STACKWALK_GET_CALLER_CLASS = 0x04, + JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20, + JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100 +}; + +JNIEXPORT jobject JNICALL +JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode, + jint skip_frames, jint frame_count, jint start_index, + jobjectArray frames); + +JNIEXPORT jint JNICALL +JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor, + jint frame_count, jint start_index, + jobjectArray frames); + +/* + * java.lang.Thread + */ +JNIEXPORT void JNICALL +JVM_StartThread(JNIEnv *env, jobject thread); + +JNIEXPORT void JNICALL +JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); + +JNIEXPORT jboolean JNICALL +JVM_IsThreadAlive(JNIEnv *env, jobject thread); + +JNIEXPORT void JNICALL +JVM_SuspendThread(JNIEnv *env, jobject thread); + +JNIEXPORT void JNICALL +JVM_ResumeThread(JNIEnv *env, jobject thread); + +JNIEXPORT void JNICALL +JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); + +JNIEXPORT void JNICALL +JVM_Yield(JNIEnv *env, jclass threadClass); + +JNIEXPORT void JNICALL +JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis); + +JNIEXPORT jobject JNICALL +JVM_CurrentThread(JNIEnv *env, jclass threadClass); + +JNIEXPORT jint JNICALL +JVM_CountStackFrames(JNIEnv *env, jobject thread); + +JNIEXPORT void JNICALL +JVM_Interrupt(JNIEnv *env, jobject thread); + +JNIEXPORT jboolean JNICALL +JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted); + +JNIEXPORT jboolean JNICALL +JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj); + +JNIEXPORT void JNICALL +JVM_DumpAllStacks(JNIEnv *env, jclass unused); + +JNIEXPORT jobjectArray JNICALL +JVM_GetAllThreads(JNIEnv *env, jclass dummy); + +JNIEXPORT void JNICALL +JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name); + +/* getStackTrace() and getAllStackTraces() method */ +JNIEXPORT jobjectArray JNICALL +JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads); + +/* + * java.lang.SecurityManager + */ +JNIEXPORT jobjectArray JNICALL +JVM_GetClassContext(JNIEnv *env); + +/* + * java.lang.Package + */ +JNIEXPORT jstring JNICALL +JVM_GetSystemPackage(JNIEnv *env, jstring name); + +JNIEXPORT jobjectArray JNICALL +JVM_GetSystemPackages(JNIEnv *env); + +/* + * java.lang.ref.Reference + */ +JNIEXPORT jobject JNICALL +JVM_GetAndClearReferencePendingList(JNIEnv *env); + +JNIEXPORT jboolean JNICALL +JVM_HasReferencePendingList(JNIEnv *env); + +JNIEXPORT void JNICALL +JVM_WaitForReferencePendingList(JNIEnv *env); + +/* + * java.io.ObjectInputStream + */ +JNIEXPORT jobject JNICALL +JVM_LatestUserDefinedLoader(JNIEnv *env); + +/* + * java.lang.reflect.Array + */ +JNIEXPORT jint JNICALL +JVM_GetArrayLength(JNIEnv *env, jobject arr); + +JNIEXPORT jobject JNICALL +JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); + +JNIEXPORT jvalue JNICALL +JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); + +JNIEXPORT void JNICALL +JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); + +JNIEXPORT void JNICALL +JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, + unsigned char vCode); + +JNIEXPORT jobject JNICALL +JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); + +JNIEXPORT jobject JNICALL +JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); + +/* + * java.lang.Class and java.lang.ClassLoader + */ + +#define JVM_CALLER_DEPTH -1 + +/* + * Returns the immediate caller class of the native method invoking + * JVM_GetCallerClass. The Method.invoke and other frames due to + * reflection machinery are skipped. + * + * The depth parameter must be -1 (JVM_DEPTH). The caller is expected + * to be marked with sun.reflect.CallerSensitive. The JVM will throw + * an error if it is not marked propertly. + */ +JNIEXPORT jclass JNICALL +JVM_GetCallerClass(JNIEnv *env, int depth); + + +/* + * Find primitive classes + * utf: class name + */ +JNIEXPORT jclass JNICALL +JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); + + +/* + * Find a class from a boot class loader. Returns NULL if class not found. + */ +JNIEXPORT jclass JNICALL +JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); + +/* + * Find a class from a given class loader. Throws ClassNotFoundException. + * name: name of class + * init: whether initialization is done + * loader: class loader to look up the class. This may not be the same as the caller's + * class loader. + * caller: initiating class. The initiating class may be null when a security + * manager is not installed. + */ +JNIEXPORT jclass JNICALL +JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init, + jobject loader, jclass caller); + +/* + * Find a class from a given class. + */ +JNIEXPORT jclass JNICALL +JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, + jclass from); + +/* Find a loaded class cached by the VM */ +JNIEXPORT jclass JNICALL +JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name); + +/* Define a class */ +JNIEXPORT jclass JNICALL +JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, + jsize len, jobject pd); + +/* Define a class with a source (added in JDK1.5) */ +JNIEXPORT jclass JNICALL +JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, + const jbyte *buf, jsize len, jobject pd, + const char *source); + +/* + * Module support funcions + */ + +/* + * Define a module with the specified packages and bind the module to the + * given class loader. + * module: module to define + * is_open: specifies if module is open (currently ignored) + * version: the module version + * location: the module location + * packages: list of packages in the module + * num_packages: number of packages in the module + */ +JNIEXPORT void JNICALL +JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version, + jstring location, const char* const* packages, jsize num_packages); + +/* + * Set the boot loader's unnamed module. + * module: boot loader's unnamed module + */ +JNIEXPORT void JNICALL +JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module); + +/* + * Do a qualified export of a package. + * from_module: module containing the package to export + * package: name of the package to export + * to_module: module to export the package to + */ +JNIEXPORT void JNICALL +JVM_AddModuleExports(JNIEnv *env, jobject from_module, const char* package, jobject to_module); + +/* + * Do an export of a package to all unnamed modules. + * from_module: module containing the package to export + * package: name of the package to export to all unnamed modules + */ +JNIEXPORT void JNICALL +JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, const char* package); + +/* + * Do an unqualified export of a package. + * from_module: module containing the package to export + * package: name of the package to export + */ +JNIEXPORT void JNICALL +JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, const char* package); + +/* + * Add a module to the list of modules that a given module can read. + * from_module: module requesting read access + * source_module: module that from_module wants to read + */ +JNIEXPORT void JNICALL +JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module); + +/* + * Reflection support functions + */ + +JNIEXPORT jstring JNICALL +JVM_GetClassName(JNIEnv *env, jclass cls); + +JNIEXPORT jobjectArray JNICALL +JVM_GetClassInterfaces(JNIEnv *env, jclass cls); + +JNIEXPORT jboolean JNICALL +JVM_IsInterface(JNIEnv *env, jclass cls); + +JNIEXPORT jobjectArray JNICALL +JVM_GetClassSigners(JNIEnv *env, jclass cls); + +JNIEXPORT void JNICALL +JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers); + +JNIEXPORT jobject JNICALL +JVM_GetProtectionDomain(JNIEnv *env, jclass cls); + +JNIEXPORT jboolean JNICALL +JVM_IsArrayClass(JNIEnv *env, jclass cls); + +JNIEXPORT jboolean JNICALL +JVM_IsPrimitiveClass(JNIEnv *env, jclass cls); + +JNIEXPORT jint JNICALL +JVM_GetClassModifiers(JNIEnv *env, jclass cls); + +JNIEXPORT jobjectArray JNICALL +JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); + +JNIEXPORT jclass JNICALL +JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); + +JNIEXPORT jstring JNICALL +JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass); + +/* Generics support (JDK 1.5) */ +JNIEXPORT jstring JNICALL +JVM_GetClassSignature(JNIEnv *env, jclass cls); + +/* Annotations support (JDK 1.5) */ +JNIEXPORT jbyteArray JNICALL +JVM_GetClassAnnotations(JNIEnv *env, jclass cls); + +/* Type use annotations support (JDK 1.8) */ + +JNIEXPORT jbyteArray JNICALL +JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); + +JNIEXPORT jbyteArray JNICALL +JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); + +JNIEXPORT jbyteArray JNICALL +JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); + +/* + * New (JDK 1.4) reflection implementation + */ + +JNIEXPORT jobjectArray JNICALL +JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly); + +JNIEXPORT jobjectArray JNICALL +JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly); + +JNIEXPORT jobjectArray JNICALL +JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly); + +/* Differs from JVM_GetClassModifiers in treatment of inner classes. + This returns the access flags for the class as specified in the + class file rather than searching the InnerClasses attribute (if + present) to find the source-level access flags. Only the values of + the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be + valid. */ +JNIEXPORT jint JNICALL +JVM_GetClassAccessFlags(JNIEnv *env, jclass cls); + +/* The following two reflection routines are still needed due to startup time issues */ +/* + * java.lang.reflect.Method + */ +JNIEXPORT jobject JNICALL +JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0); + +/* + * java.lang.reflect.Constructor + */ +JNIEXPORT jobject JNICALL +JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0); + +/* + * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5) + */ + +JNIEXPORT jobject JNICALL +JVM_GetClassConstantPool(JNIEnv *env, jclass cls); + +JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize +(JNIEnv *env, jobject unused, jobject jcpool); + +JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt +(JNIEnv *env, jobject obj, jobject unused, jint index); + +JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt +(JNIEnv *env, jobject obj, jobject unused, jint index); + +JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt +(JNIEnv *env, jobject obj, jobject unused, jint index); + +JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + +/* + * Parameter reflection + */ + +JNIEXPORT jobjectArray JNICALL +JVM_GetMethodParameters(JNIEnv *env, jobject method); + +/* + * java.security.* + */ + +JNIEXPORT jobject JNICALL +JVM_DoPrivileged(JNIEnv *env, jclass cls, + jobject action, jobject context, jboolean wrapException); + +JNIEXPORT jobject JNICALL +JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls); + +JNIEXPORT jobject JNICALL +JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls); + +/* + * Signal support, used to implement the shutdown sequence. Every VM must + * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts + * (^C) and the latter for external termination (kill, system shutdown, etc.). + * Other platform-dependent signal values may also be supported. + */ + +JNIEXPORT void * JNICALL +JVM_RegisterSignal(jint sig, void *handler); + +JNIEXPORT jboolean JNICALL +JVM_RaiseSignal(jint sig); + +JNIEXPORT jint JNICALL +JVM_FindSignal(const char *name); + +/* + * Retrieve the assertion directives for the specified class. + */ +JNIEXPORT jboolean JNICALL +JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls); + +/* + * Retrieve the assertion directives from the VM. + */ +JNIEXPORT jobject JNICALL +JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused); + +/* + * java.util.concurrent.atomic.AtomicLong + */ +JNIEXPORT jboolean JNICALL +JVM_SupportsCX8(void); + +/* + * com.sun.dtrace.jsdt support + */ + +#define JVM_TRACING_DTRACE_VERSION 1 + +/* + * Structure to pass one probe description to JVM + */ +typedef struct { + jmethodID method; + jstring function; + jstring name; + void* reserved[4]; // for future use +} JVM_DTraceProbe; + +/** + * Encapsulates the stability ratings for a DTrace provider field + */ +typedef struct { + jint nameStability; + jint dataStability; + jint dependencyClass; +} JVM_DTraceInterfaceAttributes; + +/* + * Structure to pass one provider description to JVM + */ +typedef struct { + jstring name; + JVM_DTraceProbe* probes; + jint probe_count; + JVM_DTraceInterfaceAttributes providerAttributes; + JVM_DTraceInterfaceAttributes moduleAttributes; + JVM_DTraceInterfaceAttributes functionAttributes; + JVM_DTraceInterfaceAttributes nameAttributes; + JVM_DTraceInterfaceAttributes argsAttributes; + void* reserved[4]; // for future use +} JVM_DTraceProvider; + +/* + * Get the version number the JVM was built with + */ +JNIEXPORT jint JNICALL +JVM_DTraceGetVersion(JNIEnv* env); + +/* + * Register new probe with given signature, return global handle + * + * The version passed in is the version that the library code was + * built with. + */ +JNIEXPORT jlong JNICALL +JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name, + jint providers_count, JVM_DTraceProvider* providers); + +/* + * Check JSDT probe + */ +JNIEXPORT jboolean JNICALL +JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method); + +/* + * Destroy custom DOF + */ +JNIEXPORT void JNICALL +JVM_DTraceDispose(JNIEnv* env, jlong activation_handle); + +/* + * Check to see if DTrace is supported by OS + */ +JNIEXPORT jboolean JNICALL +JVM_DTraceIsSupported(JNIEnv* env); + +/************************************************************************* + PART 2: Support for the Verifier and Class File Format Checker + ************************************************************************/ +/* + * Return the class name in UTF format. The result is valid + * until JVM_ReleaseUTf is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetClassNameUTF(JNIEnv *env, jclass cb); + +/* + * Returns the constant pool types in the buffer provided by "types." + */ +JNIEXPORT void JNICALL +JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types); + +/* + * Returns the number of Constant Pool entries. + */ +JNIEXPORT jint JNICALL +JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb); + +/* + * Returns the number of *declared* fields or methods. + */ +JNIEXPORT jint JNICALL +JVM_GetClassFieldsCount(JNIEnv *env, jclass cb); + +JNIEXPORT jint JNICALL +JVM_GetClassMethodsCount(JNIEnv *env, jclass cb); + +/* + * Returns the CP indexes of exceptions raised by a given method. + * Places the result in the given buffer. + * + * The method is identified by method_index. + */ +JNIEXPORT void JNICALL +JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index, + unsigned short *exceptions); +/* + * Returns the number of exceptions raised by a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index); + +/* + * Returns the byte code sequence of a given method. + * Places the result in the given buffer. + * + * The method is identified by method_index. + */ +JNIEXPORT void JNICALL +JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index, + unsigned char *code); + +/* + * Returns the length of the byte code sequence of a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index); + +/* + * A structure used to a capture exception table entry in a Java method. + */ +typedef struct { + jint start_pc; + jint end_pc; + jint handler_pc; + jint catchType; +} JVM_ExceptionTableEntryType; + +/* + * Returns the exception table entry at entry_index of a given method. + * Places the result in the given buffer. + * + * The method is identified by method_index. + */ +JNIEXPORT void JNICALL +JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index, + jint entry_index, + JVM_ExceptionTableEntryType *entry); + +/* + * Returns the length of the exception table of a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index); + +/* + * Returns the modifiers of a given field. + * The field is identified by field_index. + */ +JNIEXPORT jint JNICALL +JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index); + +/* + * Returns the modifiers of a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index); + +/* + * Returns the number of local variables of a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index); + +/* + * Returns the number of arguments (including this pointer) of a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index); + +/* + * Returns the maximum amount of stack (in words) used by a given method. + * The method is identified by method_index. + */ +JNIEXPORT jint JNICALL +JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index); + +/* + * Is a given method a constructor. + * The method is identified by method_index. + */ +JNIEXPORT jboolean JNICALL +JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index); + +/* + * Is the given method generated by the VM. + * The method is identified by method_index. + */ +JNIEXPORT jboolean JNICALL +JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index); + +/* + * Returns the name of a given method in UTF format. + * The result remains valid until JVM_ReleaseUTF is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the signature of a given method in UTF format. + * The result remains valid until JVM_ReleaseUTF is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the name of the field referred to at a given constant pool + * index. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the name of the method referred to at a given constant pool + * index. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the signature of the method referred to at a given constant pool + * index. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the signature of the field referred to at a given constant pool + * index. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the class name referred to at a given constant pool index. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the class name referred to at a given constant pool index. + * + * The constant pool entry must refer to a CONSTANT_Fieldref. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the class name referred to at a given constant pool index. + * + * The constant pool entry must refer to CONSTANT_Methodref or + * CONSTANT_InterfaceMethodref. + * + * The result is in UTF format and remains valid until JVM_ReleaseUTF + * is called. + * + * The caller must treat the string as a constant and not modify it + * in any way. + */ +JNIEXPORT const char * JNICALL +JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index); + +/* + * Returns the modifiers of a field in calledClass. The field is + * referred to in class cb at constant pool entry index. + * + * The caller must treat the string as a constant and not modify it + * in any way. + * + * Returns -1 if the field does not exist in calledClass. + */ +JNIEXPORT jint JNICALL +JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); + +/* + * Returns the modifiers of a method in calledClass. The method is + * referred to in class cb at constant pool entry index. + * + * Returns -1 if the method does not exist in calledClass. + */ +JNIEXPORT jint JNICALL +JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); + +/* + * Releases the UTF string obtained from the VM. + */ +JNIEXPORT void JNICALL +JVM_ReleaseUTF(const char *utf); + +/* + * Compare if two classes are in the same package. + */ +JNIEXPORT jboolean JNICALL +JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2); + +/* Get classfile constants */ +#include "classfile_constants.h" + +/* + * A function defined by the byte-code verifier and called by the VM. + * This is not a function implemented in the VM. + * + * Returns JNI_FALSE if verification fails. A detailed error message + * will be places in msg_buf, whose length is specified by buf_len. + */ +typedef jboolean (*verifier_fn_t)(JNIEnv *env, + jclass cb, + char * msg_buf, + jint buf_len); + + +/* + * Support for a VM-independent class format checker. + */ +typedef struct { + unsigned long code; /* byte code */ + unsigned long excs; /* exceptions */ + unsigned long etab; /* catch table */ + unsigned long lnum; /* line number */ + unsigned long lvar; /* local vars */ +} method_size_info; + +typedef struct { + unsigned int constants; /* constant pool */ + unsigned int fields; + unsigned int methods; + unsigned int interfaces; + unsigned int fields2; /* number of static 2-word fields */ + unsigned int innerclasses; /* # of records in InnerClasses attr */ + + method_size_info clinit; /* memory used in clinit */ + method_size_info main; /* used everywhere else */ +} class_size_info; + +/* + * Functions defined in libjava.so to perform string conversions. + * + */ + +typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str); + +typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b); + +/* This is the function defined in libjava.so that performs class + * format checks. This functions fills in size information about + * the class file and returns: + * + * 0: good + * -1: out of memory + * -2: bad format + * -3: unsupported version + * -4: bad class name + */ + +typedef jint (*check_format_fn_t)(char *class_name, + unsigned char *data, + unsigned int data_size, + class_size_info *class_size, + char *message_buffer, + jint buffer_length, + jboolean measure_only, + jboolean check_relaxed); + +#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ + JVM_ACC_FINAL | \ + JVM_ACC_SUPER | \ + JVM_ACC_INTERFACE | \ + JVM_ACC_ABSTRACT | \ + JVM_ACC_ANNOTATION | \ + JVM_ACC_ENUM | \ + JVM_ACC_SYNTHETIC) + +#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ + JVM_ACC_PRIVATE | \ + JVM_ACC_PROTECTED | \ + JVM_ACC_STATIC | \ + JVM_ACC_FINAL | \ + JVM_ACC_VOLATILE | \ + JVM_ACC_TRANSIENT | \ + JVM_ACC_ENUM | \ + JVM_ACC_SYNTHETIC) + +#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ + JVM_ACC_PRIVATE | \ + JVM_ACC_PROTECTED | \ + JVM_ACC_STATIC | \ + JVM_ACC_FINAL | \ + JVM_ACC_SYNCHRONIZED | \ + JVM_ACC_BRIDGE | \ + JVM_ACC_VARARGS | \ + JVM_ACC_NATIVE | \ + JVM_ACC_ABSTRACT | \ + JVM_ACC_STRICT | \ + JVM_ACC_SYNTHETIC) + +/* + * This is the function defined in libjava.so to perform path + * canonicalization. VM call this function before opening jar files + * to load system classes. + * + */ + +typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); + +/************************************************************************* + PART 3: I/O and Network Support + ************************************************************************/ + +/* + * Convert a pathname into native format. This function does syntactic + * cleanup, such as removing redundant separator characters. It modifies + * the given pathname string in place. + */ +JNIEXPORT char * JNICALL +JVM_NativePath(char *); + +/* + * The standard printing functions supported by the Java VM. (Should they + * be renamed to JVM_* in the future? + */ + +/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3), + * respectively, with the following differences: + * - The string written to str is always zero-terminated, also in case of + * truncation (count is too small to hold the result string), unless count + * is 0. In case of truncation count-1 characters are written and '\0' + * appendend. + * - If count is too small to hold the whole string, -1 is returned across + * all platforms. */ + +JNIEXPORT int +jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); + +JNIEXPORT int +jio_snprintf(char *str, size_t count, const char *fmt, ...); + +JNIEXPORT int +jio_fprintf(FILE *, const char *fmt, ...); + +JNIEXPORT int +jio_vfprintf(FILE *, const char *fmt, va_list args); + + +JNIEXPORT void * JNICALL +JVM_RawMonitorCreate(void); + +JNIEXPORT void JNICALL +JVM_RawMonitorDestroy(void *mon); + +JNIEXPORT jint JNICALL +JVM_RawMonitorEnter(void *mon); + +JNIEXPORT void JNICALL +JVM_RawMonitorExit(void *mon); + +/* + * java.lang.management support + */ +JNIEXPORT void* JNICALL +JVM_GetManagement(jint version); + +/* + * com.sun.tools.attach.VirtualMachine support + * + * Initialize the agent properties with the properties maintained in the VM. + */ +JNIEXPORT jobject JNICALL +JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); + +JNIEXPORT jstring JNICALL +JVM_GetTemporaryDirectory(JNIEnv *env); + +/* Generics reflection support. + * + * Returns information about the given class's EnclosingMethod + * attribute, if present, or null if the class had no enclosing + * method. + * + * If non-null, the returned array contains three elements. Element 0 + * is the java.lang.Class of which the enclosing method is a member, + * and elements 1 and 2 are the java.lang.Strings for the enclosing + * method's name and descriptor, respectively. + */ +JNIEXPORT jobjectArray JNICALL +JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); + +/* ========================================================================= + * The following defines a private JVM interface that the JDK can query + * for the JVM version and capabilities. sun.misc.Version defines + * the methods for getting the VM version and its capabilities. + * + * When a new bit is added, the following should be updated to provide + * access to the new capability: + * HS: JVM_GetVersionInfo and Abstract_VM_Version class + * SDK: Version class + * + * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for + * JVM to query for the JDK version and capabilities. + * + * When a new bit is added, the following should be updated to provide + * access to the new capability: + * HS: JDK_Version class + * SDK: JDK_GetVersionInfo0 + * + * ========================================================================== + */ +typedef struct { + unsigned int jvm_version; /* Encoded $VNUM as specified by JEP-223 */ + unsigned int patch_version : 8; /* JEP-223 patch version */ + unsigned int reserved3 : 8; + unsigned int reserved1 : 16; + unsigned int reserved2; + + /* The following bits represents JVM supports that JDK has dependency on. + * JDK can use these bits to determine which JVM version + * and support it has to maintain runtime compatibility. + * + * When a new bit is added in a minor or update release, make sure + * the new bit is also added in the main/baseline. + */ + unsigned int is_attach_supported : 1; + unsigned int : 31; + unsigned int : 32; + unsigned int : 32; +} jvm_version_info; + +#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) +#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) +#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8) +#define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) + +JNIEXPORT void JNICALL +JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size); + +typedef struct { + unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */ + unsigned int patch_version : 8; /* JEP-223 patch version */ + unsigned int reserved3 : 8; + unsigned int reserved1 : 16; + unsigned int reserved2; + + /* The following bits represents new JDK supports that VM has dependency on. + * VM implementation can use these bits to determine which JDK version + * and support it has to maintain runtime compatibility. + * + * When a new bit is added in a minor or update release, make sure + * the new bit is also added in the main/baseline. + */ + unsigned int thread_park_blocker : 1; + unsigned int post_vm_init_hook_enabled : 1; + unsigned int pending_list_uses_discovered_field : 1; + unsigned int : 29; + unsigned int : 32; + unsigned int : 32; +} jdk_version_info; + +#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) +#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) +#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8) +#define JDK_VERSION_BUILD(version) ((version & 0x000000FF)) + +/* + * This is the function JDK_GetVersionInfo0 defined in libjava.so + * that is dynamically looked up by JVM. + */ +typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size); + +/* + * This structure is used by the launcher to get the default thread + * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a + * version of 1.1. As it is not supported otherwise, it has been removed + * from jni.h + */ +typedef struct JDK1_1InitArgs { + jint version; + + char **properties; + jint checkSource; + jint nativeStackSize; + jint javaStackSize; + jint minHeapSize; + jint maxHeapSize; + jint verifyMode; + char *classpath; + + jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); + void (JNICALL *exit)(jint code); + void (JNICALL *abort)(void); + + jint enableClassGC; + jint enableVerboseGC; + jint disableAsyncGC; + jint verbose; + jboolean debugging; + jint debugPort; +} JDK1_1InitArgs; + + +#ifdef __cplusplus +} /* extern "C" */ + +#endif /* __cplusplus */ + +#endif /* !_JAVASOFT_JVM_H_ */