This commit is contained in:
Phil Race 2020-04-23 10:06:36 -07:00
commit 4765b3bdd8
4544 changed files with 24799 additions and 752146 deletions

View File

@ -629,3 +629,5 @@ bc54620a3848c26cff9766e5e2a6e5ddab98ed18 jdk-14-ga
5c7ec21f5d13f6eb5cd32288c69b8be2f9cac256 jdk-15+16
dd5198db2e5b1ebcafe065d987c03ba9fcb50fc3 jdk-15+17
44aef192b488a48cce12422394691a6b1d16b98e jdk-15+18
7cc27caabe6e342151e8baf549beb07a9c755ec2 jdk-15+19
46bca5e5e6fb26efd07245d26fe96a9c3260f51e jdk-15+20

View File

@ -303,8 +303,8 @@ jdk.compiler_CLEAN_FILES += $(wildcard \
################################################################################
jdk.hotspot.agent_DISABLED_WARNINGS += deprecation rawtypes serial unchecked \
cast static overrides fallthrough
jdk.hotspot.agent_DISABLED_WARNINGS += rawtypes serial cast static overrides \
fallthrough
jdk.hotspot.agent_COPY += .gif .png sa.js .properties
################################################################################
@ -668,12 +668,6 @@ endif
################################################################################
ifeq ($(MODULE), jdk.scripting.nashorn)
include CompileJavaModulesNashorn.gmk
endif
################################################################################
$(eval $(call IncludeCustomExtension, CompileJavaModules-post.gmk))
################################################################################

View File

@ -1,54 +0,0 @@
#
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
NASGEN_SRC := $(TOPDIR)/make/nashorn/buildtools/nasgen/src
ASM_SRC := $(TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
# Build nasgen
$(eval $(call SetupJavaCompilation, BUILD_NASGEN, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(NASGEN_SRC) $(ASM_SRC), \
BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
))
NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/$(MODULE)
NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
NASGEN_OPTIONS := \
-cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
#
# Run nasgen to modify classes in jdk.nashorn.internal.objects package
$(NASGEN_RUN_FILE): $(BUILD_NASGEN) $($(MODULE))
$(ECHO) Running nasgen
$(JAVA_SMALL) $(NASGEN_OPTIONS) \
jdk.nashorn.internal.tools.nasgen.Main $(@D) \
jdk.nashorn.internal.objects $(@D)
$(TOUCH) $@
TARGETS += $(NASGEN_RUN_FILE)

View File

@ -103,9 +103,8 @@ ifeq ($(ENABLE_PANDOC), true)
SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-troff-manpage-filter.sh.template, \
OUTPUT_FILE := $(PANDOC_TROFF_MANPAGE_FILTER), \
REPLACEMENTS := \
@@BOOT_JDK@@ => $(BOOT_JDK) ; \
@@JJS@@ => $(JJS) ; \
@@TOPDIR@@ => $(TOPDIR) ; \
@@JJS_FLAGS@@ => $(addprefix -J, $(JAVA_FLAGS_SMALL)), \
))
# Created script must be made executable
@ -127,9 +126,8 @@ ifeq ($(ENABLE_PANDOC), true)
SOURCE_FILES := $(TOPDIR)/make/scripts/pandoc-html-manpage-filter.sh.template, \
OUTPUT_FILE := $(PANDOC_HTML_MANPAGE_FILTER), \
REPLACEMENTS := \
@@BOOT_JDK@@ => $(BOOT_JDK) ; \
@@JJS@@ => $(JJS) ; \
@@TOPDIR@@ => $(TOPDIR) ; \
@@JJS_FLAGS@@ => $(addprefix -J, $(JAVA_FLAGS_SMALL)), \
))
# Created script must be made executable

View File

@ -177,6 +177,11 @@ else # not java.base
JMOD_FLAGS += --exclude '$(notdir $(MSVCR_DLL))'
endif
endif
ifneq ($(VCRUNTIME_1_DLL), )
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(VCRUNTIME_1_DLL))), )
JMOD_FLAGS += --exclude '$(notdir $(VCRUNTIME_1_DLL))'
endif
endif
ifneq ($(MSVCP_DLL), )
ifneq ($(wildcard $(LIBS_DIR)/$(notdir $(MSVCP_DLL))), )
JMOD_FLAGS += --exclude '$(notdir $(MSVCP_DLL))'

View File

@ -356,7 +356,6 @@ jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
langtools_JTREG_MAX_MEM := 768m

View File

@ -37,10 +37,22 @@ ifeq ($(call isTargetOs, windows), true)
$(call install-file)
endif
prepare-test-image: $(FIXPATH_COPY)
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
FIXPATH_ECHO := $(FIXPATH) $(call FixPath, $(ECHO))
$(BUILD_INFO_PROPERTIES):
$(call MakeTargetDir)
$(ECHO) "# Build info properties for JDK tests" > $@
$(FIXPATH_ECHO) "build.workspace.root=$(WORKSPACE_ROOT)" >> $@
$(FIXPATH_ECHO) "build.output.root=$(OUTPUTDIR)" >> $@
prepare-test-image: $(FIXPATH_COPY) $(BUILD_INFO_PROPERTIES)
$(call MakeDir, $(TEST_IMAGE_DIR))
$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
################################################################################
all: prepare-test-image
.PHONY: default all prepare-test-image

View File

@ -86,6 +86,13 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
AC_SUBST(TOPDIR)
AC_SUBST(CONFIGURE_START_DIR)
if test "x$CUSTOM_ROOT" != x; then
WORKSPACE_ROOT="${CUSTOM_ROOT}"
else
WORKSPACE_ROOT="${TOPDIR}"
fi
AC_SUBST(WORKSPACE_ROOT)
# We can only call UTIL_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
UTIL_FIXUP_PATH(TOPDIR)
@ -141,6 +148,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
# Corresponds to --with-msvcr-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
# Corresponds to --with-vcruntime-1-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
# Corresponds to --with-msvcp-dll
BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
# Corresponds to --with-ucrt-dll-dir
@ -313,11 +322,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
AC_MSG_RESULT([in build directory with custom name])
fi
if test "x$CUSTOM_ROOT" != x; then
WORKSPACE_ROOT="${CUSTOM_ROOT}"
else
WORKSPACE_ROOT="${TOPDIR}"
fi
OUTPUTDIR="${WORKSPACE_ROOT}/build/${CONF_NAME}"
$MKDIR -p "$OUTPUTDIR"
if test ! -d "$OUTPUTDIR"; then
@ -374,7 +378,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
AC_SUBST(SPEC)
AC_SUBST(CONF_NAME)
AC_SUBST(OUTPUTDIR)
AC_SUBST(WORKSPACE_ROOT)
AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
# The spec.gmk file contains all variables for the make system.

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2020, 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
@ -345,7 +345,9 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
# When compiling code to be executed by the Boot JDK, force compatibility with the
# oldest supported bootjdk.
BOOT_JDK_SOURCETARGET="-source 13 -target 13"
OLDEST_BOOT_JDK=`$ECHO $DEFAULT_ACCEPTABLE_BOOT_VERSIONS \
| $TR " " "\n" | $SORT -n | $HEAD -n1`
BOOT_JDK_SOURCETARGET="-source $OLDEST_BOOT_JDK -target $OLDEST_BOOT_JDK"
AC_SUBST(BOOT_JDK_SOURCETARGET)
AC_SUBST(JAVAC_FLAGS)
@ -379,6 +381,21 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
BOOTJDK_USE_LOCAL_CDS=false
AC_MSG_RESULT([no, -XX:SharedArchiveFile not supported])
fi
# Check for jjs in bootjdk
UTIL_SETUP_TOOL(JJS,
[
AC_MSG_CHECKING([for jjs in Boot JDK])
JJS=$BOOT_JDK/bin/jjs
if test ! -x $JJS; then
AC_MSG_RESULT(not found)
JJS=""
AC_MSG_NOTICE([Cannot use pandoc without jjs])
ENABLE_PANDOC=false
fi
AC_MSG_RESULT(ok)
AC_SUBST(JJS)
])
])
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -66,3 +66,6 @@ JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@
# By filtering out those JVM args, the bootcycle JVM will use its default
# settings for CDS.
JAVA_FLAGS := $(filter-out -XX:SharedArchiveFile% -Xshare%, $(JAVA_FLAGS))
# Pandoc cannot be used without the jjs plugin, which was removed with Nashorn.
ENABLE_PANDOC := false

View File

@ -97,6 +97,9 @@ HOTSPOT_SETUP_JVM_VARIANTS
# With basic setup done, call the custom early hook.
CUSTOM_EARLY_HOOK
# This only needs debug level to be setup
JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT
# Check if we have devkits, extra paths or sysroot set.
BASIC_SETUP_DEVKIT
@ -123,12 +126,11 @@ BASIC_SETUP_DEFAULT_LOG
###############################################################################
#
# Determine OpenJDK variants, options and version numbers.
# Determine OpenJDK variants and version numbers.
#
###############################################################################
# We need build & target for this.
JDKOPT_SETUP_JDK_OPTIONS
JDKOPT_SETUP_JLINK_OPTIONS
JDKVER_SETUP_JDK_VERSION_NUMBERS
@ -141,6 +143,14 @@ JDKVER_SETUP_JDK_VERSION_NUMBERS
BOOTJDK_SETUP_BOOT_JDK
BOOTJDK_SETUP_BUILD_JDK
###############################################################################
#
# Determine JDK specific build time options.
#
###############################################################################
JDKOPT_SETUP_JDK_OPTIONS
###############################################################################
#
# Configure the sources to use. We can add or override individual directories.

View File

@ -641,6 +641,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# Where does this really belong??
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
PICFLAG="-fPIC"
PIEFLAG="-fPIE"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
PICFLAG="-KPIC"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
@ -854,18 +855,27 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
fi
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# Check if compiler supports -fmacro-prefix-map. If so, use that to make
# the __FILE__ macro resolve to paths relative to the workspace root.
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
FILE_MACRO_CFLAGS="-fmacro-prefix-map=${workspace_root_trailing_slash}="
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
PREFIX: $3,
IF_FALSE: [
FILE_MACRO_CFLAGS=
]
)
# Prevent the __FILE__ macro from generating absolute paths into the built
# binaries. Depending on toolchain, different mitigations are possible.
# * GCC and Clang of new enough versions have -fmacro-prefix-map.
# * For most other toolchains, supplying all source files and -I flags as
# relative paths fixes the issue.
FILE_MACRO_CFLAGS=
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# Check if compiler supports -fmacro-prefix-map. If so, use that to make
# the __FILE__ macro resolve to paths relative to the workspace root.
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
FILE_MACRO_CFLAGS="-fmacro-prefix-map=${workspace_root_trailing_slash}="
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
PREFIX: $3,
IF_FALSE: [
FILE_MACRO_CFLAGS=
]
)
fi
fi
AC_SUBST(FILE_MACRO_CFLAGS)
# EXPORT to API
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
@ -894,10 +904,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
$2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
$2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK} $PIEFLAG"
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK} $PIEFLAG"
$2CFLAGS_JDKLIB="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK} \
$JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
$2CXXFLAGS_JDKLIB="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK} \
$JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
AC_SUBST($2JVM_CFLAGS)
AC_SUBST($2CFLAGS_JDKLIB)

View File

@ -152,6 +152,17 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
# Setup LDFLAGS for linking executables
if test "x$TOOLCHAIN_TYPE" = xgcc; then
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
# Enabling pie on 32 bit builds prevents the JVM from allocating a continuous
# java heap.
if test "x$OPENJDK_TARGET_CPU_BITS" != "x32"; then
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -pie"
fi
fi
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BASIC_LDFLAGS="$BASIC_LDFLAGS -pdbaltpath:%_PDB%"
fi
fi
# Export some intermediate variables for compatibility

View File

@ -140,7 +140,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
fi
AC_MSG_CHECKING([for pandoc])
if test "x$PANDOC" != "x"; then
if test "x$ENABLE_PANDOC" = "xtrue"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, cannot generate full docs])
@ -598,3 +598,35 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
])
AC_SUBST(BUILD_CDS_ARCHIVE)
])
################################################################################
#
# Disallow any output from containing absolute paths from the build system.
# This setting defaults to allowed on debug builds and not allowed on release
# builds.
#
AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT],
[
AC_ARG_ENABLE([absolute-paths-in-output],
[AS_HELP_STRING([--disable-absolute-paths-in-output],
[Set to disable to prevent any absolute paths from the build to end up in
any of the build output. @<:@disabled in release builds, otherwise enabled@:>@])
])
AC_MSG_CHECKING([if absolute paths should be allowed in the build output])
if test "x$enable_absolute_paths_in_output" = "xno"; then
AC_MSG_RESULT([no, forced])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
elif test "x$enable_absolute_paths_in_output" = "xyes"; then
AC_MSG_RESULT([yes, forced])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
elif test "x$DEBUG_LEVEL" = "xrelease"; then
AC_MSG_RESULT([no, release build])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
else
AC_MSG_RESULT([yes, debug build])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
fi
AC_SUBST(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)
])

View File

@ -338,6 +338,8 @@ BUILD_MANPAGES := @BUILD_MANPAGES@
BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT := @ALLOW_ABSOLUTE_PATHS_IN_OUTPUT@
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
# it in sync.
BOOT_JDK:=@BOOT_JDK@
@ -381,6 +383,7 @@ LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
GRAALUNIT_LIB := @GRAALUNIT_LIB@
FILE_MACRO_CFLAGS := @FILE_MACRO_CFLAGS@
STATIC_LIBS_CFLAGS := @STATIC_LIBS_CFLAGS@
@ -631,6 +634,7 @@ JAR_CMD:=@JAR@
JLINK_CMD := @JLINK@
JMOD_CMD := @JMOD@
JARSIGNER_CMD:=@JARSIGNER@
JJS_CMD:=@JJS@
SJAVAC_SERVER_JAVA_CMD:=@SJAVAC_SERVER_JAVA@
# These variables are meant to be used. They are defined with = instead of := to make
# it possible to override only the *_CMD variables.
@ -643,6 +647,7 @@ JAR=@FIXPATH@ $(JAR_CMD)
JLINK = @FIXPATH@ $(JLINK_CMD) $(JAVA_TOOL_FLAGS_SMALL)
JMOD = @FIXPATH@ $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD)
JJS=@FIXPATH@ $(JJS_CMD) $(JAVA_TOOL_FLAGS_SMALL)
# A specific java binary with specific options can be used to run
# the long running background sjavac servers and other long running tasks.
SJAVAC_SERVER_JAVA=@FIXPATH@ @FIXPATH_DETACH_FLAG@ $(SJAVAC_SERVER_JAVA_CMD) \
@ -783,6 +788,7 @@ LIBZ_CFLAGS:=@LIBZ_CFLAGS@
LIBZ_LIBS:=@LIBZ_LIBS@
LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
MSVCR_DLL:=@MSVCR_DLL@
VCRUNTIME_1_DLL:=@VCRUNTIME_1_DLL@
MSVCP_DLL:=@MSVCP_DLL@
UCRT_DLL_DIR:=@UCRT_DLL_DIR@
STLPORT_LIB:=@STLPORT_LIB@

View File

@ -90,8 +90,9 @@ VS_SUPPORTED_2017=true
VS_TOOLSET_SUPPORTED_2017=true
VS_DESCRIPTION_2019="Microsoft Visual Studio 2019"
VS_VERSION_INTERNAL_2019=141
VS_VERSION_INTERNAL_2019=142
VS_MSVCR_2019=vcruntime140.dll
VS_VCRUNTIME_1_2019=vcruntime140_1.dll
VS_MSVCP_2019=msvcp140.dll
VS_ENVVAR_2019="VS160COMNTOOLS"
VS_USE_UCRT_2019="true"
@ -299,6 +300,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
fi
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
@ -365,6 +367,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
eval VCRUNTIME_1_NAME="\${VS_VCRUNTIME_1_${VS_VERSION}}"
eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
@ -802,6 +805,31 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
AC_SUBST(MSVCP_DLL)
fi
AC_ARG_WITH(vcruntime-1-dll, [AS_HELP_STRING([--with-vcruntime-1-dll],
[path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows only) @<:@probed@:>@])])
if test "x$VCRUNTIME_1_NAME" != "x"; then
if test "x$with_vcruntime_1_dll" != x; then
# If given explicitly by user, do not probe. If not present, fail directly.
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$with_vcruntime_1_dll],
[--with-vcruntime-1-dll])
if test "x$MSVC_DLL" = x; then
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by --with-vcruntime-1-dll])
fi
VCRUNTIME_1_DLL="$MSVC_DLL"
elif test "x$DEVKIT_VCRUNTIME_1_DLL" != x; then
TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$DEVKIT_VCRUNTIME_1_DLL], [devkit])
if test "x$MSVC_DLL" = x; then
AC_MSG_ERROR([Could not find a proper $VCRUNTIME_1_NAME as specified by devkit])
fi
VCRUNTIME_1_DLL="$MSVC_DLL"
else
TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}])
VCRUNTIME_1_DLL="$MSVC_DLL"
fi
AC_SUBST(VCRUNTIME_1_DLL)
fi
AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
[path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])

View File

@ -36,7 +36,7 @@ DEFAULT_VERSION_EXTRA3=0
DEFAULT_VERSION_DATE=2020-09-15
DEFAULT_VERSION_CLASSFILE_MAJOR=59 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="13 14 15"
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="14 15"
DEFAULT_JDK_SOURCE_TARGET_VERSION=15
DEFAULT_PROMOTED_VERSION_PRE=ea

View File

@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, common/FindTests.gmk))
TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
# JTREG_TESTROOTS might have been set by a custom extension
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp)
# Extract the names of the Jtreg group files from the TEST.ROOT files. The
# TEST.ROOT files being properties files can be interpreted as makefiles so

View File

@ -112,7 +112,6 @@ PLATFORM_MODULES += \
jdk.jsobject \
jdk.localedata \
jdk.naming.dns \
jdk.scripting.nashorn \
jdk.security.auth \
jdk.security.jgss \
jdk.xml.dom \
@ -130,7 +129,6 @@ endif
JRE_TOOL_MODULES += \
jdk.jdwp.agent \
jdk.incubator.jpackage \
jdk.scripting.nashorn.shell \
#
################################################################################
@ -172,7 +170,6 @@ DOCS_MODULES += \
jdk.naming.rmi \
jdk.net \
jdk.nio.mapmode \
jdk.scripting.nashorn \
jdk.sctp \
jdk.security.auth \
jdk.security.jgss \

View File

@ -204,6 +204,68 @@ DEPENDENCY_TARGET_SED_PATTERN := \
-e 's/$$$$/ :/' \
#
################################################################################
# When absolute paths are not allowed in the output, and the compiler does not
# support any options to avoid it, we need to rewrite compile commands to use
# relative paths. By doing this, the __FILE__ macro will resolve to relative
# paths. The relevant input paths on the command line are the -I flags and the
# path to the source file itself.
#
# The macro MakeCommandRelative is used to rewrite the command line like this:
# 'CD $(WORKSPACE_ROOT) && <cmd>'
# and changes all paths in cmd to be relative to the workspace root. This only
# works properly if the build dir is inside the workspace root. If it's not,
# relative paths are still calculated, but depending on the distance between the
# dirs, paths in the build dir may end up as essentially absolute anyway.
#
# The fix-deps-file macro is used to adjust the contents of the generated make
# dependency files to contain paths compatible with make.
#
ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)-$(FILE_MACRO_CFLAGS), false-)
# Need to handle -I flags as both '-Ifoo' and '-I foo'.
MakeCommandRelative = \
$(CD) $(WORKSPACE_ROOT) && \
$(foreach o, $1, \
$(if $(filter $(WORKSPACE_ROOT)/% $(OUTPUTDIR)/%, $o), \
$(call RelativePath, $o, $(WORKSPACE_ROOT)) \
, \
$(if $(filter -I$(WORKSPACE_ROOT)/%, $o), \
-I$(call RelativePath, $(patsubst -I%, %, $o), $(WORKSPACE_ROOT)) \
, \
$o \
) \
) \
)
# When compiling with relative paths, the deps file comes out with relative
# paths.
ifeq ($(TOOLCHAIN_TYPE), solstudio)
define fix-deps-file
$(SED) -e 's|\./|$(WORKSPACE_ROOT)/|g' $1.tmp > $1
endef
else
define fix-deps-file
$(SED) -e 's|^\([ ]*\)|\1$(WORKSPACE_ROOT)|' $1.tmp > $1
endef
endif
else
# By default the MakeCommandRelative macro does nothing.
MakeCommandRelative = $1
# Even with absolute paths on the command line, the Solaris studio compiler
# doesn't output the full path to the object file in the generated deps files.
# For other toolchains, no adjustment is needed.
ifeq ($(TOOLCHAIN_TYPE), solstudio)
define fix-deps-file
$(SED) 's|^$$(@F):|$$@:|' $1.tmp > $1
endef
else
define fix-deps-file
$(MV) $1.tmp $1
endef
endif
endif
################################################################################
# Create the recipe needed to compile a single native source file.
#
@ -214,7 +276,6 @@ DEPENDENCY_TARGET_SED_PATTERN := \
# Remaining parameters are named arguments:
# FILE - The full path of the source file to compiler
# BASE - The name of the rule for the entire binary to build ($1)
# DISABLE_THIS_FILE_DEFINE - Set to true to disable the THIS_FILE define.
#
SetupCompileNativeFile = $(NamedParamsMacroTemplate)
define SetupCompileNativeFileBody
@ -236,12 +297,6 @@ define SetupCompileNativeFileBody
# This is the definite source file to use for $1_FILENAME.
$1_SRC_FILE := $$($1_FILE)
ifneq ($$($1_DEFINE_THIS_FILE), false)
ifneq ($$($$($1_BASE)_DEFINE_THIS_FILE), false)
$1_THIS_FILE = -DTHIS_FILE='"$$($1_FILENAME)"'
endif
endif
ifeq ($$($1_OPTIMIZATION), )
$1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS)
$1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS)
@ -284,13 +339,13 @@ define SetupCompileNativeFileBody
ifneq ($$(filter %.c, $$($1_FILENAME)), )
# Compile as a C file
$1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CFLAGS) \
$$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
$$($1_OPT_CFLAGS) $$($1_CFLAGS) -c
$1_COMPILER := $$($$($1_BASE)_CC)
$1_DEP_FLAG := $(C_FLAG_DEPS)
else ifneq ($$(filter %.m, $$($1_FILENAME)), )
# Compile as an Objective-C file
$1_FLAGS := -x objective-c $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) \
$$($1_BASE_CFLAGS) $$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
$$($1_BASE_CFLAGS) $$($1_OPT_CFLAGS) $$($1_CFLAGS) -c
$1_COMPILER := $$($$($1_BASE)_CC)
$1_DEP_FLAG := $(C_FLAG_DEPS)
else ifneq ($$(filter %.s %.S, $$($1_FILENAME)), )
@ -301,7 +356,7 @@ define SetupCompileNativeFileBody
else ifneq ($$(filter %.cpp %.cc %.mm, $$($1_FILENAME)), )
# Compile as a C++ or Objective-C++ file
$1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CXXFLAGS) \
$$($1_OPT_CXXFLAGS) $$($1_CXXFLAGS) $$($1_THIS_FILE) -c
$$($1_OPT_CXXFLAGS) $$($1_CXXFLAGS) -c
$1_COMPILER := $$($$($1_BASE)_CXX)
$1_DEP_FLAG := $(CXX_FLAG_DEPS)
else
@ -341,21 +396,17 @@ define SetupCompileNativeFileBody
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
$$(call MakeDir, $$(@D))
ifneq ($(TOOLCHAIN_TYPE), microsoft)
ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $$($1_FILENAME)), solstudio)
# The Solaris studio compiler doesn't output the full path to the
# object file in the generated deps files. Fixing it with sed. If
# compiling assembly, don't try this.
$$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEPS_FILE).tmp $$($1_COMPILE_OPTIONS))
$(SED) 's|^$$(@F):|$$@:|' $$($1_DEPS_FILE).tmp > $$($1_DEPS_FILE)
else
$$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEPS_FILE) $$($1_COMPILE_OPTIONS))
endif
# Create a dependency target file from the dependency file.
# Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
$$($1_COMPILER) $$($1_DEP_FLAG) \
$$(addsuffix .tmp, $$($1_DEPS_FILE)) \
$$($1_COMPILE_OPTIONS)))
ifneq ($$($1_DEPS_FILE), )
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEPS_FILE) > $$($1_DEPS_TARGETS_FILE)
$$(call fix-deps-file, $$($1_DEPS_FILE))
# Create a dependency target file from the dependency file.
# Solution suggested by:
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEPS_FILE) \
> $$($1_DEPS_TARGETS_FILE)
endif
else
# The Visual Studio compiler lacks a feature for generating make
@ -365,8 +416,8 @@ define SetupCompileNativeFileBody
# Keep as much as possible on one execution line for best performance
# on Windows. No need to save exit code from compilation since
# pipefail is always active on Windows.
$$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS)) \
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
$$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS))) \
| $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
-e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \
$(ECHO) $$@: \\ > $$($1_DEPS_FILE) ; \
@ -430,7 +481,6 @@ endef
# STRIPFLAGS Optionally change the flags given to the strip command
# PRECOMPILED_HEADER Header file to use as precompiled header
# PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
# DEFINE_THIS_FILE Set to false to not set the THIS_FILE preprocessor macro
#
# After being called, some variables are exported from this macro, all prefixed
# with parameter 1 followed by a '_':
@ -734,7 +784,6 @@ define SetupNativeCompilationBody
FILE := $$($1_GENERATED_PCH_SRC), \
BASE := $1, \
EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
DEFINE_THIS_FILE := false, \
))
$1_USE_PCH_FLAGS := \
@ -769,7 +818,8 @@ define SetupNativeCompilationBody
$$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
$$(call LogInfo, Generating precompiled header)
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, $$($1_PCH_COMMAND) $$< -o $$@)
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
$$($1_PCH_COMMAND) $$< -o $$@))
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEPS_FILE) \
> $$($1_PCH_DEPS_TARGETS_FILE)
@ -825,9 +875,9 @@ define SetupNativeCompilationBody
$$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
$$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$($1_BASENAME)))
$$(call MakeDir, $$(@D) $$($1_OBJECT_DIR))
$$(call ExecuteWithLog, $$@, \
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
$$($1_VERSIONINFO_RESOURCE) 2>&1 )
$$($1_VERSIONINFO_RESOURCE) 2>&1 ))
# Windows RC compiler does not support -showIncludes, so we mis-use CL
# for this. Filter out RC specific arguments that are unknown to CL.
# For some unknown reason, in this case CL actually outputs the show

View File

@ -381,8 +381,8 @@ var getJibProfilesCommon = function (input, data) {
};
};
common.boot_jdk_version = "13";
common.boot_jdk_build_number = "33";
common.boot_jdk_version = "14";
common.boot_jdk_build_number = "36";
common.boot_jdk_home = input.get("boot_jdk", "install_path") + "/jdk-"
+ common.boot_jdk_version
+ (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
@ -615,7 +615,13 @@ var getJibProfilesProfiles = function (input, common, data) {
// The prebuilt bootcycle variant modifies the boot jdk argument
var bootcyclePrebuiltBase = {
dependencies: [ name + ".jdk" ],
configure_args: "--with-boot-jdk=" + input.get(name + ".jdk", "home_path"),
configure_args: [
"--with-boot-jdk=" + input.get(name + ".jdk", "home_path"),
// Full docs do not currently work with bootcycle build
// since Nashorn was removed. This negates the
// --enable-full-docs from the main profile.
"--enable-full-docs=auto",
]
}
profiles[bootcyclePrebuiltName] = concatObjects(profiles[name],
bootcyclePrebuiltBase);
@ -1009,16 +1015,16 @@ var getJibProfilesDependencies = function (input, common) {
: input.get("gnumake", "install_path") + "/bin");
if (input.build_cpu == 'aarch64') {
boot_jdk = {
boot_jdk = {
organization: common.organization,
ext: "tar.gz",
module: "jdk-linux_aarch64",
revision: "13+1.0",
configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
environment_path: common.boot_jdk_home + "/bin"
}
}
} else {
boot_jdk = {
boot_jdk = {
server: "jpg",
product: "jdk",
version: common.boot_jdk_version,
@ -1027,7 +1033,12 @@ var getJibProfilesDependencies = function (input, common) {
+ boot_jdk_platform + "_bin" + boot_jdk_ext,
configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
environment_path: common.boot_jdk_home + "/bin"
}
}
}
if (input.build_cpu == 'sparcv9') {
boot_jdk.file = "bundles/openjdk/GPL/" + boot_jdk_platform
+ "/openjdk-" + common.boot_jdk_version + "_"
+ boot_jdk_platform + "_bin" + boot_jdk_ext;
}
var dependencies = {

View File

@ -59,12 +59,17 @@ ifeq ($(call isTargetOs, windows), true)
FILES := $(MSVCR_DLL), \
MACRO := copy-and-chmod))
$(eval $(call SetupCopyFiles,COPY_VCRUNTIME_1, \
DEST := $(LIB_DST_DIR), \
FILES := $(VCRUNTIME_1_DLL), \
MACRO := copy-and-chmod))
$(eval $(call SetupCopyFiles,COPY_MSVCP, \
DEST := $(LIB_DST_DIR), \
FILES := $(MSVCP_DLL), \
MACRO := copy-and-chmod))
TARGETS += $(COPY_MSVCR) $(COPY_MSVCP)
TARGETS += $(COPY_MSVCR) $(COPY_VCRUNTIME_1) $(COPY_MSVCP)
ifneq ($(UCRT_DLL_DIR), )
$(eval $(call SetupCopyFiles, COPY_UCRT_DLLS, \

View File

@ -70,7 +70,8 @@ JDWP "Java(tm) Debug Wire Protocol"
)
(Command AllClasses=3
"Returns reference types for all classes currently loaded by the "
"target VM."
"target VM. "
"See <a href=\"../jvmti.html#GetLoadedClasses\">JVM TI GetLoadedClasses</a>."
(Out
)
(Reply
@ -600,14 +601,9 @@ JDWP "Java(tm) Debug Wire Protocol"
(CommandSet ReferenceType=2
(Command Signature=1
"Returns the JNI signature of a reference type. "
"JNI signature formats are described in the "
"<a href=\"../jni/index.html\">Java Native Interface Specification</a>"
"<p>
"For primitive classes "
"the returned signature is the signature of the corresponding primitive "
"type; for example, \"I\" is returned as the signature of the class "
"represented by java.lang.Integer.TYPE."
"Returns the type signature of a reference type. "
"Type signature formats are the same as specified in "
"<a href=\"../jvmti.html#GetClassSignature\">JVM TI GetClassSignature</a>."
(Out
(referenceType refType "The reference type ID.")
)
@ -2266,11 +2262,12 @@ JDWP "Java(tm) Debug Wire Protocol"
)
(CommandSet ClassLoaderReference=14
(Command VisibleClasses=1
"Returns a list of all classes which this class loader has "
"been requested to load. This class loader is considered to be "
"an <i>initiating</i> class loader for each class in the returned "
"list. The list contains each "
"reference type defined by this loader and any types for which "
"Returns a list of all classes which this class loader can find "
"by name via <code>ClassLoader::loadClass</code>, "
"<code>Class::forName</code> and bytecode linkage. That is, "
"all classes for which this class loader has been recorded as an "
"<i>initiating</i> loader. The list contains each "
"reference type created by this loader and any types for which "
"loading was delegated by this class loader to another class loader. "
"<p>"
"The visible class list has useful properties with respect to "
@ -2280,6 +2277,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"this class loader must be resolved to that single type. "
"<p>"
"No ordering of the returned list is guaranteed. "
"<p>"
"See <a href=\"../jvmti.html#GetClassLoaderClasses\">JVM TI GetClassLoaderClasses</a>. "
(Out
(classLoaderObject classLoaderObject "The class loader object ID. ")
)

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ VS_VERSION_NUM_NODOT="160"
VS_DLL_VERSION="140"
SDK_VERSION="10"
SDK_FULL_VERSION="10.0.17763.0"
MSVC_DIR="Microsoft.VC141.CRT"
MSVC_DIR="Microsoft.VC142.CRT"
MSVC_FULL_VERSION="14.12.27508"
REDIST_FULL_VERSION="14.20.27508"
@ -102,6 +102,7 @@ DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
echo "Creating devkit in $DEVKIT_ROOT"
MSVCR_DLL=${MSVC_DIR}/vcruntime${VS_DLL_VERSION}.dll
VCRUNTIME_1_DLL=${MSVC_DIR}/vcruntime${VS_DLL_VERSION}_1.dll
MSVCP_DLL=${MSVC_DIR}/msvcp${VS_DLL_VERSION}.dll
################################################################################
@ -188,6 +189,7 @@ echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/x64:\$DEVKIT_ROOT
echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/x64;\$DEVKIT_ROOT/VC/atlmfc/lib/x64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
echo-info "DEVKIT_VCRUNTIME_1_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$VCRUNTIME_1_DLL\""
echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
echo-info "DEVKIT_UCRT_DLL_DIR_x86_64=\"\$DEVKIT_ROOT/10/Redist/ucrt/DLLs/x64\""
echo-info ""

View File

@ -1,51 +0,0 @@
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include TextFileProcessing.gmk
################################################################################
# Version file needs to be processed with version numbers
VERSION_FILE := jdk/nashorn/internal/runtime/resources/version.properties
$(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
SOURCE_FILES := $(TOPDIR)/src/$(MODULE)/share/classes/$(VERSION_FILE).template, \
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$(VERSION_FILE), \
REPLACEMENTS := \
@@VERSION_STRING@@ => $(VERSION_STRING) ; \
@@VERSION_SHORT@@ => $(VERSION_SHORT) , \
))
TARGETS += $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE)
################################################################################
all: $(TARGETS)
.PHONY: all default

View File

@ -38,6 +38,7 @@ define SetupCharacterData
$$(call LogInfo, Generating $1.java)
$$(call MakeDir, $$(@D))
$(TOOL_GENERATECHARACTER) $2 \
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true), -d) \
-template $(CHARACTERDATA)/$1.java.template \
-spec $(UNICODEDATA)/UnicodeData.txt \
-specialcasing $(UNICODEDATA)/SpecialCasing.txt \

View File

@ -81,7 +81,9 @@ ifneq ($(MOD_FILES), )
$(call DependOnVariable, ALL_MODULES)
$(call MakeTargetDir)
$(RM) $@ $@.tmp
$(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \
$(TOOL_GENMODULEINFOSOURCE) \
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true), -d) \
-o $@.tmp \
--source-file $< \
--modules $(call CommaList, $(ALL_MODULES)) \
$(MOD_FILES)

View File

@ -75,7 +75,6 @@ ifeq ($(call check-jvm-feature, compiler2), true)
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc, \
DEBUG_SYMBOLS := false, \
DISABLED_WARNINGS_clang := tautological-compare, \
DEFINE_THIS_FILE := false, \
))
ADLC_TOOL := $(BUILD_ADLC_TARGET)
@ -201,6 +200,9 @@ ifeq ($(call check-jvm-feature, compiler2), true)
$(NAWK) \
'BEGIN { print "#line 1 \"$*\""; } \
/^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), false), \
/^#line .*$$/ {sub("$(WORKSPACE_ROOT)/","")} \
) \
{print}' \
< $(ADLC_SUPPORT_DIR)/$* > $@

View File

@ -80,7 +80,6 @@ ifeq ($(call check-jvm-feature, dtrace), true)
EXTRA_DEPS := $(JVMTI_H) $(JFR_FILES), \
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
DEFINE_THIS_FILE := false, \
))
DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)

View File

@ -42,7 +42,6 @@ ifeq ($(call check-jvm-feature, dtrace), true)
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
LIBS := $(LIBDL) -lthread -ldoor, \
OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
DEFINE_THIS_FILE := false, \
))
# Note that libjvm_db.c has tests for COMPILER2, but this was never set by
@ -55,7 +54,6 @@ ifeq ($(call check-jvm-feature, dtrace), true)
CFLAGS := -I$(DTRACE_GENSRC_DIR) $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
DEFINE_THIS_FILE := false, \
))
TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)

View File

@ -96,7 +96,6 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
STRIP_SYMBOLS := false, \
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
PRECOMPILED_HEADER_EXCLUDE := gtest-all.cc gmock-all.cc gtestMain.cpp, \
DEFINE_THIS_FILE := false, \
))
TARGETS += $(BUILD_GTEST_LIBJVM)
@ -123,7 +122,6 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \
COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
DEFINE_THIS_FILE := false, \
))
$(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM)

View File

@ -208,7 +208,6 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
DEFINE_THIS_FILE := false, \
))
# Always recompile abstract_vm_version.cpp if libjvm needs to be relinked. This ensures

View File

@ -142,6 +142,7 @@ JVM_Interrupt
JVM_InvokeMethod
JVM_IsArrayClass
JVM_IsConstructorIx
JVM_IsHiddenClass
JVM_IsInterface
JVM_IsPrimitiveClass
JVM_IsRecord
@ -151,6 +152,7 @@ JVM_IsThreadAlive
JVM_IsVMGeneratedMethodIx
JVM_LatestUserDefinedLoader
JVM_LoadLibrary
JVM_LookupDefineClass
JVM_MaxMemory
JVM_MaxObjectInspectionAge
JVM_MonitorNotify

View File

@ -41,7 +41,7 @@ ifeq ($(call isTargetOs, windows), true)
$(foreach v, $(JVM_VARIANTS), \
$(eval $(call SetupCopyFiles, COPY_GTEST_MSVCR_$v, \
DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \
FILES := $(MSVCR_DLL) $(MSVCP_DLL), \
FILES := $(MSVCR_DLL) $(VCRUNTIME_1_DLL) $(MSVCP_DLL), \
FLATTEN := true, \
)) \
$(eval TARGETS += $$(COPY_GTEST_MSVCR_$v)) \

View File

@ -942,14 +942,15 @@ OUTER: for (int i = 0; i < n; i += m) {
int n = sizes.length;
StringBuffer result = new StringBuffer();
// liu : Add a comment showing the source of this table
result.append(commentStart + " The following tables and code generated using:" +
commentEnd + "\n ");
result.append(commentStart + ' ' + commandLineDescription + commentEnd + "\n ");
if (plane == 0 && bLatin1 == false) {
if (debug) {
result.append(commentStart + " The following tables and code generated using:" +
commentEnd + "\n ");
result.append(commentStart + ' ' + commandLineDescription + commentEnd + "\n ");
}
if (plane == 0 && bLatin1 == false) {
genCaseMapTableDeclaration(result);
genCaseMapTable(initializers, specialCaseMaps);
}
}
int totalBytes = 0;
for (int k = 0; k < n - 1; k++) {
genTable(result, tableNames[k], tables[k], 0, bytes[k]<<3, sizes[k], preshifted[k],
@ -1612,6 +1613,7 @@ OUTER: for (int i = 0; i < n; i += m) {
*/
static boolean verbose = false;
static boolean debug = false;
static boolean nobidi = false;
static boolean nomirror = false;
static boolean identifiers = false;
@ -1692,6 +1694,8 @@ OUTER: for (int i = 0; i < n; i += m) {
for (int j = 0; j < args.length; j++) {
if (args[j].equals("-verbose") || args[j].equals("-v"))
verbose = true;
else if (args[j].equals("-d"))
debug = true;
else if (args[j].equals("-nobidi"))
nobidi = true;
else if (args[j].equals("-nomirror"))

View File

@ -59,11 +59,14 @@ import static java.util.stream.Collectors.*;
*/
public class GenModuleInfoSource {
private final static String USAGE =
"Usage: GenModuleInfoSource -o <output file> \n" +
" --source-file <module-info-java>\n" +
" --modules <module-name>[,<module-name>...]\n" +
" <module-info.java.extra> ...\n";
"Usage: GenModuleInfoSource \n" +
" [-d]\n" +
" -o <output file>\n" +
" --source-file <module-info-java>\n" +
" --modules <module-name>[,<module-name>...]\n" +
" <module-info.java.extra> ...\n";
static boolean debug = false;
static boolean verbose = false;
public static void main(String... args) throws Exception {
Path outfile = null;
@ -75,6 +78,9 @@ public class GenModuleInfoSource {
String option = args[i];
String arg = i+1 < args.length ? args[i+1] : null;
switch (option) {
case "-d":
debug = true;
break;
case "-o":
outfile = Paths.get(arg);
i++;
@ -148,10 +154,12 @@ public class GenModuleInfoSource {
for (String l : lines) {
writer.println(l);
if (l.trim().startsWith("module ")) {
// print URI rather than file path to avoid escape
writer.format(" // source file: %s%n", sourceFile.toUri());
for (Path file: extraFiles) {
writer.format(" // %s%n", file.toUri());
if (debug) {
// print URI rather than file path to avoid escape
writer.format(" // source file: %s%n", sourceFile.toUri());
for (Path file : extraFiles) {
writer.format(" // %s%n", file.toUri());
}
}
break;
}

View File

@ -1,32 +0,0 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LauncherCommon.gmk
$(eval $(call SetupBuildLauncher, jjs, \
MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
JAVA_ARGS := --add-modules ALL-DEFAULT, \
CFLAGS := -DENABLE_ARG_FILES, \
))

View File

@ -138,12 +138,11 @@ define SetupBuildLauncherBody
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
OPTIMIZATION := $$($1_OPTIMIZATION), \
CFLAGS := $$(CFLAGS_JDKEXE) \
$(LAUNCHER_CFLAGS) \
$(VERSION_CFLAGS) \
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
$$(LAUNCHER_CFLAGS) \
$$(VERSION_CFLAGS) \
-DLAUNCHER_NAME='"$$(LAUNCHER_NAME)"' \
-DPROGNAME='"$1"' \
$$($1_CFLAGS), \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_windows := $$($1_CFLAGS_windows), \
DISABLED_WARNINGS_gcc := unused-function, \

View File

@ -184,6 +184,9 @@ endif
ifeq ($(call isTargetOs, windows), true)
# Supply the name of the C runtime lib.
LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
ifneq ($(VCRUNTIME_1_DLL), )
LIBJLI_CFLAGS += -DVCRUNTIME_1_DLL_NAME='"$(notdir $(VCRUNTIME_1_DLL))"'
endif
ifneq ($(MSVCP_DLL), )
LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
endif

View File

@ -111,9 +111,9 @@ ifeq ($(call isTargetOs, macosx), true)
missing-method-return-type, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
$(call SET_SHARED_LIBRARY_ORIGIN) \
-fobjc-link-runtime, \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := \
-lobjc \
-framework JavaNativeFoundation \
-framework CoreServices \
-framework Security \

View File

@ -1,435 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project
name="nashorn-benchmarks"
default="all"
basedir=".."
xmlns:if="ant:if">
<!--
Below are the octane benchmarks that should be run.
The ones that are excluded, as Nashorn currently has
some issues with them (functionality or performance)
are commented out
-->
<!-- box2d -->
<target name="octane-box2d" depends="octane-box2d-nashorn"/>
<target name="octane-box2d-nashorn" depends="jar">
<run-one cond="octane.benchmark.box2d" runtime="nashorn"/>
</target>
<target name="octane-box2d-v8" depends="jar">
<run-one cond="octane.benchmark.box2d" runtime="v8"/>
</target>
<target name="octane-box2d-rhino" depends="jar">
<run-one cond="octane.benchmark.box2d" runtime="rhino"/>
</target>
<!-- code-load -->
<target name="octane-code-load" depends="octane-code-load-nashorn"/>
<target name="octane-code-load-nashorn" depends="jar">
<run-one cond="octane.benchmark.code-load" runtime="nashorn"/>
</target>
<target name="octane-code-load-v8" depends="jar">
<run-one cond="octane.benchmark.code-load" runtime="v8"/>
</target>
<target name="octane-code-load-rhino" depends="jar">
<run-one cond="octane.benchmark.code-load" runtime="rhino"/>
</target>
<!-- crypto -->
<target name="octane-crypto" depends="octane-crypto-nashorn"/>
<target name="octane-crypto-nashorn" depends="jar">
<run-one cond="octane.benchmark.crypto" runtime="nashorn"/>
</target>
<target name="octane-crypto-v8" depends="jar">
<run-one cond="octane.benchmark.crypto" runtime="v8"/>
</target>
<target name="octane-crypto-rhino" depends="jar">
<run-one cond="octane.benchmark.crypto" runtime="rhino"/>
</target>
<!-- deltablue -->
<target name="octane-deltablue" depends="octane-deltablue-nashorn"/>
<target name="octane-deltablue-nashorn" depends="jar">
<run-one cond="octane.benchmark.deltablue" runtime="nashorn"/>
</target>
<target name="octane-deltablue-v8" depends="jar">
<run-one cond="octane.benchmark.deltablue" runtime="v8"/>
</target>
<target name="octane-deltablue-rhino" depends="jar">
<run-one cond="octane.benchmark.deltablue" runtime="rhino"/>
</target>
<!-- earley-boyer -->
<target name="octane-earley-boyer" depends="octane-earley-boyer-nashorn"/>
<target name="octane-earley-boyer-nashorn" depends="jar">
<run-one cond="octane.benchmark.earley-boyer" runtime="nashorn"/>
</target>
<target name="octane-earley-boyer-v8" depends="jar">
<run-one cond="octane.benchmark.earley-boyer" runtime="v8"/>
</target>
<target name="octane-earley-boyer-rhino" depends="jar">
<run-one cond="octane.benchmark.earley-boyer" runtime="rhino"/>
</target>
<!-- gbemu -->
<target name="octane-gbemu" depends="octane-gbemu-nashorn"/>
<target name="octane-gbemu-nashorn" depends="jar">
<run-one cond="octane.benchmark.gbemu" runtime="nashorn"/>
</target>
<target name="octane-gbemu-v8" depends="jar">
<run-one cond="octane.benchmark.gbemu" runtime="v8"/>
</target>
<target name="octane-gbemu-rhino" depends="jar">
<run-one cond="octane.benchmark.gbemu" runtime="rhino"/>
</target>
<!-- mandreel -->
<target name="octane-mandreel" depends="octane-mandreel-nashorn"/>
<target name="octane-mandreel-nashorn" depends="jar">
<run-one cond="octane.benchmark.mandreel" runtime="nashorn"/>
</target>
<target name="octane-mandreel-v8" depends="jar">
<run-one cond="octane.benchmark.mandreel" runtime="v8"/>
</target>
<target name="octane-mandreel-rhino" depends="jar">
<run-one cond="octane.benchmark.mandreel" runtime="rhino"/>
</target>
<!-- navier-stokes -->
<target name="octane-navier-stokes" depends="octane-navier-stokes-nashorn"/>
<target name="octane-navier-stokes-nashorn" depends="jar">
<run-one cond="octane.benchmark.navier-stokes" runtime="nashorn"/>
</target>
<target name="octane-navier-stokes-v8" depends="jar">
<run-one cond="octane.benchmark.navier-stokes" runtime="v8"/>
</target>
<target name="octane-navier-stokes-rhino" depends="jar">
<run-one cond="octane.benchmark.navier-stokes" runtime="rhino"/>
</target>
<!-- pdfjs -->
<target name="octane-pdfjs" depends="octane-pdfjs-nashorn"/>
<target name="octane-pdfjs-nashorn" depends="jar">
<run-one cond="octane.benchmark.pdfjs" runtime="nashorn"/>
</target>
<target name="octane-pdfjs-v8" depends="jar">
<run-one cond="octane.benchmark.pdfjs" runtime="v8"/>
</target>
<target name="octane-pdfjs-rhino" depends="jar">
<run-one cond="octane.benchmark.pdfjs" runtime="rhino"/>
</target>
<!-- raytrace -->
<target name="octane-raytrace" depends="octane-raytrace-nashorn"/>
<target name="octane-raytrace-nashorn" depends="jar">
<run-one cond="octane.benchmark.raytrace" runtime="nashorn"/>
</target>
<target name="octane-raytrace-v8" depends="jar">
<run-one cond="octane.benchmark.raytrace" runtime="v8"/>
</target>
<target name="octane-raytrace-rhino" depends="jar">
<run-one cond="octane.benchmark.raytrace" runtime="rhino"/>
</target>
<!-- regexp -->
<target name="octane-regexp" depends="octane-regexp-nashorn"/>
<target name="octane-regexp-nashorn" depends="jar">
<run-one cond="octane.benchmark.regexp" runtime="nashorn"/>
</target>
<target name="octane-regexp-v8" depends="jar">
<run-one cond="octane.benchmark.regexp" runtime="v8"/>
</target>
<target name="octane-regexp-rhino" depends="jar">
<run-one cond="octane.benchmark.regexp" runtime="rhino"/>
</target>
<!-- richards -->
<target name="octane-richards" depends="octane-richards-nashorn"/>
<target name="octane-richards-nashorn" depends="jar">
<run-one cond="octane.benchmark.richards" runtime="nashorn"/>
</target>
<target name="octane-richards-v8" depends="jar">
<run-one cond="octane.benchmark.richards" runtime="v8"/>
</target>
<target name="octane-richards-rhino" depends="jar">
<run-one cond="octane.benchmark.richards" runtime="rhino"/>
</target>
<!-- splay -->
<target name="octane-splay" depends="octane-splay-nashorn"/>
<target name="octane-splay-nashorn" depends="jar">
<run-one cond="octane.benchmark.splay" runtime="nashorn"/>
</target>
<target name="octane-splay-v8" depends="jar">
<run-one cond="octane.benchmark.splay" runtime="v8"/>
</target>
<target name="octane-splay-rhino" depends="jar">
<run-one cond="octane.benchmark.splay" runtime="rhino"/>
</target>
<!-- typescript -->
<target name="octane-typescript" depends="octane-typescript-nashorn"/>
<target name="octane-typescript-nashorn" depends="jar">
<run-one cond="octane.benchmark.typescript" runtime="nashorn"/>
</target>
<target name="octane-typescript-v8" depends="jar">
<run-one cond="octane.benchmark.typescript" runtime="v8"/>
</target>
<target name="octane-typescript-rhino" depends="jar">
<run-one cond="octane.benchmark.typescript" runtime="rhino"/>
</target>
<!-- zlib -->
<target name="octane-zlib" depends="octane-zlib-nashorn"/>
<target name="octane-zlib-nashorn" depends="jar">
<run-one cond="octane.benchmark.zlib" runtime="nashorn"/>
</target>
<target name="octane-zlib-v8" depends="jar">
<run-one cond="octane.benchmark.zlib" runtime="v8"/>
</target>
<target name="octane-zlib-rhino" depends="jar">
<run-one cond="octane.benchmark.zlib" runtime="rhino"/>
</target>
<target name="-define-nashorn-task">
<ant dir="${nashorntask.dir}" inheritAll="false"/>
<taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask"
classpath="${nashorntask.dist.dir}/nashorntask.jar"/>
</target>
<!--
Benchmark runners for one or more benchmarks, single
or multiple process
-->
<target name="octane-process-separate" if="${octane-test-sys-prop.separate.process}"
depends="-define-nashorn-task">
<echo message="Running each benchmark in separate processes, starting new JVMs for each."/>
<nashorn><![CDATA[
var props = [];
for (var prop in project.getProperties()) {
if (prop.startsWith("octane.benchmark.")) {
props.push(prop);
}
}
//sort benchmark props in alphabetical order by name
props.sort(function(a, b) {
if (a < b) {
return -1;
} else if (a > b) {
return 1;
} else {
return 0;
}
});
var runtime = project.getProperty("runtime");
for (var i in props) {
var task = project.createTask("run-one");
// workaround for https://issues.apache.org/bugzilla/show_bug.cgi?id=53831, still not fixed
if (task.getOwningTarget() == null) {
task.setOwningTarget(self.getOwningTarget());
}
var prop = props[i];
task.setDynamicAttribute("cond", prop);
task.setDynamicAttribute("runtime", runtime);
task.perform();
}
]]></nashorn>
</target>
<target name="octane-process-single" unless="${octane-test-sys-prop.separate.process}">
<echo message="Running all benchmarks in the same process."/>
<pathconvert property="octane.benchmarks" pathsep=" ">
<propertyset>
<propertyref prefix="octane.benchmark."/>
</propertyset>
</pathconvert>
<antcall target="run-octane${runtime}">
<param name="octane-tests" value="${octane.benchmarks}"/>
</antcall>
</target>
<!--
run 'octane' in single or separate processes based on config
This uses nashorn as the default runtime
-->
<target name="octane-nashorn" depends="jar">
<property name="runtime" value="nashorn"/>
<antcall target="octane-process-separate"/>
<antcall target="octane-process-single"/>
</target>
<!-- alias for 'octane' -->
<target name="octane" depends="octane-nashorn"/>
<!-- run octane benchmarks using octane as runtime -->
<target name="octane-v8" depends="jar">
<property name="runtime" value="v8"/>
<antcall target="octane-process-separate"/>
<antcall target="octane-process-single"/>
</target>
<!-- run octane benchmarks using Rhino as runtime -->
<target name="octane-rhino" depends="jar">
<property name="runtime" value="rhino"/>
<antcall target="octane-process-separate"/>
<antcall target="octane-process-single"/>
</target>
<macrodef name="run-one">
<attribute name="cond"/>
<attribute name="runtime" default=""/>
<sequential>
<antcall target="run-octane-@{runtime}" if:set="@{cond}">
<param name="octane-tests" value="${@{cond}}"/>
</antcall>
</sequential>
</macrodef>
<target name="run-octane-nashorn">
<java classname="${nashorn.shell.tool}"
classpath="${run.test.classpath}"
fork="true">
<jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
<!-- pass on all properties prefixed with 'nashorn' to the runtime -->
<syspropertyset>
<propertyref prefix="nashorn."/>
</syspropertyset>
<arg value="${octane-test-sys-prop.test.js.framework}"/>
<arg value="-scripting"/>
<arg value="--"/>
<arg value="${octane-tests}"/>
<arg value="--runtime"/>
<arg value="nashorn"/>
<arg value="--verbose"/>
<arg value="--iterations ${octane.iterations}"/>
</java>
</target>
<target name="run-octane-v8">
<exec executable="${v8.shell}">
<arg value="${octane-test-sys-prop.test.js.framework}"/>
<arg value="--"/>
<arg value="${octane-tests}"/>
<arg value="--runtime"/>
<arg value="v8"/>
<arg value="--verbose"/>
<arg value="--iterations ${octane.iterations}"/>
</exec>
</target>
<target name="run-octane-rhino">
<java jar="${rhino.jar}"
classpath="${run.test.classpath}"
fork="true"
dir=".">
<jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
<arg value="-opt"/>
<arg value="9"/>
<arg value="${octane-test-sys-prop.test.js.framework}"/>
<arg value="${octane-tests}"/>
<arg value="--runtime"/>
<arg value="rhino"/>
<arg value="--verbose"/>
<arg value="--iterations ${octane.iterations}"/>
</java>
</target>
<!-- run octane with all known runtimes for comparison -->
<target name="octane-all" depends="octane, octane-v8, octane-rhino">
<exec executable="${v8.shell}">
<arg value="${octane-test-sys-prop.test.js.framework}"/>
<arg value="${octane-tests}/"/>
</exec>
</target>
<target name="sunspider-init" depends="jar">
<fileset id="sunspider-set"
dir="${sunspider-test-sys-prop.test.js.roots}"
excludes="${sunspider-test-sys-prop.test.js.exclude.list}">
<include name="**/*.js"/>
</fileset>
<pathconvert pathsep=" " property="sunspider-tests" refid="sunspider-set"/>
</target>
<!--- SUNSPIDER JOB BELOW -->
<!-- run sunspider with Nashorn -->
<target name="sunspider" depends="sunspider-nashorn"/>
<target name="sunspider-nashorn" depends="sunspider-init">
<java classname="${nashorn.shell.tool}"
classpath="${run.test.classpath}"
fork="true">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="-timezone=PST"/>
<arg value="--class-cache-size=50"/>
<arg value="${sunspider-test-sys-prop.test.js.framework}"/>
<arg value="--"/>
<arg value="${sunspider-tests}/"/>
<arg value="--verbose"/>
<arg value="--times"/>
<arg value="${sunspider.iterations}"/>
</java>
</target>
<!-- run sunspider with v8 -->
<target name="sunspider-v8" depends="sunspider-init">
<exec executable="${v8.shell}">
<arg value="${sunspider-test-sys-prop.test.js.framework}"/>
<arg value="--"/>
<arg value="${sunspider-tests}/"/>
<arg value="--verbose"/>
<arg value="--times"/>
<arg value="${sunspider.iterations}"/>
</exec>
</target>
<!-- run sunspider with Rhino -->
<target name="sunspider-rhino" depends="sunspider-init">
<java jar="${rhino.jar}"
classpath="${run.test.classpath}"
fork="true"
dir=".">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="-opt"/>
<arg value="9"/>
<arg value="${sunspider-test-sys-prop.test.js.framework}"/>
<arg value="${sunspider-tests}/"/>
<arg value="--verbose"/>
<arg value="--times"/>
<arg value="${sunspider.iterations}"/>
</java>
</target>
</project>

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="build-nasgen" default="run-nasgen" basedir=".">
<description>Builds and runs nasgen.</description>
<import file="build.xml"/>
<target name="build-nasgen" depends="prepare">
<ant inheritAll="false" dir="${nashorn.make.dir}/buildtools/nasgen"
antfile="build.xml" target="jar"/>
</target>
<target name="run-nasgen" depends="build-nasgen">
<java classname="${nasgen.tool}" fork="true" failonerror="true">
<classpath>
<pathelement location="${basedir}/jcov2/lib/jcov_j2se_rt.jar"/>
<pathelement location="${build.dir}/nasgen/dist/nasgen.jar"/>
</classpath>
<jvmarg line="${nasgen.module.imports}"/>
<arg value="${nashorn.module.classes.dir}"/>
<arg value="jdk.nashorn.internal.objects"/>
<arg value="${nashorn.module.classes.dir}"/>
</java>
</target>
<target name="run-nasgen-eclipse" depends="load-properties">
<mkdir dir="${basedir}/build/eclipse/.nasgentmp"/>
<java classname="jdk.nashorn.internal.tools.nasgen.Main" fork="true" failonerror="true">
<classpath>
<pathelement location="${basedir}/buildtools/nasgen/dist/nasgen.jar"/>
</classpath>
<jvmarg line="${nasgen.module.imports}"/>
<arg value="${basedir}/build/eclipse"/>
<arg value="jdk.nashorn.internal.objects"/>
<arg value="${basedir}/build/eclipse/.nasgentmp"/>
</java>
<move todir="${basedir}/build/eclipse/jdk/nashorn/internal/objects">
<fileset dir="${basedir}/build/eclipse/.nasgentmp/jdk/nashorn/internal/objects">
<include name="*.class"/>
</fileset>
</move>
<delete includeemptydirs="true"><fileset dir="${basedir}/build/eclipse/.nasgentmp" includes="**"/></delete>
<copy todir="${basedir}/build/eclipse/jdk/nashorn/internal/objects" preservelastmodified="true">
<fileset dir="${basedir}/build/eclipse/jdk/nashorn/internal/objects">
<include name="**/*.class"/>
</fileset>
</copy>
</target>
<target name="clean-nasgen">
<ant inheritAll="false" dir="${nashorn.make.dir}/buildtools/nasgen"
antfile="build.xml" target="clean"/>
</target>
</project>

View File

@ -1,883 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="nashorn" default="test" basedir="../..">
<import file="build-nasgen.xml"/>
<import file="code_coverage.xml"/>
<target name="load-properties">
<!-- set default values to run.test.jvmargs.external property -->
<condition property="run.test.jvmargs.external" value="">
<not><isset property="run.test.jvmargs.external"/></not>
</condition>
<!-- loading locally defined resources and properties. NB they owerwrite default ones defined later -->
<property file="${user.home}/.nashorn.project.local.properties"/>
<loadproperties srcFile="make/nashorn/project.properties"/>
</target>
<target name="init-conditions" depends="load-properties">
<path id="nashorn.jar.path">
<pathelement location="${nashorn.jar}"/>
</path>
<condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
<available file="/usr/local/bin/svn"/>
</condition>
<condition property="hg.executable" value="/usr/local/bin/hg" else="hg">
<available file="/usr/local/bin/hg"/>
</condition>
<condition property="git.executable" value="/usr/local/bin/git" else="git">
<available file="/usr/local/bin/git"/>
</condition>
<!-- check if TestNG and dependencies are available, and download them if they aren't -->
<antcall target="get-testng"/>
<condition property="testng.available" value="true">
<and>
<available file="${file.reference.testng.jar}"/>
<available file="${file.reference.jcommander.jar}"/>
<available file="${file.reference.bsh.jar}"/>
<available file="${file.reference.snakeyaml.jar}"/>
</and>
</condition>
<!-- check if asmtools-6.0.jar is available, and download it if it isn't -->
<!--
<available property="asmtools.already.present" file="${file.reference.asmtools.jar}"/>
<antcall target="get-asmtools"/>
<available property="asmtools.available" file="${file.reference.asmtools.jar}"/>
-->
<!-- check if Jemmy ang TestNG are avaiable -->
<condition property="jemmy.jfx.testng.available" value="true">
<and>
<available file="${file.reference.jemmyfx.jar}"/>
<available file="${file.reference.jemmycore.jar}"/>
<available file="${file.reference.jemmyawtinput.jar}"/>
<available file="${file.reference.jfxrt.jar}"/>
<isset property="testng.available"/>
</and>
</condition>
<!-- enable/disable make code coverage -->
<condition property="cc.enabled">
<istrue value="${make.code.coverage}" />
</condition>
<!-- exclude tests in exclude lists -->
<condition property="exclude.list" value="${nashorn.make.dir}/exclude/exclude_list_cc.txt" else="${nashorn.make.dir}/exclude/exclude_list.txt">
<istrue value="${make.code.coverage}" />
</condition>
<condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
<istrue value="${jfr}"/>
</condition>
<condition property="test-sys-prop-no-security.os.not.windows">
<not>
<os family="windows"/>
</not>
</condition>
<!--set windows cygwin/cmd specific properties-->
<property environment="env"/>
<condition property="test-sys-prop-no-security.os.not.windows.cmd">
<not>
<and>
<os family="windows"/>
<not>
<isset property="env.SHELL"/>
</not>
</and>
</not>
</condition>
</target>
<!-- check minimum ant version required to be 1.9.5 -->
<target name="check-ant-version">
<property name="ant.version.required" value="1.9.5"/>
<antversion property="ant.current.version" />
<fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.9.5 or above.">
<condition>
<not>
<antversion atleast="${ant.version.required}"/>
</not>
</condition>
</fail>
</target>
<target name="check-java-version">
<!-- look for a Class that is available only in jdk1.8 or above -->
<!-- core/exposed API class is better than an implementation class -->
<available property="jdk1.8+" classname="java.util.stream.Stream"/>
<!-- need jdk1.8 or above -->
<fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+">
</fail>
</target>
<target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc">
<!-- extends jvm args -->
<property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
<property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
<echo message="run.test.jvmargs=${run.test.jvmargs}"/>
<echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
<echo message="run.test.xms=${run.test.xms}"/>
<echo message="run.test.xmx=${run.test.xmx}"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${nashorn.module.classes.dir}"/>
<mkdir dir="${dynalink.module.classes.dir}"/>
<mkdir dir="${nashorn.shell.module.classes.dir}"/>
<mkdir dir="${nashorn.module.classes.dir}/META-INF/services"/>
<mkdir dir="${build.test.classes.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.javadoc.dir}"/>
</target>
<target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
<delete includeemptydirs="true">
<fileset dir="${build.dir}" erroronmissingdir="false"/>
</delete>
<delete dir="${dist.dir}"/>
<delete dir="${jdk.build.dir}/nashorn_code_cache"/>
<delete file="${basedir}/NashornProfile.txt"/>
</target>
<target name="compile" depends="prepare" description="Compiles nashorn">
<javac srcdir="${dynalink.module.src.dir}"
destdir="${dynalink.module.classes.dir}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xdiags:verbose"/>
<compilerarg value="-parameters"/>
</javac>
<!-- patch-module does not like module-info.class files! -->
<delete>
<fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
</delete>
<javac srcdir="${nashorn.module.src.dir}"
destdir="${nashorn.module.classes.dir}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xdiags:verbose"/>
<compilerarg value="-parameters"/>
<compilerarg line="${nashorn.override.option}"/>
</javac>
<!-- patch-module does not like module-info.class files! -->
<delete>
<fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
</delete>
<javac srcdir="${nashorn.shell.module.src.dir}"
destdir="${nashorn.shell.module.classes.dir}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xdiags:verbose"/>
<compilerarg value="-parameters"/>
<compilerarg line="${nashorn.override.option}"/>
</javac>
<!-- patch-module does not like module-info.class files! -->
<delete>
<fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
</delete>
<copy todir="${nashorn.module.classes.dir}/jdk/nashorn/api/scripting/resources">
<fileset dir="${nashorn.module.src.dir}/jdk/nashorn/api/scripting/resources/"/>
</copy>
<copy todir="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources">
<fileset dir="${nashorn.module.src.dir}/jdk/nashorn/internal/runtime/resources/"/>
</copy>
<copy todir="${nashorn.module.classes.dir}/jdk/nashorn/tools/resources">
<fileset dir="${nashorn.module.src.dir}/jdk/nashorn/tools/resources/"/>
</copy>
<copy file="${dynalink.module.src.dir}/jdk/dynalink/support/messages.properties" todir="${dynalink.module.classes.dir}/jdk/dynalink/support"/>
<copy file="${nashorn.module.src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${nashorn.module.classes.dir}/jdk/nashorn/internal/codegen"/>
<copy todir="${nashorn.shell.module.classes.dir}/jdk/nashorn/tools/jjs/resources">
<fileset dir="${nashorn.shell.module.src.dir}/jdk/nashorn/tools/jjs/resources/"/>
</copy>
<echo message="version_string=${nashorn.fullversion}" file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
<echo file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
<echo message="version_short=${nashorn.version}" file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
</target>
<target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
<jar jarfile="${dynalink.jar}">
<fileset dir="${dynalink.module.classes.dir}"/>
</jar>
<jar jarfile="${nashorn.jar}" index="true" filesetmanifest="merge">
<fileset dir="${nashorn.module.classes.dir}"/>
<manifest>
<attribute name="Archiver-Version" value="n/a"/>
<attribute name="Build-Jdk" value="${java.runtime.version}"/>
<attribute name="Built-By" value="n/a"/>
<attribute name="Created-By" value="Ant jar task"/>
<section name="jdk/nashorn/">
<attribute name="Implementation-Title" value="${nashorn.product.name}"/>
<attribute name="Implementation-Version" value="${nashorn.version}"/>
</section>
</manifest>
</jar>
<jar jarfile="${jjs.jar}">
<fileset dir="${nashorn.shell.module.classes.dir}"/>
</jar>
</target>
<target name="use-promoted-nashorn" depends="init">
<delete file="${dist.dir}/nashorn.jar"/>
<copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
<property name="compile.suppress.jar" value="defined"/>
</target>
<!-- generate javadoc for Nashorn classes -->
<target name="javadoc" depends="jar" unless="test.class">
<javadoc destdir="${dist.javadoc.dir}" use="yes"
windowtitle="${nashorn.product.name} ${nashorn.version}"
additionalparam="-quiet" failonerror="true" useexternalfile="true">
<arg value="--patch-module"/>
<arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
<arg value="--patch-module"/>
<arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
<arg value="."/>
<arg value="${javadoc.option}"/>
<fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
<fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
<link offline="true" href="${javadoc.base.url}" packagelistLoc="${javadoc.element.list}"/>
</javadoc>
</target>
<!-- generate javadoc only for nashorn extension api classes -->
<target name="nashornapi" depends="jar">
<mkdir dir="${dist.nashornapi.javadoc.dir}"/>
<javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes"
windowtitle="${nashorn.product.name} ${nashorn.version}"
additionalparam="-quiet" failonerror="true" useexternalfile="true">
<arg value="--patch-module"/>
<arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
<arg value="--patch-module"/>
<arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
<arg value="."/>
<arg value="${javadoc.option}"/>
<fileset dir="${nashorn.module.src.dir}" includes="jdk/nashorn/api/**/*.java"/>
<link offline="true" href="${javadoc.base.url}" packagelistLoc="${javadoc.element.list}"/>
</javadoc>
</target>
<!-- generate javadoc only for Dynalink API classes -->
<target name="dynalinkapi" depends="jar">
<mkdir dir="${dist.dynalinkapi.javadoc.dir}"/>
<javadoc destdir="${dist.dynalinkapi.javadoc.dir}" use="yes"
windowtitle="Dynalink"
additionalparam="-quiet" failonerror="true" useexternalfile="true">
<arg value="--patch-module"/>
<arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
<arg value="--patch-module"/>
<arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
<arg value="--module-source-path"/>
<arg value="."/>
<arg value="${javadoc.option}"/>
<fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
<link offline="true" href="${javadoc.base.url}" packagelistLoc="${javadoc.element.list}"/>
</javadoc>
</target>
<target name="javadocapi" depends="nashornapi, dynalinkapi"/>
<!-- generate all docs -->
<target name="docs" depends="javadoc"/>
<!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
<target name="dist" depends="jar">
<zip destfile="${build.zip}" basedir=".."
excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
<tar destfile="${build.gzip}" basedir=".." compression="gzip"
excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
</target>
<target name="compile-test" depends="compile, run-nasgen" if="testng.available">
<!-- testng task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask"
classpath="${testng.ant.classpath}"/>
<javac srcdir="${test.src.dir}"
destdir="${build.test.classes.dir}"
classpath="${javac.test.classpath}"
debug="${javac.debug}"
encoding="${javac.encoding}"
includeantruntime="false" fork="true">
<compilerarg line="${nashorn.override.option}"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xdiags:verbose"/>
<compilerarg line="${test.module.imports.compile.time}"/>
</javac>
<copy todir="${build.test.classes.dir}/META-INF/services">
<fileset dir="${test.src.dir}/META-INF/services/"/>
</copy>
<copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/test/resources">
<fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/test/resources"/>
</copy>
<copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/doubleconv/test/resources">
<fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/doubleconv/test/resources"/>
</copy>
<copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/test/resources">
<fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/test/resources"/>
</copy>
<!-- tests that check nashorn internals and internal API -->
<jar jarfile="${nashorn.internal.tests.jar}">
<fileset dir="${build.test.classes.dir}" includes="**/internal/**"/>
<fileset dir="${build.test.classes.dir}" includes="**/test/tools/**"/>
<fileset dir="${build.test.classes.dir}" includes="**/models/**"/>
<fileset dir="${build.test.classes.dir}" includes="**/jdk/dynalink/test/Trusted**"/>
<fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
</jar>
<!-- tests that check nashorn script engine (jsr-223) API and dynalink API -->
<jar jarfile="${nashorn.api.tests.jar}">
<fileset dir="${build.test.classes.dir}" includes="**/jdk/dynalink/**" excludes="**/jdk/dynalink/test/Trusted**"/>
<fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
<fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
<fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
<fileset dir="${build.test.classes.dir}" includes="**/UnnamedPackage**"/>
</jar>
</target>
<target name="generate-security-config" depends="generate-policy-file, generate-security-properties-file"/>
<target name="generate-security-properties-file" depends="prepare">
<echo file="${build.dir}/nashorn.security.properties">
package.access=sun.misc.,\
sun.reflect.,\
jdk.nashorn.internal.
</echo>
</target>
<target name="generate-policy-file" depends="prepare">
<echo file="${build.dir}/nashorn.policy">
grant codeBase "file:/${basedir}/${dynalink.module.classes.dir}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${nashorn.module.classes.dir}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${nashorn.api.tests.jar}" {
permission java.util.PropertyPermission "parserapitest.*", "read";
permission java.util.PropertyPermission "test.*", "read";
permission java.util.PropertyPermission "test262.*", "read";
permission java.io.FilePermission "${basedir}/test/nashorn/-","read";
permission java.io.FilePermission "$${user.dir}", "read";
permission java.util.PropertyPermission "user.dir", "read";
};
grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
permission java.security.AllPermission;
};
//// in case of absolute path:
grant codeBase "file:/${nashorn.internal.tests.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${file.reference.testng.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${file.reference.jcommander.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${file.reference.bsh.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${file.reference.snakeyaml.jar}" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${test.script.dir}/trusted/*" {
permission java.security.AllPermission;
};
grant codeBase "file:/${basedir}/${test.script.dir}/maptests/*" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/maptests/*","read";
permission java.lang.RuntimePermission "nashorn.debugMode";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/*" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/-", "read";
permission java.io.FilePermission "$${user.dir}", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "nashorn.test.*", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/apply_to_call/*" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/-", "read";
permission java.io.FilePermission "$${user.dir}", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "nashorn.test.*", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/parser/*" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/-", "read";
permission java.io.FilePermission "$${user.dir}", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "nashorn.test.*", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/es6/*" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/-", "read";
permission java.io.FilePermission "$${user.dir}", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "nashorn.test.*", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/JDK-8010946-privileged.js" {
permission java.util.PropertyPermission "java.security.policy", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/classloader.js" {
permission java.lang.RuntimePermission "nashorn.JavaReflection";
};
grant codeBase "file:/${basedir}/${test.script.dir}/markdown.js" {
permission java.io.FilePermission "${basedir}/${test.script.dir}/external/showdown/-", "read";
};
grant codeBase "file:/${basedir}/${test.script.dir}/basic/JDK-8158467.js" {
permission java.lang.RuntimePermission "nashorn.setConfig";
};
</echo>
<replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators -->
<replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs -->
</target>
<target name="check-external-tests">
<available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
<available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
<available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
<available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
<available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
<available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
<available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
<available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
</target>
<target name="check-testng" unless="testng.available">
<echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
</target>
<!-- only to be invoked as dependency of "test" target -->
<target name="-test-classes-all" depends="jar" unless="test.class">
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="**/dynalink/beans/test/*Test.class"/>
<include name="**/dynalink/linker/support/test/*Test.class"/>
<include name="**/dynalink/support/test/*Test.class"/>
<include name="**/dynalink/test/*Test.class"/>
<include name="**/api/javaaccess/test/*Test.class"/>
<include name="**/api/scripting/test/*Test.class"/>
<include name="**/api/tree/test/*Test.class"/>
<include name="**/codegen/test/*Test.class"/>
<include name="**/parser/test/*Test.class"/>
<include name="**/runtime/test/*Test.class"/>
<include name="**/runtime/doubleconv/test/*Test.class"/>
<include name="**/runtime/regexp/test/*Test.class"/>
<include name="**/runtime/regexp/joni/test/*Test.class"/>
<include name="**/framework/*Test.class"/>
</fileset>
</target>
<!-- only to be invoked as dependency of "test" target -->
<target name="-test-classes-single" depends="jar" if="test.class">
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="${test.class}*"/>
</fileset>
</target>
<!-- only to be invoked as dependency of "test" target -->
<target name="-test-nosecurity" unless="test.class">
<fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
<include name="**/framework/ScriptTest.class"/>
<include name="**/runtime/linker/test/*Test.class"/>
</fileset>
<testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
<sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
<propertyset>
<propertyref prefix="nashorn."/>
</propertyset>
<propertyset>
<propertyref prefix="test-sys-prop-no-security."/>
<mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
</propertyset>
<sysproperty key="optimistic.override" value="${optimistic}"/>
<classpath>
<pathelement path="${run.test.classpath}"/>
</classpath>
</testng>
</target>
<!-- only to be invoked as dependency of "test" target -->
<target name="-test-security">
<delete dir="${build.dir}/nashorn_code_cache"/>
<property name="debug.test.jvmargs" value=""/>
<testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<jvmarg line="${debug.test.jvmargs}"/>
<propertyset>
<propertyref prefix="nashorn."/>
</propertyset>
<propertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<sysproperty key="optimistic.override" value="${optimistic}"/>
<sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
<classpath>
<pathelement path="${run.test.classpath}"/>
</classpath>
</testng>
</target>
<target name="test" depends="prepare, javadoc, test-pessimistic, test-optimistic"/>
<target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<echo message="Running test suite in OPTIMISTIC mode..."/>
<antcall target="-test-nosecurity" inheritRefs="true">
<param name="optimistic" value="true"/>
<param name="testResultsSubDir" value="optimistic"/>
</antcall>
<antcall target="-test-security" inheritRefs="true">
<param name="optimistic" value="true"/>
<param name="testResultsSubDir" value="optimistic"/>
</antcall>
</target>
<target name="test-pessimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<echo message="Running test suite in PESSIMISTIC mode..."/>
<antcall target="-test-nosecurity" inheritRefs="true">
<param name="optimistic" value="false"/>
<param name="testResultsSubDir" value="pessimistic"/>
</antcall>
<antcall target="-test-security" inheritRefs="true">
<param name="optimistic" value="false"/>
<param name="testResultsSubDir" value="pessimistic"/>
</antcall>
</target>
<target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
<echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy TestNG and dependency JARs, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar to the test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
</target>
<target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="**/framework/*Test.class"/>
</fileset>
<copy file="${file.reference.jfxrt.jar}" todir="dist"/>
<condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
<not>
<os family="mac"/>
</not>
</condition>
<testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
<propertyset>
<propertyref prefix="testjfx-test-sys-prop."/>
<mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
<classpath>
<pathelement path="${testjfx.run.test.classpath}"/>
</classpath>
</testng>
</target>
<target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="**/framework/*Test.class"/>
</fileset>
<testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<propertyset>
<propertyref prefix="testmarkdown-test-sys-prop."/>
<mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<classpath>
<pathelement path="${run.test.classpath}"/>
</classpath>
</testng>
</target>
<target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<fileset id="test.classes" dir="${build.test.classes.dir}">
<include name="**/framework/*Test.class"/>
</fileset>
<testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<propertyset>
<propertyref prefix="nashorn."/>
</propertyset>
<propertyset>
<propertyref prefix="test262-test-sys-prop."/>
<mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<classpath>
<pathelement path="${run.test.classpath}"/>
</classpath>
</testng>
</target>
<target name="test262parallel" depends="test262-parallel"/>
<target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<!-- use just build.test.classes.dir to avoid referring to TestNG -->
<java classname="${parallel.test.runner}" dir="${basedir}" fork="true" failonerror="true">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
<!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
<jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
<classpath>
<pathelement path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test262-test-sys-prop."/>
<mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
</syspropertyset>
</java>
</target>
<target name="testparallel" depends="test-parallel"/>
<target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
<!-- use just build.test.classes.dir to avoid referring to TestNG -->
<java classname="${parallel.test.runner}" dir="${basedir}"
failonerror="true"
fork="true">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
<classpath>
<pathelement path="${run.test.classpath}"/>
<pathelement path="${build.test.classes.dir}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper type="glob" from="test-sys-prop.*" to="*"/>
</syspropertyset>
</java>
</target>
<target name="all" depends="test, docs"
description="Build, test and generate docs for nashorn"/>
<target name="run" depends="jar"
description="Run the shell with a sample script">
<java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="-dump-on-error"/>
<arg value="test.js"/>
</java>
</target>
<target name="debug" depends="jar"
description="Debug the shell with a sample script">
<java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
<arg value="--print-code"/>
<arg value="--verify-code"/>
<arg value="--print-symbols"/>
<jvmarg value="-Dnashorn.codegen.debug=true"/>
<arg value="test.js"/>
</java>
</target>
<!-- targets to get external script tests -->
<!-- test262 test suite -->
<target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
<!-- clone test262 git repo -->
<exec executable="${git.executable}">
<arg value="clone"/>
<arg value="--branch"/>
<arg value="es5-tests"/>
<arg value="https://github.com/tc39/test262"/>
<arg value="${test.external.dir}/test262"/>
</exec>
</target>
<target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
<!-- update test262 git repo -->
<exec executable="${git.executable}" dir="${test.external.dir}/test262">
<arg value="pull"/>
</exec>
</target>
<!-- octane benchmark -->
<target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
<!-- checkout octane benchmarks -->
<exec executable="${git.executable}">
<arg value="clone"/>
<arg value="https://github.com/chromium/octane"/>
<arg value="${test.external.dir}/octane"/>
</exec>
</target>
<target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
<!-- update octane benchmarks -->
<exec executable="${git.executable}" dir="${test.external.dir}/octane">
<arg value="pull"/>
</exec>
</target>
<!-- sunspider benchmark -->
<target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
<!-- checkout sunspider -->
<exec executable="${svn.executable}">
<arg value="--non-interactive"/>
<arg value="--trust-server-cert"/>
<arg value="checkout"/>
<arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
<arg value="${test.external.dir}/sunspider"/>
</exec>
</target>
<target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
<!-- update sunspider -->
<exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
<arg value="--non-interactive"/>
<arg value="--trust-server-cert"/>
<arg value="update"/>
</exec>
</target>
<!-- get all external test scripts -->
<target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
<!-- make external test dir -->
<mkdir dir="${test.external.dir}"/>
<!-- jquery -->
<mkdir dir="${test.external.dir}/jquery"/>
<get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
<get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
<!-- prototype -->
<mkdir dir="${test.external.dir}/prototype"/>
<get src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0/prototype.js" dest="${test.external.dir}/prototype" usetimestamp="true" skipexisting="true" ignoreerrors="true"/>
<!-- underscorejs -->
<mkdir dir="${test.external.dir}/underscore"/>
<get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true" tryGzipEncoding="true"/>
<get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true" tryGzipEncoding="true"/>
<!-- yui -->
<mkdir dir="${test.external.dir}/yui"/>
<get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true" tryGzipEncoding="true"/>
<get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true" tryGzipEncoding="true"/>
<!-- showdown -->
<mkdir dir="${test.external.dir}/showdown"/>
<get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
<get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
</target>
<!-- update external test suites that are pulled from source control systems -->
<target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
<!-- run all perf tests -->
<target name="perf" depends="externals, update-externals, sunspider, octane"/>
<!-- download and install testng.jar -->
<target name="get-testng">
<get dest="${test.lib}" skipexisting="true">
<url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
<url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
<url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
<url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
</get>
</target>
<!-- download and install asmtools.jar -->
<target name="get-asmtools" unless="asmtools.already.present">
<get src="https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/asmtools/lastSuccessfulBuild/artifact/asmtools-6.0.tar.gz" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
<untar src="${test.lib}${file.separator}asmtools-6.0.tar.gz" dest="${test.lib}" compression="gzip"/>
<!-- they are tar.gz'ing a .zip file! -->
<unzip src="${test.lib}${file.separator}asmtools-6.0.zip" dest="${test.lib}">
<patternset>
<include name="asmtools-6.0/lib/asmtools.jar"/>
</patternset>
</unzip>
<move file="${test.lib}${file.separator}asmtools-6.0${file.separator}lib${file.separator}asmtools.jar" tofile="${test.lib}${file.separator}asmtools.jar"/>
<delete dir="${test.lib}${file.separator}asmtools-6.0"/>
</target>
<!-- run all tests -->
<target name="alltests" depends="externals, update-externals, test, test262parallel, testmarkdown, perf"/>
<import file="build-benchmark.xml"/>
</project>

View File

@ -1,34 +0,0 @@
Nasgen is a tool for processing Java classes that implement native
JavaScript objects. It does so by looking for the
com.oracle.nashorn.objects.annotations.ScriptClass annotation and other
annotations in that package.
For each class "C", nasgen instruments the original class and generates
two additional classes: a "C$Prototype" class for the JavaScript
prototype object, and a "C$Constructor" class for the JavaScript
constructor function.
Each class instrumented or generated by nasgen contains a private static
"$nasgenmap$" field of type com.oracle.nashorn.runtime.PropertyMap and
static initializer block to initialize the field to the object's
JavaScript properties.
Members annotated with @Function, @Property, @Getter, and @Setter are
mapped to the $Constructor, $Prototype, or main class, depending on the
value of the annotation's 'where' field. By default, @Property, @Getter,
and @Setter belong to the main class while @Function methods without
explicit 'where' field belong to the $Prototype class. The @Constructor
annotation marks a method to be invoked as JavaScript constructor.
Nasgen enforces all @Function/@Getter/@Setter/@Constructor annotated
methods to be declared as static. Static final @Property fields remain
in the main class while other @Property fields are moved to respective
classes depending on the annotation's 'where' value. For functions
mapped to the $Prototype or $Constructor class, nasgen also generates
getters and setters prefixed by G$ and S$, respectively.
Nasgen-generated classes are hidden from normal ClassLoaders by giving
them a ".clazz" file name extension instead of the standard ".class"
extension. This allows script classes to be loaded independently by each
Nashorn context through the com.oracle.nashorn.runtime.StructureLoader
class loader.

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="nasgen" default="all" basedir=".">
<target name="init">
<loadproperties srcFile="project.properties"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${nasgen.build.classes.dir}"/>
<mkdir dir="${nasgen.dist.dir}"/>
<mkdir dir="${nasgen.dist.dir}/lib"/>
</target>
<target name="clean" depends="init">
<delete dir="${nasgen.build.dir}"/>
<delete dir="${nasgen.dist.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles the nasgen sources">
<javac srcdir="${src.dir}"
destdir="${nasgen.build.classes.dir}"
debug="${javac.debug}"
includeantruntime="false" fork="true">
<compilerarg line="${nasgen.module.imports}"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-XDignore.symbol.file"/>
</javac>
</target>
<target name="jar" depends="compile" description="Creates nasgen.jar">
<jar jarfile="${nasgen.dist.jar}" basedir="${nasgen.build.classes.dir}" manifest="${meta.inf.dir}/MANIFEST.MF"/>
</target>
<target name="dist" depends="jar"/>
<target name="all" depends="dist"
description="Builds sources and generates nasgen.jar"/>
</project>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes" />
<output-test url="file://$MODULE_DIR$/build/test/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="asm" />
</component>
</module>

View File

@ -1,48 +0,0 @@
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
application.title=nasgen
# source and target levels
build.compiler=modern
# This directory is removed when the project is cleaned:
nasgen.build.dir=../../../../build/nashorn/nasgen
nasgen.build.classes.dir=${nasgen.build.dir}/classes
# This directory is removed when the project is cleaned:
nasgen.dist.dir=${nasgen.build.dir}/dist
nasgen.dist.jar=${nasgen.dist.dir}/nasgen.jar
nasgen.dist.javadoc.dir=${nasgen.dist.dir}/javadoc
javac.debug=true
nasgen.module.imports=\
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED
meta.inf.dir=${src.dir}/META-INF
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
run.jvmargs=
src.dir=src

View File

@ -1,4 +0,0 @@
Manifest-Version: 1.0
Class-Path: lib/ant-1.7.1.jar
Main-Class: jdk.nashorn.internal.tools.nasgen.Main

View File

@ -1,397 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKEVIRTUAL;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.ACCESSORPROPERTY_CREATE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.ACCESSORPROPERTY_CREATE_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.ACCESSORPROPERTY_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.ARRAYLIST_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.ARRAYLIST_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.CLINIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.COLLECTIONS_EMPTY_LIST;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.COLLECTIONS_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.COLLECTION_ADD;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.COLLECTION_ADD_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.COLLECTION_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.GETTER_PREFIX;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.GET_CLASS_NAME;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.GET_CLASS_NAME_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.LIST_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.NATIVESYMBOL_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_FIELD_NAME;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_NEWMAP;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_NEWMAP_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETDOCUMENTATIONKEY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SETTER_PREFIX;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SYMBOL_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SYMBOL_PREFIX;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_OBJECT;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Type;
import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
/**
* Base class for class generator classes.
*
*/
public class ClassGenerator {
/** ASM class writer used to output bytecode for this class */
protected final ClassWriter cw;
/**
* Constructor
*/
protected ClassGenerator() {
this.cw = makeClassWriter();
}
MethodGenerator makeStaticInitializer() {
return makeStaticInitializer(cw);
}
MethodGenerator makeConstructor() {
return makeConstructor(cw);
}
MethodGenerator makeMethod(final int access, final String name, final String desc) {
return makeMethod(cw, access, name, desc);
}
void addMapField() {
addMapField(cw);
}
void addField(final String name, final String desc) {
addField(cw, name, desc);
}
void addFunctionField(final String name) {
addFunctionField(cw, name);
}
void addGetter(final String owner, final MemberInfo memInfo) {
addGetter(cw, owner, memInfo);
}
void addSetter(final String owner, final MemberInfo memInfo) {
addSetter(cw, owner, memInfo);
}
void emitGetClassName(final String name) {
final MethodGenerator mi = makeMethod(ACC_PUBLIC, GET_CLASS_NAME, GET_CLASS_NAME_DESC);
mi.loadLiteral(name);
mi.returnValue();
mi.computeMaxs();
mi.visitEnd();
}
static ClassWriter makeClassWriter() {
return new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS) {
@Override
protected String getCommonSuperClass(final String type1, final String type2) {
try {
return super.getCommonSuperClass(type1, type2);
} catch (final RuntimeException | LinkageError e) {
if (MemberInfo.isScriptObject(type1) && MemberInfo.isScriptObject(type2)) {
return StringConstants.SCRIPTOBJECT_TYPE;
}
return StringConstants.OBJECT_TYPE;
}
}
};
}
static MethodGenerator makeStaticInitializer(final ClassVisitor cv) {
return makeStaticInitializer(cv, CLINIT);
}
static MethodGenerator makeStaticInitializer(final ClassVisitor cv, final String name) {
final int access = ACC_PUBLIC | ACC_STATIC;
final String desc = DEFAULT_INIT_DESC;
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
return new MethodGenerator(mv, access, name, desc);
}
static MethodGenerator makeConstructor(final ClassVisitor cv) {
final int access = 0;
final String name = INIT;
final String desc = DEFAULT_INIT_DESC;
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
return new MethodGenerator(mv, access, name, desc);
}
static MethodGenerator makeMethod(final ClassVisitor cv, final int access, final String name, final String desc) {
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
return new MethodGenerator(mv, access, name, desc);
}
static void emitStaticInitPrefix(final MethodGenerator mi, final String className, final int memberCount) {
mi.visitCode();
if (memberCount > 0) {
// new ArrayList(int)
mi.newObject(ARRAYLIST_TYPE);
mi.dup();
mi.push(memberCount);
mi.invokeSpecial(ARRAYLIST_TYPE, INIT, ARRAYLIST_INIT_DESC);
// stack: ArrayList
} else {
// java.util.Collections.EMPTY_LIST
mi.getStatic(COLLECTIONS_TYPE, COLLECTIONS_EMPTY_LIST, LIST_DESC);
// stack List
}
}
static void emitStaticInitSuffix(final MethodGenerator mi, final String className) {
// stack: Collection
// pmap = PropertyMap.newMap(Collection<Property>);
mi.invokeStatic(PROPERTYMAP_TYPE, PROPERTYMAP_NEWMAP, PROPERTYMAP_NEWMAP_DESC);
// $nasgenmap$ = pmap;
mi.putStatic(className, PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC);
mi.returnVoid();
mi.computeMaxs();
mi.visitEnd();
}
@SuppressWarnings("fallthrough")
private static Type memInfoType(final MemberInfo memInfo) {
switch (memInfo.getJavaDesc().charAt(0)) {
case 'I': return Type.INT_TYPE;
case 'J': return Type.LONG_TYPE;
case 'D': return Type.DOUBLE_TYPE;
default: assert false : memInfo.getJavaDesc();
case 'L': return TYPE_OBJECT;
}
}
private static String getterDesc(final MemberInfo memInfo) {
return Type.getMethodDescriptor(memInfoType(memInfo));
}
private static String setterDesc(final MemberInfo memInfo) {
return Type.getMethodDescriptor(Type.VOID_TYPE, memInfoType(memInfo));
}
static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) {
final int access = ACC_PUBLIC;
final String name = GETTER_PREFIX + memInfo.getJavaName();
final String desc = getterDesc(memInfo);
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
final MethodGenerator mi = new MethodGenerator(mv, access, name, desc);
mi.visitCode();
if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) {
mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
} else {
mi.loadLocal(0);
mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
}
mi.returnValue();
mi.computeMaxs();
mi.visitEnd();
}
static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) {
final int access = ACC_PUBLIC;
final String name = SETTER_PREFIX + memInfo.getJavaName();
final String desc = setterDesc(memInfo);
final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
final MethodGenerator mi = new MethodGenerator(mv, access, name, desc);
mi.visitCode();
if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) {
mi.loadLocal(1);
mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
} else {
mi.loadLocal(0);
mi.loadLocal(1);
mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
}
mi.returnVoid();
mi.computeMaxs();
mi.visitEnd();
}
static void addMapField(final ClassVisitor cv) {
// add a PropertyMap static field
final FieldVisitor fv = cv.visitField(ACC_PRIVATE | ACC_STATIC | ACC_FINAL,
PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC, null, null);
if (fv != null) {
fv.visitEnd();
}
}
static void addField(final ClassVisitor cv, final String name, final String desc) {
final FieldVisitor fv = cv.visitField(ACC_PRIVATE, name, desc, null, null);
if (fv != null) {
fv.visitEnd();
}
}
static void addFunctionField(final ClassVisitor cv, final String name) {
addField(cv, name, OBJECT_DESC);
}
static void newFunction(final MethodGenerator mi, final String objName, final String className, final MemberInfo memInfo, final List<MemberInfo> specs) {
final boolean arityFound = (memInfo.getArity() != MemberInfo.DEFAULT_ARITY);
loadFunctionName(mi, memInfo.getName());
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className, memInfo.getJavaName(), memInfo.getJavaDesc(), false));
assert specs != null;
if (!specs.isEmpty()) {
mi.memberInfoArray(className, specs);
mi.invokeStatic(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_CREATEBUILTIN, SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC);
} else {
mi.invokeStatic(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_CREATEBUILTIN, SCRIPTFUNCTION_CREATEBUILTIN_DESC);
}
if (arityFound) {
mi.dup();
mi.push(memInfo.getArity());
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETARITY, SCRIPTFUNCTION_SETARITY_DESC);
}
mi.dup();
mi.loadLiteral(memInfo.getDocumentationKey(objName));
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETDOCUMENTATIONKEY, SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC);
}
static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) {
final String propertyName = memInfo.getName();
// stack: Collection
// dup of Collection instance
mi.dup();
// Load property name, converting to Symbol if it begins with "@@"
loadPropertyKey(mi, propertyName);
// setup flags
mi.push(memInfo.getAttributes());
// setup getter method handle
String javaName = GETTER_PREFIX + memInfo.getJavaName();
mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, getterDesc(memInfo), false));
// setup setter method handle
if (memInfo.isFinal()) {
mi.pushNull();
} else {
javaName = SETTER_PREFIX + memInfo.getJavaName();
mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo), false));
}
// property = AccessorProperty.create(key, flags, getter, setter);
mi.invokeStatic(ACCESSORPROPERTY_TYPE, ACCESSORPROPERTY_CREATE, ACCESSORPROPERTY_CREATE_DESC);
// boolean Collection.add(property)
mi.invokeInterface(COLLECTION_TYPE, COLLECTION_ADD, COLLECTION_ADD_DESC);
// pop return value of Collection.add
mi.pop();
// stack: Collection
}
static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) {
final String propertyName = getter.getName();
// stack: Collection
// dup of Collection instance
mi.dup();
// Load property name, converting to Symbol if it begins with "@@"
loadPropertyKey(mi, propertyName);
// setup flags
mi.push(getter.getAttributes());
// setup getter method handle
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
getter.getJavaName(), getter.getJavaDesc(), false));
// setup setter method handle
if (setter == null) {
mi.pushNull();
} else {
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
setter.getJavaName(), setter.getJavaDesc(), false));
}
// property = AccessorProperty.create(key, flags, getter, setter);
mi.invokeStatic(ACCESSORPROPERTY_TYPE, ACCESSORPROPERTY_CREATE, ACCESSORPROPERTY_CREATE_DESC);
// boolean Collection.add(property)
mi.invokeInterface(COLLECTION_TYPE, COLLECTION_ADD, COLLECTION_ADD_DESC);
// pop return value of Collection.add
mi.pop();
// stack: Collection
}
static ScriptClassInfo getScriptClassInfo(final String fileName) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fileName))) {
return getScriptClassInfo(new ClassReader(bis));
}
}
static ScriptClassInfo getScriptClassInfo(final byte[] classBuf) {
return getScriptClassInfo(new ClassReader(classBuf));
}
private static void loadFunctionName(final MethodGenerator mi, final String propertyName) {
if (propertyName.startsWith(SYMBOL_PREFIX)) {
mi.loadLiteral("Symbol[" + propertyName.substring(2) + "]");
} else {
mi.loadLiteral(propertyName);
}
}
private static void loadPropertyKey(final MethodGenerator mi, final String propertyName) {
if (propertyName.startsWith(SYMBOL_PREFIX)) {
mi.getStatic(NATIVESYMBOL_TYPE, propertyName.substring(2), SYMBOL_DESC);
} else {
mi.loadLiteral(propertyName);
}
}
private static ScriptClassInfo getScriptClassInfo(final ClassReader reader) {
final ScriptClassInfoCollector scic = new ScriptClassInfoCollector();
reader.accept(scic, 0);
return scic.getScriptClassInfo();
}
}

View File

@ -1,281 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.CONSTRUCTOR_SUFFIX;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_FIELD_NAME;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_INIT_DESC3;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_INIT_DESC4;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETDOCUMENTATIONKEY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import jdk.internal.org.objectweb.asm.Handle;
/**
* This class generates constructor class for a @ScriptClass annotated class.
*
*/
public class ConstructorGenerator extends ClassGenerator {
private final ScriptClassInfo scriptClassInfo;
private final String className;
private final MemberInfo constructor;
private final int memberCount;
private final List<MemberInfo> specs;
ConstructorGenerator(final ScriptClassInfo sci) {
this.scriptClassInfo = sci;
this.className = scriptClassInfo.getConstructorClassName();
this.constructor = scriptClassInfo.getConstructor();
this.memberCount = scriptClassInfo.getConstructorMemberCount();
this.specs = scriptClassInfo.getSpecializedConstructors();
}
byte[] getClassBytes() {
// new class extending from ScriptObject
final String superClass = (constructor != null)? SCRIPTFUNCTION_TYPE : SCRIPTOBJECT_TYPE;
cw.visit(V1_7, ACC_FINAL, className, null, superClass, null);
if (memberCount > 0) {
// add fields
emitFields();
// add <clinit>
emitStaticInitializer();
}
// add <init>
emitConstructor();
if (constructor == null) {
emitGetClassName(scriptClassInfo.getName());
}
cw.visitEnd();
return cw.toByteArray();
}
// --Internals only below this point
private void emitFields() {
// Introduce "Function" type instance fields for each
// constructor @Function in script class and introduce instance
// fields for each constructor @Property in the script class.
for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isConstructorFunction()) {
addFunctionField(memInfo.getJavaName());
memInfo = (MemberInfo)memInfo.clone();
memInfo.setJavaDesc(OBJECT_DESC);
memInfo.setJavaAccess(ACC_PUBLIC);
addGetter(className, memInfo);
addSetter(className, memInfo);
} else if (memInfo.isConstructorProperty()) {
if (memInfo.isStaticFinal()) {
addGetter(scriptClassInfo.getJavaName(), memInfo);
} else {
addField(memInfo.getJavaName(), memInfo.getJavaDesc());
memInfo = (MemberInfo)memInfo.clone();
memInfo.setJavaAccess(ACC_PUBLIC);
addGetter(className, memInfo);
addSetter(className, memInfo);
}
}
}
addMapField();
}
private void emitStaticInitializer() {
final MethodGenerator mi = makeStaticInitializer();
emitStaticInitPrefix(mi, className, memberCount);
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isConstructorFunction() || memInfo.isConstructorProperty()) {
linkerAddGetterSetter(mi, className, memInfo);
} else if (memInfo.isConstructorGetter()) {
final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
linkerAddGetterSetter(mi, scriptClassInfo.getJavaName(), memInfo, setter);
}
}
emitStaticInitSuffix(mi, className);
}
private void emitConstructor() {
final MethodGenerator mi = makeConstructor();
mi.visitCode();
callSuper(mi);
if (memberCount > 0) {
// initialize Function type fields
initFunctionFields(mi);
// initialize data fields
initDataFields(mi);
}
if (constructor != null) {
initPrototype(mi);
final int arity = constructor.getArity();
if (arity != MemberInfo.DEFAULT_ARITY) {
mi.loadThis();
mi.push(arity);
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETARITY,
SCRIPTFUNCTION_SETARITY_DESC);
}
mi.loadThis();
mi.loadLiteral(scriptClassInfo.getName());
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETDOCUMENTATIONKEY,
SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC);
}
mi.returnVoid();
mi.computeMaxs();
mi.visitEnd();
}
private void loadMap(final MethodGenerator mi) {
if (memberCount > 0) {
mi.getStatic(className, PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC);
}
}
private void callSuper(final MethodGenerator mi) {
String superClass, superDesc;
mi.loadThis();
if (constructor == null) {
// call ScriptObject.<init>
superClass = SCRIPTOBJECT_TYPE;
superDesc = (memberCount > 0) ? SCRIPTOBJECT_INIT_DESC : DEFAULT_INIT_DESC;
loadMap(mi);
} else {
// call Function.<init>
superClass = SCRIPTFUNCTION_TYPE;
superDesc = (memberCount > 0) ? SCRIPTFUNCTION_INIT_DESC4 : SCRIPTFUNCTION_INIT_DESC3;
mi.loadLiteral(constructor.getName());
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, scriptClassInfo.getJavaName(), constructor.getJavaName(), constructor.getJavaDesc(), false));
loadMap(mi);
mi.memberInfoArray(scriptClassInfo.getJavaName(), specs); //pushes null if specs empty
}
mi.invokeSpecial(superClass, INIT, superDesc);
}
private void initFunctionFields(final MethodGenerator mi) {
assert memberCount > 0;
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (!memInfo.isConstructorFunction()) {
continue;
}
mi.loadThis();
newFunction(mi, scriptClassInfo.getName(), scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
mi.putField(className, memInfo.getJavaName(), OBJECT_DESC);
}
}
private void initDataFields(final MethodGenerator mi) {
assert memberCount > 0;
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (!memInfo.isConstructorProperty() || memInfo.isFinal()) {
continue;
}
final Object value = memInfo.getValue();
if (value != null) {
mi.loadThis();
mi.loadLiteral(value);
mi.putField(className, memInfo.getJavaName(), memInfo.getJavaDesc());
} else if (!memInfo.getInitClass().isEmpty()) {
final String clazz = memInfo.getInitClass();
mi.loadThis();
mi.newObject(clazz);
mi.dup();
mi.invokeSpecial(clazz, INIT, DEFAULT_INIT_DESC);
mi.putField(className, memInfo.getJavaName(), memInfo.getJavaDesc());
}
}
}
private void initPrototype(final MethodGenerator mi) {
assert constructor != null;
mi.loadThis();
final String protoName = scriptClassInfo.getPrototypeClassName();
mi.newObject(protoName);
mi.dup();
mi.invokeSpecial(protoName, INIT, DEFAULT_INIT_DESC);
mi.dup();
mi.loadThis();
mi.invokeStatic(PROTOTYPEOBJECT_TYPE, PROTOTYPEOBJECT_SETCONSTRUCTOR,
PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC);
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETPROTOTYPE, SCRIPTFUNCTION_SETPROTOTYPE_DESC);
}
/**
* Entry point for ConstructorGenerator run separately as an application. Will display
* usage. Takes one argument, a class name.
* @param args args vector
* @throws IOException if class can't be read
*/
public static void main(final String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: " + ConstructorGenerator.class.getName() + " <class>");
System.exit(1);
}
final String className = args[0].replace('.', '/');
final ScriptClassInfo sci = getScriptClassInfo(className + ".class");
if (sci == null) {
System.err.println("No @ScriptClass in " + className);
System.exit(2);
throw new IOException(); // get rid of warning for sci.verify() below - may be null
}
try {
sci.verify();
} catch (final Exception e) {
System.err.println(e.getMessage());
System.exit(3);
}
final ConstructorGenerator gen = new ConstructorGenerator(sci);
try (FileOutputStream fos = new FileOutputStream(className + CONSTRUCTOR_SUFFIX + ".class")) {
fos.write(gen.getClassBytes());
}
}
}

View File

@ -1,187 +0,0 @@
/*
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
/**
* Main class for the "nasgen" tool.
*
*/
public class Main {
/**
* ASM version to be used by nasgen tool.
*/
public static final int ASM_VERSION = Opcodes.ASM7;
private static final boolean DEBUG = Boolean.getBoolean("nasgen.debug");
private interface ErrorReporter {
public void error(String msg);
}
/**
* Public entry point for Nasgen if invoked from command line. Nasgen takes three arguments
* in order: input directory, package list, output directory
*
* @param args argument vector
*/
public static void main(final String[] args) {
final ErrorReporter reporter = new ErrorReporter() {
@Override
public void error(final String msg) {
Main.error(msg, 1);
}
};
if (args.length == 3) {
processAll(args[0], args[1], args[2], reporter);
} else {
error("Usage: nasgen <input-dir> <package-list> <output-dir>", 1);
}
}
private static void processAll(final String in, final String pkgList, final String out, final ErrorReporter reporter) {
final File inDir = new File(in);
if (!inDir.exists() || !inDir.isDirectory()) {
reporter.error(in + " does not exist or not a directory");
return;
}
final File outDir = new File(out);
if (!outDir.exists() || !outDir.isDirectory()) {
reporter.error(out + " does not exist or not a directory");
return;
}
final String[] packages = pkgList.split(":");
for (String pkg : packages) {
pkg = pkg.replace('.', File.separatorChar);
final File dir = new File(inDir, pkg);
final File[] classes = dir.listFiles();
for (final File clazz : classes) {
if (clazz.isFile() && clazz.getName().endsWith(".class")) {
if (! process(clazz, new File(outDir, pkg), reporter)) {
return;
}
}
}
}
}
private static boolean process(final File inFile, final File outDir, final ErrorReporter reporter) {
try {
byte[] buf = new byte[(int)inFile.length()];
try (FileInputStream fin = new FileInputStream(inFile)) {
fin.read(buf);
}
final ScriptClassInfo sci = ClassGenerator.getScriptClassInfo(buf);
if (sci != null) {
try {
sci.verify();
} catch (final Exception e) {
reporter.error(e.getMessage());
return false;
}
// create necessary output package dir
outDir.mkdirs();
// instrument @ScriptClass
final ClassWriter writer = ClassGenerator.makeClassWriter();
final ClassReader reader = new ClassReader(buf);
final ScriptClassInstrumentor inst = new ScriptClassInstrumentor(writer, sci);
reader.accept(inst, 0);
//noinspection UnusedAssignment
// write instrumented class
try (FileOutputStream fos = new FileOutputStream(new File(outDir, inFile.getName()))) {
buf = writer.toByteArray();
if (DEBUG) {
verify(buf);
}
fos.write(buf);
}
// simple class name without package prefix
String simpleName = inFile.getName();
simpleName = simpleName.substring(0, simpleName.indexOf(".class"));
if (sci.isPrototypeNeeded()) {
// generate prototype class
final PrototypeGenerator protGen = new PrototypeGenerator(sci);
buf = protGen.getClassBytes();
if (DEBUG) {
verify(buf);
}
try (FileOutputStream fos = new FileOutputStream(new File(outDir, simpleName + StringConstants.PROTOTYPE_SUFFIX + ".class"))) {
fos.write(buf);
}
}
if (sci.isConstructorNeeded()) {
// generate constructor class
final ConstructorGenerator consGen = new ConstructorGenerator(sci);
buf = consGen.getClassBytes();
if (DEBUG) {
verify(buf);
}
try (FileOutputStream fos = new FileOutputStream(new File(outDir, simpleName + StringConstants.CONSTRUCTOR_SUFFIX + ".class"))) {
fos.write(buf);
}
}
}
return true;
} catch (final IOException | RuntimeException e) {
if (DEBUG) {
e.printStackTrace(System.err);
}
reporter.error(e.getMessage());
return false;
}
}
private static void verify(final byte[] buf) {
final ClassReader cr = new ClassReader(buf);
CheckClassAdapter.verify(cr, false, new PrintWriter(System.err));
}
private static void error(final String msg, final int exitCode) {
System.err.println(msg);
System.exit(exitCode);
}
}

View File

@ -1,613 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_ARRAY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJ_PKG;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.RUNTIME_PKG;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTS_PKG;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.STRING_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_SYMBOL;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
/**
* Details about a Java method or field annotated with any of the field/method
* annotations from the jdk.nashorn.internal.objects.annotations package.
*/
public final class MemberInfo implements Cloneable {
// class loader of this class
private static final ClassLoader MY_LOADER = MemberInfo.class.getClassLoader();
/**
* The different kinds of available class annotations
*/
public static enum Kind {
/**
* This is a script class
*/
SCRIPT_CLASS,
/**
* This is a constructor
*/
CONSTRUCTOR,
/**
* This is a function
*/
FUNCTION,
/**
* This is a getter
*/
GETTER,
/**
* This is a setter
*/
SETTER,
/**
* This is a property
*/
PROPERTY,
/**
* This is a specialized version of a function
*/
SPECIALIZED_FUNCTION,
}
// keep in sync with jdk.nashorn.internal.objects.annotations.Attribute
static final int DEFAULT_ATTRIBUTES = 0x0;
static final int DEFAULT_ARITY = -2;
// the kind of the script annotation - one of the above constants
private MemberInfo.Kind kind;
// script property name
private String name;
// script property attributes
private int attributes;
// name of the java member
private String javaName;
// type descriptor of the java member
private String javaDesc;
// access bits of the Java field or method
private int javaAccess;
// initial value for static @Property fields
private Object value;
// class whose object is created to fill property value
private String initClass;
// arity of the Function or Constructor
private int arity;
private Where where;
private Type linkLogicClass;
private boolean isSpecializedConstructor;
private boolean isOptimistic;
private boolean convertsNumericArgs;
/**
* @return the kind
*/
public Kind getKind() {
return kind;
}
/**
* @param kind the kind to set
*/
public void setKind(final Kind kind) {
this.kind = kind;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(final String name) {
this.name = name;
}
/**
* Tag something as specialized constructor or not
* @param isSpecializedConstructor boolean, true if specialized constructor
*/
public void setIsSpecializedConstructor(final boolean isSpecializedConstructor) {
this.isSpecializedConstructor = isSpecializedConstructor;
}
/**
* Check if something is a specialized constructor
* @return true if specialized constructor
*/
public boolean isSpecializedConstructor() {
return isSpecializedConstructor;
}
/**
* Check if this is an optimistic builtin function
* @return true if optimistic builtin
*/
public boolean isOptimistic() {
return isOptimistic;
}
/**
* Tag something as optimistic builtin or not
* @param isOptimistic boolean, true if builtin constructor
*/
public void setIsOptimistic(final boolean isOptimistic) {
this.isOptimistic = isOptimistic;
}
/**
* Check if this function converts arguments for numeric parameters to numbers
* so it's safe to pass booleans as 0 and 1
* @return true if it is safe to convert arguments to numbers
*/
public boolean convertsNumericArgs() {
return convertsNumericArgs;
}
/**
* Tag this as a function that converts arguments for numeric params to numbers
* @param convertsNumericArgs if true args can be safely converted to numbers
*/
public void setConvertsNumericArgs(final boolean convertsNumericArgs) {
this.convertsNumericArgs = convertsNumericArgs;
}
/**
* Get the SpecializedFunction guard for specializations, i.e. optimistic
* builtins
* @return specialization, null if none
*/
public Type getLinkLogicClass() {
return linkLogicClass;
}
/**
* Set the SpecializedFunction link logic class for specializations, i.e. optimistic
* builtins
* @param linkLogicClass link logic class
*/
public void setLinkLogicClass(final Type linkLogicClass) {
this.linkLogicClass = linkLogicClass;
}
/**
* @return the attributes
*/
public int getAttributes() {
return attributes;
}
/**
* @param attributes the attributes to set
*/
public void setAttributes(final int attributes) {
this.attributes = attributes;
}
/**
* @return the javaName
*/
public String getJavaName() {
return javaName;
}
/**
* @param javaName the javaName to set
*/
public void setJavaName(final String javaName) {
this.javaName = javaName;
}
/**
* @return the javaDesc
*/
public String getJavaDesc() {
return javaDesc;
}
void setJavaDesc(final String javaDesc) {
this.javaDesc = javaDesc;
}
int getJavaAccess() {
return javaAccess;
}
void setJavaAccess(final int access) {
this.javaAccess = access;
}
Object getValue() {
return value;
}
void setValue(final Object value) {
this.value = value;
}
Where getWhere() {
return where;
}
void setWhere(final Where where) {
this.where = where;
}
boolean isFinal() {
return (javaAccess & Opcodes.ACC_FINAL) != 0;
}
boolean isStatic() {
return (javaAccess & Opcodes.ACC_STATIC) != 0;
}
boolean isStaticFinal() {
return isStatic() && isFinal();
}
boolean isInstanceGetter() {
return kind == Kind.GETTER && where == Where.INSTANCE;
}
/**
* Check whether this MemberInfo is a getter that resides in the instance
*
* @return true if instance setter
*/
boolean isInstanceSetter() {
return kind == Kind.SETTER && where == Where.INSTANCE;
}
boolean isInstanceProperty() {
return kind == Kind.PROPERTY && where == Where.INSTANCE;
}
boolean isInstanceFunction() {
return kind == Kind.FUNCTION && where == Where.INSTANCE;
}
boolean isPrototypeGetter() {
return kind == Kind.GETTER && where == Where.PROTOTYPE;
}
boolean isPrototypeSetter() {
return kind == Kind.SETTER && where == Where.PROTOTYPE;
}
boolean isPrototypeProperty() {
return kind == Kind.PROPERTY && where == Where.PROTOTYPE;
}
boolean isPrototypeFunction() {
return kind == Kind.FUNCTION && where == Where.PROTOTYPE;
}
boolean isConstructorGetter() {
return kind == Kind.GETTER && where == Where.CONSTRUCTOR;
}
boolean isConstructorSetter() {
return kind == Kind.SETTER && where == Where.CONSTRUCTOR;
}
boolean isConstructorProperty() {
return kind == Kind.PROPERTY && where == Where.CONSTRUCTOR;
}
boolean isConstructorFunction() {
return kind == Kind.FUNCTION && where == Where.CONSTRUCTOR;
}
boolean isConstructor() {
return kind == Kind.CONSTRUCTOR;
}
void verify() {
switch (kind) {
case CONSTRUCTOR: {
final Type returnType = Type.getReturnType(javaDesc);
if (!isJSObjectType(returnType)) {
error("return value of a @Constructor method should be of Object type, found " + returnType);
}
final Type[] argTypes = Type.getArgumentTypes(javaDesc);
if (argTypes.length < 2) {
error("@Constructor methods should have at least 2 args");
}
if (!argTypes[0].equals(Type.BOOLEAN_TYPE)) {
error("first argument of a @Constructor method should be of boolean type, found " + argTypes[0]);
}
if (!isJavaLangObject(argTypes[1])) {
error("second argument of a @Constructor method should be of Object type, found " + argTypes[0]);
}
if (argTypes.length > 2) {
for (int i = 2; i < argTypes.length - 1; i++) {
if (!isJavaLangObject(argTypes[i])) {
error(i + "'th argument of a @Constructor method should be of Object type, found " + argTypes[i]);
}
}
final String lastArgTypeDesc = argTypes[argTypes.length - 1].getDescriptor();
final boolean isVarArg = lastArgTypeDesc.equals(OBJECT_ARRAY_DESC);
if (!lastArgTypeDesc.equals(OBJECT_DESC) && !isVarArg) {
error("last argument of a @Constructor method is neither Object nor Object[] type: " + lastArgTypeDesc);
}
if (isVarArg && argTypes.length > 3) {
error("vararg of a @Constructor method has more than 3 arguments");
}
}
}
break;
case FUNCTION: {
final Type returnType = Type.getReturnType(javaDesc);
if (!(isValidJSType(returnType) || Type.VOID_TYPE == returnType)) {
error("return value of a @Function method should be a valid JS type, found " + returnType);
}
final Type[] argTypes = Type.getArgumentTypes(javaDesc);
if (argTypes.length < 1) {
error("@Function methods should have at least 1 arg");
}
if (!isJavaLangObject(argTypes[0])) {
error("first argument of a @Function method should be of Object type, found " + argTypes[0]);
}
if (argTypes.length > 1) {
for (int i = 1; i < argTypes.length - 1; i++) {
if (!isJavaLangObject(argTypes[i])) {
error(i + "'th argument of a @Function method should be of Object type, found " + argTypes[i]);
}
}
final String lastArgTypeDesc = argTypes[argTypes.length - 1].getDescriptor();
final boolean isVarArg = lastArgTypeDesc.equals(OBJECT_ARRAY_DESC);
if (!lastArgTypeDesc.equals(OBJECT_DESC) && !isVarArg) {
error("last argument of a @Function method is neither Object nor Object[] type: " + lastArgTypeDesc);
}
if (isVarArg && argTypes.length > 2) {
error("vararg @Function method has more than 2 arguments");
}
}
}
break;
case SPECIALIZED_FUNCTION: {
final Type returnType = Type.getReturnType(javaDesc);
if (!(isValidJSType(returnType) || (isSpecializedConstructor() && Type.VOID_TYPE == returnType))) {
error("return value of a @SpecializedFunction method should be a valid JS type, found " + returnType);
}
final Type[] argTypes = Type.getArgumentTypes(javaDesc);
for (int i = 0; i < argTypes.length; i++) {
if (!isValidJSType(argTypes[i])) {
error(i + "'th argument of a @SpecializedFunction method is not valid JS type, found " + argTypes[i]);
}
}
}
break;
case GETTER: {
final Type[] argTypes = Type.getArgumentTypes(javaDesc);
if (argTypes.length != 1) {
error("@Getter methods should have one argument");
}
if (!isJavaLangObject(argTypes[0])) {
error("first argument of a @Getter method should be of Object type, found: " + argTypes[0]);
}
if (Type.getReturnType(javaDesc).equals(Type.VOID_TYPE)) {
error("return type of getter should not be void");
}
}
break;
case SETTER: {
final Type[] argTypes = Type.getArgumentTypes(javaDesc);
if (argTypes.length != 2) {
error("@Setter methods should have two arguments");
}
if (!isJavaLangObject(argTypes[0])) {
error("first argument of a @Setter method should be of Object type, found: " + argTypes[0]);
}
if (!Type.getReturnType(javaDesc).toString().equals("V")) {
error("return type of of a @Setter method should be void, found: " + Type.getReturnType(javaDesc));
}
}
break;
case PROPERTY: {
if (where == Where.CONSTRUCTOR) {
if (isStatic()) {
if (!isFinal()) {
error("static Where.CONSTRUCTOR @Property should be final");
}
if (!isJSPrimitiveType(Type.getType(javaDesc))) {
error("static Where.CONSTRUCTOR @Property should be a JS primitive");
}
}
} else if (where == Where.PROTOTYPE) {
if (isStatic()) {
if (!isFinal()) {
error("static Where.PROTOTYPE @Property should be final");
}
if (!isJSPrimitiveType(Type.getType(javaDesc))) {
error("static Where.PROTOTYPE @Property should be a JS primitive");
}
}
}
}
break;
default:
break;
}
}
/**
* Returns if the given (internal) name of a class represents a ScriptObject subtype.
*/
public static boolean isScriptObject(final String name) {
// very crude check for ScriptObject subtype!
if (name.startsWith(OBJ_PKG + "Native") ||
name.equals(OBJ_PKG + "Global") ||
name.equals(OBJ_PKG + "ArrayBufferView")) {
return true;
}
if (name.startsWith(RUNTIME_PKG)) {
final String simpleName = name.substring(name.lastIndexOf('/') + 1);
switch (simpleName) {
case "ScriptObject":
case "ScriptFunction":
case "NativeJavaPackage":
case "Scope":
return true;
}
}
if (name.startsWith(SCRIPTS_PKG)) {
final String simpleName = name.substring(name.lastIndexOf('/') + 1);
switch (simpleName) {
case "JD":
case "JO":
return true;
}
}
return false;
}
private static boolean isValidJSType(final Type type) {
return isJSPrimitiveType(type) || isJSObjectType(type);
}
private static boolean isJSPrimitiveType(final Type type) {
switch (type.getSort()) {
case Type.BOOLEAN:
case Type.INT:
case Type.DOUBLE:
return true;
default:
return type != TYPE_SYMBOL;
}
}
private static boolean isJSObjectType(final Type type) {
return isJavaLangObject(type) || isJavaLangString(type) || isScriptObject(type);
}
private static boolean isJavaLangObject(final Type type) {
return type.getDescriptor().equals(OBJECT_DESC);
}
private static boolean isJavaLangString(final Type type) {
return type.getDescriptor().equals(STRING_DESC);
}
private static boolean isScriptObject(final Type type) {
if (type.getSort() != Type.OBJECT) {
return false;
}
return isScriptObject(type.getInternalName());
}
private void error(final String msg) {
throw new RuntimeException(javaName + " of type " + javaDesc + " : " + msg);
}
/**
* @return the initClass
*/
String getInitClass() {
return initClass;
}
/**
* @param initClass the initClass to set
*/
void setInitClass(final String initClass) {
this.initClass = initClass;
}
@Override
protected Object clone() {
try {
return super.clone();
} catch (final CloneNotSupportedException e) {
assert false : "clone not supported " + e;
return null;
}
}
/**
* @return the arity
*/
int getArity() {
return arity;
}
/**
* @param arity the arity to set
*/
void setArity(final int arity) {
this.arity = arity;
}
String getDocumentationKey(final String objName) {
if (kind == Kind.FUNCTION) {
final StringBuilder buf = new StringBuilder(objName);
switch (where) {
case CONSTRUCTOR:
break;
case PROTOTYPE:
buf.append(".prototype");
break;
case INSTANCE:
buf.append(".this");
break;
}
buf.append('.');
buf.append(name);
return buf.toString();
}
return null;
}
}

View File

@ -1,454 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.AALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.AASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.ANEWARRAY;
import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.ASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.BALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.BASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.BIPUSH;
import static jdk.internal.org.objectweb.asm.Opcodes.CALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.CASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.CHECKCAST;
import static jdk.internal.org.objectweb.asm.Opcodes.DALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.DASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.DCONST_0;
import static jdk.internal.org.objectweb.asm.Opcodes.DRETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
import static jdk.internal.org.objectweb.asm.Opcodes.DUP2;
import static jdk.internal.org.objectweb.asm.Opcodes.FALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.FASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.FCONST_0;
import static jdk.internal.org.objectweb.asm.Opcodes.FRETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.GETFIELD;
import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.IALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.IASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0;
import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1;
import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEINTERFACE;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.ISTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.LALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.LASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.LCONST_0;
import static jdk.internal.org.objectweb.asm.Opcodes.LRETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
import static jdk.internal.org.objectweb.asm.Opcodes.POP;
import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
import static jdk.internal.org.objectweb.asm.Opcodes.PUTSTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
import static jdk.internal.org.objectweb.asm.Opcodes.SALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.SASTORE;
import static jdk.internal.org.objectweb.asm.Opcodes.SIPUSH;
import static jdk.internal.org.objectweb.asm.Opcodes.SWAP;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJ_ANNO_PKG;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_INIT2;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_INIT3;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_SPECIALIZATION;
import java.util.List;
import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Type;
/**
* Base class for all method generating classes.
*
*/
public class MethodGenerator extends MethodVisitor {
private final int access;
private final String name;
private final String descriptor;
private final Type returnType;
private final Type[] argumentTypes;
static final Type EMPTY_LINK_LOGIC_TYPE = Type.getType("L" + OBJ_ANNO_PKG + "SpecializedFunction$LinkLogic$Empty;");
MethodGenerator(final MethodVisitor mv, final int access, final String name, final String descriptor) {
super(Main.ASM_VERSION, mv);
this.access = access;
this.name = name;
this.descriptor = descriptor;
this.returnType = Type.getReturnType(descriptor);
this.argumentTypes = Type.getArgumentTypes(descriptor);
}
int getAccess() {
return access;
}
final String getName() {
return name;
}
final String getDescriptor() {
return descriptor;
}
final Type getReturnType() {
return returnType;
}
final Type[] getArgumentTypes() {
return argumentTypes;
}
/**
* Check whether access for this method is static
* @return true if static
*/
protected final boolean isStatic() {
return (getAccess() & ACC_STATIC) != 0;
}
/**
* Check whether this method is a constructor
* @return true if constructor
*/
protected final boolean isConstructor() {
return "<init>".equals(name);
}
void newObject(final String type) {
super.visitTypeInsn(NEW, type);
}
void newObjectArray(final String type) {
super.visitTypeInsn(ANEWARRAY, type);
}
void loadThis() {
if ((access & ACC_STATIC) != 0) {
throw new IllegalStateException("no 'this' inside static method");
}
super.visitVarInsn(ALOAD, 0);
}
void returnValue() {
super.visitInsn(returnType.getOpcode(IRETURN));
}
void returnVoid() {
super.visitInsn(RETURN);
}
// load, store
void arrayLoad(final Type type) {
super.visitInsn(type.getOpcode(IALOAD));
}
void arrayLoad() {
super.visitInsn(AALOAD);
}
void arrayStore(final Type type) {
super.visitInsn(type.getOpcode(IASTORE));
}
void arrayStore() {
super.visitInsn(AASTORE);
}
void loadLiteral(final Object value) {
super.visitLdcInsn(value);
}
void classLiteral(final String className) {
super.visitLdcInsn(className);
}
void loadLocal(final Type type, final int index) {
super.visitVarInsn(type.getOpcode(ILOAD), index);
}
void loadLocal(final int index) {
super.visitVarInsn(ALOAD, index);
}
void storeLocal(final Type type, final int index) {
super.visitVarInsn(type.getOpcode(ISTORE), index);
}
void storeLocal(final int index) {
super.visitVarInsn(ASTORE, index);
}
void checkcast(final String type) {
super.visitTypeInsn(CHECKCAST, type);
}
// push constants/literals
void pushNull() {
super.visitInsn(ACONST_NULL);
}
void push(final int value) {
if (value >= -1 && value <= 5) {
super.visitInsn(ICONST_0 + value);
} else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
super.visitIntInsn(BIPUSH, value);
} else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
super.visitIntInsn(SIPUSH, value);
} else {
super.visitLdcInsn(value);
}
}
void loadClass(final String className) {
super.visitLdcInsn(Type.getObjectType(className));
}
void pop() {
super.visitInsn(POP);
}
// various "dups"
void dup() {
super.visitInsn(DUP);
}
void dup2() {
super.visitInsn(DUP2);
}
void swap() {
super.visitInsn(SWAP);
}
void dupArrayValue(final int arrayOpcode) {
switch (arrayOpcode) {
case IALOAD: case FALOAD:
case AALOAD: case BALOAD:
case CALOAD: case SALOAD:
case IASTORE: case FASTORE:
case AASTORE: case BASTORE:
case CASTORE: case SASTORE:
dup();
break;
case LALOAD: case DALOAD:
case LASTORE: case DASTORE:
dup2();
break;
default:
throw new AssertionError("invalid dup");
}
}
void dupReturnValue(final int returnOpcode) {
switch (returnOpcode) {
case IRETURN:
case FRETURN:
case ARETURN:
super.visitInsn(DUP);
return;
case LRETURN:
case DRETURN:
super.visitInsn(DUP2);
return;
case RETURN:
return;
default:
throw new IllegalArgumentException("not return");
}
}
void dupValue(final Type type) {
switch (type.getSize()) {
case 1:
dup();
break;
case 2:
dup2();
break;
default:
throw new AssertionError("invalid dup");
}
}
void dupValue(final String desc) {
final int typeCode = desc.charAt(0);
switch (typeCode) {
case '[':
case 'L':
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
super.visitInsn(DUP);
break;
case 'J':
case 'D':
super.visitInsn(DUP2);
break;
default:
throw new RuntimeException("invalid signature");
}
}
// push default value of given type desc
void defaultValue(final String desc) {
final int typeCode = desc.charAt(0);
switch (typeCode) {
case '[':
case 'L':
super.visitInsn(ACONST_NULL);
break;
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
super.visitInsn(ICONST_0);
break;
case 'J':
super.visitInsn(LCONST_0);
break;
case 'F':
super.visitInsn(FCONST_0);
break;
case 'D':
super.visitInsn(DCONST_0);
break;
default:
throw new AssertionError("invalid desc " + desc);
}
}
// invokes, field get/sets
void invokeInterface(final String owner, final String method, final String desc) {
super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc, true);
}
void invokeVirtual(final String owner, final String method, final String desc) {
super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc, false);
}
void invokeSpecial(final String owner, final String method, final String desc) {
super.visitMethodInsn(INVOKESPECIAL, owner, method, desc, false);
}
void invokeStatic(final String owner, final String method, final String desc) {
super.visitMethodInsn(INVOKESTATIC, owner, method, desc, false);
}
void putStatic(final String owner, final String field, final String desc) {
super.visitFieldInsn(PUTSTATIC, owner, field, desc);
}
void getStatic(final String owner, final String field, final String desc) {
super.visitFieldInsn(GETSTATIC, owner, field, desc);
}
void putField(final String owner, final String field, final String desc) {
super.visitFieldInsn(PUTFIELD, owner, field, desc);
}
void getField(final String owner, final String field, final String desc) {
super.visitFieldInsn(GETFIELD, owner, field, desc);
}
private static boolean linkLogicIsEmpty(final Type type) {
assert EMPTY_LINK_LOGIC_TYPE != null; //type is ok for null if we are a @SpecializedFunction without any attribs
return EMPTY_LINK_LOGIC_TYPE.equals(type);
}
void memberInfoArray(final String className, final List<MemberInfo> mis) {
if (mis.isEmpty()) {
pushNull();
return;
}
int pos = 0;
push(mis.size());
newObjectArray(SPECIALIZATION_TYPE);
for (final MemberInfo mi : mis) {
dup();
push(pos++);
visitTypeInsn(NEW, SPECIALIZATION_TYPE);
dup();
visitLdcInsn(new Handle(H_INVOKESTATIC, className, mi.getJavaName(), mi.getJavaDesc(), false));
final Type linkLogicClass = mi.getLinkLogicClass();
final boolean linkLogic = !linkLogicIsEmpty(linkLogicClass);
final String ctor = linkLogic ? SPECIALIZATION_INIT3 : SPECIALIZATION_INIT2;
if (linkLogic) {
visitLdcInsn(linkLogicClass);
}
visitInsn(mi.isOptimistic() ? ICONST_1 : ICONST_0);
visitInsn(mi.convertsNumericArgs() ? ICONST_1 : ICONST_0);
visitMethodInsn(INVOKESPECIAL, SPECIALIZATION_TYPE, INIT, ctor, false);
arrayStore(TYPE_SPECIALIZATION);
}
}
void computeMaxs() {
// These values are ignored as we create class writer
// with ClassWriter.COMPUTE_MAXS flag.
super.visitMaxs(Short.MAX_VALUE, Short.MAX_VALUE);
}
// debugging support - print calls
void println(final String msg) {
super.visitFieldInsn(GETSTATIC,
"java/lang/System",
"out",
"Ljava/io/PrintStream;");
super.visitLdcInsn(msg);
super.visitMethodInsn(INVOKEVIRTUAL,
"java/io/PrintStream",
"println",
"(Ljava/lang/String;)V",
false);
}
// print the object on the top of the stack
void printObject() {
super.visitFieldInsn(GETSTATIC,
"java/lang/System",
"out",
"Ljava/io/PrintStream;");
super.visitInsn(SWAP);
super.visitMethodInsn(INVOKEVIRTUAL,
"java/io/PrintStream",
"println",
"(Ljava/lang/Object;)V",
false);
}
}

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.MethodVisitor;
/**
* A visitor that does nothing on visitXXX calls.
*
*/
public class NullVisitor extends ClassVisitor {
NullVisitor() {
super(Main.ASM_VERSION);
}
@Override
public MethodVisitor visitMethod(
final int access,
final String name,
final String desc,
final String signature,
final String[] exceptions) {
return new MethodVisitor(Main.ASM_VERSION) {
@Override
public AnnotationVisitor visitAnnotationDefault() {
return new NullAnnotationVisitor();
}
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
return new NullAnnotationVisitor();
}
};
}
@Override
public FieldVisitor visitField(
final int access,
final String name,
final String desc,
final String signature,
final Object value) {
return new FieldVisitor(Main.ASM_VERSION) {
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
return new NullAnnotationVisitor();
}
};
}
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
return new NullAnnotationVisitor();
}
private static class NullAnnotationVisitor extends AnnotationVisitor {
NullAnnotationVisitor() {
super(Main.ASM_VERSION);
}
}
}

View File

@ -1,180 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_FIELD_NAME;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPE_SUFFIX;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* This class generates prototype class for a @ScriptClass annotated class.
*
*/
public class PrototypeGenerator extends ClassGenerator {
private final ScriptClassInfo scriptClassInfo;
private final String className;
private final int memberCount;
PrototypeGenerator(final ScriptClassInfo sci) {
this.scriptClassInfo = sci;
this.className = scriptClassInfo.getPrototypeClassName();
this.memberCount = scriptClassInfo.getPrototypeMemberCount();
}
byte[] getClassBytes() {
// new class extending from ScriptObject
cw.visit(V1_7, ACC_FINAL | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
if (memberCount > 0) {
// add fields
emitFields();
// add <clinit>
emitStaticInitializer();
}
// add <init>
emitConstructor();
// add getClassName()
emitGetClassName(scriptClassInfo.getName());
cw.visitEnd();
return cw.toByteArray();
}
// --Internals only below this point
private void emitFields() {
// introduce "Function" type instance fields for each
// prototype @Function in script class info
for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isPrototypeFunction()) {
addFunctionField(memInfo.getJavaName());
memInfo = (MemberInfo)memInfo.clone();
memInfo.setJavaDesc(OBJECT_DESC);
addGetter(className, memInfo);
addSetter(className, memInfo);
} else if (memInfo.isPrototypeProperty()) {
if (memInfo.isStaticFinal()) {
addGetter(scriptClassInfo.getJavaName(), memInfo);
} else {
addField(memInfo.getJavaName(), memInfo.getJavaDesc());
memInfo = (MemberInfo)memInfo.clone();
memInfo.setJavaAccess(ACC_PUBLIC);
addGetter(className, memInfo);
addSetter(className, memInfo);
}
}
}
addMapField();
}
private void emitStaticInitializer() {
final MethodGenerator mi = makeStaticInitializer();
emitStaticInitPrefix(mi, className, memberCount);
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isPrototypeFunction() || memInfo.isPrototypeProperty()) {
linkerAddGetterSetter(mi, className, memInfo);
} else if (memInfo.isPrototypeGetter()) {
final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
linkerAddGetterSetter(mi, scriptClassInfo.getJavaName(), memInfo, setter);
}
}
emitStaticInitSuffix(mi, className);
}
private void emitConstructor() {
final MethodGenerator mi = makeConstructor();
mi.visitCode();
mi.loadThis();
if (memberCount > 0) {
// call "super(map$)"
mi.getStatic(className, PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC);
mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC);
// initialize Function type fields
initFunctionFields(mi);
} else {
// call "super()"
mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, DEFAULT_INIT_DESC);
}
mi.returnVoid();
mi.computeMaxs();
mi.visitEnd();
}
private void initFunctionFields(final MethodGenerator mi) {
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (! memInfo.isPrototypeFunction()) {
continue;
}
mi.loadThis();
newFunction(mi, scriptClassInfo.getName(), scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
mi.putField(className, memInfo.getJavaName(), OBJECT_DESC);
}
}
/**
* External entry point for PrototypeGenerator if called from the command line
*
* @param args arguments, takes 1 argument which is the class to process
* @throws IOException if class cannot be read
*/
public static void main(final String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: " + PrototypeGenerator.class.getName() + " <class>");
System.exit(1);
}
final String className = args[0].replace('.', '/');
final ScriptClassInfo sci = getScriptClassInfo(className + ".class");
if (sci == null) {
System.err.println("No @ScriptClass in " + className);
System.exit(2);
throw new AssertionError(); //guard against warning that sci is null below
}
try {
sci.verify();
} catch (final Exception e) {
System.err.println(e.getMessage());
System.exit(3);
}
final PrototypeGenerator gen = new PrototypeGenerator(sci);
try (FileOutputStream fos = new FileOutputStream(className + PROTOTYPE_SUFFIX + ".class")) {
fos.write(gen.getClassBytes());
}
}
}

View File

@ -1,286 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import jdk.internal.org.objectweb.asm.Type;
import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJ_ANNO_PKG;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.RUNTIME_PKG;
/**
* All annotation information from a class that is annotated with
* the annotation com.sun.oracle.objects.annotations.ScriptClass.
*
*/
public final class ScriptClassInfo {
private static String getTypeDescriptor(final String pkg, final String name) {
return "L" + pkg + name + ";";
}
// descriptors for various annotations
static final String SCRIPT_CLASS_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "ScriptClass");
static final String CONSTRUCTOR_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Constructor");
static final String FUNCTION_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Function");
static final String GETTER_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Getter");
static final String SETTER_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Setter");
static final String PROPERTY_ANNO_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Property");
static final String WHERE_ENUM_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "Where");
static final String LINK_LOGIC_DESC = getTypeDescriptor(OBJ_ANNO_PKG, "SpecializedFunction$LinkLogic");
static final String SPECIALIZED_FUNCTION = getTypeDescriptor(OBJ_ANNO_PKG, "SpecializedFunction");
static final Map<String, Kind> annotations = new HashMap<>();
static {
annotations.put(SCRIPT_CLASS_ANNO_DESC, Kind.SCRIPT_CLASS);
annotations.put(FUNCTION_ANNO_DESC, Kind.FUNCTION);
annotations.put(CONSTRUCTOR_ANNO_DESC, Kind.CONSTRUCTOR);
annotations.put(GETTER_ANNO_DESC, Kind.GETTER);
annotations.put(SETTER_ANNO_DESC, Kind.SETTER);
annotations.put(PROPERTY_ANNO_DESC, Kind.PROPERTY);
annotations.put(SPECIALIZED_FUNCTION, Kind.SPECIALIZED_FUNCTION);
}
// name of the script class
private String name;
// member info for script properties
private List<MemberInfo> members = Collections.emptyList();
// java class name that is annotated with @ScriptClass
private String javaName;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(final String name) {
this.name = name;
}
/**
* @return the members
*/
public List<MemberInfo> getMembers() {
return Collections.unmodifiableList(members);
}
/**
* @param members the members to set
*/
public void setMembers(final List<MemberInfo> members) {
this.members = members;
}
MemberInfo getConstructor() {
for (final MemberInfo memInfo : members) {
if (memInfo.getKind() == Kind.CONSTRUCTOR) {
return memInfo;
}
}
return null;
}
List<MemberInfo> getSpecializedConstructors() {
final List<MemberInfo> res = new LinkedList<>();
for (final MemberInfo memInfo : members) {
if (memInfo.isSpecializedConstructor()) {
assert memInfo.getKind() == Kind.SPECIALIZED_FUNCTION;
res.add(memInfo);
}
}
return Collections.unmodifiableList(res);
}
boolean isConstructorNeeded() {
// Constructor class generation is needed if we one or
// more constructor properties are defined or @Constructor
// is defined in the class.
for (final MemberInfo memInfo : members) {
if (memInfo.getKind() == Kind.CONSTRUCTOR ||
memInfo.getWhere() == Where.CONSTRUCTOR) {
return true;
}
}
return false;
}
boolean isPrototypeNeeded() {
// Prototype class generation is needed if we have at least one
// prototype property or @Constructor defined in the class.
for (final MemberInfo memInfo : members) {
if (memInfo.getWhere() == Where.PROTOTYPE || memInfo.isConstructor()) {
return true;
}
}
return false;
}
int getPrototypeMemberCount() {
int count = 0;
for (final MemberInfo memInfo : members) {
switch (memInfo.getKind()) {
case SETTER:
case SPECIALIZED_FUNCTION:
// SETTER was counted when GETTER was encountered.
// SPECIALIZED_FUNCTION was counted as FUNCTION already.
continue;
}
if (memInfo.getWhere() == Where.PROTOTYPE) {
count++;
}
}
return count;
}
int getConstructorMemberCount() {
int count = 0;
for (final MemberInfo memInfo : members) {
switch (memInfo.getKind()) {
case CONSTRUCTOR:
case SETTER:
case SPECIALIZED_FUNCTION:
// SETTER was counted when GETTER was encountered.
// Constructor and constructor SpecializedFunctions
// are not added as members and so not counted.
continue;
}
if (memInfo.getWhere() == Where.CONSTRUCTOR) {
count++;
}
}
return count;
}
int getInstancePropertyCount() {
int count = 0;
for (final MemberInfo memInfo : members) {
switch (memInfo.getKind()) {
case SETTER:
case SPECIALIZED_FUNCTION:
// SETTER was counted when GETTER was encountered.
// SPECIALIZED_FUNCTION was counted as FUNCTION already.
continue;
}
if (memInfo.getWhere() == Where.INSTANCE) {
count++;
}
}
return count;
}
MemberInfo find(final String findJavaName, final String findJavaDesc, final int findAccess) {
for (final MemberInfo memInfo : members) {
if (memInfo.getJavaName().equals(findJavaName) &&
memInfo.getJavaDesc().equals(findJavaDesc) &&
memInfo.getJavaAccess() == findAccess) {
return memInfo;
}
}
return null;
}
List<MemberInfo> findSpecializations(final String methodName) {
final List<MemberInfo> res = new LinkedList<>();
for (final MemberInfo memInfo : members) {
if (memInfo.getName().equals(methodName) &&
memInfo.getKind() == Kind.SPECIALIZED_FUNCTION) {
res.add(memInfo);
}
}
return Collections.unmodifiableList(res);
}
MemberInfo findSetter(final MemberInfo getter) {
assert getter.getKind() == Kind.GETTER : "getter expected";
final String getterName = getter.getName();
final Where getterWhere = getter.getWhere();
for (final MemberInfo memInfo : members) {
if (memInfo.getKind() == Kind.SETTER &&
getterName.equals(memInfo.getName()) &&
getterWhere == memInfo.getWhere()) {
return memInfo;
}
}
return null;
}
/**
* @return the javaName
*/
public String getJavaName() {
return javaName;
}
/**
* @param javaName the javaName to set
*/
void setJavaName(final String javaName) {
this.javaName = javaName;
}
String getConstructorClassName() {
return getJavaName() + StringConstants.CONSTRUCTOR_SUFFIX;
}
String getPrototypeClassName() {
return getJavaName() + StringConstants.PROTOTYPE_SUFFIX;
}
void verify() {
boolean constructorSeen = false;
for (final MemberInfo memInfo : getMembers()) {
if (memInfo.isConstructor()) {
if (constructorSeen) {
error("more than @Constructor method");
}
constructorSeen = true;
}
try {
memInfo.verify();
} catch (final Exception e) {
e.printStackTrace();
error(e.getMessage());
}
}
}
private void error(final String msg) throws RuntimeException {
throw new RuntimeException(javaName + " : " + msg);
}
}

View File

@ -1,365 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.SCRIPT_CLASS_ANNO_DESC;
import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.WHERE_ENUM_DESC;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
/**
* This class collects all @ScriptClass and other annotation information from a
* compiled .class file. Enforces that @Function/@Getter/@Setter/@Constructor
* methods are declared to be 'static'.
*/
public class ScriptClassInfoCollector extends ClassVisitor {
private String scriptClassName;
private List<MemberInfo> scriptMembers;
private String javaClassName;
ScriptClassInfoCollector(final ClassVisitor visitor) {
super(Main.ASM_VERSION, visitor);
}
ScriptClassInfoCollector() {
this(new NullVisitor());
}
private void addScriptMember(final MemberInfo memInfo) {
if (scriptMembers == null) {
scriptMembers = new ArrayList<>();
}
scriptMembers.add(memInfo);
}
@Override
public void visit(final int version, final int access, final String name, final String signature,
final String superName, final String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
javaClassName = name;
}
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
final AnnotationVisitor delegateAV = super.visitAnnotation(desc, visible);
if (SCRIPT_CLASS_ANNO_DESC.equals(desc)) {
return new AnnotationVisitor(Main.ASM_VERSION, delegateAV) {
@Override
public void visit(final String name, final Object value) {
if ("value".equals(name)) {
scriptClassName = (String) value;
}
super.visit(name, value);
}
};
}
return delegateAV;
}
@Override
public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) {
final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value);
return new FieldVisitor(Main.ASM_VERSION, delegateFV) {
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
final AnnotationVisitor delegateAV = super.visitAnnotation(descriptor, visible);
if (ScriptClassInfo.PROPERTY_ANNO_DESC.equals(descriptor)) {
final MemberInfo memInfo = new MemberInfo();
memInfo.setKind(Kind.PROPERTY);
memInfo.setJavaName(fieldName);
memInfo.setJavaDesc(fieldDesc);
memInfo.setJavaAccess(fieldAccess);
if ((fieldAccess & Opcodes.ACC_STATIC) != 0) {
memInfo.setValue(value);
}
addScriptMember(memInfo);
return new AnnotationVisitor(Main.ASM_VERSION, delegateAV) {
// These could be "null" if values are not supplied,
// in which case we have to use the default values.
private String name;
private Integer attributes;
private String clazz = "";
private Where where;
@Override
public void visit(final String annotationName, final Object annotationValue) {
switch (annotationName) {
case "name":
this.name = (String) annotationValue;
break;
case "attributes":
this.attributes = (Integer) annotationValue;
break;
case "clazz":
this.clazz = (annotationValue == null) ? "" : annotationValue.toString();
break;
default:
break;
}
super.visit(annotationName, annotationValue);
}
@Override
public void visitEnum(final String enumName, final String desc, final String enumValue) {
if ("where".equals(enumName) && WHERE_ENUM_DESC.equals(desc)) {
this.where = Where.valueOf(enumValue);
}
super.visitEnum(enumName, desc, enumValue);
}
@Override
public void visitEnd() {
super.visitEnd();
memInfo.setName(name == null ? fieldName : name);
memInfo.setAttributes(attributes == null
? MemberInfo.DEFAULT_ATTRIBUTES : attributes);
clazz = clazz.replace('.', '/');
memInfo.setInitClass(clazz);
memInfo.setWhere(where == null? Where.INSTANCE : where);
}
};
}
return delegateAV;
}
};
}
private void error(final String javaName, final String javaDesc, final String msg) {
throw new RuntimeException(scriptClassName + "." + javaName + javaDesc + " : " + msg);
}
@Override
public MethodVisitor visitMethod(final int methodAccess, final String methodName,
final String methodDesc, final String signature, final String[] exceptions) {
final MethodVisitor delegateMV = super.visitMethod(methodAccess, methodName, methodDesc,
signature, exceptions);
return new MethodVisitor(Main.ASM_VERSION, delegateMV) {
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
final AnnotationVisitor delegateAV = super.visitAnnotation(descriptor, visible);
final Kind annoKind = ScriptClassInfo.annotations.get(descriptor);
if (annoKind != null) {
if ((methodAccess & Opcodes.ACC_STATIC) == 0) {
error(methodName, methodDesc, "nasgen method annotations cannot be on instance methods");
}
final MemberInfo memInfo = new MemberInfo();
// annoKind == GETTER or SPECIALIZED_FUNCTION
memInfo.setKind(annoKind);
memInfo.setJavaName(methodName);
memInfo.setJavaDesc(methodDesc);
memInfo.setJavaAccess(methodAccess);
addScriptMember(memInfo);
return new AnnotationVisitor(Main.ASM_VERSION, delegateAV) {
// These could be "null" if values are not supplied,
// in which case we have to use the default values.
private String name;
private Integer attributes;
private Integer arity;
private Where where;
private boolean isSpecializedConstructor;
private boolean isOptimistic;
private boolean convertsNumericArgs;
private Type linkLogicClass = MethodGenerator.EMPTY_LINK_LOGIC_TYPE;
@Override
public void visit(final String annotationName, final Object annotationValue) {
switch (annotationName) {
case "name":
this.name = (String)annotationValue;
if (name.isEmpty()) {
name = null;
}
break;
case "attributes":
this.attributes = (Integer)annotationValue;
break;
case "arity":
this.arity = (Integer)annotationValue;
break;
case "isConstructor":
assert annoKind == Kind.SPECIALIZED_FUNCTION;
this.isSpecializedConstructor = (Boolean)annotationValue;
break;
case "isOptimistic":
assert annoKind == Kind.SPECIALIZED_FUNCTION;
this.isOptimistic = (Boolean)annotationValue;
break;
case "linkLogic":
this.linkLogicClass = (Type)annotationValue;
break;
case "convertsNumericArgs":
assert annoKind == Kind.SPECIALIZED_FUNCTION;
this.convertsNumericArgs = (Boolean)annotationValue;
break;
default:
break;
}
super.visit(annotationName, annotationValue);
}
@Override
public void visitEnum(final String enumName, final String desc, final String enumValue) {
switch (enumName) {
case "where":
if (WHERE_ENUM_DESC.equals(desc)) {
this.where = Where.valueOf(enumValue);
}
break;
default:
break;
}
super.visitEnum(enumName, desc, enumValue);
}
@SuppressWarnings("fallthrough")
@Override
public void visitEnd() {
super.visitEnd();
if (memInfo.getKind() == Kind.CONSTRUCTOR) {
memInfo.setName(name == null ? scriptClassName : name);
} else {
memInfo.setName(name == null ? methodName : name);
}
memInfo.setAttributes(attributes == null ? MemberInfo.DEFAULT_ATTRIBUTES : attributes);
memInfo.setArity((arity == null)? MemberInfo.DEFAULT_ARITY : arity);
if (where == null) {
// by default @Getter/@Setter belongs to INSTANCE
// @Function belong to PROTOTYPE.
switch (memInfo.getKind()) {
case GETTER:
case SETTER:
where = Where.INSTANCE;
break;
case CONSTRUCTOR:
where = Where.CONSTRUCTOR;
break;
case FUNCTION:
where = Where.PROTOTYPE;
break;
case SPECIALIZED_FUNCTION:
where = isSpecializedConstructor? Where.CONSTRUCTOR : Where.PROTOTYPE;
//fallthru
default:
break;
}
}
memInfo.setWhere(where);
memInfo.setLinkLogicClass(linkLogicClass);
memInfo.setIsSpecializedConstructor(isSpecializedConstructor);
memInfo.setIsOptimistic(isOptimistic);
memInfo.setConvertsNumericArgs(convertsNumericArgs);
}
};
}
return delegateAV;
}
};
}
ScriptClassInfo getScriptClassInfo() {
ScriptClassInfo sci = null;
if (scriptClassName != null) {
sci = new ScriptClassInfo();
sci.setName(scriptClassName);
if (scriptMembers == null) {
scriptMembers = Collections.emptyList();
}
sci.setMembers(scriptMembers);
sci.setJavaName(javaClassName);
}
return sci;
}
/**
* External entry point for ScriptClassInfoCollector if invoked from the command line
* @param args argument vector, args contains a class for which to collect info
* @throws IOException if there were problems parsing args or class
*/
public static void main(final String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: " + ScriptClassInfoCollector.class.getName() + " <class>");
System.exit(1);
}
args[0] = args[0].replace('.', '/');
final ScriptClassInfoCollector scic = new ScriptClassInfoCollector();
try (final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(args[0] + ".class"))) {
final ClassReader reader = new ClassReader(bis);
reader.accept(scic, 0);
}
final ScriptClassInfo sci = scic.getScriptClassInfo();
final PrintStream out = System.out;
if (sci != null) {
out.println("script class: " + sci.getName());
out.println("===================================");
for (final MemberInfo memInfo : sci.getMembers()) {
out.println("kind : " + memInfo.getKind());
out.println("name : " + memInfo.getName());
out.println("attributes: " + memInfo.getAttributes());
out.println("javaName: " + memInfo.getJavaName());
out.println("javaDesc: " + memInfo.getJavaDesc());
out.println("where: " + memInfo.getWhere());
out.println("=====================================");
}
} else {
out.println(args[0] + " is not a @ScriptClass");
}
}
}

View File

@ -1,298 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.$CLINIT$;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.CLINIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
import jdk.internal.org.objectweb.asm.Attribute;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.FieldVisitor;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
/**
* This class instruments the java class annotated with @ScriptClass.
*
* Changes done are:
*
* 1) remove all jdk.nashorn.internal.objects.annotations.* annotations.
* 2) static final @Property fields stay here. Other @Property fields moved to
* respective classes depending on 'where' value of annotation.
* 2) add "Map" type static field named "$map".
* 3) add static initializer block to initialize map.
*/
public class ScriptClassInstrumentor extends ClassVisitor {
private final ScriptClassInfo scriptClassInfo;
private final int memberCount;
private boolean staticInitFound;
ScriptClassInstrumentor(final ClassVisitor visitor, final ScriptClassInfo sci) {
super(Main.ASM_VERSION, visitor);
if (sci == null) {
throw new IllegalArgumentException("Null ScriptClassInfo, is the class annotated?");
}
this.scriptClassInfo = sci;
this.memberCount = scriptClassInfo.getInstancePropertyCount();
}
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
if (ScriptClassInfo.annotations.containsKey(desc)) {
// ignore @ScriptClass
return null;
}
return super.visitAnnotation(desc, visible);
}
@Override
public FieldVisitor visitField(final int fieldAccess, final String fieldName,
final String fieldDesc, final String signature, final Object value) {
final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess);
if (memInfo != null && memInfo.getKind() == Kind.PROPERTY &&
memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) {
// non-instance @Property fields - these have to go elsewhere unless 'static final'
return null;
}
final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc,
signature, value);
return new FieldVisitor(Main.ASM_VERSION, delegateFV) {
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
if (ScriptClassInfo.annotations.containsKey(desc)) {
// ignore script field annotations
return null;
}
return fv.visitAnnotation(desc, visible);
}
@Override
public void visitAttribute(final Attribute attr) {
fv.visitAttribute(attr);
}
@Override
public void visitEnd() {
fv.visitEnd();
}
};
}
@Override
public MethodVisitor visitMethod(final int methodAccess, final String methodName,
final String methodDesc, final String signature, final String[] exceptions) {
final boolean isConstructor = INIT.equals(methodName);
final boolean isStaticInit = CLINIT.equals(methodName);
if (isStaticInit) {
staticInitFound = true;
}
final MethodGenerator delegateMV = new MethodGenerator(super.visitMethod(methodAccess, methodName, methodDesc,
signature, exceptions), methodAccess, methodName, methodDesc);
return new MethodVisitor(Main.ASM_VERSION, delegateMV) {
@Override
public void visitInsn(final int opcode) {
// call $clinit$ just before return from <clinit>
if (isStaticInit && opcode == RETURN) {
super.visitMethodInsn(INVOKESTATIC, scriptClassInfo.getJavaName(),
$CLINIT$, DEFAULT_INIT_DESC, false);
}
super.visitInsn(opcode);
}
@Override
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) {
if (isConstructor && opcode == INVOKESPECIAL &&
INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) {
super.visitMethodInsn(opcode, owner, name, desc, false);
if (memberCount > 0) {
// initialize @Property fields if needed
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isInstanceProperty() && !memInfo.getInitClass().isEmpty()) {
final String clazz = memInfo.getInitClass();
super.visitVarInsn(ALOAD, 0);
super.visitTypeInsn(NEW, clazz);
super.visitInsn(DUP);
super.visitMethodInsn(INVOKESPECIAL, clazz,
INIT, DEFAULT_INIT_DESC, false);
super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(),
memInfo.getJavaName(), memInfo.getJavaDesc());
}
if (memInfo.isInstanceFunction()) {
super.visitVarInsn(ALOAD, 0);
ClassGenerator.newFunction(delegateMV, scriptClassInfo.getName(), scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(),
memInfo.getJavaName(), OBJECT_DESC);
}
}
}
} else {
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
if (ScriptClassInfo.annotations.containsKey(desc)) {
// ignore script method annotations
return null;
}
return super.visitAnnotation(desc, visible);
}
};
}
@Override
public void visitEnd() {
emitFields();
emitStaticInitializer();
emitGettersSetters();
super.visitEnd();
}
private void emitFields() {
// introduce "Function" type instance fields for each
// instance @Function in script class info
final String className = scriptClassInfo.getJavaName();
for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isInstanceFunction()) {
ClassGenerator.addFunctionField(cv, memInfo.getJavaName());
memInfo = (MemberInfo)memInfo.clone();
memInfo.setJavaDesc(OBJECT_DESC);
ClassGenerator.addGetter(cv, className, memInfo);
ClassGenerator.addSetter(cv, className, memInfo);
}
}
// omit addMapField() since instance classes already define a static PropertyMap field
}
void emitGettersSetters() {
if (memberCount > 0) {
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
final String className = scriptClassInfo.getJavaName();
if (memInfo.isInstanceProperty()) {
ClassGenerator.addGetter(cv, className, memInfo);
if (! memInfo.isFinal()) {
ClassGenerator.addSetter(cv, className, memInfo);
}
}
}
}
}
private void emitStaticInitializer() {
final String className = scriptClassInfo.getJavaName();
if (! staticInitFound) {
// no user written <clinit> and so create one
final MethodVisitor mv = ClassGenerator.makeStaticInitializer(this);
mv.visitCode();
mv.visitInsn(RETURN);
mv.visitMaxs(Short.MAX_VALUE, 0);
mv.visitEnd();
}
// Now generate $clinit$
final MethodGenerator mi = ClassGenerator.makeStaticInitializer(this, $CLINIT$);
ClassGenerator.emitStaticInitPrefix(mi, className, memberCount);
if (memberCount > 0) {
for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
if (memInfo.isInstanceProperty() || memInfo.isInstanceFunction()) {
ClassGenerator.linkerAddGetterSetter(mi, className, memInfo);
} else if (memInfo.isInstanceGetter()) {
final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
ClassGenerator.linkerAddGetterSetter(mi, className, memInfo, setter);
}
}
}
ClassGenerator.emitStaticInitSuffix(mi, className);
}
/**
* External entry point for ScriptClassInfoCollector if run from the command line
*
* @param args arguments - one argument is needed, the name of the class to collect info from
*
* @throws IOException if there are problems reading class
*/
public static void main(final String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: " + ScriptClassInstrumentor.class.getName() + " <class>");
System.exit(1);
}
final String fileName = args[0].replace('.', '/') + ".class";
final ScriptClassInfo sci = ClassGenerator.getScriptClassInfo(fileName);
if (sci == null) {
System.err.println("No @ScriptClass in " + fileName);
System.exit(2);
throw new AssertionError(); //guard against warning that sci is null below
}
try {
sci.verify();
} catch (final Exception e) {
System.err.println(e.getMessage());
System.exit(3);
}
final ClassWriter writer = ClassGenerator.makeClassWriter();
try (final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fileName))) {
final ClassReader reader = new ClassReader(bis);
final CheckClassAdapter checker = new CheckClassAdapter(writer);
final ScriptClassInstrumentor instr = new ScriptClassInstrumentor(checker, sci);
reader.accept(instr, 0);
}
try (FileOutputStream fos = new FileOutputStream(fileName)) {
fos.write(writer.toByteArray());
}
}
}

View File

@ -1,150 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
import java.lang.invoke.MethodHandle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import jdk.internal.org.objectweb.asm.Type;
/**
* String constants used for code generation/instrumentation.
*/
@SuppressWarnings("javadoc")
public interface StringConstants {
static final String NASHORN_INTERNAL = "jdk/nashorn/internal/";
static final String OBJ_PKG = NASHORN_INTERNAL + "objects/";
static final String OBJ_ANNO_PKG = OBJ_PKG + "annotations/";
static final String RUNTIME_PKG = NASHORN_INTERNAL + "runtime/";
static final String SCRIPTS_PKG = NASHORN_INTERNAL + "scripts/";
// standard jdk types, methods
static final Type TYPE_METHODHANDLE = Type.getType(MethodHandle.class);
static final Type TYPE_SPECIALIZATION = Type.getType("L" + RUNTIME_PKG + "Specialization;");
static final Type TYPE_SPECIALIZATION_ARRAY = Type.getType("[L" + RUNTIME_PKG + "Specialization;");
static final Type TYPE_OBJECT = Type.getType(Object.class);
static final Type TYPE_STRING = Type.getType(String.class);
static final Type TYPE_CLASS = Type.getType(Class.class);
static final Type TYPE_COLLECTION = Type.getType(Collection.class);
static final Type TYPE_COLLECTIONS = Type.getType(Collections.class);
static final Type TYPE_ARRAYLIST = Type.getType(ArrayList.class);
static final Type TYPE_LIST = Type.getType(List.class);
static final String CLINIT = "<clinit>";
static final String INIT = "<init>";
static final String DEFAULT_INIT_DESC = Type.getMethodDescriptor(Type.VOID_TYPE);
static final String SPECIALIZATION_TYPE = TYPE_SPECIALIZATION.getInternalName();
static final String SPECIALIZATION_INIT2 = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_METHODHANDLE, Type.BOOLEAN_TYPE, Type.BOOLEAN_TYPE);
static final String SPECIALIZATION_INIT3 = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_METHODHANDLE, TYPE_CLASS, Type.BOOLEAN_TYPE, Type.BOOLEAN_TYPE);
static final String OBJECT_TYPE = TYPE_OBJECT.getInternalName();
static final String OBJECT_DESC = TYPE_OBJECT.getDescriptor();
static final String STRING_DESC = TYPE_STRING.getDescriptor();
static final String OBJECT_ARRAY_DESC = Type.getDescriptor(Object[].class);
static final String ARRAYLIST_TYPE = TYPE_ARRAYLIST.getInternalName();
static final String COLLECTION_TYPE = TYPE_COLLECTION.getInternalName();
static final String COLLECTIONS_TYPE = TYPE_COLLECTIONS.getInternalName();
// java.util.Collection.add(Object)
static final String COLLECTION_ADD = "add";
static final String COLLECTION_ADD_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, TYPE_OBJECT);
// java.util.ArrayList.<init>(int)
static final String ARRAYLIST_INIT_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE);
// java.util.Collections.EMPTY_LIST
static final String COLLECTIONS_EMPTY_LIST = "EMPTY_LIST";
static final String LIST_DESC = TYPE_LIST.getDescriptor();
// Nashorn types, methods
static final Type TYPE_ACCESSORPROPERTY = Type.getType("L" + RUNTIME_PKG + "AccessorProperty;");
static final Type TYPE_PROPERTYMAP = Type.getType("L" + RUNTIME_PKG + "PropertyMap;");
static final Type TYPE_PROTOTYPEOBJECT = Type.getType("L" + RUNTIME_PKG + "PrototypeObject;");
static final Type TYPE_SCRIPTFUNCTION = Type.getType("L" + RUNTIME_PKG + "ScriptFunction;");
static final Type TYPE_SCRIPTOBJECT = Type.getType("L" + RUNTIME_PKG + "ScriptObject;");
static final Type TYPE_NATIVESYMBOL = Type.getType("L" + OBJ_PKG + "NativeSymbol;");
static final Type TYPE_SYMBOL = Type.getType("L" + RUNTIME_PKG + "Symbol;");
static final String PROTOTYPE_SUFFIX = "$Prototype";
static final String CONSTRUCTOR_SUFFIX = "$Constructor";
// This field name is known to Nashorn runtime (Context).
// Synchronize the name change, if needed at all.
static final String PROPERTYMAP_FIELD_NAME = "$nasgenmap$";
static final String $CLINIT$ = "$clinit$";
// AccessorProperty
static final String ACCESSORPROPERTY_TYPE = TYPE_ACCESSORPROPERTY.getInternalName();
static final String ACCESSORPROPERTY_CREATE = "create";
static final String ACCESSORPROPERTY_CREATE_DESC =
Type.getMethodDescriptor(TYPE_ACCESSORPROPERTY, TYPE_OBJECT, Type.INT_TYPE, TYPE_METHODHANDLE, TYPE_METHODHANDLE);
// PropertyMap
static final String PROPERTYMAP_TYPE = TYPE_PROPERTYMAP.getInternalName();
static final String PROPERTYMAP_DESC = TYPE_PROPERTYMAP.getDescriptor();
static final String PROPERTYMAP_NEWMAP = "newMap";
static final String PROPERTYMAP_NEWMAP_DESC = Type.getMethodDescriptor(TYPE_PROPERTYMAP, TYPE_COLLECTION);
// PrototypeObject
static final String PROTOTYPEOBJECT_TYPE = TYPE_PROTOTYPEOBJECT.getInternalName();
static final String PROTOTYPEOBJECT_SETCONSTRUCTOR = "setConstructor";
static final String PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT, TYPE_OBJECT);
// ScriptFunction
static final String SCRIPTFUNCTION_TYPE = TYPE_SCRIPTFUNCTION.getInternalName();
static final String SCRIPTFUNCTION_SETARITY = "setArity";
static final String SCRIPTFUNCTION_SETARITY_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE);
static final String SCRIPTFUNCTION_SETDOCUMENTATIONKEY = "setDocumentationKey";
static final String SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING);
static final String SCRIPTFUNCTION_SETPROTOTYPE = "setPrototype";
static final String SCRIPTFUNCTION_SETPROTOTYPE_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT);
static final String SCRIPTFUNCTION_CREATEBUILTIN = "createBuiltin";
static final String SCRIPTFUNCTION_CREATEBUILTIN_DESC =
Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE);
static final String SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC =
Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY);
static final String SCRIPTFUNCTION_INIT_DESC3 =
Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY);
static final String SCRIPTFUNCTION_INIT_DESC4 =
Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_SPECIALIZATION_ARRAY);
// ScriptObject
static final String SCRIPTOBJECT_TYPE = TYPE_SCRIPTOBJECT.getInternalName();
static final String SCRIPTOBJECT_DESC = TYPE_SCRIPTOBJECT.getDescriptor();
static final String SCRIPTOBJECT_INIT_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_PROPERTYMAP);
static final String GETTER_PREFIX = "G$";
static final String SETTER_PREFIX = "S$";
// ScriptObject.getClassName() method.
static final String GET_CLASS_NAME = "getClassName";
static final String GET_CLASS_NAME_DESC = Type.getMethodDescriptor(TYPE_STRING);
// NativeSymbol
static final String NATIVESYMBOL_TYPE = TYPE_NATIVESYMBOL.getInternalName();
static final String SYMBOL_DESC = TYPE_SYMBOL.getDescriptor();
static final String SYMBOL_PREFIX = "@@";
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.tools.nasgen;
/**
* Enum to tell where a Function or Property belongs.
* Note: keep this in sync. with jdk.nashorn.internal.objects.annotations.Where.
*/
public enum Where {
/** this means that the item belongs in the Constructor of an object */
CONSTRUCTOR,
/** this means that the item belongs in the Prototype of an object */
PROTOTYPE,
/** this means that the item belongs in the Instance of an object */
INSTANCE
}

View File

@ -1 +0,0 @@
This project implements an ant task to run Nashorn scripts from ant projects.

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="nashorntask" default="all" basedir=".">
<target name="init">
<loadproperties srcFile="project.properties"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${nashorntask.build.classes.dir}"/>
<mkdir dir="${nashorntask.dist.dir}"/>
</target>
<target name="clean" depends="init">
<delete dir="${nashorntask.build.dir}"/>
<delete dir="${nashorntask.dist.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles the nashorn ant tag sources">
<javac srcdir="${src.dir}"
destdir="${nashorntask.build.classes.dir}"
debug="${javac.debug}"
includeantruntime="true">
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
</javac>
</target>
<target name="jar" depends="compile" description="Creates nashorntask.jar">
<jar jarfile="${nashorntask.dist.jar}" basedir="${nashorntask.build.classes.dir}"/>
</target>
<target name="dist" depends="jar"/>
<target name="all" depends="dist"
description="Builds sources and generates nashorntask.jar"/>
</project>

View File

@ -1,38 +0,0 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
application.title=nashorntask
# source and target levels
build.compiler=modern
# This directory is removed when the project is cleaned:
nashorntask.build.dir=../../../../build/nashorn/nashorntask
nashorntask.build.classes.dir=${nashorntask.build.dir}/classes
# This directory is removed when the project is cleaned:
nashorntask.dist.dir=${nashorntask.build.dir}/dist
nashorntask.dist.jar=${nashorntask.dist.dir}/nashorntask.jar
nashorntask.dist.javadoc.dir=${nashorntask.dist.dir}/javadoc
javac.debug=true
src.dir=src

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.ant;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
/**
* This class implements an ant task to evaluate nashorn scripts
* from ant projects.
*/
public final class NashornTask extends Task {
// Underlying nashorn script engine
private final ScriptEngine engine;
// the current ant project
private Project project;
// the script evaluated by this task
private String script;
public NashornTask() {
final ScriptEngineManager m = new ScriptEngineManager();
this.engine = m.getEngineByName("nashorn");
}
@Override
public void setProject(Project proj) {
this.project = proj;
}
// set the script to be evaluated
public void addText(String text) {
this.script = text;
}
@Override
public void execute() {
// expose project as "project" variable
engine.put("project", project);
// expose this task as "self" variable
engine.put("self", this);
// evaluate specified script
try {
engine.eval(script);
} catch (final ScriptException se) {
throw new BuildException(se);
}
}
}

View File

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="code-coverage" default="generate-code-coverage-report" basedir="..">
<!-- CODE COVERAGE -->
<target name="init-cc-enabled" if="${cc.enabled}">
<echo message="initialize [${jcov}] java coverage"/>
<property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/>
<property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/>
<condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}">
<equals arg1="${jcov}" arg2="dynamic" trim="true"/>
</condition>
<condition property="cc.generate.template" value="true">
<equals arg1="${cc.dynamic.genereate.template}" arg2="true" trim="true"/>
</condition>
<mkdir dir="${cc.dir}"/>
<mkdir dir="${build.dir}/to_be_instrumented"/>
<!-- info -->
<echo message="jcov=${jcov}"/>
<echo message="cc.generate.template=${cc.generate.template}"/>
<echo message="cc.instrument=${cc.instrument}"/>
<echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/>
<echo message="cc.report.dir=${cc.report.dir}"/>
<echo message="cc.merged.xml=${cc.merged.xml}"/>
</target>
<target name="init-cc-disabled" unless="${cc.enabled}">
<property name="run.test.cc.jvmargs" value=""/>
</target>
<target name="prepare-to-be-instrumented" depends="compile" description="Prepares to_be_instrumented dir">
<copy todir="${build.dir}/to_be_instrumented">
<fileset dir="${build.classes.dir}">
<include name="**/*.class"/>
</fileset>
</copy>
</target>
<target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template">
<property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/>
<java classname="com.sun.tdk.jcov.TmplGen">
<arg value="-verbose"/>
<arg line="-include ${cc.include}"/>
<arg line="-type all"/>
<arg line="-template ${cc.template}"/>
<arg value="${cc.instrumented.path}"/>
<classpath>
<pathelement location="${jcov.jar}"/>
</classpath>
</java>
<java classname="com.sun.tdk.jcov.RepGen">
<arg value="-verbose"/>
<arg line="-output ${cc.dir}/CC_template_report"/>
<arg value="${cc.template}"/>
<classpath>
<pathelement location="${jcov.jar}"/>
</classpath>
</java>
</target>
<target name="init-cc" depends="init-cc-disabled, init-cc-enabled">
<property name="run.test.cc.jvmargs" value=""/>
</target>
<target name="init-cc-cleanup" if="${cc.enabled}">
<delete dir="${cc.dir}" failonerror="false" />
<delete dir="${build.dir}/to_be_instrumented" failonerror="false" />
</target>
<target name="check-merging-files" depends="init">
<echo message="checking avalibility of ${cc.template}"/>
<condition property="nothing-to-merge" value="true">
<not>
<available file="${cc.template}"/>
</not>
</condition>
<echo message="nothing-to-merge = ${nothing-to-merge}"/>
</target>
<target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}">
<echo message="making pre-merge workaround due to missed template"/>
<move todir="${cc.dir}" includeemptydirs="false">
<fileset dir="${cc.dir}">
<include name="*.xml"/>
</fileset>
<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/>
</move>
</target>
<target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}">
<echo message="merging files"/>
<fileset dir="${cc.dir}" id="cc.xmls">
<include name="**/*_${jcov}_*.xml"/>
<include name="**/CC_template.xml"/>
</fileset>
<pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/>
<echo message="merging files - ${cc.all.xmls}" />
<java classname="com.sun.tdk.jcov.Merger">
<arg value="-verbose"/>
<arg value="-output"/>
<arg value="${cc.merged.xml}"/>
<arg value="-exclude"/>
<arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.javaadapters*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.objects\.annotations*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.scripts*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.lookup\.MethodHandleFactory*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.test\.framework*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.test\.models*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.ir\.debug*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.runtime\.regexp\.joni\.bench*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.runtime\.DebugLogger*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.runtime\.Timing*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.runtime\.Logging*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.runtime\.Debug*"/>
<arg value="-exclude"/>
<arg value="jdk\.nashorn\.internal\.objects\.NativeDebug*"/>
<arg line="${cc.all.xmls}"/>
<classpath>
<pathelement location="${jcov.jar}"/>
</classpath>
</java>
</target>
<target name="generate-code-coverage-report" depends="merge-code-coverage">
<java classname="com.sun.tdk.jcov.RepGen">
<arg value="-verbose"/>
<!-- <arg line ="-exclude_list CC.report.exclude"/> -->
<arg line="-output ${cc.report.dir}"/>
<arg value="${cc.merged.xml}"/>
<classpath>
<pathelement location="${jcov.jar}"/>
</classpath>
</java>
</target>
</project>

View File

@ -1,280 +0,0 @@
module:java.base
java.io
java.lang
java.lang.annotation
java.lang.invoke
java.lang.module
java.lang.ref
java.lang.reflect
java.math
java.net
java.net.spi
java.nio
java.nio.channels
java.nio.channels.spi
java.nio.charset
java.nio.charset.spi
java.nio.file
java.nio.file.attribute
java.nio.file.spi
java.security
java.security.acl
java.security.cert
java.security.interfaces
java.security.spec
java.text
java.text.spi
java.time
java.time.chrono
java.time.format
java.time.temporal
java.time.zone
java.util
java.util.concurrent
java.util.concurrent.atomic
java.util.concurrent.locks
java.util.function
java.util.jar
java.util.regex
java.util.spi
java.util.stream
java.util.zip
javax.crypto
javax.crypto.interfaces
javax.crypto.spec
javax.net
javax.net.ssl
javax.security.auth
javax.security.auth.callback
javax.security.auth.login
javax.security.auth.spi
javax.security.auth.x500
javax.security.cert
module:java.compiler
javax.annotation.processing
javax.lang.model
javax.lang.model.element
javax.lang.model.type
javax.lang.model.util
javax.tools
module:java.datatransfer
java.awt.datatransfer
module:java.desktop
java.applet
java.awt
java.awt.color
java.awt.desktop
java.awt.dnd
java.awt.event
java.awt.font
java.awt.geom
java.awt.im
java.awt.im.spi
java.awt.image
java.awt.image.renderable
java.awt.print
java.beans
java.beans.beancontext
javax.accessibility
javax.imageio
javax.imageio.event
javax.imageio.metadata
javax.imageio.plugins.bmp
javax.imageio.plugins.jpeg
javax.imageio.plugins.tiff
javax.imageio.spi
javax.imageio.stream
javax.print
javax.print.attribute
javax.print.attribute.standard
javax.print.event
javax.sound.midi
javax.sound.midi.spi
javax.sound.sampled
javax.sound.sampled.spi
javax.swing
javax.swing.border
javax.swing.colorchooser
javax.swing.event
javax.swing.filechooser
javax.swing.plaf
javax.swing.plaf.basic
javax.swing.plaf.metal
javax.swing.plaf.multi
javax.swing.plaf.nimbus
javax.swing.plaf.synth
javax.swing.table
javax.swing.text
javax.swing.text.html
javax.swing.text.html.parser
javax.swing.text.rtf
javax.swing.tree
javax.swing.undo
module:java.instrument
java.lang.instrument
module:java.logging
java.util.logging
module:java.management
java.lang.management
javax.management
javax.management.loading
javax.management.modelmbean
javax.management.monitor
javax.management.openmbean
javax.management.relation
javax.management.remote
javax.management.timer
module:java.management.rmi
javax.management.remote.rmi
module:java.naming
javax.naming
javax.naming.directory
javax.naming.event
javax.naming.ldap
javax.naming.spi
module:java.net.http
java.net.http
module:java.prefs
java.util.prefs
module:java.rmi
java.rmi
java.rmi.activation
java.rmi.dgc
java.rmi.registry
java.rmi.server
javax.rmi.ssl
module:java.scripting
javax.script
module:java.se
module:java.security.jgss
javax.security.auth.kerberos
org.ietf.jgss
module:java.security.sasl
javax.security.sasl
module:java.smartcardio
javax.smartcardio
module:java.sql
java.sql
javax.sql
module:java.sql.rowset
javax.sql.rowset
javax.sql.rowset.serial
javax.sql.rowset.spi
module:java.transaction.xa
javax.transaction.xa
module:java.xml
javax.xml
javax.xml.catalog
javax.xml.datatype
javax.xml.namespace
javax.xml.parsers
javax.xml.stream
javax.xml.stream.events
javax.xml.stream.util
javax.xml.transform
javax.xml.transform.dom
javax.xml.transform.sax
javax.xml.transform.stax
javax.xml.transform.stream
javax.xml.validation
javax.xml.xpath
org.w3c.dom
org.w3c.dom.bootstrap
org.w3c.dom.events
org.w3c.dom.ls
org.w3c.dom.ranges
org.w3c.dom.traversal
org.w3c.dom.views
org.xml.sax
org.xml.sax.ext
org.xml.sax.helpers
module:java.xml.crypto
javax.xml.crypto
javax.xml.crypto.dom
javax.xml.crypto.dsig
javax.xml.crypto.dsig.dom
javax.xml.crypto.dsig.keyinfo
javax.xml.crypto.dsig.spec
module:jdk.accessibility
com.sun.java.accessibility.util
module:jdk.attach
com.sun.tools.attach
com.sun.tools.attach.spi
module:jdk.charsets
module:jdk.compiler
com.sun.source.doctree
com.sun.source.tree
com.sun.source.util
com.sun.tools.javac
module:jdk.crypto.cryptoki
module:jdk.crypto.ec
module:jdk.dynalink
jdk.dynalink
jdk.dynalink.beans
jdk.dynalink.linker
jdk.dynalink.linker.support
jdk.dynalink.support
module:jdk.editpad
module:jdk.hotspot.agent
module:jdk.httpserver
com.sun.net.httpserver
com.sun.net.httpserver.spi
module:jdk.jartool
com.sun.jarsigner
jdk.security.jarsigner
module:jdk.javadoc
com.sun.javadoc
com.sun.tools.javadoc
jdk.javadoc.doclet
module:jdk.jcmd
module:jdk.jconsole
com.sun.tools.jconsole
module:jdk.jdeps
module:jdk.jdi
com.sun.jdi
com.sun.jdi.connect
com.sun.jdi.connect.spi
com.sun.jdi.event
com.sun.jdi.request
module:jdk.jdwp.agent
module:jdk.jfr
jdk.jfr
jdk.jfr.consumer
module:jdk.jlink
module:jdk.jshell
jdk.jshell
jdk.jshell.execution
jdk.jshell.spi
jdk.jshell.tool
module:jdk.jsobject
netscape.javascript
module:jdk.jstatd
module:jdk.localedata
module:jdk.management
com.sun.management
module:jdk.management.agent
module:jdk.management.jfr
jdk.management.jfr
module:jdk.naming.dns
module:jdk.naming.rmi
module:jdk.net
jdk.net
jdk.nio
module:jdk.scripting.nashorn
jdk.nashorn.api.scripting
jdk.nashorn.api.tree
module:jdk.sctp
com.sun.nio.sctp
module:jdk.security.auth
com.sun.security.auth
com.sun.security.auth.callback
com.sun.security.auth.login
com.sun.security.auth.module
module:jdk.security.jgss
com.sun.security.jgss
module:jdk.xml.dom
org.w3c.dom.css
org.w3c.dom.html
org.w3c.dom.stylesheets
org.w3c.dom.xpath
module:jdk.zipfs

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<excludeList>
</excludeList>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<excludeList>
<test id="JDK-8014647.js" />
<test id="javaclassoverrides.js" />
<test id="JDK-8020809.js" />
</excludeList>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project basedir=".." name="nashorn-IDE">
<target name="debug-selected-file-in-src">
<fail unless="test.class">Must set property 'debug.class'</fail>
<nbjpdastart addressproperty="jpda.address" name="nashorn" transport="dt_socket">
<classpath path="${run.test.classpath}"/>
</nbjpdastart>
<ant antfile="build.xml" inheritall="false" target="test">
<property name="test.class" value="${test.class}"/>
<property name="debug.test.jvmargs" value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
</ant>
</target>
</project>

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project basedir="../.." name="nashorn-IDE">
<import file="../build.xml"/>
<!-- TODO: edit the following target according to your needs -->
<!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html#debugj2se) -->
<target depends="jar" description="Run the shell with a sample script" name="debug-nb">
<nbjpdastart addressproperty="jpda.address" name="nashorn" transport="dt_socket">
<classpath path="${run.test.classpath}"/>
</nbjpdastart>
<java classname="jdk.nashorn.tools.Shell" classpath="${run.test.classpath}" dir="samples" fork="true">
<jvmarg line="-Dnashorn.optimistic"/>
<jvmarg line="${nashorn.override.path}"/>
<jvmarg line="${run.test.jvmargs}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
</java>
</target>
</project>

View File

@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><project name="jdk" basedir=".">
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<description>
Permits selection of a JDK to use when building and running project.
See: http://www.netbeans.org/issues/show_bug.cgi?id=64160
</description>
<target name="-jdk-pre-preinit">
<condition property="nbjdk.active-or-nbjdk.home">
<or>
<and>
<isset property="nbjdk.active"/>
<not>
<equals arg1="${nbjdk.active}" arg2="default_platform"/>
</not>
</and>
<and>
<isset property="nbjdk.home"/>
<not>
<isset property="nbjdk.home.defaulted"/>
</not>
</and>
</or>
</condition>
</target>
<target xmlns:common="http://java.netbeans.org/freeform/jdk.xml" name="-jdk-preinit" depends="-jdk-pre-preinit" if="nbjdk.active-or-nbjdk.home">
<macrodef name="property" uri="http://java.netbeans.org/freeform/jdk.xml">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<common:property name="nbjdk.home" value="platforms.${nbjdk.active}.home"/>
<common:property name="nbjdk.javac.tmp" value="platforms.${nbjdk.active}.javac"/>
<condition property=".exe" value=".exe">
<os family="windows"/>
</condition>
<property name=".exe" value=""/>
<condition property="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}">
<equals arg1="${nbjdk.javac.tmp}" arg2="$${platforms.${nbjdk.active}.javac}"/>
</condition>
<property name="nbjdk.javac" value="${nbjdk.javac.tmp}"/>
<common:property name="nbjdk.java.tmp" value="platforms.${nbjdk.active}.java"/>
<condition property="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}">
<equals arg1="${nbjdk.java.tmp}" arg2="$${platforms.${nbjdk.active}.java}"/>
</condition>
<property name="nbjdk.java" value="${nbjdk.java.tmp}"/>
<common:property name="nbjdk.javadoc.tmp" value="platforms.${nbjdk.active}.javadoc"/>
<condition property="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}">
<equals arg1="${nbjdk.javadoc.tmp}" arg2="$${platforms.${nbjdk.active}.javadoc}"/>
</condition>
<property name="nbjdk.javadoc" value="${nbjdk.javadoc.tmp}"/>
<common:property name="nbjdk.bootclasspath.tmp" value="platforms.${nbjdk.active}.bootclasspath"/>
<condition property="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar">
<equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
</condition>
<property name="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.tmp}"/>
<condition property="nbjdk.valid">
<and>
<available file="${nbjdk.home}" type="dir"/>
<available file="${nbjdk.javac}" type="file"/>
<available file="${nbjdk.java}" type="file"/>
<available file="${nbjdk.javadoc}" type="file"/>
</and>
</condition>
<echo level="verbose">nbjdk.active=${nbjdk.active} nbjdk.home=${nbjdk.home} nbjdk.java=${nbjdk.java} nbjdk.javac=${nbjdk.javac} nbjdk.javadoc=${nbjdk.javadoc} nbjdk.bootclasspath=${nbjdk.bootclasspath} nbjdk.valid=${nbjdk.valid} have-jdk-1.4=${have-jdk-1.4} have-jdk-1.5=${have-jdk-1.5}</echo>
</target>
<target name="-jdk-warn" depends="-jdk-preinit" if="nbjdk.active-or-nbjdk.home" unless="nbjdk.valid">
<property name="jdkhome.presumed" location="${java.home}/.."/>
<echo level="warning">Warning: nbjdk.active=${nbjdk.active} or nbjdk.home=${nbjdk.home} is an invalid Java platform; ignoring and using ${jdkhome.presumed}</echo>
</target>
<target name="-jdk-presetdef-basic" depends="-jdk-preinit" if="nbjdk.valid" unless="nbjdk.presetdef.basic.done">
<macrodef name="javac-presetdef">
<attribute name="javacval"/>
<sequential>
<presetdef name="javac">
<javac fork="yes" executable="@{javacval}"/>
</presetdef>
</sequential>
</macrodef>
<javac-presetdef javacval="${nbjdk.javac}"/>
<macrodef name="java-presetdef">
<attribute name="javaval"/>
<sequential>
<presetdef name="java">
<java fork="yes" jvm="@{javaval}"/>
</presetdef>
</sequential>
</macrodef>
<java-presetdef javaval="${nbjdk.java}"/>
<macrodef name="javadoc-presetdef">
<attribute name="javadocval"/>
<sequential>
<presetdef name="javadoc">
<javadoc executable="@{javadocval}"/>
</presetdef>
</sequential>
</macrodef>
<javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
<macrodef name="junit-presetdef">
<attribute name="javaval"/>
<sequential>
<presetdef name="junit">
<junit fork="yes" jvm="@{javaval}"/>
</presetdef>
</sequential>
</macrodef>
<junit-presetdef javaval="${nbjdk.java}"/>
<property name="nbjdk.presetdef.basic.done" value="true"/>
</target>
<target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" if="nbjdk.valid" unless="nbjdk.presetdef.nbjpdastart.done">
<macrodef name="nbjpdastart-presetdef">
<attribute name="bootcpval"/>
<sequential>
<presetdef name="nbjpdastart">
<nbjpdastart>
<bootclasspath>
<path path="@{bootcpval}"/>
</bootclasspath>
</nbjpdastart>
</presetdef>
</sequential>
</macrodef>
<nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
<property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
</target>
<target name="-jdk-default" unless="nbjdk.active-or-nbjdk.home">
<property name="java.home.parent" location="${java.home}/.."/>
<condition property="nbjdk.home" value="${java.home.parent}">
<available file="${java.home.parent}/lib/tools.jar" type="file"/>
</condition>
<condition property="nbjdk.home" value="${java.home}">
<available file="${java.home}/lib/tools.jar" type="file"/>
</condition>
<condition property="nbjdk.home" value="/Library/Java/Home">
<available file="/Library/Java/Home" type="dir"/>
</condition>
<property name="nbjdk.home" location="${java.home.parent}"/>
<property name="nbjdk.home.defaulted" value="true"/>
</target>
<target name="-jdk-init" depends="-jdk-preinit,-jdk-warn,-jdk-presetdef-basic,-jdk-default"/>
</project>

View File

@ -1,24 +0,0 @@
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
nbjdk.active=JDK_9

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project basedir="..">
<property file="../global.properties"/>
<property file="nbproject/nbjdk.properties"/>
<property location="${netbeans.user}/build.properties" name="user.properties.file"/>
<property file="${user.properties.file}"/>
<import file="jdk.xml"/>
<target depends="-jdk-init" name="jar">
<ant inheritall="false" target="jar"/>
</target>
<target depends="-jdk-init" name="clean">
<ant inheritall="false" target="clean"/>
</target>
<target depends="-jdk-init" name="javadoc">
<ant inheritall="false" target="javadoc"/>
</target>
<target depends="-jdk-init" name="test">
<ant inheritall="false" target="test"/>
</target>
<target depends="-jdk-init" name="run">
<ant inheritall="false" target="run"/>
</target>
<target depends="-jdk-init,-jdk-presetdef-nbjpdastart" name="debug-nb">
<ant antfile="nbproject/ide-targets.xml" inheritall="false" target="debug-nb"/>
</target>
</project>

View File

@ -1,212 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<name>nashorn</name>
</general-data>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>nashorn</name>
<properties/>
<folders>
<source-folder>
<label>nashorn</label>
<location>.</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../test/src</label>
<location>../test/src</location>
</source-folder>
<source-folder>
<label>../buildtools/nasgen/src</label>
<location>../buildtools/nasgen/src</location>
</source-folder>
<source-folder>
<label>../src/jdk.scripting.nashorn/share/classes</label>
<location>../src/jdk.scripting.nashorn/share/classes</location>
</source-folder>
<source-folder>
<label>../src/jdk.scripting.nashorn.shell/share/classes</label>
<location>../src/jdk.scripting.nashorn.shell/share/classes</location>
</source-folder>
<source-folder>
<label>../test/src</label>
<type>java</type>
<location>../test/src</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../buildtools/nasgen/src</label>
<type>java</type>
<location>../buildtools/nasgen/src</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../src/jdk.scripting.nashorn/share/classes</label>
<type>java</type>
<location>../src/jdk.scripting.nashorn/share/classes</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../src/jdk.scripting.nashorn.shell/share/classes</label>
<type>java</type>
<location>../src/jdk.scripting.nashorn.shell/share/classes</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../src/jdk.dynalink/share/classes</label>
<type>java</type>
<location>../src/jdk.dynalink/share/classes</location>
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
<label>../src/jdk.dynalink/share/classes</label>
<location>../src/jdk.dynalink/share/classes</location>
</source-folder>
</folders>
<ide-actions>
<action name="build">
<script>nbproject/nbjdk.xml</script>
<target>jar</target>
</action>
<action name="clean">
<script>nbproject/nbjdk.xml</script>
<target>clean</target>
</action>
<action name="javadoc">
<script>nbproject/nbjdk.xml</script>
<target>javadoc</target>
</action>
<action name="test">
<script>nbproject/nbjdk.xml</script>
<target>test</target>
</action>
<action name="rebuild">
<script>nbproject/nbjdk.xml</script>
<target>clean</target>
<target>jar</target>
</action>
<action name="run">
<script>nbproject/nbjdk.xml</script>
<target>run</target>
</action>
<action name="debug">
<script>nbproject/nbjdk.xml</script>
<target>debug-nb</target>
</action>
<action name="run.single">
<script>build.xml</script>
<target>test</target>
<context>
<property>test.class</property>
<folder>../test/src</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.single">
<script>nbproject/ide-file-targets.xml</script>
<target>debug-selected-file-in-src</target>
<context>
<property>test.class</property>
<folder>../test/src</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
</ide-actions>
<view>
<items>
<source-folder style="packages">
<label>../test/src</label>
<location>../test/src</location>
</source-folder>
<source-folder style="packages">
<label>../buildtools/nasgen/src</label>
<location>../buildtools/nasgen/src</location>
</source-folder>
<source-folder style="packages">
<label>../src/jdk.scripting.nashorn/share/classes</label>
<location>../src/jdk.scripting.nashorn/share/classes</location>
</source-folder>
<source-folder style="packages">
<label>../src/jdk.scripting.nashorn.shell/share/classes</label>
<location>../src/jdk.scripting.nashorn.shell/share/classes</location>
</source-folder>
<source-folder style="packages">
<label>../src/jdk.dynalink/share/classes</label>
<location>../src/jdk.dynalink/share/classes</location>
</source-folder>
<source-file>
<location>build.xml</location>
</source-file>
</items>
<context-menu>
<ide-action name="build"/>
<ide-action name="rebuild"/>
<ide-action name="clean"/>
<ide-action name="javadoc"/>
<ide-action name="run"/>
<ide-action name="test"/>
<ide-action name="debug"/>
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
<compilation-unit>
<package-root>../test/src</package-root>
<unit-tests/>
<classpath mode="compile">../test/lib/testng.jar:../build/classes:../src/jdk.scripting.nashorn/share/classes</classpath>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>../buildtools/nasgen/src</package-root>
<classpath mode="compile">../build/classes:../src</classpath>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>../src/jdk.scripting.nashorn/share/classes</package-root>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>../src/jdk.scripting.nashorn.shell/share/classes</package-root>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
<package-root>../src/jdk.dynalink/share/classes</package-root>
<source-level>1.8</source-level>
</compilation-unit>
</java-data>
</configuration>
</project>

View File

@ -1,492 +0,0 @@
#
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
application.title=nashorn
# location of JDK embedded ASM sources
jdk.java.base.dir=src/java.base/share/classes
jdk.asm.src.dir=${jdk.java.base.dir}/jdk/internal/org/objectweb/asm
# location of JDK embedded jline sources
jdk.jline.src.dir=src/jdk.internal.le/share/classes
# source and target levels
build.compiler=modern
jdk.build.dir=build
nashorn.make.dir=make/nashorn
javadoc.base.url=https://docs.oracle.com/en/java/javase/11/docs/api/
javadoc.element.list=make/nashorn
javadoc.option=\
-tag "implSpec:a:Implementation Requirements:" \
-tag "implNote:a:Implementation Note:" \
-tag "moduleGraph:a:Module Graph"
# nashorn version information
nashorn.version=0.1
nashorn.fullversion=0.1
nashorn.product.name=Oracle Nashorn
# This directory is removed when the project is cleaned:
build.dir=${jdk.build.dir}/nashorn
build.classes.dir=${build.dir}/classes
build.zip=${build.dir}/nashorn.zip
build.gzip=${build.dir}/nashorn.tar.gz
nashorn.override.option=\
--patch-module jdk.scripting.nashorn=${build.classes.dir}/jdk.scripting.nashorn \
--patch-module jdk.scripting.nashorn.shell=${build.classes.dir}/jdk.scripting.nashorn.shell \
--patch-module jdk.dynalink=${build.classes.dir}/jdk.dynalink
# project directory of <nashorn> ant task
nashorntask.dir=${nashorn.make.dir}/buildtools/nashorntask
nashorntask.dist.dir=${build.dir}/nashorntask/dist
# nashorn Shell tool
nashorn.shell.tool=jdk.nashorn.tools.Shell
# nasgen tool
nasgen.tool=jdk.nashorn.internal.tools.nasgen.Main
nasgen.module.imports=\
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED
# parallel test runner tool
parallel.test.runner=jdk.nashorn.internal.test.framework.ParallelTestRunner
# test classes directory
build.test.classes.dir=${build.dir}/test/classes
# nashorn test jar - internal tests jar and api tests jar
nashorn.internal.tests.jar=${build.dir}/nashorn-internal-tests.jar
nashorn.api.tests.jar=${build.dir}/nashorn-api-tests.jar
# test results directory
build.test.results.dir=${build.dir}/test/reports
build.nosecurity.test.results.dir=${build.dir}/test/nosecurity/reports
build.nooptimistic.test.results.dir=${build.dir}/test/nooptimistic/reports
# This directory is removed when the project is cleaned:
dist.dir=build/nashorn/dist
dynalink.jar=${dist.dir}/dynalink.jar
nashorn.jar=${dist.dir}/nashorn.jar
jjs.jar=${dist.dir}/jjs.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.nashornapi.javadoc.dir=${dist.javadoc.dir}/nashornapi
dist.dynalinkapi.javadoc.dir=${dist.javadoc.dir}/dynalinkapi
# configuration for flight recorder
run.test.jvmargs.jfr=XX:StartFlightRecording=disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128
# test library location
test.lib=test/nashorn/lib
# jars refererred
file.reference.testng.jar=${test.lib}${file.separator}testng-6.8.jar
file.reference.jcommander.jar=${test.lib}${file.separator}jcommander-1.27.jar
file.reference.bsh.jar=${test.lib}${file.separator}bsh-2.0b4.jar
file.reference.snakeyaml.jar=${test.lib}${file.separator}snakeyaml-1.6.jar
file.reference.asmtools.jar=${test.lib}${file.separator}asmtools-60.jar
# TestNG ant task classpath
testng.ant.classpath=\
${file.reference.testng.jar}${path.separator}\
${file.reference.jcommander.jar}${path.separator}\
${file.reference.bsh.jar}${path.separator}\
${file.reference.snakeyaml.jar}${path.separator}
# Set testng verbose level
# From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed)
# Actually, this is a lie: you can specify -1 and this will put TestNG in
# debug mode (no longer slicing off stack traces and all)."
testng.verbose=2
# TestNG listeners - we want to replace TestNG's own JUnit
# reporter, but want everything else provided by default
# Unfortunately, we've to clone the other default reporters here.
testng.listeners=\
org.testng.reporters.SuiteHTMLReporter, \
org.testng.reporters.TestHTMLReporter, \
org.testng.reporters.jq.Main, \
org.testng.reporters.FailedReporter, \
org.testng.reporters.XMLReporter \
org.testng.reporters.EmailableReporter, \
jdk.nashorn.internal.test.framework.JSJUnitReportReporter
javac.debug=true
javac.encoding=ascii
javac.test.classpath=\
${build.test.classes.dir}${path.separator}\
${file.reference.testng.jar}${path.separator}\
${file.reference.jcommander.jar}${path.separator}\
${file.reference.bsh.jar}${path.separator}\
${file.reference.snakeyaml.jar}
test.module.imports.compile.time=\
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.ir=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.codegen=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.parser=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.objects=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.events=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp.joni=ALL-UNNAMED \
--add-exports jdk.scripting.nashorn/jdk.nashorn.tools=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
test.module.imports.runtime=\
${test.module.imports.compile.time} \
--add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED \
--add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED
meta.inf.dir=${nashorn.module.src.dir}/META-INF
run.classpath=\
${build.classes.dir}
# test scripts to run
test.dir=test/nashorn
test.nosecurity.dir=${test.dir}/script/nosecurity
test.script.dir=${test.dir}/script
test.basic.dir=${test.script.dir}/basic
test.maptests.dir=${test.script.dir}/maptests
test.error.dir=${test.script.dir}/error
test.sandbox.dir=${test.script.dir}/sandbox
test.trusted.dir=${test.script.dir}/trusted
test.external.dir=${test.script.dir}/external
test262.dir=${test.external.dir}/test262
test262.suite.dir=${test262.dir}/test/suite
testjfx.dir=${test.script.dir}/jfx
testmarkdown.dir=${test.script.dir}/markdown
test-sys-prop.test.dir=${test.dir}
test-sys-prop.test.js.roots=${test.basic.dir} ${test.maptests.dir} ${test.error.dir} ${test.sandbox.dir} ${test.trusted.dir}
test-sys-prop.test262.suite.dir=${test262.suite.dir}
test-sys-prop.es5conform.testcases.dir=${test.external.dir}/ES5Conform/TestCases
test-sys-prop.test.basic.dir=${test.basic.dir}
test-sys-prop.test.external.dir=${test.external.dir}
test-sys-prop.test.maptests.dir=${test.maptests.dir}
test-sys-prop.test.sandbox.dir=${test.sandbox.dir}
test-sys-prop.test.trusted.dir=${test.trusted.dir}
test-sys-prop-no-security.test.dir=${test.dir}
test-sys-prop-no-security.test.js.roots=${test.nosecurity.dir}
# framework root for our script tests
test-sys-prop.test.js.framework=${test.script.dir}/assert.js
test-sys-prop-no-security.test.js.framework=${test.script.dir}/assert.js
# Control the verbosity of ParserTest
test-sys-prop.parsertest.verbose=false
# turn on/off scripting mode for parser tests
test-sys-prop.parsertest.scripting=true
test-sys-prop.parserapitest.verbose=false
# turn on/off test262 scripts for parser tests
test-sys-prop.parsertest.test262=false
test-sys-prop.parserapitest.test262=false
# Control the verbosity of the CompilerTest
test-sys-prop.compilertest.verbose=false
# turn on/off scripting mode for compiler tests
test-sys-prop.compilertest.scripting=true
# turn on/off test262 scripts for compiler tests
test-sys-prop.compilertest.test262=false
# test directory to be excluded.
test-sys-prop.test.js.exclude.dir=${test.script.dir}/currently-failing ${test.external.dir}
# run everything that's js in here, without checking file headers for test annotations
test-sys-prop.test.js.unchecked.dir=${test262.dir}
# test root for octane
octane-test-sys-prop.test.js.roots=${test.external.dir}/octane/
# run octane benchmars in separate processes? (recommended)
octane-test-sys-prop.separate.process=true
# framework root for octane
octane-test-sys-prop.test.js.framework=${test.basic.dir}/run-octane.js
# test root for sunspider
sunspider-test-sys-prop.test.js.roots=${test.external.dir}/sunspider/tests/sunspider-1.0.2/
# framework root for sunspider
sunspider-test-sys-prop.test.js.framework=${test.basic.dir}/runsunspider.js
# list of tests to be excluded
sunspider-test-sys-prop.test.js.exclude.list=
# execute our script tests in shared nashorn context or not?
test-sys-prop.test.js.shared.context=false
# execute test262 tests in shared nashorn context or not?
test262-test-sys-prop.test.js.shared.context=true
# test262 test root
test262-test-sys-prop.test.js.roots=${test262.suite.dir}
# test262 enable/disable strict mode tests
test262-test-sys-prop.test.js.enable.strict.mode=true
# file containing test262 tests to be excluded
# test262-test-sys-prop.test.js.excludes.file=${test262.dir}/test/config/excludelist.xml
# list of test262 files to be excluded
test262-test-sys-prop.test.js.exclude.list=\
${test262.suite.dir}/ch07/7.4/S7.4_A6.js \
${test262.suite.dir}/ch07/7.8/7.8.5/S7.8.5_A1.4_T2.js \
${test262.suite.dir}/ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-170.js
# list of test262 test dirs to be excluded
test262-test-sys-prop.test.js.exclude.dir=\
${test262.suite.dir}/intl402/ \
${test262.suite.dir}/bestPractice/
test262-test-sys-prop.test.failed.list.file=${build.dir}/test/failedTests
# test262 test frameworks
test262-test-sys-prop.test.js.framework=\
--class-cache-size=10 \
--no-java \
--no-typed-arrays \
-timezone=PST \
${test.script.dir}/test262.js \
${test262.dir}/test/harness/framework.js \
${test262.dir}/test/harness/sta.js
# testmarkdown test root
testmarkdown-test-sys-prop.test.js.roots=${testmarkdown.dir}
# execute testmarkdown tests in shared nashorn context or not?
testmarkdown-test-sys-prop.test.js.shared.context=false
# framework root for markdown script tests
testmarkdown-test-sys-prop.test.js.framework=\
${test.script.dir}${file.separator}markdown.js
# testjfx test root
testjfx-test-sys-prop.test.js.roots=${testjfx.dir}
# execute testjfx tests in shared nashorn context or not?
testjfx-test-sys-prop.test.js.shared.context=false
# framework root for our script tests
testjfx-test-sys-prop.test.js.framework=\
-fx \
${test.script.dir}${file.separator}jfx.js
file.reference.jemmyfx.jar=${test.lib}${file.separator}JemmyFX.jar
file.reference.jemmycore.jar=${test.lib}${file.separator}JemmyCore.jar
file.reference.jemmyawtinput.jar=${test.lib}${file.separator}JemmyAWTInput.jar
file.reference.jfxrt.jar=${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar
testjfx.run.test.classpath=\
${file.reference.jemmyfx.jar}${path.separator}\
${file.reference.jemmycore.jar}${path.separator}\
${file.reference.jemmyawtinput.jar}${path.separator}\
${file.reference.testng.jar}${path.separator}\
${file.reference.jcommander.jar}${path.separator}\
${file.reference.bsh.jar}${path.separator}\
${file.reference.snakeyaml.jar}${path.separator}\
${nashorn.internal.tests.jar}${path.separator}\
${nashorn.api.tests.jar}
# testjfx VM options for script tests with @fork option
testjfx-test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${testjfx.run.test.classpath}
run.test.classpath=\
${file.reference.testng.jar}${path.separator}\
${file.reference.jcommander.jar}${path.separator}\
${file.reference.bsh.jar}${path.separator}\
${file.reference.snakeyaml.jar}${path.separator}\
${nashorn.internal.tests.jar}${path.separator}\
${nashorn.api.tests.jar}
dynalink.module.src.dir=src/jdk.dynalink/share/classes
dynalink.module.classes.dir=${build.classes.dir}/jdk.dynalink
nashorn.module.src.dir=src/jdk.scripting.nashorn/share/classes
nashorn.module.classes.dir=${build.classes.dir}/jdk.scripting.nashorn
nashorn.shell.module.src.dir=src/jdk.scripting.nashorn.shell/share/classes
nashorn.shell.module.classes.dir=${build.classes.dir}/jdk.scripting.nashorn.shell
src.dir=${dynalink.module.src.dir}${path.separator}\
${nashorn.module.src.dir}${path.separator}\
${nashorn.shell.module.src.dir}${path.separator}\
${jdk.jline.src.dir}
test.src.dir=test/nashorn/src
# -Xmx is used for all tests, -Xms only for octane benchmark
run.test.xmx=2G
run.test.xms=2G
# uncomment this jfr.args to enable flight recordings. the stack needs to be cranked up to 1024 frames,
# or everything will as of the now drown in lambda forms and be cut off.
#
#jfr.args=-XX:StartFlightRecording=disk=true,dumponexit=true,dumponexitpath="test_suite.jfr",stackdepth=1024
jfr.args=
run.test.user.language=tr
run.test.user.country=TR
run.test.jvmargs.common=\
-server \
${test.module.imports.runtime} \
${run.test.jvmargs.external} \
--add-modules jdk.scripting.nashorn.shell \
${nashorn.override.option} \
-Dfile.encoding=UTF-8 \
-Duser.language=${run.test.user.language} \
-Duser.country=${run.test.user.country} \
-Dnashorn.typeInfo.cacheDir=${build.dir}${file.separator}test${file.separator}type_info_cache \
-Dnashorn.args.prepend=--no-deprecation-warning \
${jfr.args} \
-XX:+HeapDumpOnOutOfMemoryError
# turn on assertions for tests
run.test.jvmargs.main=${run.test.jvmargs.common} -esa -ea
# Extra jvmargs that might be useful for debugging
# and performance improvements/monitoring
#
# -XX:+UnlockDiagnosticVMOptions
#
# turn off compressed class pointers in metaspace
# -XX:-UseCompressedKlassPointers
#
# dump the heap after every GC
# -XX:+PrintHeapAtGC
#
# manually set a metaspace size for class data
# -XX:ClassMetaspaceSize=300M
#
# print out methods compiled
# -XX:+PrintCompilation
#
# print all compiled nmethods with oopmaps and lots of other info
# -XX:+PrintNMethods
#
# activate the generic "UseNewCode" flag to test whatever functionality
# lies behind it. This is the preferred way to test a, yet flagless,
# feature in HotSpot - for example, the uncommon trap placement fix
# was hidden behind this flag before it became the default
#
# -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode
#
# Crank up the type profile level to 222, which has some warmup
# penalties, but produces much better code for JavaScript, where better
# and more intrusive type profiling is required to get rid of
# a large amount of unnecessary guard code, that could not otherwise
# be eliminated
#
# -XX:TypeProfileLevel=222
#
# Use best known performance options for octane
run.test.jvmargs.octane.main=${run.test.jvmargs.common} -XX:TypeProfileLevel=222
# Security manager args - make sure that we run with the nashorn.policy that the build creates
run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${build.dir}/nashorn.policy -Djava.security.properties=${build.dir}/nashorn.security.properties
# VM options for script tests with @fork option
test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -cp ${run.test.classpath}
# VM options for no-security script tests with @fork option - same as above but without jvmsecurityargs
test-sys-prop-no-security.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${run.test.classpath}
# path of rhino.jar for benchmarks
rhino.dir=
rhino.jar=${rhino.dir}/js.jar
v8.shell=d8
# How many iterations should 'ant octane' run for each
# benchmark
octane.iterations=25
# List of octane tests to run, as properties prefixed with
# "octane.benchmark." mapping to the benchmark name in
# the test harness
#
# Octane tests that are disabled should have their entire line
# commented out Tests may be disabled for functionality reasons when
# they have bugs or when the runtime doesn't handle them (yet)
octane.benchmark.box2d=box2d
#octane.benchmark.code-load=code-load
octane.benchmark.crypto=crypto
octane.benchmark.deltablue=deltablue
octane.benchmark.earley-boyer=earley-boyer
octane.benchmark.gbemu=gbemu
octane.benchmark.navier-stokes=navier-stokes
octane.benchmark.mandreel=mandreel
octane.benchmark.pdfjs=pdfjs
octane.benchmark.raytrace=raytrace
octane.benchmark.regexp=regexp
octane.benchmark.richards=richards
octane.benchmark.splay=splay
#octane.benchmark.typescript=typescript
#octane.benchmark.zlib=zlib
#path to rhino jar file
octaneperf-sys-prop.rhino.jar=${rhino.jar}
#timeout for performance tests in minutes
octaneperf-sys-prop.timeout.value=10
#how many iterations to run sunspider after warmup
sunspider.iterations=3000
#################
# code coverage #
#################
#enable/disable code coverage; please redifine in the ${user.home}/.nashorn.project.local.properties
make.code.coverage=false
#type of codecoverage; one of static or dynamic. Now only dynamic is supported
jcov=dynamic
#naming of CC results
#NB directory specified in the cc.dir will be cleaned up!!!
cc.dir=${build.dir}/Codecoverage_Nashorn
cc.result.file.name=CC_${jcov}_nashorn.xml
#dynamic CC parameters; please redefine in the ${user.home}/.nashorn.project.local.properties
jcov2.lib.dir=${build.dir}/jcov2/lib
jcov.jar=${jcov2.lib.dir}/jcov.jar
cc.include=jdk\.nashorn\.*
cc.exclude=jdk\.nashorn\.internal\.scripts\.*
cc.dynamic.genereate.template=true
cc.template=${cc.dir}/CC_template.xml
cc.dynamic.args=-javaagent:${jcov.jar}=include=${cc.include},exclude=${cc.exclude},type=all,verbose=0,file=${cc.dir}/${cc.result.file.name}

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -24,5 +24,5 @@
# Simple wrapper script to call Nashorn with the javascript pandoc filter
@@BOOT_JDK@@/bin/jjs @@JJS_FLAGS@@ -scripting \
@@JJS@@ -scripting \
"@@TOPDIR@@/make/scripts/pandoc-html-manpage-filter.js" 2> /dev/null

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -24,5 +24,5 @@
# Simple wrapper script to call Nashorn with the javascript pandoc filter
@@BOOT_JDK@@/bin/jjs @@JJS_FLAGS@@ -scripting \
@@JJS@@ -scripting \
"@@TOPDIR@@/make/scripts/pandoc-troff-manpage-filter.js" 2> /dev/null

View File

@ -52,7 +52,7 @@ $(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \
BIN := $(FH_SUPPORT)/classes, \
DISABLED_WARNINGS := deprecation serial try, \
DISABLED_WARNINGS := serial try, \
COPY := .properties, \
CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \
JAR := $(FH_JAR), \

View File

@ -77,7 +77,7 @@ $(eval $(call SetupJavaCompilation, BUILD_INDIFY, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(TOPDIR)/test/jdk/java/lang/invoke, \
INCLUDE_FILES := indify/Indify.java, \
DISABLED_WARNINGS := rawtypes unchecked serial deprecation, \
DISABLED_WARNINGS := rawtypes serial, \
BIN := $(MICROBENCHMARK_TOOLS_CLASSES), \
))
@ -99,7 +99,7 @@ $(eval $(call SetupJavaCompiler, MICROBENCHMARK_JAVA_COMPILER, \
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
SETUP := MICROBENCHMARK_JAVA_COMPILER, \
ADD_JAVAC_FLAGS := -cp $(MICROBENCHMARK_CLASSPATH), \
DISABLED_WARNINGS := processing rawtypes cast serial deprecation, \
DISABLED_WARNINGS := processing rawtypes cast serial, \
SRC := $(MICROBENCHMARK_SRC), \
BIN := $(MICROBENCHMARK_CLASSES), \
))

View File

@ -1097,9 +1097,9 @@ source %{
_NO_SPECIAL_PTR_REG_mask = _ALL_REG_mask;
_NO_SPECIAL_PTR_REG_mask.SUBTRACT(_NON_ALLOCATABLE_REG_mask);
// r27 is not allocatable when compressed oops is on, compressed klass
// pointers doesn't use r27 after JDK-8234794
if (UseCompressedOops) {
// r27 is not allocatable when compressed oops is on and heapbase is not
// zero, compressed klass pointers doesn't use r27 after JDK-8234794
if (UseCompressedOops && CompressedOops::ptrs_base() != NULL) {
_NO_SPECIAL_REG32_mask.Remove(OptoReg::as_OptoReg(r27->as_VMReg()));
_NO_SPECIAL_REG_mask.SUBTRACT(_HEAPBASE_REG_mask);
_NO_SPECIAL_PTR_REG_mask.SUBTRACT(_HEAPBASE_REG_mask);
@ -2170,15 +2170,6 @@ const uint Matcher::vector_ideal_reg(int len) {
return 0;
}
const uint Matcher::vector_shift_count_ideal_reg(int size) {
switch(size) {
case 8: return Op_VecD;
case 16: return Op_VecX;
}
ShouldNotReachHere();
return 0;
}
// AES support not yet implemented
const bool Matcher::pass_original_key_for_aes() {
return false;
@ -2213,7 +2204,7 @@ const bool Matcher::need_masked_shift_count = false;
// No support for generic vector operands.
const bool Matcher::supports_generic_vector_operands = false;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
ShouldNotReachHere(); // generic vector operands not supported
return NULL;
}
@ -7486,19 +7477,17 @@ instruct storeN(iRegN src, memory4 mem)
ins_pipe(istore_reg_mem);
%}
instruct storeImmN0(iRegIHeapbase heapbase, immN0 zero, memory4 mem)
instruct storeImmN0(immN0 zero, memory4 mem)
%{
match(Set mem (StoreN mem zero));
predicate(CompressedOops::base() == NULL &&
CompressedKlassPointers::base() == NULL &&
(!needs_releasing_store(n)));
predicate(!needs_releasing_store(n));
ins_cost(INSN_COST);
format %{ "strw rheapbase, $mem\t# compressed ptr (rheapbase==0)" %}
format %{ "strw zr, $mem\t# compressed ptr" %}
ins_encode(aarch64_enc_strw(heapbase, mem));
ins_encode(aarch64_enc_strw0(mem));
ins_pipe(istore_reg_mem);
ins_pipe(istore_mem);
%}
// Store Float
@ -8450,17 +8439,6 @@ instruct castII(iRegI dst)
ins_pipe(pipe_class_empty);
%}
instruct castLL(iRegL dst)
%{
match(Set dst (CastLL dst));
size(0);
format %{ "# castLL of $dst" %}
ins_encode(/* empty encoding */);
ins_cost(0);
ins_pipe(pipe_class_empty);
%}
// ============================================================================
// Atomic operation instructions
//
@ -16033,318 +16011,318 @@ instruct replicate2D(vecX dst, vRegD src)
// ====================REDUCTION ARITHMETIC====================================
instruct reduce_add2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegINoSp tmp, iRegINoSp tmp2)
instruct reduce_add2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, iRegINoSp tmp, iRegINoSp tmp2)
%{
match(Set dst (AddReductionVI src1 src2));
match(Set dst (AddReductionVI isrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP tmp2);
format %{ "umov $tmp, $src2, S, 0\n\t"
"umov $tmp2, $src2, S, 1\n\t"
"addw $tmp, $src1, $tmp\n\t"
format %{ "umov $tmp, $vsrc, S, 0\n\t"
"umov $tmp2, $vsrc, S, 1\n\t"
"addw $tmp, $isrc, $tmp\n\t"
"addw $dst, $tmp, $tmp2\t# add reduction2I"
%}
ins_encode %{
__ umov($tmp$$Register, as_FloatRegister($src2$$reg), __ S, 0);
__ umov($tmp2$$Register, as_FloatRegister($src2$$reg), __ S, 1);
__ addw($tmp$$Register, $src1$$Register, $tmp$$Register);
__ umov($tmp$$Register, as_FloatRegister($vsrc$$reg), __ S, 0);
__ umov($tmp2$$Register, as_FloatRegister($vsrc$$reg), __ S, 1);
__ addw($tmp$$Register, $isrc$$Register, $tmp$$Register);
__ addw($dst$$Register, $tmp$$Register, $tmp2$$Register);
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_add4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegINoSp tmp2)
instruct reduce_add4I(iRegINoSp dst, iRegIorL2I isrc, vecX vsrc, vecX vtmp, iRegINoSp itmp)
%{
match(Set dst (AddReductionVI src1 src2));
match(Set dst (AddReductionVI isrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP tmp2);
format %{ "addv $tmp, T4S, $src2\n\t"
"umov $tmp2, $tmp, S, 0\n\t"
"addw $dst, $tmp2, $src1\t# add reduction4I"
effect(TEMP vtmp, TEMP itmp);
format %{ "addv $vtmp, T4S, $vsrc\n\t"
"umov $itmp, $vtmp, S, 0\n\t"
"addw $dst, $itmp, $isrc\t# add reduction4I"
%}
ins_encode %{
__ addv(as_FloatRegister($tmp$$reg), __ T4S,
as_FloatRegister($src2$$reg));
__ umov($tmp2$$Register, as_FloatRegister($tmp$$reg), __ S, 0);
__ addw($dst$$Register, $tmp2$$Register, $src1$$Register);
__ addv(as_FloatRegister($vtmp$$reg), __ T4S,
as_FloatRegister($vsrc$$reg));
__ umov($itmp$$Register, as_FloatRegister($vtmp$$reg), __ S, 0);
__ addw($dst$$Register, $itmp$$Register, $isrc$$Register);
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_mul2I(iRegINoSp dst, iRegIorL2I src1, vecD src2, iRegINoSp tmp)
instruct reduce_mul2I(iRegINoSp dst, iRegIorL2I isrc, vecD vsrc, iRegINoSp tmp)
%{
match(Set dst (MulReductionVI src1 src2));
match(Set dst (MulReductionVI isrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "umov $tmp, $src2, S, 0\n\t"
"mul $dst, $tmp, $src1\n\t"
"umov $tmp, $src2, S, 1\n\t"
format %{ "umov $tmp, $vsrc, S, 0\n\t"
"mul $dst, $tmp, $isrc\n\t"
"umov $tmp, $vsrc, S, 1\n\t"
"mul $dst, $tmp, $dst\t# mul reduction2I"
%}
ins_encode %{
__ umov($tmp$$Register, as_FloatRegister($src2$$reg), __ S, 0);
__ mul($dst$$Register, $tmp$$Register, $src1$$Register);
__ umov($tmp$$Register, as_FloatRegister($src2$$reg), __ S, 1);
__ umov($tmp$$Register, as_FloatRegister($vsrc$$reg), __ S, 0);
__ mul($dst$$Register, $tmp$$Register, $isrc$$Register);
__ umov($tmp$$Register, as_FloatRegister($vsrc$$reg), __ S, 1);
__ mul($dst$$Register, $tmp$$Register, $dst$$Register);
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_mul4I(iRegINoSp dst, iRegIorL2I src1, vecX src2, vecX tmp, iRegINoSp tmp2)
instruct reduce_mul4I(iRegINoSp dst, iRegIorL2I isrc, vecX vsrc, vecX vtmp, iRegINoSp itmp)
%{
match(Set dst (MulReductionVI src1 src2));
match(Set dst (MulReductionVI isrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP tmp2, TEMP dst);
format %{ "ins $tmp, $src2, 0, 1\n\t"
"mul $tmp, $tmp, $src2\n\t"
"umov $tmp2, $tmp, S, 0\n\t"
"mul $dst, $tmp2, $src1\n\t"
"umov $tmp2, $tmp, S, 1\n\t"
"mul $dst, $tmp2, $dst\t# mul reduction4I"
effect(TEMP vtmp, TEMP itmp, TEMP dst);
format %{ "ins $vtmp, D, $vsrc, 0, 1\n\t"
"mulv $vtmp, T2S, $vtmp, $vsrc\n\t"
"umov $itmp, $vtmp, S, 0\n\t"
"mul $dst, $itmp, $isrc\n\t"
"umov $itmp, $vtmp, S, 1\n\t"
"mul $dst, $itmp, $dst\t# mul reduction4I"
%}
ins_encode %{
__ ins(as_FloatRegister($tmp$$reg), __ D,
as_FloatRegister($src2$$reg), 0, 1);
__ mulv(as_FloatRegister($tmp$$reg), __ T2S,
as_FloatRegister($tmp$$reg), as_FloatRegister($src2$$reg));
__ umov($tmp2$$Register, as_FloatRegister($tmp$$reg), __ S, 0);
__ mul($dst$$Register, $tmp2$$Register, $src1$$Register);
__ umov($tmp2$$Register, as_FloatRegister($tmp$$reg), __ S, 1);
__ mul($dst$$Register, $tmp2$$Register, $dst$$Register);
__ ins(as_FloatRegister($vtmp$$reg), __ D,
as_FloatRegister($vsrc$$reg), 0, 1);
__ mulv(as_FloatRegister($vtmp$$reg), __ T2S,
as_FloatRegister($vtmp$$reg), as_FloatRegister($vsrc$$reg));
__ umov($itmp$$Register, as_FloatRegister($vtmp$$reg), __ S, 0);
__ mul($dst$$Register, $itmp$$Register, $isrc$$Register);
__ umov($itmp$$Register, as_FloatRegister($vtmp$$reg), __ S, 1);
__ mul($dst$$Register, $itmp$$Register, $dst$$Register);
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_add2F(vRegF dst, vRegF src1, vecD src2, vecD tmp)
instruct reduce_add2F(vRegF dst, vRegF fsrc, vecD vsrc, vecD tmp)
%{
match(Set dst (AddReductionVF src1 src2));
match(Set dst (AddReductionVF fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "fadds $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fadds $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fadds $dst, $dst, $tmp\t# add reduction2F"
%}
ins_encode %{
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_add4F(vRegF dst, vRegF src1, vecX src2, vecX tmp)
instruct reduce_add4F(vRegF dst, vRegF fsrc, vecX vsrc, vecX tmp)
%{
match(Set dst (AddReductionVF src1 src2));
match(Set dst (AddReductionVF fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "fadds $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fadds $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fadds $dst, $dst, $tmp\n\t"
"ins $tmp, S, $src2, 0, 2\n\t"
"ins $tmp, S, $vsrc, 0, 2\n\t"
"fadds $dst, $dst, $tmp\n\t"
"ins $tmp, S, $src2, 0, 3\n\t"
"ins $tmp, S, $vsrc, 0, 3\n\t"
"fadds $dst, $dst, $tmp\t# add reduction4F"
%}
ins_encode %{
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 2);
as_FloatRegister($vsrc$$reg), 0, 2);
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 3);
as_FloatRegister($vsrc$$reg), 0, 3);
__ fadds(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_mul2F(vRegF dst, vRegF src1, vecD src2, vecD tmp)
instruct reduce_mul2F(vRegF dst, vRegF fsrc, vecD vsrc, vecD tmp)
%{
match(Set dst (MulReductionVF src1 src2));
match(Set dst (MulReductionVF fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "fmuls $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fmuls $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fmuls $dst, $dst, $tmp\t# mul reduction2F"
%}
ins_encode %{
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_mul4F(vRegF dst, vRegF src1, vecX src2, vecX tmp)
instruct reduce_mul4F(vRegF dst, vRegF fsrc, vecX vsrc, vecX tmp)
%{
match(Set dst (MulReductionVF src1 src2));
match(Set dst (MulReductionVF fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "fmuls $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fmuls $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fmuls $dst, $dst, $tmp\n\t"
"ins $tmp, S, $src2, 0, 2\n\t"
"ins $tmp, S, $vsrc, 0, 2\n\t"
"fmuls $dst, $dst, $tmp\n\t"
"ins $tmp, S, $src2, 0, 3\n\t"
"ins $tmp, S, $vsrc, 0, 3\n\t"
"fmuls $dst, $dst, $tmp\t# mul reduction4F"
%}
ins_encode %{
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 2);
as_FloatRegister($vsrc$$reg), 0, 2);
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S,
as_FloatRegister($src2$$reg), 0, 3);
as_FloatRegister($vsrc$$reg), 0, 3);
__ fmuls(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_add2D(vRegD dst, vRegD src1, vecX src2, vecX tmp)
instruct reduce_add2D(vRegD dst, vRegD dsrc, vecX vsrc, vecX tmp)
%{
match(Set dst (AddReductionVD src1 src2));
match(Set dst (AddReductionVD dsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "faddd $dst, $src1, $src2\n\t"
"ins $tmp, D, $src2, 0, 1\n\t"
format %{ "faddd $dst, $dsrc, $vsrc\n\t"
"ins $tmp, D, $vsrc, 0, 1\n\t"
"faddd $dst, $dst, $tmp\t# add reduction2D"
%}
ins_encode %{
__ faddd(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($dsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ faddd(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_mul2D(vRegD dst, vRegD src1, vecX src2, vecX tmp)
instruct reduce_mul2D(vRegD dst, vRegD dsrc, vecX vsrc, vecX tmp)
%{
match(Set dst (MulReductionVD src1 src2));
match(Set dst (MulReductionVD dsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP tmp, TEMP dst);
format %{ "fmuld $dst, $src1, $src2\n\t"
"ins $tmp, D, $src2, 0, 1\n\t"
format %{ "fmuld $dst, $dsrc, $vsrc\n\t"
"ins $tmp, D, $vsrc, 0, 1\n\t"
"fmuld $dst, $dst, $tmp\t# mul reduction2D"
%}
ins_encode %{
__ fmuld(as_FloatRegister($dst$$reg),
as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
as_FloatRegister($dsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D,
as_FloatRegister($src2$$reg), 0, 1);
as_FloatRegister($vsrc$$reg), 0, 1);
__ fmuld(as_FloatRegister($dst$$reg),
as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_max2F(vRegF dst, vRegF src1, vecD src2, vecD tmp) %{
instruct reduce_max2F(vRegF dst, vRegF fsrc, vecD vsrc, vecD tmp) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (MaxReductionV src1 src2));
match(Set dst (MaxReductionV fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst, TEMP tmp);
format %{ "fmaxs $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fmaxs $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fmaxs $dst, $dst, $tmp\t# max reduction2F" %}
ins_encode %{
__ fmaxs(as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S, as_FloatRegister($src2$$reg), 0, 1);
__ fmaxs(as_FloatRegister($dst$$reg), as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S, as_FloatRegister($vsrc$$reg), 0, 1);
__ fmaxs(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_max4F(vRegF dst, vRegF src1, vecX src2) %{
instruct reduce_max4F(vRegF dst, vRegF fsrc, vecX vsrc) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (MaxReductionV src1 src2));
match(Set dst (MaxReductionV fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst);
format %{ "fmaxv $dst, T4S, $src2\n\t"
"fmaxs $dst, $dst, $src1\t# max reduction4F" %}
format %{ "fmaxv $dst, T4S, $vsrc\n\t"
"fmaxs $dst, $dst, $fsrc\t# max reduction4F" %}
ins_encode %{
__ fmaxv(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src2$$reg));
__ fmaxs(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg));
__ fmaxv(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($vsrc$$reg));
__ fmaxs(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($fsrc$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_max2D(vRegD dst, vRegD src1, vecX src2, vecX tmp) %{
instruct reduce_max2D(vRegD dst, vRegD dsrc, vecX vsrc, vecX tmp) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE);
match(Set dst (MaxReductionV src1 src2));
match(Set dst (MaxReductionV dsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst, TEMP tmp);
format %{ "fmaxd $dst, $src1, $src2\n\t"
"ins $tmp, D, $src2, 0, 1\n\t"
format %{ "fmaxd $dst, $dsrc, $vsrc\n\t"
"ins $tmp, D, $vsrc, 0, 1\n\t"
"fmaxd $dst, $dst, $tmp\t# max reduction2D" %}
ins_encode %{
__ fmaxd(as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($src2$$reg), 0, 1);
__ fmaxd(as_FloatRegister($dst$$reg), as_FloatRegister($dsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($vsrc$$reg), 0, 1);
__ fmaxd(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_min2F(vRegF dst, vRegF src1, vecD src2, vecD tmp) %{
instruct reduce_min2F(vRegF dst, vRegF fsrc, vecD vsrc, vecD tmp) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (MinReductionV src1 src2));
match(Set dst (MinReductionV fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst, TEMP tmp);
format %{ "fmins $dst, $src1, $src2\n\t"
"ins $tmp, S, $src2, 0, 1\n\t"
format %{ "fmins $dst, $fsrc, $vsrc\n\t"
"ins $tmp, S, $vsrc, 0, 1\n\t"
"fmins $dst, $dst, $tmp\t# min reduction2F" %}
ins_encode %{
__ fmins(as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S, as_FloatRegister($src2$$reg), 0, 1);
__ fmins(as_FloatRegister($dst$$reg), as_FloatRegister($fsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ S, as_FloatRegister($vsrc$$reg), 0, 1);
__ fmins(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_min4F(vRegF dst, vRegF src1, vecX src2) %{
instruct reduce_min4F(vRegF dst, vRegF fsrc, vecX vsrc) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (MinReductionV src1 src2));
match(Set dst (MinReductionV fsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst);
format %{ "fminv $dst, T4S, $src2\n\t"
"fmins $dst, $dst, $src1\t# min reduction4F" %}
format %{ "fminv $dst, T4S, $vsrc\n\t"
"fmins $dst, $dst, $fsrc\t# min reduction4F" %}
ins_encode %{
__ fminv(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($src2$$reg));
__ fmins(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg));
__ fminv(as_FloatRegister($dst$$reg), __ T4S, as_FloatRegister($vsrc$$reg));
__ fmins(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($fsrc$$reg));
%}
ins_pipe(pipe_class_default);
%}
instruct reduce_min2D(vRegD dst, vRegD src1, vecX src2, vecX tmp) %{
instruct reduce_min2D(vRegD dst, vRegD dsrc, vecX vsrc, vecX tmp) %{
predicate(n->in(2)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE);
match(Set dst (MinReductionV src1 src2));
match(Set dst (MinReductionV dsrc vsrc));
ins_cost(INSN_COST);
effect(TEMP_DEF dst, TEMP tmp);
format %{ "fmind $dst, $src1, $src2\n\t"
"ins $tmp, D, $src2, 0, 1\n\t"
format %{ "fmind $dst, $dsrc, $vsrc\n\t"
"ins $tmp, D, $vsrc, 0, 1\n\t"
"fmind $dst, $dst, $tmp\t# min reduction2D" %}
ins_encode %{
__ fmind(as_FloatRegister($dst$$reg), as_FloatRegister($src1$$reg), as_FloatRegister($src2$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($src2$$reg), 0, 1);
__ fmind(as_FloatRegister($dst$$reg), as_FloatRegister($dsrc$$reg), as_FloatRegister($vsrc$$reg));
__ ins(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($vsrc$$reg), 0, 1);
__ fmind(as_FloatRegister($dst$$reg), as_FloatRegister($dst$$reg), as_FloatRegister($tmp$$reg));
%}
ins_pipe(pipe_class_default);
@ -17589,7 +17567,7 @@ instruct vsll8S_imm(vecX dst, vecX src, immI shift) %{
instruct vsra4S_imm(vecD dst, vecD src, immI shift) %{
predicate(n->as_Vector()->length() == 2 ||
n->as_Vector()->length() == 4);
match(Set dst (RShiftVS src (LShiftCntV shift)));
match(Set dst (RShiftVS src (RShiftCntV shift)));
ins_cost(INSN_COST);
format %{ "sshr $dst, $src, $shift\t# vector (4H)" %}
ins_encode %{
@ -17603,7 +17581,7 @@ instruct vsra4S_imm(vecD dst, vecD src, immI shift) %{
instruct vsra8S_imm(vecX dst, vecX src, immI shift) %{
predicate(n->as_Vector()->length() == 8);
match(Set dst (RShiftVS src (LShiftCntV shift)));
match(Set dst (RShiftVS src (RShiftCntV shift)));
ins_cost(INSN_COST);
format %{ "sshr $dst, $src, $shift\t# vector (8H)" %}
ins_encode %{

View File

@ -2185,6 +2185,10 @@ void MacroAssembler::verify_heapbase(const char* msg) {
#if 0
assert (UseCompressedOops || UseCompressedClassPointers, "should be compressed");
assert (Universe::heap() != NULL, "java heap should be initialized");
if (!UseCompressedOops || Universe::ptr_base() == NULL) {
// rheapbase is allocated as general register
return;
}
if (CheckCompressedOops) {
Label ok;
push(1 << rscratch1->encoding(), sp); // cmpptr trashes rscratch1

View File

@ -1017,10 +1017,6 @@ const uint Matcher::vector_ideal_reg(int size) {
return 0;
}
const uint Matcher::vector_shift_count_ideal_reg(int size) {
return vector_ideal_reg(size);
}
// Limits on vector size (number of elements) loaded into vector.
const int Matcher::max_vector_size(const BasicType bt) {
assert(is_java_primitive(bt), "only primitive type vectors");
@ -1087,7 +1083,7 @@ const bool Matcher::convi2l_type_required = true;
// No support for generic vector operands.
const bool Matcher::supports_generic_vector_operands = false;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
ShouldNotReachHere(); // generic vector operands not supported
return NULL;
}
@ -5316,14 +5312,6 @@ instruct castII( iRegI dst ) %{
ins_pipe(empty);
%}
instruct castLL( iRegL dst ) %{
match(Set dst (CastLL dst));
format %{ "! castLL of $dst" %}
ins_encode( /*empty encoding*/ );
ins_cost(0);
ins_pipe(empty);
%}
//----------Arithmetic Instructions--------------------------------------------
// Addition Instructions
// Register Addition

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
#include "classfile/javaClasses.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
@ -540,7 +541,7 @@ void trace_method_handle_stub(const char* adaptername,
}
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
if (!TraceMethodHandles) return;
if (!log_is_enabled(Info, methodhandles)) return;
BLOCK_COMMENT("trace_method_handle {");
// register saving
// must correspond to trace_mh_nregs and trace_mh_regs defined above

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. 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
@ -530,6 +530,8 @@ class Assembler : public AbstractAssembler {
XXLXOR_OPCODE = (60u << OPCODE_SHIFT | 154u << 3),
XXLEQV_OPCODE = (60u << OPCODE_SHIFT | 186u << 3),
XVDIVSP_OPCODE = (60u << OPCODE_SHIFT | 88u << 3),
XXBRD_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 23u << 16), // XX2-FORM
XXBRW_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 15u << 16), // XX2-FORM
XVDIVDP_OPCODE = (60u << OPCODE_SHIFT | 120u << 3),
XVABSSP_OPCODE = (60u << OPCODE_SHIFT | 409u << 2),
XVABSDP_OPCODE = (60u << OPCODE_SHIFT | 473u << 2),
@ -2227,11 +2229,15 @@ class Assembler : public AbstractAssembler {
inline void xxmrghw( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xxmrglw( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void mtvsrd( VectorSRegister d, Register a);
inline void mfvsrd( Register d, VectorSRegister a);
inline void mtvsrwz( VectorSRegister d, Register a);
inline void mfvsrwz( Register d, VectorSRegister a);
inline void xxspltw( VectorSRegister d, VectorSRegister b, int ui2);
inline void xxlor( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xxlxor( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xxbrd( VectorSRegister d, VectorSRegister b);
inline void xxbrw( VectorSRegister d, VectorSRegister b);
inline void xvdivsp( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xvdivdp( VectorSRegister d, VectorSRegister a, VectorSRegister b);
inline void xvabssp( VectorSRegister d, VectorSRegister b);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. 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
@ -776,11 +776,15 @@ inline void Assembler::lxvd2x( VectorSRegister d, Register s1, Register s2) { e
inline void Assembler::stxvd2x( VectorSRegister d, Register s1) { emit_int32( STXVD2X_OPCODE | vsrs(d) | ra(0) | rb(s1)); }
inline void Assembler::stxvd2x( VectorSRegister d, Register s1, Register s2) { emit_int32( STXVD2X_OPCODE | vsrs(d) | ra0mem(s1) | rb(s2)); }
inline void Assembler::mtvsrd( VectorSRegister d, Register a) { emit_int32( MTVSRD_OPCODE | vsrt(d) | ra(a)); }
inline void Assembler::mfvsrd( Register d, VectorSRegister a) { emit_int32( MFVSRD_OPCODE | vsrs(a) | ra(d)); }
inline void Assembler::mtvsrwz( VectorSRegister d, Register a) { emit_int32( MTVSRWZ_OPCODE | vsrt(d) | ra(a)); }
inline void Assembler::mfvsrwz( Register d, VectorSRegister a) { emit_int32( MFVSRWZ_OPCODE | vsrs(a) | ra(d)); }
inline void Assembler::xxspltw( VectorSRegister d, VectorSRegister b, int ui2) { emit_int32( XXSPLTW_OPCODE | vsrt(d) | vsrb(b) | xxsplt_uim(uimm(ui2,2))); }
inline void Assembler::xxlor( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLOR_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
inline void Assembler::xxlxor( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLXOR_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
inline void Assembler::xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLEQV_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
inline void Assembler::xxbrd( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRD_OPCODE | vsrt(d) | vsrb(b) ); }
inline void Assembler::xxbrw( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRW_OPCODE | vsrt(d) | vsrb(b) ); }
inline void Assembler::xvdivsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
inline void Assembler::xvdivdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
inline void Assembler::xvabssp( VectorSRegister d, VectorSRegister b) { emit_int32( XVABSSP_OPCODE | vsrt(d) | vsrb(b)); }

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. 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
@ -112,6 +112,8 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
"Use load instructions for stack banging.") \
\
/* special instructions */ \
product(bool, UseVectorByteReverseInstructionsPPC64, false, \
"Use Power9 xxbr* vector byte reverse instructions.") \
\
product(bool, UseCountLeadingZerosInstructionsPPC64, true, \
"Use count leading zeros instructions.") \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,6 +28,7 @@
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
@ -264,7 +265,7 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
DEBUG_ONLY(param_size = noreg);
}
if (TraceMethodHandles) {
if (log_is_enabled(Info, methodhandles)) {
if (tmp_mh != noreg) {
__ mr(R23_method_handle, tmp_mh); // make stub happy
}
@ -545,7 +546,7 @@ void trace_method_handle_stub(const char* adaptername,
}
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
if (!TraceMethodHandles) return;
if (!log_is_enabled(Info, methodhandles)) return;
BLOCK_COMMENT("trace_method_handle {");

View File

@ -1,6 +1,6 @@
//
// Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2012, 2019 SAP SE. All rights reserved.
// Copyright (c) 2012, 2020 SAP SE. 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
@ -2366,11 +2366,6 @@ const uint Matcher::vector_ideal_reg(int size) {
}
}
const uint Matcher::vector_shift_count_ideal_reg(int size) {
fatal("vector shift is not supported");
return Node::NotAMachineReg;
}
// Limits on vector size (number of elements) loaded into vector.
const int Matcher::max_vector_size(const BasicType bt) {
assert(is_java_primitive(bt), "only primitive type vectors");
@ -2451,7 +2446,7 @@ const bool Matcher::need_masked_shift_count = true;
// No support for generic vector operands.
const bool Matcher::supports_generic_vector_operands = false;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
ShouldNotReachHere(); // generic vector operands not supported
return NULL;
}
@ -10890,14 +10885,6 @@ instruct castII(iRegIdst dst) %{
ins_pipe(pipe_class_default);
%}
instruct castLL(iRegLdst dst) %{
match(Set dst (CastLL dst));
format %{ " -- \t// castLL of $dst" %}
size(0);
ins_encode( /*empty*/ );
ins_pipe(pipe_class_default);
%}
instruct checkCastPP(iRegPdst dst) %{
match(Set dst (CheckCastPP dst));
format %{ " -- \t// checkcastPP of $dst" %}
@ -13737,6 +13724,24 @@ instruct bytes_reverse_int_Ex(iRegIdst dst, iRegIsrc src) %{
%}
%}
instruct bytes_reverse_int_vec(iRegIdst dst, iRegIsrc src, vecX tmpV) %{
match(Set dst (ReverseBytesI src));
predicate(UseVectorByteReverseInstructionsPPC64);
effect(TEMP tmpV);
ins_cost(DEFAULT_COST*3);
size(12);
format %{ "MTVSRWZ $tmpV, $src\n"
"\tXXBRW $tmpV, $tmpV\n"
"\tMFVSRWZ $dst, $tmpV" %}
ins_encode %{
__ mtvsrwz($tmpV$$VectorSRegister, $src$$Register);
__ xxbrw($tmpV$$VectorSRegister, $tmpV$$VectorSRegister);
__ mfvsrwz($dst$$Register, $tmpV$$VectorSRegister);
%}
ins_pipe(pipe_class_default);
%}
instruct bytes_reverse_long_Ex(iRegLdst dst, iRegLsrc src) %{
match(Set dst (ReverseBytesL src));
ins_cost(15*DEFAULT_COST);
@ -13776,6 +13781,24 @@ instruct bytes_reverse_long_Ex(iRegLdst dst, iRegLsrc src) %{
%}
%}
instruct bytes_reverse_long_vec(iRegLdst dst, iRegLsrc src, vecX tmpV) %{
match(Set dst (ReverseBytesL src));
predicate(UseVectorByteReverseInstructionsPPC64);
effect(TEMP tmpV);
ins_cost(DEFAULT_COST*3);
size(12);
format %{ "MTVSRD $tmpV, $src\n"
"\tXXBRD $tmpV, $tmpV\n"
"\tMFVSRD $dst, $tmpV" %}
ins_encode %{
__ mtvsrd($tmpV$$VectorSRegister, $src$$Register);
__ xxbrd($tmpV$$VectorSRegister, $tmpV$$VectorSRegister);
__ mfvsrd($dst$$Register, $tmpV$$VectorSRegister);
%}
ins_pipe(pipe_class_default);
%}
instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
match(Set dst (ReverseBytesUS src));
ins_cost(2*DEFAULT_COST);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 SAP SE. 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
@ -141,6 +141,9 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(UseCharacterCompareIntrinsics)) {
FLAG_SET_ERGO(UseCharacterCompareIntrinsics, true);
}
if (FLAG_IS_DEFAULT(UseVectorByteReverseInstructionsPPC64)) {
FLAG_SET_ERGO(UseVectorByteReverseInstructionsPPC64, true);
}
} else {
if (UseCountTrailingZerosInstructionsPPC64) {
warning("UseCountTrailingZerosInstructionsPPC64 specified, but needs at least Power9.");
@ -150,6 +153,10 @@ void VM_Version::initialize() {
warning("UseCharacterCompareIntrinsics specified, but needs at least Power9.");
FLAG_SET_DEFAULT(UseCharacterCompareIntrinsics, false);
}
if (UseVectorByteReverseInstructionsPPC64) {
warning("UseVectorByteReverseInstructionsPPC64 specified, but needs at least Power9.");
FLAG_SET_DEFAULT(UseVectorByteReverseInstructionsPPC64, false);
}
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,6 +28,7 @@
#include "asm/macroAssembler.inline.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
@ -616,7 +617,7 @@ void trace_method_handle_stub(const char* adaptername,
}
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
if (!TraceMethodHandles) { return; }
if (!log_is_enabled(Info, methodhandles)) { return; }
// If arg registers are contiguous, we can use STMG/LMG.
assert((Z_ARG5->encoding() - Z_ARG1->encoding() + 1) == RegisterImpl::number_of_arg_registers, "Oops");

View File

@ -1610,11 +1610,6 @@ const int Matcher::min_vector_size(const BasicType bt) {
return max_vector_size(bt); // Same as max.
}
const uint Matcher::vector_shift_count_ideal_reg(int size) {
fatal("vector shift is not supported");
return Node::NotAMachineReg;
}
// z/Architecture does support misaligned store/load at minimal extra cost.
const bool Matcher::misaligned_vectors_ok() {
return true;
@ -1669,7 +1664,7 @@ const bool Matcher::need_masked_shift_count = false;
// No support for generic vector operands.
const bool Matcher::supports_generic_vector_operands = false;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
ShouldNotReachHere(); // generic vector operands not supported
return NULL;
}
@ -5439,14 +5434,6 @@ instruct castII(iRegI dst) %{
ins_pipe(pipe_class_dummy);
%}
instruct castLL(iRegL dst) %{
match(Set dst (CastLL dst));
size(0);
format %{ "# castLL of $dst" %}
ins_encode(/*empty*/);
ins_pipe(pipe_class_dummy);
%}
//----------Conditional_store--------------------------------------------------
// Conditional-store of the updated heap-top.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "classfile/javaClasses.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interp_masm.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
@ -274,7 +275,7 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
// O4_first_arg_addr is live!
if (TraceMethodHandles) {
if (log_is_enabled(Info, methodhandles)) {
if (O0_mh != noreg)
__ mov(O0_mh, G3_method_handle); // make stub happy
trace_method_handle_interpreter_entry(_masm, iid);
@ -576,7 +577,7 @@ void trace_method_handle_stub(const char* adaptername,
}
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
if (!TraceMethodHandles) return;
if (!log_is_enabled(Info, methodhandles)) return;
BLOCK_COMMENT("trace_method_handle {");
// save: Gargs, O5_savedSP
__ save_frame(16); // need space for saving required FPU state

View File

@ -1753,11 +1753,6 @@ const uint Matcher::vector_ideal_reg(int size) {
return Op_RegD;
}
const uint Matcher::vector_shift_count_ideal_reg(int size) {
fatal("vector shift is not supported");
return Node::NotAMachineReg;
}
// Limits on vector size (number of elements) loaded into vector.
const int Matcher::max_vector_size(const BasicType bt) {
assert(is_java_primitive(bt), "only primitive type vectors");
@ -1821,7 +1816,7 @@ const bool Matcher::need_masked_shift_count = false;
// No support for generic vector operands.
const bool Matcher::supports_generic_vector_operands = false;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
ShouldNotReachHere(); // generic vector operands not supported
return NULL;
}
@ -6812,14 +6807,6 @@ instruct castII( iRegI dst ) %{
ins_pipe(empty);
%}
instruct castLL( iRegL dst ) %{
match(Set dst (CastLL dst));
format %{ "# castLL of $dst" %}
ins_encode( /*empty encoding*/ );
ins_cost(0);
ins_pipe(empty);
%}
//----------Arithmetic Instructions--------------------------------------------
// Addition Instructions
// Register Addition

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@
#include "classfile/javaClasses.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
@ -594,7 +595,7 @@ void trace_method_handle_stub_wrapper(MethodHandleStubArguments* args) {
}
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
if (!TraceMethodHandles) return;
if (!log_is_enabled(Info, methodhandles)) return;
BLOCK_COMMENT(err_msg("trace_method_handle %s {", adaptername));
__ enter();
__ andptr(rsp, -16); // align stack if needed for FPU state

View File

@ -1490,7 +1490,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
// x86 supports generic vector operands: vec and legVec.
const bool Matcher::supports_generic_vector_operands = true;
MachOper* Matcher::specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg, bool is_temp) {
MachOper* Matcher::pd_specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg, bool is_temp) {
assert(Matcher::is_generic_vector(generic_opnd), "not generic");
bool legacy = (generic_opnd->opcode() == LEGVEC);
if (!VM_Version::supports_avx512vlbwdq() && // KNL
@ -1630,11 +1630,6 @@ const uint Matcher::vector_ideal_reg(int size) {
return 0;
}
// Only lowest bits of xmm reg are used for vector shift count.
const uint Matcher::vector_shift_count_ideal_reg(int size) {
return Op_VecS;
}
// x86 supports misaligned vectors store/load.
const bool Matcher::misaligned_vectors_ok() {
return true;
@ -5344,7 +5339,7 @@ instruct vpopcountI(vec dst, vec src) %{
// --------------------------------- Bitwise Ternary Logic ----------------------------------
instruct vpternlogdB(vec dst, vec src2, vec src3, immU8 func) %{
instruct vpternlog(vec dst, vec src2, vec src3, immU8 func) %{
match(Set dst (MacroLogicV (Binary dst src2) (Binary src3 func)));
effect(TEMP dst);
format %{ "vpternlogd $dst,$src2,$src3,$func\t! vector ternary logic" %}
@ -5355,7 +5350,7 @@ instruct vpternlogdB(vec dst, vec src2, vec src3, immU8 func) %{
ins_pipe( pipe_slow );
%}
instruct vpternlogdB_mem(vec dst, vec src2, memory src3, immU8 func) %{
instruct vpternlog_mem(vec dst, vec src2, memory src3, immU8 func) %{
match(Set dst (MacroLogicV (Binary dst src2) (Binary (LoadVector src3) func)));
effect(TEMP dst);
format %{ "vpternlogd $dst,$src2,$src3,$func\t! vector ternary logic" %}

View File

@ -7237,15 +7237,6 @@ instruct castII( rRegI dst ) %{
ins_pipe( empty );
%}
instruct castLL( eRegL dst ) %{
match(Set dst (CastLL dst));
format %{ "#castLL of $dst" %}
ins_encode( /*empty encoding*/ );
ins_cost(0);
ins_pipe( empty );
%}
// Load-locked - same as a regular pointer load when used with compare-swap
instruct loadPLocked(eRegP dst, memory mem) %{
match(Set dst (LoadPLocked mem));

View File

@ -7504,17 +7504,6 @@ instruct castII(rRegI dst)
ins_pipe(empty);
%}
instruct castLL(rRegL dst)
%{
match(Set dst (CastLL dst));
size(0);
format %{ "# castLL of $dst" %}
ins_encode(/* empty encoding */);
ins_cost(0);
ins_pipe(empty);
%}
// LoadP-locked same as a regular LoadP when used with compare-swap
instruct loadPLocked(rRegP dst, memory mem)
%{

View File

@ -141,6 +141,13 @@ static bool check_signals = true;
static int SR_signum = SIGUSR2;
sigset_t SR_sigset;
#ifdef __APPLE__
static const int processor_id_unassigned = -1;
static const int processor_id_assigning = -2;
static const int processor_id_map_size = 256;
static volatile int processor_id_map[processor_id_map_size];
static volatile int processor_id_next = 0;
#endif
////////////////////////////////////////////////////////////////////////////////
// utility functions
@ -250,6 +257,13 @@ void os::Bsd::initialize_system_info() {
set_processor_count(1); // fallback
}
#ifdef __APPLE__
// initialize processor id map
for (int i = 0; i < processor_id_map_size; i++) {
processor_id_map[i] = processor_id_unassigned;
}
#endif
// get physical memory via hw.memsize sysctl (hw.memsize is used
// since it returns a 64 bit value)
mib[0] = CTL_HW;
@ -3196,69 +3210,32 @@ int os::active_processor_count() {
}
#ifdef __APPLE__
static volatile int* volatile apic_to_processor_mapping = NULL;
static volatile int next_processor_id = 0;
static inline volatile int* get_apic_to_processor_mapping() {
volatile int* mapping = Atomic::load_acquire(&apic_to_processor_mapping);
if (mapping == NULL) {
// Calculate possible number space for APIC ids. This space is not necessarily
// in the range [0, number_of_processors).
uint total_bits = 0;
for (uint i = 0;; ++i) {
uint eax = 0xb; // Query topology leaf
uint ebx;
uint ecx = i;
uint edx;
__asm__ ("cpuid\n\t" : "+a" (eax), "+b" (ebx), "+c" (ecx), "+d" (edx) : );
uint level_type = (ecx >> 8) & 0xFF;
if (level_type == 0) {
// Invalid level; end of topology
break;
}
uint level_apic_id_shift = eax & ((1u << 5) - 1);
total_bits += level_apic_id_shift;
}
uint max_apic_ids = 1u << total_bits;
mapping = NEW_C_HEAP_ARRAY(int, max_apic_ids, mtInternal);
for (uint i = 0; i < max_apic_ids; ++i) {
mapping[i] = -1;
}
if (!Atomic::replace_if_null(&apic_to_processor_mapping, mapping)) {
FREE_C_HEAP_ARRAY(int, mapping);
mapping = Atomic::load_acquire(&apic_to_processor_mapping);
}
}
return mapping;
}
uint os::processor_id() {
volatile int* mapping = get_apic_to_processor_mapping();
uint eax = 0xb;
// Get the initial APIC id and return the associated processor id. The initial APIC
// id is limited to 8-bits, which means we can have at most 256 unique APIC ids. If
// the system has more processors (or the initial APIC ids are discontiguous) the
// APIC id will be truncated and more than one processor will potentially share the
// same processor id. This is not optimal, but unlikely to happen in practice. Should
// this become a real problem we could switch to using x2APIC ids, which are 32-bit
// wide. However, note that x2APIC is Intel-specific, and the wider number space
// would require a more complicated mapping approach.
uint eax = 0x1;
uint ebx;
uint ecx = 0;
uint edx;
__asm__ ("cpuid\n\t" : "+a" (eax), "+b" (ebx), "+c" (ecx), "+d" (edx) : );
// Map from APIC id to a unique logical processor ID in the expected
// [0, num_processors) range.
uint apic_id = edx;
int processor_id = Atomic::load(&mapping[apic_id]);
uint apic_id = (ebx >> 24) & (processor_id_map_size - 1);
int processor_id = Atomic::load(&processor_id_map[apic_id]);
while (processor_id < 0) {
if (Atomic::cmpxchg(&mapping[apic_id], -1, -2) == -1) {
Atomic::store(&mapping[apic_id], Atomic::add(&next_processor_id, 1) - 1);
// Assign processor id to APIC id
processor_id = Atomic::cmpxchg(&processor_id_map[apic_id], processor_id_unassigned, processor_id_assigning);
if (processor_id == processor_id_unassigned) {
processor_id = Atomic::fetch_and_add(&processor_id_next, 1) % os::processor_count();
Atomic::store(&processor_id_map[apic_id], processor_id);
}
processor_id = Atomic::load(&mapping[apic_id]);
}
assert(processor_id >= 0 && processor_id < os::processor_count(), "invalid processor id");

View File

@ -413,60 +413,69 @@ void os::Posix::print_uptime_info(outputStream* st) {
}
}
void os::Posix::print_rlimit_info(outputStream* st) {
st->print("rlimit:");
static void print_rlimit(outputStream* st, const char* msg,
int resource, bool output_k = false) {
struct rlimit rlim;
st->print(" STACK ");
getrlimit(RLIMIT_STACK, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024);
st->print(" %s ", msg);
int res = getrlimit(resource, &rlim);
if (res == -1) {
st->print("could not obtain value");
} else {
// soft limit
if (rlim.rlim_cur == RLIM_INFINITY) { st->print("infinity"); }
else {
if (output_k) { st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024); }
else { st->print(UINT64_FORMAT, uint64_t(rlim.rlim_cur)); }
}
// hard limit
st->print("/");
if (rlim.rlim_max == RLIM_INFINITY) { st->print("infinity"); }
else {
if (output_k) { st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_max) / 1024); }
else { st->print(UINT64_FORMAT, uint64_t(rlim.rlim_max)); }
}
}
}
st->print(", CORE ");
getrlimit(RLIMIT_CORE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024);
void os::Posix::print_rlimit_info(outputStream* st) {
st->print("rlimit (soft/hard):");
print_rlimit(st, "STACK", RLIMIT_STACK, true);
print_rlimit(st, ", CORE", RLIMIT_CORE, true);
// Isn't there on solaris
#if defined(AIX)
st->print(", NPROC ");
st->print("%d", sysconf(_SC_CHILD_MAX));
st->print(", THREADS ");
getrlimit(RLIMIT_THREADS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT, uint64_t(rlim.rlim_cur));
print_rlimit(st, ", THREADS", RLIMIT_THREADS);
#elif !defined(SOLARIS)
st->print(", NPROC ");
getrlimit(RLIMIT_NPROC, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT, uint64_t(rlim.rlim_cur));
print_rlimit(st, ", NPROC", RLIMIT_NPROC);
#endif
st->print(", NOFILE ");
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT, uint64_t(rlim.rlim_cur));
print_rlimit(st, ", NOFILE", RLIMIT_NOFILE);
print_rlimit(st, ", AS", RLIMIT_AS, true);
print_rlimit(st, ", CPU", RLIMIT_CPU);
print_rlimit(st, ", DATA", RLIMIT_DATA, true);
st->print(", AS ");
getrlimit(RLIMIT_AS, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024);
// maximum size of files that the process may create
print_rlimit(st, ", FSIZE", RLIMIT_FSIZE, true);
st->print(", CPU ");
getrlimit(RLIMIT_CPU, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT, uint64_t(rlim.rlim_cur));
#if defined(LINUX) || defined(__APPLE__)
// maximum number of bytes of memory that may be locked into RAM
// (rounded down to the nearest multiple of system pagesize)
print_rlimit(st, ", MEMLOCK", RLIMIT_MEMLOCK, true);
#endif
st->print(", DATA ");
getrlimit(RLIMIT_DATA, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024);
#if defined(SOLARIS)
// maximum size of mapped address space of a process in bytes;
// if the limit is exceeded, mmap and brk fail
print_rlimit(st, ", VMEM", RLIMIT_VMEM, true);
#endif
st->print(", FSIZE ");
getrlimit(RLIMIT_FSIZE, &rlim);
if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
else st->print(UINT64_FORMAT "k", uint64_t(rlim.rlim_cur) / 1024);
// MacOS; The maximum size (in bytes) to which a process's resident set size may grow.
#if defined(__APPLE__)
print_rlimit(st, ", RSS", RLIMIT_RSS, true);
#endif
st->cr();
}

View File

@ -4143,7 +4143,7 @@ static void file_attribute_data_to_stat(struct stat* sbuf, WIN32_FILE_ATTRIBUTE_
static errno_t convert_to_unicode(char const* char_path, LPWSTR* unicode_path) {
// Get required buffer size to convert to Unicode
int unicode_path_len = MultiByteToWideChar(CP_THREAD_ACP,
int unicode_path_len = MultiByteToWideChar(CP_ACP,
MB_ERR_INVALID_CHARS,
char_path, -1,
NULL, 0);
@ -4153,7 +4153,7 @@ static errno_t convert_to_unicode(char const* char_path, LPWSTR* unicode_path) {
*unicode_path = NEW_C_HEAP_ARRAY(WCHAR, unicode_path_len, mtInternal);
int result = MultiByteToWideChar(CP_THREAD_ACP,
int result = MultiByteToWideChar(CP_ACP,
MB_ERR_INVALID_CHARS,
char_path, -1,
*unicode_path, unicode_path_len);

Some files were not shown because too many files have changed in this diff Show More