changeset 59931:5f90d52615de

Merge
author jwilhelm
date Thu, 25 Jun 2020 03:11:32 +0200
parents ae38ffda3ef7 a754f573be59
children 24f3207730e5
files .hgtags bin/nashorn/fixwhitespace.sh bin/nashorn/runopt.sh doc/nashorn/DEVELOPER_README doc/nashorn/JavaScriptingProgrammersGuide.html doc/nashorn/source/EvalFile.java doc/nashorn/source/EvalScript.java doc/nashorn/source/InvokeScriptFunction.java doc/nashorn/source/InvokeScriptMethod.java doc/nashorn/source/MultiScopes.java doc/nashorn/source/RunnableImpl.java doc/nashorn/source/RunnableImplObject.java doc/nashorn/source/ScriptVars.java doc/nashorn/source/importpackageclass.js doc/nashorn/source/javaarray.js doc/nashorn/source/javaextend.js doc/nashorn/source/javaimporter.js doc/nashorn/source/javatypes.js doc/nashorn/source/overload.js doc/nashorn/source/runnable.js doc/nashorn/source/samfunc.js doc/nashorn/source/test.js src/hotspot/share/jfr/recorder/jfrRecorder.cpp src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java
diffstat 64 files changed, 1532 insertions(+), 2899 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jun 25 02:54:12 2020 +0200
+++ b/.hgtags	Thu Jun 25 03:11:32 2020 +0200
@@ -642,4 +642,5 @@
 4a485c89d5a08b495961835f5308a96038678aeb jdk-16+1
 06c9f89459daba98395fad726100feb44f89ba71 jdk-15+28
 bcbe7b8a77b8971bc221c0be1bd2abb6fb68c2d0 jdk-16+2
+b58fc60580550a4a587cab729d8fd87223ad6932 jdk-15+29
 76810b3a88c8c641ae3850a8dfd7c40c984aea9d jdk-16+3
--- a/bin/nashorn/fixwhitespace.sh	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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
--- a/bin/nashorn/runopt.sh	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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 ${@}
-
-
--- a/doc/nashorn/DEVELOPER_README	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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
-
--- a/doc/nashorn/JavaScriptingProgrammersGuide.html	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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&amp;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&amp;url=http%3A%2F%2Fdocs.oracle.com%2Fjavase%2F6%2Fdocs%2Ftechnotes%2Fguides%2Fscripting%2Fprogrammer_guide%2Findex.html&amp;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&amp;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&lt;String,
-Object&gt;</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 &ndash; passing an implementation JavaScript object 
-or function to a constructor, or using <code>Java.extend</code> with <code>new</code> &ndash; 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> &ndash; aside from being able to take any number of type parameters
-denoting a class to extend and interfaces to implement &ndash; 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 &ndash; 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 &ndash; 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 &ndash; 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 &ndash; 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. &ndash; 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>
--- a/doc/nashorn/source/EvalFile.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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]));
-    }
-}
-
--- a/doc/nashorn/source/EvalScript.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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')");
-    }
-}
-
--- a/doc/nashorn/source/InvokeScriptFunction.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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!!" );
-    }
-}
-
-
-
--- a/doc/nashorn/source/InvokeScriptMethod.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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 !!" );
-    }
-}
--- a/doc/nashorn/source/MultiScopes.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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"
-    }
-}
-
-
--- a/doc/nashorn/source/RunnableImpl.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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();
-    }
-}
--- a/doc/nashorn/source/RunnableImplObject.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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();
-    }
-}
--- a/doc/nashorn/source/ScriptVars.java	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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())");
-    }
-}
-
-
-
--- a/doc/nashorn/source/importpackageclass.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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);
--- a/doc/nashorn/source/javaarray.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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);
--- a/doc/nashorn/source/javaextend.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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);
--- a/doc/nashorn/source/javaimporter.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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);
-}
-
-
--- a/doc/nashorn/source/javatypes.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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
-
--- a/doc/nashorn/source/overload.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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");
-
--- a/doc/nashorn/source/runnable.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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();
--- a/doc/nashorn/source/samfunc.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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();
--- a/doc/nashorn/source/test.js	Thu Jun 25 02:54:12 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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");
--- a/make/test/BuildMicrobenchmark.gmk	Thu Jun 25 02:54:12 2020 +0200
+++ b/make/test/BuildMicrobenchmark.gmk	Thu Jun 25 03:11:32 2020 +0200
@@ -90,10 +90,11 @@
     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)
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -427,34 +427,26 @@
   }
 }
 
-class JavaThreadToVM : public StackObj {
- private:
-  JavaThread* _jt;
- public:
-  JavaThreadToVM(Thread* thread) : _jt(thread->is_Java_thread() ? (JavaThread*)thread : NULL) {
-    if (_jt != NULL) {
-      assert(_jt->thread_state() == _thread_in_native, "invariant");
-      _jt->set_thread_state(_thread_in_vm);
-    }
-  }
-  ~JavaThreadToVM() {
-    if (_jt != NULL) {
-      _jt->set_thread_state(_thread_in_native);
-    }
-  }
-};
+static size_t flush_type_set(Thread* thread) {
+  assert(thread != NULL, "invariant");
+  JfrCheckpointWriter writer(thread);
+  MutexLocker cld_lock(thread, ClassLoaderDataGraph_lock);
+  MutexLocker module_lock(thread, Module_lock);
+  return JfrTypeSet::serialize(&writer, NULL, false, true);
+}
 
 size_t JfrCheckpointManager::flush_type_set() {
   size_t elements = 0;
   if (JfrTraceIdEpoch::has_changed_tag_state()) {
-    Thread* const t = Thread::current();
-    // can safepoint here (if JavaThread)
-    JavaThreadToVM transition(t);
-    ResetNoHandleMark rnhm;
-    MutexLocker cld_lock(t, ClassLoaderDataGraph_lock);
-    MutexLocker module_lock(t, Module_lock);
-    JfrCheckpointWriter writer(t);
-    elements = JfrTypeSet::serialize(&writer, NULL, false, true);
+    Thread* const thread = Thread::current();
+    if (thread->is_Java_thread()) {
+      // can safepoint here
+      ThreadInVMfromNative transition((JavaThread*)thread);
+      ResetNoHandleMark rnhm;
+      elements = ::flush_type_set(thread);
+    } else {
+      elements = ::flush_type_set(thread);
+    }
   }
   if (is_constant_pending()) {
     WriteOperation wo(_chunkwriter);
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -761,6 +761,7 @@
 int write__method__leakp(JfrCheckpointWriter* writer, const void* m) {
   assert(m != NULL, "invariant");
   MethodPtr method = (MethodPtr)m;
+  CLEAR_LEAKP_METHOD(method);
   return write_method(writer, method, true);
 }
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -170,6 +170,13 @@
   k->set_trace_id(EVENT_KLASS_MASK(k));
 }
 
+// used by CDS / APPCDS as part of "remove_unshareable_info"
+void JfrTraceId::remove(const Method* method) {
+  assert(method != NULL, "invariant");
+  // Clear all bits.
+  method->set_trace_flags(0);
+}
+
 // used by CDS / APPCDS as part of "restore_unshareable_info"
 void JfrTraceId::restore(const Klass* k) {
   assert(k != NULL, "invariant");
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp	Thu Jun 25 03:11:32 2020 +0200
@@ -106,6 +106,7 @@
   static traceid load_raw(const ClassLoaderData* cld);
 
   static void remove(const Klass* klass);
+  static void remove(const Method* method);
   static void restore(const Klass* klass);
 
   // set of event classes made visible to java
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp	Thu Jun 25 03:11:32 2020 +0200
@@ -145,6 +145,7 @@
 #define CLEAR_SERIALIZED_METHOD(method)           (METHOD_META_MASK_CLEAR(method, META_MASK))
 #define SET_PREVIOUS_EPOCH_METHOD_CLEARED_BIT(ptr) (METHOD_META_TAG(ptr, PREVIOUS_EPOCH_BIT))
 #define CLEAR_LEAKP(ptr)                          (TRACE_ID_META_MASK_CLEAR(ptr, (~(LEAKP_META_BIT))))
+#define CLEAR_LEAKP_METHOD(method)                (METHOD_META_MASK_CLEAR(method, (~(LEAKP_META_BIT))))
 #define CLEAR_THIS_EPOCH_CLEARED_BIT(ptr)         (TRACE_ID_META_MASK_CLEAR(ptr,(~(THIS_EPOCH_BIT))))
 #define CLEAR_THIS_EPOCH_METHOD_CLEARED_BIT(ptr)  (METHOD_META_MASK_CLEAR(ptr,(~(THIS_EPOCH_BIT))))
 #define IS_THIS_EPOCH_METHOD_CLEARED(ptr)         (METHOD_FLAG_PREDICATE(method, THIS_EPOCH_BIT))
--- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -172,8 +172,8 @@
 }
 
 static bool is_cds_dump_requested() {
-  // we will not be able to launch recordings if a cds dump is being requested
-  if (Arguments::is_dumping_archive() && (JfrOptionSet::start_flight_recording_options() != NULL)) {
+  // we will not be able to launch recordings on startup if a cds dump is being requested
+  if (Arguments::is_dumping_archive()) {
     warning("JFR will be disabled during CDS dumping");
     teardown_startup_support();
     return true;
@@ -213,7 +213,7 @@
 
 bool JfrRecorder::on_create_vm_3() {
   assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
-  return launch_command_line_recordings(Thread::current());
+  return Arguments::is_dumping_archive() || launch_command_line_recordings(Thread::current());
 }
 
 static bool _created = false;
--- a/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp	Thu Jun 25 03:11:32 2020 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2012, 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
@@ -40,6 +40,7 @@
 
 #define INIT_ID(data) JfrTraceId::assign(data)
 #define REMOVE_ID(k) JfrTraceId::remove(k);
+#define REMOVE_METHOD_ID(method) JfrTraceId::remove(method);
 #define RESTORE_ID(k) JfrTraceId::restore(k);
 
 class JfrTraceFlag {
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -1025,7 +1025,7 @@
   JVMCIObject nmethod_mirror = JVMCIENV->wrap(hs_nmethod);
   nmethodLocker locker;
   nmethod* nm = JVMCIENV->get_nmethod(nmethod_mirror, locker);
-  if (nm == NULL) {
+  if (nm == NULL || !nm->is_in_use()) {
     JVMCI_THROW_NULL(InvalidInstalledCodeException);
   }
   methodHandle mh(THREAD, nm->method());
@@ -1034,7 +1034,7 @@
 
   JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
   JavaValue result(jap.return_type());
-  jca.set_alternative_target(nm);
+  jca.set_alternative_target(Handle(THREAD, JNIHandles::resolve(nmethod_mirror.as_jobject())));
   JavaCalls::call(&result, mh, &jca, CHECK_NULL);
 
   if (jap.return_type() == T_VOID) {
@@ -1768,6 +1768,18 @@
   }
 C2V_END
 
+C2V_VMENTRY(void, ensureLinked, (JNIEnv* env, jobject, jobject jvmci_type))
+  if (jvmci_type == NULL) {
+    JVMCI_THROW(NullPointerException);
+  }
+
+  Klass* klass = JVMCIENV->asKlass(jvmci_type);
+  if (klass != NULL && klass->is_instance_klass()) {
+    InstanceKlass* k = InstanceKlass::cast(klass);
+    k->link_class(CHECK);
+  }
+C2V_END
+
 C2V_VMENTRY_0(jint, interpreterFrameSize, (JNIEnv* env, jobject, jobject bytecode_frame_handle))
   if (bytecode_frame_handle == NULL) {
     JVMCI_THROW_0(NullPointerException);
@@ -2775,6 +2787,7 @@
   {CC "getInterfaces",                                CC "(" HS_RESOLVED_KLASS ")[" HS_RESOLVED_KLASS,                                      FN_PTR(getInterfaces)},
   {CC "getComponentType",                             CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_TYPE,                                        FN_PTR(getComponentType)},
   {CC "ensureInitialized",                            CC "(" HS_RESOLVED_KLASS ")V",                                                        FN_PTR(ensureInitialized)},
+  {CC "ensureLinked",                                 CC "(" HS_RESOLVED_KLASS ")V",                                                        FN_PTR(ensureLinked)},
   {CC "getIdentityHashCode",                          CC "(" OBJECTCONSTANT ")I",                                                           FN_PTR(getIdentityHashCode)},
   {CC "isInternedString",                             CC "(" OBJECTCONSTANT ")Z",                                                           FN_PTR(isInternedString)},
   {CC "unboxPrimitive",                               CC "(" OBJECTCONSTANT ")" OBJECT,                                                     FN_PTR(unboxPrimitive)},
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -554,7 +554,14 @@
   declare_constant(InstanceKlass::linked)                                 \
   declare_constant(InstanceKlass::being_initialized)                      \
   declare_constant(InstanceKlass::fully_initialized)                      \
+                                                                          \
+  /*********************************/                                     \
+  /* InstanceKlass _misc_flags */                                         \
+  /*********************************/                                     \
+                                                                          \
   declare_constant(InstanceKlass::_misc_is_unsafe_anonymous)              \
+  declare_constant(InstanceKlass::_misc_has_nonstatic_concrete_methods)   \
+  declare_constant(InstanceKlass::_misc_declares_nonstatic_concrete_methods) \
                                                                           \
   declare_constant(JumpData::taken_off_set)                               \
   declare_constant(JumpData::displacement_off_set)                        \
--- a/src/hotspot/share/oops/method.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/oops/method.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -357,6 +357,7 @@
 
 void Method::remove_unshareable_info() {
   unlink_method();
+  JFR_ONLY(REMOVE_METHOD_ID(this);)
 }
 
 void Method::set_vtable_index(int index) {
--- a/src/hotspot/share/runtime/javaCalls.cpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/runtime/javaCalls.cpp	Thu Jun 25 03:11:32 2020 +0200
@@ -30,6 +30,9 @@
 #include "compiler/compileBroker.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/linkResolver.hpp"
+#if INCLUDE_JVMCI
+#include "jvmci/jvmciJavaClasses.hpp"
+#endif
 #include "memory/universe.hpp"
 #include "oops/method.inline.hpp"
 #include "oops/oop.inline.hpp"
@@ -346,27 +349,15 @@
   assert(!SafepointSynchronize::is_at_safepoint(), "call to Java code during VM operation");
   assert(!thread->handle_area()->no_handle_mark_active(), "cannot call out to Java here");
 
-#if INCLUDE_JVMCI
-  // Gets the nmethod (if any) that should be called instead of normal target
-  nmethod* alternative_target = args->alternative_target();
-  if (alternative_target == NULL) {
-#endif
-// Verify the arguments
-
-  if (CheckJNICalls)  {
+  // Verify the arguments
+  if (JVMCI_ONLY(args->alternative_target().is_null() &&) (DEBUG_ONLY(true ||) CheckJNICalls)) {
     args->verify(method, result->get_type());
   }
-  else debug_only(args->verify(method, result->get_type()));
-#if INCLUDE_JVMCI
-  }
-#else
-
   // Ignore call if method is empty
-  if (method->is_empty_method()) {
+  if (JVMCI_ONLY(args->alternative_target().is_null() &&) method->is_empty_method()) {
     assert(result->get_type() == T_VOID, "an empty method must return a void value");
     return;
   }
-#endif
 
 #ifdef ASSERT
   { InstanceKlass* holder = method->method_holder();
@@ -414,17 +405,6 @@
     os::map_stack_shadow_pages(sp);
   }
 
-#if INCLUDE_JVMCI
-  if (alternative_target != NULL) {
-    if (alternative_target->is_alive() && !alternative_target->is_unloading()) {
-      thread->set_jvmci_alternate_call_target(alternative_target->verified_entry_point());
-      entry_point = method->adapter()->get_i2c_entry();
-    } else {
-      THROW(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException());
-    }
-  }
-#endif
-
   // do call
   { JavaCallWrapper link(method, receiver, result, CHECK);
     { HandleMark hm(thread);  // HandleMark used by HandleMarkCleaner
@@ -433,7 +413,20 @@
       // the call to call_stub, the optimizer produces wrong code.
       intptr_t* result_val_address = (intptr_t*)(result->get_value_addr());
       intptr_t* parameter_address = args->parameters();
-
+#if INCLUDE_JVMCI
+      // Gets the alternative target (if any) that should be called
+      Handle alternative_target = args->alternative_target();
+      if (!alternative_target.is_null()) {
+        // Must extract verified entry point from HotSpotNmethod after VM to Java
+        // transition in JavaCallWrapper constructor so that it is safe with
+        // respect to nmethod sweeping.
+        address verified_entry_point = (address) HotSpotJVMCI::InstalledCode::entryPoint(NULL, alternative_target());
+        if (verified_entry_point != NULL) {
+          thread->set_jvmci_alternate_call_target(verified_entry_point);
+          entry_point = method->adapter()->get_i2c_entry();
+        }
+      }
+#endif
       StubRoutines::call_stub()(
         (address)&link,
         // (intptr_t*)&(result->_value), // see NOTE above (compiler problem)
--- a/src/hotspot/share/runtime/javaCalls.hpp	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/hotspot/share/runtime/javaCalls.hpp	Thu Jun 25 03:11:32 2020 +0200
@@ -88,7 +88,10 @@
   int         _size;
   int         _max_size;
   bool        _start_at_zero;      // Support late setting of receiver
-  JVMCI_ONLY(nmethod*    _alternative_target;) // Nmethod that should be called instead of normal target
+#if INCLUDE_JVMCI
+  Handle      _alternative_target; // HotSpotNmethod wrapping an nmethod whose verified entry point
+                                   // should be called instead of the normal target
+#endif
 
   void initialize() {
     // Starts at first element to support set_receiver.
@@ -98,7 +101,6 @@
     _max_size = _default_size;
     _size = 0;
     _start_at_zero = false;
-    JVMCI_ONLY(_alternative_target = NULL;)
   }
 
   // Helper for push_oop and the like.  The value argument is a
@@ -138,18 +140,17 @@
       _max_size = max_size;
       _size = 0;
       _start_at_zero = false;
-      JVMCI_ONLY(_alternative_target = NULL;)
     } else {
       initialize();
     }
   }
 
 #if INCLUDE_JVMCI
-  void set_alternative_target(nmethod* target) {
+  void set_alternative_target(Handle target) {
     _alternative_target = target;
   }
 
-  nmethod* alternative_target() {
+  Handle alternative_target() {
     return _alternative_target;
   }
 #endif
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Jun 25 03:11:32 2020 +0200
@@ -2182,7 +2182,7 @@
             handles.markException(passHandle, resolveEx);
         }
 
-        final boolean isRecord = cl != null && isRecord(cl) ? true : false;
+        final boolean isRecord = cl != null && isRecord(cl);
         if (isRecord) {
             assert obj == null;
             obj = readRecord(desc);
@@ -2289,14 +2289,14 @@
 
         FieldValues fieldValues = defaultReadFields(null, desc);
 
-        // retrieve the canonical constructor
-        MethodHandle ctrMH = desc.getRecordConstructor();
-
-        // bind the stream field values
-        ctrMH = RecordSupport.bindCtrValues(ctrMH, desc, fieldValues);
+        // get canonical record constructor adapted to take two arguments:
+        // - byte[] primValues
+        // - Object[] objValues
+        // and return Object
+        MethodHandle ctrMH = RecordSupport.deserializationCtr(desc);
 
         try {
-            return ctrMH.invoke();
+            return (Object) ctrMH.invokeExact(fieldValues.primValues, fieldValues.objValues);
         } catch (Exception e) {
             InvalidObjectException ioe = new InvalidObjectException(e.getMessage());
             ioe.initCause(e);
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java	Thu Jun 25 03:11:32 2020 +0200
@@ -27,6 +27,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.SoftReference;
@@ -55,6 +56,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -191,8 +193,14 @@
 
     /** serialization-appropriate constructor, or null if none */
     private Constructor<?> cons;
-    /** record canonical constructor, or null */
+    /** record canonical constructor (shared among OSCs for same class), or null */
     private MethodHandle canonicalCtr;
+    /** cache of record deserialization constructors per unique set of stream fields
+     * (shared among OSCs for same class), or null */
+    private DeserializationConstructorsCache deserializationCtrs;
+    /** session-cache of record deserialization constructor
+     * (in de-serialized OSC only), or null */
+    private MethodHandle deserializationCtr;
     /** protection domains that need to be checked when calling the constructor */
     private ProtectionDomain[] domains;
 
@@ -525,6 +533,7 @@
 
                     if (isRecord) {
                         canonicalCtr = canonicalRecordCtr(cl);
+                        deserializationCtrs = new DeserializationConstructorsCache();
                     } else if (externalizable) {
                         cons = getExternalizableConstructor(cl);
                     } else {
@@ -740,7 +749,10 @@
         this.cl = cl;
         if (cl != null) {
             this.isRecord = isRecord(cl);
+            // canonical record constructor is shared
             this.canonicalCtr = osc.canonicalCtr;
+            // cache of deserialization constructors is shared
+            this.deserializationCtrs = osc.deserializationCtrs;
         }
         this.resolveEx = resolveEx;
         this.superDesc = superDesc;
@@ -2528,14 +2540,135 @@
         }
     }
 
+    // a LRA cache of record deserialization constructors
+    @SuppressWarnings("serial")
+    private static final class DeserializationConstructorsCache
+        extends ConcurrentHashMap<DeserializationConstructorsCache.Key, MethodHandle>  {
+
+        // keep max. 10 cached entries - when the 11th element is inserted the oldest
+        // is removed and 10 remains - 11 is the biggest map size where internal
+        // table of 16 elements is sufficient (inserting 12th element would resize it to 32)
+        private static final int MAX_SIZE = 10;
+        private Key.Impl first, last; // first and last in FIFO queue
+
+        DeserializationConstructorsCache() {
+            // start small - if there is more than one shape of ObjectStreamClass
+            // deserialized, there will typically be two (current version and previous version)
+            super(2);
+        }
+
+        MethodHandle get(ObjectStreamField[] fields) {
+            return get(new Key.Lookup(fields));
+        }
+
+        synchronized MethodHandle putIfAbsentAndGet(ObjectStreamField[] fields, MethodHandle mh) {
+            Key.Impl key = new Key.Impl(fields);
+            var oldMh = putIfAbsent(key, mh);
+            if (oldMh != null) return oldMh;
+            // else we did insert new entry -> link the new key as last
+            if (last == null) {
+                last = first = key;
+            } else {
+                last = (last.next = key);
+            }
+            // may need to remove first
+            if (size() > MAX_SIZE) {
+                assert first != null;
+                remove(first);
+                first = first.next;
+                if (first == null) {
+                    last = null;
+                }
+            }
+            return mh;
+        }
+
+        // a key composed of ObjectStreamField[] names and types
+        static abstract class Key {
+            abstract int length();
+            abstract String fieldName(int i);
+            abstract Class<?> fieldType(int i);
+
+            @Override
+            public final int hashCode() {
+                int n = length();
+                int h = 0;
+                for (int i = 0; i < n; i++) h = h * 31 + fieldType(i).hashCode();
+                for (int i = 0; i < n; i++) h = h * 31 + fieldName(i).hashCode();
+                return h;
+            }
+
+            @Override
+            public final boolean equals(Object obj) {
+                if (!(obj instanceof Key)) return false;
+                Key other = (Key) obj;
+                int n = length();
+                if (n != other.length()) return false;
+                for (int i = 0; i < n; i++) if (fieldType(i) != other.fieldType(i)) return false;
+                for (int i = 0; i < n; i++) if (!fieldName(i).equals(other.fieldName(i))) return false;
+                return true;
+            }
+
+            // lookup key - just wraps ObjectStreamField[]
+            static final class Lookup extends Key {
+                final ObjectStreamField[] fields;
+
+                Lookup(ObjectStreamField[] fields) { this.fields = fields; }
+
+                @Override
+                int length() { return fields.length; }
+
+                @Override
+                String fieldName(int i) { return fields[i].getName(); }
+
+                @Override
+                Class<?> fieldType(int i) { return fields[i].getType(); }
+            }
+
+            // real key - copies field names and types and forms FIFO queue in cache
+            static final class Impl extends Key {
+                Impl next;
+                final String[] fieldNames;
+                final Class<?>[] fieldTypes;
+
+                Impl(ObjectStreamField[] fields) {
+                    this.fieldNames = new String[fields.length];
+                    this.fieldTypes = new Class<?>[fields.length];
+                    for (int i = 0; i < fields.length; i++) {
+                        fieldNames[i] = fields[i].getName();
+                        fieldTypes[i] = fields[i].getType();
+                    }
+                }
+
+                @Override
+                int length() { return fieldNames.length; }
+
+                @Override
+                String fieldName(int i) { return fieldNames[i]; }
+
+                @Override
+                Class<?> fieldType(int i) { return fieldTypes[i]; }
+            }
+        }
+    }
+
     /** Record specific support for retrieving and binding stream field values. */
     static final class RecordSupport {
+        /**
+         * Returns canonical record constructor adapted to take two arguments:
+         * {@code (byte[] primValues, Object[] objValues)}
+         * and return
+         * {@code Object}
+         */
+        @SuppressWarnings("preview")
+        static MethodHandle deserializationCtr(ObjectStreamClass desc) {
+            // check the cached value 1st
+            MethodHandle mh = desc.deserializationCtr;
+            if (mh != null) return mh;
+            mh = desc.deserializationCtrs.get(desc.getFields(false));
+            if (mh != null) return desc.deserializationCtr = mh;
 
-        /** Binds the given stream field values to the given method handle. */
-        @SuppressWarnings("preview")
-        static MethodHandle bindCtrValues(MethodHandle ctrMH,
-                                          ObjectStreamClass desc,
-                                          ObjectInputStream.FieldValues fieldValues) {
+            // retrieve record components
             RecordComponent[] recordComponents;
             try {
                 Class<?> cls = desc.forClass();
@@ -2545,15 +2678,36 @@
                 throw new InternalError(e.getCause());
             }
 
-            Object[] args = new Object[recordComponents.length];
-            for (int i = 0; i < recordComponents.length; i++) {
+            // retrieve the canonical constructor
+            // (T1, T2, ..., Tn):TR
+            mh = desc.getRecordConstructor();
+
+            // change return type to Object
+            // (T1, T2, ..., Tn):TR -> (T1, T2, ..., Tn):Object
+            mh = mh.asType(mh.type().changeReturnType(Object.class));
+
+            // drop last 2 arguments representing primValues and objValues arrays
+            // (T1, T2, ..., Tn):Object -> (T1, T2, ..., Tn, byte[], Object[]):Object
+            mh = MethodHandles.dropArguments(mh, mh.type().parameterCount(), byte[].class, Object[].class);
+
+            for (int i = recordComponents.length-1; i >= 0; i--) {
                 String name = recordComponents[i].getName();
-                Class<?> type= recordComponents[i].getType();
-                Object o = streamFieldValue(name, type, desc, fieldValues);
-                args[i] = o;
+                Class<?> type = recordComponents[i].getType();
+                // obtain stream field extractor that extracts argument at
+                // position i (Ti+1) from primValues and objValues arrays
+                // (byte[], Object[]):Ti+1
+                MethodHandle combiner = streamFieldExtractor(name, type, desc);
+                // fold byte[] privValues and Object[] objValues into argument at position i (Ti+1)
+                // (..., Ti, Ti+1, byte[], Object[]):Object -> (..., Ti, byte[], Object[]):Object
+                mh = MethodHandles.foldArguments(mh, i, combiner);
             }
+            // what we are left with is a MethodHandle taking just the primValues
+            // and objValues arrays and returning the constructed record instance
+            // (byte[], Object[]):Object
 
-            return MethodHandles.insertArguments(ctrMH, 0, args);
+            // store it into cache and return the 1st value stored
+            return desc.deserializationCtr =
+                desc.deserializationCtrs.putIfAbsentAndGet(desc.getFields(false), mh);
         }
 
         /** Returns the number of primitive fields for the given descriptor. */
@@ -2569,37 +2723,15 @@
             return primValueCount;
         }
 
-        /** Returns the default value for the given type. */
-        private static Object defaultValueFor(Class<?> pType) {
-            if (pType == Integer.TYPE)
-                return 0;
-            else if (pType == Byte.TYPE)
-                return (byte)0;
-            else if (pType == Long.TYPE)
-                return 0L;
-            else if (pType == Float.TYPE)
-                return 0.0f;
-            else if (pType == Double.TYPE)
-                return 0.0d;
-            else if (pType == Short.TYPE)
-                return (short)0;
-            else if (pType == Character.TYPE)
-                return '\u0000';
-            else if (pType == Boolean.TYPE)
-                return false;
-            else
-                return null;
-        }
-
         /**
-         * Returns the stream field value for the given name. The default value
-         * for the given type is returned if the field value is absent.
+         * Returns extractor MethodHandle taking the primValues and objValues arrays
+         * and extracting the argument of canonical constructor with given name and type
+         * or producing  default value for the given type if the field is absent.
          */
-        private static Object streamFieldValue(String pName,
-                                               Class<?> pType,
-                                               ObjectStreamClass desc,
-                                               ObjectInputStream.FieldValues fieldValues) {
-            ObjectStreamField[] fields = desc.getFields();
+        private static MethodHandle streamFieldExtractor(String pName,
+                                                         Class<?> pType,
+                                                         ObjectStreamClass desc) {
+            ObjectStreamField[] fields = desc.getFields(false);
 
             for (int i = 0; i < fields.length; i++) {
                 ObjectStreamField f = fields[i];
@@ -2612,30 +2744,62 @@
                     throw new InternalError(fName + " unassignable, pType:" + pType + ", fType:" + fType);
 
                 if (f.isPrimitive()) {
-                    if (pType == Integer.TYPE)
-                        return Bits.getInt(fieldValues.primValues, f.getOffset());
-                    else if (fType == Byte.TYPE)
-                        return fieldValues.primValues[f.getOffset()];
-                    else if (fType == Long.TYPE)
-                        return Bits.getLong(fieldValues.primValues, f.getOffset());
-                    else if (fType == Float.TYPE)
-                        return Bits.getFloat(fieldValues.primValues, f.getOffset());
-                    else if (fType == Double.TYPE)
-                        return Bits.getDouble(fieldValues.primValues, f.getOffset());
-                    else if (fType == Short.TYPE)
-                        return Bits.getShort(fieldValues.primValues, f.getOffset());
-                    else if (fType == Character.TYPE)
-                        return Bits.getChar(fieldValues.primValues, f.getOffset());
-                    else if (fType == Boolean.TYPE)
-                        return Bits.getBoolean(fieldValues.primValues, f.getOffset());
-                    else
+                    // (byte[], int):fType
+                    MethodHandle mh = PRIM_VALUE_EXTRACTORS.get(fType);
+                    if (mh == null) {
                         throw new InternalError("Unexpected type: " + fType);
+                    }
+                    // bind offset
+                    // (byte[], int):fType -> (byte[]):fType
+                    mh = MethodHandles.insertArguments(mh, 1, f.getOffset());
+                    // drop objValues argument
+                    // (byte[]):fType -> (byte[], Object[]):fType
+                    mh = MethodHandles.dropArguments(mh, 1, Object[].class);
+                    // adapt return type to pType
+                    // (byte[], Object[]):fType -> (byte[], Object[]):pType
+                    if (pType != fType) {
+                        mh = mh.asType(mh.type().changeReturnType(pType));
+                    }
+                    return mh;
                 } else { // reference
-                    return fieldValues.objValues[i - numberPrimValues(desc)];
+                    // (Object[], int):Object
+                    MethodHandle mh = MethodHandles.arrayElementGetter(Object[].class);
+                    // bind index
+                    // (Object[], int):Object -> (Object[]):Object
+                    mh = MethodHandles.insertArguments(mh, 1, i - numberPrimValues(desc));
+                    // drop primValues argument
+                    // (Object[]):Object -> (byte[], Object[]):Object
+                    mh = MethodHandles.dropArguments(mh, 0, byte[].class);
+                    // adapt return type to pType
+                    // (byte[], Object[]):Object -> (byte[], Object[]):pType
+                    if (pType != Object.class) {
+                        mh = mh.asType(mh.type().changeReturnType(pType));
+                    }
+                    return mh;
                 }
             }
 
-            return defaultValueFor(pType);
+            // return default value extractor if no field matches pName
+            return MethodHandles.empty(MethodType.methodType(pType, byte[].class, Object[].class));
+        }
+
+        private static final Map<Class<?>, MethodHandle> PRIM_VALUE_EXTRACTORS;
+        static {
+            var lkp = MethodHandles.lookup();
+            try {
+                PRIM_VALUE_EXTRACTORS = Map.of(
+                    byte.class, MethodHandles.arrayElementGetter(byte[].class),
+                    short.class, lkp.findStatic(Bits.class, "getShort", MethodType.methodType(short.class, byte[].class, int.class)),
+                    int.class, lkp.findStatic(Bits.class, "getInt", MethodType.methodType(int.class, byte[].class, int.class)),
+                    long.class, lkp.findStatic(Bits.class, "getLong", MethodType.methodType(long.class, byte[].class, int.class)),
+                    float.class, lkp.findStatic(Bits.class, "getFloat", MethodType.methodType(float.class, byte[].class, int.class)),
+                    double.class, lkp.findStatic(Bits.class, "getDouble", MethodType.methodType(double.class, byte[].class, int.class)),
+                    char.class, lkp.findStatic(Bits.class, "getChar", MethodType.methodType(char.class, byte[].class, int.class)),
+                    boolean.class, lkp.findStatic(Bits.class, "getBoolean", MethodType.methodType(boolean.class, byte[].class, int.class))
+                );
+            } catch (NoSuchMethodException | IllegalAccessException e) {
+                throw new InternalError("Can't lookup Bits.getXXX", e);
+            }
         }
     }
 }
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Jun 25 03:11:32 2020 +0200
@@ -133,11 +133,12 @@
  *     It is the virtual machine's built-in class loader, typically represented
  *     as {@code null}, and does not have a parent.</li>
  * <li><p>{@linkplain #getPlatformClassLoader() Platform class loader}.
- *     All <em>platform classes</em> are visible to the platform class loader
- *     that can be used as the parent of a {@code ClassLoader} instance.
- *     Platform classes include Java SE platform APIs, their implementation
- *     classes and JDK-specific run-time classes that are defined by the
- *     platform class loader or its ancestors.
+ *     The platform class loader is responsible for loading the
+ *     <em>platform classes</em>.  Platform classes include Java SE platform APIs,
+ *     their implementation classes and JDK-specific run-time classes that are
+ *     defined by the platform class loader or its ancestors.
+ *     The platform class loader can be used as the parent of a {@code ClassLoader}
+ *     instance.
  *     <p> To allow for upgrading/overriding of modules defined to the platform
  *     class loader, and where upgraded modules read modules defined to class
  *     loaders other than the platform class loader and its ancestors, then
@@ -151,8 +152,9 @@
  *     from the platform class loader.
  *     The system class loader is typically used to define classes on the
  *     application class path, module path, and JDK-specific tools.
- *     The platform class loader is a parent or an ancestor of the system class
- *     loader that all platform classes are visible to it.</li>
+ *     The platform class loader is the parent or an ancestor of the system class
+ *     loader, so the system class loader can load platform classes by delegating
+ *     to its parent.</li>
  * </ul>
  *
  * <p> Normally, the Java virtual machine loads classes from the local file
--- a/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java	Thu Jun 25 03:11:32 2020 +0200
@@ -163,19 +163,24 @@
     /**
      * Mismatch over long lengths.
      */
-    public static long vectorizedMismatchLarge(Object a, long aOffset,
-                                               Object b, long bOffset,
-                                               long length,
-                                               int log2ArrayIndexScale) {
+    public static long vectorizedMismatchLargeForBytes(Object a, long aOffset,
+                                                       Object b, long bOffset,
+                                                       long length) {
         long off = 0;
         long remaining = length;
-        int i ;
-        while (remaining > 7) {
-            int size = (int) Math.min(Integer.MAX_VALUE, remaining);
+        int i, size;
+        boolean lastSubRange = false;
+        while (remaining > 7 && !lastSubRange) {
+            if (remaining > Integer.MAX_VALUE) {
+                size = Integer.MAX_VALUE;
+            } else {
+                size = (int) remaining;
+                lastSubRange = true;
+            }
             i = vectorizedMismatch(
                     a, aOffset + off,
                     b, bOffset + off,
-                    size, log2ArrayIndexScale);
+                    size, LOG2_ARRAY_BYTE_INDEX_SCALE);
             if (i >= 0)
                 return off + i;
 
@@ -183,7 +188,7 @@
             off += i;
             remaining -= i;
         }
-        return ~off;
+        return ~remaining;
     }
 
     // Booleans
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java	Thu Jun 25 03:11:32 2020 +0200
@@ -36,6 +36,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -114,6 +115,7 @@
 
     public enum Flag {
         TABLE_HAS_CAPTION,
+        TABLE_IS_PRESENTATION,
         HAS_ELEMENT,
         HAS_HEADING,
         HAS_INLINE_TAG,
@@ -530,7 +532,8 @@
                 if (t == top.tag) {
                     switch (t) {
                         case TABLE:
-                            if (!top.attrs.contains(HtmlTag.Attr.SUMMARY)
+                            if (!top.flags.contains(Flag.TABLE_IS_PRESENTATION)
+                                    && !top.attrs.contains(HtmlTag.Attr.SUMMARY)
                                     && !top.flags.contains(Flag.TABLE_HAS_CAPTION)) {
                                 env.messages.error(ACCESSIBILITY, tree,
                                         "dc.no.summary.or.caption.for.table");
@@ -687,6 +690,15 @@
                             }
                         }
                         break;
+
+                    case ROLE:
+                        if (currTag == HtmlTag.TABLE) {
+                            String v = getAttrValue(tree);
+                            if (Objects.equals(v, "presentation")) {
+                                tagStack.peek().flags.add(Flag.TABLE_IS_PRESENTATION);
+                            }
+                        }
+                        break;
                 }
             }
         }
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c	Thu Jun 25 03:11:32 2020 +0200
@@ -56,6 +56,8 @@
     if (fd >= 0) {
       print_debug("path %s substituted for %s\n", alt_path, name);
       return fd;
+    } else {
+      print_debug("can't open %s\n", alt_path);
     }
 
     if (strrchr(name, '/')) {
@@ -65,12 +67,16 @@
       if (fd >= 0) {
         print_debug("path %s substituted for %s\n", alt_path, name);
         return fd;
+    } else {
+      print_debug("can't open %s\n", alt_path);
       }
     }
   } else {
     fd = open(name, O_RDONLY);
     if (fd >= 0) {
       return fd;
+    } else {
+      print_debug("can't open %s\n", name);
     }
   }
   return -1;
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java	Thu Jun 25 03:11:32 2020 +0200
@@ -52,7 +52,7 @@
  * explicitly permitted types.
  *
  * @implSpec
- * Implementations of this interface are immutable and thread-safe.
+ * Implementations of this interface are immutable, thread-safe and <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>.
  */
 public interface MemoryAddress {
     /**
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java	Thu Jun 25 03:11:32 2020 +0200
@@ -54,6 +54,27 @@
  * element layout (see {@link SequenceLayout}); a <em>group layout</em> denotes an aggregation of (typically) heterogeneous
  * member layouts (see {@link GroupLayout}).
  * <p>
+ * For instance, consider the following struct declaration in C:
+ *
+ * <blockquote><pre>{@code
+ typedef struct {
+     char kind;
+     int value;
+ } TaggedValues[5];
+ * }</pre></blockquote>
+ *
+ * The above declaration can be modelled using a layout object, as follows:
+ *
+ * <blockquote><pre>{@code
+SequenceLayout taggedValues = MemoryLayout.ofSequence(5,
+    MemoryLayout.ofStruct(
+        MemoryLayout.ofValueBits(8, ByteOrder.NATIVE_ORDER).withName("kind"),
+        MemoryLayout.ofPaddingBits(24),
+        MemoryLayout.ofValueBits(32, ByteOrder.NATIVE_ORDER).withName("value")
+    )
+).withName("TaggedValues");
+ * }</pre></blockquote>
+ * <p>
  * All implementations of this interface must be <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>;
  * use of identity-sensitive operations (including reference equality ({@code ==}), identity hash code, or synchronization) on
  * instances of {@code MemoryLayout} may have unpredictable results and should be avoided. The {@code equals} method should
@@ -103,53 +124,30 @@
  * another layout (see {@link MemoryLayout#map(UnaryOperator, PathElement...)}).
  * <p>
  * Such <em>layout paths</em> can be constructed programmatically using the methods in this class.
- * For instance, given a layout constructed as follows:
+ * For instance, given the {@code taggedValues} layout instance constructed as above, we can obtain the offset,
+ * in bits, of the member layout named <code>value</code> in the <em>first</em> sequence element, as follows:
  * <blockquote><pre>{@code
-SequenceLayout seq = MemoryLayout.ofSequence(5,
-    MemoryLayout.ofStruct(
-        MemoryLayout.ofPaddingBits(32),
-        MemoryLayout.ofValueBits(32, ByteOrder.BIG_ENDIAN).withName("value")
-));
- * }</pre></blockquote>
- *
- * We can obtain the offset, in bits, of the member layout named <code>value</code> from <code>seq</code>, as follows:
- * <blockquote><pre>{@code
-long valueOffset = seq.bitOffset(PathElement.sequenceElement(), PathElement.groupElement("value"));
+long valueOffset = taggedValues.bitOffset(PathElement.sequenceElement(0),
+                                          PathElement.groupElement("value")); // yields 32
  * }</pre></blockquote>
  *
  * Similarly, we can select the member layout named {@code value}, as follows:
  * <blockquote><pre>{@code
-MemoryLayout value = seq.select(PathElement.sequenceElement(), PathElement.groupElement("value"));
+MemoryLayout value = taggedValues.select(PathElement.sequenceElement(),
+                                         PathElement.groupElement("value"));
  * }</pre></blockquote>
  *
  * And, we can also replace the layout named {@code value} with another layout, as follows:
  * <blockquote><pre>{@code
-MemoryLayout newSeq = seq.map(l -> MemoryLayout.ofPadding(32), PathElement.sequenceElement(), PathElement.groupElement("value"));
+MemoryLayout taggedValuesWithHole = taggedValues.map(l -> MemoryLayout.ofPadding(32),
+                                            PathElement.sequenceElement(), PathElement.groupElement("value"));
  * }</pre></blockquote>
  *
  * That is, the above declaration is identical to the following, more verbose one:
  * <blockquote><pre>{@code
-MemoryLayout newSeq = MemoryLayout.ofSequence(5,
+MemoryLayout taggedValuesWithHole = MemoryLayout.ofSequence(5,
     MemoryLayout.ofStruct(
-        MemoryLayout.ofPaddingBits(32),
-        MemoryLayout.ofPaddingBits(32)
-));
- * }</pre></blockquote>
- *
- * Similarly, we can select the member layout named {@code value}, as follows:
- * <blockquote><pre>{@code
-MemoryLayout value = seq.select(PathElement.sequenceElement(), PathElement.groupElement("value"));
- * }</pre></blockquote>
- *
- * And, we can also replace the layout named {@code value} with another layout, as follows:
- * <blockquote><pre>{@code
-MemoryLayout newSeq = seq.map(l -> MemoryLayout.ofPadding(32), PathElement.sequenceElement(), PathElement.groupElement("value"));
- * }</pre></blockquote>
- *
- * That is, the above declaration is identical to the following, more verbose one:
- * <blockquote><pre>{@code
-MemoryLayout newSeq = MemoryLayout.ofSequence(5,
-    MemoryLayout.ofStruct(
+        MemoryLayout.ofValueBits(8, ByteOrder.NATIVE_ORDER).withName("kind").
         MemoryLayout.ofPaddingBits(32),
         MemoryLayout.ofPaddingBits(32)
 ));
@@ -161,11 +159,14 @@
  * This is important when obtaining memory access var handle from layouts, as in the following code:
  *
  * <blockquote><pre>{@code
-VarHandle valueHandle = seq.map(int.class, PathElement.sequenceElement(), PathElement.groupElement("value"));
+VarHandle valueHandle = taggedValues.varHandle(int.class,
+                                               PathElement.sequenceElement(),
+                                               PathElement.groupElement("value"));
  * }</pre></blockquote>
  *
- * Since the layout path {@code seq} constructed in the above example features exactly one free dimension,
- * it follows that the memory access var handle {@code valueHandle} will feature an extra {@code long}
+ * Since the layout path constructed in the above example features exactly one free dimension (as it doesn't specify
+ * <em>which</em> member layout named {@code value} should be selected from the enclosing sequence layout),
+ * it follows that the memory access var handle {@code valueHandle} will feature an <em>additional</em> {@code long}
  * access coordinate.
  *
  * <h2>Layout attributes</h2>
@@ -180,7 +181,7 @@
  * explicitly permitted types.
  *
  * @implSpec
- * Implementations of this class are immutable and thread-safe.
+ * Implementations of this interface are immutable, thread-safe and <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>.
  */
 public interface MemoryLayout extends Constable {
 
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java	Thu Jun 25 03:11:32 2020 +0200
@@ -44,7 +44,7 @@
 /**
  * A memory segment models a contiguous region of memory. A memory segment is associated with both spatial
  * and temporal bounds. Spatial bounds ensure that memory access operations on a memory segment cannot affect a memory location
- * which falls <em>outside</em> the boundaries of the memory segment being accessed. Temporal checks ensure that memory access
+ * which falls <em>outside</em> the boundaries of the memory segment being accessed. Temporal bounds ensure that memory access
  * operations on a segment cannot occur after a memory segment has been closed (see {@link MemorySegment#close()}).
  * <p>
  * All implementations of this interface must be <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>;
@@ -76,12 +76,22 @@
  * Finally, it is also possible to obtain a memory segment backed by a memory-mapped file using the factory method
  * {@link MemorySegment#mapFromPath(Path, long, long, FileChannel.MapMode)}. Such memory segments are called <em>mapped memory segments</em>
  * (see {@link MappedMemorySegment}).
+ * <p>
+ * Array and buffer segments are effectively <em>views</em> over existing memory regions which might outlive the
+ * lifecycle of the segments derived from them, and can even be manipulated directly (e.g. via array access, or direct use
+ * of the {@link ByteBuffer} API) by other clients. As a result, while sharing array or buffer segments is possible,
+ * it is strongly advised that clients wishing to do so take extra precautions to make sure that the underlying memory sources
+ * associated with such segments remain inaccessible, and that said memory sources are never aliased by more than one segment
+ * at a time - e.g. so as to prevent concurrent modifications of the contents of an array, or buffer segment.
  *
  * <h2>Closing a memory segment</h2>
  *
- * Memory segments are closed explicitly (see {@link MemorySegment#close()}). In general when a segment is closed, all off-heap
- * resources associated with it are released; this has different meanings depending on the kind of memory segment being
- * considered:
+ * Memory segments are closed explicitly (see {@link MemorySegment#close()}). When a segment is closed, it is no longer
+ * <em>alive</em> (see {@link #isAlive()}, and subsequent operation on the segment (or on any {@link MemoryAddress} instance
+ * derived from it) will fail with {@link IllegalStateException}.
+ * <p>
+ * Closing a segment might trigger the releasing of the underlying memory resources associated with said segment, depending on
+ * the kind of memory segment being considered:
  * <ul>
  *     <li>closing a native memory segment results in <em>freeing</em> the native memory associated with it</li>
  *     <li>closing a mapped memory segment results in the backing memory-mapped file to be unmapped</li>
@@ -92,32 +102,6 @@
  *     objects.</li>
  * </ul>
  *
- * <h2><a id = "thread-confinement">Thread confinement</a></h2>
- *
- * Memory segments support strong thread-confinement guarantees. Upon creation, they are assigned an <em>owner thread</em>,
- * typically the thread which initiated the creation operation. After creation, only the owner thread will be allowed
- * to directly manipulate the memory segment (e.g. close the memory segment) or access the underlying memory associated with
- * the segment using a memory access var handle. Any attempt to perform such operations from a thread other than the
- * owner thread will result in a runtime failure.
- * <p>
- * Memory segments support <em>serial thread confinement</em>; that is, ownership of a memory segment can change (see
- * {@link #withOwnerThread(Thread)}). This allows, for instance, for two threads {@code A} and {@code B} to share
- * a segment in a controlled, cooperative and race-free fashion.
- * <p>
- * In some cases, it might be useful for multiple threads to process the contents of the same memory segment concurrently
- * (e.g. in the case of parallel processing); while memory segments provide strong confinement guarantees, it is possible
- * to obtain a {@link Spliterator} from a segment, which can be used to slice the segment and allow multiple thread to
- * work in parallel on disjoint segment slices (this assumes that the access mode {@link #ACQUIRE} is set).
- * For instance, the following code can be used to sum all int values in a memory segment in parallel:
- * <blockquote><pre>{@code
-MemorySegment segment = ...
-SequenceLayout SEQUENCE_LAYOUT = MemoryLayout.ofSequence(1024, MemoryLayouts.JAVA_INT);
-VarHandle VH_int = SEQUENCE_LAYOUT.elementLayout().varHandle(int.class);
-int sum = StreamSupport.stream(MemorySegment.spliterator(segment, SEQUENCE_LAYOUT), true)
-            .mapToInt(s -> (int)VH_int.get(s.baseAddress()))
-            .sum();
- * }</pre></blockquote>
- *
  * <h2><a id = "access-modes">Access modes</a></h2>
  *
  * Memory segments supports zero or more <em>access modes</em>. Supported access modes are {@link #READ},
@@ -152,12 +136,38 @@
  * {@link ByteBuffer} API, but need to operate on large memory segments. Byte buffers obtained in such a way support
  * the same spatial and temporal access restrictions associated to the memory segment from which they originated.
  *
+ * <h2><a id = "thread-confinement">Thread confinement</a></h2>
+ *
+ * Memory segments support strong thread-confinement guarantees. Upon creation, they are assigned an <em>owner thread</em>,
+ * typically the thread which initiated the creation operation. After creation, only the owner thread will be allowed
+ * to directly manipulate the memory segment (e.g. close the memory segment) or access the underlying memory associated with
+ * the segment using a memory access var handle. Any attempt to perform such operations from a thread other than the
+ * owner thread will result in a runtime failure.
+ * <p>
+ * Memory segments support <em>serial thread confinement</em>; that is, ownership of a memory segment can change (see
+ * {@link #withOwnerThread(Thread)}). This allows, for instance, for two threads {@code A} and {@code B} to share
+ * a segment in a controlled, cooperative and race-free fashion.
+ * <p>
+ * In some cases, it might be useful for multiple threads to process the contents of the same memory segment concurrently
+ * (e.g. in the case of parallel processing); while memory segments provide strong confinement guarantees, it is possible
+ * to obtain a {@link Spliterator} from a segment, which can be used to slice the segment and allow multiple thread to
+ * work in parallel on disjoint segment slices (this assumes that the access mode {@link #ACQUIRE} is set).
+ * For instance, the following code can be used to sum all int values in a memory segment in parallel:
+ * <blockquote><pre>{@code
+MemorySegment segment = ...
+SequenceLayout SEQUENCE_LAYOUT = MemoryLayout.ofSequence(1024, MemoryLayouts.JAVA_INT);
+VarHandle VH_int = SEQUENCE_LAYOUT.elementLayout().varHandle(int.class);
+int sum = StreamSupport.stream(MemorySegment.spliterator(segment, SEQUENCE_LAYOUT), true)
+                       .mapToInt(s -> (int)VH_int.get(s.baseAddress()))
+                       .sum();
+ * }</pre></blockquote>
+ *
  * @apiNote In the future, if the Java language permits, {@link MemorySegment}
  * may become a {@code sealed} interface, which would prohibit subclassing except by
  * {@link MappedMemorySegment} and other explicitly permitted subtypes.
  *
  * @implSpec
- * Implementations of this interface are immutable and thread-safe.
+ * Implementations of this interface are immutable, thread-safe and <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>.
  */
 public interface MemorySegment extends AutoCloseable {
 
@@ -276,8 +286,8 @@
 
     /**
      * Closes this memory segment. Once a memory segment has been closed, any attempt to use the memory segment,
-     * or to access the memory associated with the segment will fail with {@link IllegalStateException}. Depending on
-     * the kind of memory segment being closed, calling this method further trigger deallocation of all the resources
+     * or to access any {@link MemoryAddress} instance associated with it will fail with {@link IllegalStateException}.
+     * Depending on the kind of memory segment being closed, calling this method further triggers deallocation of all the resources
      * associated with the memory segment.
      * @throws IllegalStateException if this segment is not <em>alive</em>, or if access occurs from a thread other than the
      * thread owning this segment, or if the segment cannot be closed because it is being operated upon by a different
@@ -610,8 +620,8 @@
      * (often as a plain {@code long} value). The segment will feature all <a href="#access-modes">access modes</a>
      * (see {@link #ALL_ACCESS}).
      * <p>
-     * This method is <em>restricted</em>. Restricted method are unsafe, and, if used incorrectly, their use might crash
-     * the JVM crash or, worse, silently result in memory corruption. Thus, clients should refrain from depending on
+     * This method is <em>restricted</em>. Restricted methods are unsafe, and, if used incorrectly, their use might crash
+     * the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on
      * restricted methods, and use safe and supported functionalities, where possible.
      *
      * @param addr the desired base address
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java	Thu Jun 25 03:11:32 2020 +0200
@@ -25,29 +25,7 @@
  */
 
 /**
- * <p> Classes to support low-level, safe and efficient memory access. For example:
- *
- * <pre>{@code
-static final VarHandle intHandle = MemoryHandles.varHandle(int.class, ByteOrder.BIG_ENDIAN);
-
-try (MemorySegment segment = MemorySegment.allocateNative(10 * 4)) {
-   MemoryAddress base = segment.baseAddress();
-   for (long i = 0 ; i < 10 ; i++) {
-     intHandle.set(base.addOffset(i * 4), (int)i);
-   }
- }
- * }</pre>
- *
- * Here we create a var handle, namely {@code intHandle}, to manipulate values of the primitive type {@code int}, at
- * a given memory location. We then create a <em>native</em> memory segment, that is, a memory segment backed by
- * off-heap memory; the size of the segment is 40 bytes, enough to store 10 values of the primitive type {@code int}.
- * The segment is created inside a <em>try-with-resources</em> construct: this idiom ensures that all the memory resources
- * associated with the segment will be released at the end of the block, according to the semantics described in
- * Section {@jls 14.20.3} of <cite>The Java&trade; Language Specification</cite>. Inside the try-with-resources block, we initialize
- * the contents of the memory segment; more specifically, if we view the memory segment as a set of 10 adjacent slots,
- * {@code s[i]}, where {@code 0 <= i < 10}, where the size of each slot is exactly 4 bytes, the initialization logic above will set each slot
- * so that {@code s[i] = i}, again where {@code 0 <= i < 10}.
- *
+ * <p> Classes to support low-level, safe and efficient memory access.
  * <p>
  * The key abstractions introduced by this package are {@link jdk.incubator.foreign.MemorySegment} and {@link jdk.incubator.foreign.MemoryAddress}.
  * The first models a contiguous memory region, which can reside either inside or outside the Java heap; the latter models an address - which can
@@ -57,6 +35,32 @@
  * layout, obtain its alignment requirements, and so on. Memory layouts also provide an alternate, more abstract way, to produce
  * memory access var handles, e.g. using <a href="MemoryLayout.html#layout-paths"><em>layout paths</em></a>.
  *
+ * For example, to allocate an off-heap memory region big enough to hold 10 values of the primitive type {@code int}, and fill it with values
+ * ranging from {@code 0} to {@code 9}, we can use the following code:
+ *
+ * <pre>{@code
+static final VarHandle intHandle = MemoryHandles.varHandle(int.class, ByteOrder.nativeOrder());
+
+try (MemorySegment segment = MemorySegment.allocateNative(10 * 4)) {
+    MemoryAddress base = segment.baseAddress();
+    for (long i = 0 ; i < 10 ; i++) {
+       intHandle.set(base.addOffset(i * 4), (int)i);
+    }
+}
+ * }</pre>
+ *
+ * Here we create a var handle, namely {@code intHandle}, to manipulate values of the primitive type {@code int}, at
+ * a given memory location. Also, {@code intHandle} is stored in a {@code static} and {@code final} field, to achieve
+ * better performance and allow for inlining of the memory access operation through the {@link java.lang.invoke.VarHandle}
+ * instance. We then create a <em>native</em> memory segment, that is, a memory segment backed by
+ * off-heap memory; the size of the segment is 40 bytes, enough to store 10 values of the primitive type {@code int}.
+ * The segment is created inside a <em>try-with-resources</em> construct: this idiom ensures that all the memory resources
+ * associated with the segment will be released at the end of the block, according to the semantics described in
+ * Section {@jls 14.20.3} of <cite>The Java&trade; Language Specification</cite>. Inside the try-with-resources block, we initialize
+ * the contents of the memory segment; more specifically, if we view the memory segment as a set of 10 adjacent slots,
+ * {@code s[i]}, where {@code 0 <= i < 10}, where the size of each slot is exactly 4 bytes, the initialization logic above will set each slot
+ * so that {@code s[i] = i}, again where {@code 0 <= i < 10}.
+ *
  * <h2><a id="deallocation"></a>Deterministic deallocation</h2>
  *
  * When writing code that manipulates memory segments, especially if backed by memory which resides outside the Java heap, it is
--- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java	Thu Jun 25 03:11:32 2020 +0200
@@ -149,14 +149,19 @@
 
         long i = 0;
         if (length > 7) {
-            i = ArraysSupport.vectorizedMismatchLarge(
+            if ((byte) BYTE_HANDLE.get(this.baseAddress(), 0) != (byte) BYTE_HANDLE.get(that.baseAddress(), 0)) {
+                return 0;
+            }
+            i = ArraysSupport.vectorizedMismatchLargeForBytes(
                     this.base(), this.min(),
                     that.base(), that.min(),
-                    length, ArraysSupport.LOG2_ARRAY_BYTE_INDEX_SCALE);
+                    length);
             if (i >= 0) {
                 return i;
             }
-            i = length - ~i;
+            long remaining = ~i;
+            assert remaining < 8 : "remaining greater than 7: " + remaining;
+            i = length - remaining;
         }
         MemoryAddress thisAddress = this.baseAddress();
         MemoryAddress thatAddress = that.baseAddress();
--- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MemoryAddressImpl.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MemoryAddressImpl.java	Thu Jun 25 03:11:32 2020 +0200
@@ -54,17 +54,6 @@
         this.offset = offset;
     }
 
-    public static void copy(MemoryAddressImpl src, MemoryAddressImpl dst, long size) {
-        src.checkAccess(0, size, true);
-        dst.checkAccess(0, size, false);
-        //check disjoint
-        long offsetSrc = src.unsafeGetOffset();
-        long offsetDst = dst.unsafeGetOffset();
-        Object baseSrc = src.unsafeGetBase();
-        Object baseDst = dst.unsafeGetBase();
-        UNSAFE.copyMemory(baseSrc, offsetSrc, baseDst, offsetDst, size);
-    }
-
     // MemoryAddress methods
 
     @Override
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java	Thu Jun 25 03:11:32 2020 +0200
@@ -305,10 +305,12 @@
             // Ignore custom icon if any as we don't want to copy anything in
             // Java Runtime image.
             installerIcon = ApplicationLayout.javaRuntime()
+                    .resolveAt(appDir.toPath())
                     .runtimeDirectory()
                     .resolve(Path.of("bin", "java.exe"));
         } else {
             installerIcon = ApplicationLayout.windowsAppImage()
+                    .resolveAt(appDir.toPath())
                     .launchersDirectory()
                     .resolve(APP_NAME.fetchFrom(params) + ".exe");
         }
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs	Thu Jun 25 03:11:32 2020 +0200
@@ -87,8 +87,10 @@
     <?endif?>
 
     <CustomAction Id="JpSetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
+
     <?ifdef JpIcon ?>
-    <CustomAction Id="JpSetARPPRODUCTICON" Property="ARPPRODUCTICON" Value="[INSTALLDIR]$(var.JpIcon)" />
+    <Property Id="ARPPRODUCTICON" Value="JpARPPRODUCTICON"/>
+    <Icon Id="JpARPPRODUCTICON" SourceFile="$(var.JpIcon)"/>
     <?endif?>
 
     <UI>
@@ -140,9 +142,6 @@
 
     <InstallExecuteSequence>
       <Custom Action="JpSetARPINSTALLLOCATION" After="CostFinalize">Not Installed</Custom>
-      <?ifdef JpIcon ?>
-      <Custom Action="JpSetARPPRODUCTICON" After="JpSetARPINSTALLLOCATION">Not Installed</Custom>
-      <?endif?>
     </InstallExecuteSequence>
   </Product>
 </Wix>
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Thu Jun 25 03:11:32 2020 +0200
@@ -773,6 +773,11 @@
     native void ensureInitialized(HotSpotResolvedObjectTypeImpl type);
 
     /**
+     * Forces linking of {@code type}.
+     */
+    native void ensureLinked(HotSpotResolvedObjectTypeImpl type);
+
+    /**
      * Checks if {@code object} is a String and is an interned string value.
      */
     native boolean isInternedString(HotSpotObjectConstantImpl object);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java	Thu Jun 25 03:11:32 2020 +0200
@@ -146,6 +146,18 @@
         return true;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * It's possible for the HotSpot runtime to sweep nmethods at any point in time. As a result,
+     * there is no guarantee that calling this method will execute the wrapped nmethod. Instead, it
+     * may end up executing the bytecode of the associated {@link #getMethod() Java method}. Only if
+     * {@link #isValid()} is {@code true} after returning can the caller be sure that the nmethod
+     * was executed. If {@link #isValid()} is {@code false}, then the only way to determine if the
+     * nmethod was executed is to test for some side-effect specific to the nmethod (e.g., update to
+     * a field) that is not performed by the bytecode of the associated {@link #getMethod() Java
+     * method}.
+     */
     @Override
     public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
         if (IS_IN_NATIVE_IMAGE) {
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu Jun 25 03:11:32 2020 +0200
@@ -372,6 +372,27 @@
         return isArray() ? true : getInitState() >= config().instanceKlassStateLinked;
     }
 
+    @Override
+    public void link() {
+        if (!isLinked()) {
+            runtime().compilerToVm.ensureLinked(this);
+        }
+    }
+
+    @Override
+    public boolean hasDefaultMethods() {
+        HotSpotVMConfig config = config();
+        int miscFlags = UNSAFE.getChar(getMetaspaceKlass() + config.instanceKlassMiscFlagsOffset);
+        return (miscFlags & config.jvmMiscFlagsHasDefaultMethods) != 0;
+    }
+
+    @Override
+    public boolean declaresDefaultMethods() {
+        HotSpotVMConfig config = config();
+        int miscFlags = UNSAFE.getChar(getMetaspaceKlass() + config.instanceKlassMiscFlagsOffset);
+        return (miscFlags & config.jvmMiscFlagsDeclaresDefaultMethods) != 0;
+    }
+
     /**
      * Returns the value of the state field {@code InstanceKlass::_init_state} of the metaspace
      * klass.
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Thu Jun 25 03:11:32 2020 +0200
@@ -251,6 +251,20 @@
     }
 
     @Override
+    public void link() {
+    }
+
+    @Override
+    public boolean hasDefaultMethods() {
+        return false;
+    }
+
+    @Override
+    public boolean declaresDefaultMethods() {
+        return false;
+    }
+
+    @Override
     public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedType) {
         return null;
     }
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Thu Jun 25 03:11:32 2020 +0200
@@ -137,6 +137,9 @@
     final int jvmAccEnum = getConstant("JVM_ACC_ENUM", Integer.class);
     final int jvmAccInterface = getConstant("JVM_ACC_INTERFACE", Integer.class);
 
+    final int jvmMiscFlagsHasDefaultMethods = getConstant("InstanceKlass::_misc_has_nonstatic_concrete_methods", Integer.class);
+    final int jvmMiscFlagsDeclaresDefaultMethods = getConstant("InstanceKlass::_misc_declares_nonstatic_concrete_methods", Integer.class);
+
     // This is only valid on AMD64.
     final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
 
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Thu Jun 25 03:11:32 2020 +0200
@@ -106,6 +106,30 @@
     boolean isLinked();
 
     /**
+     * Links this type. If this method returns normally, then future calls of {@link #isLinked} will
+     * return true and future calls of {@link #link} are no-ops. If the method throws an exception,
+     * then future calls of {@link #isLinked} will return false and future calls of {@link #link}
+     * will reattempt the linking step which might succeed or throw an exception.
+     */
+    default void link() {
+        throw new UnsupportedOperationException("link is unsupported");
+    }
+
+    /**
+     * Checks whether this type or any of its supertypes or superinterfaces has default methods.
+     */
+    default boolean hasDefaultMethods() {
+        throw new UnsupportedOperationException("hasDefaultMethods is unsupported");
+    }
+
+    /**
+     * Checks whether this type declares defaults methods.
+     */
+    default boolean declaresDefaultMethods() {
+        throw new UnsupportedOperationException("declaresDefaultMethods is unsupported");
+    }
+
+    /**
      * Determines if this type is either the same as, or is a superclass or superinterface of, the
      * type represented by the specified parameter. This method is identical to
      * {@link Class#isAssignableFrom(Class)} in terms of the value return for this type.
@@ -308,13 +332,15 @@
 
     /**
      * Returns an array reflecting all the constructors declared by this type. This method is
-     * similar to {@link Class#getDeclaredConstructors()} in terms of returned constructors.
+     * similar to {@link Class#getDeclaredConstructors()} in terms of returned constructors. Calling
+     * this method forces this type to be {@link #link linked}.
      */
     ResolvedJavaMethod[] getDeclaredConstructors();
 
     /**
      * Returns an array reflecting all the methods declared by this type. This method is similar to
-     * {@link Class#getDeclaredMethods()} in terms of returned methods.
+     * {@link Class#getDeclaredMethods()} in terms of returned methods. Calling this method forces
+     * this type to be {@link #link linked}.
      */
     ResolvedJavaMethod[] getDeclaredMethods();
 
--- a/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Thu Jun 25 03:11:32 2020 +0200
@@ -25,6 +25,7 @@
 
 package com.sun.management;
 
+import java.io.IOException;
 import java.lang.management.PlatformManagedObject;
 
 /**
@@ -72,7 +73,7 @@
      *         method denies write access to the named file
      *         or the caller does not have ManagmentPermission("control").
      */
-    public void dumpHeap(String outputFile, boolean live) throws java.io.IOException;
+    public void dumpHeap(String outputFile, boolean live) throws IOException;
 
     /**
      * Returns a list of {@code VMOption} objects for all diagnostic options.
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Jun 25 03:11:32 2020 +0200
@@ -49,6 +49,9 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.AccessibleObject;
@@ -64,6 +67,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 import jdk.internal.org.objectweb.asm.*;
@@ -335,6 +339,111 @@
         }
     }
 
+    @Test
+    public void linkTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            type.link();
+        }
+    }
+
+    private class HidingClassLoader extends ClassLoader {
+        @Override
+        protected Class<?> findClass(final String name) throws ClassNotFoundException {
+            if (name.endsWith("MissingInterface")) {
+                throw new ClassNotFoundException("missing");
+            }
+            byte[] classData = null;
+            try {
+                InputStream is = HidingClassLoader.class.getResourceAsStream("/" + name.replace('.', '/') + ".class");
+                classData = new byte[is.available()];
+                new DataInputStream(is).readFully(classData);
+            } catch (IOException e) {
+                Assert.fail("can't access class: " + name);
+            }
+
+            return defineClass(null, classData, 0, classData.length);
+        }
+
+        ResolvedJavaType lookupJavaType(String name) throws ClassNotFoundException {
+            return metaAccess.lookupJavaType(loadClass(name));
+        }
+
+        HidingClassLoader() {
+            super(null);
+        }
+
+    }
+
+    interface MissingInterface {
+    }
+
+    static class MissingInterfaceImpl implements MissingInterface {
+    }
+
+    interface SomeInterface {
+        default MissingInterface someMethod() {
+            return new MissingInterfaceImpl();
+        }
+    }
+
+    static class Wrapper implements SomeInterface {
+    }
+
+    @Test
+    public void linkExceptionTest() throws ClassNotFoundException {
+        HidingClassLoader cl = new HidingClassLoader();
+        ResolvedJavaType inner = cl.lookupJavaType(Wrapper.class.getName());
+        assertTrue("expected default methods", inner.hasDefaultMethods());
+        try {
+            inner.link();
+            assertFalse("link should throw an exception", true);
+        } catch (NoClassDefFoundError e) {
+        }
+    }
+
+    @Test
+    public void hasDefaultMethodsTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            assertEquals(hasDefaultMethods(type), type.hasDefaultMethods());
+        }
+    }
+
+    @Test
+    public void declaresDefaultMethodsTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            assertEquals(declaresDefaultMethods(type), type.declaresDefaultMethods());
+        }
+    }
+
+    private static boolean hasDefaultMethods(ResolvedJavaType type) {
+        if (!type.isInterface() && type.getSuperclass() != null && hasDefaultMethods(type.getSuperclass())) {
+            return true;
+        }
+        for (ResolvedJavaType iface : type.getInterfaces()) {
+            if (hasDefaultMethods(iface)) {
+                return true;
+            }
+        }
+        return declaresDefaultMethods(type);
+    }
+
+    static boolean declaresDefaultMethods(ResolvedJavaType type) {
+        if (!type.isInterface()) {
+            /* Only interfaces can declare default methods. */
+            return false;
+        }
+        for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
+            if (method.isDefault()) {
+                assert !Modifier.isStatic(method.getModifiers()) : "Default method that is static?";
+                return true;
+            }
+        }
+        return false;
+    }
+
     private static class Base {
     }
 
--- a/test/jdk/ProblemList.txt	Thu Jun 25 02:54:12 2020 +0200
+++ b/test/jdk/ProblemList.txt	Thu Jun 25 03:11:32 2020 +0200
@@ -920,3 +920,13 @@
 # jdk_internal
 
 ############################################################################
+
+# jdk_jpackage
+
+tools/jpackage/share/EmptyFolderPackageTest.java                8248059 macosx-all
+tools/jpackage/share/IconTest.java                              8248059 macosx-all
+tools/jpackage/share/AppImagePackageTest.java                   8248059 macosx-all
+tools/jpackage/share/SimplePackageTest.java                     8248059 macosx-all
+tools/jpackage/share/jdk/jpackage/tests/BasicTest.java          8248059 macosx-all
+
+############################################################################
--- a/test/jdk/java/foreign/TestMismatch.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/test/jdk/java/foreign/TestMismatch.java	Thu Jun 25 03:11:32 2020 +0200
@@ -117,12 +117,28 @@
             assertEquals(s1.mismatch(s2), -1);
             assertEquals(s2.mismatch(s1), -1);
 
-            for (long i = s2.byteSize() -1 ; i >= Integer.MAX_VALUE - 10L; i--) {
-                BYTE_HANDLE.set(s2.baseAddress().addOffset(i), (byte) 0xFF);
-                long expectedMismatchOffset = i;
-                assertEquals(s1.mismatch(s2), expectedMismatchOffset);
-                assertEquals(s2.mismatch(s1), expectedMismatchOffset);
-            }
+            testLargeAcrossMaxBoundary(s1, s2);
+
+            testLargeMismatchAcrossMaxBoundary(s1, s2);
+        }
+    }
+
+    private void testLargeAcrossMaxBoundary(MemorySegment s1, MemorySegment s2) {
+        for (long i = s2.byteSize() -1 ; i >= Integer.MAX_VALUE - 10L; i--) {
+            var s3 = s1.asSlice(0, i);
+            var s4 = s2.asSlice(0, i);
+            assertEquals(s3.mismatch(s3), -1);
+            assertEquals(s3.mismatch(s4), -1);
+            assertEquals(s4.mismatch(s3), -1);
+        }
+    }
+
+    private void testLargeMismatchAcrossMaxBoundary(MemorySegment s1, MemorySegment s2) {
+        for (long i = s2.byteSize() -1 ; i >= Integer.MAX_VALUE - 10L; i--) {
+            BYTE_HANDLE.set(s2.baseAddress().addOffset(i), (byte) 0xFF);
+            long expectedMismatchOffset = i;
+            assertEquals(s1.mismatch(s2), expectedMismatchOffset);
+            assertEquals(s2.mismatch(s1), expectedMismatchOffset);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java	Thu Jun 25 03:11:32 2020 +0200
@@ -0,0 +1,563 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Checks that the appropriate value is given to the canonical ctr
+ * @compile --enable-preview -source ${jdk.version} DifferentStreamFieldsTest.java
+ * @run testng/othervm --enable-preview DifferentStreamFieldsTest
+ * @run testng/othervm/java.security.policy=empty_security.policy --enable-preview DifferentStreamFieldsTest
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.io.ObjectStreamConstants.SC_SERIALIZABLE;
+import static java.io.ObjectStreamConstants.STREAM_MAGIC;
+import static java.io.ObjectStreamConstants.STREAM_VERSION;
+import static java.io.ObjectStreamConstants.TC_CLASSDESC;
+import static java.io.ObjectStreamConstants.TC_ENDBLOCKDATA;
+import static java.io.ObjectStreamConstants.TC_NULL;
+import static java.io.ObjectStreamConstants.TC_OBJECT;
+import static java.io.ObjectStreamConstants.TC_STRING;
+import static java.lang.System.out;
+import static org.testng.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InvalidClassException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.io.UncheckedIOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Checks that the appropriate value is given to the canonical ctr.
+ */
+public class DifferentStreamFieldsTest {
+
+    record R01(boolean x) implements Serializable {}
+
+    record R02(byte x) implements Serializable {}
+
+    record R03(short x) implements Serializable {}
+
+    record R04(char x) implements Serializable {}
+
+    record R05(int x) implements Serializable {}
+
+    record R06(long x) implements Serializable {}
+
+    record R07(float x) implements Serializable {}
+
+    record R08(double x) implements Serializable {}
+
+    record R09(Object x) implements Serializable {}
+
+    record R10(String x) implements Serializable {}
+
+    record R11(int[]x) implements Serializable {}
+
+    record R12(Object[]x) implements Serializable {}
+
+    record R13(R12 x) implements Serializable {}
+
+    record R14(R13[]x) implements Serializable {}
+
+    @DataProvider(name = "recordTypeAndExpectedValue")
+    public Object[][] recordTypeAndExpectedValue() {
+        return new Object[][]{
+            new Object[]{R01.class, false},
+            new Object[]{R02.class, (byte) 0},
+            new Object[]{R03.class, (short) 0},
+            new Object[]{R04.class, '\u0000'},
+            new Object[]{R05.class, 0},
+            new Object[]{R06.class, 0L},
+            new Object[]{R07.class, 0.0f},
+            new Object[]{R08.class, 0.0d},
+            new Object[]{R09.class, null},
+            new Object[]{R10.class, null},
+            new Object[]{R11.class, null},
+            new Object[]{R12.class, null},
+            new Object[]{R13.class, null},
+            new Object[]{R14.class, null}
+        };
+    }
+
+    @Test(dataProvider = "recordTypeAndExpectedValue")
+    public void testWithDifferentTypes(Class<?> clazz, Object expectedXValue)
+    throws Exception {
+        out.println("\n---");
+        assert clazz.isRecord();
+        byte[] bytes = SerialByteStreamBuilder
+            .newBuilder(clazz.getName())
+            .build();
+
+        Object obj = deserialize(bytes);
+        out.println("deserialized: " + obj);
+        Object actualXValue = clazz.getDeclaredMethod("x").invoke(obj);
+        assertEquals(actualXValue, expectedXValue);
+
+        bytes = SerialByteStreamBuilder
+            .newBuilder(clazz.getName())
+            .addPrimitiveField("y", int.class, 5)  // stream junk
+            .build();
+
+        obj = deserialize(bytes);
+        out.println("deserialized: " + obj);
+        actualXValue = clazz.getDeclaredMethod("x").invoke(obj);
+        assertEquals(actualXValue, expectedXValue);
+    }
+
+    // --- all together
+
+    @Test
+    public void testWithAllTogether() throws Exception {
+        out.println("\n---");
+        record R15(boolean a, byte b, short c, char d, int e, long f, float g,
+                   double h, Object i, String j, long[]k, Object[]l)
+            implements Serializable {}
+
+        byte[] bytes = SerialByteStreamBuilder
+            .newBuilder(R15.class.getName())
+            .addPrimitiveField("x", int.class, 5)  // stream junk
+            .build();
+
+        R15 obj = deserialize(bytes);
+        out.println("deserialized: " + obj);
+        assertEquals(obj.a, false);
+        assertEquals(obj.b, 0);
+        assertEquals(obj.c, 0);
+        assertEquals(obj.d, '\u0000');
+        assertEquals(obj.e, 0);
+        assertEquals(obj.f, 0l);
+        assertEquals(obj.g, 0f);
+        assertEquals(obj.h, 0d);
+        assertEquals(obj.i, null);
+        assertEquals(obj.j, null);
+        assertEquals(obj.k, null);
+        assertEquals(obj.l, null);
+    }
+
+    @Test
+    public void testInt() throws Exception {
+        out.println("\n---");
+        {
+            record R(int x) implements Serializable {}
+
+            var r = new R(5);
+            byte[] OOSBytes = serialize(r);
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())
+                .addPrimitiveField("x", int.class, 5)
+                .build();
+
+            var deser1 = deserialize(OOSBytes);
+            assertEquals(deser1, r);
+            var deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+        }
+        {
+            record R(int x, int y) implements Serializable {}
+
+            var r = new R(7, 8);
+            byte[] OOSBytes = serialize(r);
+            var deser1 = deserialize(OOSBytes);
+            assertEquals(deser1, r);
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())
+                .addPrimitiveField("x", int.class, 7)
+                .addPrimitiveField("y", int.class, 8)
+                .build();
+
+            var deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+
+            builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())
+                .addPrimitiveField("y", int.class, 8)  // reverse order
+                .addPrimitiveField("x", int.class, 7)
+                .build();
+            deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+
+            builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())
+                .addPrimitiveField("w", int.class, 6) // additional fields
+                .addPrimitiveField("x", int.class, 7)
+                .addPrimitiveField("y", int.class, 8)
+                .addPrimitiveField("z", int.class, 9) // additional fields
+                .build();
+            deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+
+            r = new R(0, 0);
+            OOSBytes = serialize(r);
+            deser1 = deserialize(OOSBytes);
+            assertEquals(deser1, r);
+
+            builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())
+                .addPrimitiveField("y", int.class, 0)
+                .addPrimitiveField("x", int.class, 0)
+                .build();
+            deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+
+            builderBytes = SerialByteStreamBuilder
+                .newBuilder(R.class.getName())  // no field values
+                .build();
+            deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+        }
+    }
+
+    @Test
+    public void testString() throws Exception {
+        out.println("\n---");
+
+        record Str(String part1, String part2) implements Serializable {}
+
+        var r = new Str("Hello", "World!");
+        var deser1 = deserialize(serialize(r));
+        assertEquals(deser1, r);
+
+        byte[] builderBytes = SerialByteStreamBuilder
+            .newBuilder(Str.class.getName())
+            .addField("part1", String.class, "Hello")
+            .addField("part2", String.class, "World!")
+            .build();
+
+        var deser2 = deserialize(builderBytes);
+        assertEquals(deser2, deser1);
+
+        builderBytes = SerialByteStreamBuilder
+            .newBuilder(Str.class.getName())
+            .addField("cruft", String.class, "gg")
+            .addField("part1", String.class, "Hello")
+            .addField("part2", String.class, "World!")
+            .addPrimitiveField("x", int.class, 13)
+            .build();
+
+        var deser3 = deserialize(builderBytes);
+        assertEquals(deser3, deser1);
+    }
+
+    @Test
+    public void testArrays() throws Exception {
+        out.println("\n---");
+        {
+            record IntArray(int[]ints, long[]longs) implements Serializable {}
+            IntArray r = new IntArray(new int[]{5, 4, 3, 2, 1}, new long[]{9L});
+            IntArray deser1 = deserialize(serialize(r));
+            assertEquals(deser1.ints(), r.ints());
+            assertEquals(deser1.longs(), r.longs());
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(IntArray.class.getName())
+                .addField("ints", int[].class, new int[]{5, 4, 3, 2, 1})
+                .addField("longs", long[].class, new long[]{9L})
+                .build();
+
+            IntArray deser2 = deserialize(builderBytes);
+            assertEquals(deser2.ints(), deser1.ints());
+            assertEquals(deser2.longs(), deser1.longs());
+        }
+        {
+            record StrArray(String[]stringArray) implements Serializable {}
+            StrArray r = new StrArray(new String[]{"foo", "bar"});
+            StrArray deser1 = deserialize(serialize(r));
+            assertEquals(deser1.stringArray(), r.stringArray());
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(StrArray.class.getName())
+                .addField("stringArray", String[].class, new String[]{"foo", "bar"})
+                .build();
+
+            StrArray deser2 = deserialize(builderBytes);
+            assertEquals(deser2.stringArray(), deser1.stringArray());
+        }
+    }
+
+    @Test
+    public void testCompatibleFieldTypeChange() throws Exception {
+        out.println("\n---");
+
+        {
+            record NumberHolder(Number n) implements Serializable {}
+
+            var r = new NumberHolder(123);
+            var deser1 = deserialize(serialize(r));
+            assertEquals(deser1, r);
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(NumberHolder.class.getName())
+                .addField("n", Integer.class, 123)
+                .build();
+
+            var deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+        }
+
+        {
+            record IntegerHolder(Integer i) implements Serializable {}
+
+            var r = new IntegerHolder(123);
+            var deser1 = deserialize(serialize(r));
+            assertEquals(deser1, r);
+
+            byte[] builderBytes = SerialByteStreamBuilder
+                .newBuilder(IntegerHolder.class.getName())
+                .addField("i", Number.class, 123)
+                .build();
+
+            var deser2 = deserialize(builderBytes);
+            assertEquals(deser2, deser1);
+        }
+    }
+
+    @Test
+    public void testIncompatibleRefFieldTypeChange() throws Exception {
+        out.println("\n---");
+
+        record StringHolder(String s) implements Serializable {}
+
+        var r = new StringHolder("123");
+        var deser1 = deserialize(serialize(r));
+        assertEquals(deser1, r);
+
+        byte[] builderBytes = SerialByteStreamBuilder
+            .newBuilder(StringHolder.class.getName())
+            .addField("s", Integer.class, 123)
+            .build();
+
+        try {
+            var deser2 = deserialize(builderBytes);
+            throw new AssertionError(
+                "Unexpected success of deserialization. Deserialized value: " + deser2);
+        } catch (InvalidObjectException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testIncompatiblePrimitiveFieldTypeChange() throws Exception {
+        out.println("\n---");
+
+        record IntHolder(int i) implements Serializable {}
+
+        var r = new IntHolder(123);
+        var deser1 = deserialize(serialize(r));
+        assertEquals(deser1, r);
+
+        byte[] builderBytes = SerialByteStreamBuilder
+            .newBuilder(IntHolder.class.getName())
+            .addPrimitiveField("i", long.class, 123L)
+            .build();
+
+        try {
+            var deser2 = deserialize(builderBytes);
+            throw new AssertionError(
+                "Unexpected success of deserialization. Deserialized value: " + deser2);
+        } catch (InvalidClassException e) {
+            // expected
+        }
+    }
+
+    <T> byte[] serialize(T obj) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(obj);
+        oos.close();
+        return baos.toByteArray();
+    }
+
+    @SuppressWarnings("unchecked")
+    static <T> T deserialize(byte[] streamBytes)
+    throws IOException, ClassNotFoundException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(streamBytes);
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        return (T) ois.readObject();
+    }
+
+    static class SerialByteStreamBuilder {
+
+        private final ObjectOutputStream objectOutputStream;
+        private final ByteArrayOutputStream byteArrayOutputStream;
+
+        record NameAndType<T>(String name, Class<T>type) {}
+
+        private String className;
+        private final LinkedHashMap<NameAndType<?>, Object> primFields = new LinkedHashMap<>();
+        private final LinkedHashMap<NameAndType<?>, Object> objectFields = new LinkedHashMap<>();
+
+        private SerialByteStreamBuilder() {
+            try {
+                byteArrayOutputStream = new ByteArrayOutputStream();
+                objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+        }
+
+        public static SerialByteStreamBuilder newBuilder(String className) {
+            return (new SerialByteStreamBuilder()).className(className);
+        }
+
+        private SerialByteStreamBuilder className(String className) {
+            this.className = className;
+            return this;
+        }
+
+        public <T> SerialByteStreamBuilder addPrimitiveField(String name, Class<T> type, T value) {
+            if (!type.isPrimitive())
+                throw new IllegalArgumentException("Unexpected non-primitive field: " + type);
+            primFields.put(new NameAndType<>(name, type), value);
+            return this;
+        }
+
+        public <T> SerialByteStreamBuilder addField(String name, Class<T> type, T value) {
+            if (type.isPrimitive())
+                throw new IllegalArgumentException("Unexpected primitive field: " + type);
+            objectFields.put(new NameAndType<>(name, type), value);
+            return this;
+        }
+
+        private static int getPrimitiveSignature(Class<?> cl) {
+            if (cl == Integer.TYPE) return 'I';
+            else if (cl == Byte.TYPE) return 'B';
+            else if (cl == Long.TYPE) return 'J';
+            else if (cl == Float.TYPE) return 'F';
+            else if (cl == Double.TYPE) return 'D';
+            else if (cl == Short.TYPE) return 'S';
+            else if (cl == Character.TYPE) return 'C';
+            else if (cl == Boolean.TYPE) return 'Z';
+            else throw new InternalError();
+        }
+
+        private static void writeUTF(DataOutputStream out, String str) throws IOException {
+            int utflen = str.length(); // assume ASCII
+            assert utflen <= 0xFFFF;
+            out.writeShort(utflen);
+            out.writeBytes(str);
+        }
+
+        private void writePrimFieldsDesc(DataOutputStream out) throws IOException {
+            for (Map.Entry<NameAndType<?>, Object> entry : primFields.entrySet()) {
+                assert entry.getKey().type() != void.class;
+                out.writeByte(getPrimitiveSignature(entry.getKey().type())); // prim_typecode
+                out.writeUTF(entry.getKey().name());                         // fieldName
+            }
+        }
+
+        private void writePrimFieldsValues(DataOutputStream out) throws IOException {
+            for (Map.Entry<NameAndType<?>, Object> entry : primFields.entrySet()) {
+                Class<?> cl = entry.getKey().type();
+                Object value = entry.getValue();
+                if (cl == Integer.TYPE) out.writeInt((int) value);
+                else if (cl == Byte.TYPE) out.writeByte((byte) value);
+                else if (cl == Long.TYPE) out.writeLong((long) value);
+                else if (cl == Float.TYPE) out.writeFloat((float) value);
+                else if (cl == Double.TYPE) out.writeDouble((double) value);
+                else if (cl == Short.TYPE) out.writeShort((short) value);
+                else if (cl == Character.TYPE) out.writeChar((char) value);
+                else if (cl == Boolean.TYPE) out.writeBoolean((boolean) value);
+                else throw new InternalError();
+            }
+        }
+
+        private void writeObjectFieldDesc(DataOutputStream out) throws IOException {
+            for (Map.Entry<NameAndType<?>, Object> entry : objectFields.entrySet()) {
+                Class<?> cl = entry.getKey().type();
+                assert !cl.isPrimitive();
+                // obj_typecode
+                if (cl.isArray()) {
+                    out.writeByte('[');
+                } else {
+                    out.writeByte('L');
+                }
+                writeUTF(out, entry.getKey().name());
+                out.writeByte(TC_STRING);
+                writeUTF(out,
+                         (cl.isArray() ? cl.getName() : "L" + cl.getName() + ";")
+                             .replace('.', '/'));
+            }
+        }
+
+        private void writeObject(DataOutputStream out, Object value) throws IOException {
+            objectOutputStream.reset();
+            byteArrayOutputStream.reset();
+            objectOutputStream.writeUnshared(value);
+            out.write(byteArrayOutputStream.toByteArray());
+        }
+
+        private void writeObjectFieldValues(DataOutputStream out) throws IOException {
+            for (Map.Entry<NameAndType<?>, Object> entry : objectFields.entrySet()) {
+                Class<?> cl = entry.getKey().type();
+                assert !cl.isPrimitive();
+                if (cl == String.class) {
+                    out.writeByte(TC_STRING);
+                    writeUTF(out, (String) entry.getValue());
+                } else {
+                    writeObject(out, entry.getValue());
+                }
+            }
+        }
+
+        private int numFields() {
+            return primFields.size() + objectFields.size();
+        }
+
+        public byte[] build() {
+            try {
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                DataOutputStream dos = new DataOutputStream(baos);
+                dos.writeShort(STREAM_MAGIC);
+                dos.writeShort(STREAM_VERSION);
+                dos.writeByte(TC_OBJECT);
+                dos.writeByte(TC_CLASSDESC);
+                dos.writeUTF(className);
+                dos.writeLong(0L);
+                dos.writeByte(SC_SERIALIZABLE);
+                dos.writeShort(numFields());      // number of fields
+                writePrimFieldsDesc(dos);
+                writeObjectFieldDesc(dos);
+                dos.writeByte(TC_ENDBLOCKDATA);   // no annotations
+                dos.writeByte(TC_NULL);           // no superclasses
+                writePrimFieldsValues(dos);
+                writeObjectFieldValues(dos);
+                dos.close();
+                return baos.toByteArray();
+            } catch (IOException unexpected) {
+                throw new AssertionError(unexpected);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/doclint/AccessibilityTest5.java	Thu Jun 25 03:11:32 2020 +0200
@@ -0,0 +1,30 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8247955
+ * @summary Add new doclint package
+ * @modules jdk.compiler/com.sun.tools.doclint
+ * @build DocLintTester
+ * @run main DocLintTester -XhtmlVersion:html5 -Xmsgs:-accessibility AccessibilityTest5.java
+ * @run main DocLintTester -XhtmlVersion:html5 -ref AccessibilityTest5.out AccessibilityTest5.java
+ */
+
+// This test should be merged into AccessibilityTest.java when we drop support for html4.
+
+/** */
+public class AccessibilityTest5 {
+    /**
+     * <table><caption>ok</caption><tr><th>head<tr><td>data</table>
+     */
+    public void table_with_caption() { }
+
+    /**
+     * <table><tr><th>head<tr><td>data</table>
+     */
+    public void table_without_caption() { }
+
+    /**
+     * <table role="presentation"><tr><th>head<tr><td>data</table>
+     */
+    public void table_presentation() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/doclint/AccessibilityTest5.out	Thu Jun 25 03:11:32 2020 +0200
@@ -0,0 +1,4 @@
+AccessibilityTest5.java:21: error: no summary or caption for table
+     * <table><tr><th>head<tr><td>data</table>
+                                      ^
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/bench/java/io/RecordDeserialization.java	Thu Jun 25 03:11:32 2020 +0200
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+
+Sample runs on Ryzen 3700X:
+
+before 8247532:
+
+Benchmark                                 (length)  Mode  Cnt     Score    Error  Units
+RecordDeserialization.deserializeClasses        10  avgt   10     8.382 :  0.013  us/op
+RecordDeserialization.deserializeClasses       100  avgt   10    33.736 :  0.171  us/op
+RecordDeserialization.deserializeClasses      1000  avgt   10   271.224 :  0.953  us/op
+RecordDeserialization.deserializeRecords        10  avgt   10    58.606 :  0.446  us/op
+RecordDeserialization.deserializeRecords       100  avgt   10   530.044 :  1.752  us/op
+RecordDeserialization.deserializeRecords      1000  avgt   10  5335.624 : 44.942  us/op
+
+after 8247532:
+
+Benchmark                                 (length)  Mode  Cnt    Score   Error  Units
+RecordDeserialization.deserializeClasses        10  avgt   10    8.681 : 0.155  us/op
+RecordDeserialization.deserializeClasses       100  avgt   10   32.496 : 0.087  us/op
+RecordDeserialization.deserializeClasses      1000  avgt   10  279.014 : 1.189  us/op
+RecordDeserialization.deserializeRecords        10  avgt   10    8.537 : 0.032  us/op
+RecordDeserialization.deserializeRecords       100  avgt   10   31.451 : 0.083  us/op
+RecordDeserialization.deserializeRecords      1000  avgt   10  250.854 : 2.772  us/op
+
+*/
+
+package org.openjdk.bench.java.io;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.io.UncheckedIOException;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+
+/**
+ * A micro benchmark used to measure/compare the performance of
+ * de-serializing record(s) vs. classical class(es)
+ */
+@BenchmarkMode(Mode.AverageTime)
+@Warmup(iterations = 5, time = 1)
+@Measurement(iterations = 10, time = 1)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@State(Scope.Thread)
+@Fork(value = 1, warmups = 0, jvmArgsAppend = "--enable-preview")
+public class RecordDeserialization {
+
+    public record PointR(int x, int y) implements Serializable {}
+
+    public record LineR(PointR p1, PointR p2) implements Serializable {}
+
+    public static class PointC implements Serializable {
+        private final int x, y;
+
+        public PointC(int x, int y) {
+            this.x = x;
+            this.y = y;
+        }
+    }
+
+    public static class LineC implements Serializable {
+        private final PointC p1, p2;
+
+        public LineC(PointC p1, PointC p2) {
+            this.p1 = p1;
+            this.p2 = p2;
+        }
+    }
+
+    private byte[] lineRsBytes, lineCsBytes;
+
+    private static LineR newLineR() {
+        ThreadLocalRandom rnd = ThreadLocalRandom.current();
+        return new LineR(new PointR(rnd.nextInt(), rnd.nextInt()),
+                         new PointR(rnd.nextInt(), rnd.nextInt()));
+    }
+
+    private static LineC newLineC() {
+        ThreadLocalRandom rnd = ThreadLocalRandom.current();
+        return new LineC(new PointC(rnd.nextInt(), rnd.nextInt()),
+                         new PointC(rnd.nextInt(), rnd.nextInt()));
+    }
+
+    private static byte[] serialize(Object o) {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(o);
+            oos.close();
+            return baos.toByteArray();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    private static Object deserialize(byte[] bytes) {
+        try {
+            return new ObjectInputStream(new ByteArrayInputStream(bytes))
+                .readObject();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Param({"10", "100", "1000"})
+    public int length;
+
+    @Setup(Level.Trial)
+    public void setup() {
+        LineR[] lineRs = IntStream
+            .range(0, length)
+            .mapToObj(i -> newLineR())
+            .toArray(LineR[]::new);
+        lineRsBytes = serialize(lineRs);
+
+        LineC[] lineCs = IntStream
+            .range(0, length)
+            .mapToObj(i -> newLineC())
+            .toArray(LineC[]::new);
+        lineCsBytes = serialize(lineCs);
+    }
+
+    @Benchmark
+    public Object deserializeRecords() {
+        return deserialize(lineRsBytes);
+    }
+
+    @Benchmark
+    public Object deserializeClasses() {
+        return deserialize(lineCsBytes);
+    }
+}
--- a/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java	Thu Jun 25 02:54:12 2020 +0200
+++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java	Thu Jun 25 03:11:32 2020 +0200
@@ -35,6 +35,7 @@
 import sun.misc.Unsafe;
 
 import jdk.incubator.foreign.MemorySegment;
+import java.nio.ByteBuffer;
 import java.util.concurrent.TimeUnit;
 
 import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT;
@@ -60,6 +61,36 @@
     static final MemorySegment bytesSegment = MemorySegment.ofArray(bytes);
     static final int UNSAFE_INT_OFFSET = unsafe.arrayBaseOffset(int[].class);
 
+    // large(ish) segments/buffers with same content, 0, for mismatch, non-multiple-of-8 sized
+    static final int SIZE_WITH_TAIL = (1024 * 1024) + 7;
+    static final MemorySegment mismatchSegmentLarge1 = MemorySegment.allocateNative(SIZE_WITH_TAIL);
+    static final MemorySegment mismatchSegmentLarge2 = MemorySegment.allocateNative(SIZE_WITH_TAIL);
+    static final ByteBuffer mismatchBufferLarge1 = ByteBuffer.allocateDirect(SIZE_WITH_TAIL);
+    static final ByteBuffer mismatchBufferLarge2 = ByteBuffer.allocateDirect(SIZE_WITH_TAIL);
+
+    // mismatch at first byte
+    static final MemorySegment mismatchSegmentSmall1 = MemorySegment.allocateNative(7);
+    static final MemorySegment mismatchSegmentSmall2 = MemorySegment.allocateNative(7);
+    static final ByteBuffer mismatchBufferSmall1 = ByteBuffer.allocateDirect(7);
+    static final ByteBuffer mismatchBufferSmall2 = ByteBuffer.allocateDirect(7);
+    static {
+        mismatchSegmentSmall1.fill((byte) 0xFF);
+        mismatchBufferSmall1.put((byte) 0xFF).clear();
+        // verify expected mismatch indices
+        long si = mismatchSegmentLarge1.mismatch(mismatchSegmentLarge2);
+        if (si != -1)
+            throw new AssertionError("Unexpected mismatch index:" + si);
+        int bi = mismatchBufferLarge1.mismatch(mismatchBufferLarge2);
+        if (bi != -1)
+            throw new AssertionError("Unexpected mismatch index:" + bi);
+        si = mismatchSegmentSmall1.mismatch(mismatchSegmentSmall2);
+        if (si != 0)
+            throw new AssertionError("Unexpected mismatch index:" + si);
+        bi = mismatchBufferSmall1.mismatch(mismatchBufferSmall2);
+        if (bi != 0)
+            throw new AssertionError("Unexpected mismatch index:" + bi);
+    }
+
     static {
         for (int i = 0 ; i < bytes.length ; i++) {
             bytes[i] = i;
@@ -89,4 +120,28 @@
     public void segment_copy() {
         segment.copyFrom(bytesSegment);
     }
+
+    @Benchmark
+    @OutputTimeUnit(TimeUnit.NANOSECONDS)
+    public long mismatch_large_segment() {
+        return mismatchSegmentLarge1.mismatch(mismatchSegmentLarge2);
+    }
+
+    @Benchmark
+    @OutputTimeUnit(TimeUnit.NANOSECONDS)
+    public int mismatch_large_bytebuffer() {
+        return mismatchBufferLarge1.mismatch(mismatchBufferLarge2);
+    }
+
+    @Benchmark
+    @OutputTimeUnit(TimeUnit.NANOSECONDS)
+    public long mismatch_small_segment() {
+        return mismatchSegmentSmall1.mismatch(mismatchSegmentSmall2);
+    }
+
+    @Benchmark
+    @OutputTimeUnit(TimeUnit.NANOSECONDS)
+    public int mismatch_small_bytebuffer() {
+        return mismatchBufferSmall1.mismatch(mismatchBufferSmall2);
+    }
 }