Merge
This commit is contained in:
commit
396146854b
.hgtags
bin/nashorn
doc
make
CompileDemos.gmkCompileJavaModules.gmkGlobal.gmkInit.gmkInitSupport.gmkMain.gmkRunTests.gmk
autoconf
common
data/symbols
java.base-7.sym.txtjava.base-8.sym.txtjava.base-9.sym.txtjava.base-F.sym.txtjava.desktop-7.sym.txtjava.desktop-8.sym.txtjava.desktop-9.sym.txtsymbols
hotspot
gensrc
lib
langtools/src/classes/build/tools/symbolgenerator
modules
src/native
test
src/hotspot
cpu
aarch64
aarch64.adframe_aarch64.cppjvmciCodeInstaller_aarch64.cppmacroAssembler_aarch64.cppnativeInst_aarch64.hpp
arm
ppc
s390
globalDefinitions_s390.hppinterp_masm_s390.cppnativeInst_s390.hpptemplateInterpreterGenerator_s390.cpptemplateTable_s390.cpp
x86
jvmciCodeInstaller_x86.cppnativeInst_x86.hppsharedRuntime_x86_64.cppstubGenerator_x86_64.cppvm_version_x86.cppx86_64.ad
zero
os/aix
6
.hgtags
6
.hgtags
@ -642,3 +642,9 @@ f143729ca00ec14a98ea5c7f73acba88da97746e jdk-15+23
|
||||
4a485c89d5a08b495961835f5308a96038678aeb jdk-16+1
|
||||
06c9f89459daba98395fad726100feb44f89ba71 jdk-15+28
|
||||
bcbe7b8a77b8971bc221c0be1bd2abb6fb68c2d0 jdk-16+2
|
||||
b58fc60580550a4a587cab729d8fd87223ad6932 jdk-15+29
|
||||
76810b3a88c8c641ae3850a8dfd7c40c984aea9d jdk-16+3
|
||||
6909e4a1f25bfe9a2727026f5845fc1fc44a36aa jdk-15+30
|
||||
78c07dd7240412e60d8694e9dbfd46e57bd42ee0 jdk-16+4
|
||||
78c07dd7240412e60d8694e9dbfd46e57bd42ee0 jdk-16+4
|
||||
e2622818f0bd30e736252eba101fe7d2c27f400b jdk-16+4
|
||||
|
@ -1,37 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
fix() {
|
||||
#convert tabs to spaces
|
||||
find . -name $1 -exec sed -i "" 's/ / /g' {} \;
|
||||
#remove trailing whitespace
|
||||
find . -name $1 -exec sed -i "" 's/[ ]*$//' \{} \;
|
||||
}
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
fix $1;
|
||||
else
|
||||
fix "*.java"
|
||||
fix "*.js"
|
||||
fi
|
@ -1,135 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
###########################################################################################
|
||||
# This is a helper script to evaluate nashorn with optimistic types
|
||||
# it produces a flight recording for every run, and uses the best
|
||||
# known flags for performance for the current configration
|
||||
###########################################################################################
|
||||
|
||||
# Flags to enable assertions, we need the system assertions too, since
|
||||
# this script runs Nashorn in the BCP to override any nashorn.jar that might
|
||||
# reside in your $JAVA_HOME/jre/lib/ext/nashorn.jar
|
||||
#
|
||||
ENABLE_ASSERTIONS_FLAGS="-ea -esa"
|
||||
|
||||
# Flags to instrument lambdaform computation, caching, interpretation and compilation
|
||||
# Default compile threshold for lambdaforms is 30
|
||||
#
|
||||
#LAMBDAFORM_FLAGS="\
|
||||
# -Djava.lang.invoke.MethodHandle.COMPILE_THRESHOLD=3 \
|
||||
# -Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true \
|
||||
# -Djava.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE=true \
|
||||
# -Djava.lang.invoke.MethodHandle.TRACE_INTERPRETER=true"
|
||||
|
||||
# Flags to run trusted tests from the Nashorn test suite
|
||||
#
|
||||
#TRUSTED_TEST_FLAGS="\
|
||||
#-Djava.security.manager \
|
||||
#-Djava.security.policy=../build/nashorn.policy -Dnashorn.debug"
|
||||
|
||||
# Testing out new code optimizations using the generic hotspot "new code" parameter
|
||||
#
|
||||
#USE_NEW_CODE_FLAGS=-XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode
|
||||
|
||||
#
|
||||
#-Dnashorn.typeInfo.disabled=false \
|
||||
# and for Nashorn options:
|
||||
# --class-cache-size=0 --persistent-code-cache=false
|
||||
|
||||
# Unique timestamped file name for JFR recordings. For JFR, we also have to
|
||||
# crank up the stack cutoff depth to 1024, because of ridiculously long lambda form
|
||||
# stack traces.
|
||||
#
|
||||
# It is also recommended that you go into $JAVA_HOME/jre/lib/jfr/default.jfc and
|
||||
# set the "method-sampling-interval" Normal and Maximum sample time as low as you
|
||||
# can go (10 ms on most platforms). The default is normally higher. The increased
|
||||
# sampling overhead is usually negligible for Nashorn runs, but the data is better
|
||||
|
||||
if [ -z $JFR_FILENAME ]; then
|
||||
JFR_FILENAME="./nashorn_$(date|sed "s/ /_/g"|sed "s/:/_/g").jfr"
|
||||
fi
|
||||
|
||||
# Flight recorder
|
||||
#
|
||||
# see above - already in place, copy the flags down here to disable
|
||||
ENABLE_FLIGHT_RECORDER_FLAGS="\
|
||||
-XX:+FlightRecorder \
|
||||
-XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=$JFR_FILENAME,stackdepth=1024"
|
||||
|
||||
# Type specialization and math intrinsic replacement should be enabled by default in 8u20 and nine,
|
||||
# keeping this flag around for experimental reasons. Replace + with - to switch it off
|
||||
#
|
||||
#ENABLE_TYPE_SPECIALIZATION_FLAGS=-XX:+UseTypeSpeculation
|
||||
|
||||
# Same with math intrinsics. They should be enabled by default in 8u20 and 9, so
|
||||
# this disables them if needed
|
||||
#
|
||||
#DISABLE_MATH_INTRINSICS_FLAGS=-XX:-UseMathExactIntrinsics
|
||||
|
||||
# Add timing to time the compilation phases.
|
||||
#ENABLE_TIME_FLAGS=--log=time
|
||||
|
||||
# Add ShowHiddenFrames to get lambda form internals on the stack traces
|
||||
#ENABLE_SHOW_HIDDEN_FRAMES_FLAGS=-XX:+ShowHiddenFrames
|
||||
|
||||
# Add print optoassembly to get an asm dump. This requires 1) a debug build, not product,
|
||||
# That tired compilation is switched off, for C2 only output and that the number of
|
||||
# compiler threads is set to 1 for determinsm.
|
||||
#
|
||||
#PRINT_ASM_FLAGS=-XX:+PrintOptoAssembly -XX:-TieredCompilation -XX:CICompilerCount=1 \
|
||||
|
||||
# Tier compile threasholds. Default value is 10. (1-100 is useful for experiments)
|
||||
#TIER_COMPILATION_THRESHOLD_FLAGS=-XX:IncreaseFirstTierCompileThresholdAt=10
|
||||
|
||||
# Directory where to look for nashorn.jar in a dist folder. The default is "..", assuming
|
||||
# that we run the script from the make dir
|
||||
DIR=..
|
||||
NASHORN_JAR=$DIR/dist/nashorn.jar
|
||||
|
||||
|
||||
# The built Nashorn jar is placed first in the bootclasspath to override the JDK
|
||||
# nashorn.jar in $JAVA_HOME/jre/lib/ext. Thus, we also need -esa, as assertions in
|
||||
# nashorn count as system assertions in this configuration
|
||||
|
||||
# Type profiling default level is 111, 222 adds some compile time, but is faster
|
||||
|
||||
$JAVA_HOME/bin/java \
|
||||
$ENABLE_ASSERTIONS_FLAGS \
|
||||
$LAMBDAFORM_FLAGS \
|
||||
$TRUSTED_FLAGS \
|
||||
$USE_NEW_CODE_FLAGS \
|
||||
$ENABLE_SHOW_HIDDEN_FRAMES_FLAGS \
|
||||
$ENABLE_FLIGHT_RECORDER_FLAGS \
|
||||
$ENABLE_TYPE_SPECIALIZATION_FLAGS \
|
||||
$TIERED_COMPILATION_THRESOLD_FLAGS \
|
||||
$DISABLE_MATH_INTRINSICS_FLAGS \
|
||||
$PRINT_ASM_FLAGS \
|
||||
-Xbootclasspath/p:$NASHORN_JAR \
|
||||
-Xms2G -Xmx2G \
|
||||
-XX:TypeProfileLevel=222 \
|
||||
-cp $CLASSPATH:../build/test/classes/ \
|
||||
jdk.nashorn.tools.Shell $ENABLE_TIME_FLAGS ${@}
|
||||
|
||||
|
@ -1,631 +0,0 @@
|
||||
This document describes system properties that are used for internal
|
||||
debugging and instrumentation purposes, along with the system loggers,
|
||||
which are used for the same thing.
|
||||
|
||||
This document is intended as a developer resource, and it is not
|
||||
needed as Nashorn documentation for normal usage. Flags and system
|
||||
properties described herein are subject to change without notice.
|
||||
|
||||
=====================================
|
||||
1. System properties used internally
|
||||
=====================================
|
||||
|
||||
This documentation of the system property flags assume that the
|
||||
default value of the flag is false, unless otherwise specified.
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.args=<string>
|
||||
|
||||
This property takes as its value a space separated list of Nashorn
|
||||
command line options that should be passed to Nashorn. This might be
|
||||
useful in environments where it is hard to tell how a nashorn.jar is
|
||||
launched.
|
||||
|
||||
Example:
|
||||
|
||||
> java -Dnashorn.args="--lazy-complation --log=compiler" large-java-app-with-nashorn.jar
|
||||
> ant -Dnashorn.args="--log=codegen" antjob
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.args.prepend=<string>
|
||||
|
||||
This property behaves like nashorn.args, but adds the given arguments
|
||||
before the existing ones instead of after them. Later arguments will
|
||||
overwrite earlier ones, so this is useful for setting default arguments
|
||||
that can be overwritten.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.unstable.relink.threshold=x
|
||||
|
||||
NOTE: This property is deprecated in favor of the
|
||||
"--unstable-relink-threshold" command line option. It controls how many
|
||||
call site misses are allowed before a callsite is relinked with "apply"
|
||||
semantics to never change again. In the case of megamorphic callsites,
|
||||
this is necessary, or the program would spend all its time swapping out
|
||||
callsite targets. When neither the system property nor the command line
|
||||
option are specified, defaults to 8, or 16 with optimistic types turned
|
||||
on.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.compiler.splitter.threshold=x
|
||||
|
||||
This will change the node weight that requires a subgraph of the IR to
|
||||
be split into several classes in order not to run out of bytecode space.
|
||||
The default value is 0x8000 (32768).
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.serialize.compression=<x>
|
||||
|
||||
This property sets the compression level used when deflating serialized
|
||||
AST structures of anonymous split functions. Valid values range from 0 to 9,
|
||||
the default value is 4. Higher values will reduce memory size of serialized
|
||||
AST but increase CPU usage required for compression.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.codegen.debug.trace=<x>
|
||||
|
||||
See the description of the codegen logger below.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.fields.objects, -Dnashorn.fields.dual
|
||||
|
||||
When the nashorn.fields.objects property is true, Nashorn will always
|
||||
use object fields for AccessorProperties, requiring boxing for all
|
||||
primitive property values. When nashorn.fields.dual is set, Nashorn
|
||||
will always use dual long/object fields, which allows primitives to be
|
||||
stored without boxing. When neither system property is set, Nashorn
|
||||
chooses a setting depending on the optimistic types setting (dual
|
||||
fields when optimistic types are enabled, object-only fields otherwise).
|
||||
|
||||
With dual fields, Nashorn uses long fields to store primitive values.
|
||||
Ints are represented as the 32 low bits of the long fields. Doubles
|
||||
are represented as the doubleToLongBits of their value. This way a
|
||||
single field can be used for all primitive types. Packing and
|
||||
unpacking doubles to their bit representation is intrinsified by
|
||||
the JVM and extremely fast.
|
||||
|
||||
In the future, this might complement or be replaced by experimental
|
||||
feature sun.misc.TaggedArray, which has been discussed on the mlvm
|
||||
mailing list. TaggedArrays are basically a way to share data space
|
||||
between primitives and references, and have the GC understand this.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.compiler.symbol.trace=[<x>[,*]],
|
||||
-Dnashorn.compiler.symbol.stacktrace=[<x>[,*]]
|
||||
|
||||
When this property is set, creation and manipulation of any symbol
|
||||
named "x" will show information about when the compiler changes its
|
||||
type assumption, bytecode local variable slot assignment and other
|
||||
data. This is useful if, for example, a symbol shows up as an Object,
|
||||
when you believe it should be a primitive. Usually there is an
|
||||
explanation for this, for example that it exists in the global scope
|
||||
and type analysis has to be more conservative.
|
||||
|
||||
Several symbols names to watch can be specified by comma separation.
|
||||
|
||||
If no variable name is specified (and no equals sign), all symbols
|
||||
will be watched
|
||||
|
||||
By using "stacktrace" instead of or together with "trace", stack
|
||||
traces will be displayed upon symbol changes according to the same
|
||||
semantics.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.lexer.xmlliterals
|
||||
|
||||
If this property it set, it means that the Lexer should attempt to
|
||||
parse XML literals, which would otherwise generate syntax
|
||||
errors. Warning: there are currently no unit tests for this
|
||||
functionality.
|
||||
|
||||
XML literals, when this is enabled, end up as standard LiteralNodes in
|
||||
the IR.
|
||||
|
||||
|
||||
SYSTEM_PROPERTY: -Dnashorn.debug
|
||||
|
||||
If this property is set to true, Nashorn runs in Debug mode. Debug
|
||||
mode is slightly slower, as for example statistics counters are enabled
|
||||
during the run. Debug mode makes available a NativeDebug instance
|
||||
called "Debug" in the global space that can be used to print property
|
||||
maps and layout for script objects, as well as a "dumpCounters" method
|
||||
that will print the current values of the previously mentioned stats
|
||||
counters.
|
||||
|
||||
These functions currently exists for Debug:
|
||||
|
||||
"map" - print(Debug.map(x)) will dump the PropertyMap for object x to
|
||||
stdout (currently there also exist functions called "embedX", where X
|
||||
is a value from 0 to 3, that will dump the contents of the embed pool
|
||||
for the first spill properties in any script object and "spill", that
|
||||
will dump the contents of the growing spill pool of spill properties
|
||||
in any script object. This is of course subject to change without
|
||||
notice, should we change the script object layout.
|
||||
|
||||
"methodHandle" - this method returns the method handle that is used
|
||||
for invoking a particular script function.
|
||||
|
||||
"identical" - this method compares two script objects for reference
|
||||
equality. It is a == Java comparison
|
||||
|
||||
"equals" - Returns true if two objects are either referentially
|
||||
identical or equal as defined by java.lang.Object.equals.
|
||||
|
||||
"dumpCounters" - will dump the debug counters' current values to
|
||||
stdout.
|
||||
|
||||
Currently we count number of ScriptObjects in the system, number of
|
||||
Scope objects in the system, number of ScriptObject listeners added,
|
||||
removed and dead (without references).
|
||||
|
||||
We also count number of ScriptFunctions, ScriptFunction invocations
|
||||
and ScriptFunction allocations.
|
||||
|
||||
Furthermore we count PropertyMap statistics: how many property maps
|
||||
exist, how many times were property maps cloned, how many times did
|
||||
the property map history cache hit, prevent new allocations, how many
|
||||
prototype invalidations were done, how many time the property map
|
||||
proto cache hit.
|
||||
|
||||
Finally we count callsite misses on a per callsite bases, which occur
|
||||
when a callsite has to be relinked, due to a previous assumption of
|
||||
object layout being invalidated.
|
||||
|
||||
"getContext" - return the current Nashorn context.
|
||||
|
||||
"equalWithoutType" - Returns true if if the two objects are both
|
||||
property maps, and they have identical properties in the same order,
|
||||
but allows the properties to differ in their types.
|
||||
|
||||
"diffPropertyMaps" Returns a diagnostic string representing the difference
|
||||
of two property maps.
|
||||
|
||||
"getClass" - Returns the Java class of an object, or undefined if null.
|
||||
|
||||
"toJavaString" - Returns the Java toString representation of an object.
|
||||
|
||||
"toIdentString" - Returns a string representation of an object consisting
|
||||
of its java class name and hash code.
|
||||
|
||||
"getListenerCount" - Return the number of property listeners for a
|
||||
script object.
|
||||
|
||||
"getEventQueueCapacity" - Get the capacity of the event queue.
|
||||
|
||||
"setEventQueueCapacity" - Set the event queue capacity.
|
||||
|
||||
"addRuntimeEvent" - Add a runtime event to the runtime event queue.
|
||||
The queue has a fixed size (see -Dnashorn.runtime.event.queue.size)
|
||||
and the oldest entry will be thrown out of the queue is about to overflow.
|
||||
|
||||
"expandEventQueueCapacity" - Expands the event queue capacity,
|
||||
or truncates if capacity is lower than current capacity. Then only
|
||||
the newest entries are kept.
|
||||
|
||||
"clearRuntimeEvents" - Clear the runtime event queue.
|
||||
|
||||
"removeRuntimeEvent" - Remove a specific runtime event from the event queue.
|
||||
|
||||
"getRuntimeEvents" - Return all runtime events in the queue as an array.
|
||||
|
||||
"getLastRuntimeEvent" - Return the last runtime event in the queue.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.methodhandles.debug.stacktrace
|
||||
|
||||
This enhances methodhandles logging (see below) to also dump the
|
||||
stack trace for every instrumented method handle operation.
|
||||
Warning: This is enormously verbose, but provides a pretty
|
||||
decent "grep:able" picture of where the calls are coming from.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.cce
|
||||
|
||||
Setting this system property causes the Nashorn linker to rely on
|
||||
ClassCastExceptions for triggering a callsite relink. If not set, the linker
|
||||
will add an explicit instanceof guard.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.spill.threshold=<x>
|
||||
|
||||
This property sets the number of fields in an object from which to use
|
||||
generic array based spill storage instead of Java fields. The default value
|
||||
is 256.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.tcs.miss.samplePercent=<x>
|
||||
|
||||
When running with the trace callsite option (-tcs), Nashorn will count
|
||||
and instrument any callsite misses that require relinking. As the
|
||||
number of relinks is large and usually produces a lot of output, this
|
||||
system property can be used to constrain the percentage of misses that
|
||||
should be logged. Typically this is set to 1 or 5 (percent). 1% is the
|
||||
default value.
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.persistent.code.cache
|
||||
|
||||
This property can be used to set the directory where Nashorn stores
|
||||
serialized script classes generated with the -pcc/--persistent-code-cache
|
||||
option. The default directory name is "nashorn_code_cache".
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.typeInfo.maxFiles
|
||||
|
||||
Maximum number of files to store in the type info cache. The type info cache
|
||||
is used to cache type data of JavaScript functions when running with
|
||||
optimistic types (-ot/--optimistic-types). There is one file per JavaScript
|
||||
function in the cache.
|
||||
|
||||
The default value is 0 which means the feature is disabled. Setting this
|
||||
to something like 20000 is probably good enough for most applications and
|
||||
will usually cap the cache directory to about 80MB presuming a 4kB
|
||||
filesystem allocation unit. Set this to "unlimited" to run without limit.
|
||||
|
||||
If the value is not 0 or "unlimited", Nashorn will spawn a cleanup thread
|
||||
that makes sure the number of files in the cache does not exceed the given
|
||||
value by deleting the least recently modified files.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.typeInfo.cacheDir
|
||||
|
||||
This property can be used to set the directory where Nashorn stores the
|
||||
type info cache when -Dnashorn.typeInfo.maxFiles is set to a nonzero
|
||||
value. The default location is platform specific. On Windows, it is
|
||||
"${java.io.tmpdir}\com.oracle.java.NashornTypeInfo". On Linux and
|
||||
Solaris it is "~/.cache/com.oracle.java.NashornTypeInfo". On Mac OS X,
|
||||
it is "~/Library/Caches/com.oracle.java.NashornTypeInfo".
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.typeInfo.cleanupDelaySeconds=<value>
|
||||
|
||||
This sets the delay between cleanups of the typeInfo cache, in seconds.
|
||||
The default delay is 20 seconds.
|
||||
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.profilefile=<filename>
|
||||
|
||||
When running with the profile callsite options (-pcs), Nashorn will
|
||||
dump profiling data for all callsites to stderr as a shutdown hook. To
|
||||
instead redirect this to a file, specify the path to the file using
|
||||
this system property.
|
||||
|
||||
|
||||
SYSTEM_PROPERTY: -Dnashorn.regexp.impl=[jdk|joni]
|
||||
|
||||
This property defines the regular expression engine to be used by
|
||||
Nashorn. Set this flag to "jdk" to get an implementation based on the
|
||||
JDK's java.util.regex package. Set this property to "joni" to install
|
||||
an implementation based on Joni, the regular expression engine used by
|
||||
the JRuby project. The default value for this flag is "joni"
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.runtime.event.queue.size=<value>
|
||||
|
||||
Nashorn provides a fixed sized runtime event queue for debugging purposes.
|
||||
See -Dnashorn.debug for methods to access the event queue.
|
||||
The default value is 1024.
|
||||
|
||||
SYSTEM PROPERTY: -Dnashorn.anonymous.classes.threshold=<value>
|
||||
|
||||
Nashorn can use anonymous classes for loading compiled scripts, depending
|
||||
on the --anonymous-classes=[auto|true|false] option. Anonymous classes load
|
||||
faster, but the loaded classes get less optimization applied to them and
|
||||
therefore usually run slower. In the default "auto" setting, scripts are
|
||||
loaded as anonymous classes if the script size does not exceed 512 bytes.
|
||||
The above system property allows to set this threshold to a user defined
|
||||
value.
|
||||
|
||||
===============
|
||||
2. The loggers.
|
||||
===============
|
||||
|
||||
It is very simple to create your own logger. Use the DebugLogger class
|
||||
and give the subsystem name as a constructor argument.
|
||||
|
||||
The Nashorn loggers can be used to print per-module or per-subsystem
|
||||
debug information with different levels of verbosity. The loggers for
|
||||
a given subsystem are available are enabled by using
|
||||
|
||||
--log=<systemname>[:<level>]
|
||||
|
||||
on the command line.
|
||||
|
||||
Here <systemname> identifies the name of the subsystem to be logged
|
||||
and the optional colon and level argument is a standard
|
||||
java.util.logging.Level name (severe, warning, info, config, fine,
|
||||
finer, finest). If the level is left out for a particular subsystem,
|
||||
it defaults to "info". Any log message logged as the level or a level
|
||||
that is more important will be output to stderr by the logger.
|
||||
|
||||
Several loggers can be enabled by a single command line option, by
|
||||
putting a comma after each subsystem/level tuple (or each subsystem if
|
||||
level is unspecified). The --log option can also be given multiple
|
||||
times on the same command line, with the same effect.
|
||||
|
||||
For example: --log=codegen,fields:finest is equivalent to
|
||||
--log=codegen:info --log=fields:finest
|
||||
|
||||
The following is an incomplete list of subsystems that currently
|
||||
support logging. Look for classes implementing
|
||||
jdk.nashorn.internal.runtime.logging.Loggable for more loggers.
|
||||
|
||||
|
||||
* compiler
|
||||
|
||||
The compiler is in charge of turning source code and function nodes
|
||||
into byte code, and installs the classes into a class loader
|
||||
controlled from the Context. Log messages are, for example, about
|
||||
things like new compile units being allocated. The compiler has global
|
||||
settings that all the tiers of codegen (e.g. Lower and CodeGenerator)
|
||||
use.s
|
||||
|
||||
|
||||
* recompile
|
||||
|
||||
This logger shows information about recompilation of scripts and
|
||||
functions at runtime. Recompilation may happen because a function
|
||||
was called with different parameter types, or because an optimistic
|
||||
assumption failed while executing a function with -ot/--optimistic-types.
|
||||
|
||||
|
||||
* codegen
|
||||
|
||||
The code generator is the emitter stage of the code pipeline, and
|
||||
turns the lowest tier of a FunctionNode into bytecode. Codegen logging
|
||||
shows byte codes as they are being emitted, line number information
|
||||
and jumps. It also shows the contents of the bytecode stack prior to
|
||||
each instruction being emitted. This is a good debugging aid. For
|
||||
example:
|
||||
|
||||
[codegen] #41 line:2 (f)_afc824e
|
||||
[codegen] #42 load symbol x slot=2
|
||||
[codegen] #43 {1:O} load int 0
|
||||
[codegen] #44 {2:I O} dynamic_runtime_call GT:ZOI_I args=2 returnType=boolean
|
||||
[codegen] #45 signature (Ljava/lang/Object;I)Z
|
||||
[codegen] #46 {1:Z} ifeq ternary_false_5402fe28
|
||||
[codegen] #47 load symbol x slot=2
|
||||
[codegen] #48 {1:O} goto ternary_exit_107c1f2f
|
||||
[codegen] #49 ternary_false_5402fe28
|
||||
[codegen] #50 load symbol x slot=2
|
||||
[codegen] #51 {1:O} convert object -> double
|
||||
[codegen] #52 {1:D} neg
|
||||
[codegen] #53 {1:D} convert double -> object
|
||||
[codegen] #54 {1:O} ternary_exit_107c1f2f
|
||||
[codegen] #55 {1:O} return object
|
||||
|
||||
shows a ternary node being generated for the sequence "return x > 0 ?
|
||||
x : -x"
|
||||
|
||||
The first number on the log line is a unique monotonically increasing
|
||||
emission id per bytecode. There is no guarantee this is the same id
|
||||
between runs. depending on non deterministic code
|
||||
execution/compilation, but for small applications it usually is. If
|
||||
the system variable -Dnashorn.codegen.debug.trace=<x> is set, where x
|
||||
is a bytecode emission id, a stack trace will be shown as the
|
||||
particular bytecode is about to be emitted. This can be a quick way to
|
||||
determine where it comes from without attaching the debugger. "Who
|
||||
generated that neg?"
|
||||
|
||||
The --log=codegen option is equivalent to setting the system variable
|
||||
"nashorn.codegen.debug" to true.
|
||||
|
||||
* fold
|
||||
|
||||
Shows constant folding taking place before lowering
|
||||
|
||||
* lower
|
||||
|
||||
This is the first lowering pass.
|
||||
|
||||
Lower is a code generation pass that turns high level IR nodes into
|
||||
lower level one, for example substituting comparisons to RuntimeNodes
|
||||
and inlining finally blocks.
|
||||
|
||||
Lower is also responsible for determining control flow information
|
||||
like end points.
|
||||
|
||||
* symbols
|
||||
|
||||
The symbols logger tracks the assignment os symbols to identifiers.
|
||||
|
||||
* scopedepths
|
||||
|
||||
This logs the calculation of scope depths for non-local symbols.
|
||||
|
||||
* fields
|
||||
|
||||
The --log=fields option (at info level) is equivalent to setting the
|
||||
system variable "nashorn.fields.debug" to true. At the info level it
|
||||
will only show info about type assumptions that were invalidated. If
|
||||
the level is set to finest, it will also trace every AccessorProperty
|
||||
getter and setter in the program, show arguments, return values
|
||||
etc. It will also show the internal representation of respective field
|
||||
(Object in the normal case, unless running with the dual field
|
||||
representation)
|
||||
|
||||
* time
|
||||
|
||||
This enables timers for various phases of script compilation. The timers
|
||||
will be dumped when the Nashorn process exits. We see a percentage value
|
||||
of how much time was spent not executing bytecode (i.e. compilation and
|
||||
internal tasks) at the end of the report.
|
||||
|
||||
A finer level than "info" will show individual compilation timings as they
|
||||
happen.
|
||||
|
||||
Here is an example:
|
||||
|
||||
[time] Accumulated complation phase Timings:
|
||||
[time]
|
||||
[time] 'JavaScript Parsing' 1076 ms
|
||||
[time] 'Constant Folding' 159 ms
|
||||
[time] 'Control Flow Lowering' 303 ms
|
||||
[time] 'Program Point Calculation' 282 ms
|
||||
[time] 'Builtin Replacement' 71 ms
|
||||
[time] 'Code Splitting' 670 ms
|
||||
[time] 'Symbol Assignment' 474 ms
|
||||
[time] 'Scope Depth Computation' 249 ms
|
||||
[time] 'Optimistic Type Assignment' 186 ms
|
||||
[time] 'Local Variable Type Calculation' 526 ms
|
||||
[time] 'Bytecode Generation' 5177 ms
|
||||
[time] 'Class Installation' 1854 ms
|
||||
[time]
|
||||
[time] Total runtime: 11994 ms (Non-runtime: 11027 ms [91%])
|
||||
|
||||
* methodhandles
|
||||
|
||||
If this logger is enabled, each MethodHandle related call that uses
|
||||
the java.lang.invoke package gets its MethodHandle intercepted and an
|
||||
instrumentation printout of arguments and return value appended to
|
||||
it. This shows exactly which method handles are executed and from
|
||||
where. (Also MethodTypes and SwitchPoints).
|
||||
|
||||
* classcache
|
||||
|
||||
This logger shows information about reusing code classes using the
|
||||
in-memory class cache. Nashorn will try to avoid compilation of
|
||||
scripts by using existing classes. This can significantly improve
|
||||
performance when repeatedly evaluating the same script.
|
||||
|
||||
=======================
|
||||
3. Undocumented options
|
||||
=======================
|
||||
|
||||
Here follows a short description of undocumented options for Nashorn.
|
||||
To see a list of all undocumented options, use the (undocumented) flag
|
||||
"-xhelp".
|
||||
|
||||
i.e. jjs -xhelp or java -jar nashorn.jar -xhelp
|
||||
|
||||
Undocumented options are not guaranteed to work, run correctly or be
|
||||
bug free. They are experimental and for internal or debugging use.
|
||||
They are also subject to change without notice.
|
||||
|
||||
In practice, though, all options below not explicitly documented as
|
||||
EXPERIMENTAL can be relied upon, for example --dump-on-error is useful
|
||||
for any JavaScript/Nashorn developer, but there is no guarantee.
|
||||
|
||||
A short summary follows:
|
||||
|
||||
-D (-Dname=value. Set a system property. This option can be repeated.)
|
||||
|
||||
-ccs, --class-cache-size (Size of the Class cache size per global scope.)
|
||||
|
||||
-cp, -classpath (-cp path. Specify where to find user class files.)
|
||||
|
||||
-co, --compile-only (Compile without running.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-d, --dump-debug-dir (specify a destination directory to dump class files.)
|
||||
param: <path>
|
||||
|
||||
--debug-lines (Generate line number table in .class files.)
|
||||
param: [true|false] default: true
|
||||
|
||||
--debug-locals (Generate local variable table in .class files.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-doe, -dump-on-error (Dump a stack trace on errors.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--early-lvalue-error (invalid lvalue expressions should be reported as early errors.)
|
||||
param: [true|false] default: true
|
||||
|
||||
--empty-statements (Preserve empty statements in AST.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-fv, -fullversion (Print full version info of Nashorn.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--function-statement-error (Report an error when function declaration is used as a statement.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--function-statement-warning (Warn when function declaration is used as a statement.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-fx (Launch script as an fx application.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--global-per-engine (Use single Global instance per script engine instance.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-h, -help (Print help for command line flags.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--loader-per-compile (Create a new class loader per compile.)
|
||||
param: [true|false] default: true
|
||||
|
||||
-l, --locale (Set Locale for script execution.)
|
||||
param: <locale> default: en-US
|
||||
|
||||
--log (Enable logging of a given level for a given number of sub systems.
|
||||
[for example: --log=fields:finest,codegen:info].)
|
||||
param: <module:level>,*
|
||||
|
||||
-nj, --no-java (Disable Java support.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-nse, --no-syntax-extensions (Disallow non-standard syntax extensions.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-nta, --no-typed-arrays (Disable typed arrays support.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--parse-only (Parse without compiling.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--print-ast (Print abstract syntax tree.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-pc, --print-code (Print generated bytecode. If a directory is specified, nothing will
|
||||
be dumped to stderr. Also, in that case, .dot files will be generated
|
||||
for all functions or for the function with the specified name only.)
|
||||
param: [dir:<output-dir>,function:<name>]
|
||||
|
||||
--print-lower-ast (Print lowered abstract syntax tree.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-plp, --print-lower-parse (Print the parse tree after lowering.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--print-no-newline (Print function will not print new line char.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-pp, --print-parse (Print the parse tree.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--print-symbols (Print the symbol table.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-pcs, --profile-callsites (Dump callsite profile data.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-scripting (Enable scripting features.)
|
||||
param: [true|false] default: false
|
||||
|
||||
--stderr (Redirect stderr to a filename or to another tty, e.g. stdout.)
|
||||
param: <output console>
|
||||
|
||||
--stdout (Redirect stdout to a filename or to another tty, e.g. stderr.)
|
||||
param: <output console>
|
||||
|
||||
-strict (Run scripts in strict mode.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-t, -timezone (Set timezone for script execution.)
|
||||
param: <timezone> default: Europe/Stockholm
|
||||
|
||||
-tcs, --trace-callsites (Enable callsite trace mode. Options are: miss [trace callsite misses]
|
||||
enterexit [trace callsite enter/exit], objects [print object properties].)
|
||||
param: [=[option,]*]
|
||||
|
||||
-urt, --unstable-relink-threshold (Number of times a dynamic call site has to be relinked before it
|
||||
is considered unstable, when the runtime will try to link it as
|
||||
if it is megamorphic.)
|
||||
|
||||
--verify-code (Verify byte code before running.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-v, -version (Print version info of Nashorn.)
|
||||
param: [true|false] default: false
|
||||
|
||||
-xhelp (Print extended help for command line flags.)
|
||||
param: [true|false] default: false
|
||||
|
@ -1,988 +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.
|
||||
-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html class=" regenabled gecko radius jsenabled regloaded" xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Java Scripting Programmer's Guide</title>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- MAIN CONTENT -->
|
||||
<!-- ============ -->
|
||||
<table summary="layout" border="0" width="100%">
|
||||
<tbody><tr>
|
||||
<td>
|
||||
|
||||
<div id="sharepage" class="smallpagetitle"><h1>Java Scripting Programmer's Guide</h1><div class="sharepage"> <div class="sharepagew1 share-mailto"> <table summary="" cellpadding="0" cellspacing="0"><tbody><tr> <td id="share-mailto"><a href="mailto:?subject=Java%20Documentation%20Page:%20Java%20Scripting%20Programmer%27s%20Guide&body=Check%20out%20this%20page:%20%0A%0Ahttp%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html" class="sharelink mailto" title="Email this page to a friend"></a></td> <td id="share-technorati"><a href="http://technorati.com/search/http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html" class="sharelink technorati" title="See who links to this page on Technorati"></a></td> <td id="share-delicious"><a href="http://del.icio.us/post?v=4;url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html;title=Java%20Scripting%20Programmer%27s%20Guide" class="sharelink delicious" title="Bookmark this page in del.icio.us"></a></td> <td id="share-digg"><a href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html&title=Java%20Scripting%20Programmer%27s%20Guide" class="sharelink digg" title="Submit this page to Digg"></a></td> <td id="share-slashdot"><a href="http://slashdot.org/bookmark.pl?title=Java%20Scripting%20Programmer%27s%20Guide&url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html" class="sharelink slashdot" title="Submit this page to Slashdot"></a></td> <td id="share-blank"> </td></tr></tbody></table></div></div></div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<!-- Body text begins here -->
|
||||
<ul>
|
||||
<li><span><a href="#who">Who is the Java Scripting API
|
||||
For?</a></span></li>
|
||||
<li><span><a href="#package">Scripting Package</a></span></li>
|
||||
<li><span><a href="#examples">Examples</a></span>
|
||||
<ul>
|
||||
<li><span><a href="#helloworld">"Hello, World"</a></span></li>
|
||||
<li><span><a href="#evalfile">Evaluating a Script
|
||||
File</a></span></li>
|
||||
<li><span><a href="#scriptvars">Script Variables</a></span></li>
|
||||
<li><span><a href="#invoke">Invoking Script Functions and
|
||||
Methods</a></span></li>
|
||||
<li><span><a href="#interfaces">Implementing Java Interfaces by
|
||||
Scripts</a></span></li>
|
||||
<li><span><a href="#scopes">Multiple Scopes for
|
||||
Scripts</a></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><span><a href="#jsengine">JavaScript Script
|
||||
Engine</a></span></li>
|
||||
<li><span><a href="#jstojava">JavaScript to Java
|
||||
Communication</a></span>
|
||||
<ul>
|
||||
<li><span><a href="#jsjavaclass">Accessing Java
|
||||
Classes</a></span></li>
|
||||
<li><span><a href="#jsimport">Importing Java Packages,
|
||||
Classes</a></span></li>
|
||||
<li><span><a href="#jsarrays">Creating, Converting and Using Java
|
||||
Arrays</a></span></li>
|
||||
<li><span><a href="#jsimplement">Implementing Java
|
||||
Interfaces</a></span></li>
|
||||
<li><span><a href="#jsextendabstract">Extending Abstract Java Classes
|
||||
</a></span></li>
|
||||
<li><span><a href="#jsextendconcrete">Extending Concrete Java Classes
|
||||
</a></span></li>
|
||||
<li><span><a href="#jsimplementmultiple">Implementing Multiple Java Interfaces
|
||||
</a></span></li>
|
||||
<li><span><a href="#classBoundImplementations">Class-Bound Implementations
|
||||
</a></span></li>
|
||||
<li><span><a href="#jsoverload">Overload Resolution</a></span></li>
|
||||
<li><span><a href="#dataTypeMapping">Mapping of Data Types Between Java
|
||||
and JavaScript</a></span></li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li><span><a href="#engineimpl">Implementing Your Own Script
|
||||
Engine</a></span></li>
|
||||
<li><span><a href="#refs">References</a></span></li>
|
||||
</ul>
|
||||
<span><a name="who" id="who"></a></span>
|
||||
<h2><span>Who is the Java Scripting API For?</span></h2>
|
||||
<span>Some useful characteristics of scripting languages
|
||||
are:</span>
|
||||
<ul>
|
||||
<li><span><b>Convenience</b>: Most scripting languages are
|
||||
dynamically typed. You can usually create new variables without
|
||||
declaring the variable type, and you can reuse variables to store
|
||||
objects of different types. Also, scripting languages tend to
|
||||
perform many type conversions automatically, for example,
|
||||
converting the number 10 to the text "10" as necessary.</span></li>
|
||||
<li><span><b>Developing rapid prototypes</b>: You can avoid the
|
||||
edit-compile-run cycle and just use edit-run!</span></li>
|
||||
<li><span><b>Application extension/customization</b>: You can
|
||||
"externalize" parts of your application - like configuration
|
||||
scripts, business logic/rules and math expressions for financial
|
||||
applications.</span></li>
|
||||
<li><span><b>"Command line" shells for applications</b> -for
|
||||
debugging, runtime/deploy time configuration etc. Most applications
|
||||
have a web-based GUI configuaration tool these days. But
|
||||
sysadmins/deployers frequently prefer command line tools. Instead
|
||||
of inventing ad-hoc scripting language for that purpose, a
|
||||
"standard" scripting language can be used.</span></li>
|
||||
</ul>
|
||||
<p><span>The Java<font size="-1"><sup>TM</sup></font> Scripting API
|
||||
is a scripting language indepedent framework for using script
|
||||
engines from Java code. With the Java Scripting API, it is possible
|
||||
to write customizable/extendable applications in the Java language
|
||||
and leave the customization scripting language choice to the end
|
||||
user. The Java application developer need not choose the extension
|
||||
language during development. If you write your application with
|
||||
JSR-223 API, then your users can use any JSR-223 compliant
|
||||
scripting language.</span></p>
|
||||
<hr>
|
||||
<span><a name="package" id="package"></a></span>
|
||||
<h2><span>Scripting Package</span></h2>
|
||||
<p><span>The Java Scripting functionality is in the <code><a href="http://docs.oracle.com/javase/9/docs/api/javax/script/package-summary.html">javax.script</a></code>
|
||||
package. This is a relatively small, simple API. The starting point
|
||||
of the scripting API is the <code>ScriptEngineManager</code> class.
|
||||
A ScriptEngineManager object can discover script engines through
|
||||
the jar file service discovery mechanism. It can also instantiate
|
||||
ScriptEngine objects that interpret scripts written in a specific
|
||||
scripting language. The simplest way to use the scripting API is as
|
||||
follows:</span></p>
|
||||
<ol>
|
||||
<li><span>Create a <code>ScriptEngineManager</code>
|
||||
object.</span></li>
|
||||
<li><span>Get a <code>ScriptEngine</code> object from the
|
||||
manager.</span></li>
|
||||
<li><span>Evaluate script using the <code>ScriptEngine</code>'s
|
||||
<code>eval</code> methods.</span></li>
|
||||
</ol>
|
||||
<p><span>Now, it is time to look at some sample code. While it is
|
||||
not mandatory, it may be useful to know a bit of JavaScript to read
|
||||
these examples.</span></p>
|
||||
<hr>
|
||||
<span><a name="examples" id="examples"></a></span>
|
||||
<h2><span>Examples</span></h2>
|
||||
<span><a name="helloworld" id="helloworld"></a></span>
|
||||
<h3><span>"Hello, World"</span></h3>
|
||||
<p><span>From the <code>ScriptEngineManager</code> instance, we
|
||||
request a JavaScript engine instance using
|
||||
<code>getEngineByName</code> method. On the script engine, the
|
||||
<code>eval</code> method is called to execute a given String as
|
||||
JavaScript code! For brevity, in this as well as in subsequent
|
||||
examples, we have not shown exception handling. There are checked
|
||||
and runtime exceptions thrown from <code>javax.script</code> API.
|
||||
Needless to say, you have to handle the exceptions
|
||||
appropriately.</span></p>
|
||||
<pre>
|
||||
<span><code>
|
||||
// <a href="source/EvalScript.java">EvalScript.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
public class EvalScript {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// create a script engine manager
|
||||
<span class="classref">ScriptEngineManager</span> factory = new ScriptEngineManager();
|
||||
// create a JavaScript engine
|
||||
<span class="classref">ScriptEngine</span> engine = factory.<span class="methodref">getEngineByName</span>("nashorn");
|
||||
// evaluate JavaScript code from String
|
||||
engine.<span class="methodref">eval</span>("print('Hello, World')");
|
||||
}
|
||||
}
|
||||
</code></span>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="evalfile" id="evalfile"></a>
|
||||
<h3>Evaluating a Script File</h3>
|
||||
<p>In this example, we call the <code>eval</code> method that
|
||||
accepts <code>java.io.Reader</code> for the input source. The
|
||||
script read by the given reader is executed. This way it is
|
||||
possible to execute scripts from files, URLs and resources by
|
||||
wrapping the relevant input stream objects as readers.</p>
|
||||
<pre>
|
||||
<code>
|
||||
// <a href="source/EvalFile.java">EvalFile.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class EvalFile {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// create a script engine manager
|
||||
<span class="classref">ScriptEngineManager</span> factory = new ScriptEngineManager();
|
||||
// create JavaScript engine
|
||||
<span class="classref">ScriptEngine</span> engine = factory.<span class="methodref">getEngineByName</span>("nashorn");
|
||||
// evaluate JavaScript code from given file - specified by first argument
|
||||
engine.<span class="methodref">eval</span>(new java.io.FileReader(args[0]));
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
Let us assume that we have the file named <a href="source/test.js">test.js</a> with the
|
||||
following text:
|
||||
<pre><code>
|
||||
print("This is hello from test.js");
|
||||
</code>
|
||||
</pre>
|
||||
We can run the above Java as
|
||||
<pre><code>
|
||||
java EvalFile test.js
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="scriptvars" id="scriptvars"></a>
|
||||
<h3>Script Variables</h3>
|
||||
<p>When you embed script engines and scripts with your Java
|
||||
application, you may want to expose your application objects as
|
||||
global variables to scripts. This example demonstrates how you can
|
||||
expose your application objects as global variables to a script. We
|
||||
create a <code>java.io.File</code> in the application and expose
|
||||
the same as a global variable with the name "file". The script can
|
||||
access the variable - for example, it can call public methods on
|
||||
it. Note that the syntax to access Java objects, methods and fields
|
||||
is dependent on the scripting language. JavaScript supports the
|
||||
most "natural" Java-like syntax.</p>
|
||||
<p>
|
||||
Nashorn script engine pre-defines two global variables named "context"
|
||||
and "engine". The "context" variable is of type javax.script.ScriptContext
|
||||
and refers to the current ScriptContext instance passed to script engine's
|
||||
eval method. The "engine" variable is of type javax.script.ScriptEngine and
|
||||
refers to the current nashorn script engine instance evaluating the script.
|
||||
Both of these variables are non-writable, non-enumerable and non-configurable
|
||||
- which implies script code can not write overwrite the value, for..loop iteration
|
||||
on global object will not iterate these variables and these variables can not be
|
||||
deleted by script.
|
||||
<pre><code>
|
||||
// <a href="source/ScriptVars.java">ScriptVars.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
import java.io.*;
|
||||
|
||||
public class ScriptVars {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
File f = new File("test.txt");
|
||||
// expose File object as variable to script
|
||||
engine.<span class="methodref">put</span>("file", f);
|
||||
|
||||
// evaluate a script string. The script accesses "file"
|
||||
// variable and calls method on it
|
||||
engine.eval("print(file.getAbsolutePath())");
|
||||
}
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="invoke" id="invoke"></a>
|
||||
<h3>Invoking Script Functions and Methods</h3>
|
||||
<p>Sometimes you may want to call a specific scripting function
|
||||
repeatedly - for example, your application menu functionality might
|
||||
be implemented by a script. In your menu's action event handler you
|
||||
may want to call a specific script function. The following example
|
||||
demonstrates invoking a specific script function from Java
|
||||
code.</p>
|
||||
<pre><code>
|
||||
// <a href="source/InvokeScriptFunction.java">InvokeScriptFunction.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class InvokeScriptFunction {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
String script = "function hello(name) { print('Hello, ' + name); }";
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// <code>javax.script.Invocable</code> is an optional interface.
|
||||
// Check whether your script engine implements it or not!
|
||||
// Note that the JavaScript engine implements Invocable interface.
|
||||
<span class="classref">Invocable</span> inv = (Invocable) engine;
|
||||
|
||||
// invoke the global function named "hello"
|
||||
inv.<span class="methodref">invokeFunction</span>("hello", "Scripting!!" );
|
||||
}
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
<p>If your scripting language is object based (like JavaScript) or
|
||||
object-oriented, then you can invoke a script method on a script
|
||||
object.</p>
|
||||
<pre><code>
|
||||
// <a href="source/InvokeScriptMethod.java">InvokeScriptMethod.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class InvokeScriptMethod {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String. This code defines a script object 'obj'
|
||||
// with one method called 'hello'.
|
||||
String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }";
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// <code>javax.script.Invocable</code> is an optional interface.
|
||||
// Check whether your script engine implements or not!
|
||||
// Note that the JavaScript engine implements Invocable interface.
|
||||
<span class="classref">Invocable</span> inv = (Invocable) engine;
|
||||
|
||||
// get script object on which we want to call the method
|
||||
Object obj = engine.<span class="methodref">get</span>("obj");
|
||||
|
||||
// invoke the method named "hello" on the script object "obj"
|
||||
inv.<span class="methodref">invokeMethod</span>(obj, "hello", "Script Method !!" );
|
||||
}
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="interfaces" id="interfaces"></a>
|
||||
<h3>Implementing Java Interfaces by Scripts</h3>
|
||||
<p>Instead of calling specific script functions from Java,
|
||||
sometimes it is convenient to implement a Java interface by script
|
||||
functions or methods. Also, by using interfaces we can avoid having
|
||||
to use the <code>javax.script</code> API in many places. We can get
|
||||
an interface implementor object and pass it to various Java APIs.
|
||||
The following example demonstrates implementing the
|
||||
<code>java.lang.Runnable</code> interface with a script.</p>
|
||||
<pre><code>
|
||||
// <a href="source/RunnableImpl.java">RunnableImpl.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class RunnableImpl {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
String script = "function run() { print('run called'); }";
|
||||
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
<span class="classref">Invocable</span> inv = (Invocable) engine;
|
||||
|
||||
// get Runnable interface object from engine. This interface methods
|
||||
// are implemented by script functions with the matching name.
|
||||
Runnable r = inv.<span class="methodref">getInterface</span>(Runnable.class);
|
||||
|
||||
// start a new thread that runs the script implemented
|
||||
// runnable interface
|
||||
Thread th = new Thread(r);
|
||||
th.start();
|
||||
th.join();
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
<p>If your scripting language is object-based or object-oriented,
|
||||
it is possible to implement a Java interface by script methods on
|
||||
script objects. This avoids having to call script global functions
|
||||
for interface methods. The script object can store the "state"
|
||||
associated with the interface implementor.</p>
|
||||
<pre><code>
|
||||
// <a href="source/RunnableImplObject.java">RunnableImplObject.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class RunnableImplObject {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
String script = "var obj = new Object(); obj.run = function() { print('run method called'); }";
|
||||
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// get script object on which we want to implement the interface with
|
||||
Object obj = engine.<span class="methodref">get</span>("obj");
|
||||
|
||||
<span class="classref">Invocable</span> inv = (Invocable) engine;
|
||||
|
||||
// get Runnable interface object from engine. This interface methods
|
||||
// are implemented by script methods of object 'obj'
|
||||
Runnable r = inv.<span class="methodref">getInterface</span>(obj, Runnable.class);
|
||||
|
||||
// start a new thread that runs the script implemented
|
||||
// runnable interface
|
||||
Thread th = new Thread(r);
|
||||
th.start();
|
||||
th.join();
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="scopes" id="scopes"></a>
|
||||
<h3>Multiple Scopes for Scripts</h3>
|
||||
<p>In the <a href="#scriptvars">script variables</a> example, we
|
||||
saw how to expose application objects as script global variables.
|
||||
It is possible to expose multiple global "scopes" for scripts. A
|
||||
single scope is an instance of <code>javax.script.Bindings</code>.
|
||||
This interface is derived from <code>java.util.Map<String,
|
||||
Object></code>. A scope a set of name-value pairs where name is
|
||||
any non-empty, non-null String.
|
||||
<code>javax.script.ScriptContext</code> interface supports multiple
|
||||
scopes with associated Bindings for each
|
||||
scope. By default, every script engine has a default script
|
||||
context. The default script context has atleast one scope called
|
||||
"ENGINE_SCOPE". Various scopes supported by a script context are
|
||||
available through <code>getScopes</code> method.</p>
|
||||
<pre><code>
|
||||
// <a href="source/MultiScopes.java">MultiScopes.java</a>
|
||||
|
||||
import javax.script.*;
|
||||
|
||||
public class MultiScopes {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScriptEngineManager manager = new ScriptEngineManager();
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
engine.put("x", "hello");
|
||||
// print global variable "x"
|
||||
engine.eval("print(x);");
|
||||
// the above line prints "hello"
|
||||
|
||||
// Now, pass a different script context
|
||||
<span class="classref">ScriptContext</span> newContext = new <span class="classref">SimpleScriptContext</span>();
|
||||
newContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
|
||||
<span class="classref">Bindings</span> engineScope = newContext.<span class="methodref">getBindings</span>(ScriptContext.ENGINE_SCOPE);
|
||||
|
||||
// add new variable "x" to the new engineScope
|
||||
engineScope.<span class="methodref">put</span>("x", "world");
|
||||
|
||||
// execute the same script - but this time pass a different script context
|
||||
engine.eval("print(x);", newContext);
|
||||
// the above line prints "world"
|
||||
}
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="jsengine" id="jsengine"></a>
|
||||
<h2>JavaScript Script Engine</h2>
|
||||
<p>Oracle's implementation of JDK 8 is co-bundled with the Nashorn ECMAScript
|
||||
script engine.
|
||||
<hr>
|
||||
<a name="jstojava" id="jstojava"></a>
|
||||
<h2>JavaScript to Java Communication</h2>
|
||||
<p>For the most part, accessing Java classes, objects and methods
|
||||
is straightforward. In particular field and method access from
|
||||
JavaScript is the same as it is from Java. We highlight important
|
||||
aspects of JavaScript Java access here.
|
||||
The following examples are JavaScript snippets accessing Java. This
|
||||
section requires knowledge of JavaScript. This section can be
|
||||
skipped if you are planning to use some other JSR-223 scripting
|
||||
language rather than JavaScript.</p>
|
||||
<hr>
|
||||
<a name="jsjavaclass" id=jsjavalass"></a>
|
||||
<h3>Accessing Java Classes</h3>
|
||||
<pre>
|
||||
<code>
|
||||
// <a href="source/javatypes.js">javatypes.js</a>
|
||||
|
||||
var arrayListType = Java.type("java.util.ArrayList")
|
||||
var intType = Java.type("int")
|
||||
var stringArrayType = Java.type("java.lang.String[]")
|
||||
var int2DArrayType = Java.type("int[][]")
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
Note that the name of the type is always a string for a fully qualified name. You can use any of these expressions to create new instances, e.g.:
|
||||
|
||||
<pre><code>
|
||||
var anArrayList = new (Java.type("java.util.ArrayList"))
|
||||
</code></pre>
|
||||
|
||||
or
|
||||
|
||||
<pre><code>
|
||||
var ArrayList = Java.type("java.util.ArrayList")
|
||||
var anArrayList = new ArrayList
|
||||
var anArrayListWithSize = new ArrayList(16)
|
||||
</code></pre>
|
||||
|
||||
In the special case of inner classes, you can either use the JVM fully qualified name, meaning using the dollar sign in the class name, or you can use the dot:
|
||||
|
||||
<pre><code>
|
||||
var ftype = Java.type("java.awt.geom.Arc2D$Float")
|
||||
</code></pre>
|
||||
|
||||
and
|
||||
|
||||
<pre><code>
|
||||
var ftype = Java.type("java.awt.geom.Arc2D.Float")
|
||||
</code></pre>
|
||||
|
||||
both work. Note however that using the dollar sign is faster, as Java.type first tries to resolve the class name as it is originally specified, and the internal JVM names for inner classes use the dollar sign. If you use the dot, Java.type will internally get a ClassNotFoundException and subsequently retry by changing the last dot to dollar sign. As a matter of fact, it'll keep replacing dots with dollar signs until it either successfully loads the class or runs out of all dots in the name. This way it can correctly resolve and load even multiply nested inner classes with the dot notation. Again, this will be slower than using the dollar signs in the name. An alternative way to access the inner class is as a property of the outer class:
|
||||
|
||||
<pre><code>
|
||||
var arctype = Java.type("java.awt.geom.Arc2D")
|
||||
var ftype = arctype.Float
|
||||
</code></pre>
|
||||
<p>
|
||||
You can access both static and non-static inner classes. If you want to create an instance of a non-static inner class, remember to pass an instance of its outer class as the first argument to the constructor.
|
||||
</p>
|
||||
<p>
|
||||
In addition to creating new instances, the type objects returned from <code>Java.type</code> calls can also be used to access the
|
||||
static fields and methods of the classes:
|
||||
<pre><code>
|
||||
var File = Java.type("java.io.File")
|
||||
File.createTempFile("nashorn", ".tmp")
|
||||
</code></pre>
|
||||
<p>
|
||||
Methods with names of the form <code>isXxx()</code>, <code>getXxx()</code>, and <code>setXxx()</code> can also be used as properties, for both instances and statics.
|
||||
</p>
|
||||
<p>
|
||||
A type object returned from <code>Java.type</code> is distinct from a <code>java.lang.Class</code> object. You can obtain one from the other using properties <code>class</code> and <code>static</code> on them.
|
||||
<pre><code>
|
||||
var ArrayList = Java.type("java.util.ArrayList")
|
||||
var a = new ArrayList
|
||||
|
||||
// All of the following print true:
|
||||
print("Type acts as target of instanceof: " + (a instanceof ArrayList))
|
||||
print("Class doesn't act as target of instanceof: " + !(a instanceof a.getClass()))
|
||||
print("Type is not same as instance's getClass(): " + (a.getClass() !== ArrayList))
|
||||
print("Type's `class` property is same as instance getClass(): " + (a.getClass() === ArrayList.class))
|
||||
print("Type is same as instance getClass()'s `static` property: " + (a.getClass().static === ArrayList))
|
||||
</code></pre>
|
||||
<p>
|
||||
You can think of the type object as similar to the class names as used in Java source code: you use them as the
|
||||
arguments to the <code>new</code> and <code>instanceof</code> operators and as the namespace for the static fields
|
||||
and methods, but they are different than the runtime <code>Class</code> objects returned by <code>getClass()</code> calls.
|
||||
Syntactically and semantically, this separation produces code that is most similar to Java code, where a distinction
|
||||
between compile-time class expressions and runtime class objects also exists. (Also, Java can't have the equivalent of <code>static</code>
|
||||
property on a <code>Class</code> object since compile-time class expressions are never reified as objects).
|
||||
</p>
|
||||
<hr>
|
||||
<a name="jsimport" id="jsimport"></a>
|
||||
<h3>Importing Java Packages, Classes</h3>
|
||||
<p>The built-in functions <code>importPackage</code> (in compatibility script) and
|
||||
<code>importClass</code> can be used to import Java packages and
|
||||
classes.</p>
|
||||
<pre><code>
|
||||
|
||||
// <a href="source/importpackageclass.js">importpackageclass.js</a>
|
||||
|
||||
// load compatibility script
|
||||
load("nashorn:mozilla_compat.js");
|
||||
// Import Java packages and classes
|
||||
// like import package.*; in Java
|
||||
<span class="functionref">importPackage</span>(java.awt);
|
||||
// like import java.awt.Frame in Java
|
||||
<span class="functionref">importClass</span>(java.awt.Frame);
|
||||
// Create Java Objects by "new ClassName"
|
||||
var frame = new java.awt.Frame("hello");
|
||||
// Call Java public methods from script
|
||||
frame.setVisible(true);
|
||||
// Access "JavaBean" properties like "fields"
|
||||
print(frame.title);
|
||||
</code>
|
||||
</pre>
|
||||
<p>The <span class="objectref">Packages</span> global variable can
|
||||
be used to access Java packages. Examples:
|
||||
<code>Packages.java.util.Vector</code>,
|
||||
<code>Packages.javax.swing.JFrame</code>. Please note that "java"
|
||||
is a shortcut for "Packages.java". There are equivalent shortcuts
|
||||
for javax, org, edu, com, net prefixes, so pratically all JDK
|
||||
platform classes can be accessed without the "Packages" prefix.</p>
|
||||
<p>Note that java.lang is not imported by default (unlike Java)
|
||||
because that would result in conflicts with JavaScript's built-in
|
||||
Object, Boolean, Math and so on.</p>
|
||||
<p><code>importPackage</code> and <code>importClass</code>
|
||||
functions "pollute" the global variable scope of JavaScript. To
|
||||
avoid that, you may use <span class="functionref">JavaImporter</span>.</p>
|
||||
<pre><code>
|
||||
|
||||
// <a href="source/javaimporter.js">javaimporter.js</a>
|
||||
|
||||
// create JavaImporter with specific packages and classes to import
|
||||
|
||||
var SwingGui = new <span class="functionref">JavaImporter</span>(javax.swing,
|
||||
javax.swing.event,
|
||||
javax.swing.border,
|
||||
java.awt.event);
|
||||
with (SwingGui) {
|
||||
// within this 'with' statement, we can access Swing and AWT
|
||||
// classes by unqualified (simple) names.
|
||||
|
||||
var mybutton = new JButton("test");
|
||||
var myframe = new JFrame("test");
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="jsarrays" id="jsarrays"></a>
|
||||
<h3>Creating, Converting and Using Java Arrays</h3>
|
||||
<p>
|
||||
Array element access or length access is the same as in Java.</p>
|
||||
<pre><code>
|
||||
// <a href="source/javaarray.js">javaarray.js</a>
|
||||
|
||||
// create Java String array of 5 elements
|
||||
var StringArray = Java.type("java.lang.String[]");
|
||||
var a = new StringArray(5);
|
||||
|
||||
// Accessing elements and length access is by usual Java syntax
|
||||
a[0] = "scripting is great!";
|
||||
print(a.length);
|
||||
print(a[0]);
|
||||
</code>
|
||||
</pre>
|
||||
<p>
|
||||
It is also possible to convert between JavaScript and Java arrays.
|
||||
Given a JavaScript array and a Java type, <code>Java.to</code> returns a Java array with the same initial contents, and with the specified array type.
|
||||
</p>
|
||||
<pre><code>
|
||||
var anArray = [1, "13", false]
|
||||
var javaIntArray = Java.to(anArray, "int[]")
|
||||
print(javaIntArray[0]) // prints 1
|
||||
print(javaIntArray[1]) // prints 13, as string "13" was converted to number 13 as per ECMAScript ToNumber conversion
|
||||
print(javaIntArray[2]) // prints 0, as boolean false was converted to number 0 as per ECMAScript ToNumber conversion
|
||||
</code></pre>
|
||||
<p>
|
||||
You can use either a string or a type object returned from <code>Java.type()</code> to specify the type of the array.
|
||||
You can also omit the array type, in which case a <code>Object[]</code> will be created.
|
||||
</p>
|
||||
<p>
|
||||
Given a Java array or Collection, <code>Java.from</code> returns a JavaScript array with a shallow copy of its contents. Note that in most cases, you can use Java arrays and lists natively in Nashorn; in cases where for some reason you need to have an actual JavaScript native array (e.g. to work with the array comprehensions functions), you will want to use this method.
|
||||
</p>
|
||||
<pre><code>
|
||||
var File = Java.type("java.io.File");
|
||||
var listCurDir = new File(".").listFiles();
|
||||
var jsList = Java.from(listCurDir);
|
||||
print(jsList);
|
||||
</code></pre>
|
||||
<hr>
|
||||
<a name="jsimplement" id="jsimplement"></a>
|
||||
<h3>Implementing Java interfaces</h3>
|
||||
<p>A Java interface can be implemented in JavaScript by using a
|
||||
Java anonymous class-like syntax:</p>
|
||||
<pre><code>
|
||||
// <a href="source/runnable.js">runnable.js</a>
|
||||
|
||||
var r = new java.lang.Runnable() {
|
||||
run: function() {
|
||||
print("running...\n");
|
||||
}
|
||||
};
|
||||
|
||||
// "r" can be passed to Java methods that expect java.lang.Runnable
|
||||
var th = new java.lang.Thread(r);
|
||||
th.start();
|
||||
th.join();
|
||||
</code>
|
||||
</pre>
|
||||
<p>When an interface with a single method is expected, you can pass
|
||||
a script function directly.(auto conversion)</p>
|
||||
<pre><code>
|
||||
// <a href="source/samfunc.js">samfunc.js</a>
|
||||
|
||||
function func() {
|
||||
print("I am func!");
|
||||
}
|
||||
|
||||
// pass script function for java.lang.Runnable argument
|
||||
var th = new java.lang.Thread(func);
|
||||
th.start();
|
||||
th.join();
|
||||
</code>
|
||||
</pre>
|
||||
<hr>
|
||||
<a name="jsextendabstract" id="jsextendabstract"></a>
|
||||
<h3>Extending Abstract Java Classes</h3>
|
||||
<p>
|
||||
If a Java class is abstract, you can instantiate an anonymous subclass of it using an argument list that is applicable to any of its public or protected constructors, but inserting a JavaScript object with functions properties that provide JavaScript implementations of the abstract methods. If method names are overloaded, the JavaScript function will provide implementation for all overloads. E.g.:
|
||||
</p>
|
||||
|
||||
<pre><code>
|
||||
var TimerTask = Java.type("java.util.TimerTask")
|
||||
var task = new TimerTask({ run: function() { print("Hello World!") } })
|
||||
</code></pre>
|
||||
|
||||
Nashorn supports a syntactic extension where a "new" expression followed by an argument is identical to invoking the constructor and passing the argument to it, so you can write the above example also as:
|
||||
|
||||
<pre><code>
|
||||
var task = new TimerTask {
|
||||
run: function() {
|
||||
print("Hello World!")
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
which is very similar to Java anonymous inner class definition. On the other hand, if the type is an abstract type with a single abstract method (commonly referred to as a "SAM type") or all abstract methods it has share the same overloaded name), then instead of an object, you can just pass a function, so the above example can become even more simplified to:
|
||||
|
||||
<pre><code>
|
||||
var task = new TimerTask(function() { print("Hello World!") })
|
||||
</code></pre>
|
||||
|
||||
<p>
|
||||
Note that in every one of these cases if you are trying to instantiate an abstract class that has constructors that take some arguments, you can invoke those simply by specifying the arguments after the initial implementation object or function.
|
||||
</p>
|
||||
<p>
|
||||
The use of functions can be taken even further; if you are invoking a Java method that takes a SAM type, you can just pass in a function object, and Nashorn will know what you meant:
|
||||
</p>
|
||||
<code><pre>
|
||||
Java.type("java.util.Timer")
|
||||
timer.schedule(function() { print("Hello World!") })
|
||||
</code></pre>
|
||||
|
||||
Here, <code>Timer.schedule()</code> expects a <code>TimerTask</code> as its argument, so Nashorn creates an instance of a TimerTask subclass and uses the passed function to implement its only abstract method, run(). In this usage though, you can't use non-default constructors; the type must be either an interface, or must have a protected or public no-arg constructor.
|
||||
|
||||
<hr>
|
||||
<a name="jsextendconcrete" id="jsextendconcrete"></a>
|
||||
<h3>Extending Concrete Java Classes</h3>
|
||||
<p>
|
||||
To extend a concrete Java class, you have to use <code>Java.extend</code> function.
|
||||
<code>Java.extend</code> returns a type object for a subclass of the specified Java class (or implementation of the specified interface) that acts as a script-to-Java adapter for it.
|
||||
</p>
|
||||
<pre><code>
|
||||
// <a href="source/javaextend.js">javaextend.js</a>
|
||||
|
||||
var ArrayList = Java.type("java.util.ArrayList")
|
||||
var ArrayListExtender = Java.extend(ArrayList)
|
||||
var printSizeInvokedArrayList = new ArrayListExtender() {
|
||||
size: function() { print("size invoked!"); }
|
||||
}
|
||||
var printAddInvokedArrayList = new ArrayListExtender() {
|
||||
add: function(x, y) {
|
||||
if(typeof(y) === "undefined") {
|
||||
print("add(e) invoked!");
|
||||
} else {
|
||||
print("add(i, e) invoked!");
|
||||
}
|
||||
}
|
||||
};
|
||||
printSizeInvokedArrayList.size();
|
||||
printAddInvokedArrayList.add(33, 33);
|
||||
</code></pre>
|
||||
<p>
|
||||
The reason you must use <code>Java.extend()</code> with concrete classes is that with concrete classes, there can be a
|
||||
syntactic ambiguity if you just invoke their constructor. Consider this example:
|
||||
</p>
|
||||
<pre><code>
|
||||
var t = new java.lang.Thread({ run: function() { print("Hello!") } })
|
||||
</code></pre>
|
||||
<p>
|
||||
If we allowed subclassing of concrete classes with constructor syntax, Nashorn couldn't tell if you're creating a new
|
||||
<code>Thread</code> and passing it a <code>Runnable</code> at this point, or you are subclassing <code>Thread</code> and
|
||||
passing it a new implementation for its own <code>run()</code> method.
|
||||
</p>
|
||||
<hr>
|
||||
<a name="jsimplementmultiple" id="jsimplementmultiple"></a>
|
||||
<h3>Implementing Multiple Interfaces</h3>
|
||||
<p>
|
||||
<code>Java.extend</code> can in fact take a list of multiple types. At most one of the types can be a class, and the rest must
|
||||
be interfaces (the class doesn't have to be the first in the list). You will get back an object that extends the class and
|
||||
implements all the interfaces. (Obviously, if you only specify interfaces and no class, the object will extend <code>java.lang.Object</code>).
|
||||
<hr>
|
||||
<a name="classBoundImplementations" id="classBoundImplementations"></a>
|
||||
<h3>Class-Bound Implementations</h3>
|
||||
<p>
|
||||
The methods shown so far for extending Java classes and implementing interfaces – passing an implementation JavaScript object
|
||||
or function to a constructor, or using <code>Java.extend</code> with <code>new</code> – all produce classes that take an
|
||||
extra JavaScript object parameter in their constructors that specifies the implementation. The implementation is therefore always bound
|
||||
to the actual instance being created with <code>new</code>, and not to the whole class. This has some advantages, for example in the
|
||||
memory footprint of the runtime, as Nashorn can just create a single "universal adapter" for every combination of types being implemented.
|
||||
In reality, the below code shows that different instantiations of, say, <code>Runnable</code> have the same class regardless of them having
|
||||
different JavaScript implementation objects:
|
||||
</p>
|
||||
<pre><code>
|
||||
var Runnable = java.lang.Runnable;
|
||||
var r1 = new Runnable(function() { print("I'm runnable 1!") })
|
||||
var r2 = new Runnable(function() { print("I'm runnable 2!") })
|
||||
r1.run()
|
||||
r2.run()
|
||||
print("We share the same class: " + (r1.class === r2.class))
|
||||
</code></pre>
|
||||
<p>
|
||||
prints:
|
||||
</p>
|
||||
<pre><code>
|
||||
I'm runnable 1!
|
||||
I'm runnable 2!
|
||||
We share the same class: true
|
||||
</code></pre>
|
||||
<p>
|
||||
Sometimes, however, you'll want to extend a Java class or implement an interface with implementation bound to the class, not to
|
||||
its instances. Such a need arises, for example, when you need to pass the class for instantiation to an external API; prime example
|
||||
of this is the JavaFX framework where you need to pass an Application class to the FX API and let it instantiate it.
|
||||
</p>
|
||||
<p>
|
||||
Fortunately, there's a solution for that: <code>Java.extend()</code> – aside from being able to take any number of type parameters
|
||||
denoting a class to extend and interfaces to implement – can also take one last argument that has to be a JavaScript object
|
||||
that serves as the implementation for the methods. In this case, <code>Java.extend()</code> will create a class that has the same
|
||||
constructors as the original class had, as they don't need to take an an extra implementation object parameter. The example below
|
||||
shows how you can create class-bound implementations, and shows that in this case, the implementation classes for different invocations
|
||||
are indeed different:
|
||||
</p>
|
||||
<pre><code>
|
||||
var RunnableImpl1 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 1!") })
|
||||
var RunnableImpl2 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 2!") })
|
||||
var r1 = new RunnableImpl1()
|
||||
var r2 = new RunnableImpl2()
|
||||
r1.run()
|
||||
r2.run()
|
||||
print("We share the same class: " + (r1.class === r2.class))
|
||||
</code></pre>
|
||||
<p>
|
||||
prints:
|
||||
</p>
|
||||
<pre><code>
|
||||
I'm runnable 1!
|
||||
I'm runnable 2!
|
||||
We share the same class: false
|
||||
</code></pre>
|
||||
<p>
|
||||
As you can see, the major difference here is that we moved the implementation object into the invocation of <code>Java.extend</code>
|
||||
from the constructor invocations – indeed the constructor invocations now don't even need to take an extra parameter! Since
|
||||
the implementations are bound to a class, the two classes obviously can't be the same, and we indeed see that the two runnables no
|
||||
longer share the same class – every invocation of <code>Java.extend()</code> with a class-specific implementation object triggers
|
||||
the creation of a new Java adapter class.
|
||||
</p>
|
||||
<p>
|
||||
Finally, the adapter classes with class-bound implementations can <i>still</i> take an additional constructor parameter to further
|
||||
override the behavior on a per-instance basis. Thus, you can even combine the two approaches: you can provide part of the implementation
|
||||
in a class-based JavaScript implementation object passed to <code>Java.extend</code>, and part in another object passed to the constructor.
|
||||
Whatever functions are provided by the constructor-passed object will override the functions in the class-bound object.
|
||||
</p>
|
||||
<pre><code>
|
||||
var RunnableImpl = Java.extend(java.lang.Runnable, function() { print("I'm runnable 1!") })
|
||||
var r1 = new RunnableImpl()
|
||||
var r2 = new RunnableImpl(function() { print("I'm runnable 2!") })
|
||||
r1.run()
|
||||
r2.run()
|
||||
print("We share the same class: " + (r1.class === r2.class))
|
||||
</code></pre>
|
||||
<p>
|
||||
prints:
|
||||
</p>
|
||||
<pre><code>
|
||||
I'm runnable 1!
|
||||
I'm runnable 2!
|
||||
We share the same class: true
|
||||
</code></pre>
|
||||
<hr>
|
||||
<a name="jsoverload" id="jsoverload"></a>
|
||||
<h3>Overload Resolution</h3>
|
||||
<p>Java methods can be overloaded by argument types. In Java,
|
||||
overload resolution occurs at compile time (performed by javac).
|
||||
When calling Java methods from Nashorn, the appropriate method will be
|
||||
selected based on the argument types at invocation time. You do not need
|
||||
to do anything special – the correct Java method overload variant
|
||||
is selected based automatically. You still have the option of explicitly
|
||||
specifying a particular overload variant. Reasons for this include
|
||||
either running into a genuine ambiguity with actual argument types, or
|
||||
rarely reasons of performance – if you specify the actual overload
|
||||
then the engine doesn't have to perform resolution during invocation.
|
||||
Individual overloads of a Java methods are exposed as special properties
|
||||
with the name of the method followed with its signature in parentheses.
|
||||
You can invoke them like this:</p>
|
||||
<pre><code>
|
||||
// <a href="source/overload.js">overload.js</a>
|
||||
|
||||
var out = java.lang.System.out;
|
||||
|
||||
// select a particular print function
|
||||
out["println(Object)"]("hello");
|
||||
</code>
|
||||
</pre>
|
||||
<p>
|
||||
Note that you normally don't even have to use qualified class names in
|
||||
the signatures as long as the unqualified name of the type is sufficient
|
||||
for uniquely identifying the signature. In practice this means that only
|
||||
in the extremely unlikely case that two overloads only differ in
|
||||
parameter types that have identical unqualified names but come from
|
||||
different packages would you need to use the fully qualified name of the
|
||||
class.
|
||||
</p>
|
||||
<hr>
|
||||
<a name="dataTypeMapping" id="dataTypeMapping"></a>
|
||||
<h3>Mapping of Data Types Between Java and JavaScript</h3>
|
||||
<p>
|
||||
We have previously shown some of the data type mappings between Java and JavaScript.
|
||||
We saw that arrays need to be explicitly converted. We have also shown that JavaScript functions
|
||||
are automatically converted to SAM types when passed as parameters to Java methods. Most other
|
||||
conversions work as you would expect.
|
||||
</p>
|
||||
<p>
|
||||
Every JavaScript object is also a <code>java.util.Map</code> so APIs receiving maps will receive them directly.
|
||||
</p>
|
||||
<p>
|
||||
When numbers are passed to a Java API, they will be converted to the expected target numeric type, either boxed or
|
||||
primitive, but if the target type is less specific, say <code>Number</code> or <code>Object</code>, you can only
|
||||
count on them being a <code>Number</code>, and have to test specifically for whether it's a boxed <code>Double</code>,
|
||||
<code>Integer</code>, <code>Long</code>, etc. – it can be any of these due to internal optimizations. Also, you
|
||||
can pass any JavaScript value to a Java API expecting either a boxed or primitive number; the JavaScript specification's
|
||||
<code>ToNumber</code> conversion algorithm will be applied to the value.
|
||||
</p>
|
||||
<p>
|
||||
In a similar vein, if a Java method expects a <code>String</code> or a <code>Boolean</code>, the values will be
|
||||
converted using all conversions allowed by the JavaScript specification's <code>ToString</code> and <code>ToBoolean</code>
|
||||
conversions.
|
||||
</p>
|
||||
<p>
|
||||
Finally, a word of caution about strings. Due to internal performance optimizations of string operations, JavaScript strings are
|
||||
not always necessarily of type <code>java.lang.String</code>, but they will always be of type <code>java.lang.CharSequence</code>.
|
||||
If you pass them to a Java method that expects a <code>java.lang.String</code> parameter, then you will naturally receive a Java
|
||||
String, but if the signature of your method is more generic, i.e. it receives a <code>java.lang.Object</code> parameter, you can
|
||||
end up with an object of private engine implementation class that implements <code>CharSequence</code> but is not a Java String.
|
||||
</p>
|
||||
<hr>
|
||||
<a name="engineimpl" id="engineimpl"></a>
|
||||
<h2>Implementing Your Own Script Engine</h2>
|
||||
<p>We will not cover implementation of JSR-223 compliant script
|
||||
engines in detail. Minimally, you need to implement the
|
||||
<code>javax.script.ScriptEngine</code> and
|
||||
<code>javax.script.ScriptEngineFactory</code> interfaces. The
|
||||
abstract class <code>javax.script.AbstractScriptEngine</code>
|
||||
provides useful defaults for a few methods of the
|
||||
<code>ScriptEngine</code> interface.</p>
|
||||
<p>Before starting to implement a JSR-223 engine, you may want to
|
||||
check <a href="http://java.net/projects/Scripting">http://java.net/projects/Scripting</a>
|
||||
project. This project maintains JSR-223 implementations for many
|
||||
popular open source scripting languages.</p>
|
||||
<hr>
|
||||
<a name="refs" id="refs"></a>
|
||||
<h2>References</h2>
|
||||
<ul>
|
||||
<li><a href="http://jcp.org/en/jsr/detail?id=223">JSR-223 Scripting
|
||||
for the Java Platform</a></li>
|
||||
<li><a href="http://java.net/projects/Scripting">http://java.net/projects/Scripting
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<div class="hr"><hr></div>
|
||||
<table summary="layout" border="0" width="100%">
|
||||
<tbody><tr valign="TOP">
|
||||
<td width="30%"> <img src="Java%20Scripting%20Programmer%27s%20Guide_files/logo_oracle_footer.gif" alt="Oracle and/or its affiliates" border="0" height="29" width="100"><br>
|
||||
<font size="+1"> <i>Java Technology</i></font> </td>
|
||||
|
||||
<td width="30%">
|
||||
<p><font size="-2">
|
||||
<a href="http://docs.oracle.com/javase/6/docs/legal/cpyr.html">Copyright ©</a> 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
</font></p>
|
||||
</td>
|
||||
<td width="30%">
|
||||
<p align="right"><font size="-2"><a href="http://download.oracle.com/javase/feedback.html">Contact Us</a></font></p><font size="-2">
|
||||
</font></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<div class="hr"><hr></div>
|
||||
</div>
|
||||
|
||||
<!-- Start SiteCatalyst code -->
|
||||
<script language="JavaScript" src="Java%20Scripting%20Programmer%27s%20Guide_files/s_code_download.js"></script>
|
||||
<script language="JavaScript" src="Java%20Scripting%20Programmer%27s%20Guide_files/s_code.js"></script>
|
||||
|
||||
<!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** -->
|
||||
<!-- Below code will send the info to Omniture server -->
|
||||
<script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script>
|
||||
|
||||
<!-- End SiteCatalyst code -->
|
||||
|
||||
|
||||
|
||||
</body></html>
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class EvalFile {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
// create a script engine manager
|
||||
final ScriptEngineManager factory = new ScriptEngineManager();
|
||||
// create JavaScript engine
|
||||
final ScriptEngine engine = factory.getEngineByName("nashorn");
|
||||
// evaluate JavaScript code from given file - specified by first argument
|
||||
engine.eval(new java.io.FileReader(args[0]));
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class EvalScript {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
// create a script engine manager
|
||||
final ScriptEngineManager factory = new ScriptEngineManager();
|
||||
// create a JavaScript engine
|
||||
final ScriptEngine engine = factory.getEngineByName("nashorn");
|
||||
// evaluate JavaScript code from String
|
||||
engine.eval("print('Hello, World')");
|
||||
}
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class InvokeScriptFunction {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
final String script = "function hello(name) { print('Hello, ' + name); }";
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// javax.script.Invocable is an optional interface.
|
||||
// Check whether your script engine implements or not!
|
||||
// Note that the JavaScript engine implements Invocable interface.
|
||||
final Invocable inv = (Invocable) engine;
|
||||
|
||||
// invoke the global function named "hello"
|
||||
inv.invokeFunction("hello", "Scripting!!" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class InvokeScriptMethod {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String. This code defines a script object 'obj'
|
||||
// with one method called 'hello'.
|
||||
final String script = "var obj = new Object(); obj.hello = function(name) { print('Hello, ' + name); }";
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// javax.script.Invocable is an optional interface.
|
||||
// Check whether your script engine implements or not!
|
||||
// Note that the JavaScript engine implements Invocable interface.
|
||||
final Invocable inv = (Invocable) engine;
|
||||
|
||||
// get script object on which we want to call the method
|
||||
final Object obj = engine.get("obj");
|
||||
|
||||
// invoke the method named "hello" on the script object "obj"
|
||||
inv.invokeMethod(obj, "hello", "Script Method !!" );
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptContext;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.SimpleScriptContext;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class MultiScopes {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
engine.put("x", "hello");
|
||||
// print global variable "x"
|
||||
engine.eval("print(x);");
|
||||
// the above line prints "hello"
|
||||
|
||||
// Now, pass a different script context
|
||||
final ScriptContext newContext = new SimpleScriptContext();
|
||||
newContext.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
|
||||
final Bindings engineScope = newContext.getBindings(ScriptContext.ENGINE_SCOPE);
|
||||
|
||||
// add new variable "x" to the new engineScope
|
||||
engineScope.put("x", "world");
|
||||
|
||||
// execute the same script - but this time pass a different script context
|
||||
engine.eval("print(x);", newContext);
|
||||
// the above line prints "world"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class RunnableImpl {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
final String script = "function run() { print('run called'); }";
|
||||
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
final Invocable inv = (Invocable) engine;
|
||||
|
||||
// get Runnable interface object from engine. This interface methods
|
||||
// are implemented by script functions with the matching name.
|
||||
final Runnable r = inv.getInterface(Runnable.class);
|
||||
|
||||
// start a new thread that runs the script implemented
|
||||
// runnable interface
|
||||
final Thread th = new Thread(r);
|
||||
th.start();
|
||||
th.join();
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class RunnableImplObject {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
// JavaScript code in a String
|
||||
final String script = "var obj = new Object(); obj.run = function() { print('run method called'); }";
|
||||
|
||||
// evaluate script
|
||||
engine.eval(script);
|
||||
|
||||
// get script object on which we want to implement the interface with
|
||||
final Object obj = engine.get("obj");
|
||||
|
||||
final Invocable inv = (Invocable) engine;
|
||||
|
||||
// get Runnable interface object from engine. This interface methods
|
||||
// are implemented by script methods of object 'obj'
|
||||
final Runnable r = inv.getInterface(obj, Runnable.class);
|
||||
|
||||
// start a new thread that runs the script implemented
|
||||
// runnable interface
|
||||
final Thread th = new Thread(r);
|
||||
th.start();
|
||||
th.join();
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class ScriptVars {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final ScriptEngineManager manager = new ScriptEngineManager();
|
||||
final ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
|
||||
final File f = new File("test.txt");
|
||||
// expose File object as variable to script
|
||||
engine.put("file", f);
|
||||
|
||||
// evaluate a script string. The script accesses "file"
|
||||
// variable and calls method on it
|
||||
engine.eval("print(file.getAbsolutePath())");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// load compatibility script
|
||||
load("nashorn:mozilla_compat.js");
|
||||
|
||||
// Import Java packages and classes
|
||||
// like import package.*; in Java
|
||||
importPackage(java.awt);
|
||||
// like import java.awt.Frame in Java
|
||||
importClass(java.awt.Frame);
|
||||
// Create Java Objects by "new ClassName"
|
||||
var frame = new java.awt.Frame("hello");
|
||||
// Call Java public methods from script
|
||||
frame.setVisible(true);
|
||||
// Access "JavaBean" properties like "fields"
|
||||
print(frame.title);
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// create Java String array of 5 elements
|
||||
var StringArray = Java.type("java.lang.String[]");
|
||||
var a = new StringArray(5);
|
||||
|
||||
// Accessing elements and length access is by usual Java syntax
|
||||
a[0] = "scripting is great!";
|
||||
print(a.length);
|
||||
print(a[0]);
|
||||
|
||||
// convert a script array to Java array
|
||||
var anArray = [1, "13", false];
|
||||
var javaIntArray = Java.to(anArray, "int[]");
|
||||
print(javaIntArray[0]);// prints 1
|
||||
print(javaIntArray[1]); // prints 13, as string "13" was converted to number 13 as per ECMAScript ToNumber conversion
|
||||
print(javaIntArray[2]);// prints 0, as boolean false was converted to number 0 as per ECMAScript ToNumber conversion
|
||||
|
||||
// convert a Java array to a JavaScript array
|
||||
var File = Java.type("java.io.File");
|
||||
var listCurDir = new File(".").listFiles();
|
||||
var jsList = Java.from(listCurDir);
|
||||
print(jsList);
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var ArrayList = Java.type("java.util.ArrayList")
|
||||
var ArrayListExtender = Java.extend(ArrayList)
|
||||
var printSizeInvokedArrayList = new ArrayListExtender() {
|
||||
size: function() { print("size invoked!"); }
|
||||
}
|
||||
var printAddInvokedArrayList = new ArrayListExtender() {
|
||||
add: function(x, y) {
|
||||
if(typeof(y) === "undefined") {
|
||||
print("add(e) invoked!");
|
||||
} else {
|
||||
print("add(i, e) invoked!");
|
||||
}
|
||||
}
|
||||
};
|
||||
printSizeInvokedArrayList.size();
|
||||
printAddInvokedArrayList.add(33, 33);
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// create JavaImporter with specific packages and classes to import
|
||||
|
||||
var SwingGui = new JavaImporter(javax.swing,
|
||||
javax.swing.event,
|
||||
javax.swing.border,
|
||||
java.awt.event);
|
||||
with (SwingGui) {
|
||||
// within this 'with' statement, we can access Swing and AWT
|
||||
// classes by unqualified (simple) names.
|
||||
|
||||
var mybutton = new JButton("test");
|
||||
print(mybutton);
|
||||
var myframe = new JFrame("test");
|
||||
print(myframe);
|
||||
}
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// accessing java types
|
||||
var arrayListType = Java.type("java.util.ArrayList")
|
||||
var intType = Java.type("int")
|
||||
var stringArrayType = Java.type("java.lang.String[]")
|
||||
var int2DArrayType = Java.type("int[][]")
|
||||
|
||||
// Using java types
|
||||
var ArrayList = Java.type("java.util.ArrayList")
|
||||
var anArrayList = new ArrayList
|
||||
var anArrayListWithSize = new ArrayList(16)
|
||||
|
||||
// fully qualified name
|
||||
var ftype = Java.type("java.awt.geom.Arc2D$Float")
|
||||
|
||||
// inner class property
|
||||
var arctype = Java.type("java.awt.geom.Arc2D")
|
||||
var ftype = arctype.Float
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var out = java.lang.System.out;
|
||||
|
||||
// select a particular print function
|
||||
out["println(java.lang.Object)"]("hello");
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var r = new java.lang.Runnable() {
|
||||
run: function() {
|
||||
print("running...\n");
|
||||
}
|
||||
};
|
||||
|
||||
// "r" can be passed to Java methods that expect java.lang.Runnable
|
||||
var th = new java.lang.Thread(r);
|
||||
th.start();
|
||||
th.join();
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function func() {
|
||||
print("I am func!");
|
||||
}
|
||||
|
||||
// pass script function for java.lang.Runnable argument
|
||||
var th = new java.lang.Thread(func);
|
||||
th.start();
|
||||
th.join();
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
print("This is hello from test.js");
|
@ -137,6 +137,8 @@ TEST FAILURE</code></pre>
|
||||
<h4 id="timeout_factor-1">TIMEOUT_FACTOR</h4>
|
||||
<p>The timeout factor (<code>-timeoutFactor</code>).</p>
|
||||
<p>Defaults to 4.</p>
|
||||
<h4 id="failure_handler_timeout">FAILURE_HANDLER_TIMEOUT</h4>
|
||||
<p>Sets the argument <code>-timeoutHandlerTimeout</code> for JTReg. The default value is 0. This is only valid if the failure handler is built.</p>
|
||||
<h4 id="test_mode">TEST_MODE</h4>
|
||||
<p>The test mode (<code>agentvm</code> or <code>othervm</code>).</p>
|
||||
<p>Defaults to <code>agentvm</code>.</p>
|
||||
@ -153,8 +155,10 @@ TEST FAILURE</code></pre>
|
||||
<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
|
||||
<p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
|
||||
<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
|
||||
<h4 id="max_output">MAX_OUTPUT</h4>
|
||||
<p>Set the property <code>javatest.maxOutputSize</code> for the launcher, to change the default JTReg log limit.</p>
|
||||
<h4 id="keywords">KEYWORDS</h4>
|
||||
<p>JTReg kewords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
|
||||
<p>JTReg keywords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
|
||||
<h4 id="extra_problem_lists">EXTRA_PROBLEM_LISTS</h4>
|
||||
<p>Use additional problem lists file or files, in addition to the default ProblemList.txt located at the JTReg test roots.</p>
|
||||
<p>If multiple file names are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
|
||||
@ -170,6 +174,8 @@ TEST FAILURE</code></pre>
|
||||
<h4 id="vm_options-1">VM_OPTIONS</h4>
|
||||
<p>Additional Java options to be used when compiling and running classes (sent to JTReg as <code>-vmoption</code>).</p>
|
||||
<p>This option is only needed in special circumstances. To pass Java options to your test classes, use <code>JAVA_OPTIONS</code>.</p>
|
||||
<h4 id="launcher_options">LAUNCHER_OPTIONS</h4>
|
||||
<p>Additional Java options that are sent to the java launcher that starts the JTReg harness.</p>
|
||||
<h4 id="aot_modules-1">AOT_MODULES</h4>
|
||||
<p>Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
|
||||
<h4 id="retry_count">RETRY_COUNT</h4>
|
||||
@ -205,14 +211,19 @@ TEST FAILURE</code></pre>
|
||||
<p>Docker tests with default parameters may fail on systems with glibc versions not compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:</p>
|
||||
<pre><code>$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"</code></pre>
|
||||
<p>To run these tests correctly, additional parameters for the correct docker image are required on Ubuntu 18.04 by using <code>JAVA_OPTIONS</code>.</p>
|
||||
<pre><code>$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"</code></pre>
|
||||
<pre><code>$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" \
|
||||
JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
|
||||
-Djdk.test.docker.image.version=latest"</code></pre>
|
||||
<h3 id="non-us-locale">Non-US locale</h3>
|
||||
<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG="en_US"</code> in the environment before running tests should work. On Windows, setting <code>JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"</code> helps for most, but not all test cases. For example:</p>
|
||||
<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG="en_US"</code> in the environment before running tests should work. On Windows, setting <code>JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"</code> helps for most, but not all test cases.</p>
|
||||
<p>For example:</p>
|
||||
<pre><code>$ export LANG="en_US" && make test TEST=...
|
||||
$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...</code></pre>
|
||||
<h3 id="pkcs11-tests">PKCS11 Tests</h3>
|
||||
<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories. For example:</p>
|
||||
<pre><code>$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"</code></pre>
|
||||
<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories.</p>
|
||||
<p>For example:</p>
|
||||
<pre><code>$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" \
|
||||
JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"</code></pre>
|
||||
<p>For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.</p>
|
||||
<h3 id="client-ui-tests">Client UI Tests</h3>
|
||||
<p>Some Client UI tests use key sequences which may be reserved by the operating system. Usually that causes the test failure. So it is highly recommended to disable system key shortcuts prior testing. The steps to access and disable system key shortcuts for various platforms are provided below.</p>
|
||||
|
158
doc/testing.md
158
doc/testing.md
@ -37,11 +37,11 @@ Note that this option should point to the JTReg home, i.e. the top directory,
|
||||
containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME`
|
||||
environment variable to point to the JTReg home before running `configure`.)
|
||||
|
||||
To be able to run microbenchmarks, `configure` needs to know where to find
|
||||
the JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
|
||||
containing the core JMH and transitive dependencies. The recommended dependencies
|
||||
can be retrieved by running `sh make/devkit/createJMHBundle.sh`, after which
|
||||
`--with-jmh=build/jmh/jars` should work.
|
||||
To be able to run microbenchmarks, `configure` needs to know where to find the
|
||||
JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
|
||||
containing the core JMH and transitive dependencies. The recommended
|
||||
dependencies can be retrieved by running `sh make/devkit/createJMHBundle.sh`,
|
||||
after which `--with-jmh=build/jmh/jars` should work.
|
||||
|
||||
## Test selection
|
||||
|
||||
@ -182,10 +182,10 @@ variables.
|
||||
These variables use a keyword=value approach to allow multiple values to be
|
||||
set. So, for instance, `JTREG="JOBS=1;TIMEOUT_FACTOR=8"` will set the JTReg
|
||||
concurrency level to 1 and the timeout factor to 8. This is equivalent to
|
||||
setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format means that
|
||||
the `JTREG` variable is parsed and verified for correctness, so
|
||||
`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8` would just
|
||||
pass unnoticed.
|
||||
setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format
|
||||
means that the `JTREG` variable is parsed and verified for correctness, so
|
||||
`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8`
|
||||
would just pass unnoticed.
|
||||
|
||||
To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell
|
||||
normally eats `;`, the recommended usage is to write the assignment inside
|
||||
@ -203,9 +203,10 @@ test suites.
|
||||
|
||||
### General keywords (TEST_OPTS)
|
||||
|
||||
Some keywords are valid across different test suites. If you want to run
|
||||
tests from multiple test suites, or just don't want to care which test suite specific
|
||||
control variable to use, then you can use the general TEST_OPTS control variable.
|
||||
Some keywords are valid across different test suites. If you want to run tests
|
||||
from multiple test suites, or just don't want to care which test suite specific
|
||||
control variable to use, then you can use the general TEST_OPTS control
|
||||
variable.
|
||||
|
||||
There are also some keywords that applies globally to the test runner system,
|
||||
not to any specific test suites. These are also available as TEST_OPTS keywords.
|
||||
@ -252,12 +253,13 @@ for only recently changed code. JCOV_DIFF_CHANGESET specifies a source
|
||||
revision. A textual report will be generated showing coverage of the diff
|
||||
between the specified revision and the repository tip.
|
||||
|
||||
The report is stored in `build/$BUILD/test-results/jcov-output/diff_coverage_report`
|
||||
file.
|
||||
The report is stored in
|
||||
`build/$BUILD/test-results/jcov-output/diff_coverage_report` file.
|
||||
|
||||
### JTReg keywords
|
||||
|
||||
#### JOBS
|
||||
|
||||
The test concurrency (`-concurrency`).
|
||||
|
||||
Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to
|
||||
@ -265,32 +267,43 @@ JOBS, except for Hotspot, where the default is *number of CPU cores/2*,
|
||||
but never more than *memory size in GB/2*.
|
||||
|
||||
#### TIMEOUT_FACTOR
|
||||
|
||||
The timeout factor (`-timeoutFactor`).
|
||||
|
||||
Defaults to 4.
|
||||
|
||||
#### FAILURE_HANDLER_TIMEOUT
|
||||
|
||||
Sets the argument `-timeoutHandlerTimeout` for JTReg. The default value is 0.
|
||||
This is only valid if the failure handler is built.
|
||||
|
||||
#### TEST_MODE
|
||||
|
||||
The test mode (`agentvm` or `othervm`).
|
||||
|
||||
Defaults to `agentvm`.
|
||||
|
||||
#### ASSERT
|
||||
|
||||
Enable asserts (`-ea -esa`, or none).
|
||||
|
||||
Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except
|
||||
for hotspot.
|
||||
|
||||
#### VERBOSE
|
||||
|
||||
The verbosity level (`-verbose`).
|
||||
|
||||
Defaults to `fail,error,summary`.
|
||||
|
||||
#### RETAIN
|
||||
|
||||
What test data to retain (`-retain`).
|
||||
|
||||
Defaults to `fail,error`.
|
||||
|
||||
#### MAX_MEM
|
||||
|
||||
Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none).
|
||||
|
||||
Limit memory consumption for JTReg test framework and VM under test. Set to 0
|
||||
@ -298,9 +311,14 @@ to disable the limits.
|
||||
|
||||
Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
|
||||
|
||||
#### MAX_OUTPUT
|
||||
|
||||
Set the property `javatest.maxOutputSize` for the launcher, to change the
|
||||
default JTReg log limit.
|
||||
|
||||
#### KEYWORDS
|
||||
|
||||
JTReg kewords sent to JTReg using `-k`. Please be careful in making sure that
|
||||
JTReg keywords sent to JTReg using `-k`. Please be careful in making sure that
|
||||
spaces and special characters (like `!`) are properly quoted. To avoid some
|
||||
issues, the special value `%20` can be used instead of space.
|
||||
|
||||
@ -323,23 +341,30 @@ Set to `true` or `false`.
|
||||
If `true`, JTReg will use `-match:` option, otherwise `-exclude:` will be used.
|
||||
Default is `false`.
|
||||
|
||||
|
||||
#### OPTIONS
|
||||
|
||||
Additional options to the JTReg test framework.
|
||||
|
||||
Use `JTREG="OPTIONS=--help all"` to see all available JTReg options.
|
||||
|
||||
#### JAVA_OPTIONS
|
||||
|
||||
Additional Java options for running test classes (sent to JTReg as
|
||||
`-javaoption`).
|
||||
|
||||
#### VM_OPTIONS
|
||||
|
||||
Additional Java options to be used when compiling and running classes (sent to
|
||||
JTReg as `-vmoption`).
|
||||
|
||||
This option is only needed in special circumstances. To pass Java options to
|
||||
your test classes, use `JAVA_OPTIONS`.
|
||||
|
||||
#### LAUNCHER_OPTIONS
|
||||
|
||||
Additional Java options that are sent to the java launcher that starts the
|
||||
JTReg harness.
|
||||
|
||||
#### AOT_MODULES
|
||||
|
||||
Generate AOT modules before testing for the specified module, or set of
|
||||
@ -353,6 +378,7 @@ Retry failed tests up to a set number of times. Defaults to 0.
|
||||
### Gtest keywords
|
||||
|
||||
#### REPEAT
|
||||
|
||||
The number of times to repeat the tests (`--gtest_repeat`).
|
||||
|
||||
Default is 1. Set to -1 to repeat indefinitely. This can be especially useful
|
||||
@ -360,6 +386,7 @@ combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent
|
||||
problem.
|
||||
|
||||
#### OPTIONS
|
||||
|
||||
Additional options to the Gtest test framework.
|
||||
|
||||
Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
|
||||
@ -373,98 +400,127 @@ modules. If multiple modules are specified, they should be separated by space
|
||||
### Microbenchmark keywords
|
||||
|
||||
#### FORK
|
||||
|
||||
Override the number of benchmark forks to spawn. Same as specifying `-f <num>`.
|
||||
|
||||
#### ITER
|
||||
|
||||
Number of measurement iterations per fork. Same as specifying `-i <num>`.
|
||||
|
||||
#### TIME
|
||||
|
||||
Amount of time to spend in each measurement iteration, in seconds. Same as
|
||||
specifying `-r <num>`
|
||||
|
||||
#### WARMUP_ITER
|
||||
|
||||
Number of warmup iterations to run before the measurement phase in each fork.
|
||||
Same as specifying `-wi <num>`.
|
||||
|
||||
#### WARMUP_TIME
|
||||
|
||||
Amount of time to spend in each warmup iteration. Same as specifying `-w <num>`.
|
||||
|
||||
#### RESULTS_FORMAT
|
||||
|
||||
Specify to have the test run save a log of the values. Accepts the same values
|
||||
as `-rff`, i.e., `text`, `csv`, `scsv`, `json`, or `latex`.
|
||||
|
||||
#### VM_OPTIONS
|
||||
|
||||
Additional VM arguments to provide to forked off VMs. Same as `-jvmArgs <args>`
|
||||
|
||||
#### OPTIONS
|
||||
|
||||
Additional arguments to send to JMH.
|
||||
|
||||
## Notes for Specific Tests
|
||||
|
||||
### Docker Tests
|
||||
|
||||
Docker tests with default parameters may fail on systems with glibc versions not
|
||||
compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86).
|
||||
For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:
|
||||
Docker tests with default parameters may fail on systems with glibc versions
|
||||
not compatible with the one used in the default docker image (e.g., Oracle
|
||||
Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu
|
||||
18.04 if run like this on x86:
|
||||
|
||||
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
|
||||
```
|
||||
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
|
||||
```
|
||||
|
||||
To run these tests correctly, additional parameters for the correct docker image are
|
||||
required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
|
||||
To run these tests correctly, additional parameters for the correct docker
|
||||
image are required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
|
||||
|
||||
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"
|
||||
```
|
||||
$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" \
|
||||
JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
|
||||
-Djdk.test.docker.image.version=latest"
|
||||
```
|
||||
|
||||
### Non-US locale
|
||||
|
||||
If your locale is non-US, some tests are likely to fail. To work around this you can
|
||||
set the locale to US. On Unix platforms simply setting `LANG="en_US"` in the
|
||||
environment before running tests should work. On Windows, setting
|
||||
`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but not all test cases.
|
||||
If your locale is non-US, some tests are likely to fail. To work around this
|
||||
you can set the locale to US. On Unix platforms simply setting `LANG="en_US"`
|
||||
in the environment before running tests should work. On Windows, setting
|
||||
`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but
|
||||
not all test cases.
|
||||
|
||||
For example:
|
||||
|
||||
$ export LANG="en_US" && make test TEST=...
|
||||
$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
|
||||
```
|
||||
$ export LANG="en_US" && make test TEST=...
|
||||
$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
|
||||
```
|
||||
|
||||
### PKCS11 Tests
|
||||
|
||||
It is highly recommended to use the latest NSS version when running PKCS11 tests.
|
||||
Improper NSS version may lead to unexpected failures which are hard to diagnose.
|
||||
For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu
|
||||
18.04 with the default NSS version in the system.
|
||||
To run these tests correctly, the system property `test.nss.lib.paths` is required
|
||||
on Ubuntu 18.04 to specify the alternative NSS lib directories.
|
||||
It is highly recommended to use the latest NSS version when running PKCS11
|
||||
tests. Improper NSS version may lead to unexpected failures which are hard to
|
||||
diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail
|
||||
on Ubuntu 18.04 with the default NSS version in the system. To run these tests
|
||||
correctly, the system property `test.nss.lib.paths` is required on Ubuntu 18.04
|
||||
to specify the alternative NSS lib directories.
|
||||
|
||||
For example:
|
||||
|
||||
$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
|
||||
```
|
||||
$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" \
|
||||
JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
|
||||
```
|
||||
|
||||
For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.
|
||||
For more notes about the PKCS11 tests, please refer to
|
||||
test/jdk/sun/security/pkcs11/README.
|
||||
|
||||
### Client UI Tests
|
||||
|
||||
Some Client UI tests use key sequences which may be reserved by the operating
|
||||
system. Usually that causes the test failure. So it is highly recommended to disable
|
||||
system key shortcuts prior testing. The steps to access and disable system key shortcuts
|
||||
for various platforms are provided below.
|
||||
system. Usually that causes the test failure. So it is highly recommended to
|
||||
disable system key shortcuts prior testing. The steps to access and disable
|
||||
system key shortcuts for various platforms are provided below.
|
||||
|
||||
#### MacOS
|
||||
|
||||
Choose Apple menu; System Preferences, click Keyboard, then click Shortcuts;
|
||||
select or deselect desired shortcut.
|
||||
|
||||
For example, test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java fails
|
||||
on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip message
|
||||
but the key combination is reserved by the operating system. To run the test correctly
|
||||
the default global key shortcut should be disabled using the steps described above, and then deselect
|
||||
"Turn keyboard access on or off" option which is responsible for `CTRL + F1` combination.
|
||||
For example,
|
||||
test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java
|
||||
fails on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip
|
||||
message but the key combination is reserved by the operating system. To run the
|
||||
test correctly the default global key shortcut should be disabled using the
|
||||
steps described above, and then deselect "Turn keyboard access on or off"
|
||||
option which is responsible for `CTRL + F1` combination.
|
||||
|
||||
#### Linux
|
||||
Open the Activities overview and start typing Settings; Choose Settings, click Devices,
|
||||
then click Keyboard; set or override desired shortcut.
|
||||
|
||||
Open the Activities overview and start typing Settings; Choose Settings, click
|
||||
Devices, then click Keyboard; set or override desired shortcut.
|
||||
|
||||
#### Windows
|
||||
Type `gpedit` in the Search and then click Edit group policy; navigate to
|
||||
User Configuration -> Administrative Templates -> Windows Components -> File Explorer;
|
||||
in the right-side pane look for "Turn off Windows key hotkeys" and double click on it;
|
||||
enable or disable hotkeys.
|
||||
|
||||
Type `gpedit` in the Search and then click Edit group policy; navigate to User
|
||||
Configuration -> Administrative Templates -> Windows Components -> File
|
||||
Explorer; in the right-side pane look for "Turn off Windows key hotkeys" and
|
||||
double click on it; enable or disable hotkeys.
|
||||
|
||||
Note: restart is required to make the settings take effect.
|
||||
|
||||
|
@ -52,7 +52,6 @@ TARGETS =
|
||||
# READMEs and other files.
|
||||
|
||||
DEMO_SHARE_SRC := $(TOPDIR)/src/demo/share
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
|
||||
DEMO_MANIFEST := $(SUPPORT_OUTPUTDIR)/demos/java-main-manifest.mf
|
||||
|
||||
|
@ -477,6 +477,7 @@ jdk.internal.vm.compiler_EXCLUDES += \
|
||||
org.graalvm.compiler.options.test \
|
||||
org.graalvm.compiler.phases.common.test \
|
||||
org.graalvm.compiler.processor \
|
||||
org.graalvm.compiler.replacements.jdk10.test \
|
||||
org.graalvm.compiler.replacements.jdk12.test \
|
||||
org.graalvm.compiler.replacements.jdk9.test \
|
||||
org.graalvm.compiler.replacements.processor \
|
||||
|
@ -101,9 +101,9 @@ help:
|
||||
$(info $(_) # method is 'auto', 'ignore' or 'fail' (default))
|
||||
$(info $(_) TEST="test1 ..." # Use the given test descriptor(s) for testing, e.g.)
|
||||
$(info $(_) # make test TEST="jdk_lang gtest:all")
|
||||
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness)
|
||||
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness)
|
||||
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness)
|
||||
$(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'help' to list)
|
||||
$(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'help' to list)
|
||||
$(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'help' to list)
|
||||
$(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses)
|
||||
$(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...")
|
||||
$(info )
|
||||
|
@ -197,7 +197,7 @@ ifeq ($(HAS_SPEC),)
|
||||
COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \
|
||||
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
|
||||
SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD)" main && \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" main && \
|
||||
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
|
||||
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
||||
COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \
|
||||
|
@ -350,6 +350,9 @@ else # $(HAS_SPEC)=true
|
||||
$$(if $$(filter FAIL=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_FAIL=$$(strip $$(subst +, , $$(patsubst FAIL=%, %, $$(part))))) \
|
||||
) \
|
||||
$$(if $$(filter NODRYRUN=%, $$(part)), \
|
||||
$$(eval COMPARE_BUILD_NODRYRUN=$$(strip $$(subst +, , $$(patsubst NODRYRUN=%, %, $$(part))))) \
|
||||
) \
|
||||
)
|
||||
else
|
||||
# Separate handling for single field case, to allow for spaces in values.
|
||||
@ -372,9 +375,11 @@ else # $(HAS_SPEC)=true
|
||||
else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), )
|
||||
$$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist)
|
||||
endif
|
||||
PATCH_DRY_RUN := $$(shell cd $$(topdir) && $$(PATCH) --dry-run -p1 < $$(COMPARE_BUILD_PATCH) > /dev/null 2>&1 || $$(ECHO) FAILED)
|
||||
ifeq ($$(PATCH_DRY_RUN), FAILED)
|
||||
$$(error Patch file $$(COMPARE_BUILD_PATCH) does not apply cleanly)
|
||||
ifneq ($$(COMPARE_BUILD_NODRYRUN), true)
|
||||
PATCH_DRY_RUN := $$(shell cd $$(topdir) && $$(PATCH) --dry-run -p1 < $$(COMPARE_BUILD_PATCH) > /dev/null 2>&1 || $$(ECHO) FAILED)
|
||||
ifeq ($$(PATCH_DRY_RUN), FAILED)
|
||||
$$(error Patch file $$(COMPARE_BUILD_PATCH) does not apply cleanly)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifneq ($$(COMPARE_BUILD_FAIL), true)
|
||||
|
@ -640,6 +640,20 @@ $(eval $(call SetupTarget, test-image-jdk-jtreg-native, \
|
||||
DEPS := build-test-jdk-jtreg-native, \
|
||||
))
|
||||
|
||||
# Native files needed by the testlib
|
||||
$(eval $(call SetupTarget, build-test-lib-native, \
|
||||
MAKEFILE := test/BuildTestLibNative, \
|
||||
TARGET := build-test-lib-native, \
|
||||
DEPS := buildtools-jdk java.base-libs, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTarget, test-image-lib-native, \
|
||||
MAKEFILE := test/BuildTestLibNative, \
|
||||
TARGET := test-image-lib-native, \
|
||||
DEPS := build-test-lib-native, \
|
||||
))
|
||||
|
||||
# Native files needed when testing the testlib itself
|
||||
$(eval $(call SetupTarget, build-test-libtest-jtreg-native, \
|
||||
MAKEFILE := test/JtregNativeLibTest, \
|
||||
TARGET := build-test-libtest-jtreg-native, \
|
||||
@ -1118,7 +1132,9 @@ endif
|
||||
docs-image: docs-jdk
|
||||
|
||||
# This target builds the test image
|
||||
test-image: prepare-test-image test-image-jdk-jtreg-native test-image-demos-jdk test-image-libtest-jtreg-native
|
||||
test-image: prepare-test-image test-image-jdk-jtreg-native \
|
||||
test-image-demos-jdk test-image-libtest-jtreg-native \
|
||||
test-image-lib-native
|
||||
|
||||
ifneq ($(JVM_TEST_IMAGE_TARGETS), )
|
||||
# If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the
|
||||
|
@ -143,9 +143,6 @@ endif
|
||||
# Optionally create AOT libraries for specified modules before running tests.
|
||||
# Note, this could not be done during JDK build time.
|
||||
################################################################################
|
||||
|
||||
# Note, this could not be done during JDK build time.
|
||||
|
||||
# Parameter 1 is the name of the rule.
|
||||
#
|
||||
# Remaining parameters are named arguments.
|
||||
@ -198,6 +195,10 @@ define SetupAotModuleBody
|
||||
$1_AOT_TARGETS += $$($1_AOT_LIB)
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Optionally create AOT libraries before running tests.
|
||||
# Note, this could not be done during JDK build time.
|
||||
################################################################################
|
||||
# Parameter 1 is the name of the rule.
|
||||
#
|
||||
# Remaining parameters are named arguments.
|
||||
@ -291,9 +292,9 @@ $(eval $(call SetTestOpt,FAILURE_HANDLER_TIMEOUT,JTREG))
|
||||
$(eval $(call ParseKeywordVariable, JTREG, \
|
||||
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
|
||||
TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
|
||||
RETRY_COUNT, \
|
||||
RETRY_COUNT MAX_OUTPUT, \
|
||||
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
|
||||
EXTRA_PROBLEM_LISTS AOT_MODULES, \
|
||||
EXTRA_PROBLEM_LISTS AOT_MODULES LAUNCHER_OPTIONS, \
|
||||
))
|
||||
|
||||
ifneq ($(JTREG), )
|
||||
@ -844,15 +845,27 @@ define SetupRunJtregTestBody
|
||||
JTREG_RUN_PROBLEM_LISTS ?= false
|
||||
JTREG_RETRY_COUNT ?= 0
|
||||
|
||||
ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
|
||||
$1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
|
||||
endif
|
||||
|
||||
ifneq ($$(JTREG_MAX_OUTPUT), )
|
||||
$1_JTREG_LAUNCHER_OPTIONS += -Djavatest.maxOutputSize=$$(JTREG_MAX_OUTPUT)
|
||||
endif
|
||||
|
||||
ifneq ($$($1_JTREG_MAX_MEM), 0)
|
||||
$1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
|
||||
$1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
|
||||
endif
|
||||
|
||||
# Make sure the tmp dir is normalized as some tests will react badly otherwise
|
||||
$1_TEST_TMP_DIR := $$(abspath $$($1_TEST_SUPPORT_DIR)/tmp)
|
||||
|
||||
$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
|
||||
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
|
||||
-concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
|
||||
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
|
||||
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
|
||||
-vmoption:-Djava.io.tmpdir="$$($1_TEST_TMP_DIR)"
|
||||
|
||||
$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
|
||||
|
||||
@ -968,7 +981,8 @@ define SetupRunJtregTestBody
|
||||
run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
|
||||
$$(call LogWarn)
|
||||
$$(call LogWarn, Running test '$$($1_TEST)')
|
||||
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
|
||||
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR) \
|
||||
$$($1_TEST_TMP_DIR))
|
||||
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, ( \
|
||||
$$(COV_ENVIRONMENT) $$($1_COMMAND_LINE) \
|
||||
))
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2016, 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
|
||||
@ -150,10 +150,10 @@ AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH],
|
||||
fi
|
||||
FIXPATH_SRC_W="$FIXPATH_SRC"
|
||||
FIXPATH_BIN_W="$FIXPATH_BIN"
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
|
||||
$RM -rf $FIXPATH_BIN $FIXPATH_DIR
|
||||
$MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W])
|
||||
UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W])
|
||||
cd $FIXPATH_DIR
|
||||
$CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
|
||||
cd $CONFIGURE_START_DIR
|
||||
|
@ -64,39 +64,12 @@ AC_DEFUN([FLAGS_SETUP_RCFLAGS],
|
||||
[
|
||||
# On Windows, we need to set RC flags.
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
RC_FLAGS="-nologo -l0x409"
|
||||
JVM_RCFLAGS="-nologo"
|
||||
RCFLAGS="-nologo"
|
||||
if test "x$DEBUG_LEVEL" = xrelease; then
|
||||
RC_FLAGS="$RC_FLAGS -DNDEBUG"
|
||||
JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
|
||||
RCFLAGS="$RCFLAGS -DNDEBUG"
|
||||
fi
|
||||
|
||||
# The version variables used to create RC_FLAGS may be overridden
|
||||
# in a custom configure script, or possibly the command line.
|
||||
# Let those variables be expanded at make time in spec.gmk.
|
||||
# The \$ are escaped to the shell, and the $(...) variables
|
||||
# are evaluated by make.
|
||||
RC_FLAGS="$RC_FLAGS \
|
||||
-D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
|
||||
-D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
|
||||
-D\"JDK_FILEDESC=\$(JDK_RC_NAME) binary\" \
|
||||
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
|
||||
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
|
||||
-D\"JDK_NAME=\$(JDK_RC_NAME) \$(VERSION_FEATURE)\" \
|
||||
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
|
||||
|
||||
JVM_RCFLAGS="$JVM_RCFLAGS \
|
||||
-D\"HS_VERSION_STRING=\$(VERSION_STRING)\" \
|
||||
-D\"HS_COMPANY=\$(COMPANY_NAME)\" \
|
||||
-D\"HS_VER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
|
||||
-D\"HS_INTERNAL_NAME=jvm\" \
|
||||
-D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
|
||||
-D\"HS_FNAME=jvm.dll\" \
|
||||
-D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
|
||||
-D\"HS_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
|
||||
fi
|
||||
AC_SUBST(RC_FLAGS)
|
||||
AC_SUBST(JVM_RCFLAGS)
|
||||
AC_SUBST(RCFLAGS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
|
@ -87,6 +87,20 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
|
||||
[LIBFFI_FOUND=no]
|
||||
)
|
||||
fi
|
||||
# on macos we need a special case for system's libffi as
|
||||
# headers are located only in sdk in $SYSROOT and in ffi subfolder
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
if test "x$SYSROOT" != "x"; then
|
||||
AC_CHECK_HEADER([$SYSROOT/usr/include/ffi/ffi.h],
|
||||
[
|
||||
LIBFFI_FOUND=yes
|
||||
LIBFFI_CFLAGS="-I${SYSROOT}/usr/include/ffi"
|
||||
LIBFFI_LIBS=-lffi
|
||||
],
|
||||
[LIBFFI_FOUND=no]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if test "x$LIBFFI_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([ffi])
|
||||
AC_MSG_ERROR([Could not find libffi! $HELP_MSG])
|
||||
|
@ -494,7 +494,6 @@ JVM_CFLAGS := @JVM_CFLAGS@
|
||||
JVM_LDFLAGS := @JVM_LDFLAGS@
|
||||
JVM_ASFLAGS := @JVM_ASFLAGS@
|
||||
JVM_LIBS := @JVM_LIBS@
|
||||
JVM_RCFLAGS := @JVM_RCFLAGS@
|
||||
|
||||
# These flags might contain variables set by a custom extension that is included later.
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
@ -665,12 +664,7 @@ NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) $(JAVADOC_MAIN_CLASS)
|
||||
|
||||
JLINK_KEEP_PACKAGED_MODULES:=@JLINK_KEEP_PACKAGED_MODULES@
|
||||
|
||||
# Base flags for RC
|
||||
# Guarding this against resetting value. Legacy make files include spec multiple
|
||||
# times.
|
||||
ifndef RC_FLAGS
|
||||
RC_FLAGS:=@RC_FLAGS@
|
||||
endif
|
||||
RCFLAGS := @RCFLAGS@
|
||||
|
||||
# Tools adhering to a minimal and common standard of posix compliance.
|
||||
AWK:=@AWK@
|
||||
|
@ -52,7 +52,15 @@ AC_DEFUN([UTIL_REWRITE_AS_WINDOWS_MIXED_PATH],
|
||||
windows_path=`cmd //c echo $unix_path`
|
||||
$1="$windows_path"
|
||||
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
|
||||
windows_path=`$WSLPATH -m "$unix_path"`
|
||||
windows_path=`$WSLPATH -m "$unix_path" 2>/dev/null`
|
||||
if test $? -ne 0; then
|
||||
dir=`dirname "$unix_path"`
|
||||
base=`basename "$unix_path"`
|
||||
windows_path=`$WSLPATH -m "$dir"`/"$base"
|
||||
if test $? -ne 0; then
|
||||
AC_MSG_ERROR([Cannot convert "$unix_path" to Windows path])
|
||||
fi
|
||||
fi
|
||||
$1="$windows_path"
|
||||
fi
|
||||
])
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018, 2019, 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
|
||||
@ -92,6 +92,16 @@ ProcessDir = \
|
||||
) \
|
||||
)
|
||||
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
|
||||
JDK_RCFLAGS=$(RCFLAGS) \
|
||||
-D"JDK_VERSION_STRING=$(VERSION_STRING)" \
|
||||
-D"JDK_COMPANY=$(COMPANY_NAME)" \
|
||||
-D"JDK_VER=$(VERSION_NUMBER_FOUR_POSITIONS)" \
|
||||
-D"JDK_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
|
||||
-D"JDK_NAME=$(JDK_RC_NAME) $(VERSION_SHORT)" \
|
||||
-D"JDK_FVER=$(subst .,$(COMMA),$(VERSION_NUMBER_FOUR_POSITIONS))"
|
||||
|
||||
# Setup make rules for creating a native shared library with suitable defaults
|
||||
# for the OpenJDK project.
|
||||
#
|
||||
@ -100,7 +110,7 @@ ProcessDir = \
|
||||
#
|
||||
# Remaining parameters are named arguments. These are all passed on to
|
||||
# SetupNativeCompilation, except for
|
||||
# EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
|
||||
# EXTRA_RCFLAGS -- additional RCFLAGS to append.
|
||||
# EXTRA_HEADER_DIRS -- additional directories to look for headers in
|
||||
# EXTRA_SRC -- additional directories to look for source in
|
||||
# EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from
|
||||
@ -108,6 +118,7 @@ ProcessDir = \
|
||||
# HEADERS_FROM_SRC -- if false, does not add source dirs automatically as
|
||||
# header include dirs. (Defaults to true.)
|
||||
# SRC -- this is passed on, but preprocessed to accept source dir designations
|
||||
# RC_FILEDESC -- override the default FILEDESC for Windows version.rc
|
||||
# such as "java.base:headers".
|
||||
SetupJdkLibrary = $(NamedParamsMacroTemplate)
|
||||
define SetupJdkLibraryBody
|
||||
@ -137,19 +148,20 @@ define SetupJdkLibraryBody
|
||||
|
||||
ifeq ($$($1_VERSIONINFO_RESOURCE), )
|
||||
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
|
||||
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
|
||||
$1_VERSIONINFO_RESOURCE :=
|
||||
endif
|
||||
|
||||
ifeq ($$($1_RC_FLAGS), )
|
||||
$1_RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=$$($1_NAME).dll" \
|
||||
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \
|
||||
-D "JDK_FTYPE=0x2L"
|
||||
else ifeq ($$($1_RC_FLAGS), DISABLE)
|
||||
$1_RC_FLAGS :=
|
||||
ifeq ($$($1_RC_FILEDESC), )
|
||||
$1_RC_FILEDESC := $(JDK_RC_NAME) binary
|
||||
endif
|
||||
|
||||
$1_RCFLAGS := $(JDK_RCFLAGS) \
|
||||
-D"JDK_FILEDESC=$$(strip $$($1_RC_FILEDESC))" \
|
||||
-D"JDK_FNAME=$$($1_NAME).dll" \
|
||||
-D"JDK_INTERNAL_NAME=$$($1_NAME)" \
|
||||
-D"JDK_FTYPE=0x2L" \
|
||||
-I$(TOPDIR)/src/java.base/windows/native/common \
|
||||
$$($1_EXTRA_RCFLAGS)
|
||||
|
||||
ifneq ($$($1_HEADERS_FROM_SRC), false)
|
||||
$1_SRC_HEADER_FLAGS := $$(addprefix -I, $$(wildcard $$($1_SRC)))
|
||||
endif
|
||||
@ -171,7 +183,6 @@ define SetupJdkLibraryBody
|
||||
ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
|
||||
$1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
|
||||
endif
|
||||
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
|
||||
|
||||
# Since we reuse the rule name ($1), all our arguments will pass through.
|
||||
# We lose in transparency, but gain in brevity in this call...
|
||||
@ -186,7 +197,7 @@ endef
|
||||
#
|
||||
# Remaining parameters are named arguments. These are all passed on to
|
||||
# SetupNativeCompilation, except for
|
||||
# EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
|
||||
# EXTRA_RCFLAGS -- additional RCFLAGS to append.
|
||||
SetupJdkExecutable = $(NamedParamsMacroTemplate)
|
||||
define SetupJdkExecutableBody
|
||||
$1_TYPE := EXECUTABLE
|
||||
@ -201,20 +212,15 @@ define SetupJdkExecutableBody
|
||||
|
||||
ifeq ($$($1_VERSIONINFO_RESOURCE), )
|
||||
$1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
|
||||
else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
|
||||
$1_VERSIONINFO_RESOURCE :=
|
||||
endif
|
||||
|
||||
ifeq ($$($1_RC_FLAGS), )
|
||||
$1_RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=$$($1_NAME).exe" \
|
||||
-D "JDK_INTERNAL_NAME=$$($1_NAME)" \
|
||||
-D "JDK_FTYPE=0x01L"
|
||||
else ifeq ($$($1_RC_FLAGS), DISABLE)
|
||||
$1_RC_FLAGS :=
|
||||
endif
|
||||
|
||||
$1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
|
||||
$1_RCFLAGS := $(JDK_RCFLAGS) \
|
||||
-D"JDK_FILEDESC=$(JDK_RC_NAME) binary" \
|
||||
-D"JDK_FNAME=$$($1_NAME).exe" \
|
||||
-D"JDK_INTERNAL_NAME=$$($1_NAME)" \
|
||||
-D"JDK_FTYPE=0x1L" \
|
||||
-I$(TOPDIR)/src/java.base/windows/native/common \
|
||||
$$($1_EXTRA_RCFLAGS)
|
||||
|
||||
# Since we reuse the rule name ($1), all our arguments will pass through.
|
||||
# We lose in transparency, but gain in brevity in this call...
|
||||
|
@ -457,7 +457,7 @@ endef
|
||||
# EXTRA_OBJECT_FILES List of extra object files to include when linking
|
||||
# EXTRA_DEPS List of extra dependencies to be added to each compiled file
|
||||
# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
|
||||
# RC_FLAGS flags for RC.
|
||||
# RCFLAGS flags for RC.
|
||||
# EMBED_MANIFEST if true, embed manifest on Windows.
|
||||
# MAPFILE mapfile
|
||||
# USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
|
||||
@ -860,7 +860,7 @@ define SetupNativeCompilationBody
|
||||
-include $$($1_RES_DEPS_FILE)
|
||||
-include $$($1_RES_DEPS_TARGETS_FILE)
|
||||
|
||||
$1_RES_VARDEPS := $$($1_RC) $$($1_RC_FLAGS)
|
||||
$1_RES_VARDEPS := $$($1_RC) $$($1_RCFLAGS)
|
||||
$1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \
|
||||
$$($1_RES).vardeps)
|
||||
|
||||
@ -868,7 +868,7 @@ define SetupNativeCompilationBody
|
||||
$$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$($1_BASENAME)))
|
||||
$$(call MakeDir, $$(@D) $$($1_OBJECT_DIR))
|
||||
$$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \
|
||||
$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
|
||||
$$($1_RC) $$($1_RCFLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
|
||||
$$($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.
|
||||
@ -876,7 +876,7 @@ define SetupNativeCompilationBody
|
||||
# includes to stderr so need to redirect it to hide the output from the
|
||||
# main log.
|
||||
$$(call ExecuteWithLog, $$($1_RES_DEPS_FILE).obj, \
|
||||
$$($1_CC) $$(filter-out -l%, $$($1_RC_FLAGS)) \
|
||||
$$($1_CC) $$(filter-out -l%, $$($1_RCFLAGS)) \
|
||||
$$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
|
||||
$(CC_OUT_OPTION)$$($1_RES_DEPS_FILE).obj -P -Fi$$($1_RES_DEPS_FILE).pp \
|
||||
$$($1_VERSIONINFO_RESOURCE)) 2>&1 \
|
||||
|
@ -220,6 +220,10 @@ define ParseKeywordVariableBody
|
||||
$$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \
|
||||
$$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \
|
||||
$$(eval $1_NO_MATCH := true) \
|
||||
$$(if $$(filter help, $$(part)), \
|
||||
$$(info Valid keywords for $1:) \
|
||||
$$(info $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS).) \
|
||||
$$(error Re-run without 'help' to continue)) \
|
||||
$$(foreach keyword, $$($1_SINGLE_KEYWORDS), \
|
||||
$$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
|
||||
$$(if $$(filter $$(keyword)=%, $$(part)), \
|
||||
|
@ -48,7 +48,6 @@ LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
|
||||
#
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
MACOSX_PLIST_DIR := $(TOPDIR)/src/java.base/macosx/native/launcher
|
||||
JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest
|
||||
|
||||
@ -71,7 +70,7 @@ JAVA_MANIFEST := $(TOPDIR)/src/java.base/windows/native/launcher/java.manifest
|
||||
# compile time defines exceeding Visual Studio 2013 limitations.
|
||||
# CFLAGS Additional CFLAGS
|
||||
# CFLAGS_windows Additional CFLAGS_windows
|
||||
# EXTRA_RC_FLAGS Additional EXTRA_RC_FLAGS
|
||||
# EXTRA_RCFLAGS Additional EXTRA_RCFLAGS
|
||||
# MACOSX_PRIVILEGED On macosx, allow to access other processes
|
||||
# OPTIMIZATION Override default optimization level (LOW)
|
||||
# OUTPUT_DIR Override default output directory
|
||||
@ -160,7 +159,7 @@ define SetupBuildLauncherBody
|
||||
$(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib, \
|
||||
OUTPUT_DIR := $$($1_OUTPUT_DIR), \
|
||||
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
|
||||
EXTRA_RC_FLAGS := $$($1_EXTRA_RC_FLAGS), \
|
||||
EXTRA_RCFLAGS := $$($1_EXTRA_RCFLAGS), \
|
||||
MANIFEST := $(JAVA_MANIFEST), \
|
||||
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
|
||||
))
|
||||
|
@ -27,8 +27,6 @@ include JdkNativeCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
|
||||
# Absolute paths to lib files on windows for use in LIBS. Should figure out a more
|
||||
# elegant solution to this.
|
||||
WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -632,10 +632,37 @@ class name java/security/cert/X509CRL
|
||||
class name java/security/cert/X509Certificate
|
||||
-method name verify descriptor (Ljava/security/PublicKey;Ljava/security/Provider;)V
|
||||
|
||||
class name java/security/interfaces/RSAKey
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
-class name java/security/spec/DSAGenParameterSpec
|
||||
|
||||
class name java/security/spec/MGF1ParameterSpec
|
||||
-field name SHA224 descriptor Ljava/security/spec/MGF1ParameterSpec;
|
||||
-field name SHA512_224 descriptor Ljava/security/spec/MGF1ParameterSpec;
|
||||
-field name SHA512_256 descriptor Ljava/security/spec/MGF1ParameterSpec;
|
||||
|
||||
class name java/security/spec/PSSParameterSpec
|
||||
-field name TRAILER_FIELD_BC descriptor I
|
||||
-method name toString descriptor ()Ljava/lang/String;
|
||||
|
||||
class name java/security/spec/RSAKeyGenParameterSpec
|
||||
-method name <init> descriptor (ILjava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getKeyParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/RSAMultiPrimePrivateCrtKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;[Ljava/security/spec/RSAOtherPrimeInfo;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
|
||||
class name java/security/spec/RSAPrivateCrtKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
|
||||
class name java/security/spec/RSAPrivateKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/RSAPublicKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/text/Collator
|
||||
-method name getInstance descriptor (Ljava/util/Locale;)Ljava/text/Collator;
|
||||
@ -1457,6 +1484,14 @@ method name newUpdater descriptor (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/
|
||||
|
||||
-class name java/util/function/UnaryOperator
|
||||
|
||||
class name java/util/jar/Attributes$Name
|
||||
-field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name;
|
||||
-field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name;
|
||||
-field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name;
|
||||
field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
|
||||
class name java/util/jar/JarFile
|
||||
-method name stream descriptor ()Ljava/util/stream/Stream;
|
||||
|
||||
@ -1535,6 +1570,9 @@ class name java/util/zip/ZipEntry
|
||||
class name java/util/zip/ZipFile
|
||||
-method name stream descriptor ()Ljava/util/stream/Stream;
|
||||
|
||||
class name javax/crypto/SealedObject
|
||||
header extends java/lang/Object implements java/io/Serializable flags 21
|
||||
|
||||
class name javax/crypto/SecretKey
|
||||
header extends java/lang/Object implements java/security/Key flags 601
|
||||
|
||||
@ -1559,6 +1597,12 @@ class name javax/net/ssl/ExtendedSSLSession
|
||||
|
||||
-class name javax/net/ssl/SNIServerName
|
||||
|
||||
class name javax/net/ssl/SSLEngine
|
||||
-method name getApplicationProtocol descriptor ()Ljava/lang/String;
|
||||
-method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String;
|
||||
-method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V
|
||||
-method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction;
|
||||
|
||||
class name javax/net/ssl/SSLParameters
|
||||
-method name setServerNames descriptor (Ljava/util/List;)V
|
||||
-method name getServerNames descriptor ()Ljava/util/List;
|
||||
@ -1566,6 +1610,14 @@ class name javax/net/ssl/SSLParameters
|
||||
-method name getSNIMatchers descriptor ()Ljava/util/Collection;
|
||||
-method name setUseCipherSuitesOrder descriptor (Z)V
|
||||
-method name getUseCipherSuitesOrder descriptor ()Z
|
||||
-method name getApplicationProtocols descriptor ()[Ljava/lang/String;
|
||||
-method name setApplicationProtocols descriptor ([Ljava/lang/String;)V
|
||||
|
||||
class name javax/net/ssl/SSLSocket
|
||||
-method name getApplicationProtocol descriptor ()Ljava/lang/String;
|
||||
-method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String;
|
||||
-method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V
|
||||
-method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction;
|
||||
|
||||
class name javax/net/ssl/SSLSocketFactory
|
||||
-method name createSocket descriptor (Ljava/net/Socket;Ljava/io/InputStream;Z)Ljava/net/Socket;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -8200,6 +8200,7 @@ method name getW descriptor ()Ljava/security/spec/ECPoint; flags 401
|
||||
class name java/security/interfaces/RSAKey
|
||||
header extends java/lang/Object flags 601 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
method name getModulus descriptor ()Ljava/math/BigInteger; flags 401
|
||||
method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1
|
||||
|
||||
class name java/security/interfaces/RSAMultiPrimePrivateCrtKey
|
||||
header extends java/lang/Object implements java/security/interfaces/RSAPrivateKey flags 601 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -8363,6 +8364,8 @@ field name SHA224 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
field name SHA256 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
field name SHA384 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
field name SHA512 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
field name SHA512_224 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
field name SHA512_256 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19
|
||||
method name <init> descriptor (Ljava/lang/String;)V flags 1
|
||||
method name getDigestAlgorithm descriptor ()Ljava/lang/String; flags 1
|
||||
|
||||
@ -8375,6 +8378,7 @@ method name getFormat descriptor ()Ljava/lang/String; flags 11
|
||||
class name java/security/spec/PSSParameterSpec
|
||||
header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
field name DEFAULT descriptor Ljava/security/spec/PSSParameterSpec; flags 19
|
||||
field name TRAILER_FIELD_BC descriptor I constantValue 1 flags 19
|
||||
method name <init> descriptor (Ljava/lang/String;Ljava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;II)V flags 1
|
||||
method name <init> descriptor (I)V flags 1
|
||||
method name getDigestAlgorithm descriptor ()Ljava/lang/String; flags 1
|
||||
@ -8382,6 +8386,7 @@ method name getMGFAlgorithm descriptor ()Ljava/lang/String; flags 1
|
||||
method name getMGFParameters descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1
|
||||
method name getSaltLength descriptor ()I flags 1
|
||||
method name getTrailerField descriptor ()I flags 1
|
||||
method name toString descriptor ()Ljava/lang/String; flags 1
|
||||
|
||||
class name java/security/spec/RSAKeyGenParameterSpec
|
||||
header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -8390,6 +8395,8 @@ field name F4 descriptor Ljava/math/BigInteger; flags 19
|
||||
method name <init> descriptor (ILjava/math/BigInteger;)V flags 1
|
||||
method name getKeysize descriptor ()I flags 1
|
||||
method name getPublicExponent descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name <init> descriptor (ILjava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1
|
||||
method name getKeyParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1
|
||||
|
||||
class name java/security/spec/RSAMultiPrimePrivateCrtKeySpec
|
||||
header extends java/security/spec/RSAPrivateKeySpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -8401,6 +8408,7 @@ method name getPrimeExponentP descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getPrimeExponentQ descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getCrtCoefficient descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getOtherPrimeInfo descriptor ()[Ljava/security/spec/RSAOtherPrimeInfo; flags 1
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;[Ljava/security/spec/RSAOtherPrimeInfo;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1
|
||||
|
||||
class name java/security/spec/RSAOtherPrimeInfo
|
||||
header extends java/lang/Object flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -8418,18 +8426,23 @@ method name getPrimeQ descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getPrimeExponentP descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getPrimeExponentQ descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getCrtCoefficient descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1
|
||||
|
||||
class name java/security/spec/RSAPrivateKeySpec
|
||||
header extends java/lang/Object implements java/security/spec/KeySpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;)V flags 1
|
||||
method name getModulus descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getPrivateExponent descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1
|
||||
method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1
|
||||
|
||||
class name java/security/spec/RSAPublicKeySpec
|
||||
header extends java/lang/Object implements java/security/spec/KeySpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;)V flags 1
|
||||
method name getModulus descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name getPublicExponent descriptor ()Ljava/math/BigInteger; flags 1
|
||||
method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1
|
||||
method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1
|
||||
|
||||
class name java/security/spec/X509EncodedKeySpec
|
||||
header extends java/security/spec/EncodedKeySpec flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -10429,6 +10442,7 @@ method name values descriptor ()[Ljava/time/chrono/JapaneseEra; flags 9
|
||||
method name getValue descriptor ()I flags 1
|
||||
method name range descriptor (Ljava/time/temporal/TemporalField;)Ljava/time/temporal/ValueRange; flags 1
|
||||
method name toString descriptor ()Ljava/lang/String; flags 1
|
||||
method name getDisplayName descriptor (Ljava/time/format/TextStyle;Ljava/util/Locale;)Ljava/lang/String; flags 1
|
||||
|
||||
class name java/time/chrono/MinguoChronology
|
||||
header extends java/time/chrono/AbstractChronology implements java/io/Serializable flags 31 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -15563,15 +15577,15 @@ field name MAIN_CLASS descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name SEALED descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name EXTENSION_LIST descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name EXTENSION_NAME descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_TITLE descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_VERSION descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_VENDOR descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name SPECIFICATION_TITLE descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name SPECIFICATION_VERSION descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name SPECIFICATION_VENDOR descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
method name <init> descriptor (Ljava/lang/String;)V flags 1
|
||||
method name equals descriptor (Ljava/lang/Object;)Z flags 1
|
||||
method name hashCode descriptor ()I flags 1
|
||||
@ -16698,6 +16712,7 @@ method name <init> descriptor ()V flags 1
|
||||
|
||||
class name javax/crypto/SealedObject
|
||||
header extends java/lang/Object implements java/io/Serializable flags 21
|
||||
innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19
|
||||
field name encodedParams descriptor [B flags 4
|
||||
method name <init> descriptor (Ljava/io/Serializable;Ljavax/crypto/Cipher;)V thrownTypes java/io/IOException,javax/crypto/IllegalBlockSizeException flags 1
|
||||
method name <init> descriptor (Ljavax/crypto/SealedObject;)V flags 4
|
||||
@ -17086,6 +17101,10 @@ method name setEnableSessionCreation descriptor (Z)V flags 401
|
||||
method name getEnableSessionCreation descriptor ()Z flags 401
|
||||
method name getSSLParameters descriptor ()Ljavax/net/ssl/SSLParameters; flags 1
|
||||
method name setSSLParameters descriptor (Ljavax/net/ssl/SSLParameters;)V flags 1
|
||||
method name getApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V flags 1 signature (Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLEngine;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;)V
|
||||
method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction; flags 1 signature ()Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLEngine;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;
|
||||
|
||||
class name javax/net/ssl/SSLEngineResult
|
||||
header extends java/lang/Object flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -17156,6 +17175,8 @@ method name setSNIMatchers descriptor (Ljava/util/Collection;)V flags 11 signatu
|
||||
method name getSNIMatchers descriptor ()Ljava/util/Collection; flags 11 signature ()Ljava/util/Collection<Ljavax/net/ssl/SNIMatcher;>;
|
||||
method name setUseCipherSuitesOrder descriptor (Z)V flags 11
|
||||
method name getUseCipherSuitesOrder descriptor ()Z flags 11
|
||||
method name getApplicationProtocols descriptor ()[Ljava/lang/String; flags 1
|
||||
method name setApplicationProtocols descriptor ([Ljava/lang/String;)V flags 1
|
||||
|
||||
class name javax/net/ssl/SSLPeerUnverifiedException
|
||||
header extends javax/net/ssl/SSLException flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
@ -17272,6 +17293,10 @@ method name setEnableSessionCreation descriptor (Z)V flags 401
|
||||
method name getEnableSessionCreation descriptor ()Z flags 401
|
||||
method name getSSLParameters descriptor ()Ljavax/net/ssl/SSLParameters; flags 1
|
||||
method name setSSLParameters descriptor (Ljavax/net/ssl/SSLParameters;)V flags 1
|
||||
method name getApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V flags 1 signature (Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLSocket;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;)V
|
||||
method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction; flags 1 signature ()Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLSocket;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;
|
||||
|
||||
class name javax/net/ssl/SSLSocketFactory
|
||||
header extends javax/net/SocketFactory flags 421 classAnnotations @Ljdk/Profile+Annotation;(value=I1)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -2083,13 +2083,42 @@ method name equals descriptor (Ljava/lang/Object;)Z flags 1
|
||||
method name toString descriptor ()Ljava/lang/String; flags 1
|
||||
method name clone descriptor ()Ljava/lang/Object; thrownTypes java/lang/CloneNotSupportedException flags 1041
|
||||
|
||||
class name java/security/interfaces/RSAKey
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/EncodedKeySpec
|
||||
method name <init> descriptor ([BLjava/lang/String;)V flags 4
|
||||
method name getAlgorithm descriptor ()Ljava/lang/String; flags 1
|
||||
|
||||
class name java/security/spec/MGF1ParameterSpec
|
||||
-field name SHA512_224 descriptor Ljava/security/spec/MGF1ParameterSpec;
|
||||
-field name SHA512_256 descriptor Ljava/security/spec/MGF1ParameterSpec;
|
||||
|
||||
class name java/security/spec/PKCS8EncodedKeySpec
|
||||
method name <init> descriptor ([BLjava/lang/String;)V flags 1
|
||||
|
||||
class name java/security/spec/PSSParameterSpec
|
||||
-field name TRAILER_FIELD_BC descriptor I
|
||||
-method name toString descriptor ()Ljava/lang/String;
|
||||
|
||||
class name java/security/spec/RSAKeyGenParameterSpec
|
||||
-method name <init> descriptor (ILjava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getKeyParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/RSAMultiPrimePrivateCrtKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;[Ljava/security/spec/RSAOtherPrimeInfo;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
|
||||
class name java/security/spec/RSAPrivateCrtKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
|
||||
class name java/security/spec/RSAPrivateKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/RSAPublicKeySpec
|
||||
-method name <init> descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V
|
||||
-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec;
|
||||
|
||||
class name java/security/spec/X509EncodedKeySpec
|
||||
method name <init> descriptor ([BLjava/lang/String;)V flags 1
|
||||
|
||||
@ -2224,9 +2253,6 @@ innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang
|
||||
class name java/time/chrono/IsoChronology
|
||||
method name epochSecond descriptor (IIIIIILjava/time/ZoneOffset;)J flags 1
|
||||
|
||||
class name java/time/chrono/JapaneseEra
|
||||
method name getDisplayName descriptor (Ljava/time/format/TextStyle;Ljava/util/Locale;)Ljava/lang/String; flags 1
|
||||
|
||||
class name java/time/format/DateTimeFormatter
|
||||
header extends java/lang/Object flags 31
|
||||
innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19
|
||||
@ -3221,12 +3247,6 @@ header extends java/lang/Object implements java/util/function/Function flags 601
|
||||
innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19
|
||||
|
||||
class name java/util/jar/Attributes$Name
|
||||
-field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name;
|
||||
-field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name;
|
||||
-field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name;
|
||||
field name EXTENSION_INSTALLATION descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
field name IMPLEMENTATION_VENDOR_ID descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
field name IMPLEMENTATION_URL descriptor Ljava/util/jar/Attributes$Name; flags 19 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;
|
||||
field name MULTI_RELEASE descriptor Ljava/util/jar/Attributes$Name; flags 19
|
||||
|
||||
class name java/util/jar/JarFile
|
||||
@ -3381,6 +3401,9 @@ method name finalize descriptor ()V thrownTypes java/io/IOException flags 4 depr
|
||||
class name javax/crypto/ExemptionMechanism
|
||||
-method name finalize descriptor ()V
|
||||
|
||||
class name javax/crypto/SealedObject
|
||||
header extends java/lang/Object implements java/io/Serializable flags 21
|
||||
|
||||
class name javax/net/ssl/ExtendedSSLSession
|
||||
method name getStatusResponses descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List<[B>;
|
||||
|
||||
@ -3388,12 +3411,6 @@ class name javax/net/ssl/HandshakeCompletedEvent
|
||||
-method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate;
|
||||
method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; thrownTypes javax/net/ssl/SSLPeerUnverifiedException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9")
|
||||
|
||||
class name javax/net/ssl/SSLEngine
|
||||
method name getApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V flags 1 signature (Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLEngine;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;)V
|
||||
method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction; flags 1 signature ()Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLEngine;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;
|
||||
|
||||
class name javax/net/ssl/SSLEngineResult
|
||||
header extends java/lang/Object flags 21
|
||||
innerclass innerClass javax/net/ssl/SSLEngineResult$HandshakeStatus outerClass javax/net/ssl/SSLEngineResult innerClassName HandshakeStatus flags 4019
|
||||
@ -3409,19 +3426,11 @@ method name setEnableRetransmissions descriptor (Z)V flags 1
|
||||
method name getEnableRetransmissions descriptor ()Z flags 1
|
||||
method name setMaximumPacketSize descriptor (I)V flags 1
|
||||
method name getMaximumPacketSize descriptor ()I flags 1
|
||||
method name getApplicationProtocols descriptor ()[Ljava/lang/String; flags 1
|
||||
method name setApplicationProtocols descriptor ([Ljava/lang/String;)V flags 1
|
||||
|
||||
class name javax/net/ssl/SSLSession
|
||||
-method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate;
|
||||
method name getPeerCertificateChain descriptor ()[Ljavax/security/cert/X509Certificate; thrownTypes javax/net/ssl/SSLPeerUnverifiedException flags 401 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9")
|
||||
|
||||
class name javax/net/ssl/SSLSocket
|
||||
method name getApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name getHandshakeApplicationProtocol descriptor ()Ljava/lang/String; flags 1
|
||||
method name setHandshakeApplicationProtocolSelector descriptor (Ljava/util/function/BiFunction;)V flags 1 signature (Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLSocket;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;)V
|
||||
method name getHandshakeApplicationProtocolSelector descriptor ()Ljava/util/function/BiFunction; flags 1 signature ()Ljava/util/function/BiFunction<Ljavax/net/ssl/SSLSocket;Ljava/util/List<Ljava/lang/String;>;Ljava/lang/String;>;
|
||||
|
||||
class name javax/security/auth/Policy
|
||||
header extends java/lang/Object flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.4")
|
||||
|
||||
|
@ -182,6 +182,20 @@ class name java/nio/channels/spi/SelectorProvider
|
||||
method name openSocketChannel descriptor (Ljava/net/ProtocolFamily;)Ljava/nio/channels/SocketChannel; thrownTypes java/io/IOException flags 1
|
||||
method name openServerSocketChannel descriptor (Ljava/net/ProtocolFamily;)Ljava/nio/channels/ServerSocketChannel; thrownTypes java/io/IOException flags 1
|
||||
|
||||
class name java/security/KeyStore
|
||||
header extends java/lang/Object nestMembers java/security/KeyStore$Builder,java/security/KeyStore$TrustedCertificateEntry,java/security/KeyStore$SecretKeyEntry,java/security/KeyStore$PrivateKeyEntry,java/security/KeyStore$Entry,java/security/KeyStore$Entry$Attribute,java/security/KeyStore$CallbackHandlerProtection,java/security/KeyStore$PasswordProtection,java/security/KeyStore$ProtectionParameter,java/security/KeyStore$LoadStoreParameter flags 21
|
||||
innerclass innerClass java/security/KeyStore$LoadStoreParameter outerClass java/security/KeyStore innerClassName LoadStoreParameter flags 609
|
||||
innerclass innerClass java/security/KeyStore$ProtectionParameter outerClass java/security/KeyStore innerClassName ProtectionParameter flags 609
|
||||
innerclass innerClass java/security/KeyStore$Entry outerClass java/security/KeyStore innerClassName Entry flags 609
|
||||
innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9
|
||||
innerclass innerClass java/security/KeyStore$Builder outerClass java/security/KeyStore innerClassName Builder flags 409
|
||||
innerclass innerClass java/security/KeyStore$TrustedCertificateEntry outerClass java/security/KeyStore innerClassName TrustedCertificateEntry flags 19
|
||||
innerclass innerClass java/security/KeyStore$SecretKeyEntry outerClass java/security/KeyStore innerClassName SecretKeyEntry flags 19
|
||||
innerclass innerClass java/security/KeyStore$PrivateKeyEntry outerClass java/security/KeyStore innerClassName PrivateKeyEntry flags 19
|
||||
innerclass innerClass java/security/KeyStore$CallbackHandlerProtection outerClass java/security/KeyStore innerClassName CallbackHandlerProtection flags 9
|
||||
innerclass innerClass java/security/KeyStore$PasswordProtection outerClass java/security/KeyStore innerClassName PasswordProtection flags 9
|
||||
innerclass innerClass java/security/KeyStore$Entry$Attribute outerClass java/security/KeyStore$Entry innerClassName Attribute flags 609
|
||||
|
||||
class name java/security/interfaces/EdECKey
|
||||
header extends java/lang/Object flags 601
|
||||
method name getParams descriptor ()Ljava/security/spec/NamedParameterSpec; flags 401
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -77,6 +77,9 @@ class name javax/swing/ImageIcon
|
||||
field name component descriptor Ljava/awt/Component; flags 1c
|
||||
field name tracker descriptor Ljava/awt/MediaTracker; flags 1c
|
||||
|
||||
class name javax/swing/JComboBox
|
||||
-method name processKeyBinding descriptor (Ljavax/swing/KeyStroke;Ljava/awt/event/KeyEvent;IZ)Z
|
||||
|
||||
class name javax/swing/JComponent
|
||||
field name accessibleContext descriptor Ljavax/accessibility/AccessibleContext; flags 4
|
||||
-method name hide descriptor ()V
|
||||
@ -90,8 +93,12 @@ field name accessibleFocusHandler descriptor Ljava/awt/event/FocusListener; flag
|
||||
class name javax/swing/JDesktopPane
|
||||
-method name remove descriptor (Ljava/awt/Component;)V
|
||||
|
||||
class name javax/swing/JViewport
|
||||
-method name addNotify descriptor ()V
|
||||
class name javax/swing/JList$AccessibleJList$AccessibleJListChild
|
||||
method name getAccessibleAction descriptor ()Ljavax/accessibility/AccessibleAction; flags 1
|
||||
|
||||
class name javax/swing/plaf/basic/BasicRadioButtonUI
|
||||
-method name installListeners descriptor (Ljavax/swing/AbstractButton;)V
|
||||
-method name uninstallListeners descriptor (Ljavax/swing/AbstractButton;)V
|
||||
|
||||
class name javax/swing/tree/DefaultMutableTreeNode
|
||||
-method name setParent descriptor (Ljavax/swing/tree/MutableTreeNode;)V
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -13524,6 +13524,7 @@ method name getItemAt descriptor (I)Ljava/lang/Object; flags 1 signature (I)TE;
|
||||
method name createDefaultKeySelectionManager descriptor ()Ljavax/swing/JComboBox$KeySelectionManager; flags 4
|
||||
method name paramString descriptor ()Ljava/lang/String; flags 4
|
||||
method name getAccessibleContext descriptor ()Ljavax/accessibility/AccessibleContext; flags 1
|
||||
method name processKeyBinding descriptor (Ljavax/swing/KeyStroke;Ljava/awt/event/KeyEvent;IZ)Z flags 4
|
||||
|
||||
class name javax/swing/JComboBox$AccessibleJComboBox
|
||||
header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleAction,javax/accessibility/AccessibleSelection flags 21
|
||||
@ -14604,7 +14605,6 @@ method name getAccessibleChild descriptor (I)Ljavax/accessibility/Accessible; fl
|
||||
method name getLocale descriptor ()Ljava/util/Locale; flags 1
|
||||
method name addPropertyChangeListener descriptor (Ljava/beans/PropertyChangeListener;)V flags 1
|
||||
method name removePropertyChangeListener descriptor (Ljava/beans/PropertyChangeListener;)V flags 1
|
||||
method name getAccessibleAction descriptor ()Ljavax/accessibility/AccessibleAction; flags 1
|
||||
method name getAccessibleComponent descriptor ()Ljavax/accessibility/AccessibleComponent; flags 1
|
||||
method name getAccessibleSelection descriptor ()Ljavax/accessibility/AccessibleSelection; flags 1
|
||||
method name getAccessibleText descriptor ()Ljavax/accessibility/AccessibleText; flags 1
|
||||
@ -16720,7 +16720,6 @@ method name updateUI descriptor ()V flags 1
|
||||
method name getUIClassID descriptor ()Ljava/lang/String; flags 1
|
||||
method name addImpl descriptor (Ljava/awt/Component;Ljava/lang/Object;I)V flags 4
|
||||
method name remove descriptor (Ljava/awt/Component;)V flags 1
|
||||
method name addNotify descriptor ()V flags 1
|
||||
method name scrollRectToVisible descriptor (Ljava/awt/Rectangle;)V flags 1
|
||||
method name setBorder descriptor (Ljavax/swing/border/Border;)V flags 11
|
||||
method name getInsets descriptor ()Ljava/awt/Insets; flags 11
|
||||
@ -20281,6 +20280,8 @@ method name getDefaultIcon descriptor ()Ljavax/swing/Icon; flags 1
|
||||
method name paint descriptor (Ljava/awt/Graphics;Ljavax/swing/JComponent;)V flags 21
|
||||
method name paintFocus descriptor (Ljava/awt/Graphics;Ljava/awt/Rectangle;Ljava/awt/Dimension;)V flags 4
|
||||
method name getPreferredSize descriptor (Ljavax/swing/JComponent;)Ljava/awt/Dimension; flags 1
|
||||
method name installListeners descriptor (Ljavax/swing/AbstractButton;)V flags 4
|
||||
method name uninstallListeners descriptor (Ljavax/swing/AbstractButton;)V flags 4
|
||||
|
||||
class name javax/swing/plaf/basic/BasicRootPaneUI
|
||||
header extends javax/swing/plaf/RootPaneUI implements java/beans/PropertyChangeListener flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I4)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 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
|
||||
@ -2524,7 +2524,6 @@ method name getPopupMenuListeners descriptor ()[Ljavax/swing/event/PopupMenuList
|
||||
method name setAction descriptor (Ljavax/swing/Action;)V flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(visualUpdate=Ztrue,description="the\u005C;u0020;Action\u005C;u0020;instance\u005C;u0020;connected\u005C;u0020;with\u005C;u0020;this\u005C;u0020;ActionEvent\u005C;u0020;source")
|
||||
method name getSelectedObjects descriptor ()[Ljava/lang/Object; flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(bound=Zfalse)
|
||||
method name setEnabled descriptor (Z)V flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(description="The\u005C;u0020;enabled\u005C;u0020;state\u005C;u0020;of\u005C;u0020;the\u005C;u0020;component.",preferred=Ztrue)
|
||||
method name processKeyBinding descriptor (Ljavax/swing/KeyStroke;Ljava/awt/event/KeyEvent;IZ)Z flags 4
|
||||
method name setKeySelectionManager descriptor (Ljavax/swing/JComboBox$KeySelectionManager;)V flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(expert=Ztrue,bound=Zfalse,description="The\u005C;u0020;objects\u005C;u0020;that\u005C;u0020;changes\u005C;u0020;the\u005C;u0020;selection\u005C;u0020;when\u005C;u0020;a\u005C;u0020;key\u005C;u0020;is\u005C;u0020;pressed.")
|
||||
method name getItemCount descriptor ()I flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(bound=Zfalse)
|
||||
method name getAccessibleContext descriptor ()Ljavax/accessibility/AccessibleContext; flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(bound=Zfalse)
|
||||
@ -3039,6 +3038,7 @@ class name javax/swing/JList$AccessibleJList$AccessibleJListChild
|
||||
header extends javax/accessibility/AccessibleContext implements javax/accessibility/Accessible,javax/accessibility/AccessibleComponent,javax/accessibility/AccessibleAction flags 21
|
||||
innerclass innerClass javax/swing/JList$AccessibleJList outerClass javax/swing/JList innerClassName AccessibleJList flags 4
|
||||
innerclass innerClass javax/swing/JList$AccessibleJList$AccessibleJListChild outerClass javax/swing/JList$AccessibleJList innerClassName AccessibleJListChild flags 4
|
||||
method name getAccessibleAction descriptor ()Ljavax/accessibility/AccessibleAction; flags 1
|
||||
method name doAccessibleAction descriptor (I)Z flags 1
|
||||
method name getAccessibleActionDescription descriptor (I)Ljava/lang/String; flags 1
|
||||
method name getAccessibleActionCount descriptor ()I flags 1
|
||||
@ -3907,7 +3907,6 @@ innerclass innerClass javax/swing/JViewport$AccessibleJViewport outerClass javax
|
||||
innerclass innerClass javax/swing/JViewport$ViewListener outerClass javax/swing/JViewport innerClassName ViewListener flags 4
|
||||
innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19
|
||||
-method name setUI descriptor (Ljavax/swing/plaf/ViewportUI;)V
|
||||
-method name addNotify descriptor ()V
|
||||
-method name getInsets descriptor (Ljava/awt/Insets;)Ljava/awt/Insets;
|
||||
-method name setScrollMode descriptor (I)V
|
||||
method name setUI descriptor (Ljavax/swing/plaf/ViewportUI;)V flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(hidden=Ztrue,visualUpdate=Ztrue,description="The\u005C;u0020;UI\u005C;u0020;object\u005C;u0020;that\u005C;u0020;implements\u005C;u0020;the\u005C;u0020;Component's\u005C;u0020;LookAndFeel.")
|
||||
@ -4402,8 +4401,6 @@ innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang
|
||||
class name javax/swing/plaf/basic/BasicRadioButtonUI
|
||||
header extends javax/swing/plaf/basic/BasicToggleButtonUI flags 21
|
||||
innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19
|
||||
method name installListeners descriptor (Ljavax/swing/AbstractButton;)V flags 4
|
||||
method name uninstallListeners descriptor (Ljavax/swing/AbstractButton;)V flags 4
|
||||
|
||||
class name javax/swing/plaf/basic/BasicScrollBarUI
|
||||
header extends javax/swing/plaf/ScrollBarUI implements java/awt/LayoutManager,javax/swing/SwingConstants flags 21
|
||||
|
@ -27,7 +27,7 @@
|
||||
# ##########################################################
|
||||
#
|
||||
#command used to generate this file:
|
||||
#build.tools.symbolgenerator.CreateSymbols build-description-incremental symbols include.list
|
||||
#build.tools.symbolgenerator.CreateSymbols build-description-incremental-file symbols include.list 8 jdk8-updated.classes <none> --normalize-method-flags
|
||||
#
|
||||
generate platforms 7:8:9:A:B:C:D:E:F
|
||||
platform version 8 files java.activation-8.sym.txt:java.base-8.sym.txt:java.compiler-8.sym.txt:java.corba-8.sym.txt:java.datatransfer-8.sym.txt:java.desktop-8.sym.txt:java.instrument-8.sym.txt:java.logging-8.sym.txt:java.management-8.sym.txt:java.management.rmi-8.sym.txt:java.naming-8.sym.txt:java.prefs-8.sym.txt:java.rmi-8.sym.txt:java.scripting-8.sym.txt:java.security.jgss-8.sym.txt:java.security.sasl-8.sym.txt:java.sql-8.sym.txt:java.sql.rowset-8.sym.txt:java.transaction-8.sym.txt:java.xml-8.sym.txt:java.xml.bind-8.sym.txt:java.xml.crypto-8.sym.txt:java.xml.ws-8.sym.txt:java.xml.ws.annotation-8.sym.txt:jdk.httpserver-8.sym.txt:jdk.management-8.sym.txt:jdk.scripting.nashorn-8.sym.txt:jdk.sctp-8.sym.txt:jdk.security.auth-8.sym.txt:jdk.security.jgss-8.sym.txt
|
||||
|
@ -106,14 +106,16 @@ $(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl, \
|
||||
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl, \
|
||||
-PARAM majorversion $(VERSION_FEATURE)))
|
||||
|
||||
JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter
|
||||
JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter/zero
|
||||
|
||||
$(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
|
||||
XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
|
||||
XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
|
||||
OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
|
||||
DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
|
||||
))
|
||||
ifeq ($(call check-jvm-feature, zero), true)
|
||||
$(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
|
||||
XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
|
||||
XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
|
||||
OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
|
||||
DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
|
||||
))
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy jvmti.h to include dir
|
||||
|
@ -38,9 +38,8 @@ endif
|
||||
|
||||
################################################################################
|
||||
|
||||
# Disabling all warnings in gtest source code
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBGTEST, \
|
||||
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
|
||||
NAME := gtest, \
|
||||
TYPE := STATIC_LIBRARY, \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
@ -50,8 +49,9 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBGTEST, \
|
||||
$(GTEST_FRAMEWORK_SRC)/googletest/src \
|
||||
$(GTEST_FRAMEWORK_SRC)/googlemock/src, \
|
||||
INCLUDE_FILES := gtest-all.cc gmock-all.cc, \
|
||||
CFLAGS := $(filter-out $(WARNING_CFLAGS_JVM), $(JVM_CFLAGS)) \
|
||||
-w \
|
||||
DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral, \
|
||||
DISABLED_WARNINGS_clang := undef unused-result format-nonliteral, \
|
||||
CFLAGS := $(JVM_CFLAGS) \
|
||||
-I$(GTEST_FRAMEWORK_SRC)/googletest \
|
||||
-I$(GTEST_FRAMEWORK_SRC)/googletest/include \
|
||||
-I$(GTEST_FRAMEWORK_SRC)/googlemock \
|
||||
@ -81,10 +81,9 @@ else
|
||||
$(call create-mapfile)
|
||||
endif
|
||||
|
||||
# Disabling undef, switch, format-nonliteral and tautological-undefined-compare
|
||||
# warnings for clang because of test source.
|
||||
# Additional disabled warnings are due to code in the test source.
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
|
||||
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \
|
||||
NAME := jvm, \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
|
||||
@ -106,6 +105,7 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
|
||||
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang) \
|
||||
undef switch format-nonliteral tautological-undefined-compare \
|
||||
self-assign-overloaded, \
|
||||
DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \
|
||||
LDFLAGS := $(JVM_LDFLAGS), \
|
||||
LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/libgtest, \
|
||||
LIBS := $(JVM_LIBS), \
|
||||
@ -127,7 +127,7 @@ TARGETS += $(BUILD_GTEST_LIBJVM)
|
||||
|
||||
################################################################################
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \
|
||||
$(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
NAME := gtestLauncher, \
|
||||
TYPE := EXECUTABLE, \
|
||||
|
@ -95,9 +95,7 @@ DISABLED_WARNINGS_clang := tautological-compare \
|
||||
|
||||
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value
|
||||
|
||||
DISABLED_WARNINGS_microsoft :=
|
||||
|
||||
|
||||
DISABLED_WARNINGS_microsoft := 4100 4127 4201 4244 4291 4351 4511 4512 4514 4996
|
||||
|
||||
################################################################################
|
||||
# Platform specific setup
|
||||
@ -126,13 +124,6 @@ else ifeq ($(call isTargetCpu, x86_64), true)
|
||||
JVM_EXCLUDE_PATTERNS += x86_32
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
ifeq ($(call isTargetCpuBits, 64), true)
|
||||
RC_DESC := 64-Bit$(SPACE)
|
||||
endif
|
||||
JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
|
||||
endif
|
||||
|
||||
JVM_OPTIMIZATION ?= HIGHEST_JVM
|
||||
|
||||
# Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
|
||||
@ -146,7 +137,7 @@ $(call FillFindCache, $(JVM_SRC_DIRS))
|
||||
################################################################################
|
||||
# Now set up the actual compilation of the main hotspot native library
|
||||
|
||||
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
|
||||
$(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
|
||||
NAME := jvm, \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
|
||||
@ -170,8 +161,7 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
|
||||
USE_MAPFILE_FOR_SYMBOLS := true, \
|
||||
STRIPFLAGS := $(JVM_STRIPFLAGS), \
|
||||
EMBED_MANIFEST := true, \
|
||||
RC_FLAGS := $(JVM_RCFLAGS), \
|
||||
VERSIONINFO_RESOURCE := $(TOPDIR)/src/hotspot/os/windows/version.rc, \
|
||||
RC_FILEDESC := $(HOTSPOT_VM_DISTRO) $(OPENJDK_TARGET_CPU_BITS)-Bit $(JVM_VARIANT) VM, \
|
||||
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
|
||||
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
|
||||
))
|
||||
|
@ -27,7 +27,7 @@ default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include NativeCompilation.gmk
|
||||
include JdkNativeCompilation.gmk
|
||||
|
||||
include HotspotCommon.gmk
|
||||
|
||||
|
@ -45,11 +45,17 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(call check-jvm-feature, zero), true)
|
||||
JVM_CFLAGS_FEATURES += -DZERO -DCC_INTERP -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
|
||||
JVM_EXCLUDES += opto libadt
|
||||
JVM_EXCLUDE_PATTERNS += c1_ c1/ c2_ runtime_ /c2/
|
||||
JVM_EXCLUDE_FILES += templateInterpreter.cpp templateInterpreterGenerator.cpp \
|
||||
bcEscapeAnalyzer.cpp ciTypeFlow.cpp
|
||||
JVM_CFLAGS_FEATURES += -DZERO -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
|
||||
JVM_LIBS_FEATURES += $(LIBFFI_LIBS)
|
||||
ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
|
||||
JVM_LDFLAGS_FEATURES += $(call SET_EXECUTABLE_ORIGIN,/..)
|
||||
endif
|
||||
else
|
||||
JVM_EXCLUDE_PATTERNS += /zero/
|
||||
endif
|
||||
|
||||
ifeq ($(JVM_VARIANT), custom)
|
||||
|
@ -92,9 +92,6 @@ else ifeq ($(call isTargetOs, macosx), true)
|
||||
# NOTE: The old build tested clang version to make sure this workaround
|
||||
# for the clang bug was still needed.
|
||||
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
|
||||
ifneq ($(DEBUG_LEVEL), slowdebug)
|
||||
BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
|
||||
endif
|
||||
|
||||
# The following files are compiled at various optimization
|
||||
# levels due to optimization issues encountered at the
|
||||
@ -110,7 +107,6 @@ else ifeq ($(call isTargetOs, macosx), true)
|
||||
sharedRuntimeTrig.cpp \
|
||||
sharedRuntimeTrans.cpp \
|
||||
loopTransform.cpp \
|
||||
unsafe.cpp \
|
||||
jvmciCompilerToVM.cpp \
|
||||
$(OPT_SPEED_SRC) \
|
||||
#
|
||||
|
@ -31,6 +31,7 @@ import build.tools.symbolgenerator.CreateSymbols
|
||||
import build.tools.symbolgenerator.CreateSymbols
|
||||
.ModuleHeaderDescription
|
||||
.RequiresDescription;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -43,6 +44,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.FileVisitor;
|
||||
@ -220,7 +222,7 @@ public class CreateSymbols {
|
||||
long timestamp, String currentVersion, String systemModules) throws IOException {
|
||||
LoadDescriptions data = load(ctDescriptionFileExtra != null ? Paths.get(ctDescriptionFileExtra)
|
||||
: null,
|
||||
Paths.get(ctDescriptionFile), null);
|
||||
Paths.get(ctDescriptionFile));
|
||||
|
||||
splitHeaders(data.classes);
|
||||
|
||||
@ -303,7 +305,7 @@ public class CreateSymbols {
|
||||
|
||||
public static String EXTENSION = ".sig";
|
||||
|
||||
LoadDescriptions load(Path ctDescriptionWithExtraContent, Path ctDescriptionOpen, String deletePlatform) throws IOException {
|
||||
LoadDescriptions load(Path ctDescriptionWithExtraContent, Path ctDescriptionOpen) throws IOException {
|
||||
Map<String, PlatformInput> platforms = new LinkedHashMap<>();
|
||||
|
||||
if (ctDescriptionWithExtraContent != null && Files.isRegularFile(ctDescriptionWithExtraContent)) {
|
||||
@ -317,8 +319,7 @@ public class CreateSymbols {
|
||||
case "platform":
|
||||
PlatformInput platform = PlatformInput.load(ctDescriptionWithExtraContent,
|
||||
reader);
|
||||
if (!platform.version.equals(deletePlatform))
|
||||
platforms.put(platform.version, platform);
|
||||
platforms.put(platform.version, platform);
|
||||
reader.moveNext();
|
||||
break;
|
||||
default:
|
||||
@ -336,13 +337,11 @@ public class CreateSymbols {
|
||||
case "generate":
|
||||
String[] platformsAttr = reader.attributes.get("platforms").split(":");
|
||||
generatePlatforms = new HashSet<>(List.of(platformsAttr));
|
||||
generatePlatforms.remove(deletePlatform);
|
||||
reader.moveNext();
|
||||
break;
|
||||
case "platform":
|
||||
PlatformInput platform = PlatformInput.load(ctDescriptionOpen, reader);
|
||||
if (!platform.version.equals(deletePlatform) &&
|
||||
!platforms.containsKey(platform.version))
|
||||
if (!platforms.containsKey(platform.version))
|
||||
platforms.put(platform.version, platform);
|
||||
reader.moveNext();
|
||||
break;
|
||||
@ -408,18 +407,28 @@ public class CreateSymbols {
|
||||
|
||||
ClassList result = new ClassList();
|
||||
|
||||
for (ClassDescription desc : classes.values()) {
|
||||
classes.values().forEach(result::add);
|
||||
return new LoadDescriptions(result,
|
||||
modules,
|
||||
new ArrayList<>(platforms.values()));
|
||||
}
|
||||
|
||||
private static void removeVersion(LoadDescriptions load, String deletePlatform) {
|
||||
for (Iterator<ClassDescription> it = load.classes.iterator(); it.hasNext();) {
|
||||
ClassDescription desc = it.next();
|
||||
Iterator<ClassHeaderDescription> chdIt = desc.header.iterator();
|
||||
|
||||
while (chdIt.hasNext()) {
|
||||
ClassHeaderDescription chd = chdIt.next();
|
||||
|
||||
chd.versions = reduce(chd.versions, generatePlatforms);
|
||||
if (chd.versions.isEmpty())
|
||||
chd.versions = removeVersion(chd.versions, deletePlatform);
|
||||
if (chd.versions.isEmpty()) {
|
||||
chdIt.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (desc.header.isEmpty()) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -428,7 +437,7 @@ public class CreateSymbols {
|
||||
while (methodIt.hasNext()) {
|
||||
MethodDescription method = methodIt.next();
|
||||
|
||||
method.versions = reduce(method.versions, generatePlatforms);
|
||||
method.versions = removeVersion(method.versions, deletePlatform);
|
||||
if (method.versions.isEmpty())
|
||||
methodIt.remove();
|
||||
}
|
||||
@ -438,37 +447,29 @@ public class CreateSymbols {
|
||||
while (fieldIt.hasNext()) {
|
||||
FieldDescription field = fieldIt.next();
|
||||
|
||||
field.versions = reduce(field.versions, generatePlatforms);
|
||||
field.versions = removeVersion(field.versions, deletePlatform);
|
||||
if (field.versions.isEmpty())
|
||||
fieldIt.remove();
|
||||
}
|
||||
|
||||
result.add(desc);
|
||||
}
|
||||
|
||||
Map<String, ModuleDescription> moduleList = new HashMap<>();
|
||||
|
||||
for (ModuleDescription desc : modules.values()) {
|
||||
for (Iterator<ModuleDescription> it = load.modules.values().iterator(); it.hasNext();) {
|
||||
ModuleDescription desc = it.next();
|
||||
Iterator<ModuleHeaderDescription> mhdIt = desc.header.iterator();
|
||||
|
||||
while (mhdIt.hasNext()) {
|
||||
ModuleHeaderDescription mhd = mhdIt.next();
|
||||
|
||||
mhd.versions = reduce(mhd.versions, generatePlatforms);
|
||||
mhd.versions = removeVersion(mhd.versions, deletePlatform);
|
||||
if (mhd.versions.isEmpty())
|
||||
mhdIt.remove();
|
||||
}
|
||||
|
||||
if (desc.header.isEmpty()) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
moduleList.put(desc.name, desc);
|
||||
}
|
||||
|
||||
return new LoadDescriptions(result,
|
||||
moduleList,
|
||||
new ArrayList<>(platforms.values()));
|
||||
}
|
||||
|
||||
static final class LoadDescriptions {
|
||||
@ -550,6 +551,17 @@ public class CreateSymbols {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String removeVersion(String original, String remove) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (char v : original.toCharArray()) {
|
||||
if (v != remove.charAt(0)) {
|
||||
sb.append(v);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static class PlatformInput {
|
||||
public final String version;
|
||||
public final String basePlatform;
|
||||
@ -1067,10 +1079,23 @@ public class CreateSymbols {
|
||||
}
|
||||
|
||||
private Annotation createAnnotation(List<CPInfo> constantPool, AnnotationDescription desc) {
|
||||
String annotationType = desc.annotationType;
|
||||
|
||||
if (PREVIEW_FEATURE_ANNOTATION.equals(annotationType)) {
|
||||
//the non-public PreviewFeature annotation will not be available in ct.sym,
|
||||
//replace with purely synthetic javac-internal annotation:
|
||||
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
|
||||
}
|
||||
|
||||
return new Annotation(null,
|
||||
addString(constantPool, desc.annotationType),
|
||||
addString(constantPool, annotationType),
|
||||
createElementPairs(constantPool, desc.values));
|
||||
}
|
||||
//where:
|
||||
private static final String PREVIEW_FEATURE_ANNOTATION =
|
||||
"Ljdk/internal/PreviewFeature;";
|
||||
private static final String PREVIEW_FEATURE_ANNOTATION_INTERNAL =
|
||||
"Ljdk/internal/PreviewFeature+Annotation;";
|
||||
|
||||
private element_value_pair[] createElementPairs(List<CPInfo> constantPool, Map<String, Object> annotationAttributes) {
|
||||
element_value_pair[] pairs = new element_value_pair[annotationAttributes.size()];
|
||||
@ -1258,24 +1283,9 @@ public class CreateSymbols {
|
||||
Map<String, ModuleDescription> modules = new HashMap<>();
|
||||
|
||||
for (VersionDescription desc : versions) {
|
||||
List<byte[]> classFileData = new ArrayList<>();
|
||||
Iterable<byte[]> classFileData = loadClassData(desc.classes);
|
||||
|
||||
try (BufferedReader descIn =
|
||||
Files.newBufferedReader(Paths.get(desc.classes))) {
|
||||
String line;
|
||||
while ((line = descIn.readLine()) != null) {
|
||||
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < line.length(); i += 2) {
|
||||
String hex = line.substring(i, i + 2);
|
||||
data.write(Integer.parseInt(hex, 16));
|
||||
}
|
||||
classFileData.add(data.toByteArray());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
|
||||
loadVersionClasses(classes, modules, classFileData, excludesIncludes, desc.version);
|
||||
loadVersionClasses(classes, modules, classFileData, excludesIncludes, desc.version, null);
|
||||
}
|
||||
|
||||
List<PlatformInput> platforms =
|
||||
@ -1286,7 +1296,7 @@ public class CreateSymbols {
|
||||
null))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dumpDescriptions(classes, modules, platforms, descDest.resolve("symbols"), args);
|
||||
dumpDescriptions(classes, modules, platforms, Set.of(), descDest.resolve("symbols"), args);
|
||||
}
|
||||
//where:
|
||||
private static final String DO_NO_MODIFY =
|
||||
@ -1319,11 +1329,33 @@ public class CreateSymbols {
|
||||
"# ##########################################################\n" +
|
||||
"#\n";
|
||||
|
||||
private Iterable<byte[]> loadClassData(String path) {
|
||||
List<byte[]> classFileData = new ArrayList<>();
|
||||
|
||||
try (BufferedReader descIn =
|
||||
Files.newBufferedReader(Paths.get(path))) {
|
||||
String line;
|
||||
while ((line = descIn.readLine()) != null) {
|
||||
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < line.length(); i += 2) {
|
||||
String hex = line.substring(i, i + 2);
|
||||
data.write(Integer.parseInt(hex, 16));
|
||||
}
|
||||
classFileData.add(data.toByteArray());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
|
||||
return classFileData;
|
||||
}
|
||||
|
||||
private void loadVersionClasses(ClassList classes,
|
||||
Map<String, ModuleDescription> modules,
|
||||
Iterable<byte[]> classData,
|
||||
ExcludeIncludeList excludesIncludes,
|
||||
String version) {
|
||||
String version,
|
||||
String baseline) {
|
||||
Map<String, ModuleDescription> currentVersionModules =
|
||||
new HashMap<>();
|
||||
|
||||
@ -1447,12 +1479,12 @@ public class CreateSymbols {
|
||||
ClassDescription existing = classes.find(clazz.name, true);
|
||||
|
||||
if (existing != null) {
|
||||
addClassHeader(existing, header, version);
|
||||
addClassHeader(existing, header, version, baseline);
|
||||
for (MethodDescription currentMethod : clazz.methods) {
|
||||
addMethod(existing, currentMethod, version);
|
||||
addMethod(existing, currentMethod, version, baseline);
|
||||
}
|
||||
for (FieldDescription currentField : clazz.fields) {
|
||||
addField(existing, currentField, version);
|
||||
addField(existing, currentField, version, baseline);
|
||||
}
|
||||
} else {
|
||||
classes.add(clazz);
|
||||
@ -1489,6 +1521,7 @@ public class CreateSymbols {
|
||||
private void dumpDescriptions(ClassList classes,
|
||||
Map<String, ModuleDescription> modules,
|
||||
List<PlatformInput> versions,
|
||||
Set<String> forceWriteVersions,
|
||||
Path ctDescriptionFile,
|
||||
String[] args) throws IOException {
|
||||
classes.sort();
|
||||
@ -1555,7 +1588,7 @@ public class CreateSymbols {
|
||||
for (PlatformInput desc : versions) {
|
||||
List<String> files = desc.files;
|
||||
|
||||
if (files == null) {
|
||||
if (files == null || forceWriteVersions.contains(desc.version)) {
|
||||
files = new ArrayList<>();
|
||||
for (Entry<String, List<ClassDescription>> e : module2Classes.entrySet()) {
|
||||
StringWriter data = new StringWriter();
|
||||
@ -1573,9 +1606,34 @@ public class CreateSymbols {
|
||||
String dataString = data.toString();
|
||||
|
||||
if (!dataString.isEmpty()) {
|
||||
try (Writer out = Files.newBufferedWriter(f)) {
|
||||
out.append(DO_NO_MODIFY.replace("{YEAR}", String.valueOf(year)));
|
||||
out.write(dataString);
|
||||
String existingYear = null;
|
||||
boolean hasChange = true;
|
||||
if (Files.isReadable(f)) {
|
||||
String oldContent = Files.readString(f, StandardCharsets.UTF_8);
|
||||
int yearPos = DO_NO_MODIFY.indexOf("{YEAR}");
|
||||
String headerPattern =
|
||||
Pattern.quote(DO_NO_MODIFY.substring(0, yearPos)) +
|
||||
"([0-9]+)(, [0-9]+)?" +
|
||||
Pattern.quote(DO_NO_MODIFY.substring(yearPos + "{YEAR}".length()));
|
||||
String pattern = headerPattern +
|
||||
Pattern.quote(dataString);
|
||||
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(oldContent);
|
||||
if (m.matches()) {
|
||||
hasChange = false;
|
||||
} else {
|
||||
m = Pattern.compile(headerPattern).matcher(oldContent);
|
||||
if (m.find()) {
|
||||
existingYear = m.group(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasChange) {
|
||||
try (Writer out = Files.newBufferedWriter(f, StandardCharsets.UTF_8)) {
|
||||
String currentYear = String.valueOf(year);
|
||||
String yearSpec = (existingYear != null && !currentYear.equals(existingYear) ? existingYear + ", " : "") + currentYear;
|
||||
out.append(DO_NO_MODIFY.replace("{YEAR}", yearSpec));
|
||||
out.write(dataString);
|
||||
}
|
||||
}
|
||||
files.add(f.getFileName().toString());
|
||||
}
|
||||
@ -1617,15 +1675,17 @@ public class CreateSymbols {
|
||||
}
|
||||
}
|
||||
|
||||
public void createIncrementalBaseLine(String ctDescriptionFile,
|
||||
String excludeFile,
|
||||
String[] args) throws IOException {
|
||||
String specVersion = System.getProperty("java.specification.version");
|
||||
private void incrementalUpdate(String ctDescriptionFile,
|
||||
String excludeFile,
|
||||
String platformVersion,
|
||||
Iterable<byte[]> classBytes,
|
||||
Function<LoadDescriptions, String> baseline,
|
||||
String[] args) throws IOException {
|
||||
String currentVersion =
|
||||
Integer.toString(Integer.parseInt(specVersion), Character.MAX_RADIX);
|
||||
currentVersion = currentVersion.toUpperCase(Locale.ROOT);
|
||||
Integer.toString(Integer.parseInt(platformVersion), Character.MAX_RADIX);
|
||||
String version = currentVersion.toUpperCase(Locale.ROOT);
|
||||
Path ctDescriptionPath = Paths.get(ctDescriptionFile).toAbsolutePath();
|
||||
LoadDescriptions data = load(null, ctDescriptionPath, currentVersion);
|
||||
LoadDescriptions data = load(null, ctDescriptionPath);
|
||||
|
||||
ClassList classes = data.classes;
|
||||
Map<String, ModuleDescription> modules = data.modules;
|
||||
@ -1634,23 +1694,70 @@ public class CreateSymbols {
|
||||
ExcludeIncludeList excludeList =
|
||||
ExcludeIncludeList.create(excludeFile);
|
||||
|
||||
Iterable<byte[]> classBytes = dumpCurrentClasses();
|
||||
loadVersionClasses(classes, modules, classBytes, excludeList, currentVersion);
|
||||
loadVersionClasses(classes, modules, classBytes, excludeList, "$", version);
|
||||
|
||||
String baseline;
|
||||
removeVersion(data, version);
|
||||
|
||||
if (versions.isEmpty()) {
|
||||
baseline = null;
|
||||
} else {
|
||||
baseline = versions.stream()
|
||||
.sorted((v1, v2) -> v2.version.compareTo(v1.version))
|
||||
.findFirst()
|
||||
.get()
|
||||
.version;
|
||||
for (ModuleDescription md : data.modules.values()) {
|
||||
for (ModuleHeaderDescription header : md.header) {
|
||||
header.versions = header.versions.replace("$", version);
|
||||
}
|
||||
}
|
||||
|
||||
versions.add(new PlatformInput(null, currentVersion, baseline, null));
|
||||
dumpDescriptions(classes, modules, versions, ctDescriptionPath, args);
|
||||
for (ClassDescription clazzDesc : data.classes) {
|
||||
for (ClassHeaderDescription header : clazzDesc.header) {
|
||||
header.versions = header.versions.replace("$", version);
|
||||
}
|
||||
for (MethodDescription method : clazzDesc.methods) {
|
||||
method.versions = method.versions.replace("$", version);
|
||||
}
|
||||
for (FieldDescription field : clazzDesc.fields) {
|
||||
field.versions = field.versions.replace("$", version);
|
||||
}
|
||||
}
|
||||
|
||||
if (versions.stream().noneMatch(inp -> version.equals(inp.version))) {
|
||||
versions.add(new PlatformInput(null, version, baseline.apply(data), null));
|
||||
}
|
||||
|
||||
Set<String> writeVersions = new HashSet<>();
|
||||
|
||||
writeVersions.add(version);
|
||||
|
||||
//re-write all platforms that have version as their basline:
|
||||
versions.stream()
|
||||
.filter(inp -> version.equals(inp.basePlatform))
|
||||
.map(inp -> inp.version)
|
||||
.forEach(writeVersions::add);
|
||||
dumpDescriptions(classes, modules, versions, writeVersions, ctDescriptionPath, args);
|
||||
}
|
||||
|
||||
public void createIncrementalBaseLineFromDataFile(String ctDescriptionFile,
|
||||
String excludeFile,
|
||||
String version,
|
||||
String dataFile,
|
||||
String baseline,
|
||||
String[] args) throws IOException {
|
||||
incrementalUpdate(ctDescriptionFile, excludeFile, version, loadClassData(dataFile), x -> baseline, args);
|
||||
}
|
||||
|
||||
public void createIncrementalBaseLine(String ctDescriptionFile,
|
||||
String excludeFile,
|
||||
String[] args) throws IOException {
|
||||
String specVersion = System.getProperty("java.specification.version");
|
||||
Iterable<byte[]> classBytes = dumpCurrentClasses();
|
||||
Function<LoadDescriptions, String> baseline = data -> {
|
||||
if (data.versions.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return data.versions.stream()
|
||||
.sorted((v1, v2) -> v2.version.compareTo(v1.version))
|
||||
.findFirst()
|
||||
.get()
|
||||
.version;
|
||||
}
|
||||
};
|
||||
incrementalUpdate(ctDescriptionFile, excludeFile, specVersion, classBytes, baseline, args);
|
||||
}
|
||||
|
||||
private List<byte[]> dumpCurrentClasses() throws IOException {
|
||||
@ -1744,7 +1851,7 @@ public class CreateSymbols {
|
||||
classes.add(clazzDesc);
|
||||
}
|
||||
|
||||
addClassHeader(clazzDesc, headerDesc, version);
|
||||
addClassHeader(clazzDesc, headerDesc, version, null);
|
||||
|
||||
for (Method m : cf.methods) {
|
||||
if (!include(m.access_flags.flags))
|
||||
@ -1756,7 +1863,7 @@ public class CreateSymbols {
|
||||
for (Attribute attr : m.attributes) {
|
||||
readAttribute(cf, methDesc, attr);
|
||||
}
|
||||
addMethod(clazzDesc, methDesc, version);
|
||||
addMethod(clazzDesc, methDesc, version, null);
|
||||
}
|
||||
for (Field f : cf.fields) {
|
||||
if (!include(f.access_flags.flags))
|
||||
@ -1768,7 +1875,7 @@ public class CreateSymbols {
|
||||
for (Attribute attr : f.attributes) {
|
||||
readAttribute(cf, fieldDesc, attr);
|
||||
}
|
||||
addField(clazzDesc, fieldDesc, version);
|
||||
addField(clazzDesc, fieldDesc, version, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1827,11 +1934,11 @@ public class CreateSymbols {
|
||||
return (accessFlags & (AccessFlags.ACC_PUBLIC | AccessFlags.ACC_PROTECTED)) != 0;
|
||||
}
|
||||
|
||||
private void addClassHeader(ClassDescription clazzDesc, ClassHeaderDescription headerDesc, String version) {
|
||||
private void addClassHeader(ClassDescription clazzDesc, ClassHeaderDescription headerDesc, String version, String baseline) {
|
||||
//normalize:
|
||||
boolean existed = false;
|
||||
for (ClassHeaderDescription existing : clazzDesc.header) {
|
||||
if (existing.equals(headerDesc)) {
|
||||
if (existing.equals(headerDesc) && (!existed || (baseline != null && existing.versions.contains(baseline)))) {
|
||||
headerDesc = existing;
|
||||
existed = true;
|
||||
}
|
||||
@ -1867,14 +1974,13 @@ public class CreateSymbols {
|
||||
}
|
||||
}
|
||||
|
||||
private void addMethod(ClassDescription clazzDesc, MethodDescription methDesc, String version) {
|
||||
private void addMethod(ClassDescription clazzDesc, MethodDescription methDesc, String version, String baseline) {
|
||||
//normalize:
|
||||
boolean methodExisted = false;
|
||||
for (MethodDescription existing : clazzDesc.methods) {
|
||||
if (existing.equals(methDesc)) {
|
||||
if (existing.equals(methDesc) && (!methodExisted || (baseline != null && existing.versions.contains(baseline)))) {
|
||||
methodExisted = true;
|
||||
methDesc = existing;
|
||||
break;
|
||||
}
|
||||
}
|
||||
methDesc.versions += version;
|
||||
@ -1883,13 +1989,12 @@ public class CreateSymbols {
|
||||
}
|
||||
}
|
||||
|
||||
private void addField(ClassDescription clazzDesc, FieldDescription fieldDesc, String version) {
|
||||
private void addField(ClassDescription clazzDesc, FieldDescription fieldDesc, String version, String baseline) {
|
||||
boolean fieldExisted = false;
|
||||
for (FieldDescription existing : clazzDesc.fields) {
|
||||
if (existing.equals(fieldDesc)) {
|
||||
if (existing.equals(fieldDesc) && (!fieldExisted || (baseline != null && existing.versions.contains(baseline)))) {
|
||||
fieldExisted = true;
|
||||
fieldDesc = existing;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fieldDesc.versions += version;
|
||||
@ -2298,6 +2403,7 @@ public class CreateSymbols {
|
||||
}
|
||||
|
||||
static abstract class FeatureDescription {
|
||||
int flagsNormalization = ~0;
|
||||
int flags;
|
||||
boolean deprecated;
|
||||
String signature;
|
||||
@ -2362,7 +2468,7 @@ public class CreateSymbols {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + this.flags;
|
||||
hash = 89 * hash + (this.flags & flagsNormalization);
|
||||
hash = 89 * hash + (this.deprecated ? 1 : 0);
|
||||
hash = 89 * hash + Objects.hashCode(this.signature);
|
||||
hash = 89 * hash + listHashCode(this.classAnnotations);
|
||||
@ -2379,7 +2485,7 @@ public class CreateSymbols {
|
||||
return false;
|
||||
}
|
||||
final FeatureDescription other = (FeatureDescription) obj;
|
||||
if (this.flags != other.flags) {
|
||||
if ((this.flags & flagsNormalization) != (other.flags & flagsNormalization)) {
|
||||
return false;
|
||||
}
|
||||
if (this.deprecated != other.deprecated) {
|
||||
@ -3031,6 +3137,7 @@ public class CreateSymbols {
|
||||
}
|
||||
|
||||
static class MethodDescription extends FeatureDescription {
|
||||
static int METHODS_FLAGS_NORMALIZATION = ~0;
|
||||
String name;
|
||||
String descriptor;
|
||||
List<String> thrownTypes;
|
||||
@ -3038,6 +3145,10 @@ public class CreateSymbols {
|
||||
List<List<AnnotationDescription>> classParameterAnnotations;
|
||||
List<List<AnnotationDescription>> runtimeParameterAnnotations;
|
||||
|
||||
public MethodDescription() {
|
||||
flagsNormalization = METHODS_FLAGS_NORMALIZATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
@ -3762,6 +3873,24 @@ public class CreateSymbols {
|
||||
args);
|
||||
break;
|
||||
}
|
||||
case "build-description-incremental-file": {
|
||||
if (args.length != 6 && args.length != 7) {
|
||||
help();
|
||||
return ;
|
||||
}
|
||||
|
||||
if (args.length == 7) {
|
||||
if ("--normalize-method-flags".equals(args[6])) {
|
||||
MethodDescription.METHODS_FLAGS_NORMALIZATION = ~(0x100 | 0x20);
|
||||
} else {
|
||||
help();
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
new CreateSymbols().createIncrementalBaseLineFromDataFile(args[1], args[2], args[3], args[4], "<none>".equals(args[5]) ? null : args[5], args);
|
||||
break;
|
||||
}
|
||||
case "build-description-incremental": {
|
||||
if (args.length != 3) {
|
||||
help();
|
||||
|
@ -30,14 +30,13 @@ $(eval $(call IncludeCustomExtension, modules/java.base/Launcher.gmk))
|
||||
|
||||
JAVA_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/launcher/java.rc
|
||||
|
||||
JAVA_RC_FLAGS += -I$(TOPDIR)/src/java.base/windows/native/common
|
||||
JAVA_RC_FLAGS += -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
|
||||
JAVA_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
|
||||
|
||||
################################################################################
|
||||
|
||||
$(eval $(call SetupBuildLauncher, java, \
|
||||
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
|
||||
EXTRA_RC_FLAGS := $(JAVA_RC_FLAGS), \
|
||||
EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \
|
||||
VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
|
||||
OPTIMIZATION := HIGH, \
|
||||
))
|
||||
@ -45,7 +44,7 @@ $(eval $(call SetupBuildLauncher, java, \
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
$(eval $(call SetupBuildLauncher, javaw, \
|
||||
CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
|
||||
EXTRA_RC_FLAGS := $(JAVA_RC_FLAGS), \
|
||||
EXTRA_RCFLAGS := $(JAVA_RCFLAGS), \
|
||||
VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
|
||||
))
|
||||
endif
|
||||
|
@ -116,7 +116,7 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
LIBAWT_CFLAGS += -DMLIB_OS64BIT
|
||||
endif
|
||||
|
||||
LIBAWT_RC_FLAGS ?= -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
|
||||
LIBAWT_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons
|
||||
LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc
|
||||
endif
|
||||
|
||||
@ -169,10 +169,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
|
||||
comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
|
||||
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
|
||||
RC_FLAGS := $(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
|
||||
-D "JDK_FNAME=awt.dll" \
|
||||
-D "JDK_INTERNAL_NAME=awt" \
|
||||
-D "JDK_FTYPE=0x2L", \
|
||||
EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \
|
||||
))
|
||||
|
||||
$(BUILD_LIBAWT): $(call FindLib, java.base, java)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 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
|
||||
@ -25,17 +25,20 @@
|
||||
|
||||
include LauncherCommon.gmk
|
||||
|
||||
################################################################################
|
||||
# jabswitch
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
JABSWITCH_SRC := $(TOPDIR)/src/jdk.accessibility/windows/native/jabswitch
|
||||
ACCESSBRIDGE_SRC := $(TOPDIR)/src/jdk.accessibility/windows/native/common
|
||||
ACCESSIBILITY_SRCDIR := $(TOPDIR)/src/jdk.accessibility/windows/native
|
||||
TOOLS_CFLAGS := $(addprefix -I, \
|
||||
$(ACCESSIBILITY_SRCDIR)/include/bridge \
|
||||
$(ACCESSIBILITY_SRCDIR)/common \
|
||||
$(ACCESSIBILITY_SRCDIR)/toolscommon)
|
||||
|
||||
##############################################################################
|
||||
# jabswitch
|
||||
|
||||
$(eval $(call SetupJdkExecutable, BUILD_JABSWITCH, \
|
||||
NAME := jabswitch, \
|
||||
SRC := $(JABSWITCH_SRC), \
|
||||
SRC := $(ACCESSIBILITY_SRCDIR)/jabswitch, \
|
||||
INCLUDE_FILES := jabswitch.cpp, \
|
||||
CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
|
||||
-analyze- -Od -Gd -D_WINDOWS \
|
||||
@ -43,21 +46,15 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
DISABLED_WARNINGS_microsoft := 4267 4996, \
|
||||
LDFLAGS := $(LDFLAGS_JDKEXE), \
|
||||
LIBS := advapi32.lib version.lib user32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.rc, \
|
||||
MANIFEST := $(JABSWITCH_SRC)/jabswitch.manifest, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
MANIFEST := $(ACCESSIBILITY_SRCDIR)/jabswitch/jabswitch.manifest, \
|
||||
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_JABSWITCH)
|
||||
|
||||
################################################################################
|
||||
# jaccessinspector
|
||||
|
||||
TOPDIR := $(TOPDIR)/src/jdk.accessibility/windows/native
|
||||
TOOLS_CFLAGS := $(addprefix -I, \
|
||||
$(TOPDIR)/include/bridge \
|
||||
$(TOPDIR)/common \
|
||||
$(TOPDIR)/toolscommon)
|
||||
##############################################################################
|
||||
# jaccessinspector
|
||||
|
||||
define SetupInspector
|
||||
# Parameter 1 File name suffix
|
||||
@ -65,20 +62,20 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
$$(eval $$(call SetupJdkExecutable, BUILD_JACCESSINSPECTOR$1, \
|
||||
NAME := jaccessinspector$1, \
|
||||
SRC := $(TOPDIR)/jaccessinspector $(TOPDIR)/common \
|
||||
$(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
|
||||
SRC := $(ACCESSIBILITY_SRCDIR)/jaccessinspector $(ACCESSIBILITY_SRCDIR)/common \
|
||||
$(ACCESSIBILITY_SRCDIR)/toolscommon $(ACCESSIBILITY_SRCDIR)/bridge, \
|
||||
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
|
||||
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
|
||||
LIBS := advapi32.lib user32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
|
||||
))
|
||||
|
||||
TARGETS += $$(BUILD_JACCESSINSPECTOR$1)
|
||||
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# jaccesswalker
|
||||
##############################################################################
|
||||
# jaccesswalker
|
||||
|
||||
define SetupWalker
|
||||
# Parameter 1 File name suffix
|
||||
@ -86,12 +83,12 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
$$(eval $$(call SetupJdkExecutable, BUILD_JACCESSWALKER$1, \
|
||||
NAME := jaccesswalker$1, \
|
||||
SRC := $(TOPDIR)/jaccesswalker $(TOPDIR)/common \
|
||||
$(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
|
||||
SRC := $(ACCESSIBILITY_SRCDIR)/jaccesswalker $(ACCESSIBILITY_SRCDIR)/common \
|
||||
$(ACCESSIBILITY_SRCDIR)/toolscommon $(ACCESSIBILITY_SRCDIR)/bridge, \
|
||||
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
|
||||
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
|
||||
LIBS := advapi32.lib comctl32.lib gdi32.lib user32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
|
||||
))
|
||||
|
||||
TARGETS += $$(BUILD_JACCESSWALKER$1)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 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,7 +29,7 @@ include LibCommon.gmk
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
ROOT_SRCDIR := $(TOPDIR)/src/jdk.accessibility/windows/native
|
||||
ACCESSIBILITY_SRCDIR := $(TOPDIR)/src/jdk.accessibility/windows/native
|
||||
|
||||
define SetupJavaDLL
|
||||
# Parameter 1 Suffix
|
||||
@ -52,7 +52,7 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
winspool.lib comdlg32.lib advapi32.lib shell32.lib \
|
||||
$(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib \
|
||||
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
)
|
||||
|
||||
$$(BUILD_JAVAACCESSBRIDGE$1): $(call FindStaticLib, java.desktop, jawt, /libjawt)
|
||||
@ -75,11 +75,11 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
include/bridge \
|
||||
java.base:include, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
-def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
|
||||
-def:$(ACCESSIBILITY_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
|
||||
LIBS := kernel32.lib user32.lib gdi32.lib \
|
||||
winspool.lib comdlg32.lib advapi32.lib shell32.lib \
|
||||
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib, \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
)
|
||||
|
||||
TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
|
||||
@ -93,7 +93,7 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB), \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB), \
|
||||
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
VERSIONINFO_RESOURCE := $(ACCESSIBILITY_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
|
||||
)
|
||||
|
||||
TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, 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
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
void report_error(char const * msg)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
LPTSTR lpMsgBuf;
|
||||
DWORD dw = GetLastError();
|
||||
|
||||
FormatMessage(
|
||||
|
@ -90,10 +90,11 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SMALL_JAVA := false, \
|
||||
CLASSPATH := $(MICROBENCHMARK_CLASSPATH), \
|
||||
DISABLED_WARNINGS := processing rawtypes cast serial, \
|
||||
DISABLED_WARNINGS := processing rawtypes cast serial preview, \
|
||||
SRC := $(MICROBENCHMARK_SRC), \
|
||||
BIN := $(MICROBENCHMARK_CLASSES), \
|
||||
JAVA_FLAGS := --add-modules jdk.unsupported --limit-modules java.management, \
|
||||
JAVAC_FLAGS := --enable-preview, \
|
||||
))
|
||||
|
||||
$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
|
||||
|
@ -43,12 +43,14 @@ $(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \
|
||||
|
||||
TARGETS += $(BUILD_WB_JAR)
|
||||
|
||||
# test-lib.jar will contain only hprof classes until JDK-8081381 is resolved
|
||||
$(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $(TEST_LIB_SOURCE_DIR)/jdk/test/lib/hprof, \
|
||||
SRC := $(TEST_LIB_SOURCE_DIR), \
|
||||
EXCLUDES := jdk/test/lib/containers jdk/test/lib/security, \
|
||||
BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \
|
||||
HEADERS := $(TEST_LIB_SUPPORT)/test-lib_headers, \
|
||||
JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \
|
||||
DISABLED_WARNINGS := try deprecation rawtypes unchecked serial cast, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_TEST_LIB_JAR)
|
||||
|
83
make/test/BuildTestLibNative.gmk
Normal file
83
make/test/BuildTestLibNative.gmk
Normal file
@ -0,0 +1,83 @@
|
||||
#
|
||||
# Copyright (c) 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# This file builds the native component of testlib.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the native tests themselves.
|
||||
################################################################################
|
||||
|
||||
BUILD_LIBTEST_NATIVE_SRC := $(TOPDIR)/test/lib
|
||||
|
||||
BUILD_LIBTEST_OUTPUT_DIR := $(OUTPUTDIR)/support/test/lib/native
|
||||
|
||||
BUILD_LIBTEST_IMAGE_DIR := $(TEST_IMAGE_DIR)/lib
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-lib-native, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(BUILD_LIBTEST_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
))
|
||||
endif
|
||||
|
||||
build-test-lib-native: $(BUILD_LIBTEST_LIBRARIES)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to testlib test image. We need it in both hotspot and jdk.
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_NATIVE_TO_HOTSPOT, \
|
||||
SRC := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_OUTPUT_DIR), /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_NATIVE_TO_JDK, \
|
||||
SRC := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/jdk/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_OUTPUT_DIR), /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
test-image-lib-native: $(COPY_LIBTEST_NATIVE_TO_HOTSPOT) $(COPY_LIBTEST_NATIVE_TO_JDK)
|
||||
|
||||
all: build-test-lib-native
|
||||
|
||||
.PHONY: default all build-test-lib-native test-image-lib-native
|
@ -105,6 +105,7 @@ ifeq ($(INCLUDE_GRAAL), true)
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.options.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk10.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk12.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.jdk9.test/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
|
||||
|
@ -13845,7 +13845,7 @@ instruct MoveL2D_reg_reg(vRegD dst, iRegL src) %{
|
||||
instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr)
|
||||
%{
|
||||
match(Set dummy (ClearArray cnt base));
|
||||
effect(USE_KILL cnt, USE_KILL base);
|
||||
effect(USE_KILL cnt, USE_KILL base, KILL cr);
|
||||
|
||||
ins_cost(4 * INSN_COST);
|
||||
format %{ "ClearArray $cnt, $base" %}
|
||||
|
@ -749,7 +749,7 @@ extern "C" void npf() {
|
||||
extern "C" void pf(unsigned long sp, unsigned long fp, unsigned long pc,
|
||||
unsigned long bcx, unsigned long thread) {
|
||||
if (!reg_map) {
|
||||
reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtNone);
|
||||
reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtInternal);
|
||||
::new (reg_map) RegisterMap((JavaThread*)thread, false);
|
||||
} else {
|
||||
*reg_map = RegisterMap((JavaThread*)thread, false);
|
||||
|
@ -21,7 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jvmci/jvmciCodeInstaller.hpp"
|
||||
#include "jvmci/jvmci.hpp"
|
||||
#include "jvmci/jvmciCodeInstaller.hpp"
|
||||
#include "jvmci/jvmciRuntime.hpp"
|
||||
#include "jvmci/jvmciCompilerToVM.hpp"
|
||||
#include "jvmci/jvmciJavaClasses.hpp"
|
||||
@ -72,12 +73,12 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, JVMCIObject consta
|
||||
if (jvmci_env()->get_HotSpotMetaspaceConstantImpl_compressed(constant)) {
|
||||
narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, JVMCI_CHECK);
|
||||
MacroAssembler::patch_narrow_klass(pc, narrowOop);
|
||||
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
|
||||
JVMCI_event_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
|
||||
} else {
|
||||
NativeMovConstReg* move = nativeMovConstReg_at(pc);
|
||||
void* reference = record_metadata_reference(_instructions, pc, constant, JVMCI_CHECK);
|
||||
move->set_data((intptr_t) reference);
|
||||
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
|
||||
JVMCI_event_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +89,7 @@ void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset
|
||||
|| (NativeInstruction::maybe_cpool_ref(pc))) {
|
||||
address dest = _constants->start() + data_offset;
|
||||
_instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS));
|
||||
TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
|
||||
JVMCI_event_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
|
||||
} else {
|
||||
JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc));
|
||||
}
|
||||
@ -115,7 +116,7 @@ void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong forei
|
||||
} else {
|
||||
JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc));
|
||||
}
|
||||
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
|
||||
JVMCI_event_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
|
||||
}
|
||||
|
||||
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, JVMCIObject hotspot_method, jint pc_offset, JVMCI_TRAPS) {
|
||||
|
@ -2133,20 +2133,34 @@ int MacroAssembler::push_fp(unsigned int bitset, Register stack) {
|
||||
regs[count++] = reg;
|
||||
bitset >>= 1;
|
||||
}
|
||||
regs[count++] = zr->encoding_nocheck();
|
||||
count &= ~1; // Only push an even number of regs
|
||||
|
||||
if (count == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count == 1) {
|
||||
strq(as_FloatRegister(regs[0]), Address(pre(stack, -wordSize * 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool odd = (count & 1) == 1;
|
||||
int push_slots = count + (odd ? 1 : 0);
|
||||
|
||||
// Always pushing full 128 bit registers.
|
||||
if (count) {
|
||||
stpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(pre(stack, -count * wordSize * 2)));
|
||||
words_pushed += 2;
|
||||
}
|
||||
for (int i = 2; i < count; i += 2) {
|
||||
stpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(pre(stack, -push_slots * wordSize * 2)));
|
||||
words_pushed += 2;
|
||||
|
||||
for (int i = 2; i + 1 < count; i += 2) {
|
||||
stpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
|
||||
words_pushed += 2;
|
||||
}
|
||||
|
||||
assert(words_pushed == count, "oops, pushed != count");
|
||||
if (odd) {
|
||||
strq(as_FloatRegister(regs[count - 1]), Address(stack, (count - 1) * wordSize * 2));
|
||||
words_pushed++;
|
||||
}
|
||||
|
||||
assert(words_pushed == count, "oops, pushed(%d) != count(%d)", words_pushed, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -2161,19 +2175,33 @@ int MacroAssembler::pop_fp(unsigned int bitset, Register stack) {
|
||||
regs[count++] = reg;
|
||||
bitset >>= 1;
|
||||
}
|
||||
regs[count++] = zr->encoding_nocheck();
|
||||
count &= ~1;
|
||||
|
||||
for (int i = 2; i < count; i += 2) {
|
||||
if (count == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count == 1) {
|
||||
ldrq(as_FloatRegister(regs[0]), Address(post(stack, wordSize * 2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool odd = (count & 1) == 1;
|
||||
int push_slots = count + (odd ? 1 : 0);
|
||||
|
||||
if (odd) {
|
||||
ldrq(as_FloatRegister(regs[count - 1]), Address(stack, (count - 1) * wordSize * 2));
|
||||
words_pushed++;
|
||||
}
|
||||
|
||||
for (int i = 2; i + 1 < count; i += 2) {
|
||||
ldpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
|
||||
words_pushed += 2;
|
||||
}
|
||||
if (count) {
|
||||
ldpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(post(stack, count * wordSize * 2)));
|
||||
words_pushed += 2;
|
||||
}
|
||||
|
||||
assert(words_pushed == count, "oops, pushed != count");
|
||||
ldpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(post(stack, push_slots * wordSize * 2)));
|
||||
words_pushed += 2;
|
||||
|
||||
assert(words_pushed == count, "oops, pushed(%d) != count(%d)", words_pushed, count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2108, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -102,9 +102,6 @@ class NativeInstruction {
|
||||
|
||||
public:
|
||||
|
||||
// unit test stuff
|
||||
static void test() {} // override for testing
|
||||
|
||||
inline friend NativeInstruction* nativeInstruction_at(address address);
|
||||
|
||||
static bool is_adrp_at(address instr);
|
||||
@ -321,9 +318,6 @@ class NativeMovConstReg: public NativeInstruction {
|
||||
void verify();
|
||||
void print();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
|
||||
// Creation
|
||||
inline friend NativeMovConstReg* nativeMovConstReg_at(address address);
|
||||
inline friend NativeMovConstReg* nativeMovConstReg_before(address address);
|
||||
@ -397,9 +391,6 @@ class NativeMovRegMem: public NativeInstruction {
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
|
||||
private:
|
||||
inline friend NativeMovRegMem* nativeMovRegMem_at (address address);
|
||||
};
|
||||
@ -432,8 +423,6 @@ class NativeLoadAddress: public NativeInstruction {
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
};
|
||||
|
||||
// adrp x16, #page
|
||||
@ -488,9 +477,6 @@ class NativeJump: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// Unit testing stuff
|
||||
static void test() {}
|
||||
|
||||
// Insertion of native jump instruction
|
||||
static void insert(address code_pos, address entry);
|
||||
// MT-safe insertion of native jump at verified method entry
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2019, 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
|
||||
@ -145,9 +145,6 @@ class RawNativeInstruction {
|
||||
bool is_movt() const { return (encoding() & 0x0ff00000) == 0x03400000; }
|
||||
// c2 doesn't use fixed registers for safepoint poll address
|
||||
bool is_safepoint_poll() const { return (encoding() & 0xfff0ffff) == 0xe590c000; }
|
||||
// For unit tests
|
||||
static void test() {}
|
||||
|
||||
};
|
||||
|
||||
inline RawNativeInstruction* rawNativeInstruction_at(address address) {
|
||||
|
@ -26,10 +26,6 @@
|
||||
#ifndef CPU_PPC_GLOBALDEFINITIONS_PPC_HPP
|
||||
#define CPU_PPC_GLOBALDEFINITIONS_PPC_HPP
|
||||
|
||||
#ifdef CC_INTERP
|
||||
#error "CC_INTERP is no longer supported. Removed in change 8145117."
|
||||
#endif
|
||||
|
||||
#ifndef FILE_AND_LINE
|
||||
#define FILE_AND_LINE __FILE__ ":" XSTR(__LINE__)
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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
|
||||
@ -30,6 +30,7 @@
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "interp_masm_ppc.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "runtime/safepointMechanism.hpp"
|
||||
|
@ -2296,10 +2296,13 @@ const bool Matcher::match_rule_supported(int opcode) {
|
||||
case Op_FmaVD:
|
||||
return (SuperwordUseVSX && UseFMA);
|
||||
case Op_Digit:
|
||||
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isDigit);
|
||||
case Op_LowerCase:
|
||||
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isLowerCase);
|
||||
case Op_UpperCase:
|
||||
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isUpperCase);
|
||||
case Op_Whitespace:
|
||||
return UseCharacterCompareIntrinsics;
|
||||
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isWhitespace);
|
||||
|
||||
case Op_CacheWB:
|
||||
case Op_CacheWBPreSync:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -33,6 +33,7 @@
|
||||
#include "interpreter/templateTable.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/klass.inline.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
|
@ -26,10 +26,6 @@
|
||||
#ifndef CPU_S390_GLOBALDEFINITIONS_S390_HPP
|
||||
#define CPU_S390_GLOBALDEFINITIONS_S390_HPP
|
||||
|
||||
#ifdef CC_INTERP
|
||||
#error "CC_INTERP is not supported on z/Architecture."
|
||||
#endif
|
||||
|
||||
// Convenience macro that produces a string literal with the filename
|
||||
// and linenumber of the location where the macro was used.
|
||||
#ifndef FILE_AND_LINE
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -34,6 +34,7 @@
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
#include "oops/markWord.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
#include "runtime/basicLock.hpp"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -137,9 +137,6 @@ class NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {} // Override for testing.
|
||||
|
||||
friend NativeInstruction* nativeInstruction_at(address address) {
|
||||
NativeInstruction* inst = (NativeInstruction*)address;
|
||||
#ifdef ASSERT
|
||||
@ -274,9 +271,6 @@ class NativeCall: public NativeInstruction {
|
||||
void verify_alignment() {} // Yet another real do nothing guy :)
|
||||
void verify();
|
||||
|
||||
// unit test stuff
|
||||
static void test();
|
||||
|
||||
// Creation.
|
||||
friend NativeCall* nativeCall_at(address instr) {
|
||||
NativeCall* call;
|
||||
@ -443,9 +437,6 @@ class NativeFarCall: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// Unit tests
|
||||
static void test();
|
||||
|
||||
// Instantiates a NativeFarCall object starting at the given instruction
|
||||
// address and returns the NativeFarCall object.
|
||||
inline friend NativeFarCall* nativeFarCall_at(address instr) {
|
||||
@ -500,9 +491,6 @@ class NativeMovConstReg: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// unit test stuff
|
||||
static void test();
|
||||
|
||||
// Creation.
|
||||
friend NativeMovConstReg* nativeMovConstReg_at(address address) {
|
||||
NativeMovConstReg* test = (NativeMovConstReg*)address;
|
||||
@ -618,9 +606,6 @@ class NativeJump: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// Unit testing stuff
|
||||
static void test();
|
||||
|
||||
// Insertion of native jump instruction.
|
||||
static void insert(address code_pos, address entry);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, SAP SE. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -34,6 +34,7 @@
|
||||
#include "interpreter/templateInterpreterGenerator.hpp"
|
||||
#include "interpreter/templateTable.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
@ -88,8 +89,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
|
||||
//
|
||||
// On entry:
|
||||
// Z_ARG1 - intptr_t* Address of java argument list in memory.
|
||||
// Z_state - cppInterpreter* Address of interpreter state for
|
||||
// this method
|
||||
// Z_state - zeroInterpreter* Address of interpreter state for
|
||||
// this method
|
||||
// Z_method
|
||||
//
|
||||
// On exit (just before return instruction):
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -31,6 +31,7 @@
|
||||
#include "interpreter/interp_masm.hpp"
|
||||
#include "interpreter/templateTable.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "jvmci/jvmci.hpp"
|
||||
#include "jvmci/jvmciEnv.hpp"
|
||||
#include "jvmci/jvmciCodeInstaller.hpp"
|
||||
#include "jvmci/jvmciJavaClasses.hpp"
|
||||
@ -74,7 +75,7 @@ void CodeInstaller::pd_patch_OopConstant(int pc_offset, JVMCIObject constant, JV
|
||||
address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
|
||||
int oop_index = _oop_recorder->find_index(value);
|
||||
_instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand);
|
||||
TRACE_jvmci_3("relocating (narrow oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
JVMCI_event_3("relocating (narrow oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
#else
|
||||
JVMCI_ERROR("compressed oop on 32bit");
|
||||
#endif
|
||||
@ -82,7 +83,7 @@ void CodeInstaller::pd_patch_OopConstant(int pc_offset, JVMCIObject constant, JV
|
||||
address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
|
||||
*((jobject*) operand) = value;
|
||||
_instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
|
||||
TRACE_jvmci_3("relocating (oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
JVMCI_event_3("relocating (oop constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,14 +93,14 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, JVMCIObject consta
|
||||
#ifdef _LP64
|
||||
address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
|
||||
*((narrowKlass*) operand) = record_narrow_metadata_reference(_instructions, operand, constant, JVMCI_CHECK);
|
||||
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
JVMCI_event_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
#else
|
||||
JVMCI_ERROR("compressed Klass* on 32bit");
|
||||
#endif
|
||||
} else {
|
||||
address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
|
||||
*((void**) operand) = record_metadata_reference(_instructions, operand, constant, JVMCI_CHECK);
|
||||
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
JVMCI_event_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +116,7 @@ void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset
|
||||
*((jint*) operand) = (jint) disp;
|
||||
|
||||
_instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand);
|
||||
TRACE_jvmci_3("relocating at " PTR_FORMAT "/" PTR_FORMAT " with destination at " PTR_FORMAT " (%d)", p2i(pc), p2i(operand), p2i(dest), data_offset);
|
||||
JVMCI_event_3("relocating at " PTR_FORMAT "/" PTR_FORMAT " with destination at " PTR_FORMAT " (%d)", p2i(pc), p2i(operand), p2i(dest), data_offset);
|
||||
}
|
||||
|
||||
void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, JVMCI_TRAPS) {
|
||||
@ -143,7 +144,7 @@ void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong forei
|
||||
JVMCI_ERROR("unsupported relocation for foreign call");
|
||||
}
|
||||
|
||||
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
|
||||
JVMCI_event_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
|
||||
}
|
||||
|
||||
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, JVMCIObject hotspot_method, jint pc_offset, JVMCI_TRAPS) {
|
||||
|
@ -94,9 +94,6 @@ class NativeInstruction {
|
||||
|
||||
public:
|
||||
|
||||
// unit test stuff
|
||||
static void test() {} // override for testing
|
||||
|
||||
inline friend NativeInstruction* nativeInstruction_at(address address);
|
||||
};
|
||||
|
||||
@ -277,9 +274,6 @@ class NativeMovConstReg: public NativeInstruction {
|
||||
void verify();
|
||||
void print();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
|
||||
// Creation
|
||||
inline friend NativeMovConstReg* nativeMovConstReg_at(address address);
|
||||
inline friend NativeMovConstReg* nativeMovConstReg_before(address address);
|
||||
@ -393,9 +387,6 @@ class NativeMovRegMem: public NativeInstruction {
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
|
||||
private:
|
||||
int patch_offset() const;
|
||||
inline friend NativeMovRegMem* nativeMovRegMem_at (address address);
|
||||
@ -432,9 +423,6 @@ class NativeLoadAddress: public NativeMovRegMem {
|
||||
void verify();
|
||||
void print ();
|
||||
|
||||
// unit test stuff
|
||||
static void test() {}
|
||||
|
||||
private:
|
||||
friend NativeLoadAddress* nativeLoadAddress_at (address address) {
|
||||
NativeLoadAddress* test = (NativeLoadAddress*)(address - instruction_offset);
|
||||
@ -536,9 +524,6 @@ class NativeJump: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// Unit testing stuff
|
||||
static void test() {}
|
||||
|
||||
// Insertion of native jump instruction
|
||||
static void insert(address code_pos, address entry);
|
||||
// MT-safe insertion of native jump at verified method entry
|
||||
@ -564,9 +549,6 @@ class NativeFarJump: public NativeInstruction {
|
||||
|
||||
void verify();
|
||||
|
||||
// Unit testing stuff
|
||||
static void test() {}
|
||||
|
||||
};
|
||||
|
||||
inline NativeFarJump* nativeFarJump_at(address address) {
|
||||
|
@ -3679,14 +3679,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
|
||||
#ifndef _WINDOWS
|
||||
|
||||
#define ASM_SUBTRACT
|
||||
|
||||
#ifdef ASM_SUBTRACT
|
||||
// Subtract 0:b from carry:a. Return carry.
|
||||
static unsigned long
|
||||
sub(unsigned long a[], unsigned long b[], unsigned long carry, long len) {
|
||||
long i = 0, cnt = len;
|
||||
unsigned long tmp;
|
||||
static julong
|
||||
sub(julong a[], julong b[], julong carry, long len) {
|
||||
long long i = 0, cnt = len;
|
||||
julong tmp;
|
||||
asm volatile("clc; "
|
||||
"0: ; "
|
||||
"mov (%[b], %[i], 8), %[tmp]; "
|
||||
@ -3699,24 +3696,6 @@ sub(unsigned long a[], unsigned long b[], unsigned long carry, long len) {
|
||||
: "memory");
|
||||
return tmp;
|
||||
}
|
||||
#else // ASM_SUBTRACT
|
||||
typedef int __attribute__((mode(TI))) int128;
|
||||
|
||||
// Subtract 0:b from carry:a. Return carry.
|
||||
static unsigned long
|
||||
sub(unsigned long a[], unsigned long b[], unsigned long carry, int len) {
|
||||
int128 tmp = 0;
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
tmp += a[i];
|
||||
tmp -= b[i];
|
||||
a[i] = tmp;
|
||||
tmp >>= 64;
|
||||
assert(-1 <= tmp && tmp <= 0, "invariant");
|
||||
}
|
||||
return tmp + carry;
|
||||
}
|
||||
#endif // ! ASM_SUBTRACT
|
||||
|
||||
// Multiply (unsigned) Long A by Long B, accumulating the double-
|
||||
// length result into the accumulator formed of T0, T1, and T2.
|
||||
@ -3739,17 +3718,59 @@ do { \
|
||||
: "r"(A), "a"(B) : "cc"); \
|
||||
} while(0)
|
||||
|
||||
#else //_WINDOWS
|
||||
|
||||
static julong
|
||||
sub(julong a[], julong b[], julong carry, long len) {
|
||||
long i;
|
||||
julong tmp;
|
||||
unsigned char c = 1;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = _addcarry_u64(c, a[i], ~b[i], &tmp);
|
||||
a[i] = tmp;
|
||||
}
|
||||
c = _addcarry_u64(c, carry, ~0, &tmp);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// Multiply (unsigned) Long A by Long B, accumulating the double-
|
||||
// length result into the accumulator formed of T0, T1, and T2.
|
||||
#define MACC(A, B, T0, T1, T2) \
|
||||
do { \
|
||||
julong hi, lo; \
|
||||
lo = _umul128(A, B, &hi); \
|
||||
unsigned char c = _addcarry_u64(0, lo, T0, &T0); \
|
||||
c = _addcarry_u64(c, hi, T1, &T1); \
|
||||
_addcarry_u64(c, T2, 0, &T2); \
|
||||
} while(0)
|
||||
|
||||
// As above, but add twice the double-length result into the
|
||||
// accumulator.
|
||||
#define MACC2(A, B, T0, T1, T2) \
|
||||
do { \
|
||||
julong hi, lo; \
|
||||
lo = _umul128(A, B, &hi); \
|
||||
unsigned char c = _addcarry_u64(0, lo, T0, &T0); \
|
||||
c = _addcarry_u64(c, hi, T1, &T1); \
|
||||
_addcarry_u64(c, T2, 0, &T2); \
|
||||
c = _addcarry_u64(0, lo, T0, &T0); \
|
||||
c = _addcarry_u64(c, hi, T1, &T1); \
|
||||
_addcarry_u64(c, T2, 0, &T2); \
|
||||
} while(0)
|
||||
|
||||
#endif //_WINDOWS
|
||||
|
||||
// Fast Montgomery multiplication. The derivation of the algorithm is
|
||||
// in A Cryptographic Library for the Motorola DSP56000,
|
||||
// Dusse and Kaliski, Proc. EUROCRYPT 90, pp. 230-237.
|
||||
|
||||
static void __attribute__((noinline))
|
||||
montgomery_multiply(unsigned long a[], unsigned long b[], unsigned long n[],
|
||||
unsigned long m[], unsigned long inv, int len) {
|
||||
unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
static void NOINLINE
|
||||
montgomery_multiply(julong a[], julong b[], julong n[],
|
||||
julong m[], julong inv, int len) {
|
||||
julong t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
int i;
|
||||
|
||||
assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
|
||||
assert(inv * n[0] == ULLONG_MAX, "broken inverse in Montgomery multiply");
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int j;
|
||||
@ -3785,13 +3806,13 @@ montgomery_multiply(unsigned long a[], unsigned long b[], unsigned long n[],
|
||||
// multiplication. However, its loop control is more complex and it
|
||||
// may actually run slower on some machines.
|
||||
|
||||
static void __attribute__((noinline))
|
||||
montgomery_square(unsigned long a[], unsigned long n[],
|
||||
unsigned long m[], unsigned long inv, int len) {
|
||||
unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
static void NOINLINE
|
||||
montgomery_square(julong a[], julong n[],
|
||||
julong m[], julong inv, int len) {
|
||||
julong t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
int i;
|
||||
|
||||
assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
|
||||
assert(inv * n[0] == ULLONG_MAX, "broken inverse in Montgomery square");
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int j;
|
||||
@ -3837,13 +3858,13 @@ montgomery_square(unsigned long a[], unsigned long n[],
|
||||
}
|
||||
|
||||
// Swap words in a longword.
|
||||
static unsigned long swap(unsigned long x) {
|
||||
static julong swap(julong x) {
|
||||
return (x << 32) | (x >> 32);
|
||||
}
|
||||
|
||||
// Copy len longwords from s to d, word-swapping as we go. The
|
||||
// destination array is reversed.
|
||||
static void reverse_words(unsigned long *s, unsigned long *d, int len) {
|
||||
static void reverse_words(julong *s, julong *d, int len) {
|
||||
d += len;
|
||||
while(len-- > 0) {
|
||||
d--;
|
||||
@ -3865,24 +3886,24 @@ void SharedRuntime::montgomery_multiply(jint *a_ints, jint *b_ints, jint *n_ints
|
||||
// Make very sure we don't use so much space that the stack might
|
||||
// overflow. 512 jints corresponds to an 16384-bit integer and
|
||||
// will use here a total of 8k bytes of stack space.
|
||||
int total_allocation = longwords * sizeof (unsigned long) * 4;
|
||||
int total_allocation = longwords * sizeof (julong) * 4;
|
||||
guarantee(total_allocation <= 8192, "must be");
|
||||
unsigned long *scratch = (unsigned long *)alloca(total_allocation);
|
||||
julong *scratch = (julong *)alloca(total_allocation);
|
||||
|
||||
// Local scratch arrays
|
||||
unsigned long
|
||||
julong
|
||||
*a = scratch + 0 * longwords,
|
||||
*b = scratch + 1 * longwords,
|
||||
*n = scratch + 2 * longwords,
|
||||
*m = scratch + 3 * longwords;
|
||||
|
||||
reverse_words((unsigned long *)a_ints, a, longwords);
|
||||
reverse_words((unsigned long *)b_ints, b, longwords);
|
||||
reverse_words((unsigned long *)n_ints, n, longwords);
|
||||
reverse_words((julong *)a_ints, a, longwords);
|
||||
reverse_words((julong *)b_ints, b, longwords);
|
||||
reverse_words((julong *)n_ints, n, longwords);
|
||||
|
||||
::montgomery_multiply(a, b, n, m, (unsigned long)inv, longwords);
|
||||
::montgomery_multiply(a, b, n, m, (julong)inv, longwords);
|
||||
|
||||
reverse_words(m, (unsigned long *)m_ints, longwords);
|
||||
reverse_words(m, (julong *)m_ints, longwords);
|
||||
}
|
||||
|
||||
void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
|
||||
@ -3894,30 +3915,28 @@ void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
|
||||
// Make very sure we don't use so much space that the stack might
|
||||
// overflow. 512 jints corresponds to an 16384-bit integer and
|
||||
// will use here a total of 6k bytes of stack space.
|
||||
int total_allocation = longwords * sizeof (unsigned long) * 3;
|
||||
int total_allocation = longwords * sizeof (julong) * 3;
|
||||
guarantee(total_allocation <= 8192, "must be");
|
||||
unsigned long *scratch = (unsigned long *)alloca(total_allocation);
|
||||
julong *scratch = (julong *)alloca(total_allocation);
|
||||
|
||||
// Local scratch arrays
|
||||
unsigned long
|
||||
julong
|
||||
*a = scratch + 0 * longwords,
|
||||
*n = scratch + 1 * longwords,
|
||||
*m = scratch + 2 * longwords;
|
||||
|
||||
reverse_words((unsigned long *)a_ints, a, longwords);
|
||||
reverse_words((unsigned long *)n_ints, n, longwords);
|
||||
reverse_words((julong *)a_ints, a, longwords);
|
||||
reverse_words((julong *)n_ints, n, longwords);
|
||||
|
||||
if (len >= MONTGOMERY_SQUARING_THRESHOLD) {
|
||||
::montgomery_square(a, n, m, (unsigned long)inv, longwords);
|
||||
::montgomery_square(a, n, m, (julong)inv, longwords);
|
||||
} else {
|
||||
::montgomery_multiply(a, a, n, m, (unsigned long)inv, longwords);
|
||||
::montgomery_multiply(a, a, n, m, (julong)inv, longwords);
|
||||
}
|
||||
|
||||
reverse_words(m, (unsigned long *)m_ints, longwords);
|
||||
reverse_words(m, (julong *)m_ints, longwords);
|
||||
}
|
||||
|
||||
#endif // WINDOWS
|
||||
|
||||
#ifdef COMPILER2
|
||||
// This is here instead of runtime_x86_64.cpp because it uses SimpleRuntimeFrame
|
||||
//
|
||||
|
@ -6566,7 +6566,6 @@ address generate_avx_ghash_processBlocks() {
|
||||
StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift();
|
||||
StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift();
|
||||
}
|
||||
#ifndef _WINDOWS
|
||||
if (UseMontgomeryMultiplyIntrinsic) {
|
||||
StubRoutines::_montgomeryMultiply
|
||||
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply);
|
||||
@ -6575,7 +6574,6 @@ address generate_avx_ghash_processBlocks() {
|
||||
StubRoutines::_montgomerySquare
|
||||
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_square);
|
||||
}
|
||||
#endif // WINDOWS
|
||||
#endif // COMPILER2
|
||||
|
||||
if (UseVectorizedMismatchIntrinsic) {
|
||||
|
@ -1507,6 +1507,12 @@ void VM_Version::get_processor_features() {
|
||||
// Modern processors allow misaligned memory operations for vectors.
|
||||
AlignVector = !UseUnalignedLoadStores;
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(OptimizeFill)) {
|
||||
// 8247307: On x86, the auto-vectorized loop array fill code shows
|
||||
// better performance than the array fill stubs. We should reenable
|
||||
// this after the x86 stubs get improved.
|
||||
OptimizeFill = false;
|
||||
}
|
||||
#endif // COMPILER2
|
||||
|
||||
if (FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
|
||||
|
@ -1645,10 +1645,7 @@ bool Matcher::const_oop_prefer_decode() {
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
// TODO: Either support matching DecodeNKlass (heap-based) in operand
|
||||
// or condisider the following:
|
||||
// Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
|
||||
//return CompressedKlassPointers::base() == NULL;
|
||||
// Prefer ConP over ConNKlass+DecodeNKlass.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "interpreter/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/cppInterpreter.hpp"
|
||||
#include "interpreter/zero/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/zero/zeroInterpreter.hpp"
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2008 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -25,10 +25,9 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/assembler.hpp"
|
||||
#include "interpreter/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/bytecodeInterpreter.inline.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "interpreter/zero/bytecodeInterpreter.inline.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
@ -40,8 +39,6 @@
|
||||
#include "runtime/vframeArray.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
#ifdef CC_INTERP
|
||||
|
||||
const char *BytecodeInterpreter::name_of_field_at_address(address addr) {
|
||||
#define DO(member) {if (addr == (address) &(member)) return XSTR(member);}
|
||||
DO(_thread);
|
||||
@ -102,5 +99,3 @@ void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
|
||||
istate->set_stack(stack);
|
||||
istate->set_stack_limit(stack_base - method->max_stack() - 1);
|
||||
}
|
||||
|
||||
#endif // CC_INTERP
|
||||
|
@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/assembler.hpp"
|
||||
#include "interpreter/bytecodeHistogram.hpp"
|
||||
#include "interpreter/cppInterpreterGenerator.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "interpreter/cppInterpreter.hpp"
|
||||
|
||||
address CppInterpreterGenerator::generate_slow_signature_handler() {
|
||||
_masm->advance(1);
|
||||
return (address) InterpreterRuntime::slow_signature_handler;
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_math_entry(
|
||||
AbstractInterpreter::MethodKind kind) {
|
||||
if (!InlineIntrinsics)
|
||||
return NULL;
|
||||
|
||||
Unimplemented();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_abstract_entry() {
|
||||
return generate_entry((address) ShouldNotCallThisEntry());
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_empty_entry() {
|
||||
if (!UseFastEmptyMethods)
|
||||
return NULL;
|
||||
|
||||
return generate_entry((address) CppInterpreter::empty_entry);
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_accessor_entry() {
|
||||
if (!UseFastAccessorMethods)
|
||||
return NULL;
|
||||
|
||||
return generate_entry((address) CppInterpreter::accessor_entry);
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_Reference_get_entry(void) {
|
||||
#if INCLUDE_G1GC
|
||||
if (UseG1GC) {
|
||||
// We need to generate have a routine that generates code to:
|
||||
// * load the value in the referent field
|
||||
// * passes that value to the pre-barrier.
|
||||
//
|
||||
// In the case of G1 this will record the value of the
|
||||
// referent in an SATB buffer if marking is active.
|
||||
// This will cause concurrent marking to mark the referent
|
||||
// field as live.
|
||||
Unimplemented();
|
||||
}
|
||||
#endif // INCLUDE_G1GC
|
||||
|
||||
// If G1 is not enabled then attempt to go through the normal entry point
|
||||
// Reference.get could be instrumented by jvmti
|
||||
return NULL;
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_native_entry(bool synchronized) {
|
||||
return generate_entry((address) CppInterpreter::native_entry);
|
||||
}
|
||||
|
||||
address CppInterpreterGenerator::generate_normal_entry(bool synchronized) {
|
||||
return generate_entry((address) CppInterpreter::normal_entry);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2008, 2009, 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,7 +26,7 @@
|
||||
#ifndef CPU_ZERO_ENTRY_ZERO_HPP
|
||||
#define CPU_ZERO_ENTRY_ZERO_HPP
|
||||
|
||||
#include "interpreter/cppInterpreter.hpp"
|
||||
#include "interpreter/zero/zeroInterpreter.hpp"
|
||||
|
||||
class ZeroEntry {
|
||||
public:
|
||||
@ -69,7 +69,7 @@ class ZeroEntry {
|
||||
private:
|
||||
static void maybe_deoptimize(int deoptimized_frames, TRAPS) {
|
||||
if (deoptimized_frames)
|
||||
CppInterpreter::main_loop(deoptimized_frames - 1, THREAD);
|
||||
ZeroInterpreter::main_loop(deoptimized_frames - 1, THREAD);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -24,26 +24,16 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "code/scopeDesc.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/markWord.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/monitorChunk.hpp"
|
||||
#include "runtime/signature.hpp"
|
||||
#include "runtime/stubCodeGenerator.hpp"
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "vmreg_zero.inline.hpp"
|
||||
#ifdef COMPILER1
|
||||
#include "c1/c1_Runtime1.hpp"
|
||||
#include "runtime/vframeArray.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef ASSERT
|
||||
void RegisterMap::check_location_valid() {
|
||||
@ -87,7 +77,6 @@ frame frame::sender(RegisterMap* map) const {
|
||||
return sender_for_nonentry_frame(map);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
|
||||
return get_interpreterState()->monitor_base();
|
||||
}
|
||||
@ -95,7 +84,6 @@ BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
|
||||
BasicObjectLock* frame::interpreter_frame_monitor_end() const {
|
||||
return (BasicObjectLock*) get_interpreterState()->stack_base();
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
void frame::patch_pc(Thread* thread, address pc) {
|
||||
if (pc != NULL) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,8 +26,6 @@
|
||||
#ifndef CPU_ZERO_FRAME_ZERO_HPP
|
||||
#define CPU_ZERO_FRAME_ZERO_HPP
|
||||
|
||||
#include "runtime/synchronizer.hpp"
|
||||
|
||||
// A frame represents a physical stack frame on the Zero stack.
|
||||
|
||||
public:
|
||||
@ -51,9 +49,7 @@
|
||||
return (intptr_t *) zeroframe();
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
inline interpreterState get_interpreterState() const;
|
||||
#endif // CC_INTERP
|
||||
|
||||
public:
|
||||
const EntryFrame *zero_entryframe() const {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -82,7 +82,6 @@ inline intptr_t* frame::link() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
inline interpreterState frame::get_interpreterState() const {
|
||||
return zero_interpreterframe()->interpreter_state();
|
||||
}
|
||||
@ -119,7 +118,6 @@ inline oop* frame::interpreter_frame_temp_oop_addr() const {
|
||||
interpreterState istate = get_interpreterState();
|
||||
return (oop *)&istate->_oop_temp;
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
inline int frame::interpreter_frame_monitor_size() {
|
||||
return BasicObjectLock::size();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2008, 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,13 +26,12 @@
|
||||
#ifndef CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
|
||||
#define CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
|
||||
|
||||
#include "interpreter/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/zero/bytecodeInterpreter.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
#include "stack_zero.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
|
||||
#ifdef CC_INTERP
|
||||
// | ... |
|
||||
// +--------------------+ ------------------
|
||||
// | stack slot n-1 | low addresses
|
||||
@ -79,6 +78,5 @@ class InterpreterFrame : public ZeroFrame {
|
||||
char* valuebuf,
|
||||
int buflen) const;
|
||||
};
|
||||
#endif // CC_INTERP
|
||||
|
||||
#endif // CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
|
||||
|
@ -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 2009, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -25,9 +25,9 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/javaClasses.inline.hpp"
|
||||
#include "interpreter/cppInterpreterGenerator.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "interpreter/zero/zeroInterpreterGenerator.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/method.inline.hpp"
|
||||
@ -35,6 +35,7 @@
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
|
||||
|
||||
void MethodHandles::invoke_target(Method* method, TRAPS) {
|
||||
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
@ -210,16 +211,16 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
|
||||
// Perhaps surprisingly, the symbolic references visible to Java are not directly used.
|
||||
// They are linked to Java-generated adapters via MethodHandleNatives.linkMethod.
|
||||
// They all allow an appendix argument.
|
||||
return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
|
||||
return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
|
||||
case vmIntrinsics::_invokeBasic:
|
||||
return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
|
||||
return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
|
||||
case vmIntrinsics::_linkToStatic:
|
||||
case vmIntrinsics::_linkToSpecial:
|
||||
return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
|
||||
return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
|
||||
case vmIntrinsics::_linkToInterface:
|
||||
return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
|
||||
return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
|
||||
case vmIntrinsics::_linkToVirtual:
|
||||
return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
|
||||
return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
return NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2008 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,17 +26,9 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "assembler_zero.inline.hpp"
|
||||
#include "entry_zero.hpp"
|
||||
#include "interpreter/cppInterpreter.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "interpreter/zero/zeroInterpreter.hpp"
|
||||
#include "nativeInst_zero.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/handles.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#ifdef COMPILER1
|
||||
#include "c1/c1_Runtime1.hpp"
|
||||
#endif
|
||||
|
||||
// This method is called by nmethod::make_not_entrant_or_zombie to
|
||||
// insert a jump to SharedRuntime::get_handle_wrong_method_stub()
|
||||
@ -48,10 +40,6 @@ void NativeJump::patch_verified_entry(address entry,
|
||||
address dest) {
|
||||
assert(dest == SharedRuntime::get_handle_wrong_method_stub(), "should be");
|
||||
|
||||
#ifdef CC_INTERP
|
||||
((ZeroEntry*) verified_entry)->set_entry_point(
|
||||
(address) CppInterpreter::normal_entry);
|
||||
#else
|
||||
Unimplemented();
|
||||
#endif // CC_INTERP
|
||||
(address) ZeroInterpreter::normal_entry);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "interpreter/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "interpreter/zero/bytecodeInterpreter.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "stack_zero.hpp"
|
||||
#include "stack_zero.inline.hpp"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,34 +26,73 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/assembler.hpp"
|
||||
#include "interpreter/bytecodeHistogram.hpp"
|
||||
#include "interpreter/cppInterpreter.hpp"
|
||||
#include "interpreter/cppInterpreterGenerator.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/interpreterRuntime.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
#include "interpreter/zero/bytecodeInterpreter.hpp"
|
||||
#include "interpreter/zero/zeroInterpreter.hpp"
|
||||
#include "interpreter/zero/zeroInterpreterGenerator.hpp"
|
||||
#include "oops/cpCache.inline.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/jvmtiThreadState.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/interfaceSupport.inline.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "runtime/synchronizer.hpp"
|
||||
#include "runtime/timer.hpp"
|
||||
#include "runtime/vframeArray.hpp"
|
||||
#include "stack_zero.inline.hpp"
|
||||
#include "runtime/timerTrace.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
#ifdef CC_INTERP
|
||||
#include "entry_zero.hpp"
|
||||
#include "stack_zero.inline.hpp"
|
||||
|
||||
void ZeroInterpreter::initialize_stub() {
|
||||
if (_code != NULL) return;
|
||||
|
||||
// generate interpreter
|
||||
int code_size = InterpreterCodeSize;
|
||||
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
|
||||
_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
|
||||
"Interpreter");
|
||||
}
|
||||
|
||||
void ZeroInterpreter::initialize_code() {
|
||||
AbstractInterpreter::initialize();
|
||||
|
||||
// generate interpreter
|
||||
{ ResourceMark rm;
|
||||
TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime));
|
||||
ZeroInterpreterGenerator g(_code);
|
||||
if (PrintInterpreter) print();
|
||||
}
|
||||
|
||||
// Allow c++ interpreter to do one initialization now that switches are set, etc.
|
||||
BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
|
||||
if (JvmtiExport::can_post_interpreter_events())
|
||||
BytecodeInterpreter::runWithChecks(&start_msg);
|
||||
else
|
||||
BytecodeInterpreter::run(&start_msg);
|
||||
}
|
||||
|
||||
void ZeroInterpreter::invoke_method(Method* method, address entry_point, TRAPS) {
|
||||
((ZeroEntry *) entry_point)->invoke(method, THREAD);
|
||||
}
|
||||
|
||||
void ZeroInterpreter::invoke_osr(Method* method,
|
||||
address entry_point,
|
||||
address osr_buf,
|
||||
TRAPS) {
|
||||
((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD);
|
||||
}
|
||||
|
||||
|
||||
|
||||
InterpreterCodelet* ZeroInterpreter::codelet_containing(address pc) {
|
||||
// FIXME: I'm pretty sure _code is null and this is never called, which is why it's copied.
|
||||
return (InterpreterCodelet*)_code->stub_containing(pc);
|
||||
}
|
||||
#define fixup_after_potential_safepoint() \
|
||||
method = istate->method()
|
||||
|
||||
@ -66,7 +105,7 @@
|
||||
CALL_VM_NOCHECK_NOFIX(func) \
|
||||
fixup_after_potential_safepoint()
|
||||
|
||||
int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
|
||||
// Allocate and initialize our frame.
|
||||
@ -104,7 +143,7 @@ intptr_t narrow(BasicType type, intptr_t result) {
|
||||
}
|
||||
|
||||
|
||||
void CppInterpreter::main_loop(int recurse, TRAPS) {
|
||||
void ZeroInterpreter::main_loop(int recurse, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
|
||||
@ -234,7 +273,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
|
||||
}
|
||||
}
|
||||
|
||||
int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
// Make sure method is native and not abstract
|
||||
assert(method->is_native() && !method->is_abstract(), "should be");
|
||||
|
||||
@ -247,6 +286,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
interpreterState istate = frame->interpreter_state();
|
||||
intptr_t *locals = istate->locals();
|
||||
|
||||
#if 0
|
||||
// Update the invocation counter
|
||||
if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
|
||||
MethodCounters* mcs = method->method_counters();
|
||||
@ -264,6 +304,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
goto unwind_and_return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Lock if necessary
|
||||
BasicObjectLock *monitor;
|
||||
@ -504,7 +545,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
int ZeroInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
intptr_t *locals = stack->sp();
|
||||
@ -637,7 +678,7 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
|
||||
@ -656,7 +697,7 @@ int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
// The new slots will be inserted before slot insert_before.
|
||||
// Slots < insert_before will have the same slot number after the insert.
|
||||
// Slots >= insert_before will become old_slot + num_slots.
|
||||
void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
|
||||
void ZeroInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
|
||||
@ -670,7 +711,7 @@ void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
|
||||
SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i + num_slots), i);
|
||||
}
|
||||
|
||||
void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
|
||||
void ZeroInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
|
||||
JavaThread *thread = (JavaThread *) THREAD;
|
||||
ZeroStack *stack = thread->zero_stack();
|
||||
intptr_t *vmslots = stack->sp();
|
||||
@ -683,13 +724,13 @@ void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
|
||||
stack->set_sp(stack->sp() + num_slots);
|
||||
}
|
||||
|
||||
BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
|
||||
BasicType ZeroInterpreter::result_type_of_handle(oop method_handle) {
|
||||
oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
|
||||
oop return_type = java_lang_invoke_MethodType::rtype(method_type);
|
||||
return java_lang_Class::as_BasicType(return_type, (Klass* *) NULL);
|
||||
}
|
||||
|
||||
intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
|
||||
intptr_t* ZeroInterpreter::calculate_unwind_sp(ZeroStack* stack,
|
||||
oop method_handle) {
|
||||
oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
|
||||
int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
|
||||
@ -697,7 +738,7 @@ intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
|
||||
return stack->sp() + argument_slots;
|
||||
}
|
||||
|
||||
JRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
|
||||
JRT_ENTRY(void, ZeroInterpreter::throw_exception(JavaThread* thread,
|
||||
Symbol* name,
|
||||
char* message))
|
||||
THROW_MSG(name, message);
|
||||
@ -804,18 +845,27 @@ InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
|
||||
return (InterpreterFrame *) fp;
|
||||
}
|
||||
|
||||
address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
|
||||
address ZeroInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
|
||||
ShouldNotCallThis();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
address CppInterpreter::deopt_entry(TosState state, int length) {
|
||||
address ZeroInterpreter::deopt_entry(TosState state, int length) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
address ZeroInterpreter::remove_activation_preserving_args_entry() {
|
||||
// Do an uncommon trap type entry. c++ interpreter will know
|
||||
// to pop frame and preserve the args
|
||||
return Interpreter::deopt_entry(vtos, 0);
|
||||
}
|
||||
|
||||
address ZeroInterpreter::remove_activation_early_entry(TosState state) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Helper for figuring out if frames are interpreter frames
|
||||
|
||||
bool CppInterpreter::contains(address pc) {
|
||||
bool ZeroInterpreter::contains(address pc) {
|
||||
return false; // make frame::print_value_on work
|
||||
}
|
||||
#endif // CC_INTERP
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
@ -53,7 +53,6 @@
|
||||
#include "prims/jvm_misc.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/extendedPC.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/interfaceSupport.inline.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
@ -2704,7 +2703,7 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
|
||||
// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
|
||||
//
|
||||
// Note that resume_clear_context() and suspend_save_context() are needed
|
||||
// by SR_handler(), so that fetch_frame_from_ucontext() works,
|
||||
// by SR_handler(), so that fetch_frame_from_context() works,
|
||||
// which in part is used by:
|
||||
// - Forte Analyzer: AsyncGetCallTrace()
|
||||
// - StackBanging: get_frame_at_stack_banging_point()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user