diff --git a/.hgtags b/.hgtags
index d7337a81d90..80b71948ce8 100644
--- a/.hgtags
+++ b/.hgtags
@@ -642,3 +642,5 @@ f143729ca00ec14a98ea5c7f73acba88da97746e jdk-15+23
 4a485c89d5a08b495961835f5308a96038678aeb jdk-16+1
 06c9f89459daba98395fad726100feb44f89ba71 jdk-15+28
 bcbe7b8a77b8971bc221c0be1bd2abb6fb68c2d0 jdk-16+2
+b58fc60580550a4a587cab729d8fd87223ad6932 jdk-15+29
+76810b3a88c8c641ae3850a8dfd7c40c984aea9d jdk-16+3
diff --git a/bin/nashorn/runopt.sh b/bin/nashorn/runopt.sh
deleted file mode 100644
index bc99095721d..00000000000
--- a/bin/nashorn/runopt.sh
+++ /dev/null
@@ -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 ${@}
-
-
diff --git a/doc/nashorn/DEVELOPER_README b/doc/nashorn/DEVELOPER_README
deleted file mode 100644
index 78f50823494..00000000000
--- a/doc/nashorn/DEVELOPER_README
+++ /dev/null
@@ -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
-
diff --git a/doc/nashorn/JavaScriptingProgrammersGuide.html b/doc/nashorn/JavaScriptingProgrammersGuide.html
deleted file mode 100644
index ae56c3fadf6..00000000000
--- a/doc/nashorn/JavaScriptingProgrammersGuide.html
+++ /dev/null
@@ -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>
diff --git a/doc/nashorn/source/EvalFile.java b/doc/nashorn/source/EvalFile.java
deleted file mode 100644
index b12e91bb53f..00000000000
--- a/doc/nashorn/source/EvalFile.java
+++ /dev/null
@@ -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]));
-    }
-}
-
diff --git a/doc/nashorn/source/EvalScript.java b/doc/nashorn/source/EvalScript.java
deleted file mode 100644
index 49f581deabc..00000000000
--- a/doc/nashorn/source/EvalScript.java
+++ /dev/null
@@ -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')");
-    }
-}
-
diff --git a/doc/nashorn/source/InvokeScriptFunction.java b/doc/nashorn/source/InvokeScriptFunction.java
deleted file mode 100644
index 5ce1cae0a42..00000000000
--- a/doc/nashorn/source/InvokeScriptFunction.java
+++ /dev/null
@@ -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!!" );
-    }
-}
-
-
-
diff --git a/doc/nashorn/source/InvokeScriptMethod.java b/doc/nashorn/source/InvokeScriptMethod.java
deleted file mode 100644
index d3cc788d09d..00000000000
--- a/doc/nashorn/source/InvokeScriptMethod.java
+++ /dev/null
@@ -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 !!" );
-    }
-}
diff --git a/doc/nashorn/source/MultiScopes.java b/doc/nashorn/source/MultiScopes.java
deleted file mode 100644
index ff4f65b4684..00000000000
--- a/doc/nashorn/source/MultiScopes.java
+++ /dev/null
@@ -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"
-    }
-}
-
-
diff --git a/doc/nashorn/source/RunnableImpl.java b/doc/nashorn/source/RunnableImpl.java
deleted file mode 100644
index 2b5113b103c..00000000000
--- a/doc/nashorn/source/RunnableImpl.java
+++ /dev/null
@@ -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();
-    }
-}
diff --git a/doc/nashorn/source/RunnableImplObject.java b/doc/nashorn/source/RunnableImplObject.java
deleted file mode 100644
index 0d5f5032e89..00000000000
--- a/doc/nashorn/source/RunnableImplObject.java
+++ /dev/null
@@ -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();
-    }
-}
diff --git a/doc/nashorn/source/ScriptVars.java b/doc/nashorn/source/ScriptVars.java
deleted file mode 100644
index c697431dc18..00000000000
--- a/doc/nashorn/source/ScriptVars.java
+++ /dev/null
@@ -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())");
-    }
-}
-
-
-
diff --git a/doc/nashorn/source/importpackageclass.js b/doc/nashorn/source/importpackageclass.js
deleted file mode 100644
index 224debd6e4a..00000000000
--- a/doc/nashorn/source/importpackageclass.js
+++ /dev/null
@@ -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);
diff --git a/doc/nashorn/source/javaarray.js b/doc/nashorn/source/javaarray.js
deleted file mode 100644
index 659619107fc..00000000000
--- a/doc/nashorn/source/javaarray.js
+++ /dev/null
@@ -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);
diff --git a/doc/nashorn/source/javaextend.js b/doc/nashorn/source/javaextend.js
deleted file mode 100644
index f1c6256b012..00000000000
--- a/doc/nashorn/source/javaextend.js
+++ /dev/null
@@ -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);
diff --git a/doc/nashorn/source/javaimporter.js b/doc/nashorn/source/javaimporter.js
deleted file mode 100644
index 5004ce889d1..00000000000
--- a/doc/nashorn/source/javaimporter.js
+++ /dev/null
@@ -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);
-}
-
-
diff --git a/doc/nashorn/source/javatypes.js b/doc/nashorn/source/javatypes.js
deleted file mode 100644
index 82392ec4495..00000000000
--- a/doc/nashorn/source/javatypes.js
+++ /dev/null
@@ -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
-
diff --git a/doc/nashorn/source/overload.js b/doc/nashorn/source/overload.js
deleted file mode 100644
index a2905f94d3c..00000000000
--- a/doc/nashorn/source/overload.js
+++ /dev/null
@@ -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");
-
diff --git a/doc/nashorn/source/runnable.js b/doc/nashorn/source/runnable.js
deleted file mode 100644
index 346c2522a36..00000000000
--- a/doc/nashorn/source/runnable.js
+++ /dev/null
@@ -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();
diff --git a/doc/nashorn/source/samfunc.js b/doc/nashorn/source/samfunc.js
deleted file mode 100644
index dbb321d0f55..00000000000
--- a/doc/nashorn/source/samfunc.js
+++ /dev/null
@@ -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();
diff --git a/doc/nashorn/source/test.js b/doc/nashorn/source/test.js
deleted file mode 100644
index 56e96ef26ad..00000000000
--- a/doc/nashorn/source/test.js
+++ /dev/null
@@ -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");
diff --git a/doc/testing.html b/doc/testing.html
index ae38528722f..49227421dcf 100644
--- a/doc/testing.html
+++ b/doc/testing.html
@@ -137,6 +137,8 @@ <h4 id="jobs-1">JOBS</h4>
 <h4 id="timeout_factor-1">TIMEOUT_FACTOR</h4>
 <p>The timeout factor (<code>-timeoutFactor</code>).</p>
 <p>Defaults to 4.</p>
+<h4 id="failure_handler_timeout">FAILURE_HANDLER_TIMEOUT</h4>
+<p>Sets the argument <code>-timeoutHandlerTimeout</code> for JTReg. The default value is 0. This is only valid if the failure handler is built.</p>
 <h4 id="test_mode">TEST_MODE</h4>
 <p>The test mode (<code>agentvm</code> or <code>othervm</code>).</p>
 <p>Defaults to <code>agentvm</code>.</p>
@@ -153,8 +155,10 @@ <h4 id="max_mem">MAX_MEM</h4>
 <p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
 <p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
 <p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
+<h4 id="max_output">MAX_OUTPUT</h4>
+<p>Set the property <code>javatest.maxOutputSize</code> for the launcher, to change the default JTReg log limit.</p>
 <h4 id="keywords">KEYWORDS</h4>
-<p>JTReg kewords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
+<p>JTReg keywords sent to JTReg using <code>-k</code>. Please be careful in making sure that spaces and special characters (like <code>!</code>) are properly quoted. To avoid some issues, the special value <code>%20</code> can be used instead of space.</p>
 <h4 id="extra_problem_lists">EXTRA_PROBLEM_LISTS</h4>
 <p>Use additional problem lists file or files, in addition to the default ProblemList.txt located at the JTReg test roots.</p>
 <p>If multiple file names are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
@@ -170,6 +174,8 @@ <h4 id="java_options-1">JAVA_OPTIONS</h4>
 <h4 id="vm_options-1">VM_OPTIONS</h4>
 <p>Additional Java options to be used when compiling and running classes (sent to JTReg as <code>-vmoption</code>).</p>
 <p>This option is only needed in special circumstances. To pass Java options to your test classes, use <code>JAVA_OPTIONS</code>.</p>
+<h4 id="launcher_options">LAUNCHER_OPTIONS</h4>
+<p>Additional Java options that are sent to the java launcher that starts the JTReg harness.</p>
 <h4 id="aot_modules-1">AOT_MODULES</h4>
 <p>Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
 <h4 id="retry_count">RETRY_COUNT</h4>
@@ -205,14 +211,19 @@ <h3 id="docker-tests">Docker Tests</h3>
 <p>Docker tests with default parameters may fail on systems with glibc versions not compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:</p>
 <pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot;</code></pre>
 <p>To run these tests correctly, additional parameters for the correct docker image are required on Ubuntu 18.04 by using <code>JAVA_OPTIONS</code>.</p>
-<pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot; JTREG=&quot;JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest&quot;</code></pre>
+<pre><code>$ make test TEST=&quot;jtreg:test/hotspot/jtreg/containers/docker&quot; \
+    JTREG=&quot;JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
+    -Djdk.test.docker.image.version=latest&quot;</code></pre>
 <h3 id="non-us-locale">Non-US locale</h3>
-<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG=&quot;en_US&quot;</code> in the environment before running tests should work. On Windows, setting <code>JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot;</code> helps for most, but not all test cases. For example:</p>
+<p>If your locale is non-US, some tests are likely to fail. To work around this you can set the locale to US. On Unix platforms simply setting <code>LANG=&quot;en_US&quot;</code> in the environment before running tests should work. On Windows, setting <code>JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot;</code> helps for most, but not all test cases.</p>
+<p>For example:</p>
 <pre><code>$ export LANG=&quot;en_US&quot; &amp;&amp; make test TEST=...
 $ make test JTREG=&quot;VM_OPTIONS=-Duser.language=en -Duser.country=US&quot; TEST=...</code></pre>
 <h3 id="pkcs11-tests">PKCS11 Tests</h3>
-<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories. For example:</p>
-<pre><code>$ make test TEST=&quot;jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java&quot; JTREG=&quot;JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs&quot;</code></pre>
+<p>It is highly recommended to use the latest NSS version when running PKCS11 tests. Improper NSS version may lead to unexpected failures which are hard to diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu 18.04 with the default NSS version in the system. To run these tests correctly, the system property <code>test.nss.lib.paths</code> is required on Ubuntu 18.04 to specify the alternative NSS lib directories.</p>
+<p>For example:</p>
+<pre><code>$ make test TEST=&quot;jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java&quot; \
+    JTREG=&quot;JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs&quot;</code></pre>
 <p>For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.</p>
 <h3 id="client-ui-tests">Client UI Tests</h3>
 <p>Some Client UI tests use key sequences which may be reserved by the operating system. Usually that causes the test failure. So it is highly recommended to disable system key shortcuts prior testing. The steps to access and disable system key shortcuts for various platforms are provided below.</p>
diff --git a/doc/testing.md b/doc/testing.md
index 8a42ea92e69..0d09491be6e 100644
--- a/doc/testing.md
+++ b/doc/testing.md
@@ -37,11 +37,11 @@ Note that this option should point to the JTReg home, i.e. the top directory,
 containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME`
 environment variable to point to the JTReg home before running `configure`.)
 
-To be able to run microbenchmarks, `configure` needs to know where to find
-the JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
-containing the core JMH and transitive dependencies. The recommended dependencies
-can be retrieved by running `sh make/devkit/createJMHBundle.sh`, after which
-`--with-jmh=build/jmh/jars` should work.
+To be able to run microbenchmarks, `configure` needs to know where to find the
+JMH dependency. Use `--with-jmh=<path to JMH jars>` to point to a directory
+containing the core JMH and transitive dependencies. The recommended
+dependencies can be retrieved by running `sh make/devkit/createJMHBundle.sh`,
+after which `--with-jmh=build/jmh/jars` should work.
 
 ## Test selection
 
@@ -182,10 +182,10 @@ variables.
 These variables use a keyword=value approach to allow multiple values to be
 set. So, for instance, `JTREG="JOBS=1;TIMEOUT_FACTOR=8"` will set the JTReg
 concurrency level to 1 and the timeout factor to 8. This is equivalent to
-setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format means that
-the `JTREG` variable is parsed and verified for correctness, so
-`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8` would just
-pass unnoticed.
+setting `JTREG_JOBS=1 JTREG_TIMEOUT_FACTOR=8`, but using the keyword format
+means that the `JTREG` variable is parsed and verified for correctness, so
+`JTREG="TMIEOUT_FACTOR=8"` would give an error, while `JTREG_TMIEOUT_FACTOR=8`
+would just pass unnoticed.
 
 To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell
 normally eats `;`, the recommended usage is to write the assignment inside
@@ -203,9 +203,10 @@ test suites.
 
 ### General keywords (TEST_OPTS)
 
-Some keywords are valid across different test suites. If you want to run
-tests from multiple test suites, or just don't want to care which test suite specific
-control variable to use, then you can use the general TEST_OPTS control variable.
+Some keywords are valid across different test suites. If you want to run tests
+from multiple test suites, or just don't want to care which test suite specific
+control variable to use, then you can use the general TEST_OPTS control
+variable.
 
 There are also some keywords that applies globally to the test runner system,
 not to any specific test suites. These are also available as TEST_OPTS keywords.
@@ -252,12 +253,13 @@ for only recently changed code. JCOV_DIFF_CHANGESET specifies a source
 revision. A textual report will be generated showing coverage of the diff
 between the specified revision and the repository tip.
 
-The report is stored in `build/$BUILD/test-results/jcov-output/diff_coverage_report`
-file.
+The report is stored in
+`build/$BUILD/test-results/jcov-output/diff_coverage_report` file.
 
 ### JTReg keywords
 
 #### JOBS
+
 The test concurrency (`-concurrency`).
 
 Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to
@@ -265,32 +267,43 @@ JOBS, except for Hotspot, where the default is *number of CPU cores/2*,
 but never more than *memory size in GB/2*.
 
 #### TIMEOUT_FACTOR
+
 The timeout factor (`-timeoutFactor`).
 
 Defaults to 4.
 
+#### FAILURE_HANDLER_TIMEOUT
+
+Sets the argument `-timeoutHandlerTimeout` for JTReg. The default value is 0.
+This is only valid if the failure handler is built.
+
 #### TEST_MODE
+
 The test mode (`agentvm` or `othervm`).
 
 Defaults to `agentvm`.
 
 #### ASSERT
+
 Enable asserts (`-ea -esa`, or none).
 
 Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except
 for hotspot.
 
 #### VERBOSE
+
 The verbosity level (`-verbose`).
 
 Defaults to `fail,error,summary`.
 
 #### RETAIN
+
 What test data to retain (`-retain`).
 
 Defaults to `fail,error`.
 
 #### MAX_MEM
+
 Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none).
 
 Limit memory consumption for JTReg test framework and VM under test. Set to 0
@@ -298,9 +311,14 @@ to disable the limits.
 
 Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
 
+#### MAX_OUTPUT
+
+Set the property `javatest.maxOutputSize` for the launcher, to change the
+default JTReg log limit.
+
 #### KEYWORDS
 
-JTReg kewords sent to JTReg using `-k`. Please be careful in making sure that
+JTReg keywords sent to JTReg using `-k`. Please be careful in making sure that
 spaces and special characters (like `!`) are properly quoted. To avoid some
 issues, the special value `%20` can be used instead of space.
 
@@ -323,23 +341,30 @@ Set to `true` or `false`.
 If `true`, JTReg will use `-match:` option, otherwise `-exclude:` will be used.
 Default is `false`.
 
-
 #### OPTIONS
+
 Additional options to the JTReg test framework.
 
 Use `JTREG="OPTIONS=--help all"` to see all available JTReg options.
 
 #### JAVA_OPTIONS
+
 Additional Java options for running test classes (sent to JTReg as
 `-javaoption`).
 
 #### VM_OPTIONS
+
 Additional Java options to be used when compiling and running classes (sent to
 JTReg as `-vmoption`).
 
 This option is only needed in special circumstances. To pass Java options to
 your test classes, use `JAVA_OPTIONS`.
 
+#### LAUNCHER_OPTIONS
+
+Additional Java options that are sent to the java launcher that starts the
+JTReg harness.
+
 #### AOT_MODULES
 
 Generate AOT modules before testing for the specified module, or set of
@@ -353,6 +378,7 @@ Retry failed tests up to a set number of times. Defaults to 0.
 ### Gtest keywords
 
 #### REPEAT
+
 The number of times to repeat the tests (`--gtest_repeat`).
 
 Default is 1. Set to -1 to repeat indefinitely. This can be especially useful
@@ -360,6 +386,7 @@ combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent
 problem.
 
 #### OPTIONS
+
 Additional options to the Gtest test framework.
 
 Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
@@ -373,98 +400,127 @@ modules. If multiple modules are specified, they should be separated by space
 ### Microbenchmark keywords
 
 #### FORK
+
 Override the number of benchmark forks to spawn. Same as specifying `-f <num>`.
 
 #### ITER
+
 Number of measurement iterations per fork. Same as specifying `-i <num>`.
 
 #### TIME
+
 Amount of time to spend in each measurement iteration, in seconds. Same as
 specifying `-r <num>`
 
 #### WARMUP_ITER
+
 Number of warmup iterations to run before the measurement phase in each fork.
 Same as specifying `-wi <num>`.
 
 #### WARMUP_TIME
+
 Amount of time to spend in each warmup iteration. Same as specifying `-w <num>`.
 
 #### RESULTS_FORMAT
+
 Specify to have the test run save a log of the values. Accepts the same values
 as `-rff`, i.e., `text`, `csv`, `scsv`, `json`, or `latex`.
 
 #### VM_OPTIONS
+
 Additional VM arguments to provide to forked off VMs. Same as `-jvmArgs <args>`
 
 #### OPTIONS
+
 Additional arguments to send to JMH.
 
 ## Notes for Specific Tests
 
 ### Docker Tests
 
-Docker tests with default parameters may fail on systems with glibc versions not
-compatible with the one used in the default docker image (e.g., Oracle Linux 7.6 for x86).
-For example, they pass on Ubuntu 16.04 but fail on Ubuntu 18.04 if run like this on x86:
+Docker tests with default parameters may fail on systems with glibc versions
+not compatible with the one used in the default docker image (e.g., Oracle
+Linux 7.6 for x86). For example, they pass on Ubuntu 16.04 but fail on Ubuntu
+18.04 if run like this on x86:
 
-    $ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
+```
+$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker"
+```
 
-To run these tests correctly, additional parameters for the correct docker image are
-required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
+To run these tests correctly, additional parameters for the correct docker
+image are required on Ubuntu 18.04 by using `JAVA_OPTIONS`.
 
-    $ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"
+```
+$ make test TEST="jtreg:test/hotspot/jtreg/containers/docker" \
+    JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu
+    -Djdk.test.docker.image.version=latest"
+```
 
 ### Non-US locale
 
-If your locale is non-US, some tests are likely to fail. To work around this you can
-set the locale to US. On Unix platforms simply setting `LANG="en_US"` in the
-environment before running tests should work. On Windows, setting
-`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but not all test cases.
+If your locale is non-US, some tests are likely to fail. To work around this
+you can set the locale to US. On Unix platforms simply setting `LANG="en_US"`
+in the environment before running tests should work. On Windows, setting
+`JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US"` helps for most, but
+not all test cases.
+
 For example:
 
-    $ export LANG="en_US" && make test TEST=...
-    $ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
+```
+$ export LANG="en_US" && make test TEST=...
+$ make test JTREG="VM_OPTIONS=-Duser.language=en -Duser.country=US" TEST=...
+```
 
 ### PKCS11 Tests
 
-It is highly recommended to use the latest NSS version when running PKCS11 tests.
-Improper NSS version may lead to unexpected failures which are hard to diagnose.
-For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail on Ubuntu
-18.04 with the default NSS version in the system.
-To run these tests correctly, the system property `test.nss.lib.paths` is required
-on Ubuntu 18.04 to specify the alternative NSS lib directories.
+It is highly recommended to use the latest NSS version when running PKCS11
+tests. Improper NSS version may lead to unexpected failures which are hard to
+diagnose. For example, sun/security/pkcs11/Secmod/AddTrustedCert.java may fail
+on Ubuntu 18.04 with the default NSS version in the system. To run these tests
+correctly, the system property `test.nss.lib.paths` is required on Ubuntu 18.04
+to specify the alternative NSS lib directories.
+
 For example:
 
-    $ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
+```
+$ make test TEST="jtreg:sun/security/pkcs11/Secmod/AddTrustedCert.java" \
+    JTREG="JAVA_OPTIONS=-Dtest.nss.lib.paths=/path/to/your/latest/NSS-libs"
+```
 
-For more notes about the PKCS11 tests, please refer to test/jdk/sun/security/pkcs11/README.
+For more notes about the PKCS11 tests, please refer to
+test/jdk/sun/security/pkcs11/README.
 
 ### Client UI Tests
 
 Some Client UI tests use key sequences which may be reserved by the operating
-system. Usually that causes the test failure. So it is highly recommended to disable
-system key shortcuts prior testing. The steps to access and disable system key shortcuts
-for various platforms are provided below.
+system. Usually that causes the test failure. So it is highly recommended to
+disable system key shortcuts prior testing. The steps to access and disable
+system key shortcuts for various platforms are provided below.
 
 #### MacOS
+
 Choose Apple menu; System Preferences, click Keyboard, then click Shortcuts;
 select or deselect desired shortcut.
 
-For example, test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java fails
-on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip message
-but the key combination is reserved by the operating system. To run the test correctly
-the default global key shortcut should be disabled using the steps described above, and then deselect
-"Turn keyboard access on or off" option which is responsible for `CTRL + F1` combination.
+For example,
+test/jdk/javax/swing/TooltipManager/JMenuItemToolTipKeyBindingsTest/JMenuItemToolTipKeyBindingsTest.java
+fails on MacOS because it uses `CTRL + F1` key sequence to show or hide tooltip
+message but the key combination is reserved by the operating system. To run the
+test correctly the default global key shortcut should be disabled using the
+steps described above, and then deselect "Turn keyboard access on or off"
+option which is responsible for `CTRL + F1` combination.
 
 #### Linux
-Open the Activities overview and start typing Settings; Choose Settings, click Devices,
-then click Keyboard; set or override desired shortcut.
+
+Open the Activities overview and start typing Settings; Choose Settings, click
+Devices, then click Keyboard; set or override desired shortcut.
 
 #### Windows
-Type `gpedit` in the Search and then click Edit group policy; navigate to
-User Configuration -> Administrative Templates -> Windows Components -> File Explorer;
-in the right-side pane look for "Turn off Windows key hotkeys" and double click on it;
-enable or disable hotkeys.
+
+Type `gpedit` in the Search and then click Edit group policy; navigate to User
+Configuration -> Administrative Templates -> Windows Components -> File
+Explorer; in the right-side pane look for "Turn off Windows key hotkeys" and
+double click on it; enable or disable hotkeys.
 
 Note: restart is required to make the settings take effect.
 
diff --git a/make/CompileToolsHotspot.gmk b/make/CompileToolsHotspot.gmk
index 30d00894430..1603ef93114 100644
--- a/make/CompileToolsHotspot.gmk
+++ b/make/CompileToolsHotspot.gmk
@@ -36,6 +36,24 @@ TARGETS :=
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, hotspot/CompileTools.gmk))
 
+################################################################################
+# Build tools needed for the JFR source code generation
+
+HOTSPOT_TOOLS_SRCDIR := $(TOPDIR)/make/src/classes
+
+HOTSPOT_TOOLS_OUTPUTDIR := $(BUILDTOOLS_OUTPUTDIR)/buildtools/hotspot_tools_classes
+
+$(eval $(call SetupJavaCompilation, BUILD_TOOLS_HOTSPOT, \
+    COMPILER := bootjdk, \
+    SRC := $(HOTSPOT_TOOLS_SRCDIR), \
+    BIN := $(HOTSPOT_TOOLS_OUTPUTDIR), \
+))
+
+TARGETS += $(BUILD_TOOLS_HOTSPOT)
+
+
+################################################################################
+# Graal build tools
 ifeq ($(INCLUDE_GRAAL), true)
   VM_CI_SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.ci/share/classes
 
diff --git a/make/Global.gmk b/make/Global.gmk
index 34a1125a1c9..f9200d16851 100644
--- a/make/Global.gmk
+++ b/make/Global.gmk
@@ -101,9 +101,9 @@ help:
 	$(info $(_)                        # method is 'auto', 'ignore' or 'fail' (default))
 	$(info $(_) TEST="test1 ..."       # Use the given test descriptor(s) for testing, e.g.)
 	$(info $(_)                        # make test TEST="jdk_lang gtest:all")
-	$(info $(_) JTREG="OPT1=x;OPT2=y"  # Control the JTREG test harness)
-	$(info $(_) GTEST="OPT1=x;OPT2=y"  # Control the GTEST test harness)
-	$(info $(_) MICRO="OPT1=x;OPT2=y"  # Control the MICRO test harness)
+	$(info $(_) JTREG="OPT1=x;OPT2=y"  # Control the JTREG test harness, use 'help' to list)
+	$(info $(_) GTEST="OPT1=x;OPT2=y"  # Control the GTEST test harness, use 'help' to list)
+	$(info $(_) MICRO="OPT1=x;OPT2=y"  # Control the MICRO test harness, use 'help' to list)
 	$(info $(_) TEST_OPTS="OPT1=x;..." # Generic control of all test harnesses)
 	$(info $(_) TEST_VM_OPTS="ARG ..." # Same as setting TEST_OPTS to VM_OPTIONS="ARG ...")
 	$(info )
diff --git a/make/Main.gmk b/make/Main.gmk
index 3e5450ca3c1..a3077022d35 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -804,7 +804,7 @@ else
 
   # Declare dependencies between hotspot-<variant>* targets
   $(foreach v, $(JVM_VARIANTS), \
-      $(eval hotspot-$v-gensrc: java.base-copy) \
+      $(eval hotspot-$v-gensrc: java.base-copy buildtools-hotspot) \
       $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
   )
 
diff --git a/make/RunTests.gmk b/make/RunTests.gmk
index 98df3be6e65..721bb827639 100644
--- a/make/RunTests.gmk
+++ b/make/RunTests.gmk
@@ -143,9 +143,6 @@ endif
 # Optionally create AOT libraries for specified modules before running tests.
 # Note, this could not be done during JDK build time.
 ################################################################################
-
-# Note, this could not be done during JDK build time.
-
 # Parameter 1 is the name of the rule.
 #
 # Remaining parameters are named arguments.
@@ -198,6 +195,10 @@ define SetupAotModuleBody
   $1_AOT_TARGETS += $$($1_AOT_LIB)
 endef
 
+################################################################################
+# Optionally create AOT libraries before running tests.
+# Note, this could not be done during JDK build time.
+################################################################################
 # Parameter 1 is the name of the rule.
 #
 # Remaining parameters are named arguments.
@@ -291,9 +292,9 @@ $(eval $(call SetTestOpt,FAILURE_HANDLER_TIMEOUT,JTREG))
 $(eval $(call ParseKeywordVariable, JTREG, \
     SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
         TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
-        RETRY_COUNT, \
+        RETRY_COUNT MAX_OUTPUT, \
     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
-        EXTRA_PROBLEM_LISTS AOT_MODULES, \
+        EXTRA_PROBLEM_LISTS AOT_MODULES LAUNCHER_OPTIONS, \
 ))
 
 ifneq ($(JTREG), )
@@ -844,15 +845,27 @@ define SetupRunJtregTestBody
   JTREG_RUN_PROBLEM_LISTS ?= false
   JTREG_RETRY_COUNT ?= 0
 
+  ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
+    $1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
+  endif
+
+  ifneq ($$(JTREG_MAX_OUTPUT), )
+    $1_JTREG_LAUNCHER_OPTIONS += -Djavatest.maxOutputSize=$$(JTREG_MAX_OUTPUT)
+  endif
+
   ifneq ($$($1_JTREG_MAX_MEM), 0)
     $1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
     $1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
   endif
 
+  # Make sure the tmp dir is normalized as some tests will react badly otherwise
+  $1_TEST_TMP_DIR := $$(abspath $$($1_TEST_SUPPORT_DIR)/tmp)
+
   $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
       -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
       -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
-      -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
+      -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
+      -vmoption:-Djava.io.tmpdir="$$($1_TEST_TMP_DIR)"
 
   $1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
 
@@ -968,7 +981,8 @@ define SetupRunJtregTestBody
   run-test-$1: pre-run-test clean-workdir-$1 $$($1_AOT_TARGETS)
 	$$(call LogWarn)
 	$$(call LogWarn, Running test '$$($1_TEST)')
-	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
+	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR) \
+	    $$($1_TEST_TMP_DIR))
 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, ( \
             $$(COV_ENVIRONMENT) $$($1_COMMAND_LINE) \
 	))
diff --git a/make/ToolsHotspot.gmk b/make/ToolsHotspot.gmk
new file mode 100644
index 00000000000..17963de7839
--- /dev/null
+++ b/make/ToolsHotspot.gmk
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ifndef _TOOLS_HOTSPOT_GMK
+_TOOLS_HOTSPOT_GMK := 1
+
+include JavaCompilation.gmk
+
+HOTSPOT_TOOLS_OUTPUTDIR := $(BUILDTOOLS_OUTPUTDIR)/buildtools/hotspot_tools_classes
+
+################################################################################
+# To avoid reevaluating the compilation setup for the tools each time this file
+# is included, the actual compilation is handled by CompileToolsHotspot.gmk. The
+# following trick is used to be able to declare a dependency on the built tools.
+BUILD_TOOLS_HOTSPOT := $(call SetupJavaCompilationCompileTarget, \
+    BUILD_TOOLS_HOTSPOT, $(HOTSPOT_TOOLS_OUTPUTDIR))
+
+################################################################################
+
+TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(HOTSPOT_TOOLS_OUTPUTDIR) \
+    build.tools.jfr.GenerateJfrFiles
+
+##########################################################################################
+
+endif # _TOOLS_HOTSPOT_GMK
diff --git a/make/common/Utils.gmk b/make/common/Utils.gmk
index 794d5789ebc..8f6f40c2657 100644
--- a/make/common/Utils.gmk
+++ b/make/common/Utils.gmk
@@ -220,6 +220,10 @@ define ParseKeywordVariableBody
       $$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \
       $$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \
       $$(eval $1_NO_MATCH := true) \
+      $$(if $$(filter help, $$(part)), \
+        $$(info Valid keywords for $1:) \
+        $$(info $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS).) \
+        $$(error Re-run without 'help' to continue)) \
       $$(foreach keyword, $$($1_SINGLE_KEYWORDS), \
         $$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
         $$(if $$(filter $$(keyword)=%, $$(part)), \
diff --git a/make/hotspot/gensrc/GensrcJfr.gmk b/make/hotspot/gensrc/GensrcJfr.gmk
index 9271de82b72..545c6876ad6 100644
--- a/make/hotspot/gensrc/GensrcJfr.gmk
+++ b/make/hotspot/gensrc/GensrcJfr.gmk
@@ -23,40 +23,24 @@
 # questions.
 #
 
-################################################################################
-# Build tools needed for the JFR source code generation
-
-JFR_TOOLS_SRCDIR := $(TOPDIR)/make/src/classes
-JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/buildtools/tools_classes
-
-$(eval $(call SetupJavaCompilation, BUILD_JFR_TOOLS, \
-    COMPILER := bootjdk, \
-    SMALL_JAVA := false, \
-    SRC := $(JFR_TOOLS_SRCDIR), \
-    BIN := $(JFR_TOOLS_OUTPUTDIR), \
-    DISABLED_WARNINGS := try, \
-))
-
-TARGETS += $(BUILD_JFR_TOOLS)
-
 ################################################################################
 # Setup make rules for JFR gensrc file generation.
 #
-TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) build.tools.jfr.GenerateJfrFiles
 
-JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
+include $(TOPDIR)/make/ToolsHotspot.gmk
+
 JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
+JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
 
 # Changing these will trigger a rebuild of generated jfr files.
 METADATA_XML := $(JFR_SRCDIR)/metadata.xml
 METADATA_XSD := $(JFR_SRCDIR)/metadata.xsd
 
-$(eval $(call SetupExecute, jfr_gen, \
+$(eval $(call SetupExecute, jfr_gen_headers, \
     INFO := Generating JFR header files, \
-    DEPS := $(METADATA_XML) $(METADATA_XSD) $(BUILD_JFR_TOOLS), \
+    DEPS := $(METADATA_XML) $(METADATA_XSD) $(BUILD_TOOLS_HOTSPOT), \
     OUTPUT_DIR := $(JFR_OUTPUTDIR), \
-    COMMAND := $(TOOL_JFR_GEN) $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR), \
+    COMMAND := $(TOOL_JFR_GEN) --mode headers --xml $(METADATA_XML) --xsd $(METADATA_XSD) --output $(JFR_OUTPUTDIR), \
 ))
 
-JFR_FILES := $(jfr_gen_TARGET)
-TARGETS += $(JFR_FILES)
+TARGETS += $(jfr_gen_headers)
diff --git a/make/hotspot/gensrc/GensrcJvmti.gmk b/make/hotspot/gensrc/GensrcJvmti.gmk
index fe9af4e19b7..312c8bc737a 100644
--- a/make/hotspot/gensrc/GensrcJvmti.gmk
+++ b/make/hotspot/gensrc/GensrcJvmti.gmk
@@ -106,14 +106,16 @@ $(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl, \
 $(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl, \
     -PARAM majorversion $(VERSION_FEATURE)))
 
-JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter
-
-$(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
-    XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
-    XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
-    OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
-    DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
-))
+JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter/zero
+
+ifeq ($(call check-jvm-feature, zero), true)
+  $(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
+      XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
+      XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
+      OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
+      DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
+  ))
+endif
 
 ################################################################################
 # Copy jvmti.h to include dir
diff --git a/make/hotspot/lib/JvmFeatures.gmk b/make/hotspot/lib/JvmFeatures.gmk
index 6a525cfa6db..ebff653f429 100644
--- a/make/hotspot/lib/JvmFeatures.gmk
+++ b/make/hotspot/lib/JvmFeatures.gmk
@@ -45,11 +45,17 @@ else
 endif
 
 ifeq ($(call check-jvm-feature, zero), true)
-  JVM_CFLAGS_FEATURES += -DZERO -DCC_INTERP -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
+  JVM_EXCLUDES += opto libadt
+  JVM_EXCLUDE_PATTERNS += c1_ c1/ c2_ runtime_ /c2/
+  JVM_EXCLUDE_FILES += templateInterpreter.cpp templateInterpreterGenerator.cpp \
+                       bcEscapeAnalyzer.cpp ciTypeFlow.cpp
+  JVM_CFLAGS_FEATURES += -DZERO -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
   JVM_LIBS_FEATURES += $(LIBFFI_LIBS)
   ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
     JVM_LDFLAGS_FEATURES += $(call SET_EXECUTABLE_ORIGIN,/..)
   endif
+else
+  JVM_EXCLUDE_PATTERNS += /zero/
 endif
 
 ifeq ($(JVM_VARIANT), custom)
diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk
index 4a89cd15157..677ec0a62e7 100644
--- a/make/hotspot/lib/JvmOverrideFiles.gmk
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk
@@ -92,9 +92,6 @@ else ifeq ($(call isTargetOs, macosx), true)
     # NOTE: The old build tested clang version to make sure this workaround
     # for the clang bug was still needed.
     BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
-    ifneq ($(DEBUG_LEVEL), slowdebug)
-      BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
-    endif
 
     # The following files are compiled at various optimization
     # levels due to optimization issues encountered at the
@@ -110,7 +107,6 @@ else ifeq ($(call isTargetOs, macosx), true)
         sharedRuntimeTrig.cpp \
         sharedRuntimeTrans.cpp \
         loopTransform.cpp \
-        unsafe.cpp \
         jvmciCompilerToVM.cpp \
         $(OPT_SPEED_SRC) \
         #
diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java
index 71ef8bde6c1..b385f8d7924 100644
--- a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java
+++ b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java
@@ -1067,10 +1067,23 @@ private Annotation[][] createParameterAnnotations(List<CPInfo> constantPool, Lis
     }
 
     private Annotation createAnnotation(List<CPInfo> constantPool, AnnotationDescription desc) {
+        String annotationType = desc.annotationType;
+
+        if (PREVIEW_FEATURE_ANNOTATION.equals(annotationType)) {
+            //the non-public PreviewFeature annotation will not be available in ct.sym,
+            //replace with purely synthetic javac-internal annotation:
+            annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
+        }
+
         return new Annotation(null,
-                              addString(constantPool, desc.annotationType),
+                              addString(constantPool, annotationType),
                               createElementPairs(constantPool, desc.values));
     }
+    //where:
+        private static final String PREVIEW_FEATURE_ANNOTATION =
+                "Ljdk/internal/PreviewFeature;";
+        private static final String PREVIEW_FEATURE_ANNOTATION_INTERNAL =
+                "Ljdk/internal/PreviewFeature+Annotation;";
 
     private element_value_pair[] createElementPairs(List<CPInfo> constantPool, Map<String, Object> annotationAttributes) {
         element_value_pair[] pairs = new element_value_pair[annotationAttributes.size()];
diff --git a/make/modules/jdk.jfr/Copy.gmk b/make/modules/jdk.jfr/Copy.gmk
index dc752d3a44f..f4fa3d97551 100644
--- a/make/modules/jdk.jfr/Copy.gmk
+++ b/make/modules/jdk.jfr/Copy.gmk
@@ -27,14 +27,6 @@ include CopyCommon.gmk
 
 ################################################################################
 
-$(eval $(call SetupCopyFiles, COPY_JFR_METADATA, \
-    SRC := $(TOPDIR)/src/hotspot/share/jfr/metadata, \
-    DEST := $(JDK_OUTPUTDIR)/modules/jdk.jfr/jdk/jfr/internal/types, \
-    FILES := metadata.xml \
-))
-
-TARGETS += $(COPY_JFR_METADATA)
-
 JFR_CONF_DIR := $(TOPDIR)/src/jdk.jfr/share/conf/jfr
 $(eval $(call SetupCopyFiles, COPY_JFR_CONF, \
     DEST := $(LIB_DST_DIR)/jfr, \
diff --git a/make/modules/jdk.jfr/Gendata.gmk b/make/modules/jdk.jfr/Gendata.gmk
new file mode 100644
index 00000000000..522eea70f32
--- /dev/null
+++ b/make/modules/jdk.jfr/Gendata.gmk
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+
+include ToolsHotspot.gmk
+include Execute.gmk
+
+JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
+JFR_DATA_OUTPUTDIR := $(OUTPUTDIR)/jdk/modules/jdk.jfr/jdk/jfr/internal/types
+JFR_DATA_OUTPUTFILE := $(JFR_DATA_OUTPUTDIR)/metadata.bin
+JFR_DATA_SUPPORTDIR := $(SUPPORT_OUTPUTDIR)/gendata/jdk.jfr
+
+# Changing these will trigger a rebuild of generated jfr files.
+METADATA_XML := $(JFR_SRCDIR)/metadata.xml
+METADATA_XSD := $(JFR_SRCDIR)/metadata.xsd
+
+$(eval $(call SetupExecute, jfr_gen_metadata, \
+    INFO := Generating JFR metadata, \
+    DEPS := $(METADATA_XML) $(METADATA_XSD) $(BUILD_TOOLS_HOTSPOT), \
+    OUTPUT_FILE := $(JFR_DATA_OUTPUTFILE), \
+    SUPPORT_DIR := $(JFR_DATA_SUPPORTDIR), \
+    COMMAND := $(TOOL_JFR_GEN) --mode metadata --xml $(METADATA_XML) --xsd $(METADATA_XSD) --output $(JFR_DATA_OUTPUTFILE), \
+))
+
+TARGETS += $(jfr_gen_metadata)
diff --git a/make/src/classes/build/tools/jfr/GenerateJfrFiles.java b/make/src/classes/build/tools/jfr/GenerateJfrFiles.java
index eb39d2487ce..cf6a08cdc49 100644
--- a/make/src/classes/build/tools/jfr/GenerateJfrFiles.java
+++ b/make/src/classes/build/tools/jfr/GenerateJfrFiles.java
@@ -1,16 +1,19 @@
 package build.tools.jfr;
 
 import java.io.BufferedOutputStream;
+import java.io.Closeable;
+import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.StringJoiner;
 import java.util.function.Predicate;
 
@@ -25,94 +28,107 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
+/**
+ * Purpose of this program is twofold:
+ *
+ * 1) Generate C++ classes to be used when writing native events for HotSpot.
+ *
+ * 2) Generate metadata (label, descriptions, field layout etc.) from XML
+ * (metadata.xml) into a binary format (metadata.bin) that can be read quickly
+ * during startup by the jdk.jfr module.
+ *
+ * INPUT FILES:
+ *
+ * -  metadata.xml  File that contains descriptions of events and types
+ * -  metadata.xsd  Schema that verifies that metadata.xml is legit XML
+ *
+ * OUTPUT FILES:
+ *
+ * MODE: headers
+ *
+ * - jfrEventIds.hpp      List of IDs so events can be identified from native
+ * - jfrTypes.hpp         List of IDs so types can be identified from native
+ * - jfrPeriodic.hpp      Dispatch mechanism so Java can emit native periodic events
+ * - jfrEventControl.hpp  Data structure for native event settings.
+ * - jfrEventClasses.hpp  C++ event classes that can write data into native buffers
+ *
+ * MODE: metadata
+ *
+ *  - metadata.bin        Binary representation of the information in metadata.xml
+ *
+ */
 public class GenerateJfrFiles {
 
-    public static void main(String... args) throws Exception {
-        if (args.length != 3) {
-            System.err.println("Incorrect number of command line arguments.");
-            System.err.println("Usage:");
-            System.err.println("java GenerateJfrFiles[.java] <path-to-metadata.xml> <path-to-metadata.xsd> <output-directory>");
-            System.exit(1);
-        }
-        try {
-            File metadataXml = new File(args[0]);
-            File metadataSchema = new File(args[1]);
-            File outputDirectory = new File(args[2]);
-
-            Metadata metadata = new Metadata(metadataXml, metadataSchema);
-            metadata.verify();
-            metadata.wireUpTypes();
-
-            TypeCounter typeCounter = new TypeCounter();
-            printJfrEventIdsHpp(metadata, typeCounter, outputDirectory);
-            printJfrTypesHpp(metadata, typeCounter, outputDirectory);
-            printJfrPeriodicHpp(metadata, outputDirectory);
-            printJfrEventControlHpp(metadata, typeCounter, outputDirectory);
-            printJfrEventClassesHpp(metadata, outputDirectory);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            System.exit(1);
-        }
+    enum OutputMode {
+        headers, metadata
     }
 
-    static class TypeCounter {
-        final static long RESERVED_EVENT_COUNT = 2;
-        long typeId = -1;
-        long eventId = -1;
-        long eventCount = 0;
-        String firstTypeName;
-        String lastTypeName;
-        String firstEventName;
-        String lastEventname;
+    private static void printUsage(PrintStream out) {
+        out.println("Usage: java GenerateJfrFiles[.java]");
+        out.println(" --mode <headers|metadata>");
+        out.println(" --xml <path-to-metadata.xml> ");
+        out.println(" --xsd <path-to-metadata.xsd>");
+        out.println(" --output <output-file-or-directory>");
+    }
 
-        public long nextEventId(String name) {
-            eventCount++;
-            if (eventId == -1) {
-                eventId = firstEventId();
-                firstEventName = lastEventname = name;
-                return eventId;
-            }
-            lastEventname = name;
-            return ++eventId;
+    private static String consumeOption(String option, List<String> argList) throws Exception {
+        int index = argList.indexOf(option);
+        if (index >= 0 && index <= argList.size() - 2) {
+            String result = argList.get(index + 1);
+            argList.remove(index);
+            argList.remove(index);
+            return result;
         }
+        throw new IllegalArgumentException("missing option " + option);
+    }
 
-        public long nextTypeId(String typeName) {
-            if (typeId == -1) {
-                lastTypeName = firstTypeName = typeName;
-                typeId = lastEventId();
+    public static void main(String... args) throws Exception {
+        try {
+            List<String> argList = new ArrayList<>();
+            argList.addAll(Arrays.asList(args));
+            String mode = consumeOption("--mode", argList);
+            String output = consumeOption("--output", argList);
+            String xml = consumeOption("--xml", argList);
+            String xsd = consumeOption("--xsd", argList);
+            if (!argList.isEmpty()) {
+                throw new IllegalArgumentException("unknown option " + argList);
             }
-            lastTypeName = typeName;
-            return ++typeId;
-        }
-
-        public long firstEventId() {
-            return RESERVED_EVENT_COUNT;
-        }
-
-        public long lastEventId() {
-            return eventId == -1 ? firstEventId() : eventId;
-        }
-
-        public long eventCount() {
-            return eventCount;
-        }
-
-        public String firstTypeName() {
-            return firstTypeName;
-        }
+            OutputMode outputMode = OutputMode.valueOf(mode);
+            File xmlFile = new File(xml);
+            File xsdFile = new File(xsd);
 
-        public String lastTypeName() {
-            return lastTypeName;
-        }
+            Metadata metadata = new Metadata(xmlFile, xsdFile);
+            metadata.verify();
+            metadata.wireUpTypes();
 
-        public String firstEventName() {
-            return firstEventName;
-        }
+            if (outputMode == OutputMode.headers) {
+                File outputDir = new File(output);
+                printJfrEventIdsHpp(metadata, new File(outputDir, "jfrEventIds.hpp"));
+                printJfrTypesHpp(metadata, new File(outputDir, "jfrTypes.hpp"));
+                printJfrPeriodicHpp(metadata, new File(outputDir, "jfrPeriodic.hpp"));
+                printJfrEventControlHpp(metadata, new File(outputDir, "jfrEventControl.hpp"));
+                printJfrEventClassesHpp(metadata, new File(outputDir, "jfrEventClasses.hpp"));
+            }
 
-        public String lastEventName() {
-            return lastEventname;
+            if (outputMode == OutputMode.metadata) {
+                File outputFile  = new File(output);
+                try (var b = new DataOutputStream(
+                        new BufferedOutputStream(
+                            new FileOutputStream(outputFile)))) {
+                    metadata.persist(b);
+                }
+            }
+            System.exit(0);
+        } catch (IllegalArgumentException iae) {
+            System.err.println();
+            System.err.println("GenerateJfrFiles: " + iae.getMessage());
+            System.err.println();
+            printUsage(System.err);
+            System.err.println();
+        } catch (Exception e) {
+            e.printStackTrace();
         }
+        System.exit(1);
     }
 
     static class XmlType {
@@ -121,28 +137,99 @@ static class XmlType {
         final String parameterType;
         final String javaType;
         final boolean unsigned;
+        final String contentType;
 
-        XmlType(String name, String fieldType, String parameterType, String javaType, boolean unsigned) {
+        XmlType(String name, String fieldType, String parameterType, String javaType, String contentType,
+                boolean unsigned) {
             this.name = name;
             this.fieldType = fieldType;
             this.parameterType = parameterType;
             this.javaType = javaType;
             this.unsigned = unsigned;
+            this.contentType = contentType;
+        }
+    }
+
+    static class XmlContentType {
+        final String name;
+        final String annotation;
+
+        XmlContentType(String name, String annotation) {
+            this.name = name;
+            this.annotation = annotation;
         }
     }
 
     static class TypeElement {
         List<FieldElement> fields = new ArrayList<>();
         String name;
-        String fieldType;
-        String parameterType;
-        boolean supportStruct;
+        String javaType;
+        String label = "";
+        String description = "";
+        String category = "";
+        boolean thread;
+        boolean stackTrace;
+        boolean startTime;
+        String period = "";
+        boolean cutoff;
+        boolean experimental;
+        long id;
+        boolean isEvent;
+        boolean isRelation;
+        boolean supportStruct = false;
+        String commitState;
+        public boolean primitive;
+
+        public void persist(DataOutputStream pos) throws IOException {
+            pos.writeInt(fields.size());
+            for (FieldElement field : fields) {
+                field.persist(pos);
+            }
+            pos.writeUTF(javaType);
+            pos.writeUTF(label);
+            pos.writeUTF(description);
+            pos.writeUTF(category);
+            pos.writeBoolean(thread);
+            pos.writeBoolean(stackTrace);
+            pos.writeBoolean(startTime);
+            pos.writeUTF(period);
+            pos.writeBoolean(cutoff);
+            pos.writeBoolean(experimental);
+            pos.writeLong(id);
+            pos.writeBoolean(isEvent);
+            pos.writeBoolean(isRelation);
+        }
     }
 
     static class Metadata {
+        static class TypeCounter {
+            final long first;
+            long last = -1;
+            long count = 0;
+            long id = -1;
+
+            TypeCounter(long startId) {
+                this.first = startId;
+            }
+
+            long next() {
+                id = (id == -1) ? first : id + 1;
+                count++;
+                last = id;
+                return id;
+            }
+        }
+
+        static int RESERVED_EVENT_COUNT = 2;
         final Map<String, TypeElement> types = new LinkedHashMap<>();
         final Map<String, XmlType> xmlTypes = new LinkedHashMap<>();
-        Metadata(File metadataXml, File metadataSchema) throws ParserConfigurationException, SAXException, FileNotFoundException, IOException {
+        final Map<String, XmlContentType> xmlContentTypes = new LinkedHashMap<>();
+        int lastEventId;
+        private TypeCounter eventCounter;
+        private TypeCounter typeCounter;
+
+        Metadata(File metadataXml, File metadataSchema)
+                throws ParserConfigurationException, SAXException, FileNotFoundException, IOException {
             SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
             SAXParserFactory factory = SAXParserFactory.newInstance();
             factory.setSchema(schemaFactory.newSchema(metadataSchema));
@@ -150,16 +237,19 @@ static class Metadata {
             sp.parse(metadataXml, new MetadataHandler(this));
         }
 
-        List<EventElement> getEvents() {
-            return getList(t -> t.getClass() == EventElement.class);
+        public void persist(DataOutputStream pos) throws IOException {
+            pos.writeInt(types.values().size());
+            for (TypeElement t : types.values()) {
+                t.persist(pos);
+            }
         }
 
-        List<TypeElement> getEventsAndStructs() {
-            return getList(t -> t.getClass() == EventElement.class || t.supportStruct);
+        List<TypeElement> getEvents() {
+            return getList(t -> t.isEvent);
         }
 
-        List<TypeElement> getTypesAndStructs() {
-            return getList(t -> t.getClass() == TypeElement.class || t.supportStruct);
+        List<TypeElement> getEventsAndStructs() {
+            return getList(t -> t.isEvent || t.supportStruct);
         }
 
         @SuppressWarnings("unchecked")
@@ -173,24 +263,25 @@ <T> List<T> getList(Predicate<? super TypeElement> pred) {
             return result;
         }
 
-        List<EventElement> getPeriodicEvents() {
-            return getList(t -> t.getClass() == EventElement.class && ((EventElement) t).periodic);
+        List<TypeElement> getPeriodicEvents() {
+            return getList(t -> t.isEvent && !t.period.isEmpty());
         }
 
         List<TypeElement> getTypes() {
-            return getList(t -> t.getClass() == TypeElement.class);
+            return getList(t -> !t.isEvent);
         }
 
         List<TypeElement> getStructs() {
-            return getList(t -> t.getClass() == TypeElement.class && t.supportStruct);
+            return getList(t -> !t.isEvent && t.supportStruct);
         }
 
-        void verify()  {
+        void verify() {
             for (TypeElement t : types.values()) {
                 for (FieldElement f : t.fields) {
                     if (!xmlTypes.containsKey(f.typeName)) { // ignore primitives
                         if (!types.containsKey(f.typeName)) {
-                            throw new IllegalStateException("Could not find definition of type '" + f.typeName + "' used by " + t.name + "#" + f.name);
+                            throw new IllegalStateException("Could not find definition of type '" + f.typeName
+                                    + "' used by " + t.name + "#" + f.name);
                         }
                     }
                 }
@@ -198,26 +289,96 @@ void verify()  {
         }
 
         void wireUpTypes() {
+            // Add Java primitives
+            for (var t : xmlTypes.entrySet()) {
+                String name = t.getKey();
+                XmlType xmlType = t.getValue();
+                // Excludes Thread and Class
+                if (!types.containsKey(name)) {
+                    // Excludes u8, u4, u2, u1, Ticks and Ticksspan
+                    if (!xmlType.javaType.isEmpty() && !xmlType.unsigned) {
+                        TypeElement te = new TypeElement();
+                        te.name = name;
+                        te.javaType = xmlType.javaType;
+                        te.primitive = true;
+                        types.put(te.name, te);
+                    }
+                }
+            }
+            // Setup Java fully qualified names
+            for (TypeElement t : types.values()) {
+                if (t.isEvent) {
+                    t.javaType = "jdk." + t.name;
+                } else {
+                    XmlType xmlType = xmlTypes.get(t.name);
+                    if (xmlType != null && !xmlType.javaType.isEmpty()) {
+                        t.javaType = xmlType.javaType;
+                    } else {
+                        t.javaType = "jdk.types." + t.name;
+                    }
+                }
+            }
+            // Setup content type, annotation, constant pool etc. for fields.
             for (TypeElement t : types.values()) {
                 for (FieldElement f : t.fields) {
                     TypeElement type = types.get(f.typeName);
+                    XmlType xmlType = xmlTypes.get(f.typeName);
+                    if (type == null) {
+                        if (xmlType == null) {
+                            throw new IllegalStateException("Unknown type");
+                        }
+                        if (f.contentType.isEmpty()) {
+                            f.contentType = xmlType.contentType;
+                        }
+                        String javaType = xmlType.javaType;
+                        type = types.get(javaType);
+                        Objects.requireNonNull(type);
+                    }
+                    if (type.primitive) {
+                        f.constantPool = false;
+                    }
+
+                    if (xmlType != null) {
+                        f.unsigned = xmlType.unsigned;
+                    }
+
                     if (f.struct) {
+                        f.constantPool = false;
                         type.supportStruct = true;
                     }
                     f.type = type;
+                    XmlContentType xmlContentType = xmlContentTypes.get(f.contentType);
+                    if (xmlContentType == null) {
+                        f.annotations = "";
+                    } else {
+                        f.annotations = xmlContentType.annotation;
+                    }
+                    if (!f.relation.isEmpty()) {
+                        f.relation = "jdk.types." + f.relation;
+                    }
                 }
             }
+
+            // Low numbers for event so most of them
+            // can fit in one byte with compressed integers
+            eventCounter = new TypeCounter(RESERVED_EVENT_COUNT);
+            for (TypeElement t : getEvents()) {
+                t.id = eventCounter.next();
+            }
+            typeCounter = new TypeCounter(eventCounter.last + 1);
+            for (TypeElement t : getTypes()) {
+                t.id = typeCounter.next();
+            }
         }
-    }
 
-    static class EventElement extends TypeElement {
-        String representation;
-        boolean thread;
-        boolean stackTrace;
-        boolean startTime;
-        boolean periodic;
-        boolean cutoff;
-        String commitState;
+        public String getName(long id) {
+            for (TypeElement t : types.values()) {
+                if (t.id == id) {
+                    return t.name;
+                }
+            }
+            throw new IllegalStateException("Unexpected id " + id );
+        }
     }
 
     static class FieldElement {
@@ -225,12 +386,36 @@ static class FieldElement {
         TypeElement type;
         String name;
         String typeName;
-        boolean struct;
+        boolean constantPool = true;
+        public String transition;
+        public String contentType;
+        private String label;
+        private String description;
+        private String relation;
+        private boolean experimental;
+        private boolean unsigned;
+        private boolean array;
+        private String annotations;
+        public boolean struct;
 
         FieldElement(Metadata metadata) {
             this.metadata = metadata;
         }
 
+        public void persist(DataOutputStream pos) throws IOException {
+            pos.writeUTF(name);
+            pos.writeUTF(type.javaType);
+            pos.writeUTF(label);
+            pos.writeUTF(description);
+            pos.writeBoolean(constantPool);
+            pos.writeBoolean(array);
+            pos.writeBoolean(unsigned);
+            pos.writeUTF(annotations);
+            pos.writeUTF(transition);
+            pos.writeUTF(relation);
+            pos.writeBoolean(experimental);
+        }
+
         String getParameterType() {
             if (struct) {
                 return "const JfrStruct" + typeName + "&";
@@ -262,50 +447,75 @@ static class MetadataHandler extends DefaultHandler {
         final Metadata metadata;
         FieldElement currentField;
         TypeElement currentType;
+
         MetadataHandler(Metadata metadata) {
             this.metadata = metadata;
         }
+
         @Override
         public void error(SAXParseException e) throws SAXException {
-          throw e;
+            throw e;
         }
+
         @Override
-        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+        public void startElement(String uri, String localName, String qName, Attributes attributes)
+                throws SAXException {
             switch (qName) {
+            case "XmlContentType":
+                String n = attributes.getValue("name"); // mandatory
+                String a = attributes.getValue("annotation"); // mandatory
+                metadata.xmlContentTypes.put(n, new XmlContentType(n, a));
+                break;
             case "XmlType":
-                String name = attributes.getValue("name");
-                String parameterType = attributes.getValue("parameterType");
-                String fieldType = attributes.getValue("fieldType");
-                String javaType = attributes.getValue("javaType");
+                String name = attributes.getValue("name"); // mandatory
+                String parameterType = attributes.getValue("parameterType"); // mandatory
+                String fieldType = attributes.getValue("fieldType"); // mandatory
+                String javaType = getString(attributes, "javaType");
+                String contentType = getString(attributes, "contentType");
                 boolean unsigned = getBoolean(attributes, "unsigned", false);
-                metadata.xmlTypes.put(name, new XmlType(name, fieldType, parameterType, javaType, unsigned));
+                metadata.xmlTypes.put(name,
+                        new XmlType(name, fieldType, parameterType, javaType, contentType, unsigned));
                 break;
             case "Relation":
             case "Type":
-                currentType = new TypeElement();
-                currentType.name = attributes.getValue("name");
-                break;
             case "Event":
-                EventElement eventType = new EventElement();
-                eventType.name = attributes.getValue("name");
-                eventType.thread = getBoolean(attributes, "thread", false);
-                eventType.stackTrace = getBoolean(attributes, "stackTrace", false);
-                eventType.startTime = getBoolean(attributes, "startTime", true);
-                eventType.periodic = attributes.getValue("period") != null;
-                eventType.cutoff = getBoolean(attributes, "cutoff", false);
-                eventType.commitState = attributes.getValue("commitState");
-                currentType = eventType;
+                currentType = new TypeElement();
+                currentType.name = attributes.getValue("name"); // mandatory
+                currentType.label = getString(attributes, "label");
+                currentType.description = getString(attributes, "description");
+                currentType.category = getString(attributes, "category");
+                currentType.experimental = getBoolean(attributes, "experimental", false);
+                currentType.thread = getBoolean(attributes, "thread", false);
+                currentType.stackTrace = getBoolean(attributes, "stackTrace", false);
+                currentType.startTime = getBoolean(attributes, "startTime", true);
+                currentType.period = getString(attributes, "period");
+                currentType.cutoff = getBoolean(attributes, "cutoff", false);
+                currentType.commitState = getString(attributes, "commitState");
+                currentType.isEvent = "Event".equals(qName);
+                currentType.isRelation = "Relation".equals(qName);
                 break;
             case "Field":
                 currentField = new FieldElement(metadata);
+                currentField.name = attributes.getValue("name"); // mandatory
+                currentField.typeName = attributes.getValue("type"); // mandatory
+                currentField.label = getString(attributes, "label");
+                currentField.description = getString(attributes, "description");
+                currentField.contentType = getString(attributes, "contentType");
                 currentField.struct = getBoolean(attributes, "struct", false);
-                currentField.name = attributes.getValue("name");
-                currentField.typeName = attributes.getValue("type");
+                currentField.array = getBoolean(attributes, "array", false);
+                currentField.transition = getString(attributes, "transition");
+                currentField.relation = getString(attributes, "relation");
+                currentField.experimental = getBoolean(attributes, "experimental", false);
                 break;
             }
         }
 
-        private boolean getBoolean(Attributes attributes, String name, boolean defaultValue) {
+        private static String getString(Attributes attributes, String name) {
+            String value = attributes.getValue(name);
+            return value != null ? value : "";
+        }
+
+        private static boolean getBoolean(Attributes attributes, String name, boolean defaultValue) {
             String value = attributes.getValue(name);
             return value == null ? defaultValue : Boolean.valueOf(value);
         }
@@ -327,10 +537,11 @@ public void endElement(String uri, String localName, String qName) {
         }
     }
 
-    static class Printer implements AutoCloseable {
+    static class Printer implements Closeable {
         final PrintStream out;
-        Printer(File outputDirectory, String filename) throws FileNotFoundException {
-            out = new PrintStream(new BufferedOutputStream(new FileOutputStream(new File(outputDirectory, filename))));
+
+        Printer(File outputFile) throws FileNotFoundException {
+            out = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile)));
             write("/* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */");
             write("");
         }
@@ -341,13 +552,13 @@ void write(String text) {
         }
 
         @Override
-        public void close() throws Exception {
+        public void close() throws IOException {
             out.close();
         }
     }
 
-    private static void printJfrPeriodicHpp(Metadata metadata, File outputDirectory) throws Exception {
-        try (Printer out = new Printer(outputDirectory, "jfrPeriodic.hpp")) {
+    private static void printJfrPeriodicHpp(Metadata metadata, File outputFile) throws Exception {
+        try (var out = new Printer(outputFile)) {
             out.write("#ifndef JFRFILES_JFRPERIODICEVENTSET_HPP");
             out.write("#define JFRFILES_JFRPERIODICEVENTSET_HPP");
             out.write("");
@@ -361,7 +572,7 @@ private static void printJfrPeriodicHpp(Metadata metadata, File outputDirectory)
             out.write("  static void requestEvent(JfrEventId id) {");
             out.write("    switch(id) {");
             out.write("  ");
-            for (EventElement e : metadata.getPeriodicEvents()) {
+            for (TypeElement e : metadata.getPeriodicEvents()) {
                 out.write("      case Jfr" + e.name + "Event:");
                 out.write("        request" + e.name + "();");
                 out.write("        break;");
@@ -374,7 +585,7 @@ private static void printJfrPeriodicHpp(Metadata metadata, File outputDirectory)
             out.write("");
             out.write(" private:");
             out.write("");
-            for (EventElement e : metadata.getPeriodicEvents()) {
+            for (TypeElement e : metadata.getPeriodicEvents()) {
                 out.write("  static void request" + e.name + "(void);");
                 out.write("");
             }
@@ -385,8 +596,8 @@ private static void printJfrPeriodicHpp(Metadata metadata, File outputDirectory)
         }
     }
 
-    private static void printJfrEventControlHpp(Metadata metadata, TypeCounter typeCounter, File outputDirectory) throws Exception {
-        try (Printer out = new Printer(outputDirectory, "jfrEventControl.hpp")) {
+    private static void printJfrEventControlHpp(Metadata metadata, File outputFile) throws Exception {
+        try (var out = new Printer(outputFile)) {
             out.write("#ifndef JFRFILES_JFR_NATIVE_EVENTSETTING_HPP");
             out.write("#define JFRFILES_JFR_NATIVE_EVENTSETTING_HPP");
             out.write("");
@@ -426,8 +637,8 @@ private static void printJfrEventControlHpp(Metadata metadata, TypeCounter typeC
         }
     }
 
-    private static void printJfrEventIdsHpp(Metadata metadata, TypeCounter typeCounter, File outputDirectory) throws Exception {
-        try (Printer out = new Printer(outputDirectory, "jfrEventIds.hpp")) {
+    private static void printJfrEventIdsHpp(Metadata metadata, File outputFile) throws Exception {
+        try (var out = new Printer(outputFile)) {
             out.write("#ifndef JFRFILES_JFREVENTIDS_HPP");
             out.write("#define JFRFILES_JFREVENTIDS_HPP");
             out.write("");
@@ -438,23 +649,28 @@ private static void printJfrEventIdsHpp(Metadata metadata, TypeCounter typeCount
             out.write("  JfrMetadataEvent = 0,");
             out.write("  JfrCheckpointEvent = 1,");
             for (TypeElement t : metadata.getEvents()) {
-                String name = "Jfr" + t.name +"Event";
-                out.write("  " + name + " = " + typeCounter.nextEventId(name) + ",");
+                out.write("  " + jfrEventId(t.name) + " = " + t.id + ",");
             }
             out.write("};");
             out.write("typedef enum JfrEventId JfrEventId;");
             out.write("");
-            out.write("static const JfrEventId FIRST_EVENT_ID = " + typeCounter.firstEventName() + ";");
-            out.write("static const JfrEventId LAST_EVENT_ID = " + typeCounter.lastEventName() + ";");
-            out.write("static const int NUMBER_OF_EVENTS = " + typeCounter.eventCount() + ";");
-            out.write("static const int NUMBER_OF_RESERVED_EVENTS = " + TypeCounter.RESERVED_EVENT_COUNT + ";");
+            String first = metadata.getName(metadata.eventCounter.first);
+            String last = metadata.getName(metadata.eventCounter.last);
+            out.write("static const JfrEventId FIRST_EVENT_ID = " + jfrEventId(first) + ";");
+            out.write("static const JfrEventId LAST_EVENT_ID = " + jfrEventId(last) + ";");
+            out.write("static const int NUMBER_OF_EVENTS = " + metadata.eventCounter.count + ";");
+            out.write("static const int NUMBER_OF_RESERVED_EVENTS = " + Metadata.RESERVED_EVENT_COUNT + ";");
             out.write("#endif // INCLUDE_JFR");
             out.write("#endif // JFRFILES_JFREVENTIDS_HPP");
         }
     }
 
-    private static void printJfrTypesHpp(Metadata metadata, TypeCounter typeCounter, File outputDirectory) throws Exception {
-        try (Printer out = new Printer(outputDirectory, "jfrTypes.hpp")) {
+    private static String jfrEventId(String name) {
+        return "Jfr" + name + "Event";
+    }
+
+    private static void printJfrTypesHpp(Metadata metadata, File outputFile) throws Exception {
+        try (var out = new Printer(outputFile)) {
             out.write("#ifndef JFRFILES_JFRTYPES_HPP");
             out.write("#define JFRFILES_JFRTYPES_HPP");
             out.write("");
@@ -465,36 +681,27 @@ private static void printJfrTypesHpp(Metadata metadata, TypeCounter typeCounter,
             out.write("#include \"memory/allocation.hpp\"");
             out.write("");
             out.write("enum JfrTypeId {");
-            Map<String, XmlType> javaTypes = new LinkedHashMap<>();
-            for (var t : metadata.xmlTypes.entrySet()) {
-                String name = t.getKey();
-                XmlType xmlType = t.getValue();
-                if (xmlType.javaType != null && !xmlType.unsigned) {
-                    String typeName = "TYPE_" + name.toUpperCase();
-                    long typeId = typeCounter.nextTypeId(typeName);
-                    out.write("  " + typeName + " = " + typeId + ",");
-                    javaTypes.put(name, xmlType);
-                }
-            }
             for (TypeElement type : metadata.getTypes()) {
-                String name = type.name;
-                if (!javaTypes.containsKey(name)) {
-                    String typeName = "TYPE_" + name.toUpperCase();
-                    long typeId = typeCounter.nextTypeId(typeName);
-                    out.write("  " + typeName + " = " + typeId + ",");
-                }
+                out.write("  " + jfrTypeId(type.name) + " = " + type.id + ",");
             }
             out.write("};");
             out.write("");
-            out.write("static const JfrTypeId FIRST_TYPE_ID = " + typeCounter.firstTypeName() + ";");
-            out.write("static const JfrTypeId LAST_TYPE_ID = " + typeCounter.lastTypeName() + ";");
-
+            String first = metadata.getName(metadata.typeCounter.first);
+            String last = metadata.getName(metadata.typeCounter.last);
+            out.write("static const JfrTypeId FIRST_TYPE_ID = " + jfrTypeId(first) + ";");
+            out.write("static const JfrTypeId LAST_TYPE_ID = " + jfrTypeId(last) + ";");
             out.write("");
             out.write("class JfrType : public AllStatic {");
             out.write(" public:");
             out.write("  static jlong name_to_id(const char* type_name) {");
-            for (Entry<String, XmlType> m : javaTypes.entrySet()) {
-                XmlType xmlType = m.getValue();
+
+            Map<String, XmlType> javaTypes = new LinkedHashMap<>();
+            for (XmlType xmlType : metadata.xmlTypes.values()) {
+                if (!xmlType.javaType.isEmpty()) {
+                    javaTypes.put(xmlType.javaType, xmlType);
+                }
+            }
+            for (XmlType xmlType : javaTypes.values()) {
                 String javaName = xmlType.javaType;
                 String typeName = xmlType.name.toUpperCase();
                 out.write("    if (strcmp(type_name, \"" + javaName + "\") == 0) {");
@@ -508,11 +715,14 @@ private static void printJfrTypesHpp(Metadata metadata, TypeCounter typeCounter,
             out.write("#endif // INCLUDE_JFR");
             out.write("#endif // JFRFILES_JFRTYPES_HPP");
         }
-        ;
     }
 
-    private static void printJfrEventClassesHpp(Metadata metadata, File outputDirectory) throws Exception {
-        try (Printer out = new Printer(outputDirectory, "jfrEventClasses.hpp")) {
+    private static String jfrTypeId(String name) {
+        return  "TYPE_" + name.toUpperCase();
+    }
+
+    private static void printJfrEventClassesHpp(Metadata metadata, File outputFile) throws Exception {
+        try (var out = new Printer(outputFile)) {
             out.write("#ifndef JFRFILES_JFREVENTCLASSES_HPP");
             out.write("#define JFRFILES_JFREVENTCLASSES_HPP");
             out.write("");
@@ -566,7 +776,7 @@ private static void printTypes(Printer out, Metadata metadata, boolean empty) {
             printType(out, t, empty);
             out.write("");
         }
-        for (EventElement e : metadata.getEvents()) {
+        for (TypeElement e : metadata.getEvents()) {
             printEvent(out, e, empty);
             out.write("");
         }
@@ -576,81 +786,83 @@ private static void printType(Printer out, TypeElement t, boolean empty) {
         out.write("struct JfrStruct" + t.name);
         out.write("{");
         if (!empty) {
-          out.write(" private:");
-          for (FieldElement f : t.fields) {
-              printField(out, f);
-          }
-          out.write("");
+            out.write(" private:");
+            for (FieldElement f : t.fields) {
+                printField(out, f);
+            }
+            out.write("");
         }
         out.write(" public:");
         for (FieldElement f : t.fields) {
-           printTypeSetter(out, f, empty);
+            printTypeSetter(out, f, empty);
         }
         out.write("");
         if (!empty) {
-          printWriteData(out, t.fields, null);
+            printWriteData(out, t);
         }
         out.write("};");
         out.write("");
     }
 
-    private static void printEvent(Printer out, EventElement event, boolean empty) {
+    private static void printEvent(Printer out, TypeElement event, boolean empty) {
         out.write("class Event" + event.name + " : public JfrEvent<Event" + event.name + ">");
         out.write("{");
         if (!empty) {
-          out.write(" private:");
-          for (FieldElement f : event.fields) {
-              printField(out, f);
-          }
-          out.write("");
+            out.write(" private:");
+            for (FieldElement f : event.fields) {
+                printField(out, f);
+            }
+            out.write("");
         }
         out.write(" public:");
         if (!empty) {
-          out.write("  static const bool hasThread = " + event.thread + ";");
-          out.write("  static const bool hasStackTrace = " + event.stackTrace + ";");
-          out.write("  static const bool isInstant = " + !event.startTime + ";");
-          out.write("  static const bool hasCutoff = " + event.cutoff + ";");
-          out.write("  static const bool isRequestable = " + event.periodic + ";");
-          out.write("  static const JfrEventId eventId = Jfr" + event.name + "Event;");
-          out.write("");
+            out.write("  static const bool hasThread = " + event.thread + ";");
+            out.write("  static const bool hasStackTrace = " + event.stackTrace + ";");
+            out.write("  static const bool isInstant = " + !event.startTime + ";");
+            out.write("  static const bool hasCutoff = " + event.cutoff + ";");
+            out.write("  static const bool isRequestable = " + !event.period.isEmpty() + ";");
+            out.write("  static const JfrEventId eventId = Jfr" + event.name + "Event;");
+            out.write("");
         }
         if (!empty) {
-          out.write("  Event" + event.name + "(EventStartTime timing=TIMED) : JfrEvent<Event" + event.name + ">(timing) {}");
+            out.write("  Event" + event.name + "(EventStartTime timing=TIMED) : JfrEvent<Event" + event.name
+                    + ">(timing) {}");
         } else {
-          out.write("  Event" + event.name + "(EventStartTime timing=TIMED) {}");
+            out.write("  Event" + event.name + "(EventStartTime timing=TIMED) {}");
         }
         out.write("");
         int index = 0;
         for (FieldElement f : event.fields) {
             out.write("  void set_" + f.name + "(" + f.getParameterType() + " " + f.getParameterName() + ") {");
             if (!empty) {
-              out.write("    this->_" + f.name + " = " + f.getParameterName() + ";");
-              out.write("    DEBUG_ONLY(set_field_bit(" + index++ + "));");
+                out.write("    this->_" + f.name + " = " + f.getParameterName() + ";");
+                out.write("    DEBUG_ONLY(set_field_bit(" + index++ + "));");
             }
             out.write("  }");
         }
         out.write("");
         if (!empty) {
-          printWriteData(out, event.fields, event.commitState);
-          out.write("");
+            printWriteData(out, event);
+            out.write("");
         }
-        out.write("  using JfrEvent<Event" + event.name + ">::commit; // else commit() is hidden by overloaded versions in this class");
+        out.write("  using JfrEvent<Event" + event.name
+                + ">::commit; // else commit() is hidden by overloaded versions in this class");
         printConstructor2(out, event, empty);
         printCommitMethod(out, event, empty);
         if (!empty) {
-          printVerify(out, event.fields);
+            printVerify(out, event.fields);
         }
         out.write("};");
     }
 
-    private static void printWriteData(Printer out, List<FieldElement> fields, String commitState) {
+    private static void printWriteData(Printer out, TypeElement type) {
         out.write("  template <typename Writer>");
         out.write("  void writeData(Writer& w) {");
-        if (("_thread_in_native").equals(commitState)) {
+        if (("_thread_in_native").equals(type.commitState)) {
             out.write("    // explicit epoch synchronization check");
             out.write("    JfrEpochSynchronization sync;");
         }
-        for (FieldElement field : fields) {
+        for (FieldElement field : type.fields) {
             if (field.struct) {
                 out.write("    _" + field.name + ".writeData(w);");
             } else {
@@ -662,9 +874,10 @@ private static void printWriteData(Printer out, List<FieldElement> fields, Strin
 
     private static void printTypeSetter(Printer out, FieldElement field, boolean empty) {
         if (!empty) {
-          out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { this->_" + field.name + " = new_value; }");
+            out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { this->_" + field.name
+                    + " = new_value; }");
         } else {
-          out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { }");
+            out.write("  void set_" + field.name + "(" + field.getParameterType() + " new_value) { }");
         }
     }
 
@@ -674,13 +887,14 @@ private static void printVerify(Printer out, List<FieldElement> fields) {
         out.write("  void verify() const {");
         int index = 0;
         for (FieldElement f : fields) {
-            out.write("    assert(verify_field_bit(" + index++ + "), \"Attempting to write an uninitialized event field: %s\", \"_" + f.name + "\");");
+            out.write("    assert(verify_field_bit(" + index++
+                    + "), \"Attempting to write an uninitialized event field: %s\", \"_" + f.name + "\");");
         }
         out.write("  }");
         out.write("#endif");
     }
 
-    private static void printCommitMethod(Printer out, EventElement event, boolean empty) {
+    private static void printCommitMethod(Printer out, TypeElement event, boolean empty) {
         if (event.startTime) {
             StringJoiner sj = new StringJoiner(",\n              ");
             for (FieldElement f : event.fields) {
@@ -689,12 +903,12 @@ private static void printCommitMethod(Printer out, EventElement event, boolean e
             out.write("");
             out.write("  void commit(" + sj.toString() + ") {");
             if (!empty) {
-              out.write("    if (should_commit()) {");
-              for (FieldElement f : event.fields) {
-                  out.write("      set_" + f.name + "(" + f.name + ");");
-              }
-              out.write("      commit();");
-              out.write("    }");
+                out.write("    if (should_commit()) {");
+                for (FieldElement f : event.fields) {
+                    out.write("      set_" + f.name + "(" + f.name + ");");
+                }
+                out.write("      commit();");
+                out.write("    }");
             }
             out.write("  }");
         }
@@ -715,23 +929,23 @@ private static void printCommitMethod(Printer out, EventElement event, boolean e
         }
         out.write("  static void commit(" + sj.toString() + ") {");
         if (!empty) {
-          out.write("    Event" + event.name + " me(UNTIMED);");
-          out.write("");
-          out.write("    if (me.should_commit()) {");
-          if (event.startTime) {
-              out.write("      me.set_starttime(startTicks);");
-              out.write("      me.set_endtime(endTicks);");
-          }
-          for (FieldElement f : event.fields) {
-              out.write("      me.set_" + f.name + "(" + f.name + ");");
-          }
-          out.write("      me.commit();");
-          out.write("    }");
+            out.write("    Event" + event.name + " me(UNTIMED);");
+            out.write("");
+            out.write("    if (me.should_commit()) {");
+            if (event.startTime) {
+                out.write("      me.set_starttime(startTicks);");
+                out.write("      me.set_endtime(endTicks);");
+            }
+            for (FieldElement f : event.fields) {
+                out.write("      me.set_" + f.name + "(" + f.name + ");");
+            }
+            out.write("      me.commit();");
+            out.write("    }");
         }
         out.write("  }");
     }
 
-    private static void printConstructor2(Printer out, EventElement event, boolean empty) {
+    private static void printConstructor2(Printer out, TypeElement event, boolean empty) {
         if (!event.startTime) {
             out.write("");
             out.write("");
@@ -744,14 +958,14 @@ private static void printConstructor2(Printer out, EventElement event, boolean e
                 sj.add(f.getParameterType() + " " + f.name);
             }
             if (!empty) {
-              out.write("    " + sj.toString() + ") : JfrEvent<Event" + event.name + ">(TIMED) {");
-              out.write("    if (should_commit()) {");
-              for (FieldElement f : event.fields) {
-                  out.write("      set_" + f.name + "(" + f.name + ");");
-              }
-              out.write("    }");
+                out.write("    " + sj.toString() + ") : JfrEvent<Event" + event.name + ">(TIMED) {");
+                out.write("    if (should_commit()) {");
+                for (FieldElement f : event.fields) {
+                    out.write("      set_" + f.name + "(" + f.name + ");");
+                }
+                out.write("    }");
             } else {
-              out.write("    " + sj.toString() + ") {");
+                out.write("    " + sj.toString() + ") {");
             }
             out.write("  }");
         }
diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk
index 55e5026eb38..3bbbea47b8e 100644
--- a/make/test/BuildMicrobenchmark.gmk
+++ b/make/test/BuildMicrobenchmark.gmk
@@ -90,10 +90,11 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
     TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
     SMALL_JAVA := false, \
     CLASSPATH := $(MICROBENCHMARK_CLASSPATH), \
-    DISABLED_WARNINGS := processing rawtypes cast serial, \
+    DISABLED_WARNINGS := processing rawtypes cast serial preview, \
     SRC := $(MICROBENCHMARK_SRC), \
     BIN := $(MICROBENCHMARK_CLASSES), \
     JAVA_FLAGS := --add-modules jdk.unsupported --limit-modules java.management, \
+    JAVAC_FLAGS := --enable-preview, \
 ))
 
 $(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad
index a00e3a68ac4..180038c056d 100644
--- a/src/hotspot/cpu/aarch64/aarch64.ad
+++ b/src/hotspot/cpu/aarch64/aarch64.ad
@@ -13845,7 +13845,7 @@ instruct MoveL2D_reg_reg(vRegD dst, iRegL src) %{
 instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr)
 %{
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base);
+  effect(USE_KILL cnt, USE_KILL base, KILL cr);
 
   ins_cost(4 * INSN_COST);
   format %{ "ClearArray $cnt, $base" %}
diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp
index 79eb8b5ebdc..0ca7f81c022 100644
--- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp
@@ -749,7 +749,7 @@ extern "C" void npf() {
 extern "C" void pf(unsigned long sp, unsigned long fp, unsigned long pc,
                    unsigned long bcx, unsigned long thread) {
   if (!reg_map) {
-    reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtNone);
+    reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtInternal);
     ::new (reg_map) RegisterMap((JavaThread*)thread, false);
   } else {
     *reg_map = RegisterMap((JavaThread*)thread, false);
diff --git a/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp b/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp
index 6fa63a20acd..e3d3d8955d2 100644
--- a/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp
+++ b/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp
@@ -26,10 +26,6 @@
 #ifndef CPU_PPC_GLOBALDEFINITIONS_PPC_HPP
 #define CPU_PPC_GLOBALDEFINITIONS_PPC_HPP
 
-#ifdef CC_INTERP
-#error "CC_INTERP is no longer supported. Removed in change 8145117."
-#endif
-
 #ifndef FILE_AND_LINE
 #define FILE_AND_LINE __FILE__ ":" XSTR(__LINE__)
 #endif
diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
index 522565e00d9..7f2d1348485 100644
--- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include "gc/shared/barrierSetAssembler.hpp"
 #include "interp_masm_ppc.hpp"
 #include "interpreter/interpreterRuntime.hpp"
+#include "oops/methodData.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/safepointMechanism.hpp"
diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad
index 6c72ac5c7c3..d97449c16f6 100644
--- a/src/hotspot/cpu/ppc/ppc.ad
+++ b/src/hotspot/cpu/ppc/ppc.ad
@@ -2296,10 +2296,13 @@ const bool Matcher::match_rule_supported(int opcode) {
   case Op_FmaVD:
     return (SuperwordUseVSX && UseFMA);
   case Op_Digit:
+    return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isDigit);
   case Op_LowerCase:
+    return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isLowerCase);
   case Op_UpperCase:
+    return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isUpperCase);
   case Op_Whitespace:
-    return UseCharacterCompareIntrinsics;
+    return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isWhitespace);
 
   case Op_CacheWB:
   case Op_CacheWBPreSync:
diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
index 089034e4d38..2f4cc7be680 100644
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2013, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "interpreter/templateTable.hpp"
 #include "memory/universe.hpp"
 #include "oops/klass.inline.hpp"
+#include "oops/methodData.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/methodHandles.hpp"
diff --git a/src/hotspot/cpu/s390/globalDefinitions_s390.hpp b/src/hotspot/cpu/s390/globalDefinitions_s390.hpp
index d184b8f7a22..1a6830027a9 100644
--- a/src/hotspot/cpu/s390/globalDefinitions_s390.hpp
+++ b/src/hotspot/cpu/s390/globalDefinitions_s390.hpp
@@ -26,10 +26,6 @@
 #ifndef CPU_S390_GLOBALDEFINITIONS_S390_HPP
 #define CPU_S390_GLOBALDEFINITIONS_S390_HPP
 
-#ifdef CC_INTERP
-#error "CC_INTERP is not supported on z/Architecture."
-#endif
-
 // Convenience macro that produces a string literal with the filename
 // and linenumber of the location where the macro was used.
 #ifndef FILE_AND_LINE
diff --git a/src/hotspot/cpu/s390/interp_masm_s390.cpp b/src/hotspot/cpu/s390/interp_masm_s390.cpp
index c4e8e3be404..6838923b166 100644
--- a/src/hotspot/cpu/s390/interp_masm_s390.cpp
+++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2019 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "interpreter/interpreterRuntime.hpp"
 #include "oops/arrayOop.hpp"
 #include "oops/markWord.hpp"
+#include "oops/methodData.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/basicLock.hpp"
diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
index 5ffdf07cf00..54c65f593b4 100644
--- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
+++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2019, SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "interpreter/templateInterpreterGenerator.hpp"
 #include "interpreter/templateTable.hpp"
 #include "oops/arrayOop.hpp"
+#include "oops/methodData.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
@@ -88,8 +89,8 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
   //
   // On entry:
   //   Z_ARG1  - intptr_t*       Address of java argument list in memory.
-  //   Z_state - cppInterpreter* Address of interpreter state for
-  //                               this method
+  //   Z_state - zeroInterpreter* Address of interpreter state for
+  //                              this method
   //   Z_method
   //
   // On exit (just before return instruction):
diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp
index 1b4a7494010..67a70c94b2b 100644
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 #include "interpreter/interp_masm.hpp"
 #include "interpreter/templateTable.hpp"
 #include "memory/universe.hpp"
+#include "oops/methodData.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/methodHandles.hpp"
diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
index e309c2f3870..3e464462132 100644
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
@@ -3679,14 +3679,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
 
 #ifndef _WINDOWS
 
-#define ASM_SUBTRACT
-
-#ifdef ASM_SUBTRACT
 // Subtract 0:b from carry:a.  Return carry.
-static unsigned long
-sub(unsigned long a[], unsigned long b[], unsigned long carry, long len) {
-  long i = 0, cnt = len;
-  unsigned long tmp;
+static julong
+sub(julong a[], julong b[], julong carry, long len) {
+  long long i = 0, cnt = len;
+  julong tmp;
   asm volatile("clc; "
                "0: ; "
                "mov (%[b], %[i], 8), %[tmp]; "
@@ -3699,24 +3696,6 @@ sub(unsigned long a[], unsigned long b[], unsigned long carry, long len) {
                : "memory");
   return tmp;
 }
-#else // ASM_SUBTRACT
-typedef int __attribute__((mode(TI))) int128;
-
-// Subtract 0:b from carry:a.  Return carry.
-static unsigned long
-sub(unsigned long a[], unsigned long b[], unsigned long carry, int len) {
-  int128 tmp = 0;
-  int i;
-  for (i = 0; i < len; i++) {
-    tmp += a[i];
-    tmp -= b[i];
-    a[i] = tmp;
-    tmp >>= 64;
-    assert(-1 <= tmp && tmp <= 0, "invariant");
-  }
-  return tmp + carry;
-}
-#endif // ! ASM_SUBTRACT
 
 // Multiply (unsigned) Long A by Long B, accumulating the double-
 // length result into the accumulator formed of T0, T1, and T2.
@@ -3739,17 +3718,59 @@ do {                                                            \
            : "r"(A), "a"(B) : "cc");                            \
  } while(0)
 
+#else //_WINDOWS
+
+static julong
+sub(julong a[], julong b[], julong carry, long len) {
+  long i;
+  julong tmp;
+  unsigned char c = 1;
+  for (i = 0; i < len; i++) {
+    c = _addcarry_u64(c, a[i], ~b[i], &tmp);
+    a[i] = tmp;
+  }
+  c = _addcarry_u64(c, carry, ~0, &tmp);
+  return tmp;
+}
+
+// Multiply (unsigned) Long A by Long B, accumulating the double-
+// length result into the accumulator formed of T0, T1, and T2.
+#define MACC(A, B, T0, T1, T2)                          \
+do {                                                    \
+  julong hi, lo;                            \
+  lo = _umul128(A, B, &hi);                             \
+  unsigned char c = _addcarry_u64(0, lo, T0, &T0);      \
+  c = _addcarry_u64(c, hi, T1, &T1);                    \
+  _addcarry_u64(c, T2, 0, &T2);                         \
+ } while(0)
+
+// As above, but add twice the double-length result into the
+// accumulator.
+#define MACC2(A, B, T0, T1, T2)                         \
+do {                                                    \
+  julong hi, lo;                            \
+  lo = _umul128(A, B, &hi);                             \
+  unsigned char c = _addcarry_u64(0, lo, T0, &T0);      \
+  c = _addcarry_u64(c, hi, T1, &T1);                    \
+  _addcarry_u64(c, T2, 0, &T2);                         \
+  c = _addcarry_u64(0, lo, T0, &T0);                    \
+  c = _addcarry_u64(c, hi, T1, &T1);                    \
+  _addcarry_u64(c, T2, 0, &T2);                         \
+ } while(0)
+
+#endif //_WINDOWS
+
 // Fast Montgomery multiplication.  The derivation of the algorithm is
 // in  A Cryptographic Library for the Motorola DSP56000,
 // Dusse and Kaliski, Proc. EUROCRYPT 90, pp. 230-237.
 
-static void __attribute__((noinline))
-montgomery_multiply(unsigned long a[], unsigned long b[], unsigned long n[],
-                    unsigned long m[], unsigned long inv, int len) {
-  unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
+static void NOINLINE
+montgomery_multiply(julong a[], julong b[], julong n[],
+                    julong m[], julong inv, int len) {
+  julong t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
   int i;
 
-  assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
+  assert(inv * n[0] == ULLONG_MAX, "broken inverse in Montgomery multiply");
 
   for (i = 0; i < len; i++) {
     int j;
@@ -3785,13 +3806,13 @@ montgomery_multiply(unsigned long a[], unsigned long b[], unsigned long n[],
 // multiplication.  However, its loop control is more complex and it
 // may actually run slower on some machines.
 
-static void __attribute__((noinline))
-montgomery_square(unsigned long a[], unsigned long n[],
-                  unsigned long m[], unsigned long inv, int len) {
-  unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
+static void NOINLINE
+montgomery_square(julong a[], julong n[],
+                  julong m[], julong inv, int len) {
+  julong t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
   int i;
 
-  assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
+  assert(inv * n[0] == ULLONG_MAX, "broken inverse in Montgomery square");
 
   for (i = 0; i < len; i++) {
     int j;
@@ -3837,13 +3858,13 @@ montgomery_square(unsigned long a[], unsigned long n[],
 }
 
 // Swap words in a longword.
-static unsigned long swap(unsigned long x) {
+static julong swap(julong x) {
   return (x << 32) | (x >> 32);
 }
 
 // Copy len longwords from s to d, word-swapping as we go.  The
 // destination array is reversed.
-static void reverse_words(unsigned long *s, unsigned long *d, int len) {
+static void reverse_words(julong *s, julong *d, int len) {
   d += len;
   while(len-- > 0) {
     d--;
@@ -3865,24 +3886,24 @@ void SharedRuntime::montgomery_multiply(jint *a_ints, jint *b_ints, jint *n_ints
   // Make very sure we don't use so much space that the stack might
   // overflow.  512 jints corresponds to an 16384-bit integer and
   // will use here a total of 8k bytes of stack space.
-  int total_allocation = longwords * sizeof (unsigned long) * 4;
+  int total_allocation = longwords * sizeof (julong) * 4;
   guarantee(total_allocation <= 8192, "must be");
-  unsigned long *scratch = (unsigned long *)alloca(total_allocation);
+  julong *scratch = (julong *)alloca(total_allocation);
 
   // Local scratch arrays
-  unsigned long
+  julong
     *a = scratch + 0 * longwords,
     *b = scratch + 1 * longwords,
     *n = scratch + 2 * longwords,
     *m = scratch + 3 * longwords;
 
-  reverse_words((unsigned long *)a_ints, a, longwords);
-  reverse_words((unsigned long *)b_ints, b, longwords);
-  reverse_words((unsigned long *)n_ints, n, longwords);
+  reverse_words((julong *)a_ints, a, longwords);
+  reverse_words((julong *)b_ints, b, longwords);
+  reverse_words((julong *)n_ints, n, longwords);
 
-  ::montgomery_multiply(a, b, n, m, (unsigned long)inv, longwords);
+  ::montgomery_multiply(a, b, n, m, (julong)inv, longwords);
 
-  reverse_words(m, (unsigned long *)m_ints, longwords);
+  reverse_words(m, (julong *)m_ints, longwords);
 }
 
 void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
@@ -3894,30 +3915,28 @@ void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
   // Make very sure we don't use so much space that the stack might
   // overflow.  512 jints corresponds to an 16384-bit integer and
   // will use here a total of 6k bytes of stack space.
-  int total_allocation = longwords * sizeof (unsigned long) * 3;
+  int total_allocation = longwords * sizeof (julong) * 3;
   guarantee(total_allocation <= 8192, "must be");
-  unsigned long *scratch = (unsigned long *)alloca(total_allocation);
+  julong *scratch = (julong *)alloca(total_allocation);
 
   // Local scratch arrays
-  unsigned long
+  julong
     *a = scratch + 0 * longwords,
     *n = scratch + 1 * longwords,
     *m = scratch + 2 * longwords;
 
-  reverse_words((unsigned long *)a_ints, a, longwords);
-  reverse_words((unsigned long *)n_ints, n, longwords);
+  reverse_words((julong *)a_ints, a, longwords);
+  reverse_words((julong *)n_ints, n, longwords);
 
   if (len >= MONTGOMERY_SQUARING_THRESHOLD) {
-    ::montgomery_square(a, n, m, (unsigned long)inv, longwords);
+    ::montgomery_square(a, n, m, (julong)inv, longwords);
   } else {
-    ::montgomery_multiply(a, a, n, m, (unsigned long)inv, longwords);
+    ::montgomery_multiply(a, a, n, m, (julong)inv, longwords);
   }
 
-  reverse_words(m, (unsigned long *)m_ints, longwords);
+  reverse_words(m, (julong *)m_ints, longwords);
 }
 
-#endif // WINDOWS
-
 #ifdef COMPILER2
 // This is here instead of runtime_x86_64.cpp because it uses SimpleRuntimeFrame
 //
diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
index b1a98598128..37d721ccd11 100644
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
@@ -6566,7 +6566,6 @@ address generate_avx_ghash_processBlocks() {
       StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift();
       StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift();
     }
-#ifndef _WINDOWS
     if (UseMontgomeryMultiplyIntrinsic) {
       StubRoutines::_montgomeryMultiply
         = CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply);
@@ -6575,7 +6574,6 @@ address generate_avx_ghash_processBlocks() {
       StubRoutines::_montgomerySquare
         = CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_square);
     }
-#endif // WINDOWS
 #endif // COMPILER2
 
     if (UseVectorizedMismatchIntrinsic) {
diff --git a/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp b/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
index ee5f6aa888f..d81a73b747f 100644
--- a/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
+++ b/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/cppInterpreter.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
 #include "runtime/frame.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 
diff --git a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp
index 1dbe94d5469..d20fe3e4f7f 100644
--- a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp
+++ b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,10 +25,9 @@
 
 #include "precompiled.hpp"
 #include "asm/assembler.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/bytecodeInterpreter.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/zero/bytecodeInterpreter.inline.hpp"
 #include "oops/methodData.hpp"
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
@@ -40,8 +39,6 @@
 #include "runtime/vframeArray.hpp"
 #include "utilities/debug.hpp"
 
-#ifdef CC_INTERP
-
 const char *BytecodeInterpreter::name_of_field_at_address(address addr) {
 #define DO(member) {if (addr == (address) &(member)) return XSTR(member);}
   DO(_thread);
@@ -102,5 +99,3 @@ void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
   istate->set_stack(stack);
   istate->set_stack_limit(stack_base - method->max_stack() - 1);
 }
-
-#endif // CC_INTERP
diff --git a/src/hotspot/cpu/zero/cppInterpreterGenerator_zero.cpp b/src/hotspot/cpu/zero/cppInterpreterGenerator_zero.cpp
deleted file mode 100644
index fc3596c335b..00000000000
--- a/src/hotspot/cpu/zero/cppInterpreterGenerator_zero.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "asm/assembler.hpp"
-#include "interpreter/bytecodeHistogram.hpp"
-#include "interpreter/cppInterpreterGenerator.hpp"
-#include "interpreter/interpreterRuntime.hpp"
-#include "oops/method.hpp"
-#include "runtime/arguments.hpp"
-#include "interpreter/cppInterpreter.hpp"
-
-address CppInterpreterGenerator::generate_slow_signature_handler() {
-  _masm->advance(1);
-  return (address) InterpreterRuntime::slow_signature_handler;
-}
-
-address CppInterpreterGenerator::generate_math_entry(
-    AbstractInterpreter::MethodKind kind) {
-  if (!InlineIntrinsics)
-    return NULL;
-
-  Unimplemented();
-  return NULL;
-}
-
-address CppInterpreterGenerator::generate_abstract_entry() {
-  return generate_entry((address) ShouldNotCallThisEntry());
-}
-
-address CppInterpreterGenerator::generate_empty_entry() {
-  if (!UseFastEmptyMethods)
-    return NULL;
-
-  return generate_entry((address) CppInterpreter::empty_entry);
-}
-
-address CppInterpreterGenerator::generate_accessor_entry() {
-  if (!UseFastAccessorMethods)
-    return NULL;
-
-  return generate_entry((address) CppInterpreter::accessor_entry);
-}
-
-address CppInterpreterGenerator::generate_Reference_get_entry(void) {
-#if INCLUDE_G1GC
-  if (UseG1GC) {
-    // We need to generate have a routine that generates code to:
-    //   * load the value in the referent field
-    //   * passes that value to the pre-barrier.
-    //
-    // In the case of G1 this will record the value of the
-    // referent in an SATB buffer if marking is active.
-    // This will cause concurrent marking to mark the referent
-    // field as live.
-    Unimplemented();
-  }
-#endif // INCLUDE_G1GC
-
-  // If G1 is not enabled then attempt to go through the normal entry point
-  // Reference.get could be instrumented by jvmti
-  return NULL;
-}
-
-address CppInterpreterGenerator::generate_native_entry(bool synchronized) {
-  return generate_entry((address) CppInterpreter::native_entry);
-}
-
-address CppInterpreterGenerator::generate_normal_entry(bool synchronized) {
-  return generate_entry((address) CppInterpreter::normal_entry);
-}
diff --git a/src/hotspot/cpu/zero/entry_zero.hpp b/src/hotspot/cpu/zero/entry_zero.hpp
index ad14a96822b..925968f4470 100644
--- a/src/hotspot/cpu/zero/entry_zero.hpp
+++ b/src/hotspot/cpu/zero/entry_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,7 +26,7 @@
 #ifndef CPU_ZERO_ENTRY_ZERO_HPP
 #define CPU_ZERO_ENTRY_ZERO_HPP
 
-#include "interpreter/cppInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
 
 class ZeroEntry {
  public:
@@ -69,7 +69,7 @@ class ZeroEntry {
  private:
   static void maybe_deoptimize(int deoptimized_frames, TRAPS) {
     if (deoptimized_frames)
-      CppInterpreter::main_loop(deoptimized_frames - 1, THREAD);
+      ZeroInterpreter::main_loop(deoptimized_frames - 1, THREAD);
   }
 
  public:
diff --git a/src/hotspot/cpu/zero/frame_zero.cpp b/src/hotspot/cpu/zero/frame_zero.cpp
index 3179a0394ea..0158812cc64 100644
--- a/src/hotspot/cpu/zero/frame_zero.cpp
+++ b/src/hotspot/cpu/zero/frame_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,26 +24,16 @@
  */
 
 #include "precompiled.hpp"
-#include "code/scopeDesc.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
-#include "oops/markWord.hpp"
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
-#include "runtime/javaCalls.hpp"
-#include "runtime/monitorChunk.hpp"
 #include "runtime/signature.hpp"
-#include "runtime/stubCodeGenerator.hpp"
-#include "runtime/stubRoutines.hpp"
 #include "vmreg_zero.inline.hpp"
-#ifdef COMPILER1
-#include "c1/c1_Runtime1.hpp"
-#include "runtime/vframeArray.hpp"
-#endif
 
 #ifdef ASSERT
 void RegisterMap::check_location_valid() {
@@ -87,7 +77,6 @@ frame frame::sender(RegisterMap* map) const {
     return sender_for_nonentry_frame(map);
 }
 
-#ifdef CC_INTERP
 BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
   return get_interpreterState()->monitor_base();
 }
@@ -95,7 +84,6 @@ BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
 BasicObjectLock* frame::interpreter_frame_monitor_end() const {
   return (BasicObjectLock*) get_interpreterState()->stack_base();
 }
-#endif // CC_INTERP
 
 void frame::patch_pc(Thread* thread, address pc) {
   if (pc != NULL) {
diff --git a/src/hotspot/cpu/zero/frame_zero.hpp b/src/hotspot/cpu/zero/frame_zero.hpp
index 375bc032424..8c229143a15 100644
--- a/src/hotspot/cpu/zero/frame_zero.hpp
+++ b/src/hotspot/cpu/zero/frame_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,8 +26,6 @@
 #ifndef CPU_ZERO_FRAME_ZERO_HPP
 #define CPU_ZERO_FRAME_ZERO_HPP
 
-#include "runtime/synchronizer.hpp"
-
 // A frame represents a physical stack frame on the Zero stack.
 
  public:
@@ -51,9 +49,7 @@
     return (intptr_t *) zeroframe();
   }
 
-#ifdef CC_INTERP
   inline interpreterState get_interpreterState() const;
-#endif // CC_INTERP
 
  public:
   const EntryFrame *zero_entryframe() const {
diff --git a/src/hotspot/cpu/zero/frame_zero.inline.hpp b/src/hotspot/cpu/zero/frame_zero.inline.hpp
index 598d6c1cc04..11472461d64 100644
--- a/src/hotspot/cpu/zero/frame_zero.inline.hpp
+++ b/src/hotspot/cpu/zero/frame_zero.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -82,7 +82,6 @@ inline intptr_t* frame::link() const {
   return NULL;
 }
 
-#ifdef CC_INTERP
 inline interpreterState frame::get_interpreterState() const {
   return zero_interpreterframe()->interpreter_state();
 }
@@ -119,7 +118,6 @@ inline oop* frame::interpreter_frame_temp_oop_addr() const {
   interpreterState istate = get_interpreterState();
   return (oop *)&istate->_oop_temp;
 }
-#endif // CC_INTERP
 
 inline int frame::interpreter_frame_monitor_size() {
   return BasicObjectLock::size();
diff --git a/src/hotspot/cpu/zero/interpreterFrame_zero.hpp b/src/hotspot/cpu/zero/interpreterFrame_zero.hpp
index cd32fd3bac2..4e96d7b3481 100644
--- a/src/hotspot/cpu/zero/interpreterFrame_zero.hpp
+++ b/src/hotspot/cpu/zero/interpreterFrame_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,13 +26,12 @@
 #ifndef CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
 #define CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
 
-#include "interpreter/bytecodeInterpreter.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
 #include "oops/method.hpp"
 #include "runtime/thread.hpp"
 #include "stack_zero.hpp"
 #include "utilities/align.hpp"
 
-#ifdef CC_INTERP
 // |  ...               |
 // +--------------------+  ------------------
 // | stack slot n-1     |       low addresses
@@ -79,6 +78,5 @@ class InterpreterFrame : public ZeroFrame {
                      char* valuebuf,
                      int   buflen) const;
 };
-#endif // CC_INTERP
 
 #endif // CPU_ZERO_INTERPRETERFRAME_ZERO_HPP
diff --git a/src/hotspot/cpu/zero/methodHandles_zero.cpp b/src/hotspot/cpu/zero/methodHandles_zero.cpp
index a8a6208584d..a644a63251a 100644
--- a/src/hotspot/cpu/zero/methodHandles_zero.cpp
+++ b/src/hotspot/cpu/zero/methodHandles_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,9 +25,9 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaClasses.inline.hpp"
-#include "interpreter/cppInterpreterGenerator.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/zero/zeroInterpreterGenerator.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/method.inline.hpp"
@@ -35,6 +35,7 @@
 #include "runtime/frame.inline.hpp"
 #include "prims/methodHandles.hpp"
 
+
 void MethodHandles::invoke_target(Method* method, TRAPS) {
 
   JavaThread *thread = (JavaThread *) THREAD;
@@ -210,16 +211,16 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
     // Perhaps surprisingly, the symbolic references visible to Java are not directly used.
     // They are linked to Java-generated adapters via MethodHandleNatives.linkMethod.
     // They all allow an appendix argument.
-    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
+    return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
   case vmIntrinsics::_invokeBasic:
-    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
+    return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
   case vmIntrinsics::_linkToStatic:
   case vmIntrinsics::_linkToSpecial:
-    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
+    return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
   case vmIntrinsics::_linkToInterface:
-    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
+    return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
   case vmIntrinsics::_linkToVirtual:
-    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
+    return ZeroInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
   default:
     ShouldNotReachHere();
     return NULL;
diff --git a/src/hotspot/cpu/zero/nativeInst_zero.cpp b/src/hotspot/cpu/zero/nativeInst_zero.cpp
index c60caa507c7..148f6084be2 100644
--- a/src/hotspot/cpu/zero/nativeInst_zero.cpp
+++ b/src/hotspot/cpu/zero/nativeInst_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,17 +26,9 @@
 #include "precompiled.hpp"
 #include "assembler_zero.inline.hpp"
 #include "entry_zero.hpp"
-#include "interpreter/cppInterpreter.hpp"
-#include "memory/resourceArea.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
 #include "nativeInst_zero.hpp"
-#include "oops/oop.inline.hpp"
-#include "runtime/handles.hpp"
 #include "runtime/sharedRuntime.hpp"
-#include "runtime/stubRoutines.hpp"
-#include "utilities/ostream.hpp"
-#ifdef COMPILER1
-#include "c1/c1_Runtime1.hpp"
-#endif
 
 // This method is called by nmethod::make_not_entrant_or_zombie to
 // insert a jump to SharedRuntime::get_handle_wrong_method_stub()
@@ -48,10 +40,6 @@ void NativeJump::patch_verified_entry(address entry,
                                       address dest) {
   assert(dest == SharedRuntime::get_handle_wrong_method_stub(), "should be");
 
-#ifdef CC_INTERP
   ((ZeroEntry*) verified_entry)->set_entry_point(
-    (address) CppInterpreter::normal_entry);
-#else
-  Unimplemented();
-#endif // CC_INTERP
+    (address) ZeroInterpreter::normal_entry);
 }
diff --git a/src/hotspot/cpu/zero/stack_zero.cpp b/src/hotspot/cpu/zero/stack_zero.cpp
index 1f4b0579347..11a5c636a53 100644
--- a/src/hotspot/cpu/zero/stack_zero.cpp
+++ b/src/hotspot/cpu/zero/stack_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
 #include "runtime/thread.inline.hpp"
 #include "stack_zero.hpp"
 #include "stack_zero.inline.hpp"
diff --git a/src/hotspot/cpu/zero/cppInterpreter_zero.cpp b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
similarity index 88%
rename from src/hotspot/cpu/zero/cppInterpreter_zero.cpp
rename to src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
index e7528bcb9e5..00fd5147da5 100644
--- a/src/hotspot/cpu/zero/cppInterpreter_zero.cpp
+++ b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,34 +26,73 @@
 #include "precompiled.hpp"
 #include "asm/assembler.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
-#include "interpreter/cppInterpreter.hpp"
-#include "interpreter/cppInterpreterGenerator.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
-#include "oops/arrayOop.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreterGenerator.hpp"
 #include "oops/cpCache.inline.hpp"
 #include "oops/methodData.hpp"
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
-#include "prims/jvmtiThreadState.hpp"
-#include "runtime/arguments.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/sharedRuntime.hpp"
-#include "runtime/stubRoutines.hpp"
-#include "runtime/synchronizer.hpp"
 #include "runtime/timer.hpp"
-#include "runtime/vframeArray.hpp"
-#include "stack_zero.inline.hpp"
+#include "runtime/timerTrace.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
-#ifdef CC_INTERP
+#include "entry_zero.hpp"
+#include "stack_zero.inline.hpp"
+
+void ZeroInterpreter::initialize_stub() {
+  if (_code != NULL) return;
+
+  // generate interpreter
+  int code_size = InterpreterCodeSize;
+  NOT_PRODUCT(code_size *= 4;)  // debug uses extra interpreter code space
+  _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
+                         "Interpreter");
+}
+
+void ZeroInterpreter::initialize_code() {
+  AbstractInterpreter::initialize();
+
+  // generate interpreter
+  { ResourceMark rm;
+    TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime));
+    ZeroInterpreterGenerator g(_code);
+    if (PrintInterpreter) print();
+  }
+
+  // Allow c++ interpreter to do one initialization now that switches are set, etc.
+  BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
+  if (JvmtiExport::can_post_interpreter_events())
+    BytecodeInterpreter::runWithChecks(&start_msg);
+  else
+    BytecodeInterpreter::run(&start_msg);
+}
+
+void ZeroInterpreter::invoke_method(Method* method, address entry_point, TRAPS) {
+  ((ZeroEntry *) entry_point)->invoke(method, THREAD);
+}
+
+void ZeroInterpreter::invoke_osr(Method* method,
+                                address   entry_point,
+                                address   osr_buf,
+                                TRAPS) {
+  ((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD);
+}
 
+
+
+InterpreterCodelet* ZeroInterpreter::codelet_containing(address pc) {
+  // FIXME: I'm pretty sure _code is null and this is never called, which is why it's copied.
+  return (InterpreterCodelet*)_code->stub_containing(pc);
+}
 #define fixup_after_potential_safepoint()       \
   method = istate->method()
 
@@ -66,7 +105,7 @@
   CALL_VM_NOCHECK_NOFIX(func)                   \
   fixup_after_potential_safepoint()
 
-int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
+int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
 
   // Allocate and initialize our frame.
@@ -104,7 +143,7 @@ intptr_t narrow(BasicType type, intptr_t result) {
 }
 
 
-void CppInterpreter::main_loop(int recurse, TRAPS) {
+void ZeroInterpreter::main_loop(int recurse, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
 
@@ -234,7 +273,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
   }
 }
 
-int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
+int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
   // Make sure method is native and not abstract
   assert(method->is_native() && !method->is_abstract(), "should be");
 
@@ -247,6 +286,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
   interpreterState istate = frame->interpreter_state();
   intptr_t *locals = istate->locals();
 
+#if 0
   // Update the invocation counter
   if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
     MethodCounters* mcs = method->method_counters();
@@ -264,6 +304,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
         goto unwind_and_return;
     }
   }
+#endif
 
   // Lock if necessary
   BasicObjectLock *monitor;
@@ -504,7 +545,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
   return 0;
 }
 
-int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
+int ZeroInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
   intptr_t *locals = stack->sp();
@@ -637,7 +678,7 @@ int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
   return 0;
 }
 
-int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
+int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
 
@@ -656,7 +697,7 @@ int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
 // The new slots will be inserted before slot insert_before.
 // Slots < insert_before will have the same slot number after the insert.
 // Slots >= insert_before will become old_slot + num_slots.
-void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
+void ZeroInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
 
@@ -670,7 +711,7 @@ void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
     SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i + num_slots), i);
 }
 
-void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
+void ZeroInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
   intptr_t *vmslots = stack->sp();
@@ -683,13 +724,13 @@ void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
   stack->set_sp(stack->sp() + num_slots);
 }
 
-BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
+BasicType ZeroInterpreter::result_type_of_handle(oop method_handle) {
   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
   oop return_type = java_lang_invoke_MethodType::rtype(method_type);
   return java_lang_Class::as_BasicType(return_type, (Klass* *) NULL);
 }
 
-intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
+intptr_t* ZeroInterpreter::calculate_unwind_sp(ZeroStack* stack,
                                               oop method_handle) {
   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
   int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
@@ -697,7 +738,7 @@ intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
   return stack->sp() + argument_slots;
 }
 
-JRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
+JRT_ENTRY(void, ZeroInterpreter::throw_exception(JavaThread* thread,
                                                 Symbol*     name,
                                                 char*       message))
   THROW_MSG(name, message);
@@ -804,18 +845,27 @@ InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
   return (InterpreterFrame *) fp;
 }
 
-address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
+address ZeroInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   ShouldNotCallThis();
   return NULL;
 }
 
-address CppInterpreter::deopt_entry(TosState state, int length) {
+address ZeroInterpreter::deopt_entry(TosState state, int length) {
+  return NULL;
+}
+
+address ZeroInterpreter::remove_activation_preserving_args_entry() {
+  // Do an uncommon trap type entry. c++ interpreter will know
+  // to pop frame and preserve the args
+  return Interpreter::deopt_entry(vtos, 0);
+}
+
+address ZeroInterpreter::remove_activation_early_entry(TosState state) {
   return NULL;
 }
 
 // Helper for figuring out if frames are interpreter frames
 
-bool CppInterpreter::contains(address pc) {
+bool ZeroInterpreter::contains(address pc) {
   return false; // make frame::print_value_on work
 }
-#endif // CC_INTERP
diff --git a/src/hotspot/cpu/zero/cppInterpreter_zero.hpp b/src/hotspot/cpu/zero/zeroInterpreter_zero.hpp
similarity index 96%
rename from src/hotspot/cpu/zero/cppInterpreter_zero.hpp
rename to src/hotspot/cpu/zero/zeroInterpreter_zero.hpp
index 40811cacdf0..e534ff2fa29 100644
--- a/src/hotspot/cpu/zero/cppInterpreter_zero.hpp
+++ b/src/hotspot/cpu/zero/zeroInterpreter_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp
index ff13754d113..64face5268a 100644
--- a/src/hotspot/os/aix/os_aix.cpp
+++ b/src/hotspot/os/aix/os_aix.cpp
@@ -53,7 +53,6 @@
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -2704,7 +2703,7 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
 //  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
 //
 //  Note that resume_clear_context() and suspend_save_context() are needed
-//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  by SR_handler(), so that fetch_frame_from_context() works,
 //  which in part is used by:
 //    - Forte Analyzer: AsyncGetCallTrace()
 //    - StackBanging: get_frame_at_stack_banging_point()
diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp
index 84e1e0ca465..57cfe91509a 100644
--- a/src/hotspot/os/bsd/os_bsd.cpp
+++ b/src/hotspot/os/bsd/os_bsd.cpp
@@ -44,7 +44,6 @@
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -2330,7 +2329,7 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr)
 //  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
 //
 //  Note that resume_clear_context() and suspend_save_context() are needed
-//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  by SR_handler(), so that fetch_frame_from_context() works,
 //  which in part is used by:
 //    - Forte Analyzer: AsyncGetCallTrace()
 //    - StackBanging: get_frame_at_stack_banging_point()
diff --git a/src/hotspot/os/bsd/os_bsd.hpp b/src/hotspot/os/bsd/os_bsd.hpp
index c9afcdad10f..f894dd2fb9e 100644
--- a/src/hotspot/os/bsd/os_bsd.hpp
+++ b/src/hotspot/os/bsd/os_bsd.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -82,14 +82,6 @@ class Bsd {
   static intptr_t* ucontext_get_sp(const ucontext_t* uc);
   static intptr_t* ucontext_get_fp(const ucontext_t* uc);
 
-  // For Analyzer Forte AsyncGetCallTrace profiling support:
-  //
-  // This interface should be declared in os_bsd_i486.hpp, but
-  // that file provides extensions to the os class and not the
-  // Bsd class.
-  static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
-                                              intptr_t** ret_sp, intptr_t** ret_fp);
-
   static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
 
   // This boolean allows users to forward their own non-matching signals
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 6176d6faa18..b08caf4d5d3 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -45,7 +45,6 @@
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/init.hpp"
@@ -4482,7 +4481,7 @@ OSReturn os::get_native_priority(const Thread* const thread,
 //  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
 //
 //  Note that resume_clear_context() and suspend_save_context() are needed
-//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  by SR_handler(), so that fetch_frame_from_context() works,
 //  which in part is used by:
 //    - Forte Analyzer: AsyncGetCallTrace()
 //    - StackBanging: get_frame_at_stack_banging_point()
diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp
index 0687d03012b..754773a7d61 100644
--- a/src/hotspot/os/linux/os_linux.hpp
+++ b/src/hotspot/os/linux/os_linux.hpp
@@ -145,14 +145,6 @@ class Linux {
   static intptr_t* ucontext_get_sp(const ucontext_t* uc);
   static intptr_t* ucontext_get_fp(const ucontext_t* uc);
 
-  // For Analyzer Forte AsyncGetCallTrace profiling support:
-  //
-  // This interface should be declared in os_linux_i486.hpp, but
-  // that file provides extensions to the os class and not the
-  // Linux class.
-  static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
-                                              intptr_t** ret_sp, intptr_t** ret_fp);
-
   static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
 
   // This boolean allows users to forward their own non-matching signals
diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp
index be2ea26ddcf..698407b7807 100644
--- a/src/hotspot/os/windows/os_windows.cpp
+++ b/src/hotspot/os/windows/os_windows.cpp
@@ -46,7 +46,6 @@
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
index 9e3438e8f74..e5e4bbc434e 100644
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
@@ -40,7 +40,6 @@
 #include "prims/jvm_misc.hpp"
 #include "porting_aix.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -110,19 +109,18 @@ static address ucontext_get_lr(const ucontext_t * uc) {
   return (address)uc->uc_mcontext.jmp_context.lr;
 }
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
-                                        intptr_t** ret_sp, intptr_t** ret_fp) {
+address os::fetch_frame_from_context(const void* ucVoid,
+                                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Aix::ucontext_get_pc(uc));
+    epc = os::Aix::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Aix::ucontext_get_sp(uc);
     if (ret_fp) *ret_fp = os::Aix::ucontext_get_fp(uc);
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -133,10 +131,10 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
   // Avoid crash during crash if pc broken.
-  if (epc.pc()) {
-    frame fr(sp, epc.pc());
+  if (epc) {
+    frame fr(sp, epc);
     return fr;
   }
   frame fr(sp);
diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
index 69621b8e712..51e69ea9247 100644
--- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
+++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
@@ -38,7 +38,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -313,35 +312,18 @@ intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) {
   return (intptr_t*)uc->context_fp;
 }
 
-// For Forte Analyzer AsyncGetCallTrace profiling support - thread
-// is currently interrupted by SIGPROF.
-// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
-// frames. Currently we don't do that on Bsd, so it's the same as
-// os::fetch_frame_from_context().
-// This method is also used for stack overflow signal handling.
-ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread,
-  const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
-
-  assert(thread != NULL, "just checking");
-  assert(ret_sp != NULL, "just checking");
-  assert(ret_fp != NULL, "just checking");
-
-  return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
-}
-
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address  epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Bsd::ucontext_get_pc(uc));
+    epc = os::Bsd::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Bsd::ucontext_get_sp(uc);
     if (ret_fp) *ret_fp = os::Bsd::ucontext_get_fp(uc);
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -352,15 +334,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
-}
-
-frame os::fetch_frame_from_ucontext(Thread* thread, void* ucVoid) {
-  intptr_t* sp;
-  intptr_t* fp;
-  ExtendedPC epc = os::Bsd::fetch_frame_from_ucontext(thread, (ucontext_t*)ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, fp, epc);
 }
 
 bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
@@ -370,7 +345,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u
     // been generated while the compilers perform it before. To maintain
     // semantic consistency between interpreted and compiled frames, the
     // method returns the Java sender of the current frame.
-    *fr = os::fetch_frame_from_ucontext(thread, uc);
+    *fr = os::fetch_frame_from_context(uc);
     if (!fr->is_first_java_frame()) {
       // get_frame_at_stack_banging_point() is only called when we
       // have well defined stacks so java_sender() calls do not need
@@ -386,7 +361,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u
       // stack overflow handling
       return false;
     } else {
-      *fr = os::fetch_frame_from_ucontext(thread, uc);
+      *fr = os::fetch_frame_from_context(uc);
       // in compiled code, the stack banging is performed just after the return pc
       // has been pushed on the stack
       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
diff --git a/src/hotspot/os_cpu/bsd_x86/thread_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/thread_bsd_x86.cpp
index 2d64def4801..3522cad9e1f 100644
--- a/src/hotspot/os_cpu/bsd_x86/thread_bsd_x86.cpp
+++ b/src/hotspot/os_cpu/bsd_x86/thread_bsd_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,24 +64,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
 
     intptr_t* ret_fp;
     intptr_t* ret_sp;
-    ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc,
-      &ret_sp, &ret_fp);
-    if (addr.pc() == NULL || ret_sp == NULL ) {
+    address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
+    if (addr == NULL || ret_sp == NULL ) {
       // ucontext wasn't useful
       return false;
     }
 
-    if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
+    if (MetaspaceShared::is_in_trampoline_frame(addr)) {
       // In the middle of a trampoline call. Bail out for safety.
       // This happens rarely so shouldn't affect profiling.
       return false;
     }
 
-    frame ret_frame(ret_sp, ret_fp, addr.pc());
+    frame ret_frame(ret_sp, ret_fp, addr);
     if (!ret_frame.safe_for_sender(jt)) {
 #if COMPILER2_OR_JVMCI
       // C2 and JVMCI use ebp as a general register see if NULL fp helps
-      frame ret_frame2(ret_sp, NULL, addr.pc());
+      frame ret_frame2(ret_sp, NULL, addr);
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
         return false;
diff --git a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp
index 4c21793f99a..4db293eca15 100644
--- a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp
+++ b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp
@@ -43,7 +43,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -103,11 +102,11 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
   ShouldNotCallThis();
 }
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
-                                        intptr_t** ret_sp,
-                                        intptr_t** ret_fp) {
+address os::fetch_frame_from_context(const void* ucVoid,
+                                     intptr_t** ret_sp,
+                                     intptr_t** ret_fp) {
   ShouldNotCallThis();
-  return ExtendedPC();
+  return NULL;
 }
 
 frame os::fetch_frame_from_context(const void* ucVoid) {
diff --git a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
index ecd05e70d13..0075e7e841c 100644
--- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
@@ -39,7 +39,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -108,34 +107,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
   return (intptr_t*)uc->uc_mcontext.regs[REG_FP];
 }
 
-// For Forte Analyzer AsyncGetCallTrace profiling support - thread
-// is currently interrupted by SIGPROF.
-// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
-// frames. Currently we don't do that on Linux, so it's the same as
-// os::fetch_frame_from_context().
-ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
-  const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
-
-  assert(thread != NULL, "just checking");
-  assert(ret_sp != NULL, "just checking");
-  assert(ret_fp != NULL, "just checking");
-
-  return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
-}
-
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
+    epc = os::Linux::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
     if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -146,8 +129,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, fp, epc);
 }
 
 bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
diff --git a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp
index 9084daeaa2e..c09244ed754 100644
--- a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp
+++ b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -65,23 +65,22 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
 
     intptr_t* ret_fp;
     intptr_t* ret_sp;
-    ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
-      &ret_sp, &ret_fp);
-    if (addr.pc() == NULL || ret_sp == NULL ) {
+    address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
+    if (addr == NULL || ret_sp == NULL ) {
       // ucontext wasn't useful
       return false;
     }
 
-    if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
+    if (MetaspaceShared::is_in_trampoline_frame(addr)) {
       // In the middle of a trampoline call. Bail out for safety.
       // This happens rarely so shouldn't affect profiling.
       return false;
     }
 
-    frame ret_frame(ret_sp, ret_fp, addr.pc());
+    frame ret_frame(ret_sp, ret_fp, addr);
     if (!ret_frame.safe_for_sender(jt)) {
 #ifdef COMPILER2
-      frame ret_frame2(ret_sp, NULL, addr.pc());
+      frame ret_frame2(ret_sp, NULL, addr);
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
         return false;
diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
index 4a5b5337e85..eb54fd091da 100644
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
@@ -37,7 +37,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -142,34 +141,19 @@ bool is_safe_for_fp(address pc) {
 #endif
 }
 
-// For Forte Analyzer AsyncGetCallTrace profiling support - thread
-// is currently interrupted by SIGPROF.
-// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
-// frames. Currently we don't do that on Linux, so it's the same as
-// os::fetch_frame_from_context().
-ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
-  const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
-
-  assert(thread != NULL, "just checking");
-  assert(ret_sp != NULL, "just checking");
-  assert(ret_fp != NULL, "just checking");
-
-  return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
-}
-
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
+    epc = os::Linux::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
     if (ret_fp) {
       intptr_t* fp = os::Linux::ucontext_get_fp(uc);
 #ifndef __thumb__
-      if (CodeCache::find_blob(epc.pc()) == NULL) {
+      if (CodeCache::find_blob(epc) == NULL) {
         // It's a C frame. We need to adjust the fp.
         fp += os::C_frame_offset;
       }
@@ -178,15 +162,14 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
       // the frame created will not be walked.
       // However, ensure FP is set correctly when reliable and
       // potentially necessary.
-      if (!is_safe_for_fp(epc.pc())) {
+      if (!is_safe_for_fp(epc)) {
         // FP unreliable
         fp = (intptr_t *)NULL;
       }
       *ret_fp = fp;
     }
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -197,8 +180,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, fp, epc);
 }
 
 frame os::get_sender_for_C_frame(frame* fr) {
diff --git a/src/hotspot/os_cpu/linux_arm/thread_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/thread_linux_arm.cpp
index d7752d63717..8776e9198bc 100644
--- a/src/hotspot/os_cpu/linux_arm/thread_linux_arm.cpp
+++ b/src/hotspot/os_cpu/linux_arm/thread_linux_arm.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,24 +99,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
 
     intptr_t* ret_fp;
     intptr_t* ret_sp;
-    ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
-      &ret_sp, &ret_fp);
-    if (addr.pc() == NULL || ret_sp == NULL ) {
+    address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
+    if (addr == NULL || ret_sp == NULL ) {
       // ucontext wasn't useful
       return false;
     }
 
-    if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
+    if (MetaspaceShared::is_in_trampoline_frame(addr)) {
       // In the middle of a trampoline call. Bail out for safety.
       // This happens rarely so shouldn't affect profiling.
       return false;
     }
 
-    frame ret_frame(ret_sp, ret_fp, addr.pc());
+    frame ret_frame(ret_sp, ret_fp, addr);
     if (!ret_frame.safe_for_sender(jt)) {
 #ifdef COMPILER2
       // C2 uses ebp as a general register see if NULL fp helps
-      frame ret_frame2(ret_sp, NULL, addr.pc());
+      frame ret_frame2(ret_sp, NULL, addr);
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
         return false;
diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
index 50c77a96f65..0f5251df602 100644
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
@@ -39,7 +39,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -136,19 +135,18 @@ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
   return uc->uc_mcontext.regs->trap;
 }
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
+    epc = os::Linux::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
     if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -159,8 +157,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, epc);
 }
 
 bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
diff --git a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
index 316b83a9f43..e803c6fdce8 100644
--- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
+++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
@@ -42,7 +42,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -119,19 +118,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
   return NULL;
 }
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
+    epc = os::Linux::ucontext_get_pc(uc);
     if (ret_sp) { *ret_sp = os::Linux::ucontext_get_sp(uc); }
     if (ret_fp) { *ret_fp = os::Linux::ucontext_get_fp(uc); }
   } else {
-    // Construct empty ExtendedPC for return value checking.
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) { *ret_sp = (intptr_t *)NULL; }
     if (ret_fp) { *ret_fp = (intptr_t *)NULL; }
   }
@@ -142,8 +140,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, epc);
 }
 
 bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
index fd441e61ed1..a902d938373 100644
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
@@ -38,7 +38,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -122,35 +121,18 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
   return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
 }
 
-// For Forte Analyzer AsyncGetCallTrace profiling support - thread
-// is currently interrupted by SIGPROF.
-// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal
-// frames. Currently we don't do that on Linux, so it's the same as
-// os::fetch_frame_from_context().
-// This method is also used for stack overflow signal handling.
-ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
-  const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
-
-  assert(thread != NULL, "just checking");
-  assert(ret_sp != NULL, "just checking");
-  assert(ret_fp != NULL, "just checking");
-
-  return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
-}
-
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address epc;
   const ucontext_t* uc = (const ucontext_t*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
+    epc = os::Linux::ucontext_get_pc(uc);
     if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
     if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -161,15 +143,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
-}
-
-frame os::fetch_frame_from_ucontext(Thread* thread, void* ucVoid) {
-  intptr_t* sp;
-  intptr_t* fp;
-  ExtendedPC epc = os::Linux::fetch_frame_from_ucontext(thread, (ucontext_t*)ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, fp, epc);
 }
 
 bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) {
@@ -179,7 +154,7 @@ bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t*
     // been generated while the compilers perform it before. To maintain
     // semantic consistency between interpreted and compiled frames, the
     // method returns the Java sender of the current frame.
-    *fr = os::fetch_frame_from_ucontext(thread, uc);
+    *fr = os::fetch_frame_from_context(uc);
     if (!fr->is_first_java_frame()) {
       // get_frame_at_stack_banging_point() is only called when we
       // have well defined stacks so java_sender() calls do not need
diff --git a/src/hotspot/os_cpu/linux_x86/thread_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/thread_linux_x86.cpp
index 68e08761b8c..f2e5ef10310 100644
--- a/src/hotspot/os_cpu/linux_x86/thread_linux_x86.cpp
+++ b/src/hotspot/os_cpu/linux_x86/thread_linux_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,24 +65,23 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
 
     intptr_t* ret_fp;
     intptr_t* ret_sp;
-    ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc,
-      &ret_sp, &ret_fp);
-    if (addr.pc() == NULL || ret_sp == NULL ) {
+    address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
+    if (addr == NULL || ret_sp == NULL ) {
       // ucontext wasn't useful
       return false;
     }
 
-    if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
+    if (MetaspaceShared::is_in_trampoline_frame(addr)) {
       // In the middle of a trampoline call. Bail out for safety.
       // This happens rarely so shouldn't affect profiling.
       return false;
     }
 
-    frame ret_frame(ret_sp, ret_fp, addr.pc());
+    frame ret_frame(ret_sp, ret_fp, addr);
     if (!ret_frame.safe_for_sender(jt)) {
 #if COMPILER2_OR_JVMCI
       // C2 and JVMCI use ebp as a general register see if NULL fp helps
-      frame ret_frame2(ret_sp, NULL, addr.pc());
+      frame ret_frame2(ret_sp, NULL, addr);
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
         return false;
diff --git a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
index d431d96dda1..d9e2382bf2c 100644
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
@@ -38,7 +38,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -99,9 +98,9 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
   ShouldNotCallThis();
 }
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
-                                        intptr_t** ret_sp,
-                                        intptr_t** ret_fp) {
+address os::fetch_frame_from_context(const void* ucVoid,
+                                     intptr_t** ret_sp,
+                                     intptr_t** ret_fp) {
   ShouldNotCallThis();
   return NULL; // silence compile warnings
 }
diff --git a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
index 77309f0331a..2e7e7ed6d41 100644
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010, 2018, Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -34,6 +34,19 @@
   // Note: Currently only used in 64 bit Windows implementations
   static bool register_code_area(char *low, char *high) { return true; }
 
+  /*
+   * Work-around for broken NX emulation using CS limit, Red Hat patch "Exec-Shield"
+   * (IA32 only).
+   *
+   * Map and execute at a high VA to prevent CS lazy updates race with SMP MM
+   * invalidation.Further code generation by the JVM will no longer cause CS limit
+   * updates.
+   *
+   * Affects IA32: RHEL 5 & 6, Ubuntu 10.04 (LTS), 10.10, 11.04, 11.10, 12.04.
+   * @see JDK-8023956
+   */
+  static void workaround_expand_exec_shield_cs_limit();
+
   // Atomically copy 64 bits of data
   static void atomic_copy64(const volatile void *src, volatile void *dst) {
 #if defined(PPC32) && !defined(__SPE__)
diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
index cbfec96405a..878ea3da9ef 100644
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -38,7 +38,6 @@
 #include "prims/jniFastGetField.hpp"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
@@ -430,19 +429,18 @@ bool os::platform_print_native_stack(outputStream* st, const void* context,
 }
 #endif // AMD64
 
-ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+address os::fetch_frame_from_context(const void* ucVoid,
                     intptr_t** ret_sp, intptr_t** ret_fp) {
 
-  ExtendedPC  epc;
+  address  epc;
   CONTEXT* uc = (CONTEXT*)ucVoid;
 
   if (uc != NULL) {
-    epc = ExtendedPC((address)uc->REG_PC);
+    epc = (address)uc->REG_PC;
     if (ret_sp) *ret_sp = (intptr_t*)uc->REG_SP;
     if (ret_fp) *ret_fp = (intptr_t*)uc->REG_FP;
   } else {
-    // construct empty ExtendedPC for return value checking
-    epc = ExtendedPC(NULL);
+    epc = NULL;
     if (ret_sp) *ret_sp = (intptr_t *)NULL;
     if (ret_fp) *ret_fp = (intptr_t *)NULL;
   }
@@ -453,8 +451,8 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
 frame os::fetch_frame_from_context(const void* ucVoid) {
   intptr_t* sp;
   intptr_t* fp;
-  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
-  return frame(sp, fp, epc.pc());
+  address epc = fetch_frame_from_context(ucVoid, &sp, &fp);
+  return frame(sp, fp, epc);
 }
 
 // VC++ does not save frame pointer on stack in optimized build. It
diff --git a/src/hotspot/os_cpu/windows_x86/thread_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/thread_windows_x86.cpp
index 69fff0318e9..7d9048c57c6 100644
--- a/src/hotspot/os_cpu/windows_x86/thread_windows_x86.cpp
+++ b/src/hotspot/os_cpu/windows_x86/thread_windows_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,28 +68,28 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
 #ifdef AMD64
     intptr_t* ret_fp = (intptr_t*) uc->Rbp;
     intptr_t* ret_sp = (intptr_t*) uc->Rsp;
-    ExtendedPC addr = ExtendedPC((address)uc->Rip);
+    address addr = (address)uc->Rip;
 #else
     intptr_t* ret_fp = (intptr_t*) uc->Ebp;
     intptr_t* ret_sp = (intptr_t*) uc->Esp;
-    ExtendedPC addr = ExtendedPC((address)uc->Eip);
+    address addr = (address)uc->Eip;
 #endif // AMD64
-    if (addr.pc() == NULL || ret_sp == NULL ) {
+    if (addr == NULL || ret_sp == NULL ) {
       // CONTEXT wasn't useful
       return false;
     }
 
-    if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {
+    if (MetaspaceShared::is_in_trampoline_frame(addr)) {
       // In the middle of a trampoline call. Bail out for safety.
       // This happens rarely so shouldn't affect profiling.
       return false;
     }
 
-    frame ret_frame(ret_sp, ret_fp, addr.pc());
+    frame ret_frame(ret_sp, ret_fp, addr);
     if (!ret_frame.safe_for_sender(jt)) {
 #if COMPILER2_OR_JVMCI
       // C2 and JVMCI use ebp as a general register see if NULL fp helps
-      frame ret_frame2(ret_sp, NULL, addr.pc());
+      frame ret_frame2(ret_sp, NULL, addr);
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
         return false;
diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp
index c75433a4d57..949213d3290 100644
--- a/src/hotspot/share/ci/ciField.cpp
+++ b/src/hotspot/share/ci/ciField.cpp
@@ -231,6 +231,9 @@ static bool trust_final_non_static_fields(ciInstanceKlass* holder) {
   // Trust final fields in all boxed classes
   if (holder->is_box_klass())
     return true;
+  // Trust final fields in records
+  if (holder->is_record())
+    return true;
   // Trust final fields in String
   if (holder->name() == ciSymbol::java_lang_String())
     return true;
diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp
index 987e001b424..4fb1be82e98 100644
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp
@@ -64,6 +64,7 @@ ciInstanceKlass::ciInstanceKlass(Klass* k) :
   _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods();
   _is_unsafe_anonymous = ik->is_unsafe_anonymous();
   _is_hidden = ik->is_hidden();
+  _is_record = ik->is_record();
   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
   _has_injected_fields = -1;
   _implementor = NULL; // we will fill these lazily
@@ -125,6 +126,7 @@ ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
   _has_injected_fields = -1;
   _is_unsafe_anonymous = false;
   _is_hidden = false;
+  _is_record = false;
   _loader = loader;
   _protection_domain = protection_domain;
   _is_shared = false;
diff --git a/src/hotspot/share/ci/ciInstanceKlass.hpp b/src/hotspot/share/ci/ciInstanceKlass.hpp
index 9ecc3da6e03..d03ecdc3a87 100644
--- a/src/hotspot/share/ci/ciInstanceKlass.hpp
+++ b/src/hotspot/share/ci/ciInstanceKlass.hpp
@@ -57,6 +57,7 @@ class ciInstanceKlass : public ciKlass {
   bool                   _has_nonstatic_concrete_methods;
   bool                   _is_unsafe_anonymous;
   bool                   _is_hidden;
+  bool                   _is_record;
 
   ciFlags                _flags;
   jint                   _nonstatic_field_size;
@@ -200,6 +201,10 @@ class ciInstanceKlass : public ciKlass {
     return _is_hidden;
   }
 
+  bool is_record() const {
+    return _is_record;
+  }
+
   ciInstanceKlass* get_canonical_holder(int offset);
   ciField* get_field_by_offset(int field_offset, bool is_static);
   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp
index 3a8dfdae60d..8c87e08a589 100644
--- a/src/hotspot/share/classfile/classLoaderData.cpp
+++ b/src/hotspot/share/classfile/classLoaderData.cpp
@@ -55,6 +55,7 @@
 #include "classfile/packageEntry.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
@@ -487,7 +488,7 @@ void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
 void ClassLoaderData::initialize_holder(Handle loader_or_mirror) {
   if (loader_or_mirror() != NULL) {
     assert(_holder.is_null(), "never replace holders");
-    _holder = WeakHandle<vm_weak_data>::create(loader_or_mirror);
+    _holder = WeakHandle(OopStorageSet::vm_weak(), loader_or_mirror);
   }
 }
 
@@ -654,7 +655,7 @@ ClassLoaderData::~ClassLoaderData() {
   ClassLoaderDataGraph::dec_instance_classes(cl.instance_class_released());
 
   // Release the WeakHandle
-  _holder.release();
+  _holder.release(OopStorageSet::vm_weak());
 
   // Release C heap allocated hashtable for all the packages.
   if (_packages != NULL) {
diff --git a/src/hotspot/share/classfile/classLoaderData.hpp b/src/hotspot/share/classfile/classLoaderData.hpp
index ba2393f8dd0..7615bcb75af 100644
--- a/src/hotspot/share/classfile/classLoaderData.hpp
+++ b/src/hotspot/share/classfile/classLoaderData.hpp
@@ -109,9 +109,9 @@ class ClassLoaderData : public CHeapObj<mtClass> {
 
   static ClassLoaderData * _the_null_class_loader_data;
 
-  WeakHandle<vm_weak_data> _holder; // The oop that determines lifetime of this class loader
-  OopHandle _class_loader;          // The instance of java/lang/ClassLoader associated with
-                                    // this ClassLoaderData
+  WeakHandle _holder;       // The oop that determines lifetime of this class loader
+  OopHandle  _class_loader; // The instance of java/lang/ClassLoader associated with
+                            // this ClassLoaderData
 
   ClassLoaderMetaspace * volatile _metaspace;  // Meta-space where meta-data defined by the
                                     // classes in the class loader are allocated.
diff --git a/src/hotspot/share/classfile/dictionary.cpp b/src/hotspot/share/classfile/dictionary.cpp
index 8b10f5abdb1..2ae13f48fec 100644
--- a/src/hotspot/share/classfile/dictionary.cpp
+++ b/src/hotspot/share/classfile/dictionary.cpp
@@ -27,6 +27,7 @@
 #include "classfile/dictionary.hpp"
 #include "classfile/protectionDomainCache.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/iterator.hpp"
@@ -406,14 +407,14 @@ oop SymbolPropertyEntry::method_type() const {
 }
 
 void SymbolPropertyEntry::set_method_type(oop p) {
-  _method_type = OopHandle::create(p);
+  _method_type = OopHandle(OopStorageSet::vm_global(), p);
 }
 
 void SymbolPropertyEntry::free_entry() {
   // decrement Symbol refcount here because hashtable doesn't.
   literal()->decrement_refcount();
   // Free OopHandle
-  _method_type.release();
+  _method_type.release(OopStorageSet::vm_global());
 }
 
 SymbolPropertyTable::SymbolPropertyTable(int table_size)
diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp
index 51b95e96ed5..63c068da6cc 100644
--- a/src/hotspot/share/classfile/javaClasses.cpp
+++ b/src/hotspot/share/classfile/javaClasses.cpp
@@ -3141,6 +3141,7 @@ int java_lang_reflect_Field::_name_offset;
 int java_lang_reflect_Field::_type_offset;
 int java_lang_reflect_Field::_slot_offset;
 int java_lang_reflect_Field::_modifiers_offset;
+int java_lang_reflect_Field::_trusted_final_offset;
 int java_lang_reflect_Field::_signature_offset;
 int java_lang_reflect_Field::_annotations_offset;
 
@@ -3150,6 +3151,7 @@ int java_lang_reflect_Field::_annotations_offset;
   macro(_type_offset,      k, vmSymbols::type_name(),      class_signature,  false); \
   macro(_slot_offset,      k, vmSymbols::slot_name(),      int_signature,    false); \
   macro(_modifiers_offset, k, vmSymbols::modifiers_name(), int_signature,    false); \
+  macro(_trusted_final_offset,    k, vmSymbols::trusted_final_name(),    bool_signature,       false); \
   macro(_signature_offset,        k, vmSymbols::signature_name(),        string_signature,     false); \
   macro(_annotations_offset,      k, vmSymbols::annotations_name(),      byte_array_signature, false);
 
@@ -3214,6 +3216,10 @@ void java_lang_reflect_Field::set_modifiers(oop field, int value) {
   field->int_field_put(_modifiers_offset, value);
 }
 
+void java_lang_reflect_Field::set_trusted_final(oop field) {
+  field->bool_field_put(_trusted_final_offset, true);
+}
+
 void java_lang_reflect_Field::set_signature(oop field, oop value) {
   field->obj_field_put(_signature_offset, value);
 }
diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp
index c219abc954a..e33391c63e0 100644
--- a/src/hotspot/share/classfile/javaClasses.hpp
+++ b/src/hotspot/share/classfile/javaClasses.hpp
@@ -696,6 +696,7 @@ class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
   static int _type_offset;
   static int _slot_offset;
   static int _modifiers_offset;
+  static int _trusted_final_offset;
   static int _signature_offset;
   static int _annotations_offset;
 
@@ -723,6 +724,8 @@ class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
   static int modifiers(oop field);
   static void set_modifiers(oop field, int value);
 
+  static void set_trusted_final(oop field);
+
   static void set_signature(oop constructor, oop value);
   static void set_annotations(oop constructor, oop value);
   static void set_parameter_annotations(oop method, oop value);
@@ -1121,6 +1124,7 @@ class java_lang_invoke_MemberName: AllStatic {
     MN_IS_FIELD              = 0x00040000, // field
     MN_IS_TYPE               = 0x00080000, // nested type
     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
+    MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
     // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
diff --git a/src/hotspot/share/classfile/moduleEntry.cpp b/src/hotspot/share/classfile/moduleEntry.cpp
index ac962fa3f01..80d96adb1d7 100644
--- a/src/hotspot/share/classfile/moduleEntry.cpp
+++ b/src/hotspot/share/classfile/moduleEntry.cpp
@@ -29,6 +29,7 @@
 #include "classfile/javaClasses.inline.hpp"
 #include "classfile/moduleEntry.hpp"
 #include "logging/log.hpp"
+#include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/oopHandle.inline.hpp"
@@ -55,6 +56,9 @@ void ModuleEntry::set_location(Symbol* location) {
 
   if (location != NULL) {
     location->increment_refcount();
+    CDS_ONLY(if (UseSharedSpaces) {
+        _shared_path_index = FileMapInfo::get_module_shared_path_index(location);
+      });
   }
 }
 
diff --git a/src/hotspot/share/classfile/moduleEntry.hpp b/src/hotspot/share/classfile/moduleEntry.hpp
index 422d1024d8d..8aa885464c8 100644
--- a/src/hotspot/share/classfile/moduleEntry.hpp
+++ b/src/hotspot/share/classfile/moduleEntry.hpp
@@ -69,6 +69,7 @@ class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
   GrowableArray<ModuleEntry*>* _reads; // list of modules that are readable by this module
   Symbol* _version;                    // module version number
   Symbol* _location;                   // module location
+  CDS_ONLY(int _shared_path_index;)    // >=0 if classes in this module are in CDS archive
   bool _can_read_all_unnamed;
   bool _has_default_read_edges;        // JVMTI redefine/retransform support
   bool _must_walk_reads;               // walk module's reads list at GC safepoints to purge out dead modules
@@ -90,6 +91,7 @@ class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
     _must_walk_reads = false;
     _is_patched = false;
     _is_open = false;
+    CDS_ONLY(_shared_path_index = -1);
   }
 
   Symbol*          name() const                        { return literal(); }
@@ -154,6 +156,7 @@ class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
 
   void set_is_patched() {
       _is_patched = true;
+      CDS_ONLY(_shared_path_index = -1); // Mark all shared classes in this module invisible.
   }
   bool is_patched() {
       return _is_patched;
@@ -182,6 +185,8 @@ class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
   void print(outputStream* st = tty);
   void verify();
 
+  CDS_ONLY(int shared_path_index() { return _shared_path_index;})
+
   JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
 };
 
diff --git a/src/hotspot/share/classfile/protectionDomainCache.cpp b/src/hotspot/share/classfile/protectionDomainCache.cpp
index 78bfbb72344..fd6f3b8da08 100644
--- a/src/hotspot/share/classfile/protectionDomainCache.cpp
+++ b/src/hotspot/share/classfile/protectionDomainCache.cpp
@@ -27,6 +27,7 @@
 #include "classfile/dictionary.hpp"
 #include "classfile/protectionDomainCache.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/iterator.hpp"
@@ -45,7 +46,7 @@ int ProtectionDomainCacheTable::index_for(Handle protection_domain) {
 }
 
 ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size)
-  : Hashtable<WeakHandle<vm_weak_data>, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
+  : Hashtable<WeakHandle, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
 {   _dead_entries = false;
     _total_oops_removed = 0;
 }
@@ -93,7 +94,7 @@ void ProtectionDomainCacheTable::unlink() {
           LogStream ls(lt);
           ls.print_cr("protection domain unlinked at %d", i);
         }
-        entry->literal().release();
+        entry->literal().release(OopStorageSet::vm_weak());
         *p = entry->next();
         free_entry(entry);
       }
@@ -180,8 +181,8 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, uns
     protection_domain->print_value_on(&ls);
     ls.cr();
   }
-  WeakHandle<vm_weak_data> w = WeakHandle<vm_weak_data>::create(protection_domain);
+  WeakHandle w(OopStorageSet::vm_weak(), protection_domain);
   ProtectionDomainCacheEntry* p = new_entry(hash, w);
-  Hashtable<WeakHandle<vm_weak_data>, mtClass>::add_entry(index, p);
+  Hashtable<WeakHandle, mtClass>::add_entry(index, p);
   return p;
 }
diff --git a/src/hotspot/share/classfile/protectionDomainCache.hpp b/src/hotspot/share/classfile/protectionDomainCache.hpp
index 44efdc5f0b6..2534af216c8 100644
--- a/src/hotspot/share/classfile/protectionDomainCache.hpp
+++ b/src/hotspot/share/classfile/protectionDomainCache.hpp
@@ -35,18 +35,18 @@
 // to dictionary.hpp pd_set for more information about how protection domain entries
 // are used.
 // This table is walked during GC, rather than the class loader data graph dictionaries.
-class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle<vm_weak_data>, mtClass> {
+class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle, mtClass> {
   friend class VMStructs;
  public:
   oop object();
   oop object_no_keepalive();
 
   ProtectionDomainCacheEntry* next() {
-    return (ProtectionDomainCacheEntry*)HashtableEntry<WeakHandle<vm_weak_data>, mtClass>::next();
+    return (ProtectionDomainCacheEntry*)HashtableEntry<WeakHandle, mtClass>::next();
   }
 
   ProtectionDomainCacheEntry** next_addr() {
-    return (ProtectionDomainCacheEntry**)HashtableEntry<WeakHandle<vm_weak_data>, mtClass>::next_addr();
+    return (ProtectionDomainCacheEntry**)HashtableEntry<WeakHandle, mtClass>::next_addr();
   }
 
   void verify();
@@ -61,21 +61,21 @@ class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle<vm_weak_data
 // we only need to iterate over this set.
 // The amount of different protection domains used is typically magnitudes smaller
 // than the number of system dictionary entries (loaded classes).
-class ProtectionDomainCacheTable : public Hashtable<WeakHandle<vm_weak_data>, mtClass> {
+class ProtectionDomainCacheTable : public Hashtable<WeakHandle, mtClass> {
   friend class VMStructs;
 private:
   ProtectionDomainCacheEntry* bucket(int i) const {
-    return (ProtectionDomainCacheEntry*) Hashtable<WeakHandle<vm_weak_data>, mtClass>::bucket(i);
+    return (ProtectionDomainCacheEntry*) Hashtable<WeakHandle, mtClass>::bucket(i);
   }
 
   // The following method is not MT-safe and must be done under lock.
   ProtectionDomainCacheEntry** bucket_addr(int i) {
-    return (ProtectionDomainCacheEntry**) Hashtable<WeakHandle<vm_weak_data>, mtClass>::bucket_addr(i);
+    return (ProtectionDomainCacheEntry**) Hashtable<WeakHandle, mtClass>::bucket_addr(i);
   }
 
-  ProtectionDomainCacheEntry* new_entry(unsigned int hash, WeakHandle<vm_weak_data> protection_domain) {
+  ProtectionDomainCacheEntry* new_entry(unsigned int hash, WeakHandle protection_domain) {
     ProtectionDomainCacheEntry* entry = (ProtectionDomainCacheEntry*)
-      Hashtable<WeakHandle<vm_weak_data>, mtClass>::new_entry(hash, protection_domain);
+      Hashtable<WeakHandle, mtClass>::new_entry(hash, protection_domain);
     return entry;
   }
 
diff --git a/src/hotspot/share/classfile/stringTable.cpp b/src/hotspot/share/classfile/stringTable.cpp
index 98c21cdd11b..ed96e649eaf 100644
--- a/src/hotspot/share/classfile/stringTable.cpp
+++ b/src/hotspot/share/classfile/stringTable.cpp
@@ -103,7 +103,7 @@ uintx hash_string(const jchar* s, int len, bool useAlt) {
 class StringTableConfig : public StackObj {
  private:
  public:
-  typedef WeakHandle<vm_string_table_data> Value;
+  typedef WeakHandle Value;
 
   static uintx get_hash(Value const& value, bool* is_dead) {
     EXCEPTION_MARK;
@@ -129,7 +129,7 @@ class StringTableConfig : public StackObj {
     return AllocateHeap(size, mtSymbol);
   }
   static void free_node(void* memory, Value const& value) {
-    value.release();
+    value.release(OopStorageSet::string_table_weak());
     FreeHeap(memory);
     StringTable::item_removed();
   }
@@ -150,7 +150,7 @@ class StringTableLookupJchar : StackObj {
   uintx get_hash() const {
     return _hash;
   }
-  bool equals(WeakHandle<vm_string_table_data>* value, bool* is_dead) {
+  bool equals(WeakHandle* value, bool* is_dead) {
     oop val_oop = value->peek();
     if (val_oop == NULL) {
       // dead oop, mark this hash dead for cleaning
@@ -182,7 +182,7 @@ class StringTableLookupOop : public StackObj {
     return _hash;
   }
 
-  bool equals(WeakHandle<vm_string_table_data>* value, bool* is_dead) {
+  bool equals(WeakHandle* value, bool* is_dead) {
     oop val_oop = value->peek();
     if (val_oop == NULL) {
       // dead oop, mark this hash dead for cleaning
@@ -272,7 +272,7 @@ class StringTableGet : public StackObj {
   Handle  _return;
  public:
   StringTableGet(Thread* thread) : _thread(thread) {}
-  void operator()(WeakHandle<vm_string_table_data>* val) {
+  void operator()(WeakHandle* val) {
     oop result = val->resolve();
     assert(result != NULL, "Result should be reachable");
     _return = Handle(_thread, result);
@@ -368,7 +368,7 @@ oop StringTable::do_intern(Handle string_or_null_h, const jchar* name,
   bool rehash_warning;
   do {
     // Callers have already looked up the String using the jchar* name, so just go to add.
-    WeakHandle<vm_string_table_data> wh = WeakHandle<vm_string_table_data>::create(string_h);
+    WeakHandle wh(OopStorageSet::string_table_weak(), string_h);
     // The hash table takes ownership of the WeakHandle, even if it's not inserted.
     if (_local_table->insert(THREAD, lookup, wh, &rehash_warning)) {
       update_needs_rehash(rehash_warning);
@@ -406,7 +406,7 @@ void StringTable::grow(JavaThread* jt) {
 }
 
 struct StringTableDoDelete : StackObj {
-  void operator()(WeakHandle<vm_string_table_data>* val) {
+  void operator()(WeakHandle* val) {
     /* do nothing */
   }
 };
@@ -415,7 +415,7 @@ struct StringTableDeleteCheck : StackObj {
   long _count;
   long _item;
   StringTableDeleteCheck() : _count(0), _item(0) {}
-  bool operator()(WeakHandle<vm_string_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     ++_item;
     oop tmp = val->peek();
     if (tmp == NULL) {
@@ -551,7 +551,7 @@ static int literal_size(oop obj) {
 }
 
 struct SizeFunc : StackObj {
-  size_t operator()(WeakHandle<vm_string_table_data>* val) {
+  size_t operator()(WeakHandle* val) {
     oop s = val->peek();
     if (s == NULL) {
       // Dead
@@ -577,7 +577,7 @@ void StringTable::print_table_statistics(outputStream* st,
 // Verification
 class VerifyStrings : StackObj {
  public:
-  bool operator()(WeakHandle<vm_string_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     oop s = val->peek();
     if (s != NULL) {
       assert(java_lang_String::length(s) >= 0, "Length on string must work.");
@@ -601,7 +601,7 @@ class VerifyCompStrings : StackObj {
  public:
   size_t _errors;
   VerifyCompStrings(GrowableArray<oop>* oops) : _oops(oops), _errors(0) {}
-  bool operator()(WeakHandle<vm_string_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     oop s = val->resolve();
     if (s == NULL) {
       return true;
@@ -639,7 +639,7 @@ class PrintString : StackObj {
   outputStream* _st;
  public:
   PrintString(Thread* thr, outputStream* st) : _thr(thr), _st(st) {}
-  bool operator()(WeakHandle<vm_string_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     oop s = val->peek();
     if (s == NULL) {
       return true;
@@ -744,7 +744,7 @@ oop StringTable::create_archived_string(oop s, Thread* THREAD) {
 struct CopyToArchive : StackObj {
   CompactHashtableWriter* _writer;
   CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
-  bool operator()(WeakHandle<vm_string_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     oop s = val->peek();
     if (s == NULL) {
       return true;
diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp
index a7f3a245464..004af96f302 100644
--- a/src/hotspot/share/classfile/symbolTable.cpp
+++ b/src/hotspot/share/classfile/symbolTable.cpp
@@ -513,6 +513,13 @@ Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, boo
   }
 
   assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
+#if INCLUDE_CDS
+  if (DumpSharedSpaces) {
+    if (sym != NULL) {
+      MetaspaceShared::add_symbol(sym);
+    }
+  }
+#endif
   return sym;
 }
 
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
index 3a460f95b59..e509b218b72 100644
--- a/src/hotspot/share/classfile/systemDictionary.cpp
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
@@ -46,6 +46,7 @@
 #include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
 #include "gc/shared/gcTraceTime.inline.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jfr/jfrEvents.hpp"
@@ -175,7 +176,7 @@ void SystemDictionary::compute_java_loaders(TRAPS) {
                          vmSymbols::void_classloader_signature(),
                          CHECK);
 
-  _java_system_loader = OopHandle::create((oop)result.get_jobject());
+  _java_system_loader = OopHandle(OopStorageSet::vm_global(), (oop)result.get_jobject());
 
   JavaCalls::call_static(&result,
                          class_loader_klass,
@@ -183,7 +184,7 @@ void SystemDictionary::compute_java_loaders(TRAPS) {
                          vmSymbols::void_classloader_signature(),
                          CHECK);
 
-  _java_platform_loader = OopHandle::create((oop)result.get_jobject());
+  _java_platform_loader = OopHandle(OopStorageSet::vm_global(), (oop)result.get_jobject());
 }
 
 ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, bool create_mirror_cld) {
@@ -1240,104 +1241,92 @@ InstanceKlass* SystemDictionary::load_shared_boot_class(Symbol* class_name,
   return NULL;
 }
 
-// Check if a shared class can be loaded by the specific classloader:
-//
-// NULL classloader:
-//   - Module class from "modules" jimage. ModuleEntry must be defined in the classloader.
-//   - Class from -Xbootclasspath/a. The class has no defined PackageEntry, or must
-//     be defined in an unnamed module.
+// Check if a shared class can be loaded by the specific classloader.
 bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
                                                InstanceKlass* ik,
                                                PackageEntry* pkg_entry,
                                                Handle class_loader, TRAPS) {
   assert(!ModuleEntryTable::javabase_moduleEntry()->is_patched(),
          "Cannot use sharing if java.base is patched");
-  if (ik->shared_classpath_index() < 0) {
-    // path_index < 0 indicates that the class is intended for a custom loader
-    // and should not be loaded by boot/platform/app loaders
-    if (is_builtin_class_loader(class_loader())) {
+
+  // (1) Check if we are loading into the same loader as in dump time.
+
+  if (ik->is_shared_boot_class()) {
+    if (class_loader() != NULL) {
+      return false;
+    }
+  } else if (ik->is_shared_platform_class()) {
+    if (class_loader() != java_platform_loader()) {
+      return false;
+    }
+  } else if (ik->is_shared_app_class()) {
+    if (class_loader() != java_system_loader()) {
+      return false;
+    }
+  } else {
+    // ik was loaded by a custom loader during dump time
+    if (class_loader_data(class_loader)->is_builtin_class_loader_data()) {
       return false;
     } else {
       return true;
     }
   }
 
-  // skip class visibility check
+  // (2) Check if we are loading into the same module from the same location as in dump time.
+
   if (MetaspaceShared::use_optimized_module_handling()) {
-    assert(SystemDictionary::is_shared_class_visible_impl(class_name, ik, pkg_entry, class_loader, THREAD), "Optimizing module handling failed.");
+    // Class visibility has not changed between dump time and run time, so a class
+    // that was visible (and thus archived) during dump time is always visible during runtime.
+    assert(SystemDictionary::is_shared_class_visible_impl(class_name, ik, pkg_entry, class_loader, THREAD),
+           "visibility cannot change between dump time and runtime");
     return true;
   }
   return is_shared_class_visible_impl(class_name, ik, pkg_entry, class_loader, THREAD);
 }
 
 bool SystemDictionary::is_shared_class_visible_impl(Symbol* class_name,
-                                               InstanceKlass* ik,
-                                               PackageEntry* pkg_entry,
-                                               Handle class_loader, TRAPS) {
-  int path_index = ik->shared_classpath_index();
-  ClassLoaderData* loader_data = class_loader_data(class_loader);
-  SharedClassPathEntry* ent =
-            (SharedClassPathEntry*)FileMapInfo::shared_path(path_index);
+                                                    InstanceKlass* ik,
+                                                    PackageEntry* pkg_entry,
+                                                    Handle class_loader, TRAPS) {
+  int scp_index = ik->shared_classpath_index();
+  assert(!ik->is_shared_unregistered_class(), "this function should be called for built-in classes only");
+  assert(scp_index >= 0, "must be");
+  SharedClassPathEntry* scp_entry = FileMapInfo::shared_path(scp_index);
   if (!Universe::is_module_initialized()) {
-    assert(ent != NULL && ent->is_modules_image(),
+    assert(scp_entry != NULL && scp_entry->is_modules_image(),
            "Loading non-bootstrap classes before the module system is initialized");
     assert(class_loader.is_null(), "sanity");
     return true;
   }
-  // Get the pkg_entry from the classloader
-  ModuleEntry* mod_entry = NULL;
-  TempNewSymbol pkg_name = pkg_entry != NULL ? pkg_entry->name() :
-                                               ClassLoader::package_from_class_name(class_name);
-  if (pkg_name != NULL) {
-    if (loader_data != NULL) {
-      if (pkg_entry != NULL) {
-        mod_entry = pkg_entry->module();
-        // If the archived class is from a module that has been patched at runtime,
-        // the class cannot be loaded from the archive.
-        if (mod_entry != NULL && mod_entry->is_patched()) {
-          return false;
-        }
-      }
-    }
-  }
 
-  if (class_loader.is_null()) {
-    assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry");
-    // The NULL classloader can load archived class originated from the
-    // "modules" jimage and the -Xbootclasspath/a. For class from the
-    // "modules" jimage, the PackageEntry/ModuleEntry must be defined
-    // by the NULL classloader.
-    if (mod_entry != NULL) {
-      // PackageEntry/ModuleEntry is found in the classloader. Check if the
-      // ModuleEntry's location agrees with the archived class' origination.
-      if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
-        return true; // Module class from the "module" jimage
-      }
-    }
+  ModuleEntry* mod_entry = (pkg_entry == NULL) ? NULL : pkg_entry->module();
+  bool should_be_in_named_module = (mod_entry != NULL && mod_entry->is_named());
+  bool was_archived_from_named_module = scp_entry->in_named_module();
+  bool visible;
 
-    // If the archived class is not from the "module" jimage, the class can be
-    // loaded by the NULL classloader if
-    //
-    // 1. the class is from the unamed package
-    // 2. or, the class is not from a module defined in the NULL classloader
-    // 3. or, the class is from an unamed module
-    if (!ent->is_modules_image() && ik->is_shared_boot_class()) {
-      // the class is from the -Xbootclasspath/a
-      if (pkg_name == NULL ||
-          pkg_entry == NULL ||
-          pkg_entry->in_unnamed_module()) {
-        assert(mod_entry == NULL ||
-               mod_entry == loader_data->unnamed_module(),
-               "the unnamed module is not defined in the classloader");
-        return true;
+  if (was_archived_from_named_module) {
+    if (should_be_in_named_module) {
+      // Is the module loaded from the same location as during dump time?
+      visible = mod_entry->shared_path_index() == scp_index;
+      if (visible) {
+        assert(!mod_entry->is_patched(), "cannot load archived classes for patched module");
       }
+    } else {
+      // During dump time, this class was in a named module, but at run time, this class should be
+      // in an unnamed module.
+      visible = false;
     }
-    return false;
   } else {
-    bool res = SystemDictionaryShared::is_shared_class_visible_for_classloader(
-              ik, class_loader, pkg_name, pkg_entry, mod_entry, CHECK_(false));
-    return res;
+    if (should_be_in_named_module) {
+      // During dump time, this class was in an unnamed, but at run time, this class should be
+      // in a named module.
+      visible = false;
+    } else {
+      visible = true;
+    }
   }
+
+  return visible;
 }
 
 bool SystemDictionary::check_shared_class_super_type(InstanceKlass* child, InstanceKlass* super_type,
@@ -2041,7 +2030,7 @@ void SystemDictionary::initialize(TRAPS) {
 
   // Allocate private object used as system class loader lock
   oop lock_obj = oopFactory::new_intArray(0, CHECK);
-  _system_loader_lock_obj = OopHandle::create(lock_obj);
+  _system_loader_lock_obj = OopHandle(OopStorageSet::vm_global(), lock_obj);
 
   // Initialize basic classes
   resolve_well_known_classes(CHECK);
diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp
index 520e8e7f86e..4d5cda155a6 100644
--- a/src/hotspot/share/classfile/systemDictionaryShared.cpp
+++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp
@@ -36,6 +36,7 @@
 #include "classfile/systemDictionaryShared.hpp"
 #include "classfile/verificationType.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "jfr/jfrEvents.hpp"
 #include "logging/log.hpp"
 #include "memory/allocation.hpp"
@@ -885,114 +886,6 @@ bool SystemDictionaryShared::is_sharing_possible(ClassLoaderData* loader_data) {
           SystemDictionary::is_platform_class_loader(class_loader));
 }
 
-// Currently AppCDS only archives classes from the run-time image, the
-// -Xbootclasspath/a path, the class path, and the module path.
-//
-// Check if a shared class can be loaded by the specific classloader. Following
-// are the "visible" archived classes for different classloaders.
-//
-// NULL classloader:
-//   - see SystemDictionary::is_shared_class_visible()
-// Platform classloader:
-//   - Module class from runtime image. ModuleEntry must be defined in the
-//     classloader.
-// App classloader:
-//   - Module Class from runtime image and module path. ModuleEntry must be defined in the
-//     classloader.
-//   - Class from -cp. The class must have no PackageEntry defined in any of the
-//     boot/platform/app classloader, or must be in the unnamed module defined in the
-//     AppClassLoader.
-bool SystemDictionaryShared::is_shared_class_visible_for_classloader(
-                                                     InstanceKlass* ik,
-                                                     Handle class_loader,
-                                                     Symbol* pkg_name,
-                                                     PackageEntry* pkg_entry,
-                                                     ModuleEntry* mod_entry,
-                                                     TRAPS) {
-  assert(class_loader.not_null(), "Class loader should not be NULL");
-  assert(Universe::is_module_initialized(), "Module system is not initialized");
-  ResourceMark rm(THREAD);
-
-  int path_index = ik->shared_classpath_index();
-  SharedClassPathEntry* ent =
-            (SharedClassPathEntry*)FileMapInfo::shared_path(path_index);
-
-  if (SystemDictionary::is_platform_class_loader(class_loader())) {
-    assert(ent != NULL, "shared class for PlatformClassLoader should have valid SharedClassPathEntry");
-    // The PlatformClassLoader can only load archived class originated from the
-    // run-time image. The class' PackageEntry/ModuleEntry must be
-    // defined by the PlatformClassLoader.
-    if (mod_entry != NULL) {
-      // PackageEntry/ModuleEntry is found in the classloader. Check if the
-      // ModuleEntry's location agrees with the archived class' origination.
-      if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
-        return true; // Module class from the runtime image
-      }
-    }
-  } else if (SystemDictionary::is_system_class_loader(class_loader())) {
-    assert(ent != NULL, "shared class for system loader should have valid SharedClassPathEntry");
-    if (pkg_name == NULL) {
-      // The archived class is in the unnamed package. Currently, the boot image
-      // does not contain any class in the unnamed package.
-      assert(!ent->is_modules_image(), "Class in the unnamed package must be from the classpath");
-      if (path_index >= ClassLoaderExt::app_class_paths_start_index()) {
-        assert(path_index < ClassLoaderExt::app_module_paths_start_index(), "invalid path_index");
-        return true;
-      }
-    } else {
-      // Check if this is from a PackageEntry/ModuleEntry defined in the AppClassloader.
-      if (pkg_entry == NULL) {
-        // It's not guaranteed that the class is from the classpath if the
-        // PackageEntry cannot be found from the AppClassloader. Need to check
-        // the boot and platform classloader as well.
-        ClassLoaderData* platform_loader_data =
-          ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader()); // can be NULL during bootstrap
-        if ((platform_loader_data == NULL ||
-             ClassLoader::get_package_entry(pkg_name, platform_loader_data) == NULL) &&
-             ClassLoader::get_package_entry(pkg_name, ClassLoaderData::the_null_class_loader_data()) == NULL) {
-          // The PackageEntry is not defined in any of the boot/platform/app classloaders.
-          // The archived class must from -cp path and not from the runtime image.
-          if (!ent->is_modules_image() && path_index >= ClassLoaderExt::app_class_paths_start_index() &&
-                                          path_index < ClassLoaderExt::app_module_paths_start_index()) {
-            return true;
-          }
-        }
-      } else if (mod_entry != NULL) {
-        // The package/module is defined in the AppClassLoader. We support
-        // archiving application module class from the runtime image or from
-        // a named module from a module path.
-        // Packages from the -cp path are in the unnamed_module.
-        if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
-          // shared module class from runtime image
-          return true;
-        } else if (pkg_entry->in_unnamed_module() && path_index >= ClassLoaderExt::app_class_paths_start_index() &&
-            path_index < ClassLoaderExt::app_module_paths_start_index()) {
-          // shared class from -cp
-          DEBUG_ONLY( \
-            ClassLoaderData* loader_data = class_loader_data(class_loader); \
-            assert(mod_entry == loader_data->unnamed_module(), "the unnamed module is not defined in the classloader");)
-          return true;
-        } else {
-          if(!pkg_entry->in_unnamed_module() &&
-              (path_index >= ClassLoaderExt::app_module_paths_start_index())&&
-              (path_index < FileMapInfo::get_number_of_shared_paths()) &&
-              (strcmp(ent->name(), ClassLoader::skip_uri_protocol(mod_entry->location()->as_C_string())) == 0)) {
-            // shared module class from module path
-            return true;
-          } else {
-            assert(path_index < FileMapInfo::get_number_of_shared_paths(), "invalid path_index");
-          }
-        }
-      }
-    }
-  } else {
-    // TEMP: if a shared class can be found by a custom loader, consider it visible now.
-    // FIXME: is this actually correct?
-    return true;
-  }
-  return false;
-}
-
 bool SystemDictionaryShared::has_platform_or_app_classes() {
   if (FileMapInfo::current_info()->has_platform_or_app_classes()) {
     return true;
@@ -1025,7 +918,7 @@ bool SystemDictionaryShared::has_platform_or_app_classes() {
 // [b] BuiltinClassLoader.loadClassOrNull() first calls findLoadedClass(name).
 // [c] At this point, if we can find the named class inside the
 //     shared_dictionary, we can perform further checks (see
-//     is_shared_class_visible_for_classloader() to ensure that this class
+//     SystemDictionary::is_shared_class_visible) to ensure that this class
 //     was loaded by the same class loader during dump time.
 //
 // Given these assumptions, we intercept the findLoadedClass() call to invoke
@@ -1118,7 +1011,7 @@ void SystemDictionaryShared::allocate_shared_protection_domain_array(int size, T
   if (_shared_protection_domains.resolve() == NULL) {
     oop spd = oopFactory::new_objArray(
         SystemDictionary::ProtectionDomain_klass(), size, CHECK);
-    _shared_protection_domains = OopHandle::create(spd);
+    _shared_protection_domains = OopHandle(OopStorageSet::vm_global(), spd);
   }
 }
 
@@ -1126,7 +1019,7 @@ void SystemDictionaryShared::allocate_shared_jar_url_array(int size, TRAPS) {
   if (_shared_jar_urls.resolve() == NULL) {
     oop sju = oopFactory::new_objArray(
         SystemDictionary::URL_klass(), size, CHECK);
-    _shared_jar_urls = OopHandle::create(sju);
+    _shared_jar_urls = OopHandle(OopStorageSet::vm_global(), sju);
   }
 }
 
@@ -1134,7 +1027,7 @@ void SystemDictionaryShared::allocate_shared_jar_manifest_array(int size, TRAPS)
   if (_shared_jar_manifests.resolve() == NULL) {
     oop sjm = oopFactory::new_objArray(
         SystemDictionary::Jar_Manifest_klass(), size, CHECK);
-    _shared_jar_manifests = OopHandle::create(sjm);
+    _shared_jar_manifests = OopHandle(OopStorageSet::vm_global(), sjm);
   }
 }
 
diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp
index 7124ca440ed..929ea601e80 100644
--- a/src/hotspot/share/classfile/systemDictionaryShared.hpp
+++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp
@@ -242,12 +242,6 @@ class SystemDictionaryShared: public SystemDictionary {
 
   // Check if sharing is supported for the class loader.
   static bool is_sharing_possible(ClassLoaderData* loader_data);
-  static bool is_shared_class_visible_for_classloader(InstanceKlass* ik,
-                                                      Handle class_loader,
-                                                      Symbol* pkg_name,
-                                                      PackageEntry* pkg_entry,
-                                                      ModuleEntry* mod_entry,
-                                                      TRAPS);
 
   static bool add_unregistered_class(InstanceKlass* k, TRAPS);
   static InstanceKlass* dump_time_resolve_super_or_fail(Symbol* child_name,
diff --git a/src/hotspot/share/classfile/vmSymbols.cpp b/src/hotspot/share/classfile/vmSymbols.cpp
index 6aa26f285b1..1b33b8c1cf4 100644
--- a/src/hotspot/share/classfile/vmSymbols.cpp
+++ b/src/hotspot/share/classfile/vmSymbols.cpp
@@ -32,6 +32,7 @@
 #include "memory/metaspaceClosure.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
+#include "utilities/tribool.hpp"
 #include "utilities/xmlstream.hpp"
 
 
@@ -460,43 +461,7 @@ int vmIntrinsics::predicates_needed(vmIntrinsics::ID id) {
   }
 }
 
-bool vmIntrinsics::is_intrinsic_available(vmIntrinsics::ID id) {
-  return !vmIntrinsics::is_intrinsic_disabled(id) &&
-    !vmIntrinsics::is_disabled_by_flags(id);
-}
-
-bool vmIntrinsics::is_intrinsic_disabled(vmIntrinsics::ID id) {
-  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
-
-  // Canonicalize DisableIntrinsic to contain only ',' as a separator.
-  // Note, DirectiveSet may not be created at this point yet since this code
-  // is called from initial stub geenration code.
-  char* local_list = (char*)DirectiveSet::canonicalize_disableintrinsic(DisableIntrinsic);
-  char* save_ptr;
-  bool found = false;
-
-  char* token = strtok_r(local_list, ",", &save_ptr);
-  while (token != NULL) {
-    if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
-      found = true;
-      break;
-    } else {
-      token = strtok_r(NULL, ",", &save_ptr);
-    }
-  }
-
-  FREE_C_HEAP_ARRAY(char, local_list);
-  return found;
-}
-
-
-bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
-  vmIntrinsics::ID id = method->intrinsic_id();
-  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
-  return is_disabled_by_flags(id);
-}
-
-bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
+bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) {
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 
   // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in
@@ -861,25 +826,86 @@ static const char* vm_intrinsic_name_bodies =
                    VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
 
 static const char* vm_intrinsic_name_table[vmIntrinsics::ID_LIMIT];
+static TriBoolArray<vmIntrinsics::ID_LIMIT, int> vm_intrinsic_control_words;
+
+static void init_vm_intrinsic_name_table() {
+  const char** nt = &vm_intrinsic_name_table[0];
+  char* string = (char*) &vm_intrinsic_name_bodies[0];
+  for (int index = vmIntrinsics::FIRST_ID; index < vmIntrinsics::ID_LIMIT; index++) {
+    nt[index] = string;
+    string += strlen(string); // skip string body
+    string += 1;              // skip trailing null
+  }
+  assert(!strcmp(nt[vmIntrinsics::_hashCode], "_hashCode"), "lined up");
+  nt[vmIntrinsics::_none] = "_none";
+}
 
 const char* vmIntrinsics::name_at(vmIntrinsics::ID id) {
   const char** nt = &vm_intrinsic_name_table[0];
   if (nt[_none] == NULL) {
-    char* string = (char*) &vm_intrinsic_name_bodies[0];
-    for (int index = FIRST_ID; index < ID_LIMIT; index++) {
-      nt[index] = string;
-      string += strlen(string); // skip string body
-      string += 1;              // skip trailing null
-    }
-    assert(!strcmp(nt[_hashCode], "_hashCode"), "lined up");
-    nt[_none] = "_none";
+    init_vm_intrinsic_name_table();
   }
+
   if ((uint)id < (uint)ID_LIMIT)
     return vm_intrinsic_name_table[(uint)id];
   else
     return "(unknown intrinsic)";
 }
 
+vmIntrinsics::ID vmIntrinsics::find_id(const char* name) {
+  const char** nt = &vm_intrinsic_name_table[0];
+  if (nt[_none] == NULL) {
+    init_vm_intrinsic_name_table();
+  }
+
+  for (int index = FIRST_ID; index < ID_LIMIT; ++index) {
+    if (0 == strcmp(name, nt[index])) {
+      return ID_from(index);
+    }
+  }
+
+  return _none;
+}
+
+bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
+  vmIntrinsics::ID id = method->intrinsic_id();
+  return is_disabled_by_flags(id);
+}
+
+bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
+  assert(id > _none && id < ID_LIMIT, "must be a VM intrinsic");
+
+  // not initialized yet, process Control/DisableIntrinsic
+  if (vm_intrinsic_control_words[_none].is_default()) {
+    for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != NULL; ++iter) {
+      vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+
+      if (id != vmIntrinsics::_none) {
+        vm_intrinsic_control_words[id] = iter.is_enabled() && !disabled_by_jvm_flags(id);
+      }
+    }
+
+    // Order matters, DisableIntrinsic can overwrite ControlIntrinsic
+    for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != NULL; ++iter) {
+      vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+
+      if (id != vmIntrinsics::_none) {
+        vm_intrinsic_control_words[id] = false;
+      }
+    }
+
+    vm_intrinsic_control_words[_none] = true;
+  }
+
+  TriBool b = vm_intrinsic_control_words[id];
+  if (b.is_default()) {
+    // unknown yet, query and cache it
+    b = vm_intrinsic_control_words[id] = !disabled_by_jvm_flags(id);
+  }
+
+  return !b;
+}
+
 // These are flag-matching functions:
 inline bool match_F_R(jshort flags) {
   const int req = 0;
diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp
index 94cee9fc61c..5b49d37a820 100644
--- a/src/hotspot/share/classfile/vmSymbols.hpp
+++ b/src/hotspot/share/classfile/vmSymbols.hpp
@@ -266,6 +266,7 @@
   template(returnType_name,                           "returnType")                               \
   template(signature_name,                            "signature")                                \
   template(slot_name,                                 "slot")                                     \
+  template(trusted_final_name,                        "trustedFinal")                             \
                                                                                                   \
   /* Support for annotations (JDK 1.5 and above) */                                               \
                                                                                                   \
@@ -1634,7 +1635,10 @@ class vmIntrinsics: AllStatic {
                          vmSymbols::SID sig,
                          jshort flags);
 
+  // check if the intrinsic is disabled by course-grained flags.
+  static bool disabled_by_jvm_flags(vmIntrinsics::ID id);
 public:
+  static ID find_id(const char* name);
   // Given a method's class, name, signature, and access flags, report its ID.
   static ID find_id(vmSymbols::SID holder,
                     vmSymbols::SID name,
@@ -1684,12 +1688,25 @@ class vmIntrinsics: AllStatic {
   // 'method' requires predicated logic.
   static int predicates_needed(vmIntrinsics::ID id);
 
-  // Returns true if a compiler intrinsic is disabled by command-line flags
-  // and false otherwise.
-  static bool is_disabled_by_flags(const methodHandle& method);
+  // There are 2 kinds of JVM options to control intrinsics.
+  // 1. Disable/Control Intrinsic accepts a list of intrinsic IDs.
+  //    ControlIntrinsic is recommended. DisableIntrinic will be deprecated.
+  //    Currently, the DisableIntrinsic list prevails if an intrinsic appears on
+  //    both lists.
+  //
+  // 2. Explicit UseXXXIntrinsics options. eg. UseAESIntrinsics, UseCRC32Intrinsics etc.
+  //    Each option can control a group of intrinsics. The user can specify them but
+  //    their final values are subject to hardware inspection (VM_Version::initialize).
+  //    Stub generators are controlled by them.
+  //
+  // An intrinsic is enabled if and only if neither the fine-grained control(1) nor
+  // the corresponding coarse-grained control(2) disables it.
   static bool is_disabled_by_flags(vmIntrinsics::ID id);
-  static bool is_intrinsic_disabled(vmIntrinsics::ID id);
-  static bool is_intrinsic_available(vmIntrinsics::ID id);
+
+  static bool is_disabled_by_flags(const methodHandle& method);
+  static bool is_intrinsic_available(vmIntrinsics::ID id) {
+    return !is_disabled_by_flags(id);
+  }
 };
 
 #endif // SHARE_CLASSFILE_VMSYMBOLS_HPP
diff --git a/src/hotspot/share/code/compiledIC.cpp b/src/hotspot/share/code/compiledIC.cpp
index 8230ddaffd7..9f8e5b57349 100644
--- a/src/hotspot/share/code/compiledIC.cpp
+++ b/src/hotspot/share/code/compiledIC.cpp
@@ -756,7 +756,9 @@ void CompiledDirectStaticCall::verify_mt_safe(const methodHandle& callee, addres
          "a) MT-unsafe modification of inline cache");
 
   address destination = jump->jump_destination();
-  assert(destination == (address)-1 || destination == entry,
+  assert(destination == (address)-1 || destination == entry
+         || old_method == NULL || !old_method->method_holder()->is_loader_alive() // may have a race due to class unloading.
+         || old_method->is_old(),  // may be race patching deoptimized nmethod due to redefinition.
          "b) MT-unsafe modification of inline cache");
 }
 #endif // !PRODUCT
diff --git a/src/hotspot/share/code/nmethod.hpp b/src/hotspot/share/code/nmethod.hpp
index f24f389748d..92b1e72aef8 100644
--- a/src/hotspot/share/code/nmethod.hpp
+++ b/src/hotspot/share/code/nmethod.hpp
@@ -260,7 +260,7 @@ class nmethod : public CompiledMethod {
   // The _hotness_counter indicates the hotness of a method. The higher
   // the value the hotter the method. The hotness counter of a nmethod is
   // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method
-  // is active while stack scanning (mark_active_nmethods()). The hotness
+  // is active while stack scanning (do_stack_scanning()). The hotness
   // counter is decreased (by 1) while sweeping.
   int _hotness_counter;
 
diff --git a/src/hotspot/share/compiler/compilerDirectives.cpp b/src/hotspot/share/compiler/compilerDirectives.cpp
index 7a25f44e6f4..e74d54b6a28 100644
--- a/src/hotspot/share/compiler/compilerDirectives.cpp
+++ b/src/hotspot/share/compiler/compilerDirectives.cpp
@@ -33,9 +33,9 @@
 
 CompilerDirectives::CompilerDirectives() : _next(NULL), _match(NULL), _ref_count(0) {
   _c1_store = new DirectiveSet(this);
-  _c1_store->init_disableintrinsic();
+  _c1_store->init_control_intrinsic();
   _c2_store = new DirectiveSet(this);
-  _c2_store->init_disableintrinsic();
+  _c2_store->init_control_intrinsic();
 };
 
 CompilerDirectives::~CompilerDirectives() {
@@ -179,14 +179,14 @@ DirectiveSet* CompilerDirectives::get_for(AbstractCompiler *comp) {
   }
 }
 
-// In the list of disabled intrinsics, the ID of the disabled intrinsics can separated:
-// - by ',' (if -XX:DisableIntrinsic is used once when invoking the VM) or
-// - by '\n' (if -XX:DisableIntrinsic is used multiple times when invoking the VM) or
-// - by ' ' (if DisableIntrinsic is used on a per-method level, e.g., with CompileCommand).
+// In the list of Control/disabled intrinsics, the ID of the control intrinsics can separated:
+// - by ',' (if -XX:Control/DisableIntrinsic is used once when invoking the VM) or
+// - by '\n' (if -XX:Control/DisableIntrinsic is used multiple times when invoking the VM) or
+// - by ' ' (if Control/DisableIntrinsic is used on a per-method level, e.g., with CompileCommand).
 //
-// To simplify the processing of the list, the canonicalize_disableintrinsic() method
+// To simplify the processing of the list, the canonicalize_control_intrinsic() method
 // returns a new copy of the list in which '\n' and ' ' is replaced with ','.
-ccstrlist DirectiveSet::canonicalize_disableintrinsic(ccstrlist option_value) {
+ccstrlist DirectiveSet::canonicalize_control_intrinsic(ccstrlist option_value) {
   char* canonicalized_list = NEW_C_HEAP_ARRAY(char, strlen(option_value) + 1, mtCompiler);
   int i = 0;
   char current;
@@ -202,9 +202,57 @@ ccstrlist DirectiveSet::canonicalize_disableintrinsic(ccstrlist option_value) {
   return canonicalized_list;
 }
 
-void DirectiveSet::init_disableintrinsic() {
-  // Canonicalize DisableIntrinsic to contain only ',' as a separator.
-  this->DisableIntrinsicOption = canonicalize_disableintrinsic(DisableIntrinsic);
+ControlIntrinsicIter::ControlIntrinsicIter(ccstrlist option_value, bool disable_all)
+  : _disableIntrinsic(disable_all) {
+  _list = (char*)DirectiveSet::canonicalize_control_intrinsic(option_value);
+  _saved_ptr = _list;
+  _enabled = false;
+
+  _token = strtok_r(_saved_ptr, ",", &_saved_ptr);
+  next_token();
+}
+
+ControlIntrinsicIter::~ControlIntrinsicIter() {
+  FREE_C_HEAP_ARRAY(char, _list);
+}
+
+// pre-increment
+ControlIntrinsicIter& ControlIntrinsicIter::operator++() {
+  _token = strtok_r(NULL, ",", &_saved_ptr);
+  next_token();
+  return *this;
+}
+
+void ControlIntrinsicIter::next_token() {
+  if (_token && !_disableIntrinsic) {
+    char ch = _token[0];
+
+    if (ch != '+' && ch != '-') {
+      warning("failed to parse %s. must start with +/-!", _token);
+    } else {
+      _enabled = ch == '+';
+      _token++;
+    }
+  }
+}
+
+void DirectiveSet::init_control_intrinsic() {
+  for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != NULL; ++iter) {
+    vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+
+    if (id != vmIntrinsics::_none) {
+      _intrinsic_control_words[id] = iter.is_enabled();
+    }
+  }
+
+  // Order matters, DisableIntrinsic can overwrite ControlIntrinsic
+  for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != NULL; ++iter) {
+    vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+
+    if (id != vmIntrinsics::_none) {
+      _intrinsic_control_words[id] = false;
+    }
+  }
 }
 
 DirectiveSet::DirectiveSet(CompilerDirectives* d) :_inlinematchers(NULL), _directive(d) {
@@ -213,6 +261,7 @@ DirectiveSet::DirectiveSet(CompilerDirectives* d) :_inlinematchers(NULL), _direc
   compilerdirectives_c2_flags(init_defaults_definition)
   compilerdirectives_c1_flags(init_defaults_definition)
   memset(_modified, 0, sizeof(_modified));
+  _intrinsic_control_words.fill_in(/*default value*/TriBool());
 }
 
 DirectiveSet::~DirectiveSet() {
@@ -223,12 +272,6 @@ DirectiveSet::~DirectiveSet() {
     delete tmp;
     tmp = next;
   }
-
-  // When constructed, DirectiveSet canonicalizes the DisableIntrinsic flag
-  // into a new string. Therefore, that string is deallocated when
-  // the DirectiveSet is destroyed.
-  assert(this->DisableIntrinsicOption != NULL, "");
-  FREE_C_HEAP_ARRAY(char, (void *)this->DisableIntrinsicOption);
 }
 
 // Backward compatibility for CompileCommands
@@ -280,10 +323,6 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
       }
     }
 
-    // Read old value of DisableIntrinsicOption, in case we need to free it
-    // and overwrite it with a new value.
-    ccstrlist old_disable_intrinsic_value = set->DisableIntrinsicOption;
-
     // inline and dontinline (including exclude) are implemented in the directiveset accessors
 #define init_default_cc(name, type, dvalue, cc_flag) { type v; if (!_modified[name##Index] && CompilerOracle::has_option_value(method, #cc_flag, v) && v != this->name##Option) { set->name##Option = v; changed = true;} }
     compilerdirectives_common_flags(init_default_cc)
@@ -292,11 +331,45 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
 
     // Canonicalize DisableIntrinsic to contain only ',' as a separator.
     ccstrlist option_value;
+    bool need_reset = true; // if Control/DisableIntrinsic redefined, only need to reset control_words once
+
+    if (!_modified[ControlIntrinsicIndex] &&
+        CompilerOracle::has_option_value(method, "ControlIntrinsic", option_value)) {
+      ControlIntrinsicIter iter(option_value);
+
+      if (need_reset) {
+        set->_intrinsic_control_words.fill_in(TriBool());
+        need_reset = false;
+      }
+
+      while (*iter != NULL) {
+        vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+        if (id != vmIntrinsics::_none) {
+          set->_intrinsic_control_words[id] = iter.is_enabled();
+        }
+
+        ++iter;
+      }
+    }
+
+
     if (!_modified[DisableIntrinsicIndex] &&
         CompilerOracle::has_option_value(method, "DisableIntrinsic", option_value)) {
-      set->DisableIntrinsicOption = canonicalize_disableintrinsic(option_value);
-      assert(old_disable_intrinsic_value != NULL, "");
-      FREE_C_HEAP_ARRAY(char, (void *)old_disable_intrinsic_value);
+      ControlIntrinsicIter iter(option_value, true/*disable_all*/);
+
+      if (need_reset) {
+        set->_intrinsic_control_words.fill_in(TriBool());
+        need_reset = false;
+      }
+
+      while (*iter != NULL) {
+        vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
+        if (id != vmIntrinsics::_none) {
+          set->_intrinsic_control_words[id] = false;
+        }
+
+        ++iter;
+      }
     }
 
 
@@ -397,38 +470,23 @@ void DirectiveSet::print_inline(outputStream* st) {
 
 bool DirectiveSet::is_intrinsic_disabled(const methodHandle& method) {
   vmIntrinsics::ID id = method->intrinsic_id();
-  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
-
-  ResourceMark rm;
-
-  // Create a copy of the string that contains the list of disabled
-  // intrinsics. The copy is created because the string
-  // will be modified by strtok(). Then, the list is tokenized with
-  // ',' as a separator.
-  size_t length = strlen(DisableIntrinsicOption);
-  char* local_list = NEW_RESOURCE_ARRAY(char, length + 1);
-  strncpy(local_list, DisableIntrinsicOption, length + 1);
-  char* save_ptr;
-
-  char* token = strtok_r(local_list, ",", &save_ptr);
-  while (token != NULL) {
-    if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
-      return true;
-    } else {
-      token = strtok_r(NULL, ",", &save_ptr);
-    }
-  }
+  assert(id > vmIntrinsics::_none && id < vmIntrinsics::ID_LIMIT, "invalid intrinsic_id!");
 
-  return false;
+  TriBool b = _intrinsic_control_words[id];
+  if (b.is_default()) {
+    return false; // if unset, every intrinsic is enabled.
+  } else {
+    return !b;
+  }
 }
 
 DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
   DirectiveSet* set = new DirectiveSet(NULL);
-  // Ordinary allocations of DirectiveSet would call init_disableintrinsic()
-  // immediately to create a new copy for set->DisableIntrinsicOption.
+  // Ordinary allocations of DirectiveSet would call init_control_intrinsic()
+  // immediately to create a new copy for set->Control/DisableIntrinsicOption.
   // However, here it does not need to because the code below creates
-  // a copy of src->DisableIntrinsicOption that initializes
-  // set->DisableIntrinsicOption.
+  // a copy of src->Control/DisableIntrinsicOption that initializes
+  // set->Control/DisableIntrinsicOption.
 
   memcpy(set->_modified, src->_modified, sizeof(src->_modified));
 
@@ -443,13 +501,7 @@ DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
     compilerdirectives_c2_flags(copy_members_definition)
     compilerdirectives_c1_flags(copy_members_definition)
 
-  // Create a local copy of the DisableIntrinsicOption.
-  assert(src->DisableIntrinsicOption != NULL, "");
-  size_t len = strlen(src->DisableIntrinsicOption) + 1;
-  char* s = NEW_C_HEAP_ARRAY(char, len, mtCompiler);
-  strncpy(s, src->DisableIntrinsicOption, len);
-  assert(s[len-1] == '\0', "");
-  set->DisableIntrinsicOption = s;
+  set->_intrinsic_control_words = src->_intrinsic_control_words;
   return set;
 }
 
diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp
index f653cd3fbd8..8908c0ee800 100644
--- a/src/hotspot/share/compiler/compilerDirectives.hpp
+++ b/src/hotspot/share/compiler/compilerDirectives.hpp
@@ -30,6 +30,7 @@
 #include "compiler/methodMatcher.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "utilities/exceptions.hpp"
+#include "utilities/tribool.hpp"
 
   //      Directives flag name,    type, default value, compile command name
   #define compilerdirectives_common_flags(cflags) \
@@ -46,7 +47,8 @@
     cflags(DumpReplay,              bool, false, DumpReplay) \
     cflags(DumpInline,              bool, false, DumpInline) \
     cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, X) \
-    cflags(DisableIntrinsic,        ccstrlist, DisableIntrinsic, DisableIntrinsic)
+    cflags(DisableIntrinsic,        ccstrlist, DisableIntrinsic, DisableIntrinsic) \
+    cflags(ControlIntrinsic,        ccstrlist, ControlIntrinsic, ControlIntrinsic)
 
 #ifdef COMPILER1
   #define compilerdirectives_c1_flags(cflags)
@@ -99,11 +101,12 @@ class DirectiveSet : public CHeapObj<mtCompiler> {
 private:
   InlineMatcher* _inlinematchers;
   CompilerDirectives* _directive;
+  TriBoolArray<vmIntrinsics::ID_LIMIT, int> _intrinsic_control_words;
 
 public:
   DirectiveSet(CompilerDirectives* directive);
   ~DirectiveSet();
-  void init_disableintrinsic();
+  void init_control_intrinsic();
   CompilerDirectives* directive();
   bool parse_and_add_inline(char* str, const char*& error_msg);
   void append_inline(InlineMatcher* m);
@@ -115,7 +118,7 @@ class DirectiveSet : public CHeapObj<mtCompiler> {
   bool matches_inline(const methodHandle& method, int inline_action);
   static DirectiveSet* clone(DirectiveSet const* src);
   bool is_intrinsic_disabled(const methodHandle& method);
-  static ccstrlist canonicalize_disableintrinsic(ccstrlist option_value);
+  static ccstrlist canonicalize_control_intrinsic(ccstrlist option_value);
   void finalize(outputStream* st);
 
   typedef enum {
@@ -126,8 +129,10 @@ class DirectiveSet : public CHeapObj<mtCompiler> {
     number_of_flags
   } flags;
 
+ private:
   bool _modified[number_of_flags]; // Records what options where set by a directive
 
+ public:
 #define flag_store_definition(name, type, dvalue, cc_flag) type name##Option;
   compilerdirectives_common_flags(flag_store_definition)
   compilerdirectives_c2_flags(flag_store_definition)
@@ -157,6 +162,28 @@ void print(outputStream* st) {
   }
 };
 
+// Iterator of ControlIntrinsic
+// if disable_all is true, it accepts DisableIntrinsic(deprecated) and all intrinsics
+// appear in the list are to disable
+class ControlIntrinsicIter {
+ private:
+  bool _enabled;
+  char* _token;
+  char* _saved_ptr;
+  char* _list;
+  const bool _disableIntrinsic;
+  void next_token();
+
+ public:
+  ControlIntrinsicIter(ccstrlist option, bool disable_all = false);
+  ~ControlIntrinsicIter();
+
+  bool is_enabled() const { return _enabled; }
+  const char* operator*() const { return _token; }
+
+  ControlIntrinsicIter& operator++();
+};
+
 class CompilerDirectives : public CHeapObj<mtCompiler> {
 private:
   CompilerDirectives* _next;
diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp
index e7a9de767d0..fe4c93d450c 100644
--- a/src/hotspot/share/compiler/compilerOracle.cpp
+++ b/src/hotspot/share/compiler/compilerOracle.cpp
@@ -490,12 +490,12 @@ static void scan_flag_and_value(const char* type, const char* line, int& total_b
       ResourceMark rm;
       char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1);
       char* next_value = value;
-      if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) {
+      if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9+\\-]%n", next_value, &bytes_read) == 1) {
         total_bytes_read += bytes_read;
         line += bytes_read;
         next_value += bytes_read;
         char* end_value = next_value-1;
-        while (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) {
+        while (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9+\\-]%n", next_value, &bytes_read) == 1) {
           total_bytes_read += bytes_read;
           line += bytes_read;
           *end_value = ' '; // override '\0'
diff --git a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp
index 3b81eb41996..78d08a4dd5a 100644
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,10 +101,7 @@ size_t EpsilonHeap::unsafe_max_tlab_alloc(Thread* thr) const {
 }
 
 EpsilonHeap* EpsilonHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to EpsilonHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Epsilon, "Not an Epsilon heap");
-  return (EpsilonHeap*)heap;
+  return named_heap<EpsilonHeap>(CollectedHeap::Epsilon);
 }
 
 HeapWord* EpsilonHeap::allocate_work(size_t size) {
diff --git a/src/hotspot/share/gc/g1/g1Analytics.cpp b/src/hotspot/share/gc/g1/g1Analytics.cpp
index 0f1de8e1a29..c817d27a899 100644
--- a/src/hotspot/share/gc/g1/g1Analytics.cpp
+++ b/src/hotspot/share/gc/g1/g1Analytics.cpp
@@ -149,18 +149,14 @@ void G1Analytics::report_alloc_rate_ms(double alloc_rate) {
   _alloc_rate_ms_seq->add(alloc_rate);
 }
 
-void G1Analytics::compute_pause_time_ratio(double interval_ms, double pause_time_ms) {
-  _long_term_pause_time_ratio = _recent_gc_times_ms->sum() / interval_ms;
-  // Filter out nonsensical results due to bad input.
+void G1Analytics::compute_pause_time_ratios(double end_time_sec, double pause_time_ms) {
+  double long_interval_ms = (end_time_sec - oldest_known_gc_end_time_sec()) * 1000.0;
+  _long_term_pause_time_ratio = _recent_gc_times_ms->sum() / long_interval_ms;
   _long_term_pause_time_ratio = clamp(_long_term_pause_time_ratio, 0.0, 1.0);
 
-  // Compute the ratio of just this last pause time to the entire time range stored
-  // in the vectors. Comparing this pause to the entire range, rather than only the
-  // most recent interval, has the effect of smoothing over a possible transient 'burst'
-  // of more frequent pauses that don't really reflect a change in heap occupancy.
-  // This reduces the likelihood of a needless heap expansion being triggered.
-  _short_term_pause_time_ratio =
-    (pause_time_ms * _recent_prev_end_times_for_all_gcs_sec->num()) / interval_ms;
+  double short_interval_ms = (end_time_sec - most_recent_gc_end_time_sec()) * 1000.0;
+  _short_term_pause_time_ratio = pause_time_ms / short_interval_ms;
+  _short_term_pause_time_ratio = clamp(_short_term_pause_time_ratio, 0.0, 1.0);
 }
 
 void G1Analytics::report_concurrent_refine_rate_ms(double cards_per_ms) {
@@ -228,7 +224,11 @@ void G1Analytics::report_rs_length(double rs_length) {
 }
 
 double G1Analytics::predict_alloc_rate_ms() const {
-  return predict_zero_bounded(_alloc_rate_ms_seq);
+  if (enough_samples_available(_alloc_rate_ms_seq)) {
+    return predict_zero_bounded(_alloc_rate_ms_seq);
+  } else {
+    return 0.0;
+  }
 }
 
 double G1Analytics::predict_concurrent_refine_rate_ms() const {
@@ -311,10 +311,14 @@ size_t G1Analytics::predict_pending_cards() const {
   return predict_size(_pending_cards_seq);
 }
 
-double G1Analytics::last_known_gc_end_time_sec() const {
+double G1Analytics::oldest_known_gc_end_time_sec() const {
   return _recent_prev_end_times_for_all_gcs_sec->oldest();
 }
 
+double G1Analytics::most_recent_gc_end_time_sec() const {
+  return _recent_prev_end_times_for_all_gcs_sec->last();
+}
+
 void G1Analytics::update_recent_gc_times(double end_time_sec,
                                          double pause_time_ms) {
   _recent_gc_times_ms->add(pause_time_ms);
diff --git a/src/hotspot/share/gc/g1/g1Analytics.hpp b/src/hotspot/share/gc/g1/g1Analytics.hpp
index d2fe2ec1599..8057f375db3 100644
--- a/src/hotspot/share/gc/g1/g1Analytics.hpp
+++ b/src/hotspot/share/gc/g1/g1Analytics.hpp
@@ -88,6 +88,9 @@ class G1Analytics: public CHeapObj<mtGC> {
   size_t predict_size(TruncatedSeq const* seq) const;
   double predict_zero_bounded(TruncatedSeq const* seq) const;
 
+  double oldest_known_gc_end_time_sec() const;
+  double most_recent_gc_end_time_sec() const;
+
 public:
   G1Analytics(const G1Predictions* predictor);
 
@@ -160,9 +163,7 @@ class G1Analytics: public CHeapObj<mtGC> {
 
   // Add a new GC of the given duration and end time to the record.
   void update_recent_gc_times(double end_time_sec, double elapsed_ms);
-  void compute_pause_time_ratio(double interval_ms, double pause_time_ms);
-
-  double last_known_gc_end_time_sec() const;
+  void compute_pause_time_ratios(double end_time_sec, double pause_time_ms);
 };
 
 #endif // SHARE_GC_G1_G1ANALYTICS_HPP
diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
index e8cdd861cbb..9559f732aa2 100644
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
@@ -2668,13 +2668,6 @@ void G1CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
   gc_tracer->report_metaspace_summary(when, metaspace_summary);
 }
 
-G1CollectedHeap* G1CollectedHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");
-  assert(heap->kind() == CollectedHeap::G1, "Invalid name");
-  return (G1CollectedHeap*)heap;
-}
-
 void G1CollectedHeap::gc_prologue(bool full) {
   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
 
diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
index 71f89d09184..3595b6bd7f2 100644
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp
@@ -1293,7 +1293,9 @@ class G1CollectedHeap : public CollectedHeap {
 
   // Convenience function to be used in situations where the heap type can be
   // asserted to be this type.
-  static G1CollectedHeap* heap();
+  static G1CollectedHeap* heap() {
+    return named_heap<G1CollectedHeap>(CollectedHeap::G1);
+  }
 
   void set_region_short_lived_locked(HeapRegion* hr);
   // add appropriate methods for any other surv rate groups
diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp
index 7808c0c90eb..e447be4e7b3 100644
--- a/src/hotspot/share/gc/g1/g1Policy.cpp
+++ b/src/hotspot/share/gc/g1/g1Policy.cpp
@@ -46,6 +46,7 @@
 #include "gc/shared/gcPolicyCounters.hpp"
 #include "logging/log.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/globals.hpp"
 #include "runtime/java.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/debug.hpp"
@@ -61,8 +62,8 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
   _policy_counters(new GCPolicyCounters("GarbageFirst", 1, 2)),
   _full_collection_start_sec(0.0),
   _collection_pause_end_millis(os::javaTimeNanos() / NANOSECS_PER_MILLISEC),
+  _young_list_desired_length(0),
   _young_list_target_length(0),
-  _young_list_fixed_length(0),
   _young_list_max_length(0),
   _eden_surv_rate_group(new G1SurvRateGroup()),
   _survivor_surv_rate_group(new G1SurvRateGroup()),
@@ -107,14 +108,11 @@ void G1Policy::init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) {
 
   assert(Heap_lock->owned_by_self(), "Locking discipline.");
 
-  if (!use_adaptive_young_list_length()) {
-    _young_list_fixed_length = _young_gen_sizer->min_desired_young_length();
-  }
   _young_gen_sizer->adjust_max_new_size(_g1h->max_expandable_regions());
 
   _free_regions_at_end_of_collection = _g1h->num_free_regions();
 
-  update_young_list_max_and_target_length();
+  update_young_length_bounds();
   // We may immediately start allocating regions and placing them on the
   // collection set list. Initialize the per-collection set info
   _collection_set->start_incremental_building();
@@ -189,158 +187,254 @@ void G1Policy::record_new_heap_size(uint new_number_of_regions) {
   _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes);
 }
 
-uint G1Policy::calculate_young_list_desired_min_length(uint base_min_length) const {
+uint G1Policy::calculate_desired_eden_length_by_mmu() const {
+  // One could argue that any useful eden length to keep any MMU would be 1, but
+  // in theory this is possible. Other constraints enforce a minimum eden of 1
+  // anyway.
   uint desired_min_length = 0;
   if (use_adaptive_young_list_length()) {
-    if (_analytics->num_alloc_rate_ms() > 3) {
-      double now_sec = os::elapsedTime();
-      double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0;
-      double alloc_rate_ms = _analytics->predict_alloc_rate_ms();
-      desired_min_length = (uint) ceil(alloc_rate_ms * when_ms);
-    } else {
-      // otherwise we don't have enough info to make the prediction
-    }
+    double now_sec = os::elapsedTime();
+    double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0;
+    double alloc_rate_ms = _analytics->predict_alloc_rate_ms();
+    desired_min_length = (uint) ceil(alloc_rate_ms * when_ms);
   }
-  desired_min_length += base_min_length;
-  // make sure we don't go below any user-defined minimum bound
-  return MAX2(_young_gen_sizer->min_desired_young_length(), desired_min_length);
-}
-
-uint G1Policy::calculate_young_list_desired_max_length() const {
-  // Here, we might want to also take into account any additional
-  // constraints (i.e., user-defined minimum bound). Currently, we
-  // effectively don't set this bound.
-  return _young_gen_sizer->max_desired_young_length();
-}
-
-uint G1Policy::update_young_list_max_and_target_length() {
-  return update_young_list_max_and_target_length(_analytics->predict_rs_length());
-}
-
-uint G1Policy::update_young_list_max_and_target_length(size_t rs_length) {
-  uint unbounded_target_length = update_young_list_target_length(rs_length);
-  update_max_gc_locker_expansion();
-  return unbounded_target_length;
-}
-
-uint G1Policy::update_young_list_target_length(size_t rs_length) {
-  YoungTargetLengths young_lengths = young_list_target_lengths(rs_length);
-  _young_list_target_length = young_lengths.first;
-
-  return young_lengths.second;
-}
-
-G1Policy::YoungTargetLengths G1Policy::young_list_target_lengths(size_t rs_length) const {
-  YoungTargetLengths result;
+  return desired_min_length;
+}
+
+void G1Policy::update_young_length_bounds() {
+  update_young_length_bounds(_analytics->predict_rs_length());
+}
+
+void G1Policy::update_young_length_bounds(size_t rs_length) {
+  _young_list_desired_length = calculate_young_desired_length(rs_length);
+  _young_list_target_length = calculate_young_target_length(_young_list_desired_length);
+  _young_list_max_length = calculate_young_max_length(_young_list_target_length);
+
+  log_debug(gc,ergo,heap)("Young list lengths: desired: %u, target: %u, max: %u",
+                          _young_list_desired_length,
+                          _young_list_target_length,
+                          _young_list_max_length);
+}
+
+// Calculates desired young gen length. It is calculated from:
+//
+// - sizer min/max bounds on young gen
+// - pause time goal for whole young gen evacuation
+// - MMU goal influencing eden to make GCs spaced apart.
+// - a minimum one eden region length.
+//
+// We may enter with already allocated eden and survivor regions, that may be
+// higher than the maximum, or the above goals may result in a desired value
+// smaller than are already allocated.
+// The main reason is revising young length, with our without the GCLocker being
+// active.
+//
+uint G1Policy::calculate_young_desired_length(size_t rs_length) const {
+  uint min_young_length_by_sizer = _young_gen_sizer->min_desired_young_length();
+  uint max_young_length_by_sizer = _young_gen_sizer->max_desired_young_length();
+
+  assert(min_young_length_by_sizer >= 1, "invariant");
+  assert(max_young_length_by_sizer >= min_young_length_by_sizer, "invariant");
+
+  // Absolute minimum eden length.
+  // Enforcing a minimum eden length helps at startup when the predictors are not
+  // yet trained on the application to avoid unnecessary (but very short) full gcs
+  // on very small (initial) heaps.
+  uint const MinDesiredEdenLength = 1;
 
   // Calculate the absolute and desired min bounds first.
 
-  // This is how many young regions we already have (currently: the survivors).
-  const uint base_min_length = _g1h->survivor_regions_count();
-  uint desired_min_length = calculate_young_list_desired_min_length(base_min_length);
-  // This is the absolute minimum young length. Ensure that we
-  // will at least have one eden region available for allocation.
-  uint absolute_min_length = base_min_length + MAX2(_g1h->eden_regions_count(), (uint)1);
-  // If we shrank the young list target it should not shrink below the current size.
-  desired_min_length = MAX2(desired_min_length, absolute_min_length);
-  // Calculate the absolute and desired max bounds.
+  // This is how many survivor regions we already have.
+  const uint survivor_length = _g1h->survivor_regions_count();
+  // Size of the already allocated young gen.
+  const uint allocated_young_length = _g1h->young_regions_count();
+  // This is the absolute minimum young length that we can return. Ensure that we
+  // don't go below any user-defined minimum bound; but we might have already
+  // allocated more than that for reasons. In this case, use that.
+  uint absolute_min_young_length = MAX2(allocated_young_length, min_young_length_by_sizer);
+  // Calculate the absolute max bounds. After evac failure or when revising the
+  // young length we might have exceeded absolute min length or absolute_max_length,
+  // so adjust the result accordingly.
+  uint absolute_max_young_length = MAX2(max_young_length_by_sizer, absolute_min_young_length);
+
+  uint desired_eden_length_by_mmu = 0;
+  uint desired_eden_length_by_pause = 0;
+  uint desired_eden_length_before_mixed = 0;
+
+  uint desired_young_length = 0;
+  if (use_adaptive_young_list_length()) {
+    desired_eden_length_by_mmu = calculate_desired_eden_length_by_mmu();
 
-  uint desired_max_length = calculate_young_list_desired_max_length();
+    const size_t pending_cards = _analytics->predict_pending_cards();
+    double survivor_base_time_ms = predict_base_elapsed_time_ms(pending_cards, rs_length);
 
-  uint young_list_target_length = 0;
-  if (use_adaptive_young_list_length()) {
-    if (collector_state()->in_young_only_phase()) {
-      young_list_target_length =
-                        calculate_young_list_target_length(rs_length,
-                                                           base_min_length,
-                                                           desired_min_length,
-                                                           desired_max_length);
+    if (!next_gc_should_be_mixed(NULL, NULL)) {
+      desired_eden_length_by_pause =
+        calculate_desired_eden_length_by_pause(survivor_base_time_ms,
+                                               absolute_min_young_length - survivor_length,
+                                               absolute_max_young_length - survivor_length);
     } else {
-      // Don't calculate anything and let the code below bound it to
-      // the desired_min_length, i.e., do the next GC as soon as
-      // possible to maximize how many old regions we can add to it.
+      desired_eden_length_before_mixed =
+        calculate_desired_eden_length_before_mixed(survivor_base_time_ms,
+                                                   absolute_min_young_length - survivor_length,
+                                                   absolute_max_young_length - survivor_length);
     }
+    // Above either sets desired_eden_length_by_pause or desired_eden_length_before_mixed,
+    // the other is zero. Use the one that has been set below.
+    uint desired_eden_length = MAX2(desired_eden_length_by_pause,
+                                    desired_eden_length_before_mixed);
+
+    // Finally incorporate MMU concerns; assume that it overrides the pause time
+    // goal, as the default value has been chosen to effectively disable it.
+    // Also request at least one eden region, see above for reasons.
+    desired_eden_length = MAX3(desired_eden_length,
+                               desired_eden_length_by_mmu,
+                               MinDesiredEdenLength);
+
+    desired_young_length = desired_eden_length + survivor_length;
   } else {
     // The user asked for a fixed young gen so we'll fix the young gen
     // whether the next GC is young or mixed.
-    young_list_target_length = _young_list_fixed_length;
+    desired_young_length = min_young_length_by_sizer;
   }
-
-  result.second = young_list_target_length;
-
-  // We will try our best not to "eat" into the reserve.
-  uint absolute_max_length = 0;
-  if (_free_regions_at_end_of_collection > _reserve_regions) {
-    absolute_max_length = _free_regions_at_end_of_collection - _reserve_regions;
-  }
-  if (desired_max_length > absolute_max_length) {
-    desired_max_length = absolute_max_length;
+  // Clamp to absolute min/max after we determined desired lengths.
+  desired_young_length = clamp(desired_young_length, absolute_min_young_length, absolute_max_young_length);
+
+  log_trace(gc, ergo, heap)("Young desired length %u "
+                            "survivor length %u "
+                            "allocated young length %u "
+                            "absolute min young length %u "
+                            "absolute max young length %u "
+                            "desired eden length by mmu %u "
+                            "desired eden length by pause %u "
+                            "desired eden length before mixed %u"
+                            "desired eden length by default %u",
+                            desired_young_length, survivor_length,
+                            allocated_young_length, absolute_min_young_length,
+                            absolute_max_young_length, desired_eden_length_by_mmu,
+                            desired_eden_length_by_pause,
+                            desired_eden_length_before_mixed,
+                            MinDesiredEdenLength);
+
+  assert(desired_young_length >= allocated_young_length, "must be");
+  return desired_young_length;
+}
+
+// Limit the desired (wished) young length by current free regions. If the request
+// can be satisfied without using up reserve regions, do so, otherwise eat into
+// the reserve, giving away at most what the heap sizer allows.
+uint G1Policy::calculate_young_target_length(uint desired_young_length) const {
+  uint allocated_young_length = _g1h->young_regions_count();
+
+  uint receiving_additional_eden;
+  if (allocated_young_length >= desired_young_length) {
+    // Already used up all we actually want (may happen as G1 revises the
+    // young list length concurrently, or caused by gclocker). Do not allow more,
+    // potentially resulting in GC.
+    receiving_additional_eden = 0;
+    log_trace(gc, ergo, heap)("Young target length: Already used up desired young %u allocated %u",
+                              desired_young_length,
+                              allocated_young_length);
+  } else {
+    // Now look at how many free regions are there currently, and the heap reserve.
+    // We will try our best not to "eat" into the reserve as long as we can. If we
+    // do, we at most eat the sizer's minimum regions into the reserve or half the
+    // reserve rounded up (if possible; this is an arbitrary value).
+
+    uint max_to_eat_into_reserve = MIN2(_young_gen_sizer->min_desired_young_length(),
+                                        (_reserve_regions + 1) / 2);
+
+    log_trace(gc, ergo, heap)("Young target length: Common "
+                              "free regions at end of collection %u "
+                              "desired young length %u "
+                              "reserve region %u "
+                              "max to eat into reserve %u",
+                              _free_regions_at_end_of_collection,
+                              desired_young_length,
+                              _reserve_regions,
+                              max_to_eat_into_reserve);
+
+    if (_free_regions_at_end_of_collection <= _reserve_regions) {
+      // Fully eat (or already eating) into the reserve, hand back at most absolute_min_length regions.
+      uint receiving_young = MIN3(_free_regions_at_end_of_collection,
+                                  desired_young_length,
+                                  max_to_eat_into_reserve);
+      // We could already have allocated more regions than what we could get
+      // above.
+      receiving_additional_eden = allocated_young_length < receiving_young ?
+                                  receiving_young - allocated_young_length : 0;
+
+      log_trace(gc, ergo, heap)("Young target length: Fully eat into reserve "
+                                "receiving young %u receiving additional eden %u",
+                                receiving_young,
+                                receiving_additional_eden);
+    } else if (_free_regions_at_end_of_collection < (desired_young_length + _reserve_regions)) {
+      // Partially eat into the reserve, at most max_to_eat_into_reserve regions.
+      uint free_outside_reserve = _free_regions_at_end_of_collection - _reserve_regions;
+      assert(free_outside_reserve < desired_young_length,
+             "must be %u %u",
+             free_outside_reserve, desired_young_length);
+
+      uint receiving_within_reserve = MIN2(desired_young_length - free_outside_reserve,
+                                           max_to_eat_into_reserve);
+      uint receiving_young = free_outside_reserve + receiving_within_reserve;
+      // Again, we could have already allocated more than we could get.
+      receiving_additional_eden = allocated_young_length < receiving_young ?
+                                  receiving_young - allocated_young_length : 0;
+
+      log_trace(gc, ergo, heap)("Young target length: Partially eat into reserve "
+                                "free outside reserve %u "
+                                "receiving within reserve %u "
+                                "receiving young %u "
+                                "receiving additional eden %u",
+                                free_outside_reserve, receiving_within_reserve,
+                                receiving_young, receiving_additional_eden);
+    } else {
+      // No need to use the reserve.
+      receiving_additional_eden = desired_young_length - allocated_young_length;
+      log_trace(gc, ergo, heap)("Young target length: No need to use reserve "
+                                "receiving additional eden %u",
+                                receiving_additional_eden);
+    }
   }
 
-  // Make sure we don't go over the desired max length, nor under the
-  // desired min length. In case they clash, desired_min_length wins
-  // which is why that test is second.
-  if (young_list_target_length > desired_max_length) {
-    young_list_target_length = desired_max_length;
-  }
-  if (young_list_target_length < desired_min_length) {
-    young_list_target_length = desired_min_length;
-  }
+  uint target_young_length = allocated_young_length + receiving_additional_eden;
 
-  assert(young_list_target_length > base_min_length,
-         "we should be able to allocate at least one eden region");
-  assert(young_list_target_length >= absolute_min_length, "post-condition");
+  assert(target_young_length >= allocated_young_length, "must be");
 
-  result.first = young_list_target_length;
-  return result;
+  log_trace(gc, ergo, heap)("Young target length: "
+                            "young target length %u "
+                            "allocated young length %u "
+                            "received additional eden %u",
+                            target_young_length, allocated_young_length,
+                            receiving_additional_eden);
+  return target_young_length;
 }
 
-uint G1Policy::calculate_young_list_target_length(size_t rs_length,
-                                                  uint base_min_length,
-                                                  uint desired_min_length,
-                                                  uint desired_max_length) const {
+uint G1Policy::calculate_desired_eden_length_by_pause(double base_time_ms,
+                                                      uint min_eden_length,
+                                                      uint max_eden_length) const {
   assert(use_adaptive_young_list_length(), "pre-condition");
-  assert(collector_state()->in_young_only_phase(), "only call this for young GCs");
-
-  // In case some edge-condition makes the desired max length too small...
-  if (desired_max_length <= desired_min_length) {
-    return desired_min_length;
-  }
 
-  // We'll adjust min_young_length and max_young_length not to include
-  // the already allocated young regions (i.e., so they reflect the
-  // min and max eden regions we'll allocate). The base_min_length
-  // will be reflected in the predictions by the
-  // survivor_regions_evac_time prediction.
-  assert(desired_min_length > base_min_length, "invariant");
-  uint min_young_length = desired_min_length - base_min_length;
-  assert(desired_max_length > base_min_length, "invariant");
-  uint max_young_length = desired_max_length - base_min_length;
-
-  const double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
-  const size_t pending_cards = _analytics->predict_pending_cards();
-  const double base_time_ms = predict_base_elapsed_time_ms(pending_cards, rs_length);
-  const uint available_free_regions = _free_regions_at_end_of_collection;
-  const uint base_free_regions =
-    available_free_regions > _reserve_regions ? available_free_regions - _reserve_regions : 0;
+  assert(min_eden_length <= max_eden_length, "must be %u %u", min_eden_length, max_eden_length);
 
   // Here, we will make sure that the shortest young length that
   // makes sense fits within the target pause time.
 
   G1YoungLengthPredictor p(base_time_ms,
-                           base_free_regions,
-                           target_pause_time_ms,
+                           _free_regions_at_end_of_collection,
+                           _mmu_tracker->max_gc_time() * 1000.0,
                            this);
-  if (p.will_fit(min_young_length)) {
+  if (p.will_fit(min_eden_length)) {
     // The shortest young length will fit into the target pause time;
     // we'll now check whether the absolute maximum number of young
     // regions will fit in the target pause time. If not, we'll do
     // a binary search between min_young_length and max_young_length.
-    if (p.will_fit(max_young_length)) {
+    if (p.will_fit(max_eden_length)) {
       // The maximum young length will fit into the target pause time.
       // We are done so set min young length to the maximum length (as
       // the result is assumed to be returned in min_young_length).
-      min_young_length = max_young_length;
+      min_eden_length = max_eden_length;
     } else {
       // The maximum possible number of young regions will not fit within
       // the target pause time so we'll search for the optimal
@@ -357,37 +451,56 @@ uint G1Policy::calculate_young_list_target_length(size_t rs_length,
       // does, it becomes the new min. If it doesn't, it becomes
       // the new max. This way we maintain the loop invariants.
 
-      assert(min_young_length < max_young_length, "invariant");
-      uint diff = (max_young_length - min_young_length) / 2;
+      assert(min_eden_length < max_eden_length, "invariant");
+      uint diff = (max_eden_length - min_eden_length) / 2;
       while (diff > 0) {
-        uint young_length = min_young_length + diff;
-        if (p.will_fit(young_length)) {
-          min_young_length = young_length;
+        uint eden_length = min_eden_length + diff;
+        if (p.will_fit(eden_length)) {
+          min_eden_length = eden_length;
         } else {
-          max_young_length = young_length;
+          max_eden_length = eden_length;
         }
-        assert(min_young_length <  max_young_length, "invariant");
-        diff = (max_young_length - min_young_length) / 2;
+        assert(min_eden_length <  max_eden_length, "invariant");
+        diff = (max_eden_length - min_eden_length) / 2;
       }
       // The results is min_young_length which, according to the
       // loop invariants, should fit within the target pause time.
 
       // These are the post-conditions of the binary search above:
-      assert(min_young_length < max_young_length,
-             "otherwise we should have discovered that max_young_length "
+      assert(min_eden_length < max_eden_length,
+             "otherwise we should have discovered that max_eden_length "
              "fits into the pause target and not done the binary search");
-      assert(p.will_fit(min_young_length),
-             "min_young_length, the result of the binary search, should "
+      assert(p.will_fit(min_eden_length),
+             "min_eden_length, the result of the binary search, should "
              "fit into the pause target");
-      assert(!p.will_fit(min_young_length + 1),
-             "min_young_length, the result of the binary search, should be "
+      assert(!p.will_fit(min_eden_length + 1),
+             "min_eden_length, the result of the binary search, should be "
              "optimal, so no larger length should fit into the pause target");
     }
   } else {
     // Even the minimum length doesn't fit into the pause time
     // target, return it as the result nevertheless.
   }
-  return base_min_length + min_young_length;
+  return min_eden_length;
+}
+
+uint G1Policy::calculate_desired_eden_length_before_mixed(double survivor_base_time_ms,
+                                                          uint min_eden_length,
+                                                          uint max_eden_length) const {
+  G1CollectionSetCandidates* candidates = _collection_set->candidates();
+
+  uint min_old_regions_end = MIN2(candidates->cur_idx() + calc_min_old_cset_length(), candidates->num_regions());
+  double predicted_region_evac_time_ms = survivor_base_time_ms;
+  for (uint i = candidates->cur_idx(); i < min_old_regions_end; i++) {
+    HeapRegion* r = candidates->at(i);
+    predicted_region_evac_time_ms += predict_region_total_time_ms(r, false);
+  }
+  uint desired_eden_length_by_min_cset_length =
+     calculate_desired_eden_length_by_pause(predicted_region_evac_time_ms,
+                                            min_eden_length,
+                                            max_eden_length);
+
+  return desired_eden_length_by_min_cset_length;
 }
 
 double G1Policy::predict_survivor_regions_evac_time() const {
@@ -408,8 +521,7 @@ void G1Policy::revise_young_list_target_length_if_necessary(size_t rs_length) {
     // add 10% to avoid having to recalculate often
     size_t rs_length_prediction = rs_length * 1100 / 1000;
     update_rs_length_prediction(rs_length_prediction);
-
-    update_young_list_max_and_target_length(rs_length_prediction);
+    update_young_length_bounds(rs_length_prediction);
   }
 }
 
@@ -457,7 +569,7 @@ void G1Policy::record_full_collection_end() {
 
   _free_regions_at_end_of_collection = _g1h->num_free_regions();
   _survivor_surv_rate_group->reset();
-  update_young_list_max_and_target_length();
+  update_young_length_bounds();
   update_rs_length_prediction();
 
   _old_gen_alloc_tracker.reset_after_full_gc();
@@ -669,10 +781,8 @@ void G1Policy::record_collection_pause_end(double pause_time_ms) {
     double alloc_rate_ms = (double) regions_allocated / app_time_ms;
     _analytics->report_alloc_rate_ms(alloc_rate_ms);
 
-    double interval_ms =
-      (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0;
+    _analytics->compute_pause_time_ratios(end_time_sec, pause_time_ms);
     _analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
-    _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms);
   }
 
   if (collector_state()->in_young_gc_before_mixed()) {
@@ -789,16 +899,11 @@ void G1Policy::record_collection_pause_end(double pause_time_ms) {
   // Do not update dynamic IHOP due to G1 periodic collection as it is highly likely
   // that in this case we are not running in a "normal" operating mode.
   if (_g1h->gc_cause() != GCCause::_g1_periodic_collection) {
-    // IHOP control wants to know the expected young gen length if it were not
-    // restrained by the heap reserve. Using the actual length would make the
-    // prediction too small and the limit the young gen every time we get to the
-    // predicted target occupancy.
-    size_t last_unrestrained_young_length = update_young_list_max_and_target_length();
+    update_young_length_bounds();
 
     _old_gen_alloc_tracker.reset_after_young_gc(app_time_ms / 1000.0);
     update_ihop_prediction(_old_gen_alloc_tracker.last_cycle_duration(),
                            _old_gen_alloc_tracker.last_cycle_old_bytes(),
-                           last_unrestrained_young_length * HeapRegion::GrainBytes,
                            this_pause_was_young_only);
 
     _ihop_control->send_trace_event(_g1h->gc_tracer_stw());
@@ -848,7 +953,6 @@ G1IHOPControl* G1Policy::create_ihop_control(const G1Predictions* predictor){
 
 void G1Policy::update_ihop_prediction(double mutator_time_s,
                                       size_t mutator_alloc_bytes,
-                                      size_t young_gen_size,
                                       bool this_gc_was_young_only) {
   // Always try to update IHOP prediction. Even evacuation failures give information
   // about e.g. whether to start IHOP earlier next time.
@@ -876,6 +980,11 @@ void G1Policy::update_ihop_prediction(double mutator_time_s,
   // marking, which makes any prediction useless. This increases the accuracy of the
   // prediction.
   if (this_gc_was_young_only && mutator_time_s > min_valid_time) {
+    // IHOP control wants to know the expected young gen length if it were not
+    // restrained by the heap reserve. Using the actual length would make the
+    // prediction too small and the limit the young gen every time we get to the
+    // predicted target occupancy.
+    size_t young_gen_size = young_list_desired_length() * HeapRegion::GrainBytes;
     _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size);
     report = true;
   }
@@ -982,7 +1091,7 @@ void G1Policy::print_age_table() {
   _survivors_age_table.print_age_table(_tenuring_threshold);
 }
 
-void G1Policy::update_max_gc_locker_expansion() {
+uint G1Policy::calculate_young_max_length(uint target_young_length) const {
   uint expansion_region_num = 0;
   if (GCLockerEdenExpansionPercent > 0) {
     double perc = (double) GCLockerEdenExpansionPercent / 100.0;
@@ -993,8 +1102,9 @@ void G1Policy::update_max_gc_locker_expansion() {
   } else {
     assert(expansion_region_num == 0, "sanity");
   }
-  _young_list_max_length = _young_list_target_length + expansion_region_num;
-  assert(_young_list_target_length <= _young_list_max_length, "post-condition");
+  uint max_length = target_young_length + expansion_region_num;
+  assert(target_young_length <= max_length, "post-condition");
+  return max_length;
 }
 
 // Calculates survivor space parameters.
@@ -1203,8 +1313,10 @@ bool G1Policy::next_gc_should_be_mixed(const char* true_action_str,
                                        const char* false_action_str) const {
   G1CollectionSetCandidates* candidates = _collection_set->candidates();
 
-  if (candidates->is_empty()) {
-    log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str);
+  if (candidates == NULL || candidates->is_empty()) {
+    if (false_action_str != NULL) {
+      log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str);
+    }
     return false;
   }
 
@@ -1213,12 +1325,16 @@ bool G1Policy::next_gc_should_be_mixed(const char* true_action_str,
   double reclaimable_percent = reclaimable_bytes_percent(reclaimable_bytes);
   double threshold = (double) G1HeapWastePercent;
   if (reclaimable_percent <= threshold) {
-    log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT,
-                        false_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent);
+    if (false_action_str != NULL) {
+      log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT,
+                          false_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent);
+    }
     return false;
   }
-  log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT,
-                      true_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent);
+  if (true_action_str != NULL) {
+    log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT,
+                        true_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent);
+  }
   return true;
 }
 
diff --git a/src/hotspot/share/gc/g1/g1Policy.hpp b/src/hotspot/share/gc/g1/g1Policy.hpp
index 473ebbac392..9784fd4e10e 100644
--- a/src/hotspot/share/gc/g1/g1Policy.hpp
+++ b/src/hotspot/share/gc/g1/g1Policy.hpp
@@ -60,7 +60,6 @@ class G1Policy: public CHeapObj<mtGC> {
   // Update the IHOP control with necessary statistics.
   void update_ihop_prediction(double mutator_time_s,
                               size_t mutator_alloc_bytes,
-                              size_t young_gen_size,
                               bool this_gc_was_young_only);
   void report_ihop_statistics();
 
@@ -76,8 +75,8 @@ class G1Policy: public CHeapObj<mtGC> {
 
   jlong _collection_pause_end_millis;
 
+  uint _young_list_desired_length;
   uint _young_list_target_length;
-  uint _young_list_fixed_length;
 
   // The max number of regions we can extend the eden by while the GC
   // locker is active. This should be >= _young_list_target_length;
@@ -170,6 +169,10 @@ class G1Policy: public CHeapObj<mtGC> {
 
 private:
   G1CollectionSet* _collection_set;
+
+  bool next_gc_should_be_mixed(const char* true_action_str,
+                               const char* false_action_str) const;
+
   double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const;
   double other_time_ms(double pause_time_ms) const;
 
@@ -189,44 +192,38 @@ class G1Policy: public CHeapObj<mtGC> {
   double _mark_remark_start_sec;
   double _mark_cleanup_start_sec;
 
-  // Updates the internal young list maximum and target lengths. Returns the
-  // unbounded young list target length. If no rs_length parameter is passed,
-  // predict the RS length using the prediction model, otherwise use the
-  // given rs_length as the prediction.
-  uint update_young_list_max_and_target_length();
-  uint update_young_list_max_and_target_length(size_t rs_length);
-
-  // Update the young list target length either by setting it to the
-  // desired fixed value or by calculating it using G1's pause
-  // prediction model.
-  // Returns the unbounded young list target length.
-  uint update_young_list_target_length(size_t rs_length);
-
-  // Calculate and return the minimum desired young list target
-  // length. This is the minimum desired young list length according
-  // to the user's inputs.
-  uint calculate_young_list_desired_min_length(uint base_min_length) const;
-
-  // Calculate and return the maximum desired young list target
-  // length. This is the maximum desired young list length according
-  // to the user's inputs.
-  uint calculate_young_list_desired_max_length() const;
-
-  // Calculate and return the maximum young list target length that
-  // can fit into the pause time goal. The parameters are: rs_length
-  // represent the prediction of how large the young RSet lengths will
-  // be, base_min_length is the already existing number of regions in
-  // the young list, min_length and max_length are the desired min and
-  // max young list length according to the user's inputs.
-  uint calculate_young_list_target_length(size_t rs_length,
-                                          uint base_min_length,
-                                          uint desired_min_length,
-                                          uint desired_max_length) const;
-
-  // Result of the bounded_young_list_target_length() method, containing both the
-  // bounded as well as the unbounded young list target lengths in this order.
-  typedef Pair<uint, uint, StackObj> YoungTargetLengths;
-  YoungTargetLengths young_list_target_lengths(size_t rs_length) const;
+  // Updates the internal young gen maximum and target and desired lengths.
+  // If no rs_length parameter is passed, predict the RS length using the
+  // prediction model, otherwise use the given rs_length as the prediction.
+  void update_young_length_bounds();
+  void update_young_length_bounds(size_t rs_length);
+
+  // Calculate and return the minimum desired eden length based on the MMU target.
+  uint calculate_desired_eden_length_by_mmu() const;
+
+  // Calculate and return the desired eden length that can fit into the pause time goal.
+  // The parameters are: rs_length represents the prediction of how large the
+  // young RSet lengths will be, min_eden_length and max_eden_length are the bounds
+  // (inclusive) within eden can grow.
+  uint calculate_desired_eden_length_by_pause(double base_time_ms,
+                                              uint min_eden_length,
+                                              uint max_eden_length) const;
+
+  // Calculates the desired eden length before mixed gc so that after adding the
+  // minimum amount of old gen regions from the collection set, the eden fits into
+  // the pause time goal.
+  uint calculate_desired_eden_length_before_mixed(double survivor_base_time_ms,
+                                                  uint min_eden_length,
+                                                  uint max_eden_length) const;
+
+  // Calculate desired young length based on current situation without taking actually
+  // available free regions into account.
+  uint calculate_young_desired_length(size_t rs_length) const;
+  // Limit the given desired young length to available free regions.
+  uint calculate_young_target_length(uint desired_young_length) const;
+  // The GCLocker might cause us to need more regions than the target. Calculate
+  // the maximum number of regions to use in that case.
+  uint calculate_young_max_length(uint target_young_length) const;
 
   void update_rs_length_prediction();
   void update_rs_length_prediction(size_t prediction);
@@ -335,9 +332,6 @@ class G1Policy: public CHeapObj<mtGC> {
 
   void print_phases();
 
-  bool next_gc_should_be_mixed(const char* true_action_str,
-                               const char* false_action_str) const;
-
   // Calculate and return the number of initial and optional old gen regions from
   // the given collection set candidates and the remaining time.
   void calculate_old_collection_set_regions(G1CollectionSetCandidates* candidates,
@@ -374,6 +368,7 @@ class G1Policy: public CHeapObj<mtGC> {
   // the initial-mark work and start a marking cycle.
   void decide_on_conc_mark_initiation();
 
+  uint young_list_desired_length() const { return _young_list_desired_length; }
   size_t young_list_target_length() const { return _young_list_target_length; }
 
   bool should_allocate_mutator_region() const;
@@ -434,8 +429,6 @@ class G1Policy: public CHeapObj<mtGC> {
 
   void print_age_table();
 
-  void update_max_gc_locker_expansion();
-
   void update_survivors_policy();
 
   virtual bool force_upgrade_to_full() {
diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
index 2ed42c16f0e..b2645223d87 100644
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
@@ -689,13 +689,6 @@ void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_trac
   gc_tracer->report_metaspace_summary(when, metaspace_summary);
 }
 
-ParallelScavengeHeap* ParallelScavengeHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to ParallelScavengeHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Parallel, "Invalid name");
-  return (ParallelScavengeHeap*)heap;
-}
-
 CardTableBarrierSet* ParallelScavengeHeap::barrier_set() {
   return barrier_set_cast<CardTableBarrierSet>(BarrierSet::barrier_set());
 }
diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
index 54f4ca72b73..34321547b7b 100644
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
@@ -126,7 +126,9 @@ class ParallelScavengeHeap : public CollectedHeap {
 
   static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
 
-  static ParallelScavengeHeap* heap();
+  static ParallelScavengeHeap* heap() {
+    return named_heap<ParallelScavengeHeap>(CollectedHeap::Parallel);
+  }
 
   CardTableBarrierSet* barrier_set();
   PSCardTable* card_table();
diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
index 18bdacd743a..474ddb1355b 100644
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
@@ -50,7 +50,8 @@
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
 #include "gc/shared/oopStorage.inline.hpp"
-#include "gc/shared/oopStorageSet.hpp"
+#include "gc/shared/oopStorageSet.inline.hpp"
+#include "gc/shared/oopStorageSetParState.inline.hpp"
 #include "gc/shared/referencePolicy.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
@@ -2015,10 +2016,6 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
       Universe::oops_do(&mark_and_push_closure);
       break;
 
-    case ParallelRootType::jni_handles:
-      JNIHandles::oops_do(&mark_and_push_closure);
-      break;
-
     case ParallelRootType::object_synchronizer:
       ObjectSynchronizer::oops_do(&mark_and_push_closure);
       break;
@@ -2031,10 +2028,6 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
       JvmtiExport::oops_do(&mark_and_push_closure);
       break;
 
-    case ParallelRootType::vm_global:
-      OopStorageSet::vm_global()->oops_do(&mark_and_push_closure);
-      break;
-
     case ParallelRootType::class_loader_data:
       {
         CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
@@ -2081,6 +2074,7 @@ static void steal_marking_work(TaskTerminator& terminator, uint worker_id) {
 class MarkFromRootsTask : public AbstractGangTask {
   typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
   StrongRootsScope _strong_roots_scope; // needed for Threads::possibly_parallel_threads_do
+  OopStorageSetStrongParState<false /* concurrent */, false /* is_const */> _oop_storage_set_par_state;
   SequentialSubTasksDone _subtasks;
   TaskTerminator _terminator;
   uint _active_workers;
@@ -2105,6 +2099,15 @@ class MarkFromRootsTask : public AbstractGangTask {
     PCAddThreadRootsMarkingTaskClosure closure(worker_id);
     Threads::possibly_parallel_threads_do(true /*parallel */, &closure);
 
+    // Mark from OopStorages
+    {
+      ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(worker_id);
+      PCMarkAndPushClosure closure(cm);
+      _oop_storage_set_par_state.oops_do(&closure);
+      // Do the real work
+      cm->follow_marking_stacks();
+    }
+
     if (_active_workers > 1) {
       steal_marking_work(_terminator, worker_id);
     }
@@ -2235,12 +2238,11 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
 
   // General strong roots.
   Universe::oops_do(&oop_closure);
-  JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
   Threads::oops_do(&oop_closure, NULL);
   ObjectSynchronizer::oops_do(&oop_closure);
   Management::oops_do(&oop_closure);
   JvmtiExport::oops_do(&oop_closure);
-  OopStorageSet::vm_global()->oops_do(&oop_closure);
+  OopStorageSet::strong_oops_do(&oop_closure);
   CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
   ClassLoaderDataGraph::cld_do(&cld_closure);
 
diff --git a/src/hotspot/share/gc/parallel/psRootType.hpp b/src/hotspot/share/gc/parallel/psRootType.hpp
index f08854debf1..3fdad285ed9 100644
--- a/src/hotspot/share/gc/parallel/psRootType.hpp
+++ b/src/hotspot/share/gc/parallel/psRootType.hpp
@@ -35,10 +35,8 @@ class ParallelRootType : public AllStatic {
   // We do not want any holes in the enum as we enumerate these values by incrementing them.
   enum Value {
     universe,
-    jni_handles,
     object_synchronizer,
     management,
-    vm_global,
     class_loader_data,
     jvmti,
     code_cache,
diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp
index 4e9a01bcaae..a9e24c123a3 100644
--- a/src/hotspot/share/gc/parallel/psScavenge.cpp
+++ b/src/hotspot/share/gc/parallel/psScavenge.cpp
@@ -44,7 +44,8 @@
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
 #include "gc/shared/oopStorage.inline.hpp"
-#include "gc/shared/oopStorageSet.hpp"
+#include "gc/shared/oopStorageSetParState.inline.hpp"
+#include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shared/referencePolicy.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
@@ -96,18 +97,10 @@ static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_i
       Universe::oops_do(&roots_closure);
       break;
 
-    case ParallelRootType::jni_handles:
-      JNIHandles::oops_do(&roots_closure);
-      break;
-
     case ParallelRootType::object_synchronizer:
       ObjectSynchronizer::oops_do(&roots_closure);
       break;
 
-    case ParallelRootType::vm_global:
-      OopStorageSet::vm_global()->oops_do(&roots_closure);
-      break;
-
     case ParallelRootType::class_loader_data:
       {
         PSScavengeCLDClosure cld_closure(pm);
@@ -312,6 +305,7 @@ class PSThreadRootsTaskClosure : public ThreadClosure {
 
 class ScavengeRootsTask : public AbstractGangTask {
   StrongRootsScope _strong_roots_scope; // needed for Threads::possibly_parallel_threads_do
+  OopStorageSetStrongParState<false /* concurrent */, false /* is_const */> _oop_storage_strong_par_state;
   SequentialSubTasksDone _subtasks;
   PSOldGen* _old_gen;
   HeapWord* _gen_top;
@@ -373,6 +367,14 @@ class ScavengeRootsTask : public AbstractGangTask {
     PSThreadRootsTaskClosure closure(worker_id);
     Threads::possibly_parallel_threads_do(true /*parallel */, &closure);
 
+    // Scavenge OopStorages
+    {
+      PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(worker_id);
+      PSScavengeRootsClosure closure(pm);
+      _oop_storage_strong_par_state.oops_do(&closure);
+      // Do the real work
+      pm->drain_stacks(false);
+    }
 
     // If active_workers can exceed 1, add a steal_work().
     // PSPromotionManager::drain_stacks_depth() does not fully drain its
diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp
index 16108fe8256..4aea11ff702 100644
--- a/src/hotspot/share/gc/serial/serialHeap.cpp
+++ b/src/hotspot/share/gc/serial/serialHeap.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,10 +31,7 @@
 #include "services/memoryManager.hpp"
 
 SerialHeap* SerialHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to SerialHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Serial, "Invalid name");
-  return static_cast<SerialHeap*>(heap);
+  return named_heap<SerialHeap>(CollectedHeap::Serial);
 }
 
 SerialHeap::SerialHeap() :
diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp
index 8a6936d2e37..9a4d2ff19ec 100644
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp
@@ -29,6 +29,7 @@
 #include "gc/shared/gcWhen.hpp"
 #include "gc/shared/verifyOption.hpp"
 #include "memory/allocation.hpp"
+#include "memory/universe.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/perfData.hpp"
 #include "runtime/safepoint.hpp"
@@ -177,6 +178,20 @@ class CollectedHeap : public CHeapObj<mtInternal> {
     Shenandoah
   };
 
+ protected:
+  // Get a pointer to the derived heap object.  Used to implement
+  // derived class heap() functions rather than being called directly.
+  template<typename T>
+  static T* named_heap(Name kind) {
+    CollectedHeap* heap = Universe::heap();
+    assert(heap != NULL, "Uninitialized heap");
+    assert(kind == heap->kind(), "Heap kind %u should be %u",
+           static_cast<uint>(heap->kind()), static_cast<uint>(kind));
+    return static_cast<T*>(heap);
+  }
+
+ public:
+
   static inline size_t filler_array_max_size() {
     return _filler_array_max_size;
   }
diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.cpp b/src/hotspot/share/gc/shared/genCollectedHeap.cpp
index c5cf68eda14..2324fdfd2e7 100644
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp
@@ -49,7 +49,7 @@
 #include "gc/shared/gcInitLogger.hpp"
 #include "gc/shared/locationPrinter.inline.hpp"
 #include "gc/shared/oopStorage.inline.hpp"
-#include "gc/shared/oopStorageSet.hpp"
+#include "gc/shared/oopStorageSet.inline.hpp"
 #include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shared/scavengableNMethods.hpp"
 #include "gc/shared/space.hpp"
@@ -825,10 +825,6 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
   if (_process_strong_tasks->try_claim_task(GCH_PS_Universe_oops_do)) {
     Universe::oops_do(strong_roots);
   }
-  // Global (strong) JNI handles
-  if (_process_strong_tasks->try_claim_task(GCH_PS_JNIHandles_oops_do)) {
-    JNIHandles::oops_do(strong_roots);
-  }
 
   if (_process_strong_tasks->try_claim_task(GCH_PS_ObjectSynchronizer_oops_do)) {
     ObjectSynchronizer::oops_do(strong_roots);
@@ -844,8 +840,8 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
     AOTLoader::oops_do(strong_roots);
   }
 #endif
-  if (_process_strong_tasks->try_claim_task(GCH_PS_VMGlobal_oops_do)) {
-    OopStorageSet::vm_global()->oops_do(strong_roots);
+  if (_process_strong_tasks->try_claim_task(GCH_PS_OopStorageSet_oops_do)) {
+    OopStorageSet::strong_oops_do(strong_roots);
   }
 
   if (_process_strong_tasks->try_claim_task(GCH_PS_CodeCache_oops_do)) {
@@ -1199,10 +1195,8 @@ void GenCollectedHeap::save_marks() {
 }
 
 GenCollectedHeap* GenCollectedHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Serial, "Invalid name");
-  return (GenCollectedHeap*) heap;
+  // SerialHeap is the only subtype of GenCollectedHeap.
+  return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
 }
 
 #if INCLUDE_SERIALGC
diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.hpp b/src/hotspot/share/gc/shared/genCollectedHeap.hpp
index 4bd5e32fc53..75716573103 100644
--- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp
@@ -106,11 +106,10 @@ class GenCollectedHeap : public CollectedHeap {
   // The set of potentially parallel tasks in root scanning.
   enum GCH_strong_roots_tasks {
     GCH_PS_Universe_oops_do,
-    GCH_PS_JNIHandles_oops_do,
     GCH_PS_ObjectSynchronizer_oops_do,
     GCH_PS_FlatProfiler_oops_do,
     GCH_PS_Management_oops_do,
-    GCH_PS_VMGlobal_oops_do,
+    GCH_PS_OopStorageSet_oops_do,
     GCH_PS_ClassLoaderDataGraph_oops_do,
     GCH_PS_jvmti_oops_do,
     GCH_PS_CodeCache_oops_do,
diff --git a/src/hotspot/share/gc/shared/oopStorageSet.hpp b/src/hotspot/share/gc/shared/oopStorageSet.hpp
index 120f1c4f8d1..1e2b9691140 100644
--- a/src/hotspot/share/gc/shared/oopStorageSet.hpp
+++ b/src/hotspot/share/gc/shared/oopStorageSet.hpp
@@ -95,6 +95,9 @@ class OopStorageSet : public AllStatic {
   static OopStorage* resolved_method_table_weak() {
     return storage(resolved_method_table_weak_index);
   }
+
+  template <typename Closure>
+  static void strong_oops_do(Closure* cl);
 };
 
 class OopStorageSet::Iterator {
diff --git a/src/hotspot/share/runtime/extendedPC.hpp b/src/hotspot/share/gc/shared/oopStorageSet.inline.hpp
similarity index 66%
rename from src/hotspot/share/runtime/extendedPC.hpp
rename to src/hotspot/share/gc/shared/oopStorageSet.inline.hpp
index fb3288a1a27..65f6ed01915 100644
--- a/src/hotspot/share/runtime/extendedPC.hpp
+++ b/src/hotspot/share/gc/shared/oopStorageSet.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -22,22 +22,17 @@
  *
  */
 
-#ifndef SHARE_RUNTIME_EXTENDEDPC_HPP
-#define SHARE_RUNTIME_EXTENDEDPC_HPP
+#ifndef SHARE_GC_SHARED_OOPSTORAGESET_INLINE_HPP
+#define SHARE_GC_SHARED_OOPSTORAGESET_INLINE_HPP
 
-#include "utilities/globalDefinitions.hpp"
+#include "gc/shared/oopStorage.inline.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 
-// An ExtendedPC contains the _pc from a signal handler in a platform
-// independent way.
+template <typename Closure>
+void OopStorageSet::strong_oops_do(Closure* cl) {
+  for (OopStorageSet::Iterator it = OopStorageSet::strong_iterator(); !it.is_end(); ++it) {
+    (*it)->oops_do(cl);
+  }
+}
 
-class ExtendedPC {
- private:
-  address _pc;
-
- public:
-  address pc() const { return _pc; }
-  ExtendedPC(address pc) { _pc  = pc;   }
-  ExtendedPC()           { _pc  = NULL; }
-};
-
-#endif // SHARE_RUNTIME_EXTENDEDPC_HPP
+#endif // SHARE_GC_SHARED_OOPSTORAGESET_INLINE_HPP
diff --git a/src/hotspot/share/gc/shared/oopStorageSetParState.hpp b/src/hotspot/share/gc/shared/oopStorageSetParState.hpp
new file mode 100644
index 00000000000..2e37435e7c4
--- /dev/null
+++ b/src/hotspot/share/gc/shared/oopStorageSetParState.hpp
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP
+#define SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP
+
+#include "gc/shared/oopStorageParState.hpp"
+#include "gc/shared/oopStorageSet.hpp"
+#include "utilities/valueObjArray.hpp"
+
+template <bool concurrent, bool is_const>
+class OopStorageSetStrongParState {
+  typedef OopStorage::ParState<concurrent, is_const> ParStateType;
+  typedef ValueObjArray<ParStateType, OopStorageSet::strong_count> ParStateArray;
+
+  ParStateArray _par_states;
+
+public:
+  OopStorageSetStrongParState();
+
+  template <typename Closure>
+  void oops_do(Closure* cl);
+};
+
+#endif // SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP
diff --git a/src/hotspot/share/gc/shared/oopStorageSetParState.inline.hpp b/src/hotspot/share/gc/shared/oopStorageSetParState.inline.hpp
new file mode 100644
index 00000000000..8152aa76d63
--- /dev/null
+++ b/src/hotspot/share/gc/shared/oopStorageSetParState.inline.hpp
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP
+#define SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP
+
+#include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/shared/oopStorageSet.hpp"
+#include "gc/shared/oopStorageSetParState.hpp"
+
+template <bool concurrent, bool is_const>
+OopStorageSetStrongParState<concurrent, is_const>::OopStorageSetStrongParState() :
+    _par_states(OopStorageSet::strong_iterator()) {
+}
+
+template <bool concurrent, bool is_const>
+template <typename Closure>
+void OopStorageSetStrongParState<concurrent, is_const>::oops_do(Closure* cl) {
+  for (int i = 0; i < _par_states.count(); i++) {
+    _par_states.at(i)->oops_do(cl);
+  }
+}
+
+
+#endif // SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
index 1566057c3ad..753638af6de 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
@@ -118,21 +118,26 @@ void ShenandoahMarkCompact::do_it(GCCause::Cause gc_cause) {
     }
     assert(!heap->is_concurrent_mark_in_progress(), "sanity");
 
-    // c. Reset the bitmaps for new marking
+    // c. Update roots if this full GC is due to evac-oom, which may carry from-space pointers in roots.
+    if (has_forwarded_objects) {
+      heap->concurrent_mark()->update_roots(ShenandoahPhaseTimings::full_gc_update_roots);
+    }
+
+    // d. Reset the bitmaps for new marking
     heap->reset_mark_bitmap();
     assert(heap->marking_context()->is_bitmap_clear(), "sanity");
     assert(!heap->marking_context()->is_complete(), "sanity");
 
-    // d. Abandon reference discovery and clear all discovered references.
+    // e. Abandon reference discovery and clear all discovered references.
     ReferenceProcessor* rp = heap->ref_processor();
     rp->disable_discovery();
     rp->abandon_partial_discovery();
     rp->verify_no_references_recorded();
 
-    // e. Set back forwarded objects bit back, in case some steps above dropped it.
+    // f. Set back forwarded objects bit back, in case some steps above dropped it.
     heap->set_has_forwarded_objects(has_forwarded_objects);
 
-    // f. Sync pinned region status from the CP marks
+    // g. Sync pinned region status from the CP marks
     heap->sync_pinned_region_status();
 
     // The rest of prologue:
@@ -242,7 +247,6 @@ void ShenandoahMarkCompact::phase1_mark_heap() {
   rp->setup_policy(true); // forcefully purge all soft references
   rp->set_active_mt_degree(heap->workers()->active_workers());
 
-  cm->update_roots(ShenandoahPhaseTimings::full_gc_update_roots);
   cm->mark_roots(ShenandoahPhaseTimings::full_gc_scan_roots);
   cm->finish_mark_from_roots(/* full_gc = */ true);
   heap->mark_complete_marking_context();
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp
index 621c8bf542d..dc3701b2b2b 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp
@@ -207,8 +207,7 @@ void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
 }
 
 #ifdef ASSERT
-void ShenandoahNMethod::assert_alive_and_correct() {
-  assert(_nm->is_alive(), "only alive nmethods here");
+void ShenandoahNMethod::assert_correct() {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
   for (int c = 0; c < _oops_count; c++) {
     oop *loc = _oops[c];
@@ -490,14 +489,14 @@ void ShenandoahNMethodTable::log_flush_nmethod(nmethod* nm) {
 }
 
 #ifdef ASSERT
-void ShenandoahNMethodTable::assert_nmethods_alive_and_correct() {
+void ShenandoahNMethodTable::assert_nmethods_correct() {
   assert_locked_or_safepoint(CodeCache_lock);
 
   for (int index = 0; index < length(); index ++) {
     ShenandoahNMethod* m = _list->at(index);
     // Concurrent unloading may have dead nmethods to be cleaned by sweeper
     if (m->is_unregistered()) continue;
-    m->assert_alive_and_correct();
+    m->assert_correct();
   }
 }
 #endif
@@ -563,8 +562,11 @@ void ShenandoahNMethodTableSnapshot::parallel_blobs_do(CodeBlobClosure *f) {
         continue;
       }
 
-      nmr->assert_alive_and_correct();
-      f->do_code_blob(nmr->nm());
+      // A nmethod can become a zombie before it is unregistered.
+      if (nmr->nm()->is_alive()) {
+        nmr->assert_correct();
+        f->do_code_blob(nmr->nm());
+      }
     }
   }
 }
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp
index 58278230553..3d87ce65c0d 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp
@@ -73,7 +73,7 @@ class ShenandoahNMethod : public CHeapObj<mtGC> {
   static inline ShenandoahNMethod* gc_data(nmethod* nm);
   static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
 
-  void assert_alive_and_correct() NOT_DEBUG_RETURN;
+  void assert_correct() NOT_DEBUG_RETURN;
   void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
   static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
 
@@ -160,7 +160,7 @@ class ShenandoahNMethodTable : public CHeapObj<mtGC> {
   ShenandoahNMethodTableSnapshot* snapshot_for_iteration();
   void finish_iteration(ShenandoahNMethodTableSnapshot* snapshot);
 
-  void assert_nmethods_alive_and_correct() NOT_DEBUG_RETURN;
+  void assert_nmethods_correct() NOT_DEBUG_RETURN;
 private:
   // Rebuild table and replace current one
   void rebuild(int size);
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp
index 4f30d0206e2..40d51f1f0f0 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp
@@ -139,12 +139,12 @@ class outputStream;
   f(full_gc,                                        "Pause Full GC (N)")               \
   f(full_gc_heapdump_pre,                           "  Pre Heap Dump")                 \
   f(full_gc_prepare,                                "  Prepare")                       \
+  f(full_gc_update_roots,                           "    Update Roots")                \
+  SHENANDOAH_PAR_PHASE_DO(full_gc_update_roots_,    "      FU: ", f)                   \
   f(full_gc_scan_roots,                             "  Scan Roots")                    \
   SHENANDOAH_PAR_PHASE_DO(full_gc_scan_roots_,      "    FS: ", f)                     \
   f(full_gc_scan_conc_roots,                        "  Scan Concurrent Roots")         \
   SHENANDOAH_PAR_PHASE_DO(full_gc_scan_conc_roots,  "    FCS: ", f)                    \
-  f(full_gc_update_roots,                           "  Update Roots")                  \
-  SHENANDOAH_PAR_PHASE_DO(full_gc_update_roots_,    "    FU: ", f)                     \
   f(full_gc_mark,                                   "  Mark")                          \
   f(full_gc_mark_finish_queues,                     "    Finish Queues")               \
   f(full_gc_weakrefs,                               "    Weak References")             \
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp
index ab13d2917f1..3f20359026f 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp
@@ -29,6 +29,7 @@
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/shared/oopStorageSet.hpp"
 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
 #include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp
index 80056a6cd84..bb7734d707e 100644
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp
@@ -41,10 +41,7 @@
 #include "utilities/align.hpp"
 
 ZCollectedHeap* ZCollectedHeap::heap() {
-  CollectedHeap* heap = Universe::heap();
-  assert(heap != NULL, "Uninitialized access to ZCollectedHeap::heap()");
-  assert(heap->kind() == CollectedHeap::Z, "Invalid name");
-  return (ZCollectedHeap*)heap;
+  return named_heap<ZCollectedHeap>(CollectedHeap::Z);
 }
 
 ZCollectedHeap::ZCollectedHeap() :
diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp
index 2eb68e65460..523487be0de 100644
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp
@@ -28,8 +28,9 @@
 #include "compiler/oopMap.hpp"
 #include "gc/shared/barrierSet.hpp"
 #include "gc/shared/barrierSetNMethod.hpp"
-#include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shared/oopStorageSet.hpp"
+#include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/shared/oopStorageSetParState.inline.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/z/zBarrierSetNMethod.hpp"
 #include "gc/z/zGlobals.hpp"
@@ -69,8 +70,7 @@ static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache")
 static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
 static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
 static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
-static const ZStatSubPhase ZSubPhaseConcurrentRootsJNIHandles("Concurrent Roots JNIHandles");
-static const ZStatSubPhase ZSubPhaseConcurrentRootsVMHandles("Concurrent Roots VMHandles");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsOopStorageSet("Concurrent Roots OopStorageSet");
 static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
 
 static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
@@ -285,11 +285,9 @@ void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
 }
 
 ZConcurrentRootsIterator::ZConcurrentRootsIterator(int cld_claim) :
-    _jni_handles_iter(OopStorageSet::jni_global()),
-    _vm_handles_iter(OopStorageSet::vm_global()),
+    _oop_storage_set_iter(),
     _cld_claim(cld_claim),
-    _jni_handles(this),
-    _vm_handles(this),
+    _oop_storage_set(this),
     _class_loader_data_graph(this) {
   ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
   ClassLoaderDataGraph::clear_claimed_marks(cld_claim);
@@ -299,14 +297,9 @@ ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
   ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
 }
 
-void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
-  ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles);
-  _jni_handles_iter.oops_do(cl);
-}
-
-void ZConcurrentRootsIterator::do_vm_handles(ZRootsIteratorClosure* cl) {
-  ZStatTimer timer(ZSubPhaseConcurrentRootsVMHandles);
-  _vm_handles_iter.oops_do(cl);
+void ZConcurrentRootsIterator::do_oop_storage_set(ZRootsIteratorClosure* cl) {
+  ZStatTimer timer(ZSubPhaseConcurrentRootsOopStorageSet);
+  _oop_storage_set_iter.oops_do(cl);
 }
 
 void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
@@ -317,8 +310,7 @@ void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure*
 
 void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   ZStatTimer timer(ZSubPhaseConcurrentRoots);
-  _jni_handles.oops_do(cl);
-  _vm_handles.oops_do(cl),
+  _oop_storage_set.oops_do(cl);
   _class_loader_data_graph.oops_do(cl);
 }
 
diff --git a/src/hotspot/share/gc/z/zRootsIterator.hpp b/src/hotspot/share/gc/z/zRootsIterator.hpp
index 622999d42c6..dd819ec79cc 100644
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp
@@ -25,6 +25,7 @@
 #define SHARE_GC_Z_ZROOTSITERATOR_HPP
 
 #include "gc/shared/oopStorageParState.hpp"
+#include "gc/shared/oopStorageSetParState.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "memory/allocation.hpp"
 #include "memory/iterator.hpp"
@@ -35,6 +36,7 @@
 class ZRootsIteratorClosure;
 
 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
+typedef OopStorageSetStrongParState<true /* concurrent */, false /* is_const */> ZOopStorageSetIterator;
 
 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 class ZSerialOopsDo {
@@ -134,16 +136,13 @@ class ZRootsIterator {
 
 class ZConcurrentRootsIterator {
 private:
-  ZOopStorageIterator _jni_handles_iter;
-  ZOopStorageIterator _vm_handles_iter;
-  const int           _cld_claim;
+  ZOopStorageSetIterator _oop_storage_set_iter;
+  const int              _cld_claim;
 
-  void do_jni_handles(ZRootsIteratorClosure* cl);
-  void do_vm_handles(ZRootsIteratorClosure* cl);
+  void do_oop_storage_set(ZRootsIteratorClosure* cl);
   void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
 
-  ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_jni_handles>             _jni_handles;
-  ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_vm_handles>              _vm_handles;
+  ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_oop_storage_set>         _oop_storage_set;
   ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
 
 public:
diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp b/src/hotspot/share/interpreter/abstractInterpreter.cpp
index 0702e8b34b2..bfa1305a9d2 100644
--- a/src/hotspot/share/interpreter/abstractInterpreter.cpp
+++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp
@@ -27,7 +27,6 @@
 #include "asm/macroAssembler.inline.hpp"
 #include "compiler/disassembler.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
@@ -121,7 +120,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
     return kind;
   }
 
-#ifndef CC_INTERP
+#ifndef ZERO
   switch (m->intrinsic_id()) {
     // Use optimized stub code for CRC32 native methods.
     case vmIntrinsics::_updateCRC32            : return java_util_zip_CRC32_update;
@@ -136,7 +135,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
     case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits;
     default:                                 break;
   }
-#endif // CC_INTERP
+#endif // ZERO
 
   // Native method?
   // Note: This test must come _before_ the test for intrinsic
@@ -189,7 +188,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
   // Accessor method?
   if (m->is_getter()) {
     // TODO: We should have used ::is_accessor above, but fast accessors in Zero expect only getters.
-    // See CppInterpreter::accessor_entry in cppInterpreter_zero.cpp. This should be fixed in Zero,
+    // See ZeroInterpreter::accessor_entry in zeroInterpreter_zero.cpp. This should be fixed in Zero,
     // then the call above updated to ::is_accessor
     assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
     return accessor;
diff --git a/src/hotspot/share/interpreter/abstractInterpreter.hpp b/src/hotspot/share/interpreter/abstractInterpreter.hpp
index 84b8124ee84..b166ecb271d 100644
--- a/src/hotspot/share/interpreter/abstractInterpreter.hpp
+++ b/src/hotspot/share/interpreter/abstractInterpreter.hpp
@@ -39,21 +39,19 @@
 // an assembly language version (aka template interpreter) and a high level language version
 // (aka c++ interpreter). Th division of labor is as follows:
 
-// Template Interpreter          C++ Interpreter        Functionality
+// Template Interpreter          Zero Interpreter       Functionality
 //
 // templateTable*                bytecodeInterpreter*   actual interpretation of bytecodes
 //
-// templateInterpreter*          cppInterpreter*        generation of assembly code that creates
+// templateInterpreter*          zeroInterpreter*       generation of assembly code that creates
 //                                                      and manages interpreter runtime frames.
-//                                                      Also code for populating interpreter
-//                                                      frames created during deoptimization.
 //
 
 class InterpreterMacroAssembler;
 
 class AbstractInterpreter: AllStatic {
   friend class VMStructs;
-  friend class CppInterpreterGenerator;
+  friend class ZeroInterpreterGenerator;
   friend class TemplateInterpreterGenerator;
  public:
   enum MethodKind {
diff --git a/src/hotspot/share/interpreter/bytecodes.cpp b/src/hotspot/share/interpreter/bytecodes.cpp
index e377e36b88c..6711ba735db 100644
--- a/src/hotspot/share/interpreter/bytecodes.cpp
+++ b/src/hotspot/share/interpreter/bytecodes.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -532,8 +532,8 @@ void Bytecodes::initialize() {
   def(_nofast_getfield     , "nofast_getfield"     , "bJJ"  , NULL    , T_ILLEGAL,  0, true,  _getfield       );
   def(_nofast_putfield     , "nofast_putfield"     , "bJJ"  , NULL    , T_ILLEGAL, -2, true , _putfield       );
 
-  def(_nofast_aload_0      , "nofast_aload_0"      , "b"    , NULL    , T_ILLEGAL,  1, true , _aload_0        );
-  def(_nofast_iload        , "nofast_iload"        , "bi"   , NULL    , T_ILLEGAL,  1, false, _iload          );
+  def(_nofast_aload_0      , "nofast_aload_0"      , "b"    , NULL    , T_OBJECT,   1, true , _aload_0        );
+  def(_nofast_iload        , "nofast_iload"        , "bi"   , NULL    , T_INT,      1, false, _iload          );
 
   def(_shouldnotreachhere  , "_shouldnotreachhere" , "b"    , NULL    , T_VOID   ,  0, false);
 
diff --git a/src/hotspot/share/interpreter/cppInterpreter.cpp b/src/hotspot/share/interpreter/cppInterpreter.cpp
deleted file mode 100644
index b69b5c47a40..00000000000
--- a/src/hotspot/share/interpreter/cppInterpreter.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/cppInterpreterGenerator.hpp"
-#include "interpreter/interpreter.hpp"
-#include "interpreter/interpreterRuntime.hpp"
-#include "memory/resourceArea.hpp"
-#include "runtime/timerTrace.hpp"
-
-#ifdef CC_INTERP
-
-#ifdef ZERO
-# include "entry_zero.hpp"
-#else
-#error "Only Zero CppInterpreter is supported"
-#endif
-
-void CppInterpreter::initialize_stub() {
-  if (_code != NULL) return;
-
-  // generate interpreter
-  int code_size = InterpreterCodeSize;
-  NOT_PRODUCT(code_size *= 4;)  // debug uses extra interpreter code space
-  _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
-                         "Interpreter");
-}
-
-void CppInterpreter::initialize_code() {
-  AbstractInterpreter::initialize();
-
-  // generate interpreter
-  { ResourceMark rm;
-    TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime));
-    CppInterpreterGenerator g(_code);
-    if (PrintInterpreter) print();
-  }
-
-  // Allow c++ interpreter to do one initialization now that switches are set, etc.
-  BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
-  if (JvmtiExport::can_post_interpreter_events())
-    BytecodeInterpreter::runWithChecks(&start_msg);
-  else
-    BytecodeInterpreter::run(&start_msg);
-}
-
-void CppInterpreter::invoke_method(Method* method, address entry_point, TRAPS) {
-  ((ZeroEntry *) entry_point)->invoke(method, THREAD);
-}
-
-void CppInterpreter::invoke_osr(Method* method,
-                                address   entry_point,
-                                address   osr_buf,
-                                TRAPS) {
-  ((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD);
-}
-
-
-
-InterpreterCodelet* CppInterpreter::codelet_containing(address pc) {
-  // FIXME: I'm pretty sure _code is null and this is never called, which is why it's copied.
-  return (InterpreterCodelet*)_code->stub_containing(pc);
-}
-
-#endif // CC_INTERP
diff --git a/src/hotspot/share/interpreter/interpreter.cpp b/src/hotspot/share/interpreter/interpreter.cpp
index ad854e16e77..f597950f38f 100644
--- a/src/hotspot/share/interpreter/interpreter.cpp
+++ b/src/hotspot/share/interpreter/interpreter.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
 #include "asm/macroAssembler.inline.hpp"
 #include "compiler/disassembler.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "interpreter/interp_masm.hpp"
diff --git a/src/hotspot/share/interpreter/interpreter.hpp b/src/hotspot/share/interpreter/interpreter.hpp
index 54bedd1dfb9..288aa662eee 100644
--- a/src/hotspot/share/interpreter/interpreter.hpp
+++ b/src/hotspot/share/interpreter/interpreter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,9 @@
 #define SHARE_INTERPRETER_INTERPRETER_HPP
 
 #include "code/stubs.hpp"
-#include "interpreter/cppInterpreter.hpp"
+#include "interpreter/interp_masm.hpp"
 #include "interpreter/templateInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
 #include "memory/resourceArea.hpp"
 #include "utilities/align.hpp"
 
@@ -115,8 +116,8 @@ class CodeletMark: ResourceMark {
 };
 
 // Wrapper typedef to use the name Interpreter to mean either
-// the c++ interpreter or the template interpreter.
+// the Zero interpreter or the template interpreter.
 
-typedef CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) Interpreter;
+typedef ZERO_ONLY(ZeroInterpreter) NOT_ZERO(TemplateInterpreter) Interpreter;
 
 #endif // SHARE_INTERPRETER_INTERPRETER_HPP
diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp
index 70ab8f6b73d..efbf725f7c9 100644
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp
@@ -353,28 +353,6 @@ void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) {
   note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
 }
 
-#ifdef CC_INTERP
-// As legacy note_trap, but we have more arguments.
-JRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci))
-  methodHandle trap_method(thread, method);
-  note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
-JRT_END
-
-// Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper
-// for each exception.
-void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci)
-  { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); }
-void InterpreterRuntime::note_div0Check_trap(JavaThread* thread, Method *method, int trap_bci)
-  { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_div0_check, method, trap_bci); }
-void InterpreterRuntime::note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci)
-  { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_range_check, method, trap_bci); }
-void InterpreterRuntime::note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci)
-  { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_class_check, method, trap_bci); }
-void InterpreterRuntime::note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci)
-  { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_array_check, method, trap_bci); }
-#endif // CC_INTERP
-
-
 static Handle get_preinitialized_exception(Klass* k, TRAPS) {
   // get klass
   InstanceKlass* klass = InstanceKlass::cast(k);
@@ -501,11 +479,7 @@ JRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
     // during deoptimization so the interpreter needs to skip it when
     // the frame is popped.
     thread->set_do_not_unlock_if_synchronized(true);
-#ifdef CC_INTERP
-    return (address) -1;
-#else
     return Interpreter::remove_activation_entry();
-#endif
   }
 
   // Need to do this check first since when _do_not_unlock_if_synchronized
@@ -516,11 +490,7 @@ JRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
     ResourceMark rm;
     assert(current_bci == 0,  "bci isn't zero for do_not_unlock_if_synchronized");
     thread->set_vm_result(exception);
-#ifdef CC_INTERP
-    return (address) -1;
-#else
     return Interpreter::remove_activation_entry();
-#endif
   }
 
   do {
@@ -590,19 +560,13 @@ JRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
     JvmtiExport::post_exception_throw(thread, h_method(), last_frame.bcp(), h_exception());
   }
 
-#ifdef CC_INTERP
-  address continuation = (address)(intptr_t) handler_bci;
-#else
   address continuation = NULL;
-#endif
   address handler_pc = NULL;
   if (handler_bci < 0 || !thread->reguard_stack((address) &continuation)) {
     // Forward exception to callee (leaving bci/bcp untouched) because (a) no
     // handler in this method, or (b) after a stack overflow there is not yet
     // enough stack space available to reprotect the stack.
-#ifndef CC_INTERP
     continuation = Interpreter::remove_activation_entry();
-#endif
 #if COMPILER2_OR_JVMCI
     // Count this for compilation purposes
     h_method->interpreter_throwout_increment(THREAD);
@@ -610,11 +574,14 @@ JRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
   } else {
     // handler in this method => change bci/bcp to handler bci/bcp and continue there
     handler_pc = h_method->code_base() + handler_bci;
-#ifndef CC_INTERP
+#ifndef ZERO
     set_bcp_and_mdp(handler_pc, thread);
     continuation = Interpreter::dispatch_table(vtos)[*handler_pc];
+#else
+    continuation = (address)(intptr_t) handler_bci;
 #endif
   }
+
   // notify debugger of an exception catch
   // (this is good for exceptions caught in native methods as well)
   if (JvmtiExport::can_post_on_exceptions()) {
diff --git a/src/hotspot/share/interpreter/interpreterRuntime.hpp b/src/hotspot/share/interpreter/interpreterRuntime.hpp
index dd83ad467a2..083c572d655 100644
--- a/src/hotspot/share/interpreter/interpreterRuntime.hpp
+++ b/src/hotspot/share/interpreter/interpreterRuntime.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,10 +46,6 @@ class InterpreterRuntime: AllStatic {
   static void      note_trap_inner(JavaThread* thread, int reason,
                                    const methodHandle& trap_method, int trap_bci, TRAPS);
   static void      note_trap(JavaThread *thread, int reason, TRAPS);
-#ifdef CC_INTERP
-  // Profile traps in C++ interpreter.
-  static void      note_trap(JavaThread* thread, int reason, Method *method, int trap_bci);
-#endif // CC_INTERP
 
   // Inner work method for Interpreter's frequency counter overflow.
   static nmethod* frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp);
@@ -92,17 +88,6 @@ class InterpreterRuntime: AllStatic {
 #endif
   static void    throw_pending_exception(JavaThread* thread);
 
-#ifdef CC_INTERP
-  // Profile traps in C++ interpreter.
-  static void    note_nullCheck_trap (JavaThread* thread, Method *method, int trap_bci);
-  static void    note_div0Check_trap (JavaThread* thread, Method *method, int trap_bci);
-  static void    note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci);
-  static void    note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci);
-  static void    note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci);
-  // A dummy for macros that shall not profile traps.
-  static void    note_no_trap(JavaThread* thread, Method *method, int trap_bci) {}
-#endif // CC_INTERP
-
   static void resolve_from_cache(JavaThread* thread, Bytecodes::Code bytecode);
  private:
   // Statics & fields
diff --git a/src/hotspot/share/interpreter/invocationCounter.cpp b/src/hotspot/share/interpreter/invocationCounter.cpp
index e5a5fd2c2d9..7a45b0a654d 100644
--- a/src/hotspot/share/interpreter/invocationCounter.cpp
+++ b/src/hotspot/share/interpreter/invocationCounter.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,32 +80,3 @@ void InvocationCounter::print() {
                                    extract_count(counter), limit(),
                                    extract_carry(counter) ? "true" : "false");
 }
-
-#ifdef CC_INTERP
-int                       InvocationCounter::InterpreterInvocationLimit;
-int                       InvocationCounter::InterpreterBackwardBranchLimit;
-#endif
-
-void invocationCounter_init() {
-#ifdef CC_INTERP
-  InvocationCounter::InterpreterInvocationLimit =
-    CompileThreshold << InvocationCounter::count_shift;
-
-  // When methodData is collected, the backward branch limit is compared against a
-  // methodData counter, rather than an InvocationCounter.  In the former case, we
-  // don't need the shift by number_of_noncount_bits, but we do need to adjust
-  // the factor by which we scale the threshold.
-  if (ProfileInterpreter) {
-    InvocationCounter::InterpreterBackwardBranchLimit =
-      (int)((int64_t)CompileThreshold
-            * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100);
-  } else {
-    InvocationCounter::InterpreterBackwardBranchLimit =
-      (int)(((int64_t)CompileThreshold * OnStackReplacePercentage / 100)
-            << InvocationCounter::count_shift);
-  }
-
-  assert(0 <= InvocationCounter::InterpreterBackwardBranchLimit,
-         "OSR threshold should be non-negative");
-#endif
-}
diff --git a/src/hotspot/share/interpreter/invocationCounter.hpp b/src/hotspot/share/interpreter/invocationCounter.hpp
index 0cf35e851b6..a552eeec512 100644
--- a/src/hotspot/share/interpreter/invocationCounter.hpp
+++ b/src/hotspot/share/interpreter/invocationCounter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,22 +82,6 @@ class InvocationCounter {
   void set(uint count, uint carry);
 
 public:
-#ifdef CC_INTERP
-  static int InterpreterInvocationLimit;        // CompileThreshold scaled for interpreter use
-  static int InterpreterBackwardBranchLimit;    // A separate threshold for on stack replacement
-
-  // Test counter using scaled limits like the asm interpreter would do rather than doing
-  // the shifts to normalize the counter.
-  // Checks sum of invocation_counter and backedge_counter as the template interpreter does.
-  bool reached_InvocationLimit(InvocationCounter *back_edge_count) const {
-    return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >=
-           (uint) InterpreterInvocationLimit;
-  }
-  bool reached_BackwardBranchLimit(InvocationCounter *back_edge_count) const {
-    return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >=
-           (uint) InterpreterBackwardBranchLimit;
-  }
-#endif // CC_INTERP
 
   // Miscellaneous
   static ByteSize counter_offset()               { return byte_offset_of(InvocationCounter, _counter); }
diff --git a/src/hotspot/share/interpreter/rewriter.cpp b/src/hotspot/share/interpreter/rewriter.cpp
index a80b8c6f7ab..c2474fd7754 100644
--- a/src/hotspot/share/interpreter/rewriter.cpp
+++ b/src/hotspot/share/interpreter/rewriter.cpp
@@ -404,7 +404,7 @@ void Rewriter::scan_method(Thread* thread, Method* method, bool reverse, bool* i
 
     switch (c) {
       case Bytecodes::_lookupswitch   : {
-#ifndef CC_INTERP
+#ifndef ZERO
         Bytecode_lookupswitch bc(method, bcp);
         (*bcp) = (
           bc.number_of_pairs() < BinarySwitchThreshold
@@ -416,7 +416,7 @@ void Rewriter::scan_method(Thread* thread, Method* method, bool reverse, bool* i
       }
       case Bytecodes::_fast_linearswitch:
       case Bytecodes::_fast_binaryswitch: {
-#ifndef CC_INTERP
+#ifndef ZERO
         (*bcp) = Bytecodes::_lookupswitch;
 #endif
         break;
diff --git a/src/hotspot/share/interpreter/templateInterpreter.cpp b/src/hotspot/share/interpreter/templateInterpreter.cpp
index 8c880228422..4bcd1333891 100644
--- a/src/hotspot/share/interpreter/templateInterpreter.cpp
+++ b/src/hotspot/share/interpreter/templateInterpreter.cpp
@@ -35,8 +35,6 @@
 #include "runtime/timerTrace.hpp"
 #include "utilities/copy.hpp"
 
-#ifndef CC_INTERP
-
 # define __ _masm->
 
 void TemplateInterpreter::initialize_stub() {
@@ -369,5 +367,3 @@ bool TemplateInterpreter::bytecode_should_reexecute(Bytecodes::Code code) {
 InterpreterCodelet* TemplateInterpreter::codelet_containing(address pc) {
   return (InterpreterCodelet*)_code->stub_containing(pc);
 }
-
-#endif // !CC_INTERP
diff --git a/src/hotspot/share/interpreter/templateInterpreter.hpp b/src/hotspot/share/interpreter/templateInterpreter.hpp
index 7ff5e5b541f..2ff62e15d33 100644
--- a/src/hotspot/share/interpreter/templateInterpreter.hpp
+++ b/src/hotspot/share/interpreter/templateInterpreter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 // This file contains the platform-independent parts
 // of the template interpreter and the template interpreter generator.
 
-#ifndef CC_INTERP
+#ifndef ZERO
 
 class InterpreterMacroAssembler;
 class InterpreterCodelet;
@@ -195,6 +195,6 @@ class TemplateInterpreter: public AbstractInterpreter {
   static int InterpreterCodeSize;
 };
 
-#endif // !CC_INTERP
+#endif // !ZERO
 
 #endif // SHARE_INTERPRETER_TEMPLATEINTERPRETER_HPP
diff --git a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp
index 0ed32295c97..51b95bbd76b 100644
--- a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp
+++ b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,6 @@
 #include "interpreter/templateTable.hpp"
 #include "oops/methodData.hpp"
 
-#ifndef CC_INTERP
-
 #define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, __LINE__, _masm)->
 
 TemplateInterpreterGenerator::TemplateInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
@@ -485,4 +483,3 @@ address TemplateInterpreterGenerator::generate_method_entry(
 
   return entry_point;
 }
-#endif // !CC_INTERP
diff --git a/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp b/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp
index 84731b7d5b2..5843b61736d 100644
--- a/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp
+++ b/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp
@@ -28,7 +28,7 @@
 // This file contains the platform-independent parts
 // of the template interpreter generator.
 
-#ifndef CC_INTERP
+#ifndef ZERO
 
 class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
  protected:
@@ -123,6 +123,6 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
   TemplateInterpreterGenerator(StubQueue* _code);
 };
 
-#endif // !CC_INTERP
+#endif // !ZERO
 
 #endif // SHARE_INTERPRETER_TEMPLATEINTERPRETERGENERATOR_HPP
diff --git a/src/hotspot/share/interpreter/templateTable.cpp b/src/hotspot/share/interpreter/templateTable.cpp
index c1bb5cb93fb..a2e23de56cc 100644
--- a/src/hotspot/share/interpreter/templateTable.cpp
+++ b/src/hotspot/share/interpreter/templateTable.cpp
@@ -27,7 +27,7 @@
 #include "interpreter/interp_masm.hpp"
 #include "interpreter/templateTable.hpp"
 
-#ifdef CC_INTERP
+#ifdef ZERO
 
 void templateTable_init() {
 }
@@ -505,4 +505,4 @@ void TemplateTable::initialize() {
 void TemplateTable::unimplemented_bc() {
   _masm->unimplemented( Bytecodes::name(_desc->bytecode()));
 }
-#endif /* !CC_INTERP */
+#endif /* !ZERO */
diff --git a/src/hotspot/share/interpreter/templateTable.hpp b/src/hotspot/share/interpreter/templateTable.hpp
index 585d067c2b4..c44ce3a1857 100644
--- a/src/hotspot/share/interpreter/templateTable.hpp
+++ b/src/hotspot/share/interpreter/templateTable.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 #include "runtime/frame.hpp"
 #include "utilities/macros.hpp"
 
-#ifndef CC_INTERP
+#ifndef ZERO
 // All the necessary definitions used for (bytecode) template generation. Instead of
 // spreading the implementation functionality for each bytecode in the interpreter
 // and the snippet generator, a template is assigned to each bytecode which can be
@@ -351,6 +351,6 @@ class TemplateTable: AllStatic {
 #include CPU_HEADER(templateTable)
 
 };
-#endif /* !CC_INTERP */
+#endif /* !ZERO */
 
 #endif // SHARE_INTERPRETER_TEMPLATETABLE_HPP
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
similarity index 95%
rename from src/hotspot/share/interpreter/bytecodeInterpreter.cpp
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
index 12511102b9f..9621bbb6c06 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
@@ -27,9 +27,8 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/bytecodeInterpreter.inline.hpp"
-#include "interpreter/bytecodeInterpreterProfiling.hpp"
+#include "interpreter/zero/bytecodeInterpreter.inline.hpp"
+#include "interpreter/zero/bytecodeInterpreterProfiling.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "logging/log.hpp"
@@ -56,7 +55,6 @@
 #include "utilities/exceptions.hpp"
 
 // no precompiled headers
-#ifdef CC_INTERP
 
 /*
  * USELABELS - If using GCC, then use labels for the opcode dispatching
@@ -117,11 +115,10 @@
  * is no entry point to do the transition to vm so we just
  * do it by hand here.
  */
-#define VM_JAVA_ERROR_NO_JUMP(name, msg, note_a_trap)                             \
+#define VM_JAVA_ERROR_NO_JUMP(name, msg)                                          \
     DECACHE_STATE();                                                              \
     SET_LAST_JAVA_FRAME();                                                        \
     {                                                                             \
-       InterpreterRuntime::note_a_trap(THREAD, istate->method(), BCI());          \
        ThreadInVMfromJava trans(THREAD);                                          \
        Exceptions::_throw_msg(THREAD, __FILE__, __LINE__, name, msg);             \
     }                                                                             \
@@ -129,8 +126,8 @@
     CACHE_STATE();
 
 // Normal throw of a java error.
-#define VM_JAVA_ERROR(name, msg, note_a_trap)                                     \
-    VM_JAVA_ERROR_NO_JUMP(name, msg, note_a_trap)                                 \
+#define VM_JAVA_ERROR(name, msg)                                     \
+    VM_JAVA_ERROR_NO_JUMP(name, msg)                                 \
     goto handle_exception;
 
 #ifdef PRODUCT
@@ -173,7 +170,7 @@
                                           pc);                                   \
           RESET_LAST_JAVA_FRAME();                                               \
           CACHE_STATE();                                                         \
-          if (THREAD->pop_frame_pending() &&                                     \
+          if (THREAD->has_pending_popframe() &&                                  \
               !THREAD->pop_frame_in_process()) {                                 \
             goto handle_Pop_Frame;                                               \
           }                                                                      \
@@ -289,66 +286,8 @@
 
 
 #define METHOD istate->method()
-#define GET_METHOD_COUNTERS(res)    \
-  res = METHOD->method_counters();  \
-  if (res == NULL) {                \
-    CALL_VM(res = InterpreterRuntime::build_method_counters(THREAD, METHOD), handle_exception); \
-  }
-
-#define OSR_REQUEST(res, branch_pc) \
-            CALL_VM(res=InterpreterRuntime::frequency_counter_overflow(THREAD, branch_pc), handle_exception);
-/*
- * For those opcodes that need to have a GC point on a backwards branch
- */
-
-// Backedge counting is kind of strange. The asm interpreter will increment
-// the backedge counter as a separate counter but it does it's comparisons
-// to the sum (scaled) of invocation counter and backedge count to make
-// a decision. Seems kind of odd to sum them together like that
-
-// skip is delta from current bcp/bci for target, branch_pc is pre-branch bcp
-
-
-#define DO_BACKEDGE_CHECKS(skip, branch_pc)                                                         \
-    if ((skip) <= 0) {                                                                              \
-      MethodCounters* mcs;                                                                          \
-      GET_METHOD_COUNTERS(mcs);                                                                     \
-      if (UseLoopCounter) {                                                                         \
-        bool do_OSR = UseOnStackReplacement;                                                        \
-        mcs->backedge_counter()->increment();                                                       \
-        if (ProfileInterpreter) {                                                                   \
-          BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);                                   \
-          /* Check for overflow against MDO count. */                                               \
-          do_OSR = do_OSR                                                                           \
-            && (mdo_last_branch_taken_count >= (uint)InvocationCounter::InterpreterBackwardBranchLimit)\
-            /* When ProfileInterpreter is on, the backedge_count comes     */                       \
-            /* from the methodDataOop, which value does not get reset on   */                       \
-            /* the call to frequency_counter_overflow(). To avoid          */                       \
-            /* excessive calls to the overflow routine while the method is */                       \
-            /* being compiled, add a second test to make sure the overflow */                       \
-            /* function is called only once every overflow_frequency.      */                       \
-            && (!(mdo_last_branch_taken_count & 1023));                                             \
-        } else {                                                                                    \
-          /* check for overflow of backedge counter */                                              \
-          do_OSR = do_OSR                                                                           \
-            && mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter());         \
-        }                                                                                           \
-        if (do_OSR) {                                                                               \
-          nmethod* osr_nmethod;                                                                     \
-          OSR_REQUEST(osr_nmethod, branch_pc);                                                      \
-          if (osr_nmethod != NULL && osr_nmethod->is_in_use()) {                                    \
-            intptr_t* buf;                                                                          \
-            /* Call OSR migration with last java frame only, no checks. */                          \
-            CALL_VM_NAKED_LJF(buf=SharedRuntime::OSR_migration_begin(THREAD));                      \
-            istate->set_msg(do_osr);                                                                \
-            istate->set_osr_buf((address)buf);                                                      \
-            istate->set_osr_entry(osr_nmethod->osr_entry());                                        \
-            return;                                                                                 \
-          }                                                                                         \
-        }                                                                                           \
-      }  /* UseCompiler ... */                                                                      \
-      SAFEPOINT;                                                                                    \
-    }
+#define GET_METHOD_COUNTERS(res)
+#define DO_BACKEDGE_CHECKS(skip, branch_pc)
 
 /*
  * For those opcodes that need to have a GC point on a backwards branch
@@ -391,7 +330,7 @@
 #undef CHECK_NULL
 #define CHECK_NULL(obj_)                                                                         \
         if ((obj_) == NULL) {                                                                    \
-          VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), NULL, note_nullCheck_trap); \
+          VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), NULL);                      \
         }                                                                                        \
         VERIFY_OOP(obj_)
 
@@ -426,7 +365,7 @@
 // Call the VM. Don't check for pending exceptions.
 #define CALL_VM_NOCHECK(func)                                      \
         CALL_VM_NAKED_LJF(func)                                    \
-        if (THREAD->pop_frame_pending() &&                         \
+        if (THREAD->has_pending_popframe() &&                      \
             !THREAD->pop_frame_in_process()) {                     \
           goto handle_Pop_Frame;                                   \
         }                                                          \
@@ -607,12 +546,7 @@ BytecodeInterpreter::run(interpreterState istate) {
          topOfStack < istate->stack_base(),
          "Stack top out of range");
 
-#ifdef CC_INTERP_PROFILE
-  // MethodData's last branch taken count.
-  uint mdo_last_branch_taken_count = 0;
-#else
   const uint mdo_last_branch_taken_count = 0;
-#endif
 
   switch (istate->msg()) {
     case initialize: {
@@ -629,18 +563,6 @@ BytecodeInterpreter::run(interpreterState istate) {
       // count invocations
       assert(initialized, "Interpreter not initialized");
       if (_compiling) {
-        MethodCounters* mcs;
-        GET_METHOD_COUNTERS(mcs);
-#if COMPILER2_OR_JVMCI
-        if (ProfileInterpreter) {
-          METHOD->increment_interpreter_invocation_count(THREAD);
-        }
-#endif
-        mcs->invocation_counter()->increment();
-        if (mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter())) {
-          CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
-          // We no longer retry on a counter overflow.
-        }
         // Get or create profile data. Check for pending (async) exceptions.
         BI_PROFILE_GET_OR_CREATE_METHOD_DATA(handle_exception);
         SAFEPOINT;
@@ -783,7 +705,7 @@ BytecodeInterpreter::run(interpreterState istate) {
         os::breakpoint();
       }
       // returned from a java call, continue executing.
-      if (THREAD->pop_frame_pending() && !THREAD->pop_frame_in_process()) {
+      if (THREAD->has_pending_popframe() && !THREAD->pop_frame_in_process()) {
         goto handle_Pop_Frame;
       }
       if (THREAD->jvmti_thread_state() &&
@@ -1142,7 +1064,7 @@ BytecodeInterpreter::run(interpreterState istate) {
                   pc = istate->method()->code_base() + (intptr_t)(LOCALS_ADDR(reg));
                   UPDATE_PC_AND_CONTINUE(0);
               default:
-                  VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode", note_no_trap);
+                  VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode");
           }
       }
 
@@ -1223,7 +1145,7 @@ BytecodeInterpreter::run(interpreterState istate) {
       CASE(_i##opcname):                                                \
           if (test && (STACK_INT(-1) == 0)) {                           \
               VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
-                            "/ by zero", note_div0Check_trap);          \
+                            "/ by zero");                               \
           }                                                             \
           SET_STACK_INT(VMint##opname(STACK_INT(-2),                    \
                                       STACK_INT(-1)),                   \
@@ -1235,7 +1157,7 @@ BytecodeInterpreter::run(interpreterState istate) {
             jlong l1 = STACK_LONG(-1);                                  \
             if (VMlongEqz(l1)) {                                        \
               VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \
-                            "/ by long zero", note_div0Check_trap);     \
+                            "/ by long zero");                          \
             }                                                           \
           }                                                             \
           /* First long at (-1,-2) next long at (-3,-4) */              \
@@ -1647,7 +1569,7 @@ BytecodeInterpreter::run(interpreterState istate) {
       if ((uint32_t)index >= (uint32_t)arrObj->length()) {                     \
           sprintf(message, "%d", index);                                       \
           VM_JAVA_ERROR(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), \
-                        message, note_rangeCheck_trap);                        \
+                        message);                                              \
       }
 
       /* 32-bit loads. These handle conversion from < 32-bit types */
@@ -1730,7 +1652,7 @@ BytecodeInterpreter::run(interpreterState istate) {
             if (rhsKlass != elemKlass && !rhsKlass->is_subtype_of(elemKlass)) { // ebx->is...
               // Decrement counter if subtype check failed.
               BI_PROFILE_SUBTYPECHECK_FAILED(rhsKlass);
-              VM_JAVA_ERROR(vmSymbols::java_lang_ArrayStoreException(), "", note_arrayCheck_trap);
+              VM_JAVA_ERROR(vmSymbols::java_lang_ArrayStoreException(), "");
             }
             // Profile checkcast with null_seen and receiver.
             BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/false, rhsKlass);
@@ -2155,7 +2077,6 @@ BytecodeInterpreter::run(interpreterState istate) {
             // Disable non-TLAB-based fast-path, because profiling requires that all
             // allocations go through InterpreterRuntime::_new() if THREAD->tlab().allocate
             // returns NULL.
-#ifndef CC_INTERP_PROFILE
             if (result == NULL) {
               need_zero = true;
               // Try allocate in shared eden
@@ -2169,7 +2090,6 @@ BytecodeInterpreter::run(interpreterState istate) {
                 result = (oop) compare_to;
               }
             }
-#endif
             if (result != NULL) {
               // Initialize object (if nonzero size and need) and then the header
               if (need_zero ) {
@@ -2254,7 +2174,7 @@ BytecodeInterpreter::run(interpreterState istate) {
               ResourceMark rm(THREAD);
               char* message = SharedRuntime::generate_class_cast_message(
                 objKlass, klassOf);
-              VM_JAVA_ERROR(vmSymbols::java_lang_ClassCastException(), message, note_classCheck_trap);
+              VM_JAVA_ERROR(vmSymbols::java_lang_ClassCastException(), message);
             }
             // Profile checkcast with null_seen and receiver.
             BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/false, objKlass);
@@ -2556,7 +2476,7 @@ BytecodeInterpreter::run(interpreterState istate) {
             jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s",
               recv_klass->external_name(),
               resolved_klass->external_name());
-            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), buf, note_no_trap);
+            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
           }
           callee = cache->f2_as_vfinal_method();
         }
@@ -2598,7 +2518,7 @@ BytecodeInterpreter::run(interpreterState istate) {
           // interface, and wasn't the same as when the caller was
           // compiled.
           if (scan->interface_klass() == NULL) {
-            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
+            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "");
           }
         }
 
@@ -2904,7 +2824,7 @@ BytecodeInterpreter::run(interpreterState istate) {
     istate->set_msg(popping_frame);
     // Clear pending so while the pop is in process
     // we don't start another one if a call_vm is done.
-    THREAD->clr_pop_frame_pending();
+    THREAD->clear_popframe_condition();
     // Let interpreter (only) see the we're in the process of popping a frame
     THREAD->set_pop_frame_in_process();
 
@@ -3088,7 +3008,7 @@ BytecodeInterpreter::run(interpreterState istate) {
           oop rcvr = base->obj();
           if (rcvr == NULL) {
             if (!suppress_error) {
-              VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "", note_nullCheck_trap);
+              VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "");
               illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
               THREAD->clear_pending_exception();
             }
@@ -3488,9 +3408,6 @@ BytecodeInterpreter::print() {
   tty->print_cr("stack_base: " INTPTR_FORMAT, (uintptr_t) this->_stack_base);
   tty->print_cr("stack_limit: " INTPTR_FORMAT, (uintptr_t) this->_stack_limit);
   tty->print_cr("monitor_base: " INTPTR_FORMAT, (uintptr_t) this->_monitor_base);
-#if !defined(ZERO) && defined(PPC)
-  tty->print_cr("last_Java_fp: " INTPTR_FORMAT, (uintptr_t) this->_last_Java_fp);
-#endif // !ZERO
   tty->print_cr("self_link: " INTPTR_FORMAT, (uintptr_t) this->_self_link);
 }
 
@@ -3502,4 +3419,3 @@ extern "C" {
 #endif // PRODUCT
 
 #endif // JVMTI
-#endif // CC_INTERP
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreter.hpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.hpp
similarity index 98%
rename from src/hotspot/share/interpreter/bytecodeInterpreter.hpp
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreter.hpp
index d8547415074..2d6f86c1f4f 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreter.hpp
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -34,8 +34,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
-#ifdef CC_INTERP
-
 // JavaStack Implementation
 #define MORE_STACK(count)  \
     (topOfStack -= ((count) * Interpreter::stackElementWords))
@@ -79,7 +77,7 @@ union frame_manager_message {
 class BytecodeInterpreter : StackObj {
 friend class SharedRuntime;
 friend class AbstractInterpreterGenerator;
-friend class CppInterpreterGenerator;
+friend class ZeroInterpreterGenerator;
 friend class InterpreterMacroAssembler;
 friend class frame;
 friend class VMStructs;
@@ -573,15 +571,8 @@ static const char* C_msg(BytecodeInterpreter::messages msg);
 void print();
 #endif // PRODUCT
 
-#ifdef ZERO
 # include "bytecodeInterpreter_zero.hpp"
-#else
-#error "Only Zero Bytecode Interpreter is supported"
-#endif
-
 
 }; // BytecodeInterpreter
 
-#endif // CC_INTERP
-
 #endif // SHARE_INTERPRETER_BYTECODEINTERPRETER_HPP
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreter.inline.hpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.inline.hpp
similarity index 87%
rename from src/hotspot/share/interpreter/bytecodeInterpreter.inline.hpp
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreter.inline.hpp
index 902987faddd..07c87708ba1 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreter.inline.hpp
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,12 @@
 #ifndef SHARE_INTERPRETER_BYTECODEINTERPRETER_INLINE_HPP
 #define SHARE_INTERPRETER_BYTECODEINTERPRETER_INLINE_HPP
 
-#include "interpreter/bytecodeInterpreter.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "utilities/macros.hpp"
 
 // This file holds platform-independent bodies of inline functions for the C++ based interpreter
 
-#ifdef CC_INTERP
-
 #ifdef ASSERT
 #define VERIFY_OOP(o_) \
       if (VerifyOops) { \
@@ -43,12 +41,6 @@
 #define VERIFY_OOP(o)
 #endif
 
-#ifdef ZERO
 # include "bytecodeInterpreter_zero.inline.hpp"
-#else
-#error "Only Zero Bytecode Interpreter is supported"
-#endif
-
-#endif // CC_INTERP
 
 #endif // SHARE_INTERPRETER_BYTECODEINTERPRETER_INLINE_HPP
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreterProfiling.hpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreterProfiling.hpp
similarity index 95%
rename from src/hotspot/share/interpreter/bytecodeInterpreterProfiling.hpp
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreterProfiling.hpp
index 469a15096df..49e8d4756fd 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreterProfiling.hpp
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreterProfiling.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,8 +30,6 @@
 #ifndef SHARE_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
 #define SHARE_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
 
-#ifdef CC_INTERP
-
 // Empty dummy implementations if profiling code is switched off. //////////////
 
 #define SET_MDX(mdx)
@@ -54,6 +52,4 @@
 #define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)
 #define BI_PROFILE_UPDATE_SWITCH(switch_index)
 
-#endif // CC_INTERP
-
 #endif // SHARE_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xml b/src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xml
similarity index 94%
rename from src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xml
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xml
index 6a3f6e4b5e5..8cbf66593c7 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xml
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 <!-- 
-     Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+     Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
      DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
      This code is free software; you can redistribute it and/or modify it
diff --git a/src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xsl b/src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xsl
similarity index 92%
rename from src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xsl
rename to src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xsl
index 824cd917762..14546dfc9a3 100644
--- a/src/hotspot/share/interpreter/bytecodeInterpreterWithChecks.xsl
+++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreterWithChecks.xsl
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 <!-- 
-     Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+     Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
      DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
      This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 <xsl:template match="processcode">
 <xsl:text>
 #define VM_JVMTI
-#include "interpreter/bytecodeInterpreter.cpp"
+#include "interpreter/zero/bytecodeInterpreter.cpp"
 </xsl:text>
 <xsl:text disable-output-escaping = "yes">
 
diff --git a/src/hotspot/share/interpreter/cppInterpreter.hpp b/src/hotspot/share/interpreter/zero/zeroInterpreter.hpp
similarity index 75%
rename from src/hotspot/share/interpreter/cppInterpreter.hpp
rename to src/hotspot/share/interpreter/zero/zeroInterpreter.hpp
index 95f89c192dd..2eaec1c2d86 100644
--- a/src/hotspot/share/interpreter/cppInterpreter.hpp
+++ b/src/hotspot/share/interpreter/zero/zeroInterpreter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,20 +22,20 @@
  *
  */
 
-#ifndef SHARE_INTERPRETER_CPPINTERPRETER_HPP
-#define SHARE_INTERPRETER_CPPINTERPRETER_HPP
+#ifndef SHARE_INTERPRETER_ZEROINTERPRETER_HPP
+#define SHARE_INTERPRETER_ZEROINTERPRETER_HPP
 
 #include "interpreter/abstractInterpreter.hpp"
 #include "utilities/macros.hpp"
 
-#ifdef CC_INTERP
+#ifdef ZERO
 
 class InterpreterCodelet;
 
 // This file contains the platform-independent parts
 // of the c++ interpreter
 
-class CppInterpreter: public AbstractInterpreter {
+class ZeroInterpreter: public AbstractInterpreter {
   friend class VMStructs;
  public:
   // Initialization/debugging
@@ -58,17 +58,23 @@ class CppInterpreter: public AbstractInterpreter {
   static address    return_entry  (TosState state, int length, Bytecodes::Code code);
   static address    deopt_entry   (TosState state, int length);
 
+  static address    remove_activation_entry() { return (address)-1; }
+  static address    remove_activation_early_entry(TosState state);
+  static address    remove_activation_preserving_args_entry();
+
   static void invoke_method(Method* method, address entry_point, TRAPS);
   static void invoke_osr(Method* method,
                          address   entry_point,
                          address   osr_buf,
                          TRAPS);
-#ifdef ZERO
-# include "cppInterpreter_zero.hpp"
-#endif
 
+  static address throw_NullPointerException_entry() { return NULL; }
+  static address throw_ArithmeticException_entry()  { return NULL; }
+  static address throw_StackOverflowError_entry()   { return NULL; }
+
+# include "zeroInterpreter_zero.hpp"
 };
 
-#endif // CC_INTERP
+#endif // ZERO
 
-#endif // SHARE_INTERPRETER_CPPINTERPRETER_HPP
+#endif // SHARE_INTERPRETER_ZEROINTERPRETER_HPP
diff --git a/src/hotspot/share/interpreter/cppInterpreterGenerator.cpp b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp
similarity index 67%
rename from src/hotspot/share/interpreter/cppInterpreterGenerator.cpp
rename to src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp
index 4c8df9d8cdd..6959504fb01 100644
--- a/src/hotspot/share/interpreter/cppInterpreterGenerator.cpp
+++ b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +24,21 @@
  */
 
 #include "precompiled.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/cppInterpreterGenerator.hpp"
+#include "asm/assembler.hpp"
+#include "interpreter/bytecodeHistogram.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/zero/bytecodeInterpreter.hpp"
+#include "interpreter/zero/zeroInterpreter.hpp"
+#include "oops/method.hpp"
+#include "runtime/arguments.hpp"
+#include "zeroInterpreterGenerator.hpp"
 
-#ifdef CC_INTERP
-
-CppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
+ZeroInterpreterGenerator::ZeroInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
   generate_all();
 }
 
-void CppInterpreterGenerator::generate_all() {
+void ZeroInterpreterGenerator::generate_all() {
   { CodeletMark cm(_masm, "slow signature handler");
     AbstractInterpreter::_slow_signature_handler = generate_slow_signature_handler();
   }
@@ -73,7 +77,7 @@ void CppInterpreterGenerator::generate_all() {
 }
 
 // Generate method entries
-address CppInterpreterGenerator::generate_method_entry(
+address ZeroInterpreterGenerator::generate_method_entry(
                                         AbstractInterpreter::MethodKind kind) {
   // determine code generation flags
   bool native = false;
@@ -126,4 +130,63 @@ address CppInterpreterGenerator::generate_method_entry(
 
   return entry_point;
 }
-#endif // CC_INTERP
+
+address ZeroInterpreterGenerator::generate_slow_signature_handler() {
+  _masm->advance(1);
+  return (address) InterpreterRuntime::slow_signature_handler;
+}
+
+address ZeroInterpreterGenerator::generate_math_entry(
+    AbstractInterpreter::MethodKind kind) {
+  if (!InlineIntrinsics)
+    return NULL;
+
+  Unimplemented();
+  return NULL;
+}
+
+address ZeroInterpreterGenerator::generate_abstract_entry() {
+  return generate_entry((address) ShouldNotCallThisEntry());
+}
+
+address ZeroInterpreterGenerator::generate_empty_entry() {
+  if (!UseFastEmptyMethods)
+    return NULL;
+
+  return generate_entry((address) ZeroInterpreter::empty_entry);
+}
+
+address ZeroInterpreterGenerator::generate_accessor_entry() {
+  if (!UseFastAccessorMethods)
+    return NULL;
+
+  return generate_entry((address) ZeroInterpreter::accessor_entry);
+}
+
+address ZeroInterpreterGenerator::generate_Reference_get_entry(void) {
+#if INCLUDE_G1GC
+  if (UseG1GC) {
+    // We need to generate have a routine that generates code to:
+    //   * load the value in the referent field
+    //   * passes that value to the pre-barrier.
+    //
+    // In the case of G1 this will record the value of the
+    // referent in an SATB buffer if marking is active.
+    // This will cause concurrent marking to mark the referent
+    // field as live.
+    Unimplemented();
+  }
+#endif // INCLUDE_G1GC
+
+  // If G1 is not enabled then attempt to go through the normal entry point
+  // Reference.get could be instrumented by jvmti
+  return NULL;
+}
+
+address ZeroInterpreterGenerator::generate_native_entry(bool synchronized) {
+  return generate_entry((address) ZeroInterpreter::native_entry);
+}
+
+address ZeroInterpreterGenerator::generate_normal_entry(bool synchronized) {
+  return generate_entry((address) ZeroInterpreter::normal_entry);
+}
diff --git a/src/hotspot/share/interpreter/cppInterpreterGenerator.hpp b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.hpp
similarity index 86%
rename from src/hotspot/share/interpreter/cppInterpreterGenerator.hpp
rename to src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.hpp
index 558cf90a245..9bc428e8019 100644
--- a/src/hotspot/share/interpreter/cppInterpreterGenerator.hpp
+++ b/src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,12 @@
 #define SHARE_INTERPRETER_CPPINTERPRETERGENERATOR_HPP
 
 // This file contains the platform-independent parts
-// of the template interpreter generator.
+// of the Zero interpreter generator.
 
-#ifdef CC_INTERP
-#ifdef ZERO
 # include "entry_zero.hpp"
-# include "interpreter/interp_masm.hpp"
-#endif
+// # include "interpreter/interp_masm.hpp"
 
-class CppInterpreterGenerator: public AbstractInterpreterGenerator {
+class ZeroInterpreterGenerator: public AbstractInterpreterGenerator {
 
  private:
   void generate_all();
@@ -51,9 +48,8 @@ class CppInterpreterGenerator: public AbstractInterpreterGenerator {
   address generate_Reference_get_entry();
 
  public:
-  CppInterpreterGenerator(StubQueue* _code);
+  ZeroInterpreterGenerator(StubQueue* _code);
 
-#ifdef ZERO
  protected:
   MacroAssembler* assembler() const {
     return _masm;
@@ -71,8 +67,6 @@ class CppInterpreterGenerator: public AbstractInterpreterGenerator {
   address generate_entry(address entry_point) {
     return generate_entry_impl(assembler(), entry_point);
   }
-#endif // ZERO
 };
 
-#endif // CC_INTERP
 #endif // SHARE_INTERPRETER_CPPINTERPRETERGENERATOR_HPP
diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp
index d36d9d73b2c..9c606df6c24 100644
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp
@@ -427,34 +427,26 @@ void JfrCheckpointManager::on_unloading_classes() {
   }
 }
 
-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);
diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
index db3c8f5ce3f..1792602489c 100644
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
@@ -761,6 +761,7 @@ int write__method(JfrCheckpointWriter* writer, const void* m) {
 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);
 }
 
diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp
index 9ea39ae0ff7..138a85ed005 100644
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp
@@ -170,6 +170,13 @@ void JfrTraceId::remove(const Klass* k) {
   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");
diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp
index 9110f7d5554..2a67e57de8a 100644
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp
@@ -106,6 +106,7 @@ class JfrTraceId : public AllStatic {
   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
diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp
index b25500afc70..14b008b1d51 100644
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp
@@ -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))
diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
index 22b0955e15c..96f89648acd 100644
--- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
+++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp
@@ -172,8 +172,8 @@ static void log_jdk_jfr_module_resolution_error(TRAPS) {
 }
 
 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_2() {
 
 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;
diff --git a/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp b/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
index 98cac9e35c0..f21e9fdd37d 100644
--- a/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
+++ b/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
@@ -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 {
diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
index 01b09819999..d6322babbec 100644
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
@@ -1025,7 +1025,7 @@ C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject
   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 @@ C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject
 
   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_VMENTRY(void, ensureInitialized, (JNIEnv* env, jobject, jobject jvmci_type))
   }
 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 @@ JNINativeMethod CompilerToVM::methods[] = {
   {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)},
diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp
index 91fe38c9efa..c94d0a444b5 100644
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp
@@ -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)                        \
diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp
index 808d857b1bd..c53613cc781 100644
--- a/src/hotspot/share/memory/filemap.cpp
+++ b/src/hotspot/share/memory/filemap.cpp
@@ -252,6 +252,7 @@ void SharedClassPathEntry::init_as_non_existent(const char* path, TRAPS) {
 }
 
 void SharedClassPathEntry::init(bool is_modules_image,
+                                bool is_module_path,
                                 ClassPathEntry* cpe, TRAPS) {
   Arguments::assert_is_dumping_archive();
   _timestamp = 0;
@@ -272,6 +273,7 @@ void SharedClassPathEntry::init(bool is_modules_image,
         _from_class_path_attr = cpe->from_class_path_attr();
       }
       _filesize = st.st_size;
+      _is_module_path = is_module_path;
     }
   } else {
     // The file/dir must exist, or it would not have been added
@@ -296,6 +298,7 @@ void SharedClassPathEntry::set_name(const char* name, TRAPS) {
 
 void SharedClassPathEntry::copy_from(SharedClassPathEntry* ent, ClassLoaderData* loader_data, TRAPS) {
   _type = ent->_type;
+  _is_module_path = ent->_is_module_path;
   _timestamp = ent->_timestamp;
   _filesize = ent->_filesize;
   _from_class_path_attr = ent->_from_class_path_attr;
@@ -450,10 +453,11 @@ void FileMapInfo::allocate_shared_path_table() {
 int FileMapInfo::add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS) {
   while (cpe != NULL) {
     bool is_jrt = (cpe == ClassLoader::get_jrt_entry());
+    bool is_module_path = i >= ClassLoaderExt::app_module_paths_start_index();
     const char* type = (is_jrt ? "jrt" : (cpe->is_jar_file() ? "jar" : "dir"));
     log_info(class, path)("add %s shared path (%s) %s", which, type, cpe->name());
     SharedClassPathEntry* ent = shared_path(i);
-    ent->init(is_jrt, cpe, THREAD);
+    ent->init(is_jrt, is_module_path, cpe, THREAD);
     if (cpe->is_jar_file()) {
       update_jar_manifest(cpe, ent, THREAD);
     }
@@ -513,6 +517,38 @@ int FileMapInfo::num_non_existent_class_paths() {
   }
 }
 
+int FileMapInfo::get_module_shared_path_index(Symbol* location) {
+  if (location->starts_with("jrt:", 4) && get_number_of_shared_paths() > 0) {
+    assert(shared_path(0)->is_modules_image(), "first shared_path must be the modules image");
+    return 0;
+  }
+
+  if (ClassLoaderExt::app_module_paths_start_index() >= get_number_of_shared_paths()) {
+    // The archive(s) were created without --module-path option
+    return -1;
+  }
+
+  if (!location->starts_with("file:", 5)) {
+    return -1;
+  }
+
+  // skip_uri_protocol was also called during dump time -- see ClassLoaderExt::process_module_table()
+  ResourceMark rm;
+  const char* file = ClassLoader::skip_uri_protocol(location->as_C_string());
+  for (int i = ClassLoaderExt::app_module_paths_start_index(); i < get_number_of_shared_paths(); i++) {
+    SharedClassPathEntry* ent = shared_path(i);
+    assert(ent->in_named_module(), "must be");
+    bool cond = strcmp(file, ent->name()) == 0;
+    log_debug(class, path)("get_module_shared_path_index (%d) %s : %s = %s", i,
+                           location->as_C_string(), ent->name(), cond ? "same" : "different");
+    if (cond) {
+      return i;
+    }
+  }
+
+  return -1;
+}
+
 class ManifestStream: public ResourceObj {
   private:
   u1*   _buffer_start; // Buffer bottom
diff --git a/src/hotspot/share/memory/filemap.hpp b/src/hotspot/share/memory/filemap.hpp
index e1957aadc53..0c3764c33f4 100644
--- a/src/hotspot/share/memory/filemap.hpp
+++ b/src/hotspot/share/memory/filemap.hpp
@@ -58,6 +58,7 @@ class SharedClassPathEntry {
   void set_name(const char* name, TRAPS);
 
   u1     _type;
+  bool   _is_module_path;
   bool   _from_class_path_attr;
   time_t _timestamp;          // jar timestamp,  0 if is directory, modules image or other
   long   _filesize;           // jar/jimage file size, -1 if is directory, -2 if other
@@ -65,7 +66,7 @@ class SharedClassPathEntry {
   Array<u1>*   _manifest;
 
 public:
-  void init(bool is_modules_image, ClassPathEntry* cpe, TRAPS);
+  void init(bool is_modules_image, bool is_module_path, ClassPathEntry* cpe, TRAPS);
   void init_as_non_existent(const char* path, TRAPS);
   void metaspace_pointers_do(MetaspaceClosure* it);
   bool validate(bool is_class_path = true) const;
@@ -96,6 +97,10 @@ class SharedClassPathEntry {
   }
   bool check_non_existent() const;
   void copy_from(SharedClassPathEntry* ent, ClassLoaderData* loader_data, TRAPS);
+  bool in_named_module() {
+    return is_modules_image() || // modules image doesn't contain unnamed modules
+           _is_module_path;      // module path doesn't contain unnamed modules
+  }
 };
 
 struct ArchiveHeapOopmapInfo {
@@ -522,6 +527,8 @@ class FileMapInfo : public CHeapObj<mtInternal> {
     return _shared_path_table.size();
   }
 
+  static int get_module_shared_path_index(Symbol* location) NOT_CDS_RETURN_(-1);
+
   char* region_addr(int idx);
 
   // The offset of the first core region in the archive, relative to SharedBaseAddress
diff --git a/src/hotspot/share/memory/iterator.hpp b/src/hotspot/share/memory/iterator.hpp
index 520acf30d0f..df351f1fd94 100644
--- a/src/hotspot/share/memory/iterator.hpp
+++ b/src/hotspot/share/memory/iterator.hpp
@@ -347,6 +347,12 @@ class SymbolClosure : public StackObj {
   }
 };
 
+template <typename E>
+class CompareClosure : public Closure {
+public:
+    virtual int do_compare(const E&, const E&) = 0;
+};
+
 // Dispatches to the non-virtual functions if OopClosureType has
 // a concrete implementation, otherwise a virtual call is taken.
 class Devirtualizer {
diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp
index 135979d5d9a..0d2f2f30685 100644
--- a/src/hotspot/share/memory/metaspaceShared.cpp
+++ b/src/hotspot/share/memory/metaspaceShared.cpp
@@ -456,10 +456,10 @@ void MetaspaceShared::post_initialize(TRAPS) {
   }
 }
 
-static GrowableArray<Handle>* _extra_interned_strings = NULL;
+static GrowableArrayCHeap<Handle, mtClassShared>* _extra_interned_strings = NULL;
 
 void MetaspaceShared::read_extra_data(const char* filename, TRAPS) {
-  _extra_interned_strings = new (ResourceObj::C_HEAP, mtClassShared) GrowableArray<Handle>(10000, mtClassShared);
+  _extra_interned_strings = new GrowableArrayCHeap<Handle, mtClassShared>(10000);
 
   HashtableTextDump reader(filename);
   reader.check_version("VERSION: 1.0");
@@ -663,6 +663,33 @@ class CollectClassesClosure : public KlassClosure {
   }
 };
 
+// Global object for holding symbols that created during class loading. See SymbolTable::new_symbol
+static GrowableArray<Symbol*>* _global_symbol_objects = NULL;
+
+static int compare_symbols_by_address(Symbol** a, Symbol** b) {
+  if (a[0] < b[0]) {
+    return -1;
+  } else if (a[0] == b[0]) {
+    ResourceMark rm;
+    log_warning(cds)("Duplicated symbol %s unexpected", (*a)->as_C_string());
+    return 0;
+  } else {
+    return 1;
+  }
+}
+
+void MetaspaceShared::add_symbol(Symbol* sym) {
+  MutexLocker ml(CDSAddSymbol_lock, Mutex::_no_safepoint_check_flag);
+  if (_global_symbol_objects == NULL) {
+    _global_symbol_objects = new (ResourceObj::C_HEAP, mtSymbol) GrowableArray<Symbol*>(2048, mtSymbol);
+  }
+  _global_symbol_objects->append(sym);
+}
+
+GrowableArray<Symbol*>* MetaspaceShared::collected_symbols() {
+  return _global_symbol_objects;
+}
+
 static void remove_unshareable_in_classes() {
   for (int i = 0; i < _global_klass_objects->length(); i++) {
     Klass* k = _global_klass_objects->at(i);
@@ -1238,34 +1265,6 @@ class VM_PopulateDumpSharedSpace: public VM_Operation {
   bool allow_nested_vm_operations() const { return true; }
 }; // class VM_PopulateDumpSharedSpace
 
-class SortedSymbolClosure: public SymbolClosure {
-  GrowableArray<Symbol*> _symbols;
-  virtual void do_symbol(Symbol** sym) {
-    assert((*sym)->is_permanent(), "archived symbols must be permanent");
-    _symbols.append(*sym);
-  }
-  static int compare_symbols_by_address(Symbol** a, Symbol** b) {
-    if (a[0] < b[0]) {
-      return -1;
-    } else if (a[0] == b[0]) {
-      ResourceMark rm;
-      log_warning(cds)("Duplicated symbol %s unexpected", (*a)->as_C_string());
-      return 0;
-    } else {
-      return 1;
-    }
-  }
-
-public:
-  SortedSymbolClosure() {
-    SymbolTable::symbols_do(this);
-    _symbols.sort(compare_symbols_by_address);
-  }
-  GrowableArray<Symbol*>* get_sorted_symbols() {
-    return &_symbols;
-  }
-};
-
 // ArchiveCompactor --
 //
 // This class is the central piece of shared archive compaction -- all metaspace data are
@@ -1277,7 +1276,6 @@ class ArchiveCompactor : AllStatic {
   static const int MAX_TABLE_SIZE     = 1000000;
 
   static DumpAllocStats* _alloc_stats;
-  static SortedSymbolClosure* _ssc;
 
   typedef KVHashtable<address, address, mtInternal> RelocationTable;
   static RelocationTable* _new_loc_table;
@@ -1421,8 +1419,6 @@ class ArchiveCompactor : AllStatic {
 public:
   static void copy_and_compact() {
     ResourceMark rm;
-    SortedSymbolClosure the_ssc; // StackObj
-    _ssc = &the_ssc;
 
     log_info(cds)("Scanning all metaspace objects ... ");
     {
@@ -1458,9 +1454,11 @@ class ArchiveCompactor : AllStatic {
     {
       log_info(cds)("Fixing symbol identity hash ... ");
       os::init_random(0x12345678);
-      GrowableArray<Symbol*>* symbols = _ssc->get_sorted_symbols();
-      for (int i=0; i<symbols->length(); i++) {
-        symbols->at(i)->update_identity_hash();
+      GrowableArray<Symbol*>* all_symbols = MetaspaceShared::collected_symbols();
+      all_symbols->sort(compare_symbols_by_address);
+      for (int i = 0; i < all_symbols->length(); i++) {
+        assert(all_symbols->at(i)->is_permanent(), "archived symbols must be permanent");
+        all_symbols->at(i)->update_identity_hash();
       }
     }
 #ifdef ASSERT
@@ -1471,10 +1469,6 @@ class ArchiveCompactor : AllStatic {
       iterate_roots(&checker);
     }
 #endif
-
-
-    // cleanup
-    _ssc = NULL;
   }
 
   // We must relocate the System::_well_known_klasses only after we have copied the
@@ -1510,8 +1504,8 @@ class ArchiveCompactor : AllStatic {
     // (see Symbol::operator new(size_t, int)). So if we iterate the Symbols by
     // ascending address order, we ensure that all Symbols are copied into deterministic
     // locations in the archive.
-    GrowableArray<Symbol*>* symbols = _ssc->get_sorted_symbols();
-    for (int i=0; i<symbols->length(); i++) {
+    GrowableArray<Symbol*>* symbols = _global_symbol_objects;
+    for (int i = 0; i < symbols->length(); i++) {
       it->push(symbols->adr_at(i));
     }
     if (_global_klass_objects != NULL) {
@@ -1541,7 +1535,6 @@ class ArchiveCompactor : AllStatic {
 };
 
 DumpAllocStats* ArchiveCompactor::_alloc_stats;
-SortedSymbolClosure* ArchiveCompactor::_ssc;
 ArchiveCompactor::RelocationTable* ArchiveCompactor::_new_loc_table;
 
 void VM_PopulateDumpSharedSpace::dump_symbols() {
diff --git a/src/hotspot/share/memory/metaspaceShared.hpp b/src/hotspot/share/memory/metaspaceShared.hpp
index 326522c4ae0..15efa49e947 100644
--- a/src/hotspot/share/memory/metaspaceShared.hpp
+++ b/src/hotspot/share/memory/metaspaceShared.hpp
@@ -213,6 +213,8 @@ class MetaspaceShared : AllStatic {
                              TRAPS) NOT_CDS_RETURN_(0);
 
   static GrowableArray<Klass*>* collected_klasses();
+  static GrowableArray<Symbol*>* collected_symbols();
+  static void add_symbol(Symbol* sym) NOT_CDS_RETURN;
 
   static ReservedSpace* shared_rs() {
     CDS_ONLY(return &_shared_rs);
diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp
index 8e256305fd9..3d8ade5496c 100644
--- a/src/hotspot/share/oops/method.cpp
+++ b/src/hotspot/share/oops/method.cpp
@@ -357,6 +357,7 @@ void Method::metaspace_pointers_do(MetaspaceClosure* it) {
 
 void Method::remove_unshareable_info() {
   unlink_method();
+  JFR_ONLY(REMOVE_METHOD_ID(this);)
 }
 
 void Method::set_vtable_index(int index) {
diff --git a/src/hotspot/share/oops/oopHandle.hpp b/src/hotspot/share/oops/oopHandle.hpp
index 31472458596..31a2ba74592 100644
--- a/src/hotspot/share/oops/oopHandle.hpp
+++ b/src/hotspot/share/oops/oopHandle.hpp
@@ -25,7 +25,9 @@
 #ifndef SHARE_OOPS_OOPHANDLE_HPP
 #define SHARE_OOPS_OOPHANDLE_HPP
 
-#include "oops/oop.hpp"
+#include "oops/oopsHierarchy.hpp"
+
+class OopStorage;
 
 // Simple class for encapsulating oop pointers stored in metadata.
 // These are different from Handle.  The Handle class stores pointers
@@ -43,13 +45,12 @@ class OopHandle {
 public:
   OopHandle() : _obj(NULL) {}
   explicit OopHandle(oop* w) : _obj(w) {}
-
-  inline static OopHandle create(oop obj);
+  OopHandle(OopStorage* storage, oop obj);
 
   inline oop resolve() const;
   inline oop peek() const;
 
-  inline void release();
+  inline void release(OopStorage* storage);
 
   // Used only for removing handle.
   oop* ptr_raw() const { return _obj; }
diff --git a/src/hotspot/share/oops/oopHandle.inline.hpp b/src/hotspot/share/oops/oopHandle.inline.hpp
index aa812fce75d..d42796170b8 100644
--- a/src/hotspot/share/oops/oopHandle.inline.hpp
+++ b/src/hotspot/share/oops/oopHandle.inline.hpp
@@ -28,7 +28,6 @@
 #include "oops/access.inline.hpp"
 #include "oops/oopHandle.hpp"
 #include "gc/shared/oopStorage.inline.hpp"
-#include "gc/shared/oopStorageSet.hpp"
 
 inline oop OopHandle::resolve() const {
   return (_obj == NULL) ? (oop)NULL : NativeAccess<>::oop_load(_obj);
@@ -38,21 +37,19 @@ inline oop OopHandle::peek() const {
   return (_obj == NULL) ? (oop)NULL : NativeAccess<AS_NO_KEEPALIVE>::oop_load(_obj);
 }
 
-// Allocate a global handle and return
-inline OopHandle OopHandle::create(oop obj) {
-  oop* handle = OopStorageSet::vm_global()->allocate();
-  if (handle == NULL) {
+inline OopHandle::OopHandle(OopStorage* storage, oop obj) :
+    _obj(storage->allocate()) {
+  if (_obj == NULL) {
     vm_exit_out_of_memory(sizeof(oop), OOM_MALLOC_ERROR,
                           "Cannot create oop handle");
   }
-  NativeAccess<>::oop_store(handle, obj);
-  return OopHandle(handle);
+  NativeAccess<>::oop_store(_obj, obj);
 }
 
-inline void OopHandle::release() {
+inline void OopHandle::release(OopStorage* storage) {
   // Clear the OopHandle first
   NativeAccess<>::oop_store(_obj, (oop)NULL);
-  OopStorageSet::vm_global()->release(_obj);
+  storage->release(_obj);
 }
 
 #endif // SHARE_OOPS_OOPHANDLE_INLINE_HPP
diff --git a/src/hotspot/share/oops/weakHandle.cpp b/src/hotspot/share/oops/weakHandle.cpp
index 9eb9d185929..5975c6ca978 100644
--- a/src/hotspot/share/oops/weakHandle.cpp
+++ b/src/hotspot/share/oops/weakHandle.cpp
@@ -31,52 +31,31 @@
 #include "utilities/debug.hpp"
 #include "utilities/ostream.hpp"
 
-template <> OopStorage* WeakHandle<vm_weak_data>::get_storage() {
-  return OopStorageSet::vm_weak();
-}
-
-template <> OopStorage* WeakHandle<vm_string_table_data>::get_storage() {
-  return OopStorageSet::string_table_weak();
-}
-
-template <> OopStorage* WeakHandle<vm_resolved_method_table_data>::get_storage() {
-  return OopStorageSet::resolved_method_table_weak();
-}
-
-template <WeakHandleType T>
-WeakHandle<T> WeakHandle<T>::create(Handle obj) {
+WeakHandle::WeakHandle(OopStorage* storage, Handle obj) :
+    _obj(storage->allocate()) {
   assert(obj() != NULL, "no need to create weak null oop");
-  oop* oop_addr = get_storage()->allocate();
-  if (oop_addr == NULL) {
+
+  if (_obj == NULL) {
     vm_exit_out_of_memory(sizeof(oop*), OOM_MALLOC_ERROR,
                           "Unable to create new weak oop handle in OopStorage %s",
-                          get_storage()->name());
+                          storage->name());
   }
-  // Create WeakHandle with address returned and store oop into it.
-  NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(oop_addr, obj());
-  return WeakHandle(oop_addr);
+
+  NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, obj());
 }
 
-template <WeakHandleType T>
-void WeakHandle<T>::release() const {
+void WeakHandle::release(OopStorage* storage) const {
   // Only release if the pointer to the object has been created.
   if (_obj != NULL) {
     // Clear the WeakHandle.  For race in creating ClassLoaderData, we can release this
     // WeakHandle before it is cleared by GC.
     NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, (oop)NULL);
-    get_storage()->release(_obj);
+    storage->release(_obj);
   }
 }
 
-template <WeakHandleType T>
-void WeakHandle<T>::print() const { print_on(tty); }
+void WeakHandle::print() const { print_on(tty); }
 
-template <WeakHandleType T>
-void WeakHandle<T>::print_on(outputStream* st) const {
+void WeakHandle::print_on(outputStream* st) const {
   st->print("WeakHandle: " PTR_FORMAT, p2i(peek()));
 }
-
-// Provide instantiation.
-template class WeakHandle<vm_weak_data>;
-template class WeakHandle<vm_string_table_data>;
-template class WeakHandle<vm_resolved_method_table_data>;
diff --git a/src/hotspot/share/oops/weakHandle.hpp b/src/hotspot/share/oops/weakHandle.hpp
index 458493371b6..59525adb665 100644
--- a/src/hotspot/share/oops/weakHandle.hpp
+++ b/src/hotspot/share/oops/weakHandle.hpp
@@ -39,27 +39,19 @@ class OopStorage;
 // This is the vm version of jweak but has different GC lifetimes and policies,
 // depending on the type.
 
-enum WeakHandleType {
-  vm_weak_data,
-  vm_string_table_data,
-  vm_resolved_method_table_data
-};
-
-template <WeakHandleType T>
 class WeakHandle {
  public:
  private:
   oop* _obj;
 
   WeakHandle(oop* w) : _obj(w) {}
-  static OopStorage* get_storage();
  public:
   WeakHandle() : _obj(NULL) {} // needed for init
+  WeakHandle(OopStorage* storage, Handle obj);
 
-  static WeakHandle create(Handle obj);
   inline oop resolve() const;
   inline oop peek() const;
-  void release() const;
+  void release(OopStorage* storage) const;
   bool is_null() const { return _obj == NULL; }
 
   void replace(oop with_obj);
diff --git a/src/hotspot/share/oops/weakHandle.inline.hpp b/src/hotspot/share/oops/weakHandle.inline.hpp
index a750296256e..217d70deae2 100644
--- a/src/hotspot/share/oops/weakHandle.inline.hpp
+++ b/src/hotspot/share/oops/weakHandle.inline.hpp
@@ -28,20 +28,17 @@
 #include "oops/weakHandle.hpp"
 #include "oops/access.inline.hpp"
 
-template <WeakHandleType T>
-oop WeakHandle<T>::resolve() const {
+inline oop WeakHandle::resolve() const {
   assert(!is_null(), "Must be created");
   return NativeAccess<ON_PHANTOM_OOP_REF>::oop_load(_obj);
 }
 
-template <WeakHandleType T>
-oop WeakHandle<T>::peek() const {
+inline oop WeakHandle::peek() const {
   assert(!is_null(), "Must be created");
   return NativeAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(_obj);
 }
 
-template <WeakHandleType T>
-void WeakHandle<T>::replace(oop with_obj) {
+inline void WeakHandle::replace(oop with_obj) {
   NativeAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, with_obj);
 }
 
diff --git a/src/hotspot/share/opto/convertnode.cpp b/src/hotspot/share/opto/convertnode.cpp
index cf2af1f40f3..20de89a0d98 100644
--- a/src/hotspot/share/opto/convertnode.cpp
+++ b/src/hotspot/share/opto/convertnode.cpp
@@ -334,6 +334,13 @@ Node *ConvI2LNode::Ideal(PhaseGVN *phase, bool can_reshape) {
   Node* z = in(1);
   int op = z->Opcode();
   if (op == Op_AddI || op == Op_SubI) {
+    if (!can_reshape) {
+      // Postpone this optimization to after parsing because with deep AddNode
+      // chains a large amount of dead ConvI2L nodes might be created that are
+      // not removed during parsing. As a result, we might hit the node limit.
+      phase->record_for_igvn(this);
+      return this_changed;
+    }
     Node* x = z->in(1);
     Node* y = z->in(2);
     assert (x != z && y != z, "dead loop in ConvI2LNode::Ideal");
diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp
index 65460463509..87ac8964c54 100644
--- a/src/hotspot/share/opto/library_call.cpp
+++ b/src/hotspot/share/opto/library_call.cpp
@@ -6522,21 +6522,21 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
 
   switch (predicate) {
   case 0:
-    if (UseSHA1Intrinsics) {
+    if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_sha_implCompress)) {
       klass_SHA_name = "sun/security/provider/SHA";
       stub_name = "sha1_implCompressMB";
       stub_addr = StubRoutines::sha1_implCompressMB();
     }
     break;
   case 1:
-    if (UseSHA256Intrinsics) {
+    if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_sha2_implCompress)) {
       klass_SHA_name = "sun/security/provider/SHA2";
       stub_name = "sha256_implCompressMB";
       stub_addr = StubRoutines::sha256_implCompressMB();
     }
     break;
   case 2:
-    if (UseSHA512Intrinsics) {
+    if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_sha5_implCompress)) {
       klass_SHA_name = "sun/security/provider/SHA5";
       stub_name = "sha512_implCompressMB";
       stub_addr = StubRoutines::sha512_implCompressMB();
diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp
index 0372fc202ae..d29970b5d36 100644
--- a/src/hotspot/share/opto/loopopts.cpp
+++ b/src/hotspot/share/opto/loopopts.cpp
@@ -909,6 +909,9 @@ void PhaseIdealLoop::try_move_store_after_loop(Node* n) {
 
             // Compute latest point this store can go
             Node* lca = get_late_ctrl(n, get_ctrl(n));
+            if (lca->is_OuterStripMinedLoop()) {
+              lca = lca->in(LoopNode::EntryControl);
+            }
             if (n_loop->is_member(get_loop(lca))) {
               // LCA is in the loop - bail out
               _igvn.replace_node(hook, n);
diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp
index a1ae5e7d9c0..eb7ae450659 100644
--- a/src/hotspot/share/prims/jvm.cpp
+++ b/src/hotspot/share/prims/jvm.cpp
@@ -493,11 +493,6 @@ JVM_END
 JVM_ENTRY_NO_ENV(void, JVM_GC(void))
   JVMWrapper("JVM_GC");
   if (!DisableExplicitGC) {
-    if (AsyncDeflateIdleMonitors) {
-      // AsyncDeflateIdleMonitors needs to know when System.gc() is
-      // called so any special deflation can be done at a safepoint.
-      ObjectSynchronizer::set_is_special_deflation_requested(true);
-    }
     Universe::heap()->collect(GCCause::_java_lang_system_gc);
   }
 JVM_END
diff --git a/src/hotspot/share/prims/methodHandles.cpp b/src/hotspot/share/prims/methodHandles.cpp
index 7516ff594a5..5eebb5c2fce 100644
--- a/src/hotspot/share/prims/methodHandles.cpp
+++ b/src/hotspot/share/prims/methodHandles.cpp
@@ -126,6 +126,7 @@ enum {
   IS_FIELD             = java_lang_invoke_MemberName::MN_IS_FIELD,
   IS_TYPE              = java_lang_invoke_MemberName::MN_IS_TYPE,
   CALLER_SENSITIVE     = java_lang_invoke_MemberName::MN_CALLER_SENSITIVE,
+  TRUSTED_FINAL        = java_lang_invoke_MemberName::MN_TRUSTED_FINAL,
   REFERENCE_KIND_SHIFT = java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT,
   REFERENCE_KIND_MASK  = java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK,
   SEARCH_SUPERCLASSES  = java_lang_invoke_MemberName::MN_SEARCH_SUPERCLASSES,
@@ -339,8 +340,10 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
 }
 
 oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) {
+  InstanceKlass* ik = fd.field_holder();
   int flags = (jushort)( fd.access_flags().as_short() & JVM_RECOGNIZED_FIELD_MODIFIERS );
   flags |= IS_FIELD | ((fd.is_static() ? JVM_REF_getStatic : JVM_REF_getField) << REFERENCE_KIND_SHIFT);
+  if (fd.is_trusted_final()) flags |= TRUSTED_FINAL;
   if (is_setter)  flags += ((JVM_REF_putField - JVM_REF_getField) << REFERENCE_KIND_SHIFT);
   int vmindex        = fd.offset();  // determines the field uniquely when combined with static bit
 
@@ -348,7 +351,7 @@ oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool
   java_lang_invoke_MemberName::set_flags  (mname_oop, flags);
   java_lang_invoke_MemberName::set_method (mname_oop, NULL);
   java_lang_invoke_MemberName::set_vmindex(mname_oop, vmindex);
-  java_lang_invoke_MemberName::set_clazz  (mname_oop, fd.field_holder()->java_mirror());
+  java_lang_invoke_MemberName::set_clazz  (mname_oop, ik->java_mirror());
 
   oop type = field_signature_type_or_null(fd.signature());
   oop name = field_name_or_null(fd.name());
@@ -1107,6 +1110,7 @@ void MethodHandles::trace_method_handle_interpreter_entry(MacroAssembler* _masm,
     template(java_lang_invoke_MemberName,MN_IS_FIELD) \
     template(java_lang_invoke_MemberName,MN_IS_TYPE) \
     template(java_lang_invoke_MemberName,MN_CALLER_SENSITIVE) \
+    template(java_lang_invoke_MemberName,MN_TRUSTED_FINAL) \
     template(java_lang_invoke_MemberName,MN_SEARCH_SUPERCLASSES) \
     template(java_lang_invoke_MemberName,MN_SEARCH_INTERFACES) \
     template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_SHIFT) \
diff --git a/src/hotspot/share/prims/methodHandles.hpp b/src/hotspot/share/prims/methodHandles.hpp
index 54f36202a5f..cd57f2146a0 100644
--- a/src/hotspot/share/prims/methodHandles.hpp
+++ b/src/hotspot/share/prims/methodHandles.hpp
@@ -36,7 +36,6 @@
 # include "interpreter/interpreter.hpp"
 #endif
 
-
 class MacroAssembler;
 class Label;
 
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
index 91d6d80e75b..b037249bfc0 100644
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp
@@ -64,7 +64,7 @@ typedef ConcurrentHashTable<ResolvedMethodTableConfig,
 class ResolvedMethodTableConfig : public AllStatic {
  private:
  public:
-  typedef WeakHandle<vm_resolved_method_table_data> Value;
+  typedef WeakHandle Value;
 
   static uintx get_hash(Value const& value, bool* is_dead) {
     oop val_oop = value.peek();
@@ -83,7 +83,7 @@ class ResolvedMethodTableConfig : public AllStatic {
     return AllocateHeap(size, mtClass);
   }
   static void free_node(void* memory, Value const& value) {
-    value.release();
+    value.release(OopStorageSet::resolved_method_table_weak());
     FreeHeap(memory);
     ResolvedMethodTable::item_removed();
   }
@@ -121,7 +121,7 @@ class ResolvedMethodTableLookup : StackObj {
   uintx get_hash() const {
     return _hash;
   }
-  bool equals(WeakHandle<vm_resolved_method_table_data>* value, bool* is_dead) {
+  bool equals(WeakHandle* value, bool* is_dead) {
     oop val_oop = value->peek();
     if (val_oop == NULL) {
       // dead oop, mark this hash dead for cleaning
@@ -145,7 +145,7 @@ class ResolvedMethodGet : public StackObj {
   Handle        _return;
 public:
   ResolvedMethodGet(Thread* thread, const Method* method) : _thread(thread), _method(method) {}
-  void operator()(WeakHandle<vm_resolved_method_table_data>* val) {
+  void operator()(WeakHandle* val) {
     oop result = val->resolve();
     assert(result != NULL, "Result should be reachable");
     _return = Handle(_thread, result);
@@ -193,7 +193,7 @@ oop ResolvedMethodTable::add_method(const Method* method, Handle rmethod_name) {
     if (_local_table->get(thread, lookup, rmg)) {
       return rmg.get_res_oop();
     }
-    WeakHandle<vm_resolved_method_table_data> wh = WeakHandle<vm_resolved_method_table_data>::create(rmethod_name);
+    WeakHandle wh(OopStorageSet::resolved_method_table_weak(), rmethod_name);
     // The hash table takes ownership of the WeakHandle, even if it's not inserted.
     if (_local_table->insert(thread, lookup, wh)) {
       log_insert(method);
@@ -282,7 +282,7 @@ void ResolvedMethodTable::grow(JavaThread* jt) {
 }
 
 struct ResolvedMethodTableDoDelete : StackObj {
-  void operator()(WeakHandle<vm_resolved_method_table_data>* val) {
+  void operator()(WeakHandle* val) {
     /* do nothing */
   }
 };
@@ -291,7 +291,7 @@ struct ResolvedMethodTableDeleteCheck : StackObj {
   long _count;
   long _item;
   ResolvedMethodTableDeleteCheck() : _count(0), _item(0) {}
-  bool operator()(WeakHandle<vm_resolved_method_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     ++_item;
     oop tmp = val->peek();
     if (tmp == NULL) {
@@ -345,7 +345,7 @@ class AdjustMethodEntries : public StackObj {
   bool* _trace_name_printed;
 public:
   AdjustMethodEntries(bool* trace_name_printed) : _trace_name_printed(trace_name_printed) {};
-  bool operator()(WeakHandle<vm_resolved_method_table_data>* entry) {
+  bool operator()(WeakHandle* entry) {
     oop mem_name = entry->peek();
     if (mem_name == NULL) {
       // Removed
@@ -387,7 +387,7 @@ void ResolvedMethodTable::adjust_method_entries(bool * trace_name_printed) {
 // Verification
 class VerifyResolvedMethod : StackObj {
  public:
-  bool operator()(WeakHandle<vm_resolved_method_table_data>* val) {
+  bool operator()(WeakHandle* val) {
     oop obj = val->peek();
     if (obj != NULL) {
       Method* method = (Method*)java_lang_invoke_ResolvedMethodName::vmtarget(obj);
diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp
index 54d01414538..2cd0fc88e19 100644
--- a/src/hotspot/share/prims/whitebox.cpp
+++ b/src/hotspot/share/prims/whitebox.cpp
@@ -41,6 +41,7 @@
 #include "gc/shared/genArguments.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "jvmtifiles/jvmtiEnv.hpp"
+#include "logging/log.hpp"
 #include "memory/filemap.hpp"
 #include "memory/heapShared.inline.hpp"
 #include "memory/metaspaceShared.hpp"
@@ -478,12 +479,6 @@ WB_END
 
 WB_ENTRY(jboolean, WB_G1StartMarkCycle(JNIEnv* env, jobject o))
   if (UseG1GC) {
-    if (AsyncDeflateIdleMonitors) {
-      // AsyncDeflateIdleMonitors needs to know when System.gc() or
-      // the equivalent is called so any special clean up can be done
-      // at a safepoint, e.g., TestHumongousClassLoader.java.
-      ObjectSynchronizer::set_is_special_deflation_requested(true);
-    }
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
     if (!g1h->concurrent_mark()->cm_thread()->during_cycle()) {
       g1h->collect(GCCause::_wb_conc_mark);
@@ -1455,12 +1450,6 @@ WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString
 WB_END
 
 WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
-  if (AsyncDeflateIdleMonitors) {
-    // AsyncDeflateIdleMonitors needs to know when System.gc() or
-    // the equivalent is called so any special clean up can be done
-    // at a safepoint, e.g., TestHumongousClassLoader.java.
-    ObjectSynchronizer::set_is_special_deflation_requested(true);
-  }
   Universe::heap()->soft_ref_policy()->set_should_clear_all_soft_refs(true);
   Universe::heap()->collect(GCCause::_wb_full_gc);
 #if INCLUDE_G1GC
@@ -1809,14 +1798,12 @@ WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
   return (jboolean) obj_oop->mark().has_monitor();
 WB_END
 
+WB_ENTRY(jboolean, WB_DeflateIdleMonitors(JNIEnv* env, jobject wb))
+  log_info(monitorinflation)("WhiteBox initiated DeflateIdleMonitors");
+  return ObjectSynchronizer::request_deflate_idle_monitors();
+WB_END
+
 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
-  if (AsyncDeflateIdleMonitors) {
-    // AsyncDeflateIdleMonitors needs to know when System.gc() or
-    // the equivalent is called so any special clean up can be done
-    // at a safepoint, e.g., TestRTMTotalCountIncrRate.java or
-    // TestUseRTMForStackLocks.java.
-    ObjectSynchronizer::set_is_special_deflation_requested(true);
-  }
   VM_ForceSafepoint force_safepoint_op;
   VMThread::execute(&force_safepoint_op);
 WB_END
@@ -2480,6 +2467,7 @@ static JNINativeMethod methods[] = {
                                                       (void*)&WB_AddModuleExportsToAll },
   {CC"assertMatchingSafepointCalls", CC"(ZZ)V",       (void*)&WB_AssertMatchingSafepointCalls },
   {CC"assertSpecialLock",  CC"(ZZ)V",                 (void*)&WB_AssertSpecialLock },
+  {CC"deflateIdleMonitors", CC"()Z",                  (void*)&WB_DeflateIdleMonitors },
   {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
   {CC"getConstantPool0",   CC"(Ljava/lang/Class;)J",  (void*)&WB_GetConstantPool    },
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
index dd0797af5bd..7c2a622e908 100644
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -3307,7 +3307,7 @@ class ScopedVMInitArgs : public StackObj {
   // allocated memory is deleted by the destructor.  If this method
   // returns anything other than JNI_OK, then this object is in a
   // partially constructed state, and should be abandoned.
-  jint set_args(GrowableArray<JavaVMOption>* options) {
+  jint set_args(const GrowableArrayView<JavaVMOption>* options) {
     _is_set = true;
     JavaVMOption* options_arr = NEW_C_HEAP_ARRAY_RETURN_NULL(
         JavaVMOption, options->length(), mtArguments);
@@ -3365,23 +3365,21 @@ class ScopedVMInitArgs : public StackObj {
     assert(vm_options_file_pos != -1, "vm_options_file_pos should be set");
 
     int length = args->nOptions + args_to_insert->nOptions - 1;
-    GrowableArray<JavaVMOption> *options = new (ResourceObj::C_HEAP, mtArguments)
-              GrowableArray<JavaVMOption>(length, mtArguments);    // Construct new option array
+    // Construct new option array
+    GrowableArrayCHeap<JavaVMOption, mtArguments> options(length);
     for (int i = 0; i < args->nOptions; i++) {
       if (i == vm_options_file_pos) {
         // insert the new options starting at the same place as the
         // -XX:VMOptionsFile option
         for (int j = 0; j < args_to_insert->nOptions; j++) {
-          options->push(args_to_insert->options[j]);
+          options.push(args_to_insert->options[j]);
         }
       } else {
-        options->push(args->options[i]);
+        options.push(args->options[i]);
       }
     }
     // make into options array
-    jint result = set_args(options);
-    delete options;
-    return result;
+    return set_args(&options);
   }
 };
 
@@ -3478,7 +3476,8 @@ jint Arguments::parse_vm_options_file(const char* file_name, ScopedVMInitArgs* v
 }
 
 jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args) {
-  GrowableArray<JavaVMOption> *options = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JavaVMOption>(2, mtArguments);    // Construct option array
+  // Construct option array
+  GrowableArrayCHeap<JavaVMOption, mtArguments> options(2);
 
   // some pointers to help with parsing
   char *buffer_end = buffer + buf_len;
@@ -3518,7 +3517,6 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
                                             // did not see closing quote
           jio_fprintf(defaultStream::error_stream(),
                       "Unmatched quote in %s\n", name);
-          delete options;
           return JNI_ERR;
         }
       } else {
@@ -3534,16 +3532,13 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
     option.optionString = opt_hd;
     option.extraInfo = NULL;
 
-    options->append(option);                // Fill in option
+    options.append(option);                // Fill in option
 
     rd++;  // Advance to next character
   }
 
   // Fill out JavaVMInitArgs structure.
-  jint status = vm_args->set_args(options);
-
-  delete options;
-  return status;
+  return vm_args->set_args(&options);
 }
 
 jint Arguments::set_shared_spaces_flags_and_archive_paths() {
@@ -4148,13 +4143,13 @@ jint Arguments::apply_ergo() {
     UseBiasedLocking = false;
   }
 
-#ifdef CC_INTERP
+#ifdef ZERO
   // Clear flags not supported on zero.
   FLAG_SET_DEFAULT(ProfileInterpreter, false);
   FLAG_SET_DEFAULT(UseBiasedLocking, false);
   LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false));
   LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false));
-#endif // CC_INTERP
+#endif // ZERO
 
   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
     warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp
index d4a99effad9..cff17b2eb4c 100644
--- a/src/hotspot/share/runtime/deoptimization.cpp
+++ b/src/hotspot/share/runtime/deoptimization.cpp
@@ -596,16 +596,9 @@ void Deoptimization::cleanup_deopt_info(JavaThread *thread,
 
 
   if (JvmtiExport::can_pop_frame()) {
-#ifndef CC_INTERP
     // Regardless of whether we entered this routine with the pending
     // popframe condition bit set, we should always clear it now
     thread->clear_popframe_condition();
-#else
-    // C++ interpreter will clear has_pending_popframe when it enters
-    // with method_resume. For deopt_resume2 we clear it now.
-    if (thread->popframe_forcing_deopt_reexecution())
-        thread->clear_popframe_condition();
-#endif /* CC_INTERP */
   }
 
   // unpack_frames() is called at the end of the deoptimization handler
diff --git a/src/hotspot/share/runtime/fieldDescriptor.cpp b/src/hotspot/share/runtime/fieldDescriptor.cpp
index 6123a502848..e3be65c6cca 100644
--- a/src/hotspot/share/runtime/fieldDescriptor.cpp
+++ b/src/hotspot/share/runtime/fieldDescriptor.cpp
@@ -58,6 +58,11 @@ Symbol* fieldDescriptor::generic_signature() const {
   return NULL;
 }
 
+bool fieldDescriptor::is_trusted_final() const {
+  InstanceKlass* ik = field_holder();
+  return is_final() && (is_static() || ik->is_hidden() || ik->is_record());
+}
+
 AnnotationArray* fieldDescriptor::annotations() const {
   InstanceKlass* ik = field_holder();
   Array<AnnotationArray*>* md = ik->fields_annotations();
diff --git a/src/hotspot/share/runtime/fieldDescriptor.hpp b/src/hotspot/share/runtime/fieldDescriptor.hpp
index 189f785bb4c..a2594a5ef29 100644
--- a/src/hotspot/share/runtime/fieldDescriptor.hpp
+++ b/src/hotspot/share/runtime/fieldDescriptor.hpp
@@ -102,6 +102,8 @@ class fieldDescriptor {
   bool has_initialized_final_update() const { return access_flags().has_field_initialized_final_update(); }
   bool has_generic_signature()    const    { return access_flags().field_has_generic_signature(); }
 
+  bool is_trusted_final()         const;
+
   inline void set_is_field_access_watched(const bool value);
   inline void set_is_field_modification_watched(const bool value);
   inline void set_has_initialized_final_update(const bool value);
diff --git a/src/hotspot/share/runtime/frame.hpp b/src/hotspot/share/runtime/frame.hpp
index 702082fc39e..5dfe01d3ffa 100644
--- a/src/hotspot/share/runtime/frame.hpp
+++ b/src/hotspot/share/runtime/frame.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -280,11 +280,9 @@ class frame {
 
   intptr_t* interpreter_frame_sender_sp() const;
 
-#ifndef CC_INTERP
   // template based interpreter deoptimization support
   void  set_interpreter_frame_sender_sp(intptr_t* sender_sp);
   void interpreter_frame_set_monitor_end(BasicObjectLock* value);
-#endif // CC_INTERP
 
   // Address of the temp oop in the frame. Needed as GC root.
   oop* interpreter_frame_temp_oop_addr() const;
diff --git a/src/hotspot/share/runtime/frame.inline.hpp b/src/hotspot/share/runtime/frame.inline.hpp
index edcdbb6b836..34e556199b4 100644
--- a/src/hotspot/share/runtime/frame.inline.hpp
+++ b/src/hotspot/share/runtime/frame.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@
 #define SHARE_RUNTIME_FRAME_INLINE_HPP
 
 #include "code/compiledMethod.inline.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
-#include "interpreter/bytecodeInterpreter.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/method.hpp"
 #include "runtime/frame.hpp"
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index a09746c3185..7240209fc20 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -350,6 +350,10 @@ const size_t minimumSymbolTableSize = 1024;
   diagnostic(ccstrlist, DisableIntrinsic, "",                               \
          "do not expand intrinsics whose (internal) names appear here")     \
                                                                             \
+  diagnostic(ccstrlist, ControlIntrinsic, "",                               \
+         "Control intrinsics using a list of +/- (internal) names, "        \
+         "separated by commas")                                             \
+                                                                            \
   develop(bool, TraceCallFixup, false,                                      \
           "Trace all call fixups")                                          \
                                                                             \
@@ -614,7 +618,7 @@ const size_t minimumSymbolTableSize = 1024;
   product(bool, OmitStackTraceInFastThrow, true,                            \
           "Omit backtraces for some 'hot' exceptions in optimized code")    \
                                                                             \
-  manageable(bool, ShowCodeDetailsInExceptionMessages, false,               \
+  manageable(bool, ShowCodeDetailsInExceptionMessages, true,                \
           "Show exception messages from RuntimeExceptions that contain "    \
           "snippets of the failing code. Disable this to improve privacy.") \
                                                                             \
diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp
index 7c0db440d32..94e92f4139c 100644
--- a/src/hotspot/share/runtime/init.cpp
+++ b/src/hotspot/share/runtime/init.cpp
@@ -68,7 +68,6 @@ jint universe_init();          // depends on codeCache_init and stubRoutines_ini
 void gc_barrier_stubs_init();
 void interpreter_init_stub();  // before any methods loaded
 void interpreter_init_code();  // after methods loaded, but before they are linked
-void invocationCounter_init(); // after methods loaded, but before they are linked
 void accessFlags_init();
 void InterfaceSupport_init();
 void universe2_init();  // dependent on codeCache_init and stubRoutines_init, loads primordial classes
@@ -128,7 +127,6 @@ jint init_globals() {
   universe2_init();  // dependent on codeCache_init and stubRoutines_init1
   javaClasses_init();// must happen after vtable initialization, before referenceProcessor_init
   interpreter_init_code();  // after javaClasses_init and before any method gets linked
-  invocationCounter_init(); // after javaClasses_init and before any method gets linked
   referenceProcessor_init();
   jni_handles_init();
 #if INCLUDE_VM_STRUCTS
diff --git a/src/hotspot/share/runtime/javaCalls.cpp b/src/hotspot/share/runtime/javaCalls.cpp
index 2733fe180e4..e08b1232777 100644
--- a/src/hotspot/share/runtime/javaCalls.cpp
+++ b/src/hotspot/share/runtime/javaCalls.cpp
@@ -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 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC
   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 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC
     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 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC
       // 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)
diff --git a/src/hotspot/share/runtime/javaCalls.hpp b/src/hotspot/share/runtime/javaCalls.hpp
index 73ecde86eb5..6a22cb23ec1 100644
--- a/src/hotspot/share/runtime/javaCalls.hpp
+++ b/src/hotspot/share/runtime/javaCalls.hpp
@@ -88,7 +88,10 @@ class JavaCallArguments : public StackObj {
   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 @@ class JavaCallArguments : public StackObj {
     _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 @@ class JavaCallArguments : public StackObj {
       _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
diff --git a/src/hotspot/share/runtime/jniHandles.hpp b/src/hotspot/share/runtime/jniHandles.hpp
index 47c14784569..4cbbb0afb73 100644
--- a/src/hotspot/share/runtime/jniHandles.hpp
+++ b/src/hotspot/share/runtime/jniHandles.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -132,7 +132,7 @@ class JNIHandles : AllStatic {
 
 class JNIHandleBlock : public CHeapObj<mtInternal> {
   friend class VMStructs;
-  friend class CppInterpreter;
+  friend class ZeroInterpreter;
 
  private:
   enum SomeConstants {
diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp
index e45e8982768..c56e46d8355 100644
--- a/src/hotspot/share/runtime/mutexLocker.cpp
+++ b/src/hotspot/share/runtime/mutexLocker.cpp
@@ -151,6 +151,7 @@ Mutex*   CDSClassFileStream_lock      = NULL;
 #endif
 Mutex*   DumpTimeTable_lock           = NULL;
 Mutex*   CDSLambda_lock               = NULL;
+Mutex*   CDSAddSymbol_lock            = NULL;
 #endif // INCLUDE_CDS
 
 #if INCLUDE_JVMCI
@@ -344,8 +345,9 @@ void mutex_init() {
 #if INCLUDE_JVMTI
   def(CDSClassFileStream_lock      , PaddedMutex  , max_nonleaf, false, _safepoint_check_always);
 #endif
-  def(DumpTimeTable_lock           , PaddedMutex  , leaf - 1,        true,  _safepoint_check_never);
+  def(DumpTimeTable_lock           , PaddedMutex  , leaf - 1,    true,  _safepoint_check_never);
   def(CDSLambda_lock               , PaddedMutex  , leaf,        true,  _safepoint_check_never);
+  def(CDSAddSymbol_lock            , PaddedMutex  , leaf - 1,    true,  _safepoint_check_never);
 #endif // INCLUDE_CDS
 
 #if INCLUDE_JVMCI
diff --git a/src/hotspot/share/runtime/mutexLocker.hpp b/src/hotspot/share/runtime/mutexLocker.hpp
index 90b17b0c234..5b5f806d7b4 100644
--- a/src/hotspot/share/runtime/mutexLocker.hpp
+++ b/src/hotspot/share/runtime/mutexLocker.hpp
@@ -130,6 +130,7 @@ extern Mutex*   CDSClassFileStream_lock;         // FileMapInfo::open_stream_for
 #endif
 extern Mutex*   DumpTimeTable_lock;              // SystemDictionaryShared::find_or_allocate_info_for
 extern Mutex*   CDSLambda_lock;                  // SystemDictionaryShared::get_shared_lambda_proxy_class
+extern Mutex*   CDSAddSymbol_lock;               // SystemDictionaryShared::add_symbol
 #endif // INCLUDE_CDS
 #if INCLUDE_JFR
 extern Mutex*   JfrStacktrace_lock;              // used to guard access to the JFR stacktrace table
diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp
index 84d5a6d26d5..42cbec80947 100644
--- a/src/hotspot/share/runtime/os.hpp
+++ b/src/hotspot/share/runtime/os.hpp
@@ -29,7 +29,6 @@
 #include "jvmtifiles/jvmti.h"
 #include "metaprogramming/isRegisteredEnum.hpp"
 #include "metaprogramming/integralConstant.hpp"
-#include "runtime/extendedPC.hpp"
 #include "utilities/exceptions.hpp"
 #include "utilities/ostream.hpp"
 #include "utilities/macros.hpp"
@@ -473,9 +472,8 @@ class os: AllStatic {
 
   static int pd_self_suspend_thread(Thread* thread);
 
-  static ExtendedPC fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
+  static address    fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
   static frame      fetch_frame_from_context(const void* ucVoid);
-  static frame      fetch_frame_from_ucontext(Thread* thread, void* ucVoid);
 
   static void breakpoint();
   static bool start_debugging(char *buf, int buflen);
diff --git a/src/hotspot/share/runtime/reflection.cpp b/src/hotspot/share/runtime/reflection.cpp
index e9366f8fa18..02e7b1973fa 100644
--- a/src/hotspot/share/runtime/reflection.cpp
+++ b/src/hotspot/share/runtime/reflection.cpp
@@ -897,6 +897,9 @@ oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
   java_lang_reflect_Field::set_slot(rh(), fd->index());
   java_lang_reflect_Field::set_name(rh(), name());
   java_lang_reflect_Field::set_type(rh(), type());
+  if (fd->is_trusted_final()) {
+    java_lang_reflect_Field::set_trusted_final(rh());
+  }
   // Note the ACC_ANNOTATION bit, which is a per-class access flag, is never set here.
   java_lang_reflect_Field::set_modifiers(rh(), fd->access_flags().as_int() & JVM_RECOGNIZED_FIELD_MODIFIERS);
   java_lang_reflect_Field::set_override(rh(), false);
diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp
index ba35254b8bc..5ee8c776da2 100644
--- a/src/hotspot/share/runtime/safepoint.cpp
+++ b/src/hotspot/share/runtime/safepoint.cpp
@@ -502,12 +502,10 @@ bool SafepointSynchronize::is_cleanup_needed() {
 
 class ParallelSPCleanupThreadClosure : public ThreadClosure {
 private:
-  CodeBlobClosure* _nmethod_cl;
   DeflateMonitorCounters* _counters;
 
 public:
   ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
-    _nmethod_cl(UseCodeAging ? NMethodSweeper::prepare_reset_hotness_counters() : NULL),
     _counters(counters) {}
 
   void do_thread(Thread* thread) {
@@ -516,11 +514,6 @@ class ParallelSPCleanupThreadClosure : public ThreadClosure {
     // there is a special cleanup request, deflation is handled now.
     // Otherwise, async deflation is requested via a flag.
     ObjectSynchronizer::deflate_thread_local_monitors(thread, _counters);
-    if (_nmethod_cl != NULL && thread->is_Java_thread() &&
-        ! thread->is_Code_cache_sweeper_thread()) {
-      JavaThread* jt = (JavaThread*) thread;
-      jt->nmethods_do(_nmethod_cl);
-    }
   }
 };
 
@@ -1181,8 +1174,6 @@ void SafepointTracing::statistics_exit_log() {
     }
   }
 
-  log_info(safepoint, stats)("VM operations coalesced during safepoint " INT64_FORMAT,
-                              VMThread::get_coalesced_count());
   log_info(safepoint, stats)("Maximum sync time  " INT64_FORMAT" ns",
                               (int64_t)(_max_sync_time));
   log_info(safepoint, stats)("Maximum vm operation time (except for Exit VM operation)  "
diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp
index a6351798b4d..256f42b5485 100644
--- a/src/hotspot/share/runtime/sharedRuntime.cpp
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp
@@ -771,17 +771,12 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
   address target_pc = NULL;
 
   if (Interpreter::contains(pc)) {
-#ifdef CC_INTERP
-    // C++ interpreter doesn't throw implicit exceptions
-    ShouldNotReachHere();
-#else
     switch (exception_kind) {
       case IMPLICIT_NULL:           return Interpreter::throw_NullPointerException_entry();
       case IMPLICIT_DIVIDE_BY_ZERO: return Interpreter::throw_ArithmeticException_entry();
       case STACK_OVERFLOW:          return Interpreter::throw_StackOverflowError_entry();
       default:                      ShouldNotReachHere();
     }
-#endif // !CC_INTERP
   } else {
     switch (exception_kind) {
       case STACK_OVERFLOW: {
diff --git a/src/hotspot/share/runtime/sweeper.cpp b/src/hotspot/share/runtime/sweeper.cpp
index cd3d3f4eee4..56beb619788 100644
--- a/src/hotspot/share/runtime/sweeper.cpp
+++ b/src/hotspot/share/runtime/sweeper.cpp
@@ -141,17 +141,6 @@ class MarkActivationClosure: public CodeBlobClosure {
 };
 static MarkActivationClosure mark_activation_closure;
 
-class SetHotnessClosure: public CodeBlobClosure {
-public:
-  virtual void do_code_blob(CodeBlob* cb) {
-    assert(cb->is_nmethod(), "CodeBlob should be nmethod");
-    nmethod* nm = (nmethod*)cb;
-    nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val());
-  }
-};
-static SetHotnessClosure set_hotness_closure;
-
-
 int NMethodSweeper::hotness_counter_reset_val() {
   if (_hotness_counter_reset_val == 0) {
     _hotness_counter_reset_val = (ReservedCodeCacheSize < M) ? 1 : (ReservedCodeCacheSize / M) * 2;
@@ -204,29 +193,6 @@ CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
   return &mark_activation_closure;
 }
 
-CodeBlobClosure* NMethodSweeper::prepare_reset_hotness_counters() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
-
-  // If we do not want to reclaim not-entrant or zombie methods there is no need
-  // to scan stacks
-  if (!MethodFlushing) {
-    return NULL;
-  }
-
-  // Check for restart
-  if (_current.method() != NULL) {
-    if (_current.method()->is_nmethod()) {
-      assert(CodeCache::find_blob_unsafe(_current.method()) == _current.method(), "Sweeper nmethod cached state invalid");
-    } else if (_current.method()->is_aot()) {
-      assert(CodeCache::find_blob_unsafe(_current.method()->code_begin()) == _current.method(), "Sweeper AOT method cached state invalid");
-    } else {
-      ShouldNotReachHere();
-    }
-  }
-
-  return &set_hotness_closure;
-}
-
 /**
   * This function triggers a VM operation that does stack scanning of active
   * methods. Stack scanning is mandatory for the sweeper to make progress.
diff --git a/src/hotspot/share/runtime/sweeper.hpp b/src/hotspot/share/runtime/sweeper.hpp
index 6d25ed121bb..9ba2298e9ef 100644
--- a/src/hotspot/share/runtime/sweeper.hpp
+++ b/src/hotspot/share/runtime/sweeper.hpp
@@ -37,8 +37,10 @@ class CodeBlobClosure;
 //    - reclamation of nmethods
 // Removing nmethods from the code cache includes two operations
 //  1) mark active nmethods
-//     Is done in 'mark_active_nmethods()'. This function is called at a
-//     safepoint and marks all nmethods that are active on a thread's stack.
+//     Is done in 'do_stack_scanning()'. This function invokes a thread-local handshake
+//     that marks all nmethods that are active on a thread's stack, and resets their
+//     hotness counters. This allows the sweeper to assume that a decayed hotness counter
+//     of an nmethod implies that it is seemingly not used actively.
 //  2) sweep nmethods
 //     Is done in sweep_code_cache(). This function is the only place in the
 //     sweeper where memory is reclaimed. Note that sweep_code_cache() is not
@@ -110,8 +112,6 @@ class NMethodSweeper : public AllStatic {
 #endif
 
   static CodeBlobClosure* prepare_mark_active_nmethods();
-  static CodeBlobClosure* prepare_reset_hotness_counters();
-
   static void sweeper_loop();
   static bool should_start_aggressive_sweep(int code_blob_type);
   static void force_sweep();
diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp
index b92e570fe04..01d0f86277b 100644
--- a/src/hotspot/share/runtime/synchronizer.cpp
+++ b/src/hotspot/share/runtime/synchronizer.cpp
@@ -121,7 +121,6 @@ static volatile intptr_t gInflationLocks[NINFLATIONLOCKS];
 // global list of blocks of monitors
 PaddedObjectMonitor* ObjectSynchronizer::g_block_list = NULL;
 bool volatile ObjectSynchronizer::_is_async_deflation_requested = false;
-bool volatile ObjectSynchronizer::_is_special_deflation_requested = false;
 jlong ObjectSynchronizer::_last_async_deflation_time_ns = 0;
 
 struct ObjectMonitorListGlobals {
@@ -1309,30 +1308,60 @@ bool ObjectSynchronizer::is_async_deflation_needed() {
     // are too many monitors in use. We don't deflate more frequently
     // than AsyncDeflationInterval (unless is_async_deflation_requested)
     // in order to not swamp the ServiceThread.
-    _last_async_deflation_time_ns = os::javaTimeNanos();
     return true;
   }
   return false;
 }
 
 bool ObjectSynchronizer::is_safepoint_deflation_needed() {
-  if (!AsyncDeflateIdleMonitors) {
-    if (monitors_used_above_threshold()) {
-      // Too many monitors in use.
-      return true;
+  return !AsyncDeflateIdleMonitors &&
+         monitors_used_above_threshold();  // Too many monitors in use.
+}
+
+bool ObjectSynchronizer::request_deflate_idle_monitors() {
+  bool is_JavaThread = Thread::current()->is_Java_thread();
+  bool ret_code = false;
+
+  if (AsyncDeflateIdleMonitors) {
+    jlong last_time = last_async_deflation_time_ns();
+    set_is_async_deflation_requested(true);
+    {
+      MonitorLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
+      ml.notify_all();
+    }
+    const int N_CHECKS = 5;
+    for (int i = 0; i < N_CHECKS; i++) {  // sleep for at most 5 seconds
+      if (last_async_deflation_time_ns() > last_time) {
+        log_info(monitorinflation)("Async Deflation happened after %d check(s).", i);
+        ret_code = true;
+        break;
+      }
+      if (is_JavaThread) {
+        // JavaThread has to honor the blocking protocol.
+        ThreadBlockInVM tbivm(JavaThread::current());
+        os::naked_short_sleep(999);  // sleep for almost 1 second
+      } else {
+        os::naked_short_sleep(999);  // sleep for almost 1 second
+      }
     }
-    return false;
-  }
-  if (is_special_deflation_requested()) {
-    // For AsyncDeflateIdleMonitors only do a safepoint deflation
-    // if there is a special deflation request.
-    return true;
+    if (!ret_code) {
+      log_info(monitorinflation)("Async Deflation DID NOT happen after %d checks.", N_CHECKS);
+    }
+  } else {
+    // Only need to force this safepoint if we are not using async
+    // deflation. The VMThread won't call this function before the
+    // final safepoint if we are not using async deflation so we
+    // don't have to reason about the VMThread executing a VM-op here.
+    VM_ForceSafepoint force_safepoint_op;
+    VMThread::execute(&force_safepoint_op);
+    ret_code = true;
   }
-  return false;
+
+  return ret_code;
 }
 
 jlong ObjectSynchronizer::time_since_last_async_deflation_ms() {
-  return (os::javaTimeNanos() - _last_async_deflation_time_ns) / (NANOUNITS / MILLIUNITS);
+  return (os::javaTimeNanos() - last_async_deflation_time_ns()) / (NANOUNITS / MILLIUNITS);
 }
 
 void ObjectSynchronizer::oops_do(OopClosure* f) {
@@ -2017,9 +2046,8 @@ void ObjectSynchronizer::do_safepoint_work(DeflateMonitorCounters* counters) {
   // The per-thread in-use lists are handled in
   // ParallelSPCleanupThreadClosure::do_thread().
 
-  if (!AsyncDeflateIdleMonitors || is_special_deflation_requested()) {
-    // Use the older mechanism for the global in-use list or if a
-    // special deflation has been requested before the safepoint.
+  if (!AsyncDeflateIdleMonitors) {
+    // Use the older mechanism for the global in-use list.
     ObjectSynchronizer::deflate_idle_monitors(counters);
     return;
   }
@@ -2438,10 +2466,8 @@ void ObjectSynchronizer::deflate_idle_monitors(DeflateMonitorCounters* counters)
 
   if (AsyncDeflateIdleMonitors) {
     // Nothing to do when global idle ObjectMonitors are deflated using
-    // a JavaThread unless a special deflation has been requested.
-    if (!is_special_deflation_requested()) {
-      return;
-    }
+    // a JavaThread.
+    return;
   }
 
   bool deflated = false;
@@ -2534,6 +2560,7 @@ void ObjectSynchronizer::deflate_idle_monitors_using_JT() {
                              Atomic::load(&om_list_globals._wait_count));
 
   // The ServiceThread's async deflation request has been processed.
+  _last_async_deflation_time_ns = os::javaTimeNanos();
   set_is_async_deflation_requested(false);
 
   if (Atomic::load(&om_list_globals._wait_count) > 0) {
@@ -2609,16 +2636,6 @@ void ObjectSynchronizer::deflate_common_idle_monitors_using_JT(bool is_global, J
   }
 
   do {
-    if (saved_mid_in_use_p != NULL) {
-      // We looped around because deflate_monitor_list_using_JT()
-      // detected a pending safepoint. Honoring the safepoint is good,
-      // but as long as is_special_deflation_requested() is supported,
-      // we can't safely restart using saved_mid_in_use_p. That saved
-      // ObjectMonitor could have been deflated by safepoint based
-      // deflation and would no longer be on the in-use list where we
-      // originally found it.
-      saved_mid_in_use_p = NULL;
-    }
     int local_deflated_count;
     if (is_global) {
       local_deflated_count =
@@ -2701,10 +2718,9 @@ void ObjectSynchronizer::finish_deflate_idle_monitors(DeflateMonitorCounters* co
   // than a beginning to end measurement of the phase.
   log_info(safepoint, cleanup)("deflating per-thread idle monitors, %3.7f secs, monitors=%d", counters->per_thread_times, counters->per_thread_scavenged);
 
-  bool needs_special_deflation = is_special_deflation_requested();
-  if (AsyncDeflateIdleMonitors && !needs_special_deflation) {
+  if (AsyncDeflateIdleMonitors) {
     // Nothing to do when idle ObjectMonitors are deflated using
-    // a JavaThread unless a special deflation has been requested.
+    // a JavaThread.
     return;
   }
 
@@ -2729,17 +2745,14 @@ void ObjectSynchronizer::finish_deflate_idle_monitors(DeflateMonitorCounters* co
 
   GVars.stw_random = os::random();
   GVars.stw_cycle++;
-
-  if (needs_special_deflation) {
-    set_is_special_deflation_requested(false);  // special deflation is done
-  }
 }
 
 void ObjectSynchronizer::deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 
-  if (AsyncDeflateIdleMonitors && !is_special_deflation_requested()) {
-    // Nothing to do if a special deflation has NOT been requested.
+  if (AsyncDeflateIdleMonitors) {
+    // Nothing to do when per-thread idle ObjectMonitors are deflated
+    // using a JavaThread.
     return;
   }
 
diff --git a/src/hotspot/share/runtime/synchronizer.hpp b/src/hotspot/share/runtime/synchronizer.hpp
index a5aa996a024..5a9a0628f22 100644
--- a/src/hotspot/share/runtime/synchronizer.hpp
+++ b/src/hotspot/share/runtime/synchronizer.hpp
@@ -161,9 +161,9 @@ class ObjectSynchronizer : AllStatic {
   static bool is_async_deflation_needed();
   static bool is_safepoint_deflation_needed();
   static bool is_async_deflation_requested() { return _is_async_deflation_requested; }
-  static bool is_special_deflation_requested() { return _is_special_deflation_requested; }
+  static jlong last_async_deflation_time_ns() { return _last_async_deflation_time_ns; }
+  static bool request_deflate_idle_monitors();  // for whitebox test support and VM exit logging
   static void set_is_async_deflation_requested(bool new_value) { _is_async_deflation_requested = new_value; }
-  static void set_is_special_deflation_requested(bool new_value) { _is_special_deflation_requested = new_value; }
   static jlong time_since_last_async_deflation_ms();
   static void oops_do(OopClosure* f);
   // Process oops in thread local used monitors
@@ -200,7 +200,6 @@ class ObjectSynchronizer : AllStatic {
   // global list of blocks of monitors
   static PaddedObjectMonitor* g_block_list;
   static volatile bool _is_async_deflation_requested;
-  static volatile bool _is_special_deflation_requested;
   static jlong         _last_async_deflation_time_ns;
 
   // Function to prepend new blocks to the appropriate lists:
diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp
index b13b86e796e..18922ddbe68 100644
--- a/src/hotspot/share/runtime/thread.hpp
+++ b/src/hotspot/share/runtime/thread.hpp
@@ -50,9 +50,6 @@
 #include "utilities/exceptions.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
-#ifdef ZERO
-# include "stack_zero.hpp"
-#endif
 #if INCLUDE_JFR
 #include "jfr/support/jfrThreadExtension.hpp"
 #endif
@@ -2001,13 +1998,10 @@ class JavaThread: public Thread {
   bool has_pending_popframe()                         { return (popframe_condition() & popframe_pending_bit) != 0; }
   bool popframe_forcing_deopt_reexecution()           { return (popframe_condition() & popframe_force_deopt_reexecution_bit) != 0; }
   void clear_popframe_forcing_deopt_reexecution()     { _popframe_condition &= ~popframe_force_deopt_reexecution_bit; }
-#ifdef CC_INTERP
-  bool pop_frame_pending(void)                        { return ((_popframe_condition & popframe_pending_bit) != 0); }
-  void clr_pop_frame_pending(void)                    { _popframe_condition = popframe_inactive; }
+
   bool pop_frame_in_process(void)                     { return ((_popframe_condition & popframe_processing_bit) != 0); }
   void set_pop_frame_in_process(void)                 { _popframe_condition |= popframe_processing_bit; }
   void clr_pop_frame_in_process(void)                 { _popframe_condition &= ~popframe_processing_bit; }
-#endif
 
   int frames_to_pop_failed_realloc() const            { return _frames_to_pop_failed_realloc; }
   void set_frames_to_pop_failed_realloc(int nb)       { _frames_to_pop_failed_realloc = nb; }
diff --git a/src/hotspot/share/runtime/vframeArray.cpp b/src/hotspot/share/runtime/vframeArray.cpp
index 53cb179a907..f3c22f39089 100644
--- a/src/hotspot/share/runtime/vframeArray.cpp
+++ b/src/hotspot/share/runtime/vframeArray.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -225,14 +225,7 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters,
         (thread->has_pending_popframe() || thread->popframe_forcing_deopt_reexecution())) {
       if (thread->has_pending_popframe()) {
         // Pop top frame after deoptimization
-#ifndef CC_INTERP
         pc = Interpreter::remove_activation_preserving_args_entry();
-#else
-        // Do an uncommon trap type entry. c++ interpreter will know
-        // to pop frame and preserve the args
-        pc = Interpreter::deopt_entry(vtos, 0);
-        use_next_mdp = false;
-#endif
       } else {
         // Reexecute invoke in top frame
         pc = Interpreter::deopt_entry(vtos, 0);
@@ -242,11 +235,10 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters,
         // Deoptimization::fetch_unroll_info_helper
         popframe_preserved_args_size_in_words = in_words(thread->popframe_preserved_args_size_in_words());
       }
-    } else if (!realloc_failure_exception && JvmtiExport::can_force_early_return() && state != NULL && state->is_earlyret_pending()) {
+    } else if (!realloc_failure_exception && JvmtiExport::can_force_early_return() && state != NULL &&
+               state->is_earlyret_pending()) {
       // Force early return from top frame after deoptimization
-#ifndef CC_INTERP
       pc = Interpreter::remove_activation_early_entry(state->earlyret_tos());
-#endif
     } else {
       if (realloc_failure_exception && JvmtiExport::can_force_early_return() && state != NULL && state->is_earlyret_pending()) {
         state->clr_earlyret_pending();
diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp
index f660db8560e..855983b52ad 100644
--- a/src/hotspot/share/runtime/vmOperations.cpp
+++ b/src/hotspot/share/runtime/vmOperations.cpp
@@ -432,11 +432,10 @@ int VM_Exit::wait_for_threads_in_native_to_block() {
 
 bool VM_Exit::doit_prologue() {
   if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
-    // AsyncDeflateIdleMonitors does a special deflation at the VM_Exit
-    // safepoint in order to reduce the in-use monitor population that
-    // is reported by ObjectSynchronizer::log_in_use_monitor_details()
-    // at VM exit.
-    ObjectSynchronizer::set_is_special_deflation_requested(true);
+    // AsyncDeflateIdleMonitors does a special deflation in order
+    // to reduce the in-use monitor population that is reported by
+    // ObjectSynchronizer::log_in_use_monitor_details() at VM exit.
+    ObjectSynchronizer::request_deflate_idle_monitors();
   }
   return true;
 }
diff --git a/src/hotspot/share/runtime/vmOperations.hpp b/src/hotspot/share/runtime/vmOperations.hpp
index f33b2a97a50..f69061fb36f 100644
--- a/src/hotspot/share/runtime/vmOperations.hpp
+++ b/src/hotspot/share/runtime/vmOperations.hpp
@@ -110,7 +110,6 @@
   template(ClassLoaderHierarchyOperation)         \
   template(DumpHashtable)                         \
   template(DumpTouchedMethods)                    \
-  template(MarkActiveNMethods)                    \
   template(PrintCompileQueue)                     \
   template(PrintClassHierarchy)                   \
   template(ThreadSuspend)                         \
diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp
index b3ae355a8a1..dc3c6936d69 100644
--- a/src/hotspot/share/runtime/vmStructs.cpp
+++ b/src/hotspot/share/runtime/vmStructs.cpp
@@ -46,7 +46,6 @@
 #include "compiler/compileBroker.hpp"
 #include "compiler/oopMap.hpp"
 #include "gc/shared/vmStructs_gc.hpp"
-#include "interpreter/bytecodeInterpreter.hpp"
 #include "interpreter/bytecodes.hpp"
 #include "interpreter/interpreter.hpp"
 #include "memory/allocation.hpp"
@@ -532,9 +531,8 @@ typedef HashtableEntry<InstanceKlass*, mtClass>  KlassHashtableEntry;
   /* GrowableArrays  */                                                                                                              \
   /*******************/                                                                                                              \
                                                                                                                                      \
-  nonstatic_field(GenericGrowableArray,        _len,                                          int)                                   \
-  nonstatic_field(GenericGrowableArray,        _max,                                          int)                                   \
-  nonstatic_field(GenericGrowableArray,        _arena,                                        Arena*)                                \
+  nonstatic_field(GrowableArrayBase,           _len,                                          int)                                   \
+  nonstatic_field(GrowableArrayBase,           _max,                                          int)                                   \
   nonstatic_field(GrowableArray<int>,          _data,                                         int*)                                  \
                                                                                                                                      \
   /********************************/                                                                                                 \
@@ -1339,7 +1337,7 @@ typedef HashtableEntry<InstanceKlass*, mtClass>  KlassHashtableEntry;
   declare_toplevel_type(SystemDictionary)                                 \
   declare_toplevel_type(vmSymbols)                                        \
                                                                           \
-  declare_toplevel_type(GenericGrowableArray)                             \
+  declare_toplevel_type(GrowableArrayBase)                                \
   declare_toplevel_type(GrowableArray<int>)                               \
   declare_toplevel_type(Arena)                                            \
     declare_type(ResourceArea, Arena)                                     \
diff --git a/src/hotspot/share/runtime/vmThread.cpp b/src/hotspot/share/runtime/vmThread.cpp
index c5710c97bf7..df73d4afb70 100644
--- a/src/hotspot/share/runtime/vmThread.cpp
+++ b/src/hotspot/share/runtime/vmThread.cpp
@@ -105,29 +105,6 @@ VM_Operation* VMOperationQueue::queue_remove_front(int prio) {
   return r;
 }
 
-VM_Operation* VMOperationQueue::queue_drain(int prio) {
-  if (queue_empty(prio)) return NULL;
-  DEBUG_ONLY(int length = _queue_length[prio];);
-  assert(length >= 0, "sanity check");
-  _queue_length[prio] = 0;
-  VM_Operation* r = _queue[prio]->next();
-  assert(r != _queue[prio], "cannot remove base element");
-  // remove links to base element from head and tail
-  r->set_prev(NULL);
-  _queue[prio]->prev()->set_next(NULL);
-  // restore queue to empty state
-  _queue[prio]->set_next(_queue[prio]);
-  _queue[prio]->set_prev(_queue[prio]);
-  assert(queue_empty(prio), "drain corrupted queue");
-#ifdef ASSERT
-  int len = 0;
-  VM_Operation* cur;
-  for(cur = r; cur != NULL; cur=cur->next()) len++;
-  assert(len == length, "drain lost some ops");
-#endif
-  return r;
-}
-
 //-----------------------------------------------------------------
 // High-level interface
 void VMOperationQueue::add(VM_Operation *op) {
@@ -199,7 +176,6 @@ VMThread*         VMThread::_vm_thread          = NULL;
 VM_Operation*     VMThread::_cur_vm_operation   = NULL;
 VMOperationQueue* VMThread::_vm_queue           = NULL;
 PerfCounter*      VMThread::_perf_accumulated_vm_operation_time = NULL;
-uint64_t          VMThread::_coalesced_count = 0;
 VMOperationTimeoutTask* VMThread::_timeout_task = NULL;
 
 
@@ -285,11 +261,10 @@ void VMThread::run() {
   }
 
   if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
-    // AsyncDeflateIdleMonitors does a special deflation at the final
-    // safepoint in order to reduce the in-use monitor population that
-    // is reported by ObjectSynchronizer::log_in_use_monitor_details()
-    // at VM exit.
-    ObjectSynchronizer::set_is_special_deflation_requested(true);
+    // AsyncDeflateIdleMonitors does a special deflation in order
+    // to reduce the in-use monitor population that is reported by
+    // ObjectSynchronizer::log_in_use_monitor_details() at VM exit.
+    ObjectSynchronizer::request_deflate_idle_monitors();
   }
 
   // 4526887 let VM thread exit at Safepoint
@@ -435,7 +410,6 @@ void VMThread::loop() {
   SafepointSynchronize::init(_vm_thread);
 
   while(true) {
-    VM_Operation* safepoint_ops = NULL;
     //
     // Wait for VM operation
     //
@@ -480,13 +454,6 @@ void VMThread::loop() {
           }
         }
         _cur_vm_operation = _vm_queue->remove_next();
-
-        // If we are at a safepoint we will evaluate all the operations that
-        // follow that also require a safepoint
-        if (_cur_vm_operation != NULL &&
-            _cur_vm_operation->evaluate_at_safepoint()) {
-          safepoint_ops = _vm_queue->drain_at_safepoint_priority();
-        }
       }
 
       if (should_terminate()) break;
@@ -512,41 +479,7 @@ void VMThread::loop() {
         }
 
         evaluate_operation(_cur_vm_operation);
-        // now process all queued safepoint ops, iteratively draining
-        // the queue until there are none left
-        do {
-          _cur_vm_operation = safepoint_ops;
-          if (_cur_vm_operation != NULL) {
-            do {
-              EventMark em("Executing coalesced safepoint VM operation: %s", _cur_vm_operation->name());
-              log_debug(vmthread)("Evaluating coalesced safepoint VM operation: %s", _cur_vm_operation->name());
-              // evaluate_operation deletes the op object so we have
-              // to grab the next op now
-              VM_Operation* next = _cur_vm_operation->next();
-              evaluate_operation(_cur_vm_operation);
-              _cur_vm_operation = next;
-              _coalesced_count++;
-            } while (_cur_vm_operation != NULL);
-          }
-          // There is a chance that a thread enqueued a safepoint op
-          // since we released the op-queue lock and initiated the safepoint.
-          // So we drain the queue again if there is anything there, as an
-          // optimization to try and reduce the number of safepoints.
-          // As the safepoint synchronizes us with JavaThreads we will see
-          // any enqueue made by a JavaThread, but the peek will not
-          // necessarily detect a concurrent enqueue by a GC thread, but
-          // that simply means the op will wait for the next major cycle of the
-          // VMThread - just as it would if the GC thread lost the race for
-          // the lock.
-          if (_vm_queue->peek_at_safepoint_priority()) {
-            // must hold lock while draining queue
-            MutexLocker mu_queue(VMOperationQueue_lock,
-                                 Mutex::_no_safepoint_check_flag);
-            safepoint_ops = _vm_queue->drain_at_safepoint_priority();
-          } else {
-            safepoint_ops = NULL;
-          }
-        } while(safepoint_ops != NULL);
+        _cur_vm_operation = NULL;
 
         if (_timeout_task != NULL) {
           _timeout_task->disarm();
diff --git a/src/hotspot/share/runtime/vmThread.hpp b/src/hotspot/share/runtime/vmThread.hpp
index eb5e95eb1f2..0f14ae30ea3 100644
--- a/src/hotspot/share/runtime/vmThread.hpp
+++ b/src/hotspot/share/runtime/vmThread.hpp
@@ -64,7 +64,6 @@ class VMOperationQueue : public CHeapObj<mtInternal> {
   bool queue_empty                (int prio);
   void queue_add                  (int prio, VM_Operation *op);
   VM_Operation* queue_remove_front(int prio);
-  VM_Operation* queue_drain(int prio);
   // lock-free query: may return the wrong answer but must not break
   bool queue_peek(int prio) { return _queue_length[prio] > 0; }
 
@@ -74,7 +73,6 @@ class VMOperationQueue : public CHeapObj<mtInternal> {
   // Highlevel operations. Encapsulates policy
   void add(VM_Operation *op);
   VM_Operation* remove_next();                        // Returns next or null
-  VM_Operation* drain_at_safepoint_priority() { return queue_drain(SafepointPriority); }
   bool peek_at_safepoint_priority() { return queue_peek(SafepointPriority); }
 };
 
@@ -113,7 +111,6 @@ class VMThread: public NamedThread {
   static bool _terminated;
   static Monitor * _terminate_lock;
   static PerfCounter* _perf_accumulated_vm_operation_time;
-  static uint64_t _coalesced_count;
 
   static VMOperationTimeoutTask* _timeout_task;
 
@@ -148,7 +145,6 @@ class VMThread: public NamedThread {
   // Returns the current vm operation if any.
   static VM_Operation* vm_operation()             { return _cur_vm_operation; }
   static VM_Operation::VMOp_Type vm_op_type()     { return _cur_vm_operation->type(); }
-  static uint64_t get_coalesced_count()           { return _coalesced_count; }
 
   // Returns the single instance of VMThread.
   static VMThread* vm_thread()                    { return _vm_thread; }
diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp
index 279b0e292a5..4f86c97333f 100644
--- a/src/hotspot/share/utilities/globalDefinitions.hpp
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp
@@ -432,6 +432,11 @@ inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) {
 #define CAST_TO_FN_PTR(func_type, value) (reinterpret_cast<func_type>(value))
 #define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((address_word)(func_ptr)))
 
+// Need the correct linkage to call qsort without warnings
+extern "C" {
+  typedef int (*_sort_Fn)(const void *, const void *);
+}
+
 // Unsigned byte types for os and stream.hpp
 
 // Unsigned one, two, four and eigth byte quantities used for describing
diff --git a/src/hotspot/share/utilities/growableArray.cpp b/src/hotspot/share/utilities/growableArray.cpp
index 076529897c6..fc0ab6e117e 100644
--- a/src/hotspot/share/utilities/growableArray.cpp
+++ b/src/hotspot/share/utilities/growableArray.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,36 +28,65 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/growableArray.hpp"
 
+void* GrowableArrayResourceAllocator::allocate(int max, int elementSize) {
+  assert(max >= 0, "integer overflow");
+  size_t byte_size = elementSize * (size_t) max;
+
+  return (void*)resource_allocate_bytes(byte_size);
+}
+
+void* GrowableArrayArenaAllocator::allocate(int max, int element_size, Arena* arena) {
+  assert(max >= 0, "integer overflow");
+  size_t byte_size = element_size * (size_t) max;
+
+  return arena->Amalloc(byte_size);
+}
+
+void* GrowableArrayCHeapAllocator::allocate(int max, int element_size, MEMFLAGS memflags) {
+  assert(max >= 0, "integer overflow");
+  size_t byte_size = element_size * (size_t) max;
+
+  // memory type has to be specified for C heap allocation
+  assert(memflags != mtNone, "memory type not specified for C heap object");
+  return (void*)AllocateHeap(byte_size, memflags);
+}
+
+void GrowableArrayCHeapAllocator::deallocate(void* elements) {
+  FreeHeap(elements);
+}
+
 #ifdef ASSERT
-void GenericGrowableArray::set_nesting() {
-  if (on_stack()) {
-    _nesting = Thread::current()->resource_area()->nesting();
-  }
+
+GrowableArrayNestingCheck::GrowableArrayNestingCheck(bool on_stack) :
+    _nesting(on_stack ? Thread::current()->resource_area()->nesting() : 0) {
 }
 
-void GenericGrowableArray::check_nesting() {
+void GrowableArrayNestingCheck::on_stack_alloc() const {
   // Check for insidious allocation bug: if a GrowableArray overflows, the
   // grown array must be allocated under the same ResourceMark as the original.
   // Otherwise, the _data array will be deallocated too early.
-  if (on_stack() &&
-      _nesting != Thread::current()->resource_area()->nesting()) {
+  if (_nesting != Thread::current()->resource_area()->nesting()) {
     fatal("allocation bug: GrowableArray could grow within nested ResourceMark");
   }
 }
-#endif
-
-void* GenericGrowableArray::raw_allocate(int elementSize) {
-  assert(_max >= 0, "integer overflow");
-  size_t byte_size = elementSize * (size_t) _max;
-  if (on_stack()) {
-    return (void*)resource_allocate_bytes(byte_size);
-  } else if (on_C_heap()) {
-    return (void*)AllocateHeap(byte_size, _memflags);
-  } else {
-    return _arena->Amalloc(byte_size);
+
+void GrowableArrayMetadata::init_checks(const GrowableArrayBase* array) const {
+  // Stack allocated arrays support all three element allocation locations
+  if (array->allocated_on_stack()) {
+    return;
   }
+
+  // Otherwise there's a strict one-to-one mapping
+  assert(on_C_heap() == array->allocated_on_C_heap(),
+         "growable array must be C heap allocated if elements are");
+  assert(on_stack() == array->allocated_on_res_area(),
+         "growable array must be resource allocated if elements are");
+  assert(on_arena() == array->allocated_on_arena(),
+         "growable array must be arena allocated if elements are");
 }
 
-void GenericGrowableArray::free_C_heap(void* elements) {
-  FreeHeap(elements);
+void GrowableArrayMetadata::on_stack_alloc_check() const {
+  _nesting_check.on_stack_alloc();
 }
+
+#endif // ASSERT
diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp
index b54a8d84cf6..479e6ecc52a 100644
--- a/src/hotspot/share/utilities/growableArray.hpp
+++ b/src/hotspot/share/utilities/growableArray.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define SHARE_UTILITIES_GROWABLEARRAY_HPP
 
 #include "memory/allocation.hpp"
-#include "oops/oop.hpp"
+#include "memory/iterator.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/ostream.hpp"
@@ -39,7 +39,7 @@
 /*     WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING   */
 /*                                                                       */
 /* Should you use GrowableArrays to contain handles you must be certain  */
-/* the the GrowableArray does not outlive the HandleMark that contains   */
+/* that the GrowableArray does not outlive the HandleMark that contains  */
 /* the handles. Since GrowableArrays are typically resource allocated    */
 /* the following is an example of INCORRECT CODE,                        */
 /*                                                                       */
@@ -59,174 +59,71 @@
 /* }                                                                     */
 /*                                                                       */
 /* If the GrowableArrays you are creating is C_Heap allocated then it    */
-/* hould not old handles since the handles could trivially try and       */
+/* should not hold handles since the handles could trivially try and     */
 /* outlive their HandleMark. In some situations you might need to do     */
 /* this and it would be legal but be very careful and see if you can do  */
 /* the code in some other manner.                                        */
 /*                                                                       */
 /*************************************************************************/
 
-// To call default constructor the placement operator new() is used.
-// It should be empty (it only returns the passed void* pointer).
-// The definition of placement operator new(size_t, void*) in the <new>.
+// Non-template base class responsible for handling the length and max.
 
-#include <new>
 
-// Need the correct linkage to call qsort without warnings
-extern "C" {
-  typedef int (*_sort_Fn)(const void *, const void *);
-}
-
-class GenericGrowableArray : public ResourceObj {
+class GrowableArrayBase : public ResourceObj {
   friend class VMStructs;
 
- protected:
-  int    _len;          // current length
-  int    _max;          // maximum length
-  Arena* _arena;        // Indicates where allocation occurs:
-                        //   0 means default ResourceArea
-                        //   1 means on C heap
-                        //   otherwise, allocate in _arena
-
-  MEMFLAGS   _memflags;   // memory type if allocation in C heap
-
-#ifdef ASSERT
-  int    _nesting;      // resource area nesting at creation
-  void   set_nesting();
-  void   check_nesting();
-#else
-#define  set_nesting();
-#define  check_nesting();
-#endif
-
-  // Where are we going to allocate memory?
-  bool on_C_heap() { return _arena == (Arena*)1; }
-  bool on_stack () { return _arena == NULL;      }
-  bool on_arena () { return _arena >  (Arena*)1;  }
-
-  // This GA will use the resource stack for storage if c_heap==false,
-  // Else it will use the C heap.  Use clear_and_deallocate to avoid leaks.
-  GenericGrowableArray(int initial_size, int initial_len, MEMFLAGS flags) {
-    _len = initial_len;
-    _max = initial_size;
-    _memflags = flags;
+protected:
+  // Current number of accessible elements
+  int _len;
+  // Current number of allocated elements
+  int _max;
 
+  GrowableArrayBase(int initial_max, int initial_len) :
+      _len(initial_len),
+      _max(initial_max) {
     assert(_len >= 0 && _len <= _max, "initial_len too big");
-
-    const bool c_heap = flags != mtNone;
-    _arena = (c_heap ? (Arena*)1 : NULL);
-    set_nesting();
-    assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
-    assert(!on_stack() ||
-           (allocated_on_res_area() || allocated_on_stack()),
-           "growable array must be on stack if elements are not on arena and not on C heap");
   }
 
-  // This GA will use the given arena for storage.
-  // Consider using new(arena) GrowableArray<T> to allocate the header.
-  GenericGrowableArray(Arena* arena, int initial_size, int initial_len) {
-    _len = initial_len;
-    _max = initial_size;
-    assert(_len >= 0 && _len <= _max, "initial_len too big");
-    _arena = arena;
-    _memflags = mtNone;
-
-    assert(on_arena(), "arena has taken on reserved value 0 or 1");
-    // Relax next assert to allow object allocation on resource area,
-    // on stack or embedded into an other object.
-    assert(allocated_on_arena() || allocated_on_stack(),
-           "growable array must be on arena or on stack if elements are on arena");
-  }
-
-  void* raw_allocate(int elementSize);
-
-  void free_C_heap(void* elements);
-};
-
-template<class E> class GrowableArrayIterator;
-template<class E, class UnaryPredicate> class GrowableArrayFilterIterator;
-
-template<class E>
-class CompareClosure : public Closure {
-public:
-    virtual int do_compare(const E&, const E&) = 0;
-};
-
-template<class E> class GrowableArray : public GenericGrowableArray {
-  friend class VMStructs;
-
- private:
-  E*     _data;         // data array
-
-  void grow(int j);
-  void raw_at_put_grow(int i, const E& p, const E& fill);
-  void  clear_and_deallocate();
+  ~GrowableArrayBase() {}
 
 public:
-  GrowableArray(int initial_size, MEMFLAGS F = mtNone)
-    : GenericGrowableArray(initial_size, 0, F) {
-    _data = (E*)raw_allocate(sizeof(E));
-// Needed for Visual Studio 2012 and older
-#ifdef _MSC_VER
-#pragma warning(suppress: 4345)
-#endif
-    for (int i = 0; i < _max; i++) ::new ((void*)&_data[i]) E();
-  }
-
-  GrowableArray(int initial_size, int initial_len, const E& filler, MEMFLAGS memflags = mtNone)
-    : GenericGrowableArray(initial_size, initial_len, memflags) {
-    _data = (E*)raw_allocate(sizeof(E));
-    int i = 0;
-    for (; i < _len; i++) ::new ((void*)&_data[i]) E(filler);
-    for (; i < _max; i++) ::new ((void*)&_data[i]) E();
-  }
-
-  // Watch out, if filler was generated by a constructor, the destuctor might
-  // be called on the original object invalidating all the copies made here.
-  // Carefully design the copy constructor.
-  GrowableArray(Arena* arena, int initial_size, int initial_len, const E& filler) :
-      GenericGrowableArray(arena, initial_size, initial_len) {
-    _data = (E*)raw_allocate(sizeof(E));
-    int i = 0;
-    for (; i < _len; i++) ::new ((void*)&_data[i]) E(filler);
-    for (; i < _max; i++) ::new ((void*)&_data[i]) E();
-  }
-
-  GrowableArray() : GenericGrowableArray(2, 0, mtNone) {
-    _data = (E*)raw_allocate(sizeof(E));
-    ::new ((void*)&_data[0]) E();
-    ::new ((void*)&_data[1]) E();
-  }
-
-                                // Does nothing for resource and arena objects
-  ~GrowableArray()              { if (on_C_heap()) clear_and_deallocate(); }
-
-  void  clear()                 { _len = 0; }
   int   length() const          { return _len; }
   int   max_length() const      { return _max; }
-  void  trunc_to(int l)         { assert(l <= _len,"cannot increase length"); _len = l; }
+
   bool  is_empty() const        { return _len == 0; }
   bool  is_nonempty() const     { return _len != 0; }
   bool  is_full() const         { return _len == _max; }
-  DEBUG_ONLY(E* data_addr() const      { return _data; })
-
-  void print();
 
-  int append(const E& elem) {
-    check_nesting();
-    if (_len == _max) grow(_len);
-    int idx = _len++;
-    _data[idx] = elem;
-    return idx;
+  void  clear()                 { _len = 0; }
+  void  trunc_to(int length)    {
+    assert(length <= _len,"cannot increase length");
+    _len = length;
   }
+};
 
-  bool append_if_missing(const E& elem) {
-    // Returns TRUE if elem is added.
-    bool missed = !contains(elem);
-    if (missed) append(elem);
-    return missed;
-  }
+template <typename E> class GrowableArrayIterator;
+template <typename E, typename UnaryPredicate> class GrowableArrayFilterIterator;
+
+// Extends GrowableArrayBase with a typed data array.
+//
+// E: Element type
+//
+// The "view" adds function that don't grow or deallocate
+// the _data array, so there's no need for an allocator.
+//
+// The "view" can be used to type erase the allocator classes
+// of GrowableArrayWithAllocator.
+template <typename E>
+class GrowableArrayView : public GrowableArrayBase {
+protected:
+  E* _data; // data array
 
+  GrowableArrayView<E>(E* data, int initial_max, int initial_len) :
+      GrowableArrayBase(initial_max, initial_len), _data(data) {}
+
+  ~GrowableArrayView() {}
+
+public:
   E& at(int i) {
     assert(0 <= i && i < _len, "illegal index");
     return _data[i];
@@ -264,8 +161,6 @@ template<class E> class GrowableArray : public GenericGrowableArray {
     return GrowableArrayIterator<E>(this, length());
   }
 
-  void push(const E& elem) { append(elem); }
-
   E pop() {
     assert(_len > 0, "empty list");
     return _data[--_len];
@@ -276,24 +171,6 @@ template<class E> class GrowableArray : public GenericGrowableArray {
     _data[i] = elem;
   }
 
-  E at_grow(int i, const E& fill = E()) {
-    assert(0 <= i, "negative index");
-    check_nesting();
-    if (i >= _len) {
-      if (i >= _max) grow(i);
-      for (int j = _len; j <= i; j++)
-        _data[j] = fill;
-      _len = i+1;
-    }
-    return _data[i];
-  }
-
-  void at_put_grow(int i, const E& elem, const E& fill = E()) {
-    assert(0 <= i, "negative index");
-    check_nesting();
-    raw_at_put_grow(i, elem, fill);
-  }
-
   bool contains(const E& elem) const {
     for (int i = 0; i < _len; i++) {
       if (_data[i] == elem) return true;
@@ -357,63 +234,14 @@ template<class E> class GrowableArray : public GenericGrowableArray {
     }
   }
 
-  // inserts the given element before the element at index i
-  void insert_before(const int idx, const E& elem) {
-    assert(0 <= idx && idx <= _len, "illegal index");
-    check_nesting();
-    if (_len == _max) grow(_len);
-    for (int j = _len - 1; j >= idx; j--) {
-      _data[j + 1] = _data[j];
-    }
-    _len++;
-    _data[idx] = elem;
-  }
-
-  void insert_before(const int idx, const GrowableArray<E>* array) {
-    assert(0 <= idx && idx <= _len, "illegal index");
-    check_nesting();
-    int array_len = array->length();
-    int new_len = _len + array_len;
-    if (new_len >= _max) grow(new_len);
-
-    for (int j = _len - 1; j >= idx; j--) {
-      _data[j + array_len] = _data[j];
-    }
-
-    for (int j = 0; j < array_len; j++) {
-      _data[idx + j] = array->_data[j];
-    }
-
-    _len += array_len;
-  }
-
-  void appendAll(const GrowableArray<E>* l) {
-    for (int i = 0; i < l->_len; i++) {
-      raw_at_put_grow(_len, l->_data[i], E());
-    }
-  }
-
-  void sort(int f(E*,E*)) {
+  void sort(int f(E*, E*)) {
     qsort(_data, length(), sizeof(E), (_sort_Fn)f);
   }
   // sort by fixed-stride sub arrays:
-  void sort(int f(E*,E*), int stride) {
+  void sort(int f(E*, E*), int stride) {
     qsort(_data, length() / stride, sizeof(E) * stride, (_sort_Fn)f);
   }
 
-  // Binary search and insertion utility.  Search array for element
-  // matching key according to the static compare function.  Insert
-  // that element is not already in the list.  Assumes the list is
-  // already sorted according to compare function.
-  template <int compare(const E&, const E&)> E insert_sorted(const E& key) {
-    bool found;
-    int location = find_sorted<E, compare>(key, found);
-    if (!found) {
-      insert_before(location, key);
-    }
-    return at(location);
-  }
-
   template <typename K, int compare(const K&, const E&)> int find_sorted(const K& key, bool& found) {
     found = false;
     int min = 0;
@@ -435,16 +263,7 @@ template<class E> class GrowableArray : public GenericGrowableArray {
     return min;
   }
 
-  E insert_sorted(CompareClosure<E>* cc, const E& key) {
-    bool found;
-    int location = find_sorted(cc, key, found);
-    if (!found) {
-      insert_before(location, key);
-    }
-    return at(location);
-  }
-
-  template<typename K>
+  template <typename K>
   int find_sorted(CompareClosure<E>* cc, const K& key, bool& found) {
     found = false;
     int min = 0;
@@ -465,80 +284,442 @@ template<class E> class GrowableArray : public GenericGrowableArray {
     }
     return min;
   }
+
+  void print() {
+    tty->print("Growable Array " INTPTR_FORMAT, this);
+    tty->print(": length %ld (_max %ld) { ", _len, _max);
+    for (int i = 0; i < _len; i++) {
+      tty->print(INTPTR_FORMAT " ", *(intptr_t*)&(_data[i]));
+    }
+    tty->print("}\n");
+  }
 };
 
-// Global GrowableArray methods (one instance in the library per each 'E' type).
+// GrowableArrayWithAllocator extends the "view" with
+// the capability to grow and deallocate the data array.
+//
+// The allocator responsibility is delegated to the sub-class.
+//
+// Derived: The sub-class responsible for allocation / deallocation
+//  - E* Derived::allocate()       - member function responsible for allocation
+//  - void Derived::deallocate(E*) - member function responsible for deallocation
+template <typename E, typename Derived>
+class GrowableArrayWithAllocator : public GrowableArrayView<E> {
+  friend class VMStructs;
 
-template<class E> void GrowableArray<E>::grow(int j) {
-    int old_max = _max;
-    // grow the array by increasing _max to the first power of two larger than the size we need
-    _max = next_power_of_2((uint32_t)j);
-    // j < _max
-    E* newData = (E*)raw_allocate(sizeof(E));
+  void grow(int j);
+
+protected:
+  GrowableArrayWithAllocator(E* data, int initial_max) :
+      GrowableArrayView<E>(data, initial_max, 0) {
+    for (int i = 0; i < initial_max; i++) {
+      ::new ((void*)&data[i]) E();
+    }
+  }
+
+  GrowableArrayWithAllocator(E* data, int initial_max, int initial_len, const E& filler) :
+      GrowableArrayView<E>(data, initial_max, initial_len) {
     int i = 0;
-    for (     ; i < _len; i++) ::new ((void*)&newData[i]) E(_data[i]);
-// Needed for Visual Studio 2012 and older
-#ifdef _MSC_VER
-#pragma warning(suppress: 4345)
-#endif
-    for (     ; i < _max; i++) ::new ((void*)&newData[i]) E();
-    for (i = 0; i < old_max; i++) _data[i].~E();
-    if (on_C_heap() && _data != NULL) {
-      free_C_heap(_data);
+    for (; i < initial_len; i++) {
+      ::new ((void*)&data[i]) E(filler);
     }
-    _data = newData;
-}
+    for (; i < initial_max; i++) {
+      ::new ((void*)&data[i]) E();
+    }
+  }
 
-template<class E> void GrowableArray<E>::raw_at_put_grow(int i, const E& p, const E& fill) {
-    if (i >= _len) {
-      if (i >= _max) grow(i);
-      for (int j = _len; j < i; j++)
-        _data[j] = fill;
-      _len = i+1;
+  ~GrowableArrayWithAllocator() {}
+
+public:
+  int append(const E& elem) {
+    if (this->_len == this->_max) grow(this->_len);
+    int idx = this->_len++;
+    this->_data[idx] = elem;
+    return idx;
+  }
+
+  bool append_if_missing(const E& elem) {
+    // Returns TRUE if elem is added.
+    bool missed = !this->contains(elem);
+    if (missed) append(elem);
+    return missed;
+  }
+
+  void push(const E& elem) { append(elem); }
+
+  E at_grow(int i, const E& fill = E()) {
+    assert(0 <= i, "negative index");
+    if (i >= this->_len) {
+      if (i >= this->_max) grow(i);
+      for (int j = this->_len; j <= i; j++)
+        this->_data[j] = fill;
+      this->_len = i+1;
     }
-    _data[i] = p;
-}
+    return this->_data[i];
+  }
 
-// This function clears and deallocate the data in the growable array that
-// has been allocated on the C heap.  It's not public - called by the
-// destructor.
-template<class E> void GrowableArray<E>::clear_and_deallocate() {
-    assert(on_C_heap(),
-           "clear_and_deallocate should only be called when on C heap");
-    clear();
-    if (_data != NULL) {
-      for (int i = 0; i < _max; i++) _data[i].~E();
-      free_C_heap(_data);
-      _data = NULL;
+  void at_put_grow(int i, const E& elem, const E& fill = E()) {
+    assert(0 <= i, "negative index");
+    if (i >= this->_len) {
+      if (i >= this->_max) grow(i);
+      for (int j = this->_len; j < i; j++)
+        this->_data[j] = fill;
+      this->_len = i+1;
     }
+    this->_data[i] = elem;
+  }
+
+  // inserts the given element before the element at index i
+  void insert_before(const int idx, const E& elem) {
+    assert(0 <= idx && idx <= this->_len, "illegal index");
+    if (this->_len == this->_max) grow(this->_len);
+    for (int j = this->_len - 1; j >= idx; j--) {
+      this->_data[j + 1] = this->_data[j];
+    }
+    this->_len++;
+    this->_data[idx] = elem;
+  }
+
+  void insert_before(const int idx, const GrowableArrayView<E>* array) {
+    assert(0 <= idx && idx <= this->_len, "illegal index");
+    int array_len = array->length();
+    int new_len = this->_len + array_len;
+    if (new_len >= this->_max) grow(new_len);
+
+    for (int j = this->_len - 1; j >= idx; j--) {
+      this->_data[j + array_len] = this->_data[j];
+    }
+
+    for (int j = 0; j < array_len; j++) {
+      this->_data[idx + j] = array->at(j);
+    }
+
+    this->_len += array_len;
+  }
+
+  void appendAll(const GrowableArrayView<E>* l) {
+    for (int i = 0; i < l->length(); i++) {
+      this->at_put_grow(this->_len, l->at(i), E());
+    }
+  }
+
+  // Binary search and insertion utility.  Search array for element
+  // matching key according to the static compare function.  Insert
+  // that element is not already in the list.  Assumes the list is
+  // already sorted according to compare function.
+  template <int compare(const E&, const E&)> E insert_sorted(const E& key) {
+    bool found;
+    int location = GrowableArrayView<E>::template find_sorted<E, compare>(key, found);
+    if (!found) {
+      insert_before(location, key);
+    }
+    return this->at(location);
+  }
+
+  E insert_sorted(CompareClosure<E>* cc, const E& key) {
+    bool found;
+    int location = find_sorted(cc, key, found);
+    if (!found) {
+      insert_before(location, key);
+    }
+    return this->at(location);
+  }
+
+  void clear_and_deallocate();
+};
+
+template <typename E, typename Derived>
+void GrowableArrayWithAllocator<E, Derived>::grow(int j) {
+  int old_max = this->_max;
+  // grow the array by increasing _max to the first power of two larger than the size we need
+  this->_max = next_power_of_2((uint32_t)j);
+  // j < _max
+  E* newData = static_cast<Derived*>(this)->allocate();
+  int i = 0;
+  for (     ; i < this->_len; i++) ::new ((void*)&newData[i]) E(this->_data[i]);
+  for (     ; i < this->_max; i++) ::new ((void*)&newData[i]) E();
+  for (i = 0; i < old_max; i++) this->_data[i].~E();
+  if (this->_data != NULL) {
+    static_cast<Derived*>(this)->deallocate(this->_data);
+  }
+  this->_data = newData;
 }
 
-template<class E> void GrowableArray<E>::print() {
-    tty->print("Growable Array " INTPTR_FORMAT, this);
-    tty->print(": length %ld (_max %ld) { ", _len, _max);
-    for (int i = 0; i < _len; i++) tty->print(INTPTR_FORMAT " ", *(intptr_t*)&(_data[i]));
-    tty->print("}\n");
+template <typename E, typename Derived>
+void GrowableArrayWithAllocator<E, Derived>::clear_and_deallocate() {
+  if (this->_data != NULL) {
+    for (int i = 0; i < this->_max; i++) {
+      this->_data[i].~E();
+    }
+    static_cast<Derived*>(this)->deallocate(this->_data);
+    this->_data = NULL;
+  }
+  this->_len = 0;
+  this->_max = 0;
 }
 
+class GrowableArrayResourceAllocator {
+public:
+  static void* allocate(int max, int element_size);
+};
+
+// Arena allocator
+class GrowableArrayArenaAllocator {
+public:
+  static void* allocate(int max, int element_size, Arena* arena);
+};
+
+// CHeap allocator
+class GrowableArrayCHeapAllocator {
+public:
+  static void* allocate(int max, int element_size, MEMFLAGS memflags);
+  static void deallocate(void* mem);
+};
+
+#ifdef ASSERT
+
+// Checks resource allocation nesting
+class GrowableArrayNestingCheck {
+  // resource area nesting at creation
+  int _nesting;
+
+public:
+  GrowableArrayNestingCheck(bool on_stack);
+
+  void on_stack_alloc() const;
+};
+
+#endif // ASSERT
+
+// Encodes where the backing array is allocated
+// and performs necessary checks.
+class GrowableArrayMetadata {
+  uintptr_t _bits;
+
+  // resource area nesting at creation
+  debug_only(GrowableArrayNestingCheck _nesting_check;)
+
+  uintptr_t bits(MEMFLAGS memflags) const {
+    if (memflags == mtNone) {
+      // Stack allocation
+      return 0;
+    }
+
+    // CHeap allocation
+    return (uintptr_t(memflags) << 1) | 1;
+  }
+
+  uintptr_t bits(Arena* arena) const {
+    return uintptr_t(arena);
+  }
+
+public:
+  GrowableArrayMetadata(Arena* arena) :
+      _bits(bits(arena))
+      debug_only(COMMA _nesting_check(on_stack())) {
+  }
+
+  GrowableArrayMetadata(MEMFLAGS memflags) :
+      _bits(bits(memflags))
+      debug_only(COMMA _nesting_check(on_stack())) {
+  }
+
+#ifdef ASSERT
+  GrowableArrayMetadata(const GrowableArrayMetadata& other) :
+      _bits(other._bits),
+      _nesting_check(other._nesting_check) {
+    assert(!on_C_heap(), "Copying of CHeap arrays not supported");
+    assert(!other.on_C_heap(), "Copying of CHeap arrays not supported");
+  }
+
+  GrowableArrayMetadata& operator=(const GrowableArrayMetadata& other) {
+    _bits = other._bits;
+    _nesting_check = other._nesting_check;
+    assert(!on_C_heap(), "Assignment of CHeap arrays not supported");
+    assert(!other.on_C_heap(), "Assignment of CHeap arrays not supported");
+    return *this;
+  }
+
+  void init_checks(const GrowableArrayBase* array) const;
+  void on_stack_alloc_check() const;
+#endif // ASSERT
+
+  bool on_C_heap() const { return (_bits & 1) == 1; }
+  bool on_stack () const { return _bits == 0;      }
+  bool on_arena () const { return (_bits & 1) == 0 && _bits != 0; }
+
+  Arena* arena() const      { return (Arena*)_bits; }
+  MEMFLAGS memflags() const { return MEMFLAGS(_bits >> 1); }
+};
+
+// THE GrowableArray.
+//
+// Supports multiple allocation strategies:
+//  - Resource stack allocation: if memflags == mtNone
+//  - CHeap allocation: if memflags != mtNone
+//  - Arena allocation: if an arena is provided
+//
+// There are some drawbacks of using GrowableArray, that are removed in some
+// of the other implementations of GrowableArrayWithAllocator sub-classes:
+//
+// Memory overhead: The multiple allocation strategies uses extra metadata
+//  embedded in the instance.
+//
+// Strict allocation locations: There are rules about where the GrowableArray
+//  instance is allocated, that depends on where the data array is allocated.
+//  See: init_checks.
+
+template <typename E>
+class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
+  friend class GrowableArrayWithAllocator<E, GrowableArray<E> >;
+  friend class GrowableArrayTest;
+
+  static E* allocate(int max) {
+    return (E*)GrowableArrayResourceAllocator::allocate(max, sizeof(E));
+  }
+
+  static E* allocate(int max, MEMFLAGS memflags) {
+    if (memflags != mtNone) {
+      return (E*)GrowableArrayCHeapAllocator::allocate(max, sizeof(E), memflags);
+    }
+
+    return (E*)GrowableArrayResourceAllocator::allocate(max, sizeof(E));
+  }
+
+  static E* allocate(int max, Arena* arena) {
+    return (E*)GrowableArrayArenaAllocator::allocate(max, sizeof(E), arena);
+  }
+
+  GrowableArrayMetadata _metadata;
+
+  void init_checks() const { debug_only(_metadata.init_checks(this);) }
+
+  // Where are we going to allocate memory?
+  bool on_C_heap() const { return _metadata.on_C_heap(); }
+  bool on_stack () const { return _metadata.on_stack(); }
+  bool on_arena () const { return _metadata.on_arena(); }
+
+  E* allocate() {
+    if (on_stack()) {
+      debug_only(_metadata.on_stack_alloc_check());
+      return allocate(this->_max);
+    }
+
+    if (on_C_heap()) {
+      return allocate(this->_max, _metadata.memflags());
+    }
+
+    assert(on_arena(), "Sanity");
+    return allocate(this->_max, _metadata.arena());
+  }
+
+  void deallocate(E* mem) {
+    if (on_C_heap()) {
+      GrowableArrayCHeapAllocator::deallocate(mem);
+    }
+  }
+
+public:
+  GrowableArray(int initial_max = 2, MEMFLAGS memflags = mtNone) :
+      GrowableArrayWithAllocator<E, GrowableArray<E> >(
+          allocate(initial_max, memflags),
+          initial_max),
+      _metadata(memflags) {
+    init_checks();
+  }
+
+  GrowableArray(int initial_max, int initial_len, const E& filler, MEMFLAGS memflags = mtNone) :
+      GrowableArrayWithAllocator<E, GrowableArray<E> >(
+          allocate(initial_max, memflags),
+          initial_max, initial_len, filler),
+      _metadata(memflags) {
+    init_checks();
+  }
+
+  GrowableArray(Arena* arena, int initial_max, int initial_len, const E& filler) :
+      GrowableArrayWithAllocator<E, GrowableArray<E> >(
+          allocate(initial_max, arena),
+          initial_max, initial_len, filler),
+      _metadata(arena) {
+    init_checks();
+  }
+
+  ~GrowableArray() {
+    if (on_C_heap()) {
+      this->clear_and_deallocate();
+    }
+  }
+};
+
+// Leaner GrowableArray for CHeap backed data arrays, with compile-time decided MEMFLAGS.
+template <typename E, MEMFLAGS F>
+class GrowableArrayCHeap : public GrowableArrayWithAllocator<E, GrowableArrayCHeap<E, F> > {
+  friend class GrowableArrayWithAllocator<E, GrowableArrayCHeap<E, F> >;
+
+  STATIC_ASSERT(F != mtNone);
+
+  static E* allocate(int max, MEMFLAGS flags) {
+    if (max == 0) {
+      return NULL;
+    }
+
+    return (E*)GrowableArrayCHeapAllocator::allocate(max, sizeof(E), flags);
+  }
+
+  NONCOPYABLE(GrowableArrayCHeap);
+
+  E* allocate() {
+    return allocate(this->_max, F);
+  }
+
+  void deallocate(E* mem) {
+    GrowableArrayCHeapAllocator::deallocate(mem);
+  }
+
+public:
+  GrowableArrayCHeap(int initial_max) :
+      GrowableArrayWithAllocator<E, GrowableArrayCHeap<E, F> >(
+          allocate(initial_max, F),
+          initial_max) {}
+
+  GrowableArrayCHeap(int initial_max, int initial_len, const E& filler) :
+      GrowableArrayWithAllocator<E, GrowableArrayCHeap<E, F> >(
+          allocate(initial_max, F),
+          initial_max, initial_len, filler) {}
+
+  ~GrowableArrayCHeap() {
+    this->clear_and_deallocate();
+  }
+
+  void* operator new(size_t size) throw() {
+    return ResourceObj::operator new(size, ResourceObj::C_HEAP, F);
+  }
+
+  void* operator new(size_t size, const std::nothrow_t&  nothrow_constant) throw() {
+    return ResourceObj::operator new(size, nothrow_constant, ResourceObj::C_HEAP, F);
+  }
+};
+
 // Custom STL-style iterator to iterate over GrowableArrays
 // It is constructed by invoking GrowableArray::begin() and GrowableArray::end()
-template<class E> class GrowableArrayIterator : public StackObj {
-  friend class GrowableArray<E>;
-  template<class F, class UnaryPredicate> friend class GrowableArrayFilterIterator;
+template <typename E>
+class GrowableArrayIterator : public StackObj {
+  friend class GrowableArrayView<E>;
+  template <typename F, typename UnaryPredicate> friend class GrowableArrayFilterIterator;
 
  private:
-  const GrowableArray<E>* _array; // GrowableArray we iterate over
-  int _position;                  // The current position in the GrowableArray
+  const GrowableArrayView<E>* _array; // GrowableArray we iterate over
+  int _position;                      // The current position in the GrowableArray
 
   // Private constructor used in GrowableArray::begin() and GrowableArray::end()
-  GrowableArrayIterator(const GrowableArray<E>* array, int position) : _array(array), _position(position) {
+  GrowableArrayIterator(const GrowableArrayView<E>* array, int position) : _array(array), _position(position) {
     assert(0 <= position && position <= _array->length(), "illegal position");
   }
 
  public:
   GrowableArrayIterator() : _array(NULL), _position(0) { }
-  GrowableArrayIterator<E>& operator++()  { ++_position; return *this; }
-  E operator*()                           { return _array->at(_position); }
+  GrowableArrayIterator<E>& operator++() { ++_position; return *this; }
+  E operator*()                          { return _array->at(_position); }
 
   bool operator==(const GrowableArrayIterator<E>& rhs)  {
     assert(_array == rhs._array, "iterator belongs to different array");
@@ -552,17 +733,18 @@ template<class E> class GrowableArrayIterator : public StackObj {
 };
 
 // Custom STL-style iterator to iterate over elements of a GrowableArray that satisfy a given predicate
-template<class E, class UnaryPredicate> class GrowableArrayFilterIterator : public StackObj {
-  friend class GrowableArray<E>;
+template <typename E, class UnaryPredicate>
+class GrowableArrayFilterIterator : public StackObj {
+  friend class GrowableArrayView<E>;
 
  private:
-  const GrowableArray<E>* _array;   // GrowableArray we iterate over
-  int _position;                    // Current position in the GrowableArray
-  UnaryPredicate _predicate;        // Unary predicate the elements of the GrowableArray should satisfy
+  const GrowableArrayView<E>* _array; // GrowableArray we iterate over
+  int _position;                      // Current position in the GrowableArray
+  UnaryPredicate _predicate;          // Unary predicate the elements of the GrowableArray should satisfy
 
  public:
-  GrowableArrayFilterIterator(const GrowableArrayIterator<E>& begin, UnaryPredicate filter_predicate)
-   : _array(begin._array), _position(begin._position), _predicate(filter_predicate) {
+  GrowableArrayFilterIterator(const GrowableArrayIterator<E>& begin, UnaryPredicate filter_predicate) :
+      _array(begin._array), _position(begin._position), _predicate(filter_predicate) {
     // Advance to first element satisfying the predicate
     while(_position != _array->length() && !_predicate(_array->at(_position))) {
       ++_position;
@@ -577,7 +759,7 @@ template<class E, class UnaryPredicate> class GrowableArrayFilterIterator : publ
     return *this;
   }
 
-  E operator*()   { return _array->at(_position); }
+  E operator*() { return _array->at(_position); }
 
   bool operator==(const GrowableArrayIterator<E>& rhs)  {
     assert(_array == rhs._array, "iterator belongs to different array");
diff --git a/src/hotspot/share/utilities/hashtable.cpp b/src/hotspot/share/utilities/hashtable.cpp
index 7e47c9cc72a..4ce5b306edb 100644
--- a/src/hotspot/share/utilities/hashtable.cpp
+++ b/src/hotspot/share/utilities/hashtable.cpp
@@ -67,7 +67,7 @@ template <MEMFLAGS F> BasicHashtableEntry<F>* BasicHashtable<F>::new_entry(unsig
       len = 1 << log2_int(len); // round down to power of 2
       assert(len >= _entry_size, "");
       _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC);
-      _entry_blocks->append(_first_free_entry);
+      _entry_blocks.append(_first_free_entry);
       _end_block = _first_free_entry + len;
     }
     entry = (BasicHashtableEntry<F>*)_first_free_entry;
@@ -128,7 +128,7 @@ static int literal_size(oop obj) {
   }
 }
 
-static int literal_size(WeakHandle<vm_weak_data> v) {
+static int literal_size(WeakHandle v) {
   return literal_size(v.peek());
 }
 
@@ -223,7 +223,7 @@ template <class T> void print_literal(T l) {
   l->print();
 }
 
-static void print_literal(WeakHandle<vm_weak_data> l) {
+static void print_literal(WeakHandle l) {
   l.print();
 }
 
@@ -287,14 +287,13 @@ template class Hashtable<ConstantPool*, mtClass>;
 template class Hashtable<Symbol*, mtSymbol>;
 template class Hashtable<Klass*, mtClass>;
 template class Hashtable<InstanceKlass*, mtClass>;
-template class Hashtable<WeakHandle<vm_weak_data>, mtClass>;
+template class Hashtable<WeakHandle, mtClass>;
 template class Hashtable<Symbol*, mtModule>;
 template class Hashtable<oop, mtSymbol>;
 template class Hashtable<Symbol*, mtClass>;
 template class HashtableEntry<Symbol*, mtSymbol>;
 template class HashtableEntry<Symbol*, mtClass>;
 template class HashtableEntry<oop, mtSymbol>;
-template class HashtableEntry<WeakHandle<vm_weak_data>, mtClass>;
 template class HashtableBucket<mtClass>;
 template class BasicHashtableEntry<mtSymbol>;
 template class BasicHashtableEntry<mtCode>;
diff --git a/src/hotspot/share/utilities/hashtable.hpp b/src/hotspot/share/utilities/hashtable.hpp
index fa4b8d6f421..a9b7ddbd15a 100644
--- a/src/hotspot/share/utilities/hashtable.hpp
+++ b/src/hotspot/share/utilities/hashtable.hpp
@@ -158,14 +158,14 @@ template <MEMFLAGS F> class BasicHashtable : public CHeapObj<F> {
 
 private:
   // Instance variables
-  int               _table_size;
-  HashtableBucket<F>*     _buckets;
+  int                              _table_size;
+  HashtableBucket<F>*              _buckets;
   BasicHashtableEntry<F>* volatile _free_list;
-  char*             _first_free_entry;
-  char*             _end_block;
-  int               _entry_size;
-  volatile int      _number_of_entries;
-  GrowableArray<char*>* _entry_blocks;
+  char*                            _first_free_entry;
+  char*                            _end_block;
+  int                              _entry_size;
+  volatile int                     _number_of_entries;
+  GrowableArrayCHeap<char*, F>     _entry_blocks;
 
 protected:
 
diff --git a/src/hotspot/share/utilities/hashtable.inline.hpp b/src/hotspot/share/utilities/hashtable.inline.hpp
index 11c5d33719b..a106f31c8fe 100644
--- a/src/hotspot/share/utilities/hashtable.inline.hpp
+++ b/src/hotspot/share/utilities/hashtable.inline.hpp
@@ -36,7 +36,8 @@
 
 // Initialize a table.
 
-template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size) {
+template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size) :
+    _entry_blocks(4) {
   // Called on startup, no locking needed
   initialize(table_size, entry_size, 0);
   _buckets = NEW_C_HEAP_ARRAY2(HashtableBucket<F>, table_size, F, CURRENT_PC);
@@ -49,7 +50,8 @@ template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, i
 
 template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, int entry_size,
                                       HashtableBucket<F>* buckets,
-                                      int number_of_entries) {
+                                      int number_of_entries) :
+    _entry_blocks(4) {
   // Called on startup, no locking needed
   initialize(table_size, entry_size, number_of_entries);
   _buckets = buckets;
@@ -57,10 +59,9 @@ template <MEMFLAGS F> inline BasicHashtable<F>::BasicHashtable(int table_size, i
 }
 
 template <MEMFLAGS F> inline BasicHashtable<F>::~BasicHashtable() {
-  for (int i = 0; i < _entry_blocks->length(); i++) {
-    FREE_C_HEAP_ARRAY(char, _entry_blocks->at(i));
+  for (int i = 0; i < _entry_blocks.length(); i++) {
+    FREE_C_HEAP_ARRAY(char, _entry_blocks.at(i));
   }
-  delete _entry_blocks;
   free_buckets();
 }
 
@@ -73,7 +74,6 @@ template <MEMFLAGS F> inline void BasicHashtable<F>::initialize(int table_size,
   _first_free_entry = NULL;
   _end_block = NULL;
   _number_of_entries = number_of_entries;
-  _entry_blocks = new(ResourceObj::C_HEAP, F) GrowableArray<char*>(4, F);
 }
 
 
diff --git a/src/hotspot/share/utilities/macros.hpp b/src/hotspot/share/utilities/macros.hpp
index b048ac035e6..e78f63f1415 100644
--- a/src/hotspot/share/utilities/macros.hpp
+++ b/src/hotspot/share/utilities/macros.hpp
@@ -367,14 +367,6 @@
 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
 #endif // CHECK_UNHANDLED_OOPS
 
-#ifdef CC_INTERP
-#define CC_INTERP_ONLY(code) code
-#define NOT_CC_INTERP(code)
-#else
-#define CC_INTERP_ONLY(code)
-#define NOT_CC_INTERP(code) code
-#endif // CC_INTERP
-
 #ifdef ASSERT
 #define DEBUG_ONLY(code) code
 #define NOT_DEBUG(code)
@@ -450,9 +442,11 @@
 #if defined(ZERO)
 #define ZERO_ONLY(code) code
 #define NOT_ZERO(code)
+#define NOT_ZERO_RETURN {}
 #else
 #define ZERO_ONLY(code)
 #define NOT_ZERO(code) code
+#define NOT_ZERO_RETURN
 #endif
 
 #if defined(IA32) || defined(AMD64)
diff --git a/src/hotspot/share/utilities/stack.hpp b/src/hotspot/share/utilities/stack.hpp
index 0b3d6ef921b..cca1c4fd57a 100644
--- a/src/hotspot/share/utilities/stack.hpp
+++ b/src/hotspot/share/utilities/stack.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -85,10 +85,6 @@ template <MEMFLAGS F> class StackBase
   size_t       _cache_size;     // Number of segments in the cache.
 };
 
-#ifdef __GNUC__
-#define inline
-#endif // __GNUC__
-
 template <class E, MEMFLAGS F>
 class Stack:  public StackBase<F>
 {
@@ -207,8 +203,4 @@ class StackIterator: public StackObj
   size_t    _full_seg_size;
 };
 
-#ifdef __GNUC__
-#undef inline
-#endif // __GNUC__
-
 #endif // SHARE_UTILITIES_STACK_HPP
diff --git a/src/hotspot/share/utilities/stack.inline.hpp b/src/hotspot/share/utilities/stack.inline.hpp
index 7c086beb78b..4502a8ac84d 100644
--- a/src/hotspot/share/utilities/stack.inline.hpp
+++ b/src/hotspot/share/utilities/stack.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -61,23 +61,27 @@ template <class E, MEMFLAGS F>
 void Stack<E, F>::push(E item)
 {
   assert(!is_full(), "pushing onto a full stack");
-  if (this->_cur_seg_size == this->_seg_size) {
+  size_t index = this->_cur_seg_size;
+  if (index == this->_seg_size) {
     push_segment();
+    index = 0;                  // Instead of fetching known zero _cur_seg_size.
   }
-  this->_cur_seg[this->_cur_seg_size] = item;
-  ++this->_cur_seg_size;
+  this->_cur_seg[index] = item;
+  this->_cur_seg_size = index + 1;
 }
 
 template <class E, MEMFLAGS F>
 E Stack<E, F>::pop()
 {
   assert(!is_empty(), "popping from an empty stack");
-  if (this->_cur_seg_size == 1) {
-    E tmp = _cur_seg[--this->_cur_seg_size];
-    pop_segment();
-    return tmp;
-  }
-  return this->_cur_seg[--this->_cur_seg_size];
+  // _cur_seg_size is never 0 if not empty.  pop that empties a
+  // segment also pops the segment.  push that adds a segment always
+  // adds an entry to the new segment.
+  assert(this->_cur_seg_size != 0, "invariant");
+  size_t index = --this->_cur_seg_size;
+  E result = _cur_seg[index];
+  if (index == 0) pop_segment();
+  return result;
 }
 
 template <class E, MEMFLAGS F>
@@ -145,9 +149,8 @@ void Stack<E, F>::free(E* addr, size_t bytes)
 
 // Stack is used by the GC code and in some hot paths a lot of the Stack
 // code gets inlined. This is generally good, but when too much code has
-// been inlined, no further inlining is allowed by GCC. Therefore we need
-// to prevent parts of the slow path in Stack to be inlined to allow other
-// code to be.
+// been inlined, further inlining in the caller might be inhibited. So
+// prevent infrequent slow path segment manipulation from being inlined.
 template <class E, MEMFLAGS F>
 NOINLINE void Stack<E, F>::push_segment()
 {
@@ -170,7 +173,7 @@ NOINLINE void Stack<E, F>::push_segment()
 }
 
 template <class E, MEMFLAGS F>
-void Stack<E, F>::pop_segment()
+NOINLINE void Stack<E, F>::pop_segment()
 {
   assert(this->_cur_seg_size == 0, "current segment is not empty");
   E* const prev = get_link(_cur_seg);
diff --git a/src/hotspot/share/utilities/tribool.hpp b/src/hotspot/share/utilities/tribool.hpp
new file mode 100644
index 00000000000..7d5c19d18f5
--- /dev/null
+++ b/src/hotspot/share/utilities/tribool.hpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright Amazon.com Inc. 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_TRIBOOL_HPP
+#define SHARE_UTILITIES_TRIBOOL_HPP
+
+#include "utilities/globalDefinitions.hpp"
+
+// 2-bit boolean type: H|L
+// the high-bit H is set if it's not default value.
+// the low-bit L represents true and false.
+class TriBool{
+  template <size_t SZ, typename T>
+  friend class TriBoolArray;
+
+ private:
+  unsigned int _value : 2;
+  explicit TriBool(u1 raw) : _value(raw & 3) {}
+
+ public:
+  TriBool() : _value(0) {}
+  TriBool(bool value) : _value(((u1)value) | 2) {}
+  TriBool(const TriBool& o): _value(o._value) {}
+
+  TriBool& operator=(bool value) {
+    _value = ((u1)value) | 2;
+    return *this;
+  }
+
+  TriBool& operator=(const TriBool& o) {
+    _value = o._value;
+    return *this;
+  }
+
+  bool is_default() const {
+    return !static_cast<bool>(_value >> 1);
+  }
+
+  /*explicit*/ operator bool() const {
+    return (_value & 1);
+  }
+};
+
+// compacted array of TriBool
+template <size_t SZ, typename T>
+class TriBoolArray {
+ private:
+  class TriBoolAssigner : public TriBool {
+   public:
+    TriBoolAssigner(T& slot, size_t offset) : TriBool(static_cast<u1>(slot >> offset)),
+                                              _slot(slot), _offset(offset) {}
+
+    TriBoolAssigner& operator=(bool newval) {
+      _slot ^= ((u1)_value) << _offset;  // reset the tribool
+      _value = (u1)newval| 2;
+      _slot |= ((u1)_value) << _offset;
+      return *this;
+    };
+
+    TriBoolAssigner& operator=(TriBool tb) {
+      _slot ^= ((u1)_value) << _offset;  // reset the tribool
+      _value = (u1)tb._value;
+      _slot |= ((u1)_value) << _offset;
+      return *this;
+    }
+
+   private:
+    T& _slot;
+    size_t _offset;
+  };
+
+ public:
+  TriBoolArray() {}
+
+  TriBoolArray(const TriBool& init) {
+    fill_in(init);
+  }
+
+  TriBool operator[](size_t x) const {
+    size_t index = x / (_slot_size);
+    size_t offset = x % (_slot_size);
+    T raw = (_array[index] >> (2 * offset)) & 3;
+    return TriBool(static_cast<u1>(raw));
+  }
+
+  TriBoolAssigner operator[](size_t x) {
+    size_t index = x / (_slot_size);
+    size_t offset = x % (_slot_size);
+    return TriBoolAssigner(_array[index], 2 * offset);
+  }
+
+  void fill_in(const TriBool& val) {
+      if (val.is_default()) {
+        memset(_array, 0, _size * sizeof(T));
+      }
+      else {
+        for (size_t i = 0; i < SZ; ++i) {
+          (*this)[i] = val;
+        }
+      }
+  }
+
+  void fill_in(const TriBool* beg, const TriBool* end) {
+      size_t i = 0;
+
+      while (i < SZ && beg != end) {
+        (*this)[i++] = *beg++;
+      }
+  }
+
+ private:
+  const static size_t _bits_in_T = sizeof(T) * 8;   // bits in a byte
+  const static size_t _slot_size = _bits_in_T >> 1; // one TriBool occupies 2bits
+  const static size_t _size = (2 * SZ + _bits_in_T - 1) / (_bits_in_T);
+  T _array[_size];
+};
+
+#endif // SHARE_UTILITIES_TRIBOOL_HPP
diff --git a/src/hotspot/share/utilities/valueObjArray.hpp b/src/hotspot/share/utilities/valueObjArray.hpp
new file mode 100644
index 00000000000..f604ea8a5da
--- /dev/null
+++ b/src/hotspot/share/utilities/valueObjArray.hpp
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_VALUEOBJARRAY_HPP
+#define SHARE_UTILITIES_VALUEOBJARRAY_HPP
+
+#include "utilities/debug.hpp"
+
+// Stamps out Count instances of Type using a recursive template.
+template <typename Type, int Count>
+class ValueObjBlock {
+  typedef ValueObjBlock<Type, Count - 1> Next;
+
+  Type _instance;
+  Next _next;
+
+public:
+  template <typename Generator>
+  ValueObjBlock(Generator g, Type** save_to) :
+      _instance(*g),
+      _next(++g, save_to + 1) {
+    *save_to = &_instance;
+  }
+};
+
+// Specialization for the recursion base case.
+template <typename Type>
+class ValueObjBlock<Type, 0> {
+public:
+  template <typename Generator>
+  ValueObjBlock(Generator, Type**) {}
+};
+
+// Maps an array of size Count over stamped-out instances of Type.
+template <typename Type, int Count>
+struct ValueObjArray {
+  Type*                      _ptrs[Count];
+  ValueObjBlock<Type, Count> _block;
+
+  template <typename Generator>
+  ValueObjArray(Generator g) : _ptrs(), _block(g, _ptrs) {}
+
+  Type* at(int index) const {
+    assert(0 <= index && index < Count, "index out-of-bounds: %d", index);
+    return _ptrs[index];
+  }
+
+  static int count() {
+    return Count;
+  }
+};
+
+#endif // SHARE_UTILITIES_VALUEOBJARRAY_HPP
diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java
index 4aa0ff6ed02..0a67b80bc46 100644
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java
@@ -2139,11 +2139,6 @@ private Enum<?> readEnum(boolean unshared) throws IOException {
         return result;
     }
 
-    @SuppressWarnings("preview")
-    private static boolean isRecord(Class<?> cls) {
-        return cls.isRecord();
-    }
-
     /**
      * Reads and returns "ordinary" (i.e., not a String, Class,
      * ObjectStreamClass, array, or enum constant) object, or null if object's
@@ -2182,7 +2177,7 @@ private Object readOrdinaryObject(boolean unshared)
             handles.markException(passHandle, resolveEx);
         }
 
-        final boolean isRecord = cl != null && isRecord(cl) ? true : false;
+        final boolean isRecord = desc.isRecord();
         if (isRecord) {
             assert obj == null;
             obj = readRecord(desc);
@@ -2289,14 +2284,14 @@ private Object readRecord(ObjectStreamClass desc) throws IOException {
 
         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);
diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java
index 0a912063d2e..16f7164c599 100644
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java
@@ -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 @@ InvalidClassException newInvalidClassException() {
 
     /** 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 @@ public Void run() {
 
                     if (isRecord) {
                         canonicalCtr = canonicalRecordCtr(cl);
+                        deserializationCtrs = new DeserializationConstructorsCache();
                     } else if (externalizable) {
                         cons = getExternalizableConstructor(cl);
                     } else {
@@ -738,10 +747,6 @@ void initNonProxy(ObjectStreamClass model,
         }
 
         this.cl = cl;
-        if (cl != null) {
-            this.isRecord = isRecord(cl);
-            this.canonicalCtr = osc.canonicalCtr;
-        }
         this.resolveEx = resolveEx;
         this.superDesc = superDesc;
         name = model.name;
@@ -758,6 +763,11 @@ void initNonProxy(ObjectStreamClass model,
 
         if (osc != null) {
             localDesc = osc;
+            isRecord = localDesc.isRecord;
+            // canonical record constructor is shared
+            canonicalCtr = localDesc.canonicalCtr;
+            // cache of deserialization constructors is shared
+            deserializationCtrs = localDesc.deserializationCtrs;
             writeObjectMethod = localDesc.writeObjectMethod;
             readObjectMethod = localDesc.readObjectMethod;
             readObjectNoDataMethod = localDesc.readObjectNoDataMethod;
@@ -2528,14 +2538,135 @@ public boolean equals(Object obj) {
         }
     }
 
+    // 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 {
-
-        /** Binds the given stream field values to the given method handle. */
+        /**
+         * Returns canonical record constructor adapted to take two arguments:
+         * {@code (byte[] primValues, Object[] objValues)}
+         * and return
+         * {@code Object}
+         */
         @SuppressWarnings("preview")
-        static MethodHandle bindCtrValues(MethodHandle ctrMH,
-                                          ObjectStreamClass desc,
-                                          ObjectInputStream.FieldValues fieldValues) {
+        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;
+
+            // retrieve record components
             RecordComponent[] recordComponents;
             try {
                 Class<?> cls = desc.forClass();
@@ -2545,15 +2676,36 @@ static MethodHandle bindCtrValues(MethodHandle ctrMH,
                 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 +2721,15 @@ private static int numberPrimValues(ObjectStreamClass desc) {
             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 +2742,62 @@ private static Object streamFieldValue(String pName,
                     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);
+            }
         }
     }
 }
diff --git a/src/java.base/share/classes/java/io/PipedWriter.java b/src/java.base/share/classes/java/io/PipedWriter.java
index a2489357f88..eb09adc8ce6 100644
--- a/src/java.base/share/classes/java/io/PipedWriter.java
+++ b/src/java.base/share/classes/java/io/PipedWriter.java
@@ -112,7 +112,7 @@ public synchronized void connect(PipedReader snk) throws IOException {
      * Implements the {@code write} method of {@code Writer}.
      *
      * @param   c   the {@code char} to be written.
-     * @throw   IOException  if the pipe is
+     * @throws  IOException  if the pipe is
      *          <a href=PipedOutputStream.html#BROKEN> {@code broken}</a>,
      *          {@link #connect(java.io.PipedReader) unconnected}, closed
      *          or an I/O error occurs.
diff --git a/src/java.base/share/classes/java/io/SequenceInputStream.java b/src/java.base/share/classes/java/io/SequenceInputStream.java
index 05f797fc9a0..441b4ad970c 100644
--- a/src/java.base/share/classes/java/io/SequenceInputStream.java
+++ b/src/java.base/share/classes/java/io/SequenceInputStream.java
@@ -121,7 +121,7 @@ private void peekNextStream() {
      *           skipped over) from the current underlying input stream
      *           without blocking or {@code 0} if this input stream
      *           has been closed by invoking its {@link #close()} method
-     * @throw    IOException  if an I/O error occurs.
+     * @throws   IOException  if an I/O error occurs.
      *
      * @since    1.1
      */
diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java b/src/java.base/share/classes/java/lang/ClassLoader.java
index 0ba39b0e64b..6f3eb264c44 100644
--- a/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -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
diff --git a/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html b/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html
index 9d69fc6a17f..a427266453b 100644
--- a/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html
+++ b/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html
@@ -282,7 +282,7 @@ <h2>What should I use instead of <code>Thread.suspend</code> and
         }
     }
 </pre>
-<hr size="3" noshade="noshade" />
+<hr>
 <h2>Can I combine the two techniques to produce a thread that may
 be safely "stopped" or "suspended"?</h2>
 Yes, it's reasonably straightforward. The one subtlety is that the
@@ -324,6 +324,5 @@ <h2>Can I combine the two techniques to produce a thread that may
 described above, it needn't call <code>notify</code> as well, but it
 still must be synchronized. This ensures that the target thread
 won't miss an interrupt due to a race condition.
-<p><!-- Body text ends here --></p>
 </body>
 </html>
diff --git a/src/java.base/share/classes/java/lang/invoke/MemberName.java b/src/java.base/share/classes/java/lang/invoke/MemberName.java
index dbd8d746830..afbb9ae636d 100644
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -480,7 +480,8 @@ public boolean isSynthetic() {
             IS_CONSTRUCTOR   = MN_IS_CONSTRUCTOR,   // constructor
             IS_FIELD         = MN_IS_FIELD,         // field
             IS_TYPE          = MN_IS_TYPE,          // nested type
-            CALLER_SENSITIVE = MN_CALLER_SENSITIVE; // @CallerSensitive annotation detected
+            CALLER_SENSITIVE = MN_CALLER_SENSITIVE, // @CallerSensitive annotation detected
+            TRUSTED_FINAL    = MN_TRUSTED_FINAL;    // trusted final field
 
     static final int ALL_ACCESS = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED;
     static final int ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE;
@@ -520,6 +521,8 @@ public boolean isPackage() {
     public boolean isCallerSensitive() {
         return testAllFlags(CALLER_SENSITIVE);
     }
+    /** Query whether this member is a trusted final field. */
+    public boolean isTrustedFinalField() { return testAllFlags(TRUSTED_FINAL|IS_FIELD); }
 
     /** Utility method to query whether this member is accessible from a given lookup class. */
     public boolean isAccessibleFrom(Class<?> lookupClass) {
diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
index ca161156c74..ff87bcedcaf 100644
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
@@ -118,6 +118,7 @@ static class Constants {
             MN_IS_FIELD            = 0x00040000, // field
             MN_IS_TYPE             = 0x00080000, // nested type
             MN_CALLER_SENSITIVE    = 0x00100000, // @CallerSensitive annotation detected
+            MN_TRUSTED_FINAL       = 0x00200000, // trusted final field
             MN_REFERENCE_KIND_SHIFT = 24, // refKind
             MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
             // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 23f31cc6b85..4038f5841d7 100644
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -3273,10 +3273,10 @@ public MethodHandle unreflectSetter(Field f) throws IllegalAccessException {
         private MethodHandle unreflectField(Field f, boolean isSetter) throws IllegalAccessException {
             MemberName field = new MemberName(f, isSetter);
             if (isSetter && field.isFinal()) {
-                if (field.isStatic()) {
-                    throw field.makeAccessException("static final field has no write access", this);
-                } else if (field.getDeclaringClass().isHidden()){
-                    throw field.makeAccessException("final field in a hidden class has no write access", this);
+                if (field.isTrustedFinalField()) {
+                    String msg = field.isStatic() ? "static final field has no write access"
+                                                  : "final field has no write access";
+                    throw field.makeAccessException(msg, this);
                 }
             }
             assert(isSetter
@@ -3839,7 +3839,7 @@ private VarHandle getFieldVarHandleCommon(byte getRefKind, byte putRefKind,
                 refc = lookupClass();
             }
             return VarHandles.makeFieldHandle(getField, refc, getField.getFieldType(),
-                                             this.allowedModes == TRUSTED && !getField.getDeclaringClass().isHidden());
+                                              this.allowedModes == TRUSTED && !getField.isTrustedFinalField());
         }
         /** Check access and get the requested constructor. */
         private MethodHandle getDirectConstructor(Class<?> refc, MemberName ctor) throws IllegalAccessException {
diff --git a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
index 4707276c720..3db39d8e92c 100644
--- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
@@ -177,10 +177,16 @@ public static void setAccessible(AccessibleObject[] array, boolean flag) {
      * to the caller's module. </p>
      *
      * <p> This method cannot be used to enable {@linkplain Field#set <em>write</em>}
-     * access to a final field declared in a {@linkplain Class#isHidden() hidden class},
-     * since such fields are not modifiable.  The {@code accessible} flag when
-     * {@code true} suppresses Java language access control checks to only
-     * enable {@linkplain Field#get <em>read</em>} access to such fields.
+     * access to a <em>non-modifiable</em> final field.  The following fields
+     * are non-modifiable:
+     * <ul>
+     * <li>static final fields declared in any class or interface</li>
+     * <li>final fields declared in a {@linkplain Class#isHidden() hidden class}</li>
+     * <li>final fields declared in a {@linkplain Class#isRecord() record}</li>
+     * </ul>
+     * <p> The {@code accessible} flag when {@code true} suppresses Java language access
+     * control checks to only enable {@linkplain Field#get <em>read</em>} access to
+     * these non-modifiable final fields.
      *
      * <p> If there is a security manager, its
      * {@code checkPermission} method is first called with a
diff --git a/src/java.base/share/classes/java/lang/reflect/Field.java b/src/java.base/share/classes/java/lang/reflect/Field.java
index 5589dc7bb7b..75bf314c5e0 100644
--- a/src/java.base/share/classes/java/lang/reflect/Field.java
+++ b/src/java.base/share/classes/java/lang/reflect/Field.java
@@ -72,6 +72,7 @@ class Field extends AccessibleObject implements Member {
     private String              name;
     private Class<?>            type;
     private int                 modifiers;
+    private boolean             trustedFinal;
     // Generics and annotations support
     private transient String    signature;
     // generic info repository; lazily initialized
@@ -119,6 +120,7 @@ private FieldRepository getGenericInfo() {
           String name,
           Class<?> type,
           int modifiers,
+          boolean trustedFinal,
           int slot,
           String signature,
           byte[] annotations)
@@ -127,6 +129,7 @@ private FieldRepository getGenericInfo() {
         this.name = name;
         this.type = type;
         this.modifiers = modifiers;
+        this.trustedFinal = trustedFinal;
         this.slot = slot;
         this.signature = signature;
         this.annotations = annotations;
@@ -148,7 +151,7 @@ Field copy() {
         if (this.root != null)
             throw new IllegalArgumentException("Can not copy a non-root Field");
 
-        Field res = new Field(clazz, name, type, modifiers, slot, signature, annotations);
+        Field res = new Field(clazz, name, type, modifiers, trustedFinal, slot, signature, annotations);
         res.root = this;
         // Might as well eagerly propagate this if already present
         res.fieldAccessor = fieldAccessor;
@@ -728,7 +731,9 @@ public double getDouble(Object obj)
      *     this {@code Field} object;</li>
      * <li>the field is non-static; and</li>
      * <li>the field's declaring class is not a {@linkplain Class#isHidden()
-     *     hidden class}.</li>
+     *     hidden class}; and</li>
+     * <li>the field's declaring class is not a {@linkplain Class#isRecord()
+     *     record class}.</li>
      * </ul>
      * If any of the above checks is not met, this method throws an
      * {@code IllegalAccessException}.
@@ -1145,10 +1150,14 @@ private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck
     }
 
     @Override
-    Field getRoot() {
+    /* package-private */ Field getRoot() {
         return root;
     }
 
+    /* package-private */ boolean isTrustedFinal() {
+        return trustedFinal;
+    }
+
     /**
      * {@inheritDoc}
      *
diff --git a/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java b/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java
index 2ed950cc76f..6ac890156b0 100644
--- a/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java
+++ b/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -118,6 +118,10 @@ public <T extends AccessibleObject> T getRoot(T obj) {
         return (T) obj.getRoot();
     }
 
+    public boolean isTrustedFinalField(Field f) {
+        return f.isTrustedFinal();
+    }
+
     public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
         throws IllegalAccessException, InstantiationException, InvocationTargetException
     {
diff --git a/src/java.base/share/classes/java/security/Permissions.java b/src/java.base/share/classes/java/security/Permissions.java
index 65e41f28602..d7c2a8f2538 100644
--- a/src/java.base/share/classes/java/security/Permissions.java
+++ b/src/java.base/share/classes/java/security/Permissions.java
@@ -32,7 +32,6 @@
 import java.io.ObjectStreamField;
 import java.io.Serializable;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
@@ -230,38 +229,50 @@ public Enumeration<Permission> elements() {
      */
     private PermissionCollection getPermissionCollection(Permission p,
                                                          boolean createEmpty) {
-        Class<?> c = p.getClass();
-
-        if (!hasUnresolved && !createEmpty) {
-            return permsMap.get(c);
+        PermissionCollection pc = permsMap.get(p.getClass());
+        if ((!hasUnresolved && !createEmpty) || pc != null) {
+            // Collection not to be created, or already created
+            return pc;
         }
+        return createPermissionCollection(p, createEmpty);
+    }
 
-        // Create and add permission collection to map if it is absent.
-        // NOTE: cannot use lambda for mappingFunction parameter until
-        // JDK-8076596 is fixed.
-        return permsMap.computeIfAbsent(c,
-            new java.util.function.Function<>() {
-                @Override
-                public PermissionCollection apply(Class<?> k) {
-                    // Check for unresolved permissions
-                    PermissionCollection pc =
-                        (hasUnresolved ? getUnresolvedPermissions(p) : null);
+    private PermissionCollection createPermissionCollection(Permission p,
+                                                            boolean createEmpty) {
+        synchronized (permsMap) {
+            // Re-read under lock
+            Class<?> c = p.getClass();
+            PermissionCollection pc = permsMap.get(c);
 
-                    // if still null, create a new collection
-                    if (pc == null && createEmpty) {
+            // Collection already created
+            if (pc != null) {
+                return pc;
+            }
 
-                        pc = p.newPermissionCollection();
+            // Create and add permission collection to map if it is absent.
+            // Check for unresolved permissions
+            pc = (hasUnresolved ? getUnresolvedPermissions(p) : null);
 
-                        // still no PermissionCollection?
-                        // We'll give them a PermissionsHash.
-                        if (pc == null) {
-                            pc = new PermissionsHash();
-                        }
-                    }
-                    return pc;
+            // if still null, create a new collection
+            if (pc == null && createEmpty) {
+
+                pc = p.newPermissionCollection();
+
+                // still no PermissionCollection?
+                // We'll give them a PermissionsHash.
+                if (pc == null) {
+                    pc = new PermissionsHash();
+                }
+            }
+            if (pc != null) {
+                // Add pc, resolving any race
+                PermissionCollection oldPc = permsMap.putIfAbsent(c, pc);
+                if (oldPc != null) {
+                    pc = oldPc;
                 }
             }
-        );
+            return pc;
+        }
     }
 
     /**
diff --git a/src/java.base/share/classes/java/time/temporal/ChronoField.java b/src/java.base/share/classes/java/time/temporal/ChronoField.java
index f1ef04ee07d..867544b3bd0 100644
--- a/src/java.base/share/classes/java/time/temporal/ChronoField.java
+++ b/src/java.base/share/classes/java/time/temporal/ChronoField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, 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
@@ -270,7 +270,7 @@ public enum ChronoField implements TemporalField {
      * The value is validated from 0 to 11 in strict and smart mode.
      * In lenient mode the value is not validated. It is combined with
      * {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying
-     * the {AMPM_OF_DAY} value by 12.
+     * the {@code AMPM_OF_DAY} value by 12.
      * <p>
      * See {@link #CLOCK_HOUR_OF_AMPM} for the related field that counts hours from 1 to 12.
      */
@@ -334,7 +334,7 @@ public enum ChronoField implements TemporalField {
      * The value is validated from 0 to 1 in strict and smart mode.
      * In lenient mode the value is not validated. It is combined with
      * {@code HOUR_OF_AMPM} to form {@code HOUR_OF_DAY} by multiplying
-     * the {AMPM_OF_DAY} value by 12.
+     * the {@code AMPM_OF_DAY} value by 12.
      */
     AMPM_OF_DAY("AmPmOfDay", HALF_DAYS, DAYS, ValueRange.of(0, 1), "dayperiod"),
     /**
diff --git a/src/java.base/share/classes/jdk/internal/access/JavaLangReflectAccess.java b/src/java.base/share/classes/jdk/internal/access/JavaLangReflectAccess.java
index 8e537b68cbf..4082fae336f 100644
--- a/src/java.base/share/classes/jdk/internal/access/JavaLangReflectAccess.java
+++ b/src/java.base/share/classes/jdk/internal/access/JavaLangReflectAccess.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -96,6 +96,9 @@ public void setConstructorAccessor(Constructor<?> c,
     /** Gets the root of the given AccessibleObject object; null if arg is the root */
     public <T extends AccessibleObject> T getRoot(T obj);
 
+    /** Tests if this is a trusted final field */
+    public boolean isTrustedFinalField(Field f);
+
     /** Returns a new instance created by the given constructor with access check */
     public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
         throws IllegalAccessException, InstantiationException, InvocationTargetException;
diff --git a/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java b/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java
index 5a3636501fd..811fbccb852 100644
--- a/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java
+++ b/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java
@@ -27,7 +27,7 @@
 
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Provides;
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -94,19 +94,24 @@ public static ServicesCatalog create() {
     }
 
     /**
-     * Returns the list of service providers for the given service type
-     * name, creating it if needed.
+     * Adds service providers for the given service type.
      */
-    private List<ServiceProvider> providers(String service) {
-        // avoid computeIfAbsent here
+    private void addProviders(String service, ServiceProvider ... providers) {
         List<ServiceProvider> list = map.get(service);
         if (list == null) {
-            list = new CopyOnWriteArrayList<>();
+            list = new CopyOnWriteArrayList<>(providers);
             List<ServiceProvider> prev = map.putIfAbsent(service, list);
-            if (prev != null)
-                list = prev;  // someone else got there
+            if (prev != null) {
+                // someone else got there
+                prev.addAll(list);
+            }
+        } else {
+            if (providers.length == 1) {
+                list.add(providers[0]);
+            } else {
+                list.addAll(Arrays.asList(providers));
+            }
         }
-        return list;
     }
 
     /**
@@ -118,16 +123,11 @@ public void register(Module module) {
             String service = provides.service();
             List<String> providerNames = provides.providers();
             int count = providerNames.size();
-            if (count == 1) {
-                String pn = providerNames.get(0);
-                providers(service).add(new ServiceProvider(module, pn));
-            } else {
-                List<ServiceProvider> list = new ArrayList<>(count);
-                for (String pn : providerNames) {
-                    list.add(new ServiceProvider(module, pn));
-                }
-                providers(service).addAll(list);
+            ServiceProvider[] providers = new ServiceProvider[count];
+            for (int i = 0; i < count; i++) {
+                providers[i] = new ServiceProvider(module, providerNames.get(i));
             }
+            addProviders(service, providers);
         }
     }
 
@@ -137,8 +137,7 @@ public void register(Module module) {
      * @apiNote This method is for use by java.lang.instrument
      */
     public void addProvider(Module module, Class<?> service, Class<?> impl) {
-        List<ServiceProvider> list = providers(service.getName());
-        list.add(new ServiceProvider(module, impl.getName()));
+        addProviders(service.getName(), new ServiceProvider(module, impl.getName()));
     }
 
     /**
diff --git a/src/java.base/share/classes/jdk/internal/reflect/Reflection.java b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
index 3152089a272..410297cac0b 100644
--- a/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
+++ b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java
@@ -31,6 +31,7 @@
 import java.util.Objects;
 import java.util.Set;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.access.SharedSecrets;
 import jdk.internal.misc.VM;
 
 /** Common utility routines used by both java.lang and
@@ -336,6 +337,14 @@ public static boolean isCallerSensitive(Method m) {
         return false;
     }
 
+    /*
+     * Tests if the given Field is a trusted final field and it cannot be
+     * modified reflectively regardless of the value of its accessible flag.
+     */
+    public static boolean isTrustedFinalField(Field field) {
+        return SharedSecrets.getJavaLangReflectAccess().isTrustedFinalField(field);
+    }
+
     /**
      * Returns an IllegalAccessException with an exception message based on
      * the access that is denied.
diff --git a/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
index 2a7728df542..4f344d22a8f 100644
--- a/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
+++ b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
@@ -181,7 +181,9 @@ public FieldAccessor newFieldAccessor(Field field, boolean override) {
                 field = root;
             }
         }
-        return UnsafeFieldAccessorFactory.newFieldAccessor(field, override);
+        boolean isFinal = Modifier.isFinal(field.getModifiers());
+        boolean isReadOnly = isFinal && (!override || langReflectAccess.isTrustedFinalField(field));
+        return UnsafeFieldAccessorFactory.newFieldAccessor(field, isReadOnly);
     }
 
     public MethodAccessor newMethodAccessor(Method method) {
diff --git a/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java b/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java
index ba292087bfd..d13043ce988 100644
--- a/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java
@@ -29,13 +29,12 @@
 import java.lang.reflect.Modifier;
 
 class UnsafeFieldAccessorFactory {
-    static FieldAccessor newFieldAccessor(Field field, boolean override) {
+    static FieldAccessor newFieldAccessor(Field field, boolean isReadOnly) {
         Class<?> type = field.getType();
         boolean isStatic = Modifier.isStatic(field.getModifiers());
         boolean isFinal = Modifier.isFinal(field.getModifiers());
         boolean isVolatile = Modifier.isVolatile(field.getModifiers());
         boolean isQualified = isFinal || isVolatile;
-        boolean isReadOnly = isFinal && (isStatic || !override || field.getDeclaringClass().isHidden());
         if (isStatic) {
             // This code path does not guarantee that the field's
             // declaring class has been initialized, but it must be
diff --git a/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java
index db20841f2a1..8f79bdc6e6f 100644
--- a/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java
+++ b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java
@@ -163,19 +163,24 @@ public static int vectorizedMismatch(Object a, long aOffset,
     /**
      * 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 @@ public static long vectorizedMismatchLarge(Object a, long aOffset,
             off += i;
             remaining -= i;
         }
-        return ~off;
+        return ~remaining;
     }
 
     // Booleans
diff --git a/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java b/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java
index b9ef2d6337f..b379107e7c4 100644
--- a/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java
+++ b/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java
@@ -28,9 +28,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.security.cert.CertificateException;
-import java.util.Locale;
 import java.util.Date;
-import java.util.HashMap;
 import sun.security.x509.CertificateExtensions;
 import sun.security.util.*;
 
@@ -234,11 +232,16 @@ public class PKCS9Attribute implements DerEncoder {
     private static final Byte[][] PKCS9_VALUE_TAGS = {
         null,
         {DerValue.tag_IA5String},   // EMailAddress
-        {DerValue.tag_IA5String,   // UnstructuredName
-         DerValue.tag_PrintableString},
+        {DerValue.tag_IA5String,
+         DerValue.tag_PrintableString,
+         DerValue.tag_T61String,
+         DerValue.tag_BMPString,
+         DerValue.tag_UniversalString,
+         DerValue.tag_UTF8String},  // UnstructuredName
         {DerValue.tag_ObjectId},    // ContentType
         {DerValue.tag_OctetString}, // MessageDigest
-        {DerValue.tag_UtcTime},     // SigningTime
+        {DerValue.tag_UtcTime,
+         DerValue.tag_GeneralizedTime}, // SigningTime
         {DerValue.tag_Sequence},    // Countersignature
         {DerValue.tag_PrintableString,
          DerValue.tag_T61String,
@@ -246,7 +249,10 @@ public class PKCS9Attribute implements DerEncoder {
          DerValue.tag_UniversalString,
          DerValue.tag_UTF8String},   // ChallengePassword
         {DerValue.tag_PrintableString,
-         DerValue.tag_T61String},   // UnstructuredAddress
+         DerValue.tag_T61String,
+         DerValue.tag_BMPString,
+         DerValue.tag_UniversalString,
+         DerValue.tag_UTF8String},   // UnstructuredAddress
         {DerValue.tag_SetOf},       // ExtendedCertificateAttributes
         {DerValue.tag_Sequence},    // issuerAndSerialNumber
         null,
@@ -437,7 +443,10 @@ public PKCS9Attribute(DerValue derVal) throws IOException {
             break;
 
         case 5:     // signing time
-            value = (new DerInputStream(elems[0].toByteArray())).getUTCTime();
+            byte elemTag = elems[0].getTag();
+            DerInputStream dis = new DerInputStream(elems[0].toByteArray());
+            value = (elemTag == DerValue.tag_GeneralizedTime) ?
+                    dis.getGeneralizedTime() : dis.getUTCTime();
             break;
 
         case 6:     // countersignature
diff --git a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
index ba0639ec867..670d0c37150 100644
--- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
+++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import java.util.*;
 import java.util.concurrent.locks.ReentrantLock;
 import sun.security.action.*;
+import sun.security.util.FilePaths;
 import sun.security.validator.TrustStoreUtil;
 
 /**
@@ -76,8 +77,7 @@ private static final class TrustStoreDescriptor {
         private static final String defaultStorePath =
                 GetPropertyAction.privilegedGetProperty("java.home") +
                 fileSep + "lib" + fileSep + "security";
-        private static final String defaultStore =
-                defaultStorePath + fileSep + "cacerts";
+        private static final String defaultStore = FilePaths.cacerts();
         private static final String jsseDefaultStore =
                 defaultStorePath + fileSep + "jssecacerts";
 
diff --git a/src/java.base/share/classes/sun/security/tools/KeyStoreUtil.java b/src/java.base/share/classes/sun/security/tools/KeyStoreUtil.java
index 029afc51dfc..6c7cc402bf7 100644
--- a/src/java.base/share/classes/sun/security/tools/KeyStoreUtil.java
+++ b/src/java.base/share/classes/sun/security/tools/KeyStoreUtil.java
@@ -51,6 +51,7 @@
 import java.util.ResourceBundle;
 import java.util.ServiceLoader;
 
+import sun.security.util.FilePaths;
 import sun.security.util.PropertyExpander;
 
 /**
@@ -110,10 +111,7 @@ public static String niceStoreTypeName(String storetype) {
      * Returns the file name of the keystore with the configured CA certificates.
      */
     public static String getCacerts() {
-        String sep = File.separator;
-        return System.getProperty("java.home") + sep
-                + "lib" + sep + "security" + sep
-                + "cacerts";
+        return FilePaths.cacerts();
     }
 
     /**
diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/src/java.base/share/classes/sun/security/tools/keytool/Main.java
index a6819fe06ac..de87f5a0ff2 100644
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java
@@ -260,12 +260,15 @@ enum Command {
             PROVIDERPATH, V, PROTECTED),
         PRINTCERT("Prints.the.content.of.a.certificate",
             RFC, FILEIN, SSLSERVER, JARFILE,
+            KEYSTORE, STOREPASS, STORETYPE, TRUSTCACERTS,
             PROVIDERNAME, ADDPROVIDER, PROVIDERCLASS,
-            PROVIDERPATH, V),
+            PROVIDERPATH, V, PROTECTED),
         PRINTCERTREQ("Prints.the.content.of.a.certificate.request",
             FILEIN, V),
         PRINTCRL("Prints.the.content.of.a.CRL.file",
-            FILEIN, V),
+            FILEIN, KEYSTORE, STOREPASS, STORETYPE, TRUSTCACERTS,
+            PROVIDERNAME, ADDPROVIDER, PROVIDERCLASS, PROVIDERPATH,
+            V, PROTECTED),
         STOREPASSWD("Changes.the.store.password.of.a.keystore",
             NEW, KEYSTORE, CACERTS, STOREPASS, STORETYPE, PROVIDERNAME,
             ADDPROVIDER, PROVIDERCLASS, PROVIDERPATH, V),
@@ -719,7 +722,7 @@ else if (collator.compare(flags, "-v") == 0) {
     }
 
     boolean isKeyStoreRelated(Command cmd) {
-        return cmd != PRINTCERT && cmd != PRINTCERTREQ && cmd != SHOWINFO;
+        return cmd != PRINTCERTREQ && cmd != SHOWINFO;
     }
 
     /**
@@ -904,14 +907,15 @@ void doCommands(PrintStream out) throws Exception {
             } catch (FileNotFoundException e) {
                 // These commands do not need the keystore to be existing.
                 // Either it will create a new one or the keystore is
-                // optional (i.e. PRINTCRL).
+                // optional (i.e. PRINTCRL and PRINTCERT).
                 if (command != GENKEYPAIR &&
                         command != GENSECKEY &&
                         command != IDENTITYDB &&
                         command != IMPORTCERT &&
                         command != IMPORTPASS &&
                         command != IMPORTKEYSTORE &&
-                        command != PRINTCRL) {
+                        command != PRINTCRL &&
+                        command != PRINTCERT) {
                     throw new Exception(rb.getString
                             ("Keystore.file.does.not.exist.") + ksfname);
                 }
@@ -1073,7 +1077,7 @@ && isKeyStoreRelated(command)
                     }
                 } else {
                     // here we have EXPORTCERT and LIST (info valid until STOREPASSWD)
-                    if (command != PRINTCRL) {
+                    if (command != PRINTCRL && command != PRINTCERT) {
                         System.err.print(rb.getString("Enter.keystore.password."));
                         System.err.flush();
                         storePass = Password.readPassword(System.in);
@@ -1108,10 +1112,10 @@ && isKeyStoreRelated(command)
             }
         }
 
-        // -trustcacerts can only be specified on -importcert.
-        // Reset it so that warnings on CA cert will remain for
-        // -printcert, etc.
-        if (command != IMPORTCERT) {
+        // -trustcacerts can be specified on -importcert, -printcert or -printcrl.
+        // Reset it so that warnings on CA cert will remain for other command.
+        if (command != IMPORTCERT && command != PRINTCERT
+                && command != PRINTCRL) {
             trustcacerts = false;
         }
 
@@ -2442,27 +2446,6 @@ private void doPrintEntries(PrintStream out)
         }
     }
 
-    private static <T> Iterable<T> e2i(final Enumeration<T> e) {
-        return new Iterable<T>() {
-            @Override
-            public Iterator<T> iterator() {
-                return new Iterator<T>() {
-                    @Override
-                    public boolean hasNext() {
-                        return e.hasMoreElements();
-                    }
-                    @Override
-                    public T next() {
-                        return e.nextElement();
-                    }
-                    public void remove() {
-                        throw new UnsupportedOperationException("Not supported yet.");
-                    }
-                };
-            }
-        };
-    }
-
     /**
      * Loads CRLs from a source. This method is also called in JarSigner.
      * @param src the source, which means System.in if null, or a URI,
@@ -2556,7 +2539,7 @@ private static String verifyCRL(KeyStore ks, CRL crl)
             throws Exception {
         X509CRLImpl xcrl = (X509CRLImpl)crl;
         X500Principal issuer = xcrl.getIssuerX500Principal();
-        for (String s: e2i(ks.aliases())) {
+        for (String s: Collections.list(ks.aliases())) {
             Certificate cert = ks.getCertificate(s);
             if (cert instanceof X509Certificate) {
                 X509Certificate xcert = (X509Certificate)cert;
@@ -2605,8 +2588,13 @@ private void doPrintCRL(String src, PrintStream out)
             if (issuer == null) {
                 out.println(rb.getString
                         ("STAR"));
-                out.println(rb.getString
-                        ("warning.not.verified.make.sure.keystore.is.correct"));
+                if (trustcacerts) {
+                    out.println(rb.getString
+                            ("warning.not.verified.make.sure.keystore.is.correct"));
+                } else {
+                    out.println(rb.getString
+                            ("warning.not.verified.make.sure.keystore.is.correct.or.specify.trustcacerts"));
+                }
                 out.println(rb.getString
                         ("STARNN"));
             }
diff --git a/src/java.base/share/classes/sun/security/tools/keytool/Resources.java b/src/java.base/share/classes/sun/security/tools/keytool/Resources.java
index 76212b030b8..d660b51fbd9 100644
--- a/src/java.base/share/classes/sun/security/tools/keytool/Resources.java
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Resources.java
@@ -429,6 +429,8 @@ public class Resources extends java.util.ListResourceBundle {
 
         {"warning.not.verified.make.sure.keystore.is.correct",
             "WARNING: not verified. Make sure -keystore is correct."},
+        {"warning.not.verified.make.sure.keystore.is.correct.or.specify.trustcacerts",
+            "WARNING: not verified. Make sure -keystore is correct or specify -trustcacerts."},
 
         {"Extensions.", "Extensions: "},
         {".Empty.value.", "(Empty value)"},
diff --git a/src/java.base/share/classes/sun/security/util/AnchorCertificates.java b/src/java.base/share/classes/sun/security/util/AnchorCertificates.java
index c720aa1d4a9..7d5f47b435c 100644
--- a/src/java.base/share/classes/sun/security/util/AnchorCertificates.java
+++ b/src/java.base/share/classes/sun/security/util/AnchorCertificates.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -36,7 +36,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import jdk.internal.util.StaticProperty;
 import sun.security.x509.X509CertImpl;
 
 /**
@@ -53,10 +52,9 @@ public class AnchorCertificates {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             @Override
             public Void run() {
-                File f = new File(StaticProperty.javaHome(),
-                        "lib/security/cacerts");
-                KeyStore cacerts;
+                File f = new File(FilePaths.cacerts());
                 try {
+                    KeyStore cacerts;
                     cacerts = KeyStore.getInstance("JKS");
                     try (FileInputStream fis = new FileInputStream(f)) {
                         cacerts.load(fis, null);
diff --git a/src/java.base/share/classes/sun/security/util/DerValue.java b/src/java.base/share/classes/sun/security/util/DerValue.java
index cf118b51c81..cbd19575eaa 100644
--- a/src/java.base/share/classes/sun/security/util/DerValue.java
+++ b/src/java.base/share/classes/sun/security/util/DerValue.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 import java.io.*;
 import java.math.BigInteger;
 import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
 import java.util.Date;
 
 import static java.nio.charset.StandardCharsets.*;
@@ -360,8 +362,9 @@ private DerInputStream init(byte stringTag, String value) {
         case tag_UTF8String:
             charset = UTF_8;
             break;
-            // TBD: Need encoder for UniversalString before it can
-            // be handled.
+        case tag_UniversalString:
+            charset = Charset.forName("UTF_32BE");
+            break;
         default:
             throw new IllegalArgumentException("Unsupported DER string type");
         }
@@ -598,10 +601,8 @@ else if (tag == tag_T61String)
             return getT61String();
         else if (tag == tag_IA5String)
             return getIA5String();
-        /*
-          else if (tag == tag_UniversalString)
+        else if (tag == tag_UniversalString)
           return getUniversalString();
-        */
         else if (tag == tag_BMPString)
             return getBMPString();
         else if (tag == tag_GeneralString)
@@ -740,6 +741,25 @@ public String getGeneralString() throws IOException {
         return new String(getDataBytes(), US_ASCII);
     }
 
+    /**
+     * Returns the ASN.1 UNIVERSAL (UTF-32) STRING value as a Java String.
+     *
+     * @return a string corresponding to the encoded UniversalString held in
+     * this value or an empty string if UTF_32BE is not a supported character
+     * set.
+     */
+    public String getUniversalString() throws IOException {
+        if (tag != tag_UniversalString)
+            throw new IOException(
+                "DerValue.getUniversalString, not UniversalString " + tag);
+        try {
+            Charset cset = Charset.forName("UTF_32BE");
+            return new String(getDataBytes(), cset);
+        } catch (IllegalCharsetNameException | UnsupportedCharsetException e) {
+            return "";
+        }
+    }
+
     /**
      * Returns a Date if the DerValue is UtcTime.
      *
diff --git a/src/java.base/share/classes/sun/security/util/FilePaths.java b/src/java.base/share/classes/sun/security/util/FilePaths.java
new file mode 100644
index 00000000000..018b40beb02
--- /dev/null
+++ b/src/java.base/share/classes/sun/security/util/FilePaths.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+import jdk.internal.util.StaticProperty;
+
+import java.io.File;
+
+public class FilePaths {
+    public static String cacerts() {
+        return StaticProperty.javaHome() + File.separator + "lib"
+                + File.separator + "security" + File.separator + "cacerts";
+    }
+}
diff --git a/src/java.base/share/lib/security/default.policy b/src/java.base/share/lib/security/default.policy
index ed553c9ab8e..7b3ba7b40c3 100644
--- a/src/java.base/share/lib/security/default.policy
+++ b/src/java.base/share/lib/security/default.policy
@@ -78,6 +78,8 @@ grant codeBase "jrt:/java.sql.rowset" {
 
 
 grant codeBase "jrt:/java.xml.crypto" {
+    permission java.lang.RuntimePermission
+                   "getStackWalkerWithClassReference";
     permission java.lang.RuntimePermission
                    "accessClassInPackage.sun.security.util";
     permission java.util.PropertyPermission "*", "read";
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m
index 235ae7bc129..b83b69a1c19 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m
@@ -90,7 +90,6 @@ extern CGLError CGLTexImageIOSurface2D(
     CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo;
 #if USE_NSVIEW_FOR_SCRATCH
     [ctxinfo->context makeCurrentContext];
-    [ctxinfo->context setView: ctxinfo->scratchSurface];
 #else
     [ctxinfo->context clearDrawable];
     [ctxinfo->context makeCurrentContext];
diff --git a/src/java.management/share/classes/java/lang/management/package.html b/src/java.management/share/classes/java/lang/management/package.html
index ff95579fad9..c10a97618f3 100644
--- a/src/java.management/share/classes/java/lang/management/package.html
+++ b/src/java.management/share/classes/java/lang/management/package.html
@@ -234,7 +234,7 @@ <h2><a id="extension">Platform Extension</a></h2>
 
 <p> The java.lang.management API is thread-safe.
 
-@see {@linkplain javax.management JMX Specification}
+@see javax.management JMX Specification
 
 @author  Mandy Chung
 @since   1.5
diff --git a/src/java.xml.crypto/share/classes/com/sun/org/slf4j/internal/Logger.java b/src/java.xml.crypto/share/classes/com/sun/org/slf4j/internal/Logger.java
index 04450d0620a..ab98cefb648 100644
--- a/src/java.xml.crypto/share/classes/com/sun/org/slf4j/internal/Logger.java
+++ b/src/java.xml.crypto/share/classes/com/sun/org/slf4j/internal/Logger.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,28 @@
  */
 package com.sun.org.slf4j.internal;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.logging.Level;
+
 // Bridge to java.util.logging.
 public class Logger {
 
+    /**
+     * StackWalker to find out the caller of this class so that it can be
+     * shown in the log output. The multiple private log0() methods below
+     * skip exactly 2 frames -- one log0() itself, the other one of the
+     * public debug()/warn()/error()/trace() methods in this class --
+     * to find the caller.
+     */
+    private static final StackWalker WALKER;
+    static {
+        final PrivilegedAction<StackWalker> action =
+                () -> StackWalker.getInstance(StackWalker.Option
+                        .RETAIN_CLASS_REFERENCE);
+        WALKER = AccessController.doPrivileged(action);
+    }
+
     private final java.util.logging.Logger impl;
 
     public Logger(String name) {
@@ -34,46 +53,92 @@ public Logger(String name) {
     }
 
     public boolean isDebugEnabled() {
-        return impl.isLoggable(java.util.logging.Level.FINE);
+        return impl.isLoggable(Level.FINE);
     }
 
     public boolean isTraceEnabled() {
-        return impl.isLoggable(java.util.logging.Level.FINE);
+        return impl.isLoggable(Level.FINE);
     }
 
     public void debug(String s) {
-        impl.log(java.util.logging.Level.FINE, s);
+        log0(Level.FINE, s);
     }
 
     public void debug(String s, Throwable e) {
-        impl.log(java.util.logging.Level.FINE, s, e);
+        log0(Level.FINE, s, e);
     }
 
     public void debug(String s, Object... o) {
-        impl.log(java.util.logging.Level.FINE, s, o);
+        log0(Level.FINE, s, o);
     }
 
     public void trace(String s) {
-        impl.log(java.util.logging.Level.FINE, s);
+        log0(Level.FINE, s);
     }
 
     public void error(String s) {
-        impl.log(java.util.logging.Level.SEVERE, s);
+        log0(Level.SEVERE, s);
     }
 
     public void error(String s, Throwable e) {
-        impl.log(java.util.logging.Level.SEVERE, s, e);
+        log0(Level.SEVERE, s, e);
     }
 
     public void error(String s, Object... o) {
-        impl.log(java.util.logging.Level.SEVERE, s, o);
+        log0(Level.SEVERE, s, o);
     }
 
     public void warn(String s) {
-        impl.log(java.util.logging.Level.WARNING, s);
+        log0(Level.WARNING, s);
     }
 
     public void warn(String s, Throwable e) {
-        impl.log(java.util.logging.Level.WARNING, s, e);
+        log0(Level.WARNING, s, e);
+    }
+
+    private void log0(Level level, String s) {
+        if (impl.isLoggable(level)) {
+            var sf = WALKER.walk(f -> f.skip(2).findFirst()).get();
+            impl.logp(Level.FINE, sf.getClassName(), sf.getMethodName(), s);
+        }
+    }
+
+    private void log0(Level level, String s, Throwable e) {
+        if (impl.isLoggable(level)) {
+            var sf = WALKER.walk(f -> f.skip(2).findFirst()).get();
+            impl.logp(Level.FINE, sf.getClassName(), sf.getMethodName(), s, e);
+        }
+    }
+
+    private void log0(Level level, String s, Object... o) {
+        if (impl.isLoggable(level)) {
+            var sf = WALKER.walk(f -> f.skip(2).findFirst()).get();
+            impl.logp(Level.FINE, sf.getClassName(), sf.getMethodName(),
+                    addIndex(s), o);
+        }
+    }
+
+    /**
+     * Translate the log4j message format "Hello {}, {}" to the
+     * java.util.logging format "Hello {0}, {1}".
+     */
+    private static String addIndex(String s) {
+        int start = 0;
+        int index = 0;
+        StringBuilder sb = new StringBuilder();
+        while (true) {
+            int pos = s.indexOf("{}", start);
+            if (pos < 0) {
+                break;
+            }
+            sb.append(s, start, pos + 1).append(index++);
+            start = pos + 1;
+        }
+        if (index == 0) {
+            return s;
+        } else {
+            sb.append(s, start, s.length());
+            return sb.toString();
+        }
     }
 }
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
index dbb577aa52d..c40d4bb52e8 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
@@ -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 class Checker extends DocTreePathScanner<Void, Void> {
 
     public enum Flag {
         TABLE_HAS_CAPTION,
+        TABLE_IS_PRESENTATION,
         HAS_ELEMENT,
         HAS_HEADING,
         HAS_INLINE_TAG,
@@ -530,7 +532,8 @@ public Void visitEndElement(EndElementTree tree, Void ignore) {
                 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 @@ public Void visitAttribute(AttributeTree tree, Void ignore) {
                             }
                         }
                         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;
                 }
             }
         }
@@ -1168,7 +1180,7 @@ void warnIfEmpty(DocTree tree, List<? extends DocTree> list) {
                     return;
             }
         }
-        env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
+        env.messages.warning(MISSING, tree, "dc.empty", tree.getKind().tagName);
     }
 
     boolean hasNonWhitespace(TextTree tree) {
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
index 9bcfc2db611..5a5d78be3c8 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
@@ -217,6 +217,7 @@ public static Symtab instance(Context context) {
     public final Type elementTypeType;
     public final Type functionalInterfaceType;
     public final Type previewFeatureType;
+    public final Type previewFeatureInternalType;
     public final Type typeDescriptorType;
     public final Type recordType;
 
@@ -580,6 +581,7 @@ public <R, P> R accept(ElementVisitor<R, P> v, P p) {
         stringConcatFactory = enterClass("java.lang.invoke.StringConcatFactory");
         functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
         previewFeatureType = enterClass("jdk.internal.PreviewFeature");
+        previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation");
         typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor");
         recordType = enterClass("java.lang.Record");
 
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index 2986bf1d60d..55e27282e46 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -999,7 +999,10 @@ JCExpression getReceiverExpression() {
         private JCExpression makeReceiver(VarSymbol rcvr) {
             if (rcvr == null) return null;
             JCExpression rcvrExpr = make.Ident(rcvr);
-            Type rcvrType = tree.ownerAccessible ? tree.sym.enclClass().type : tree.expr.type;
+            boolean protAccess =
+                    isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner);
+            Type rcvrType = tree.ownerAccessible && !protAccess ? tree.sym.enclClass().type
+                                                                : tree.expr.type;
             if (rcvrType == syms.arrayClass.type) {
                 // Map the receiver type to the actually type, not just "array"
                 rcvrType = tree.getQualifierExpression().type;
@@ -2270,11 +2273,6 @@ boolean isPrivateInOtherClass() {
                               types.erasure(owner.enclClass().asType()));
             }
 
-            boolean isProtectedInSuperClassOfEnclosingClassInOtherPackage() {
-                return ((tree.sym.flags() & PROTECTED) != 0 &&
-                        tree.sym.packge() != owner.packge());
-            }
-
             /**
              * Erasure destroys the implementation parameter subtype
              * relationship for intersection types.
@@ -2311,7 +2309,7 @@ final boolean needsConversionToLambda() {
                         needsVarArgsConversion() ||
                         isArrayOp() ||
                         (!nestmateLambdas && isPrivateInOtherClass()) ||
-                        isProtectedInSuperClassOfEnclosingClassInOtherPackage() ||
+                        isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner) ||
                         !receiverAccessible() ||
                         (tree.getMode() == ReferenceMode.NEW &&
                           tree.kind != ReferenceKind.ARRAY_CTOR &&
@@ -2386,6 +2384,12 @@ private String classSig(Type type) {
         }
     }
 
+    private boolean isProtectedInSuperClassOfEnclosingClassInOtherPackage(Symbol targetReference,
+                                                                          Symbol currentClass) {
+        return ((targetReference.flags() & PROTECTED) != 0 &&
+                targetReference.packge() != currentClass.packge());
+    }
+
     /**
      * Signature Generation
      */
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index c27da999af6..47269bf866c 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -1429,6 +1429,9 @@ else if (proxy.type.tsym.flatName() == syms.profileType.tsym.flatName()) {
                         }
                     }
                 }
+            } else if (proxy.type.tsym.flatName() == syms.previewFeatureInternalType.tsym.flatName()) {
+                sym.flags_field |= PREVIEW_API;
+                setFlagIfAttributeTrue(proxy, sym, names.essentialAPI, PREVIEW_ESSENTIAL_API);
             } else {
                 if (proxy.type.tsym == syms.annotationTargetType.tsym) {
                     target = proxy;
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index 604be0c8918..57d53ed438a 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -3761,15 +3761,7 @@ protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) {
             nextToken();
             implementing = typeList();
         }
-        List<JCExpression> permitting = List.nil();
-        if (allowSealedTypes && token.kind == IDENTIFIER && token.name() == names.permits) {
-            checkSourceLevel(Feature.SEALED_CLASSES);
-            if ((mods.flags & Flags.SEALED) == 0) {
-                log.error(token.pos, Errors.InvalidPermitsClause(Fragments.ClassIsNotSealed("class")));
-            }
-            nextToken();
-            permitting = qualidentList(false);
-        }
+        List<JCExpression> permitting = permitsClause(mods, "class");
         List<JCTree> defs = classInterfaceOrRecordBody(name, false, false);
         JCClassDecl result = toP(F.at(pos).ClassDef(
             mods, name, typarams, extending, implementing, permitting, defs));
@@ -3849,15 +3841,7 @@ protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
             nextToken();
             extending = typeList();
         }
-        List<JCExpression> permitting = List.nil();
-        if (allowSealedTypes && token.kind == IDENTIFIER && token.name() == names.permits) {
-            checkSourceLevel(Feature.SEALED_CLASSES);
-            if ((mods.flags & Flags.SEALED) == 0) {
-                log.error(token.pos, Errors.InvalidPermitsClause(Fragments.ClassIsNotSealed("interface")));
-            }
-            nextToken();
-            permitting = typeList();
-        }
+        List<JCExpression> permitting = permitsClause(mods, "interface");
         List<JCTree> defs;
         defs = classInterfaceOrRecordBody(name, true, false);
         JCClassDecl result = toP(F.at(pos).ClassDef(
@@ -3866,6 +3850,18 @@ protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
         return result;
     }
 
+    List<JCExpression> permitsClause(JCModifiers mods, String classOrInterface) {
+        if (allowSealedTypes && token.kind == IDENTIFIER && token.name() == names.permits) {
+            checkSourceLevel(Feature.SEALED_CLASSES);
+            if ((mods.flags & Flags.SEALED) == 0) {
+                log.error(token.pos, Errors.InvalidPermitsClause(Fragments.ClassIsNotSealed(classOrInterface)));
+            }
+            nextToken();
+            return qualidentList(false);
+        }
+        return List.nil();
+    }
+
     /** EnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody
      *  @param mods    The modifiers starting the enum declaration
      *  @param dc       The documentation comment for the enum, or null.
diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp
index bd50a17b9af..33554463e2a 100644
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp
@@ -104,7 +104,9 @@ JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_cr
   DwarfParser *parser = new DwarfParser(reinterpret_cast<lib_info *>(lib));
   if (!parser->is_parseable()) {
     jclass ex_cls = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException");
-    env->ThrowNew(ex_cls, "DWARF not found");
+    if (!env->ExceptionOccurred()) {
+        env->ThrowNew(ex_cls, "DWARF not found");
+    }
     return 0L;
   }
 
@@ -146,7 +148,9 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_pro
   DwarfParser *parser = reinterpret_cast<DwarfParser *>(get_dwarf_context(env, this_obj));
   if (!parser->process_dwarf(pc)) {
     jclass ex_cls = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException");
-    env->ThrowNew(ex_cls, "Could not find PC in DWARF");
+    if (!env->ExceptionOccurred()) {
+        env->ThrowNew(ex_cls, "Could not find PC in DWARF");
+    }
     return;
   }
 }
diff --git a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c
index b84c6505997..a7e4b0b5874 100644
--- a/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c
+++ b/src/jdk.hotspot.agent/macosx/native/libsaproc/libproc_impl.c
@@ -56,6 +56,8 @@ int pathmap_open(const char* name) {
     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 @@ int pathmap_open(const char* name) {
       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;
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
index c54f5e8f87e..c4c5f43a76c 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java
@@ -116,8 +116,8 @@ public Type lookupType(String cTypeName, boolean throwException) {
 
         BasicType basicTargetType = createBasicType(cTypeName, false, false, false);
 
-        // transfer fields from GenericGrowableArray to template instance
-        BasicType generic = lookupOrFail("GenericGrowableArray");
+        // transfer fields from GrowableArrayBase to template instance
+        BasicType generic = lookupOrFail("GrowableArrayBase");
         BasicType specific = lookupOrFail("GrowableArray<int>");
         basicTargetType.setSize(specific.getSize());
         Iterator fields = generic.getFields();
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java
index 4a759d93a82..a845dd3982c 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java
@@ -818,8 +818,8 @@ private static void initialize() {
     // CDS specific. Bytecodes rewritten at CDS dump time
     def(_nofast_getfield     , "_nofast_getfield"    , "bJJ"  , null    , BasicType.getTIllegal() , 0, true,  _getfield );
     def(_nofast_putfield     , "_nofast_putfield"    , "bJJ"  , null    , BasicType.getTIllegal() ,-2, true,  _putfield );
-    def(_nofast_aload_0      , "_nofast_aload_0"     , "b"    , null    , BasicType.getTIllegal() , 1, true,  _aload_0  );
-    def(_nofast_iload        , "_nofast_iload"       , "bi"   , null    , BasicType.getTIllegal() , 1, false, _iload    );
+    def(_nofast_aload_0      , "_nofast_aload_0"     , "b"    , null    , BasicType.getTObject()  , 1, true,  _aload_0  );
+    def(_nofast_iload        , "_nofast_iload"       , "bi"   , null    , BasicType.getTInt()     , 1, false, _iload    );
 
     def(_shouldnotreachhere  , "_shouldnotreachhere" , "b"    , null    , BasicType.getTVoid()   ,  0, false);
 
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java
index a738e75b86c..4f983679d43 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java
@@ -42,13 +42,11 @@ public void update(Observable o, Object data) {
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type      = db.lookupType("GenericGrowableArray");
-    _arena_field = type.getAddressField("_arena");
+    Type type      = db.lookupType("GrowableArrayBase");
     _max_field = new CIntField(type.getCIntegerField("_max"), 0);
     _len_field = new CIntField(type.getCIntegerField("_len"), 0);
   }
 
-  private static AddressField _arena_field;
   private static CIntField _max_field;
   private static CIntField _len_field;
 
diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java
index f444b2fb8f8..fab3c38def5 100644
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java
@@ -147,7 +147,7 @@
  * <blockquote><pre>{@code
 MemoryLayout taggedValuesWithHole = MemoryLayout.ofSequence(5,
     MemoryLayout.ofStruct(
-        MemoryLayout.ofPaddingBits(8, ByteOrder.nativeOrder()).withName("kind").
+        MemoryLayout.ofValueBits(8, ByteOrder.nativeOrder()).withName("kind").
         MemoryLayout.ofPaddingBits(32),
         MemoryLayout.ofPaddingBits(32)
 ));
diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
index 5be650a8b4e..239d14b8f5e 100644
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java
@@ -158,8 +158,8 @@
 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();
+                       .mapToInt(s -> (int)VH_int.get(s.baseAddress()))
+                       .sum();
  * }</pre></blockquote>
  *
  * @apiNote In the future, if the Java language permits, {@link MemorySegment}
@@ -620,7 +620,7 @@ static MemorySegment allocateNative(long bytesSize, long alignmentBytes) {
      * (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
+     * 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.
      *
diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java
index 6238bd62a38..1d8408db2e5 100644
--- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java
+++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java
@@ -42,16 +42,16 @@
 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);
-   }
- }
+    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 performances and allow for inlining of the memory access operation through the {@link java.lang.invoke.VarHandle}
+ * 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
diff --git a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
index 2bfe7926e8d..9c45b02e5c2 100644
--- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
+++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
@@ -149,14 +149,19 @@ public long mismatch(MemorySegment other) {
 
         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();
diff --git a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LibProvidersLookup.java b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LibProvidersLookup.java
index 2835db49ad5..aa0b3bbf852 100644
--- a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LibProvidersLookup.java
+++ b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LibProvidersLookup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,13 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.List;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.Collections;
+import java.util.Set;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
diff --git a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxAppImageBuilder.java b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxAppImageBuilder.java
index 1fb01b6ff7e..b9ba8725e6a 100644
--- a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxAppImageBuilder.java
+++ b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxAppImageBuilder.java
@@ -35,6 +35,7 @@
 import java.util.Map;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.ICON;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;
 
 public class LinuxAppImageBuilder extends AbstractAppImageBuilder {
 
@@ -84,7 +85,7 @@ public void prepareApplicationFiles(Map<String, ? super Object> params)
 
         // create the additional launchers, if any
         List<Map<String, ? super Object>> entryPoints
-                = StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params);
+                = ADD_LAUNCHERS.fetchFrom(params);
         for (Map<String, ? super Object> entryPoint : entryPoints) {
             createLauncherForEntryPoint(AddLauncherArguments.merge(params,
                     entryPoint, ICON.getID(), ICON_PNG.getID()), params);
diff --git a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxDebBundler.java b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxDebBundler.java
index e137ee6ff33..de618a75903 100644
--- a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxDebBundler.java
+++ b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxDebBundler.java
@@ -25,7 +25,8 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -35,15 +36,23 @@
 import java.nio.file.attribute.PosixFilePermission;
 import java.nio.file.attribute.PosixFilePermissions;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
-
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
-
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.COPYRIGHT;
 
 public class LinuxDebBundler extends LinuxPackageBundler {
 
diff --git a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxPackageBundler.java b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxPackageBundler.java
index b97ea19cdb5..c3b90d8c6e4 100644
--- a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxPackageBundler.java
+++ b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxPackageBundler.java
@@ -24,19 +24,29 @@
  */
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import static jdk.incubator.jpackage.internal.DesktopIntegration.*;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
-
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_RUNTIME_IMAGE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.DESCRIPTION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.INSTALL_DIR;
 
 abstract class LinuxPackageBundler extends AbstractBundler {
 
diff --git a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxRpmBundler.java b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxRpmBundler.java
index d0ffdb3d030..1c2f7d05c2c 100644
--- a/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxRpmBundler.java
+++ b/src/jdk.incubator.jpackage/linux/classes/jdk/incubator/jpackage/internal/LinuxRpmBundler.java
@@ -25,15 +25,24 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.RELEASE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
 import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
 
 /**
diff --git a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java
index c422c8a78f8..4fae1245776 100644
--- a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java
+++ b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java
@@ -67,6 +67,7 @@
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.MAIN_CLASS;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_APP_IMAGE;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;
 
 public class MacAppImageBuilder extends AbstractAppImageBuilder {
 
@@ -259,7 +260,7 @@ public void prepareApplicationFiles(Map<String, ? super Object> params)
 
         // create additional app launcher(s) and config file(s)
         List<Map<String, ? super Object>> entryPoints =
-                StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params);
+                ADD_LAUNCHERS.fetchFrom(params);
         for (Map<String, ? super Object> entryPoint : entryPoints) {
             Map<String, ? super Object> tmp =
                     AddLauncherArguments.merge(originalParams, entryPoint);
diff --git a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppStoreBundler.java b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppStoreBundler.java
index ccf46b7a9cf..186c13659cf 100644
--- a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppStoreBundler.java
+++ b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppStoreBundler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,19 @@
 package jdk.incubator.jpackage.internal;
 
 import java.io.File;
-import java.io.IOException;
 import java.text.MessageFormat;
-import java.util.*;
-
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
-import static jdk.incubator.jpackage.internal.MacAppBundler.*;
-import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.ResourceBundle;
+
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERBOSE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.MacAppBundler.DEVELOPER_ID_APP_SIGNING_KEY;
+import static jdk.incubator.jpackage.internal.MacAppBundler.DEFAULT_ICNS_ICON;
+import static jdk.incubator.jpackage.internal.MacAppBundler.BUNDLE_ID_SIGNING_PREFIX;
 
 public class MacAppStoreBundler extends MacBaseInstallerBundler {
 
diff --git a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacPkgBundler.java b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacPkgBundler.java
index 894d0ab817d..040469fec49 100644
--- a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacPkgBundler.java
+++ b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacPkgBundler.java
@@ -25,15 +25,28 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
-
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.ResourceBundle;
+
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERBOSE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
 import static jdk.incubator.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEYCHAIN;
 import static jdk.incubator.jpackage.internal.MacBaseInstallerBundler.SIGNING_KEY_USER;
 import static jdk.incubator.jpackage.internal.MacAppImageBuilder.MAC_CF_BUNDLE_IDENTIFIER;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AddLauncherArguments.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AddLauncherArguments.java
index d19cfaaba5c..5b2016348a7 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AddLauncherArguments.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AddLauncherArguments.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.io.File;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageBundler.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageBundler.java
index a830fa1da29..05dd5844647 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageBundler.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageBundler.java
@@ -35,6 +35,8 @@
 import java.util.function.Function;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_APP_IMAGE;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.PREDEFINED_RUNTIME_IMAGE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
 
 
 class AppImageBundler extends AbstractBundler {
@@ -62,7 +64,7 @@ final public boolean validate(Map<String, ? super Object> params)
 
             if (!params.containsKey(PREDEFINED_APP_IMAGE.getID())
                     && !StandardBundlerParam.isRuntimeInstaller(params)) {
-                StandardBundlerParam.LAUNCHER_DATA.fetchFrom(params);
+                LAUNCHER_DATA.fetchFrom(params);
             }
 
             if (paramsValidator != null) {
@@ -132,7 +134,7 @@ private Path createRoot(Map<String, ? super Object> params,
 
         IOUtils.writableOutputDir(outputDirectory);
 
-        String imageName = StandardBundlerParam.APP_NAME.fetchFrom(params);
+        String imageName = APP_NAME.fetchFrom(params);
         if (Platform.isMac()) {
             imageName = imageName + ".app";
         }
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageFile.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageFile.java
index b4feff36f8e..40ca3d5a3c8 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageFile.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/AppImageFile.java
@@ -27,8 +27,8 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.nio.file.Path;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -41,7 +41,9 @@
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
 
 public class AppImageFile {
 
@@ -152,7 +154,7 @@ static AppImageFile load(Path appImageDir) throws IOException {
                 return new AppImageFile();
             }
 
-            List<String> addLaunchers = new ArrayList<String>();
+            List<String> addLaunchers = new ArrayList<>();
 
             String platform = xpathQueryNullable(xPath,
                     "/jpackage-state/@platform", doc);
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Arguments.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Arguments.java
index 9838de04e9e..5ab14fcc58a 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Arguments.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Arguments.java
@@ -27,25 +27,18 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
-import java.util.stream.Stream;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/BundleParams.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/BundleParams.java
index ab677750291..bc735fafefd 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/BundleParams.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/BundleParams.java
@@ -25,14 +25,10 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
 
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import java.util.HashMap;
+import java.util.Map;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
 
 public class BundleParams {
 
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Bundler.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Bundler.java
index c219d9457db..06df6b3a10b 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Bundler.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Bundler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 package jdk.incubator.jpackage.internal;
 
 import java.io.File;
-import java.util.Collection;
 import java.util.Map;
 
 /**
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/CfgFile.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/CfgFile.java
index f3fa85e64a6..1eb12e012cb 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/CfgFile.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/CfgFile.java
@@ -31,7 +31,10 @@
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Stream;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.LAUNCHER_DATA;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.JAVA_OPTIONS;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ARGUMENTS;
 
 /**
  * App launcher's config file.
@@ -42,8 +45,8 @@ final class CfgFile {
     }
 
     CfgFile initFromParams(Map<String, ? super Object> params) {
-        launcherData = StandardBundlerParam.LAUNCHER_DATA.fetchFrom(params);
-        launcherName = StandardBundlerParam.APP_NAME.fetchFrom(params);
+        launcherData = LAUNCHER_DATA.fetchFrom(params);
+        launcherName = APP_NAME.fetchFrom(params);
         javaOptions = JAVA_OPTIONS.fetchFrom(params);
         arguments = ARGUMENTS.fetchFrom(params);
         return this;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/DeployParams.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/DeployParams.java
index 1105724b2e5..5f43b93a7fe 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/DeployParams.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/DeployParams.java
@@ -29,12 +29,8 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.InvalidPathException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/FileAssociation.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/FileAssociation.java
index 57a00469569..800ec2a46f8 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/FileAssociation.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/FileAssociation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,18 @@
 import java.io.File;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
 import java.util.stream.Collectors;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.FILE_ASSOCIATIONS;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.FA_EXTENSIONS;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.FA_CONTENT_TYPE;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.FA_ICON;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.FA_DESCRIPTION;
 
 final class FileAssociation {
     void verify() {
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/IOUtils.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/IOUtils.java
index 6375d32ad54..fa31d485dfd 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/IOUtils.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/IOUtils.java
@@ -25,7 +25,12 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.File;
+import java.io.PrintStream;
+import java.io.Writer;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -35,7 +40,11 @@
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/JLinkBundlerHelper.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/JLinkBundlerHelper.java
index 9a43e5fb103..473d00773f8 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/JLinkBundlerHelper.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/JLinkBundlerHelper.java
@@ -37,7 +37,6 @@
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java
index 87268b0cb9c..9667e406bb2 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/LauncherData.java
@@ -31,7 +31,11 @@
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.function.Supplier;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Log.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Log.java
index 35f5a42add1..9b084619620 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Log.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/Log.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
 import java.io.PrintWriter;
 
 /**
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/PathGroup.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/PathGroup.java
index 4b11b5203ac..a791ed36293 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/PathGroup.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/PathGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/StandardBundlerParam.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/StandardBundlerParam.java
index 30c626d6a58..1ea0eb08c32 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/StandardBundlerParam.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/StandardBundlerParam.java
@@ -27,11 +27,8 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleDescriptor.Version;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,15 +37,9 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
-import java.util.ResourceBundle;
 import java.util.Set;
-import java.util.HashSet;
 import java.util.function.BiFunction;
 import java.util.function.Function;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -500,8 +491,7 @@ static void copyPredefinedRuntimeImage(Map<String, ? super Object> params,
                 appLayout.runtimeHomeDirectory(), excludes);
 
         // if module-path given - copy modules to appDir/mods
-        List<Path> modulePath =
-                StandardBundlerParam.MODULE_PATH.fetchFrom(params);
+        List<Path> modulePath = MODULE_PATH.fetchFrom(params);
         List<Path> defaultModulePath = getDefaultModulePath();
         Path dest = appLayout.appModsDirectory();
 
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/ValidOptions.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/ValidOptions.java
index 5581ff47f60..4671db67715 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/ValidOptions.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/ValidOptions.java
@@ -26,9 +26,6 @@
 package jdk.incubator.jpackage.internal;
 
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
 import jdk.incubator.jpackage.internal.Arguments.CLIOptions;
 
 /**
diff --git a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/main/CommandLine.java b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/main/CommandLine.java
index fc1f942b405..08ebc23f8fa 100644
--- a/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/main/CommandLine.java
+++ b/src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/main/CommandLine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.File;
 import java.io.Reader;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/ExecutableRebrander.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/ExecutableRebrander.java
index f9177f4437b..86b07d2752f 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/ExecutableRebrander.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/ExecutableRebrander.java
@@ -29,7 +29,6 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.math.BigInteger;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
 import java.text.MessageFormat;
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinExeBundler.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinExeBundler.java
index 3f02483b4ce..cb7e8e26dff 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinExeBundler.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinExeBundler.java
@@ -24,12 +24,14 @@
  */
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.Map;
 
 public class WinExeBundler extends AbstractBundler {
 
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java
index b64ee43de0a..161cdbd4164 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java
@@ -48,8 +48,6 @@
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.CONFIG_ROOT;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.DESCRIPTION;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.FA_CONTENT_TYPE;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.FILE_ASSOCIATIONS;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.LICENSE_FILE;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.TEMP_ROOT;
 import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
@@ -307,10 +305,12 @@ private void prepareProto(Map<String, ? super Object> params)
             // 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");
         }
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsAppImageBuilder.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsAppImageBuilder.java
index 44609506915..28081c8ccef 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsAppImageBuilder.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsAppImageBuilder.java
@@ -28,20 +28,16 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Reader;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
 import java.util.ResourceBundle;
-import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
 
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ICON;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.ADD_LAUNCHERS;
 
 public class WindowsAppImageBuilder extends AbstractAppImageBuilder {
     private static final ResourceBundle I18N = ResourceBundle.getBundle(
@@ -107,8 +103,7 @@ public void prepareApplicationFiles(Map<String, ? super Object> params)
         copyApplication(params);
 
         // create the additional launcher(s), if any
-        List<Map<String, ? super Object>> entryPoints =
-                StandardBundlerParam.ADD_LAUNCHERS.fetchFrom(params);
+        List<Map<String, ? super Object>> entryPoints = ADD_LAUNCHERS.fetchFrom(params);
         for (Map<String, ? super Object> entryPoint : entryPoints) {
             createLauncherForEntryPoint(AddLauncherArguments.merge(params,
                     entryPoint, ICON.getID(), ICON_ICO.getID()), params);
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsRegistry.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsRegistry.java
index 843023da4e6..f502dc03a2f 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsRegistry.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WindowsRegistry.java
@@ -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
@@ -25,12 +25,6 @@
 
 package jdk.incubator.jpackage.internal;
 
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixPipeline.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixPipeline.java
index 28cc28e4e64..1cc88c63efb 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixPipeline.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixPipeline.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,11 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.function.UnaryOperator;
 import java.util.stream.Stream;
 
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixSourcesBuilder.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixSourcesBuilder.java
index 7613bb064d2..5c018dd34a6 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixSourcesBuilder.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixSourcesBuilder.java
@@ -29,15 +29,30 @@
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
 import java.text.MessageFormat;
-import java.util.*;
-import java.util.function.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import jdk.incubator.jpackage.internal.IOUtils.XmlConsumer;
-import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
-import static jdk.incubator.jpackage.internal.WinMsiBundler.*;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.APP_NAME;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.INSTALL_DIR;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VENDOR;
+import static jdk.incubator.jpackage.internal.StandardBundlerParam.VERSION;
+import static jdk.incubator.jpackage.internal.WinMsiBundler.MSI_SYSTEM_WIDE;
 
 /**
  * Creates application WiX source files.
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixTool.java b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixTool.java
index b73f8e7dfc8..de46437b897 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixTool.java
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WixTool.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,18 @@
 package jdk.incubator.jpackage.internal;
 
 import java.io.IOException;
-import java.nio.file.*;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
diff --git a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs
index 63e32d47030..6b0f9b09f9b 100644
--- a/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs
+++ b/src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/resources/main.wxs
@@ -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>
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java
index 3c9166408b2..609204ebcd6 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java
@@ -772,6 +772,11 @@ HotSpotResolvedObjectTypeImpl getResolvedJavaType(long displacement, boolean com
      */
     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.
      */
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java
index ae8dcbc259a..99fd3016f98 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java
@@ -146,6 +146,18 @@ private boolean checkArgs(Object... args) {
         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) {
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
index 3191918d48b..67f79a950e7 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
@@ -372,6 +372,27 @@ public boolean isLinked() {
         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.
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java
index af3dfdace5b..c71aa16a940 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java
@@ -250,6 +250,20 @@ public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
     public void initialize() {
     }
 
+    @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;
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
index ad45016bafe..3ab8ffa9c46 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
@@ -137,6 +137,9 @@ String getHostArchitectureName() {
     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);
 
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java
index f4b30368937..772e4da7699 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java
@@ -105,6 +105,30 @@ default boolean isLeaf() {
      */
     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
@@ -308,13 +332,15 @@ default ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, Reso
 
     /**
      * 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();
 
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java
new file mode 100644
index 00000000000..9d08ee670f6
--- /dev/null
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/Versions.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal;
+
+import java.util.ResourceBundle;
+
+import static java.util.ResourceBundle.getBundle;
+
+public final class Versions {
+
+    private Versions() { throw new AssertionError(); }
+
+    /**
+     * Returns the version of the {@code javadoc} tool and the Standard doclet.
+     *
+     * <p> This is typically the same as the version of the JDK platform being
+     * used to run the tool, but may be different when running the tool on an
+     * older version of the platform.
+     *
+     * @throws RuntimeException in an unlikely event of the version info
+     *                          not being available
+     *
+     * @apiNote This method does not return {@code null}, has the return type of
+     * {@code Optional<Runtime.Version>}, or throw a checked exception. Those
+     * would warp the API to cater for something that is probably a result of
+     * a build error anyway. Hence, {@code RuntimeException}.
+     *
+     * @return the version
+     */
+    public static Runtime.Version javadocVersion() throws RuntimeException {
+        /*
+         * The "jdk.javadoc.internal.tool.resources.version" resource bundle is
+         * non-localized and represented by a class compiled from a source like this:
+         *
+         * $ cat build/.../support/gensrc/jdk.javadoc/jdk/javadoc/internal/tool/resources/version.java
+         * package jdk.javadoc.internal.tool.resources;
+         *
+         * public final class version extends java.util.ListResourceBundle {
+         *     protected final Object[][] getContents() {
+         *         return new Object[][] {
+         *             { "full", "15-internal+0-2020-06-02-1426246.duke..." },
+         *             { "jdk", "15" },
+         *             { "release", "15-internal" },
+         *         };
+         *     }
+         * }
+         *
+         * The string keyed by "full" should be parseable by Runtime.Version.parse()
+         */
+        ResourceBundle bundle = getBundle("jdk.javadoc.internal.tool.resources.version");
+        return Runtime.Version.parse(bundle.getString("full"));
+    }
+
+    /**
+     * Returns a short string representation of the provided version.
+     *
+     * <p> Examples of strings returned from this method are: "15" and
+     * "15-internal".
+     *
+     * @return a short string representation of the provided version
+     *
+     * @throws NullPointerException if {@code v == null}
+     */
+    public static String shortVersionStringOf(Runtime.Version v) {
+        String svstr = String.valueOf(v.feature());
+        if (v.pre().isPresent()) {
+            svstr += "-" + v.pre().get();
+        }
+        return svstr;
+    }
+
+    /**
+     * Returns a full string representation of the provided version.
+     *
+     * <p> Examples of strings returned from this method are "14+36-1461" and
+     * "15-internal+0-2020-06-02-1426246.duke...".
+     *
+     * @return a full string representation of the provided version
+     *
+     * @throws NullPointerException if {@code v == null}
+     */
+    public static String fullVersionStringOf(Runtime.Version v) {
+        return v.toString();
+    }
+}
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
index 41262280e82..50a11e061db 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
@@ -27,6 +27,7 @@
 
 import java.io.IOException;
 import java.io.Writer;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -105,8 +106,12 @@ protected void addContents(Character uc, List<IndexItem> memberlist,
         addHeading(uc, contentTree);
 
         HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
+        Map<String,Integer> duplicateLabelCheck = new HashMap<>();
+        memberlist.forEach(e -> duplicateLabelCheck.compute(e.getFullyQualifiedLabel(utils),
+                (k, v) -> v == null ? 1 : v + 1));
         for (IndexItem indexItem : memberlist) {
-            addDescription(indexItem, dl);
+            addDescription(indexItem, dl,
+                    duplicateLabelCheck.get(indexItem.getFullyQualifiedLabel(utils)) > 1);
         }
         contentTree.add(dl);
     }
@@ -120,14 +125,14 @@ protected void addHeading(Character uc, Content contentTree) {
         contentTree.add(heading);
     }
 
-    protected void addDescription(IndexItem indexItem, Content dl) {
+    protected void addDescription(IndexItem indexItem, Content dl, boolean addModuleInfo) {
         SearchIndexItem si = indexItem.getSearchTag();
         if (si != null) {
             addDescription(si, dl);
         } else {
             si = new SearchIndexItem();
             si.setLabel(indexItem.getLabel());
-            addElementDescription(indexItem, dl, si);
+            addElementDescription(indexItem, dl, si, addModuleInfo);
             searchItems.add(si);
         }
     }
@@ -138,8 +143,10 @@ protected void addDescription(IndexItem indexItem, Content dl) {
      * @param indexItem the element to be documented
      * @param dlTree the content tree to which the description will be added
      * @param si the search index item
+     * @param addModuleInfo whether to include module information
      */
-    protected void addElementDescription(IndexItem indexItem, Content dlTree, SearchIndexItem si) {
+    protected void addElementDescription(IndexItem indexItem, Content dlTree, SearchIndexItem si,
+                                         boolean addModuleInfo) {
         Content dt;
         Element element = indexItem.getElement();
         String label = indexItem.getLabel();
@@ -165,6 +172,9 @@ protected void addElementDescription(IndexItem indexItem, Content dlTree, Search
                 dt = HtmlTree.DT(getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.INDEX, (TypeElement)element).strong(true)));
                 si.setContainingPackage(utils.getPackageName(utils.containingPackage(element)));
+                if (configuration.showModules && addModuleInfo) {
+                    si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(element)));
+                }
                 si.setCategory(Category.TYPES);
                 dt.add(" - ");
                 addClassInfo((TypeElement)element, dt);
@@ -175,6 +185,9 @@ protected void addElementDescription(IndexItem indexItem, Content dlTree, Search
                         getDocLink(LinkInfoImpl.Kind.INDEX, containingType, element, new StringContent(label))));
                 si.setContainingPackage(utils.getPackageName(utils.containingPackage(element)));
                 si.setContainingClass(utils.getSimpleName(containingType));
+                if (configuration.showModules && addModuleInfo) {
+                    si.setContainingModule(utils.getFullyQualifiedName(utils.containingModule(element)));
+                }
                 if (utils.isExecutableElement(element)) {
                     String url = HtmlTree.encodeURL(links.getName(getAnchor((ExecutableElement)element)));
                     if (!label.equals(url)) {
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
index 7613136899f..b9a6fc52922 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
@@ -205,8 +205,6 @@ private String getHeaderKey(DeprElementKind kind) {
 
     private EnumMap<DeprElementKind, AbstractMemberWriter> writerMap;
 
-    private HtmlConfiguration configuration;
-
     private final Navigation navBar;
 
     /**
@@ -218,7 +216,6 @@ private String getHeaderKey(DeprElementKind kind) {
 
     public DeprecatedListWriter(HtmlConfiguration configuration, DocPath filename) {
         super(configuration, filename);
-        this.configuration = configuration;
         this.navBar = new Navigation(null, configuration, PageMode.DEPRECATED, path);
         NestedClassWriterImpl classW = new NestedClassWriterImpl(this);
         writerMap = new EnumMap<>(DeprElementKind.class);
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
index 5a961c692c7..56eee939d96 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
@@ -276,7 +276,7 @@ protected void addHelpFileContents(Content contentTree) {
                             HtmlTree.CODE(new StringContent(example[0])), example[1])));
         }
         Content searchSpecLink = HtmlTree.A(
-                resources.getText("doclet.help.search.spec.url", Runtime.version().feature()),
+                resources.getText("doclet.help.search.spec.url", configuration.getDocletVersion().feature()),
                 getContent("doclet.help.search.spec.title"));
         Content searchRefer = HtmlTree.P(getContent("doclet.help.search.refer", searchSpecLink));
         section.add(searchIntro)
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
index a189a431636..a055d21daa8 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java
@@ -42,6 +42,7 @@
 import jdk.javadoc.doclet.Reporter;
 import jdk.javadoc.doclet.StandardDoclet;
 import jdk.javadoc.doclet.Taglet;
+import jdk.javadoc.internal.Versions;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
@@ -51,8 +52,6 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
-import static javax.tools.Diagnostic.Kind.*;
-
 /**
  * Configure the output based on the command-line options.
  * <p>
@@ -142,31 +141,29 @@ public HtmlConfiguration(Doclet doclet, Locale locale, Reporter reporter) {
         contents = new Contents(this);
         options = new HtmlOptions(this);
 
-        String v;
+        Runtime.Version v;
         try {
-            // the version bundle is not localized
-            ResourceBundle rb = ResourceBundle.getBundle(versionBundleName, Locale.getDefault());
-            try {
-                v = rb.getString("release");
-            } catch (MissingResourceException e) {
-                v = defaultDocletVersion;
-            }
-        } catch (MissingResourceException e) {
-            v = defaultDocletVersion;
+            v = Versions.javadocVersion();
+        } catch (RuntimeException e) {
+            assert false : e;
+            v = Runtime.version(); // arguably, the only sensible default
         }
         docletVersion = v;
     }
 
-    private static final String versionBundleName = "jdk.javadoc.internal.tool.resources.version";
-    private static final String defaultDocletVersion = System.getProperty("java.version");
-    public final String docletVersion;
+    private final Runtime.Version docletVersion;
     public final Date startTime = new Date();
 
     @Override
-    public String getDocletVersion() {
+    public Runtime.Version getDocletVersion() {
         return docletVersion;
     }
 
+    @Override
+    public String getDocletVersionString() {
+        return Versions.shortVersionStringOf(docletVersion);
+    }
+
     @Override
     public Resources getDocResources() {
         return docResources;
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
index c8ec0e7e88f..26999451093 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
@@ -431,7 +431,7 @@ public void printHtmlDocument(List<String> metakeywords,
         Content htmlComment = contents.newPage;
         List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets();
         additionalStylesheets.addAll(localStylesheets);
-        Head head = new Head(path, configuration.docletVersion, configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
                 .setTimestamp(!options.noTimestamp())
                 .setDescription(description)
                 .setGenerator(getGenerator(getClass()))
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java
index 2794ca8c883..e9ace055240 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java
@@ -75,7 +75,7 @@ private IndexRedirectWriter(HtmlConfiguration configuration, DocPath filename, D
      */
     private void generateIndexFile() throws DocFileIOException {
         Content htmlComment = contents.newPage;
-        Head head = new Head(path, configuration.docletVersion, configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
                 .setTimestamp(!options.noTimestamp())
                 .setDescription("index redirect")
                 .setGenerator(getGenerator(getClass()))
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java
index a5043d8492d..0f2c6181d00 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java
@@ -148,6 +148,9 @@ public String toString() {
                 if (!containingPackage.isEmpty()) {
                     item.append("\"p\":\"").append(containingPackage).append("\",");
                 }
+                if (!containingModule.isEmpty()) {
+                    item.append("\"m\":\"").append(containingModule).append("\",");
+                }
                 item.append("\"l\":\"").append(label).append("\"");
                 if (!url.isEmpty()) {
                     item.append(",\"u\":\"").append(url).append("\"");
@@ -155,8 +158,11 @@ public String toString() {
                 item.append("}");
                 break;
             case MEMBERS:
-                item.append("{")
-                        .append("\"p\":\"").append(containingPackage).append("\",")
+                item.append("{");
+                if (!containingModule.isEmpty()) {
+                    item.append("\"m\":\"").append(containingModule).append("\",");
+                }
+                item.append("\"p\":\"").append(containingPackage).append("\",")
                         .append("\"c\":\"").append(containingClass).append("\",")
                         .append("\"l\":\"").append(label).append("\"");
                 if (!url.isEmpty()) {
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
index 5262a5ca144..f1c58b93957 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
@@ -235,7 +235,7 @@ public void convertClass(TypeElement te, DocPath outputdir)
      * @param path the path for the file.
      */
     private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException {
-        Head head = new Head(path, configuration.docletVersion, configuration.startTime)
+        Head head = new Head(path, configuration.getDocletVersionString(), configuration.startTime)
 //                .setTimestamp(!options.notimestamp) // temporary: compatibility!
                 .setTitle(resources.getText("doclet.Window_Source_title"))
 //                .setCharset(options.charset) // temporary: compatibility!
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
index 9a684ca1b55..c4e4e8b6c84 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
@@ -34,6 +34,7 @@ var searchPattern = "";
 var RANKING_THRESHOLD = 2;
 var NO_MATCH = 0xffff;
 var MAX_RESULTS_PER_CATEGORY = 500;
+var UNNAMED = "<Unnamed>";
 function escapeHtml(str) {
     return str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
 }
@@ -48,14 +49,16 @@ function getURLPrefix(ui) {
         return ui.item.l + slash;
     } else if (ui.item.category === catPackages && ui.item.m) {
         return ui.item.m + slash;
-    } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) {
-        $.each(packageSearchIndex, function(index, item) {
-            if (item.m && ui.item.p == item.l) {
-                urlPrefix = item.m + slash;
-            }
-        });
-        return urlPrefix;
-    } else {
+    } else if (ui.item.category === catTypes || ui.item.category === catMembers) {
+        if (ui.item.m) {
+            urlPrefix = ui.item.m + slash;
+        } else {
+            $.each(packageSearchIndex, function(index, item) {
+                if (item.m && ui.item.p === item.l) {
+                    urlPrefix = item.m + slash;
+                }
+            });
+        }
         return urlPrefix;
     }
     return urlPrefix;
@@ -121,7 +124,7 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
         rMenu.menu.bindings = $();
         $.each(items, function(index, item) {
             var li;
-            if (item.l !== noResult.l && item.category !== currentCategory) {
+            if (item.category && item.category !== currentCategory) {
                 ul.append("<li class=\"ui-autocomplete-category\">" + item.category + "</li>");
                 currentCategory = item.category;
             }
@@ -141,15 +144,15 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
         if (item.category === catModules) {
             label = getHighlightedText(item.l, matcher);
         } else if (item.category === catPackages) {
-            label = (item.m)
-                    ? getHighlightedText(item.m + "/" + item.l, matcher)
-                    : getHighlightedText(item.l, matcher);
+            label = getHighlightedText(item.l, matcher);
         } else if (item.category === catTypes) {
-            label = (item.p)
+            label = (item.p && item.p !== UNNAMED)
                     ? getHighlightedText(item.p + "." + item.l, matcher)
                     : getHighlightedText(item.l, matcher);
         } else if (item.category === catMembers) {
-            label = getHighlightedText(item.p + "." + (item.c + "." + item.l), matcher);
+            label = (item.p && item.p !== UNNAMED)
+                    ? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher)
+                    : getHighlightedText(item.c + "." + item.l, matcher);
         } else if (item.category === catSearchTags) {
             label = getHighlightedText(item.l, matcher);
         } else {
@@ -165,7 +168,11 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
                 div.html(label + "<span class=\"search-tag-holder-result\"> (" + item.h + ")</span>");
             }
         } else {
-            div.html(label);
+            if (item.m) {
+                div.html(item.m + "/" + label);
+            } else {
+                div.html(label);
+            }
         }
         return li;
     }
@@ -317,7 +324,7 @@ $(function() {
             collision: "flip"
         },
         select: function(event, ui) {
-            if (ui.item.l !== noResult.l) {
+            if (ui.item.category) {
                 var url = getURLPrefix(ui);
                 if (ui.item.category === catModules) {
                     url += "module-summary.html";
@@ -330,13 +337,13 @@ $(function() {
                 } else if (ui.item.category === catTypes) {
                     if (ui.item.u) {
                         url = ui.item.u;
-                    } else if (ui.item.p === "<Unnamed>") {
+                    } else if (ui.item.p === UNNAMED) {
                         url += ui.item.l + ".html";
                     } else {
                         url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html";
                     }
                 } else if (ui.item.category === catMembers) {
-                    if (ui.item.p === "<Unnamed>") {
+                    if (ui.item.p === UNNAMED) {
                         url += ui.item.c + ".html" + "#";
                     } else {
                         url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#";
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
index 063cbaef5e1..a3356bdb1fa 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
@@ -144,7 +144,7 @@ doclet.help.package.intro=\
     each. These pages may contain six categories:
 doclet.help.module.intro=\
     Each module has a page that contains a list of its packages, dependencies on other modules, \
-    and services, with a summary for each. These page may contain three categories:
+    and services, with a summary for each. These pages may contain three categories:
 doclet.help.class_interface.head=\
     Class or Interface
 doclet.help.class_interface.intro=\
@@ -164,7 +164,6 @@ doclet.help.class_interface.declaration=\
 doclet.help.class_interface.description=\
     Class or Interface Description
 doclet.help.class_interface.summary=\
-    Each summary entry contains the first sentence from the detailed description for that item. \
     The summary entries are alphabetical, while the detailed descriptions are in the order they \
     appear in the source code. This preserves the logical groupings established by the programmer.
 doclet.help.use.head=\
@@ -189,7 +188,7 @@ doclet.help.tree.package=\
     hierarchy for only that package.
 doclet.help.deprecated.body=\
     The {0} page lists all of the API that have been deprecated. A deprecated API is not \
-    recommended for use, generally due to improvements, and a replacement API is usually given. \
+    recommended for use, generally due to shortcomings, and a replacement API is usually given. \
     Deprecated APIs may be removed in future implementations.
 doclet.help.index.head=\
     Index
@@ -198,9 +197,9 @@ doclet.help.index.body=\
     and fields, as well as lists of all packages and all classes.
 doclet.help.serial_form.body=\
     Each serializable or externalizable class has a description of its serialization fields and \
-    methods. This information is of interest to re-implementors, not to developers using the API. \
+    methods. This information is of interest to those who implement rather than use the API. \
     While there is no link in the navigation bar, you can get to this information by going to any \
-    serialized class and clicking "Serialized Form" in the "See also" section of the class \
+    serialized class and clicking "Serialized Form" in the "See Also" section of the class \
     description.
 doclet.help.constants.body=\
     The {0} page lists the static final fields and their values.
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
index c27710cc431..2f537fc6bc7 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java
@@ -151,11 +151,19 @@ public abstract class BaseConfiguration {
     public abstract Resources getDocResources();
 
     /**
-     * Returns a string identifying the version of the doclet.
+     * Returns the version of the {@link #doclet doclet}.
      *
-     * @return a version string
+     * @return the version
      */
-    public abstract String getDocletVersion();
+    public abstract Runtime.Version getDocletVersion();
+
+    /**
+     * Returns a short string representation of the version returned by
+     * {@linkplain #getDocletVersion()}.
+     *
+     * @return a short string representation of the version
+     */
+    public abstract String getDocletVersionString();
 
     /**
      * This method should be defined in all those doclets (configurations),
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java
index dbe42598ba5..3a2931c6886 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Comparators.java
@@ -139,9 +139,15 @@ public Comparator<Element> makeDeprecatedComparator() {
                 @Override
                 public int compare(Element e1, Element e2) {
                     int result = compareFullyQualifiedNames(e1, e2);
-                    if (result == 0)
-                        result = compareModuleNames(e1, e2);
-                    return result;
+                    if (result != 0) {
+                        return result;
+                    }
+                    // if elements are executable compare their parameter arrays
+                    result = compareParameters(e1, e2);
+                    if (result != 0) {
+                        return result;
+                    }
+                    return compareModuleNames(e1, e2);
                 }
             };
         }
@@ -256,19 +262,11 @@ public int compare(Element e1, Element e2) {
                     if (result != 0) {
                         return result;
                     }
-                    // if element kinds are the same, and are methods,
-                    // compare the method parameters
-                    if (hasParameters(e1)) {
-                        List<? extends VariableElement> parameters1 = ((ExecutableElement)e1).getParameters();
-                        List<? extends VariableElement> parameters2 = ((ExecutableElement)e2).getParameters();
-                        result = compareParameters(false, parameters1, parameters2);
-                        if (result != 0) {
-                            return result;
-                        }
-                        result = compareParameters(true, parameters1, parameters2);
-                        if (result != 0) {
-                            return result;
-                        }
+                    // if element kinds are the same, and are executable,
+                    // compare the parameter arrays
+                    result = compareParameters(e1, e2);
+                    if (result != 0) {
+                        return result;
                     }
                     // else fall back on fully qualified names
                     result = compareFullyQualifiedNames(e1, e2);
@@ -383,15 +381,7 @@ public int compare(Element e1, Element e2) {
                     if (result != 0) {
                         return result;
                     }
-                    if (hasParameters(e1) && hasParameters(e2)) {
-                        List<? extends VariableElement> parameters1 = ((ExecutableElement)e1).getParameters();
-                        List<? extends VariableElement> parameters2 = ((ExecutableElement)e2).getParameters();
-                        result = compareParameters(false, parameters1, parameters2);
-                        if (result != 0) {
-                            return result;
-                        }
-                        result = compareParameters(true, parameters1, parameters2);
-                    }
+                    result = compareParameters(e1, e2);
                     if (result != 0) {
                         return result;
                     }
@@ -504,6 +494,34 @@ protected int compareModuleNames(Element e1, Element e2) {
             return 0;
         }
 
+        /**
+         * Compares the parameter arrays of two elements if they both are executable.
+         * @param e1 the first element
+         * @param e2 the second element
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second
+         */
+        protected int compareParameters(Element e1, Element e2) {
+            int result = 0;
+            if (hasParameters(e1) && hasParameters(e2)) {
+                List<? extends VariableElement> parameters1 = ((ExecutableElement)e1).getParameters();
+                List<? extends VariableElement> parameters2 = ((ExecutableElement)e2).getParameters();
+                result = compareParameters(false, parameters1, parameters2);
+                if (result != 0) {
+                    return result;
+                }
+                result = compareParameters(true, parameters1, parameters2);
+            }
+            return result;
+        }
+
+        /**
+         * Compares the kinds of two elements.
+         * @param e1 the first element
+         * @param e2 the second element
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second
+         */
         protected int compareElementKinds(Element e1, Element e2) {
             return Integer.compare(getKindIndex(e1), getKindIndex(e2));
         }
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java
index d88d1fa4e13..75e818c8d24 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexItem.java
@@ -26,7 +26,6 @@
 package jdk.javadoc.internal.doclets.toolkit.util;
 
 import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem;
-import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
@@ -90,6 +89,16 @@ public String getLabel() {
         return label;
     }
 
+    public String getFullyQualifiedLabel(Utils utils) {
+        if (typeElement != null) {
+            return utils.getFullyQualifiedName(typeElement) + "." + label;
+        } else if (element != null) {
+            return utils.getFullyQualifiedName(element);
+        } else {
+            return label;
+        }
+    }
+
     public Element getElement() {
         return element;
     }
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java
index cc6deb73720..261c2d53886 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,6 +109,7 @@ public Content visitArray(ArrayType type, LinkInfo linkInfo) {
                 @Override
                 public Content visitWildcard(WildcardType type, LinkInfo linkInfo) {
                     linkInfo.isTypeBound = true;
+                    link.add(getTypeAnnotationLinks(linkInfo));
                     link.add("?");
                     TypeMirror extendsBound = type.getExtendsBound();
                     if (extendsBound != null) {
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
index ef695034c0e..24cce42cf57 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
@@ -31,16 +31,14 @@
 import java.text.BreakIterator;
 import java.text.Collator;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.IllformedLocaleException;
 import java.util.List;
 import java.util.Locale;
-import java.util.MissingResourceException;
 import java.util.Objects;
-import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
 import javax.tools.JavaFileManager;
@@ -62,6 +60,7 @@
 import jdk.javadoc.doclet.Doclet.Option;
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.doclet.StandardDoclet;
+import jdk.javadoc.internal.Versions;
 import jdk.javadoc.internal.tool.Main.Result;
 import jdk.javadoc.internal.tool.ToolOptions.ToolOption;
 
@@ -167,17 +166,30 @@ public void Xusage() {
 
             @Override
             public void version() {
-                showVersion("javadoc.version", "release");
+                showVersion("javadoc.version", orDefault(() -> Versions.shortVersionStringOf(toolVersion())));
             }
 
             @Override
             public void fullVersion() {
-                showVersion("javadoc.fullversion", "full");
+                showVersion("javadoc.fullversion", orDefault(() -> Versions.fullVersionStringOf(toolVersion())));
+            }
+
+            private String orDefault(Supplier<String> s) {
+                try {
+                    return s.get();
+                } catch (RuntimeException e) {
+                    assert false : e;
+                    return Log.getLocalizedString("version.not.available");
+                }
             }
         };
         return new ToolOptions(context, messager, helper);
     }
 
+    private Runtime.Version toolVersion() {
+        return Versions.javadocVersion();
+    }
+
     private void showUsage() {
         showUsage("main.usage", ToolOption.Kind.STANDARD, "main.usage.foot");
     }
@@ -196,26 +208,8 @@ private void showUsage(String headerKey, ToolOption.Kind kind, String footerKey)
             messager.notice(footerKey);
     }
 
-    private static final String versionRBName = "jdk.javadoc.internal.tool.resources.version";
-    private static ResourceBundle versionRB;
-
-    private void showVersion(String labelKey, String versionKey) {
-        messager.notice(labelKey, messager.programName, getVersion(versionKey));
-    }
-
-    private static String getVersion(String key) {
-        if (versionRB == null) {
-            try {
-                versionRB = ResourceBundle.getBundle(versionRBName);
-            } catch (MissingResourceException e) {
-                return Log.getLocalizedString("version.not.available");
-            }
-        }
-        try {
-            return versionRB.getString(key);
-        } catch (MissingResourceException e) {
-            return Log.getLocalizedString("version.not.available");
-        }
+    private void showVersion(String labelKey, String value) {
+        messager.notice(labelKey, messager.programName, value);
     }
 
     private void showToolOptions(ToolOption.Kind kind) {
diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/Type.java b/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
index 91ab3dee148..c5d7554799c 100644
--- a/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/Type.java
@@ -152,7 +152,7 @@ public interface Type extends Mirror {
      * Returns the name of this type. The result is of the same form as
      * the name returned by {@link Class#getName()}.
      * The returned name may not be a
-     * <a href="${docRoot}/java.base/java/lang/ClassLoader.html#binary-name">binary name</a>.
+     * <a href="{@docRoot}/java.base/java/lang/ClassLoader.html#binary-name">binary name</a>.
      *
      * @return the name of this type
      */
diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java b/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java
index 14a100a1f8c..a449b55df1e 100644
--- a/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java
@@ -217,6 +217,7 @@ default List<ModuleReference> allModules() {
      * is false attempting any of the unsupported class file changes described
      * in <a href="{@docRoot}/../specs/jvmti.html#RedefineClasses">
      * JVM TI RedefineClasses</a> will throw this exception.
+     * </UL>
      *
      * @throws java.lang.NoClassDefFoundError if the bytes
      * don't correspond to the reference type (the names
diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java b/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
index 2431f6c02ed..8b5957dc0d9 100644
--- a/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java
@@ -185,6 +185,7 @@
  * </UL>
  * </TD>
  * </TR>
+ * </TBODY>
  * </TABLE>
  *
  * <p> Connectors are created at start-up time. That is, they
diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java b/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java
index e236da0838a..ae2fe364bfb 100644
--- a/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java
@@ -44,7 +44,7 @@ public interface ClassUnloadEvent extends Event {
     /**
      * Returns the {@linkplain com.sun.jdi.Type#name() name of the class}
      * that has been unloaded. The returned string may not be a
-     * <a href="${docRoot}/java.base/java/lang/ClassLoader.html#binary-name">binary name</a>.
+     * <a href="{@docRoot}/java.base/java/lang/ClassLoader.html#binary-name">binary name</a>.
      *
      * @see Class#getName()
      */
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java
deleted file mode 100644
index 20f297877a0..00000000000
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.jfr.internal;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import jdk.internal.org.xml.sax.Attributes;
-import jdk.internal.org.xml.sax.EntityResolver;
-import jdk.internal.org.xml.sax.SAXException;
-import jdk.internal.org.xml.sax.helpers.DefaultHandler;
-import jdk.internal.util.xml.SAXParser;
-import jdk.internal.util.xml.impl.SAXParserImpl;
-import jdk.jfr.AnnotationElement;
-import jdk.jfr.Category;
-import jdk.jfr.Description;
-import jdk.jfr.Enabled;
-import jdk.jfr.Experimental;
-import jdk.jfr.Label;
-import jdk.jfr.Period;
-import jdk.jfr.Relational;
-import jdk.jfr.StackTrace;
-import jdk.jfr.Threshold;
-import jdk.jfr.TransitionFrom;
-import jdk.jfr.TransitionTo;
-import jdk.jfr.Unsigned;
-
-final class MetadataHandler extends DefaultHandler implements EntityResolver {
-
-    // Metadata and Checkpoint event
-    private final long RESERVED_EVENT_COUNT = 2;
-
-    static class TypeElement {
-        List<FieldElement> fields = new ArrayList<>();
-        String name;
-        String label;
-        String description;
-        String category;
-        String superType;
-        String period;
-        boolean thread;
-        boolean startTime;
-        boolean stackTrace;
-        boolean cutoff;
-        boolean isEvent;
-        boolean isRelation;
-        boolean experimental;
-        boolean valueType;
-    }
-
-    static class FieldElement {
-        TypeElement referenceType;
-        String name;
-        String label;
-        String description;
-        String contentType;
-        String typeName;
-        String transition;
-        String relation;
-        boolean struct;
-        boolean array;
-        boolean experimental;
-        boolean unsigned;
-    }
-
-    static class XmlType {
-        String name;
-        String javaType;
-        String contentType;
-        boolean unsigned;
-    }
-
-    final Map<String, TypeElement> types = new LinkedHashMap<>(200);
-    final Map<String, XmlType> xmlTypes = new LinkedHashMap<>(20);
-    final Map<String, List<AnnotationElement>> xmlContentTypes = new LinkedHashMap<>(20);
-    FieldElement currentField;
-    TypeElement currentType;
-    long eventCount;
-
-    @Override
-    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
-        switch (qName) {
-        case "XmlType":
-            XmlType xmlType = new XmlType();
-            xmlType.name = attributes.getValue("name");
-            xmlType.javaType = attributes.getValue("javaType");
-            xmlType.contentType = attributes.getValue("contentType");
-            xmlType.unsigned = Boolean.valueOf(attributes.getValue("unsigned"));
-            xmlTypes.put(xmlType.name, xmlType);
-            break;
-        case "Relation":
-        case "Type":
-        case "Event":
-            currentType = new TypeElement();
-            currentType.name = attributes.getValue("name");
-            currentType.label = attributes.getValue("label");
-            currentType.description = attributes.getValue("description");
-            currentType.category = attributes.getValue("category");
-            currentType.thread = getBoolean(attributes, "thread", false);
-            currentType.stackTrace = getBoolean(attributes, "stackTrace", false);
-            currentType.startTime = getBoolean(attributes, "startTime", true);
-            currentType.period = attributes.getValue("period");
-            currentType.cutoff = getBoolean(attributes, "cutoff", false);
-            currentType.experimental = getBoolean(attributes, "experimental", false);
-            currentType.isEvent = qName.equals("Event");
-            currentType.isRelation = qName.equals("Relation");
-            break;
-        case "Field":
-            currentField = new FieldElement();
-            currentField.struct = getBoolean(attributes, "struct", false);
-            currentField.array = getBoolean(attributes, "array", false);
-            currentField.name = attributes.getValue("name");
-            currentField.label = attributes.getValue("label");
-            currentField.typeName = attributes.getValue("type");
-            currentField.description = attributes.getValue("description");
-            currentField.experimental = getBoolean(attributes, "experimental", false);
-            currentField.contentType = attributes.getValue("contentType");
-            currentField.relation = attributes.getValue("relation");
-            currentField.transition = attributes.getValue("transition");
-            break;
-        case "XmlContentType":
-            String name = attributes.getValue("name");
-            String annotation = attributes.getValue("annotation");
-            xmlContentTypes.put(name, createAnnotationElements(annotation));
-            break;
-        }
-    }
-
-    private List<AnnotationElement> createAnnotationElements(String annotation) throws InternalError {
-        String[] annotations = annotation.split(",");
-        List<AnnotationElement> annotationElements = new ArrayList<>();
-        for (String a : annotations) {
-            a = a.trim();
-            int leftParenthesis = a.indexOf("(");
-            if (leftParenthesis == -1) {
-                annotationElements.add(new AnnotationElement(createAnnotationClass(a)));
-            } else {
-                int rightParenthesis = a.lastIndexOf(")");
-                if (rightParenthesis == -1) {
-                    throw new InternalError("Expected closing parenthesis for 'XMLContentType'");
-                }
-                String value = a.substring(leftParenthesis + 1, rightParenthesis);
-                String type = a.substring(0, leftParenthesis);
-                annotationElements.add(new AnnotationElement(createAnnotationClass(type), value));
-            }
-        }
-        return annotationElements;
-    }
-
-    @SuppressWarnings("unchecked")
-    private Class<? extends Annotation> createAnnotationClass(String type) {
-        try {
-            if (!type.startsWith("jdk.jfr.")) {
-                throw new IllegalStateException("Incorrect type " + type + ". Annotation class must be located in jdk.jfr package.");
-            }
-            Class<?> c = Class.forName(type, true, null);
-            return (Class<? extends Annotation>) c;
-        } catch (ClassNotFoundException cne) {
-            throw new IllegalStateException(cne);
-        }
-    }
-
-    private boolean getBoolean(Attributes attributes, String name, boolean defaultValue) {
-        String value = attributes.getValue(name);
-        return value == null ? defaultValue : Boolean.valueOf(value);
-    }
-
-    @Override
-    public void endElement(String uri, String localName, String qName) {
-        switch (qName) {
-        case "Type":
-        case "Event":
-        case "Relation":
-            types.put(currentType.name, currentType);
-            if (currentType.isEvent) {
-                eventCount++;
-            }
-            currentType = null;
-            break;
-        case "Field":
-            currentType.fields.add(currentField);
-            currentField = null;
-            break;
-        }
-    }
-
-    public static List<Type> createTypes() throws IOException {
-        SAXParser parser = new SAXParserImpl();
-        MetadataHandler t = new MetadataHandler();
-        try (InputStream is = new BufferedInputStream(SecuritySupport.getResourceAsStream("/jdk/jfr/internal/types/metadata.xml"))) {
-            Logger.log(LogTag.JFR_SYSTEM, LogLevel.DEBUG, "Parsing metadata.xml");
-            try {
-                parser.parse(is, t);
-                return t.buildTypes();
-            } catch (Exception e) {
-                throw new IOException(e);
-            }
-        }
-    }
-
-    private List<Type> buildTypes() {
-        removeXMLConvenience();
-        Map<String, Type> typeMap = buildTypeMap();
-        Map<String, AnnotationElement> relationMap = buildRelationMap(typeMap);
-        addFields(typeMap, relationMap);
-        return trimTypes(typeMap);
-    }
-
-    private Map<String, AnnotationElement> buildRelationMap(Map<String, Type> typeMap) {
-        Map<String, AnnotationElement> relationMap = new HashMap<>();
-        for (TypeElement t : types.values()) {
-            if (t.isRelation) {
-                Type relationType = typeMap.get(t.name);
-                AnnotationElement ae = PrivateAccess.getInstance().newAnnotation(relationType, Collections.emptyList(), true);
-                relationMap.put(t.name, ae);
-            }
-        }
-        return relationMap;
-    }
-
-    private List<Type> trimTypes(Map<String, Type> lookup) {
-        List<Type> trimmedTypes = new ArrayList<>(lookup.size());
-        for (Type t : lookup.values()) {
-            t.trimFields();
-            trimmedTypes.add(t);
-        }
-        return trimmedTypes;
-    }
-
-    private void addFields(Map<String, Type> lookup, Map<String, AnnotationElement> relationMap) {
-        for (TypeElement te : types.values()) {
-            Type type = lookup.get(te.name);
-            if (te.isEvent) {
-                boolean periodic = te.period!= null;
-                TypeLibrary.addImplicitFields(type, periodic, te.startTime && !periodic, te.thread, te.stackTrace && !periodic, te.cutoff);
-            }
-            for (FieldElement f : te.fields) {
-                Type fieldType = Type.getKnownType(f.typeName);
-                if (fieldType == null) {
-                    fieldType = Objects.requireNonNull(lookup.get(f.referenceType.name));
-                }
-                List<AnnotationElement> aes = new ArrayList<>();
-                if (f.unsigned) {
-                    aes.add(new AnnotationElement(Unsigned.class));
-                }
-                if (f.contentType != null) {
-                    aes.addAll(Objects.requireNonNull(xmlContentTypes.get(f.contentType)));
-                }
-                if (f.relation != null) {
-                    String relationTypeName = Type.TYPES_PREFIX + f.relation;
-                    AnnotationElement t = relationMap.get(relationTypeName);
-                    aes.add(Objects.requireNonNull(t));
-                }
-                if (f.label != null) {
-                    aes.add(new AnnotationElement(Label.class, f.label));
-                }
-                if (f.experimental) {
-                    aes.add(new AnnotationElement(Experimental.class));
-                }
-                if (f.description != null) {
-                    aes.add(new AnnotationElement(Description.class, f.description));
-                }
-                if ("from".equals(f.transition)) {
-                    aes.add(new AnnotationElement(TransitionFrom.class));
-                }
-                if ("to".equals(f.transition)) {
-                    aes.add(new AnnotationElement(TransitionTo.class));
-                }
-                boolean constantPool = !f.struct && f.referenceType != null;
-                type.add(PrivateAccess.getInstance().newValueDescriptor(f.name, fieldType, aes, f.array ? 1 : 0, constantPool, null));
-            }
-        }
-    }
-
-    private Map<String, Type> buildTypeMap() {
-        Map<String, Type> typeMap = new HashMap<>();
-        Map<String, Type> knownTypeMap = new HashMap<>();
-        for (Type kt :Type.getKnownTypes()) {
-            typeMap.put(kt.getName(), kt);
-            knownTypeMap.put(kt.getName(), kt);
-        }
-        long eventTypeId = RESERVED_EVENT_COUNT;
-        long typeId = RESERVED_EVENT_COUNT + eventCount + knownTypeMap.size();
-        for (TypeElement t : types.values()) {
-            List<AnnotationElement> aes = new ArrayList<>();
-            if (t.category != null) {
-                aes.add(new AnnotationElement(Category.class, buildCategoryArray(t.category)));
-            }
-            if (t.label != null) {
-                aes.add(new AnnotationElement(Label.class, t.label));
-            }
-            if (t.description != null) {
-                aes.add(new AnnotationElement(Description.class, t.description));
-            }
-            if (t.isEvent) {
-                if (t.period != null) {
-                    aes.add(new AnnotationElement(Period.class, t.period));
-                } else {
-                    if (t.startTime) {
-                        aes.add(new AnnotationElement(Threshold.class, "0 ns"));
-                    }
-                    if (t.stackTrace) {
-                        aes.add(new AnnotationElement(StackTrace.class, true));
-                    }
-                }
-                if (t.cutoff) {
-                    aes.add(new AnnotationElement(Cutoff.class, Cutoff.INFINITY));
-                }
-            }
-            if (t.experimental) {
-                aes.add(new AnnotationElement(Experimental.class));
-            }
-            Type type;
-            if (t.isEvent) {
-                aes.add(new AnnotationElement(Enabled.class, false));
-                type = new PlatformEventType(t.name,  eventTypeId++, false, true);
-            } else {
-                if (knownTypeMap.containsKey(t.name)) {
-                    type = knownTypeMap.get(t.name);
-                } else {
-                    if (t.isRelation) {
-                        type = new Type(t.name, Type.SUPER_TYPE_ANNOTATION, typeId++);
-                        aes.add(new AnnotationElement(Relational.class));
-                    } else {
-                        type = new Type(t.name, null, typeId++);
-                    }
-                }
-            }
-            type.setAnnotations(aes);
-            typeMap.put(t.name, type);
-        }
-        return typeMap;
-    }
-
-    private String[] buildCategoryArray(String category) {
-        List<String> categories = new ArrayList<>();
-        StringBuilder sb = new StringBuilder();
-        for (char c : category.toCharArray()) {
-            if (c == ',') {
-                categories.add(sb.toString().trim());
-                sb.setLength(0);
-            } else {
-                sb.append(c);
-            }
-        }
-        categories.add(sb.toString().trim());
-        return categories.toArray(new String[0]);
-    }
-
-    private void removeXMLConvenience() {
-        for (TypeElement t : types.values()) {
-            XmlType xmlType = xmlTypes.get(t.name);
-            if (xmlType != null && xmlType.javaType != null) {
-                t.name = xmlType.javaType; // known type, i.e primitive
-            } else {
-                if (t.isEvent) {
-                    t.name = Type.EVENT_NAME_PREFIX + t.name;
-                } else {
-                    t.name = Type.TYPES_PREFIX + t.name;
-                }
-            }
-        }
-
-        for (TypeElement t : types.values()) {
-            for (FieldElement f : t.fields) {
-                f.referenceType = types.get(f.typeName);
-                XmlType xmlType = xmlTypes.get(f.typeName);
-                if (xmlType != null) {
-                    if (xmlType.javaType != null) {
-                        f.typeName = xmlType.javaType;
-                    }
-                    if (xmlType.contentType != null) {
-                        f.contentType = xmlType.contentType;
-                    }
-                    if (xmlType.unsigned) {
-                        f.unsigned = true;
-                    }
-                }
-                if (f.struct && f.referenceType != null) {
-                    f.referenceType.valueType = true;
-                }
-            }
-        }
-    }
-}
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java
new file mode 100644
index 00000000000..e0e242bf03b
--- /dev/null
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jfr.internal;
+
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import jdk.jfr.AnnotationElement;
+import jdk.jfr.Category;
+import jdk.jfr.Description;
+import jdk.jfr.Enabled;
+import jdk.jfr.Experimental;
+import jdk.jfr.Label;
+import jdk.jfr.Period;
+import jdk.jfr.Relational;
+import jdk.jfr.StackTrace;
+import jdk.jfr.Threshold;
+import jdk.jfr.TransitionFrom;
+import jdk.jfr.TransitionTo;
+import jdk.jfr.Unsigned;
+
+public final class MetadataLoader {
+
+    // Caching to reduce allocation pressure and heap usage
+    private final AnnotationElement RELATIONAL = new AnnotationElement(Relational.class);
+    private final AnnotationElement ENABLED = new AnnotationElement(Enabled.class, false);
+    private final AnnotationElement THRESHOLD = new AnnotationElement(Threshold.class, "0 ns");
+    private final AnnotationElement STACK_TRACE = new AnnotationElement(StackTrace.class, true);
+    private final AnnotationElement TRANSITION_TO = new AnnotationElement(TransitionTo.class);
+    private final AnnotationElement TRANSITION_FROM = new AnnotationElement(TransitionFrom.class);
+    private final AnnotationElement EXPERIMENTAL = new AnnotationElement(Experimental.class);
+    private final AnnotationElement UNSIGNED = new AnnotationElement(Unsigned.class);
+    private final List<Object> SMALL_TEMP_LIST = new ArrayList<>();
+    private final Type LABEL_TYPE = TypeLibrary.createAnnotationType(Label.class);
+    private final Type DESCRIPTION_TYPE = TypeLibrary.createAnnotationType(Description.class);
+    private final Type CATEGORY_TYPE = TypeLibrary.createAnnotationType(Category.class);
+    private final Type PERIOD_TYPE = TypeLibrary.createAnnotationType(Period.class);
+
+    // <Event>, <Type> and <Relation>
+    private final static class TypeElement {
+        private final List<FieldElement> fields;
+        private final String name;
+        private final String label;
+        private final String description;
+        private final String category;
+        private final String period;
+        private final boolean thread;
+        private final boolean startTime;
+        private final boolean stackTrace;
+        private final boolean cutoff;
+        private final boolean isEvent;
+        private final boolean isRelation;
+        private final boolean experimental;
+        private final long id;
+
+        public TypeElement(DataInputStream dis) throws IOException {
+            int fieldCount = dis.readInt();
+            fields = new ArrayList<>(fieldCount);
+            for (int i = 0; i < fieldCount; i++) {
+                fields.add(new FieldElement(dis));
+            }
+            name = dis.readUTF();
+            label = dis.readUTF();
+            description = dis.readUTF();
+            category = dis.readUTF();
+            thread = dis.readBoolean();
+            stackTrace = dis.readBoolean();
+            startTime = dis.readBoolean();
+            period = dis.readUTF();
+            cutoff = dis.readBoolean();
+            experimental = dis.readBoolean();
+            id = dis.readLong();
+            isEvent = dis.readBoolean();
+            isRelation = dis.readBoolean();
+        }
+    }
+
+    // <Field>
+    private static class FieldElement {
+        private final String name;
+        private final String label;
+        private final String description;
+        private final String typeName;
+        private final String annotations;
+        private final String transition;
+        private final String relation;
+        private final boolean constantPool;
+        private final boolean array;
+        private final boolean experimental;
+        private final boolean unsigned;
+
+        public FieldElement(DataInputStream dis) throws IOException {
+            name = dis.readUTF();
+            typeName = dis.readUTF();
+            label = dis.readUTF();
+            description = dis.readUTF();
+            constantPool = dis.readBoolean();
+            array = dis.readBoolean();
+            unsigned = dis.readBoolean();
+            annotations = dis.readUTF();
+            transition = dis.readUTF();
+            relation = dis.readUTF();
+            experimental = dis.readBoolean();
+        }
+    }
+
+    private final List<TypeElement> types;
+    private final Map<String, List<AnnotationElement>> anotationElements = new HashMap<>(20);
+    private final Map<String, AnnotationElement> categories = new HashMap<>();
+
+    MetadataLoader(DataInputStream dis) throws IOException {
+        SMALL_TEMP_LIST.add(this); // add any object to expand list
+        int typeCount = dis.readInt();
+        types = new ArrayList<>(typeCount);
+        for (int i = 0; i < typeCount; i++) {
+            types.add(new TypeElement(dis));
+        }
+    }
+
+    private List<AnnotationElement> createAnnotationElements(String annotation) throws InternalError {
+        String[] annotations = annotation.split(",");
+        List<AnnotationElement> annotationElements = new ArrayList<>();
+        for (String a : annotations) {
+            a = a.trim();
+            int leftParenthesis = a.indexOf("(");
+            if (leftParenthesis == -1) {
+                annotationElements.add(new AnnotationElement(createAnnotationClass(a)));
+            } else {
+                int rightParenthesis = a.lastIndexOf(")");
+                if (rightParenthesis == -1) {
+                    throw new InternalError("Expected closing parenthesis for 'XMLContentType'");
+                }
+                String value = a.substring(leftParenthesis + 1, rightParenthesis);
+                String type = a.substring(0, leftParenthesis);
+                annotationElements.add(new AnnotationElement(createAnnotationClass(type), value));
+            }
+        }
+        return annotationElements;
+    }
+
+    @SuppressWarnings("unchecked")
+    private Class<? extends Annotation> createAnnotationClass(String type) {
+        try {
+            if (!type.startsWith("jdk.jfr.")) {
+                throw new IllegalStateException("Incorrect type " + type + ". Annotation class must be located in jdk.jfr package.");
+            }
+            Class<?> c = Class.forName(type, true, null);
+            return (Class<? extends Annotation>) c;
+        } catch (ClassNotFoundException cne) {
+            throw new IllegalStateException(cne);
+        }
+    }
+
+    public static List<Type> createTypes() throws IOException {
+        try (DataInputStream dis = new DataInputStream(
+                SecuritySupport.getResourceAsStream("/jdk/jfr/internal/types/metadata.bin"))) {
+            MetadataLoader ml = new MetadataLoader(dis);
+            return ml.buildTypes();
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+    }
+
+    private List<Type> buildTypes() {
+        Map<String, Type> typeMap = buildTypeMap();
+        Map<String, AnnotationElement> relationMap = buildRelationMap(typeMap);
+        addFields(typeMap, relationMap);
+        return new ArrayList<>(typeMap.values());
+    }
+
+    private Map<String, AnnotationElement> buildRelationMap(Map<String, Type> typeMap) {
+        Map<String, AnnotationElement> relationMap = new HashMap<>(20);
+        for (TypeElement t : types) {
+            if (t.isRelation) {
+                Type relationType = typeMap.get(t.name);
+                AnnotationElement ae = PrivateAccess.getInstance().newAnnotation(relationType, Collections.emptyList(), true);
+                relationMap.put(t.name, ae);
+            }
+        }
+        return relationMap;
+    }
+
+    private void addFields(Map<String, Type> lookup, Map<String, AnnotationElement> relationMap) {
+        for (TypeElement te : types) {
+            Type type = lookup.get(te.name);
+            if (te.isEvent) {
+                boolean periodic = !te.period.isEmpty();
+                TypeLibrary.addImplicitFields(type, periodic, te.startTime && !periodic, te.thread, te.stackTrace && !periodic, te.cutoff);
+            }
+            for (FieldElement f : te.fields) {
+                Type fieldType = Type.getKnownType(f.typeName);
+                if (fieldType == null) {
+                    fieldType = Objects.requireNonNull(lookup.get(f.typeName));
+                }
+                List<AnnotationElement> aes = new ArrayList<>();
+                if (f.unsigned) {
+                    aes.add(UNSIGNED);
+                }
+                if (!f.annotations.isEmpty()) {
+                    var ae = anotationElements.get(f.annotations);
+                    if (ae == null) {
+                        ae = createAnnotationElements(f.annotations);
+                        anotationElements.put(f.annotations, ae);
+                    }
+                    aes.addAll(ae);
+                }
+                if (!f.relation.isEmpty()) {
+                    AnnotationElement t = relationMap.get(f.relation);
+                    aes.add(Objects.requireNonNull(t));
+                }
+                if (!f.label.isEmpty()) {
+                    aes.add(newAnnotation(LABEL_TYPE, f.label));
+                }
+                if (f.experimental) {
+                    aes.add(EXPERIMENTAL);
+                }
+                if (!f.description.isEmpty()) {
+                    aes.add(newAnnotation(DESCRIPTION_TYPE, f.description));
+                }
+                if ("from".equals(f.transition)) {
+                    aes.add(TRANSITION_FROM);
+                }
+                if ("to".equals(f.transition)) {
+                    aes.add(TRANSITION_TO);
+                }
+                type.add(PrivateAccess.getInstance().newValueDescriptor(f.name, fieldType, aes, f.array ? 1 : 0, f.constantPool, null));
+            }
+        }
+    }
+
+    private AnnotationElement newAnnotation(Type type, Object value) {
+        SMALL_TEMP_LIST.set(0, value);
+        return PrivateAccess.getInstance().newAnnotation(type, SMALL_TEMP_LIST, true);
+    }
+
+    private Map<String, Type> buildTypeMap() {
+        Map<String, Type> typeMap = new HashMap<>(2 * types.size());
+        Map<String, Type> knownTypeMap = new HashMap<>(20);
+        for (Type kt : Type.getKnownTypes()) {
+            typeMap.put(kt.getName(), kt);
+            knownTypeMap.put(kt.getName(), kt);
+        }
+        for (TypeElement t : types) {
+            List<AnnotationElement> aes = new ArrayList<>();
+            if (!t.category.isEmpty()) {
+                AnnotationElement cat = categories.get(t.category);
+                if (cat == null) {
+                    String[] segments = buildCategorySegments(t.category);
+                    cat = newAnnotation(CATEGORY_TYPE, segments);
+                    categories.put(t.category, cat);
+                }
+                aes.add(cat);
+            }
+            if (!t.label.isEmpty()) {
+                aes.add(newAnnotation(LABEL_TYPE, t.label));
+            }
+            if (!t.description.isEmpty()) {
+                aes.add(newAnnotation(DESCRIPTION_TYPE, t.description));
+            }
+            if (t.isEvent) {
+                if (!t.period.isEmpty()) {
+                    aes.add(newAnnotation(PERIOD_TYPE, t.period));
+                } else {
+                    if (t.startTime) {
+                        aes.add(THRESHOLD);
+                    }
+                    if (t.stackTrace) {
+                        aes.add(STACK_TRACE);
+                    }
+                }
+                if (t.cutoff) {
+                    aes.add(new AnnotationElement(Cutoff.class, Cutoff.INFINITY));
+                }
+            }
+            if (t.experimental) {
+                aes.add(EXPERIMENTAL);
+            }
+            Type type;
+            if (t.isEvent) {
+                aes.add(ENABLED);
+                type = new PlatformEventType(t.name, t.id, false, true);
+            } else {
+                type = knownTypeMap.get(t.name);
+                if (type == null) {
+                    if (t.isRelation) {
+                        type = new Type(t.name, Type.SUPER_TYPE_ANNOTATION, t.id);
+                        aes.add(RELATIONAL);
+                    } else {
+                        type = new Type(t.name, null, t.id);
+                    }
+                }
+            }
+            type.setAnnotations(aes);
+            typeMap.put(t.name, type);
+        }
+        return typeMap;
+    }
+
+    private String[] buildCategorySegments(String category) {
+        String[] segments = category.split(",");
+        for (int i = 0; i < segments.length; i++) {
+            segments[i] = segments[i].trim();
+        }
+        return segments;
+    }
+}
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
index fe6775af4a6..f7b4746c793 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
@@ -142,13 +142,11 @@ public synchronized EventType register(Class<? extends jdk.internal.event.Event>
         handler.setRegistered(true);
         typeLibrary.addType(handler.getPlatformEventType());
         if (jvm.isRecording()) {
-            storeDescriptorInJVM(); // needed for emergency dump
             settingsManager.setEventControl(handler.getEventControl());
             settingsManager.updateRetransform(Collections.singletonList((eventClass)));
-        } else {
-            setStaleMetadata();
-        }
-        return handler.getEventType();
+       }
+       setStaleMetadata();
+       return handler.getEventType();
     }
 
     private PlatformEventType findMirrorType(Class<? extends jdk.internal.event.Event> eventClass) throws InternalError {
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/TypeLibrary.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/TypeLibrary.java
index 1e653e622c5..d1d7c41d961 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/TypeLibrary.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/TypeLibrary.java
@@ -26,6 +26,7 @@
 package jdk.jfr.internal;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.lang.annotation.Annotation;
 import java.lang.annotation.Repeatable;
 import java.lang.reflect.Field;
@@ -56,10 +57,12 @@
 import jdk.jfr.Timespan;
 import jdk.jfr.Timestamp;
 import jdk.jfr.ValueDescriptor;
+import jdk.jfr.internal.tool.PrettyWriter;
 
 public final class TypeLibrary {
 
     private static TypeLibrary instance;
+    private static boolean implicitFieldTypes;
     private static final Map<Long, Type> types = new LinkedHashMap<>(100);
     static final ValueDescriptor DURATION_FIELD = createDurationField();
     static final ValueDescriptor THREAD_FIELD = createThreadField();
@@ -108,7 +111,7 @@ public static TypeLibrary getInstance() {
             if (instance == null) {
                 List<Type> jvmTypes;
                 try {
-                    jvmTypes = MetadataHandler.createTypes();
+                    jvmTypes = MetadataLoader.createTypes();
                     Collections.sort(jvmTypes, (a,b) -> Long.compare(a.getId(), b.getId()));
                 } catch (IOException e) {
                     throw new Error("JFR: Could not read metadata");
@@ -315,10 +318,13 @@ private static void addUserFields(Class<?> clazz, Type type, List<ValueDescripto
 
     // By convention all events have these fields.
     static void addImplicitFields(Type type, boolean requestable, boolean hasDuration, boolean hasThread, boolean hasStackTrace, boolean hasCutoff) {
-        createAnnotationType(Timespan.class);
-        createAnnotationType(Timestamp.class);
-        createAnnotationType(Label.class);
-        defineType(long.class, null,false);
+        if (!implicitFieldTypes) {
+            createAnnotationType(Timespan.class);
+            createAnnotationType(Timestamp.class);
+            createAnnotationType(Label.class);
+            defineType(long.class, null, false);
+            implicitFieldTypes = true;
+        }
         addFields(type, requestable, hasDuration, hasThread, hasStackTrace, hasCutoff);
     }
 
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Main.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Main.java
index 785ffda9133..bc8f96992dd 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Main.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,10 @@ public static void main(String... args) {
             System.out.println();
             System.out.println(" jfr print --json --events CPULoad recording.jfr");
             System.out.println();
-            System.out.println(" jfr print --categories \"GC,JVM,Java*\" recording.jfr");
+            char q = Print.quoteCharacter();
+            System.out.println(" jfr print --categories " + q + "GC,JVM,Java*" + q + " recording.jfr");
             System.out.println();
-            System.out.println(" jfr print --events \"jdk.*\" --stack-depth 64 recording.jfr");
+            System.out.println(" jfr print --events " + q + "jdk.*" + q + " --stack-depth 64 recording.jfr");
             System.out.println();
             System.out.println(" jfr summary recording.jfr");
             System.out.println();
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Print.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Print.java
index 7b5d89f9e2f..85895baafef 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Print.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Print.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package jdk.jfr.internal.tool;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.io.PrintWriter;
@@ -92,9 +93,10 @@ public void displayOptionUsage(PrintStream stream) {
         stream.println();
         stream.println(" jfr print --events CPULoad,GarbageCollection recording.jfr");
         stream.println();
-        stream.println(" jfr print --categories \"GC,JVM,Java*\" recording.jfr");
+        char q = quoteCharacter();
+        stream.println(" jfr print --categories " + q + "GC,JVM,Java*" + q + " recording.jfr");
         stream.println();
-        stream.println(" jfr print --events \"jdk.*\" --stack-depth 64 recording.jfr");
+        stream.println(" jfr print --events "+ q + "jdk.*" + q +" --stack-depth 64 recording.jfr");
         stream.println();
         stream.println(" jfr print --json --events CPULoad recording.jfr");
     }
@@ -279,4 +281,8 @@ private static List<String> explodeFilter(String filter) throws UserSyntaxExcept
         }
         return list;
     }
+
+    static char quoteCharacter() {
+        return File.pathSeparatorChar == ';' ? '"' : '\'';
+    }
 }
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java
index 0bff53af887..a4ac6cf8535 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java
@@ -120,6 +120,10 @@ private void printInformation(Path p) throws IOException {
                     int size = input.readInt();
                     long eventTypeId = input.readLong();
                     Statistics s = stats.get(eventTypeId);
+                    if (s == null) {
+                        s = new Statistics(eventTypeId + " (missing event metadata)");
+                        stats.put(eventTypeId, s);
+                    }
                     if (s != null) {
                         s.count++;
                         s.size += size;
@@ -138,7 +142,6 @@ private void printInformation(Path p) throws IOException {
             println(" Chunks: " + chunks);
             println(" Start: " + DATE_FORMAT.format(Instant.ofEpochSecond(epochSeconds, adjustNanos)) + " (UTC)");
             println(" Duration: " + (totalDuration + 500_000_000) / 1_000_000_000 + " s");
-
             List<Statistics> statsList = new ArrayList<>(stats.values());
             Collections.sort(statsList, (u, v) -> Long.compare(v.count, u.count));
             println();
diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
index c56dc1beb12..0d99cc3b0b2 100644
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.net.URI;
 import java.nio.charset.Charset;
 import java.time.Instant;
 import java.util.ArrayList;
@@ -50,6 +51,9 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
 
 import jdk.internal.shellsupport.doc.JavadocFormatter;
 import jdk.internal.jshell.tool.StopDetectingInputStream.State;
@@ -974,6 +978,15 @@ private int countPendingOpenBraces(String code) {
         int pendingBraces = 0;
         com.sun.tools.javac.util.Context ctx =
                 new com.sun.tools.javac.util.Context();
+        SimpleJavaFileObject source = new SimpleJavaFileObject(URI.create("mem://snippet"),
+                                                               JavaFileObject.Kind.SOURCE) {
+            @Override
+            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                return code;
+            }
+        };
+        ctx.put(DiagnosticListener.class, d -> {});
+        com.sun.tools.javac.util.Log.instance(ctx).useSource(source);
         com.sun.tools.javac.parser.ScannerFactory scannerFactory =
                 com.sun.tools.javac.parser.ScannerFactory.instance(ctx);
         com.sun.tools.javac.parser.Scanner scanner =
diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBean.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBean.java
index e7cd8d85416..4aebdede921 100644
--- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBean.java
+++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -205,13 +205,11 @@ public interface FlightRecorderMXBean extends PlatformManagedObject {
      * The caller must close the recording when access to the data is no longer
      * needed.
      *
-     * @return a snapshot of all available recording data, not {@code null}
+     * @return a unique ID that can be used for reading recording data
      *
      * @throws java.lang.SecurityException if a security manager exists and the
      *         caller does not have {@code ManagementPermission("control")}
      *
-     * @return a unique ID that can be used for reading recording data.
-     *
      * @see Recording
      */
     public long takeSnapshot();
diff --git a/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java b/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
index c79d511b471..b87cd0eebd8 100644
--- a/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
+++ b/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
@@ -25,6 +25,7 @@
 
 package com.sun.management;
 
+import java.io.IOException;
 import java.lang.management.PlatformManagedObject;
 
 /**
@@ -72,7 +73,7 @@ public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
      *         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.
diff --git a/src/jdk.nio.mapmode/share/classes/jdk/nio/mapmode/ExtendedMapMode.java b/src/jdk.nio.mapmode/share/classes/jdk/nio/mapmode/ExtendedMapMode.java
index 7f9a40cee01..4c2d02d78cc 100644
--- a/src/jdk.nio.mapmode/share/classes/jdk/nio/mapmode/ExtendedMapMode.java
+++ b/src/jdk.nio.mapmode/share/classes/jdk/nio/mapmode/ExtendedMapMode.java
@@ -25,6 +25,8 @@
 
 package jdk.nio.mapmode;
 
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
 import java.nio.channels.FileChannel.MapMode;
 
 /**
@@ -52,7 +54,7 @@ private ExtendedMapMode() { }
 
     /**
      * File mapping mode for a read-write mapping of a file backed by
-     * non-volatile RAM. {@linkplain MappedByteBufefr#force force}
+     * non-volatile RAM. {@linkplain MappedByteBuffer#force force}
      * operations on a buffer created with this mode will be performed
      * using cache line writeback rather than proceeding via a file
      * device flush.
diff --git a/src/jdk.sctp/share/classes/com/sun/nio/sctp/NotificationHandler.java b/src/jdk.sctp/share/classes/com/sun/nio/sctp/NotificationHandler.java
index 9e5f239f297..accfb9f8b58 100644
--- a/src/jdk.sctp/share/classes/com/sun/nio/sctp/NotificationHandler.java
+++ b/src/jdk.sctp/share/classes/com/sun/nio/sctp/NotificationHandler.java
@@ -45,7 +45,7 @@
  * this handler interface as the type for parameters, return type, etc. rather
  * than the abstract class.
  *
- * @param  T  The type of the object attached to the receive operation
+ * @param  <T>  The type of the object attached to the receive operation
  *
  * @since 1.7
  */
diff --git a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
index cbdeddbfba4..d8074ddcbea 100644
--- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
+++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -636,13 +636,18 @@ public void freeMemory(long address) {
      * @see #getInt(Object, long)
      */
     @ForceInline
+    @SuppressWarnings("preview")
     public long objectFieldOffset(Field f) {
         if (f == null) {
             throw new NullPointerException();
         }
-        if (f.getDeclaringClass().isHidden()) {
+        Class<?> declaringClass = f.getDeclaringClass();
+        if (declaringClass.isHidden()) {
             throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
         }
+        if (declaringClass.isRecord()) {
+            throw new UnsupportedOperationException("can't get field offset on a record (preview): " + f);
+        }
         return theInternalUnsafe.objectFieldOffset(f);
     }
 
@@ -664,13 +669,18 @@ public long objectFieldOffset(Field f) {
      * @see #getInt(Object, long)
      */
     @ForceInline
+    @SuppressWarnings("preview")
     public long staticFieldOffset(Field f) {
         if (f == null) {
             throw new NullPointerException();
         }
-        if (f.getDeclaringClass().isHidden()) {
+        Class<?> declaringClass = f.getDeclaringClass();
+        if (declaringClass.isHidden()) {
             throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
         }
+        if (declaringClass.isRecord()) {
+            throw new UnsupportedOperationException("can't get field offset on a record (preview): " + f);
+        }
         return theInternalUnsafe.staticFieldOffset(f);
     }
 
@@ -685,13 +695,18 @@ public long staticFieldOffset(Field f) {
      * this class.
      */
     @ForceInline
+    @SuppressWarnings("preview")
     public Object staticFieldBase(Field f) {
         if (f == null) {
             throw new NullPointerException();
         }
-        if (f.getDeclaringClass().isHidden()) {
+        Class<?> declaringClass = f.getDeclaringClass();
+        if (declaringClass.isHidden()) {
             throw new UnsupportedOperationException("can't get base address on a hidden class: " + f);
         }
+        if (declaringClass.isRecord()) {
+            throw new UnsupportedOperationException("can't get base address on a record (preview): " + f);
+        }
         return theInternalUnsafe.staticFieldBase(f);
     }
 
diff --git a/src/jdk.zipfs/share/classes/module-info.java b/src/jdk.zipfs/share/classes/module-info.java
index f74a926c239..dcb2545b74a 100644
--- a/src/jdk.zipfs/share/classes/module-info.java
+++ b/src/jdk.zipfs/share/classes/module-info.java
@@ -234,9 +234,9 @@
  *   <td>null/unset</td>
  *   <td>
  *       A value representing the version entry to use when accessing a
- *       <a href=="{@docRoot}/../specs/jar/jar.html#multi-release-jar-files">
+ *       <a href="{@docRoot}/../specs/jar/jar.html#multi-release-jar-files">
  *       multi-release JAR</a>. If the JAR is not a
- *       <a href=="{@docRoot}/../specs/jar/jar.html#multi-release-jar-files">
+ *       <a href="{@docRoot}/../specs/jar/jar.html#multi-release-jar-files">
  *       multi-release JAR</a>, the value will be ignored and the JAR will be
  *       considered un-versioned.
  *       <p>
diff --git a/test/hotspot/gtest/compiler/test_directivesParser.cpp b/test/hotspot/gtest/compiler/test_directivesParser.cpp
index a021f327487..b6b9708b695 100644
--- a/test/hotspot/gtest/compiler/test_directivesParser.cpp
+++ b/test/hotspot/gtest/compiler/test_directivesParser.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,20 @@ TEST_VM_F(DirectivesParserTest, simple_match) {
 
 }
 
+TEST_VM_F(DirectivesParserTest, control_intrinsic) {
+  test_positive(
+      "[" "\n"
+      "  {" "\n"
+      "    match: \"foo/bar.*\"," "\n"
+      "    c2: {" "\n"
+      "      DisableIntrinsic: \"_compareToL\"," "\n"
+      "      ControlIntrinsic: \"+_mulAdd,+_getInt,-_arraycopy,+_compareToL\"" "\n"
+      "    }" "\n"
+      "  }" "\n"
+      "]" "\n");
+
+}
+
 TEST_VM_F(DirectivesParserTest, nesting_arrays) {
   test_negative(
       "[" "\n"
diff --git a/test/hotspot/gtest/utilities/test_growableArray.cpp b/test/hotspot/gtest/utilities/test_growableArray.cpp
new file mode 100644
index 00000000000..2ead040ee39
--- /dev/null
+++ b/test/hotspot/gtest/utilities/test_growableArray.cpp
@@ -0,0 +1,557 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "memory/resourceArea.hpp"
+#include "utilities/growableArray.hpp"
+#include "unittest.hpp"
+
+struct WithEmbeddedArray {
+  // Array embedded in another class
+  GrowableArray<int> _a;
+
+  // Resource allocated data array
+  WithEmbeddedArray(int initial_max) : _a(initial_max) {}
+  // Arena allocated data array
+  WithEmbeddedArray(Arena* arena, int initial_max) : _a(arena, initial_max, 0, 0) {}
+  // CHeap allocated data array
+  WithEmbeddedArray(int initial_max, MEMFLAGS memflags) : _a(initial_max, memflags) {
+    assert(memflags != mtNone, "test requirement");
+  }
+  WithEmbeddedArray(const GrowableArray<int>& other) : _a(other) {}
+};
+
+// Test fixture to work with TEST_VM_F
+class GrowableArrayTest : public ::testing::Test {
+protected:
+  // friend -> private accessors
+  template <typename E>
+  static bool elements_on_C_heap(const GrowableArray<E>* array) {
+    return array->on_C_heap();
+  }
+  template <typename E>
+  static bool elements_on_stack(const GrowableArray<E>* array) {
+    return array->on_stack();
+  }
+  template <typename E>
+  static bool elements_on_arena(const GrowableArray<E>* array) {
+    return array->on_arena();
+  }
+
+  template <typename ArrayClass>
+  static void test_append(ArrayClass* a) {
+    // Add elements
+    for (int i = 0; i < 10; i++) {
+      a->append(i);
+    }
+
+    // Check size
+    ASSERT_EQ(a->length(), 10);
+
+    // Check elements
+    for (int i = 0; i < 10; i++) {
+      EXPECT_EQ(a->at(i), i);
+    }
+  }
+
+  template <typename ArrayClass>
+  static void test_clear(ArrayClass* a) {
+    // Add elements
+    for (int i = 0; i < 10; i++) {
+      a->append(i);
+    }
+
+    // Check size
+    ASSERT_EQ(a->length(), 10);
+    ASSERT_EQ(a->is_empty(), false);
+
+    // Clear elements
+    a->clear();
+
+    // Check size
+    ASSERT_EQ(a->length(), 0);
+    ASSERT_EQ(a->is_empty(), true);
+
+    // Add element
+    a->append(11);
+
+    // Check size
+    ASSERT_EQ(a->length(), 1);
+    ASSERT_EQ(a->is_empty(), false);
+
+    // Clear elements
+    a->clear();
+
+    // Check size
+    ASSERT_EQ(a->length(), 0);
+    ASSERT_EQ(a->is_empty(), true);
+  }
+
+  template <typename ArrayClass>
+  static void test_iterator(ArrayClass* a) {
+    // Add elements
+    for (int i = 0; i < 10; i++) {
+      a->append(i);
+    }
+
+    // Iterate
+    int counter = 0;
+    for (GrowableArrayIterator<int> i = a->begin(); i != a->end(); ++i) {
+      ASSERT_EQ(*i, counter++);
+    }
+
+    // Check count
+    ASSERT_EQ(counter, 10);
+  }
+
+  template <typename ArrayClass>
+  static void test_copy1(ArrayClass* a) {
+    ASSERT_EQ(a->length(), 1);
+    ASSERT_EQ(a->at(0), 1);
+
+    // Only allowed to copy to stack and embedded ResourceObjs
+
+    // Copy to stack
+    {
+      GrowableArray<int> c(*a);
+
+      ASSERT_EQ(c.length(), 1);
+      ASSERT_EQ(c.at(0), 1);
+    }
+
+    // Copy to embedded
+    {
+      WithEmbeddedArray c(*a);
+
+      ASSERT_EQ(c._a.length(), 1);
+      ASSERT_EQ(c._a.at(0), 1);
+    }
+  }
+
+  template <typename ArrayClass>
+  static void test_assignment1(ArrayClass* a) {
+    ASSERT_EQ(a->length(), 1);
+    ASSERT_EQ(a->at(0), 1);
+
+    // Only allowed to assign to stack and embedded ResourceObjs
+
+    // Copy to embedded/resource
+    {
+      ResourceMark rm;
+      GrowableArray<int> c(1);
+      c = *a;
+
+      ASSERT_EQ(c.length(), 1);
+      ASSERT_EQ(c.at(0), 1);
+    }
+
+    // Copy to embedded/arena
+    {
+      Arena arena(mtTest);
+      GrowableArray<int> c(&arena, 1, 0, 0);
+      c = *a;
+
+      ASSERT_EQ(c.length(), 1);
+      ASSERT_EQ(c.at(0), 1);
+    }
+
+    // Copy to embedded/resource
+    {
+      ResourceMark rm;
+      WithEmbeddedArray c(1);
+      c._a = *a;
+
+      ASSERT_EQ(c._a.length(), 1);
+      ASSERT_EQ(c._a.at(0), 1);
+    }
+
+    // Copy to embedded/arena
+    {
+      Arena arena(mtTest);
+      WithEmbeddedArray c(&arena, 1);
+      c._a = *a;
+
+      ASSERT_EQ(c._a.length(), 1);
+      ASSERT_EQ(c._a.at(0), 1);
+    }
+  }
+
+  // Supported by all GrowableArrays
+  enum TestEnum {
+    Append,
+    Clear,
+    Iterator,
+  };
+
+  template <typename ArrayClass>
+  static void do_test(ArrayClass* a, TestEnum test) {
+    switch (test) {
+      case Append:
+        test_append(a);
+        break;
+
+      case Clear:
+        test_clear(a);
+        break;
+
+      case Iterator:
+        test_iterator(a);
+        break;
+
+      default:
+        fatal("Missing dispatch");
+        break;
+    }
+  }
+
+  // Only supported by GrowableArrays without CHeap data arrays
+  enum TestNoCHeapEnum {
+    Copy1,
+    Assignment1,
+  };
+
+  template <typename ArrayClass>
+  static void do_test(ArrayClass* a, TestNoCHeapEnum test) {
+    switch (test) {
+      case Copy1:
+        test_copy1(a);
+        break;
+
+      case Assignment1:
+        test_assignment1(a);
+        break;
+
+      default:
+        fatal("Missing dispatch");
+        break;
+    }
+  }
+
+  enum ModifyEnum {
+    Append1,
+    Append1Clear,
+    Append1ClearAndDeallocate,
+    NoModify
+  };
+
+  template <typename ArrayClass>
+  static void do_modify(ArrayClass* a, ModifyEnum modify) {
+    switch (modify) {
+      case Append1:
+        a->append(1);
+        break;
+
+      case Append1Clear:
+        a->append(1);
+        a->clear();
+        break;
+
+      case Append1ClearAndDeallocate:
+        a->append(1);
+        a->clear_and_deallocate();
+        break;
+
+      case NoModify:
+        // Nothing to do
+        break;
+
+      default:
+        fatal("Missing dispatch");
+        break;
+    }
+  }
+
+  static const int Max0 = 0;
+  static const int Max1 = 1;
+
+  template <typename ArrayClass, typename T>
+  static void modify_and_test(ArrayClass* array, ModifyEnum modify, T test) {
+    do_modify(array, modify);
+    do_test(array, test);
+  }
+
+  template <typename T>
+  static void with_no_cheap_array(int max, ModifyEnum modify, T test) {
+    // Resource/Resource allocated
+    {
+      ResourceMark rm;
+      GrowableArray<int>* a = new GrowableArray<int>(max);
+      modify_and_test(a, modify, test);
+    }
+
+    // Resource/Arena allocated
+    //  Combination not supported
+
+    // CHeap/Resource allocated
+    //  Combination not supported
+
+    // CHeap/Arena allocated
+    //  Combination not supported
+
+    // Stack/Resource allocated
+    {
+      ResourceMark rm;
+      GrowableArray<int> a(max);
+      modify_and_test(&a, modify, test);
+    }
+
+    // Stack/Arena allocated
+    {
+      Arena arena(mtTest);
+      GrowableArray<int> a(&arena, max, 0, 0);
+      modify_and_test(&a, modify, test);
+    }
+
+    // Embedded/Resource allocated
+    {
+      ResourceMark rm;
+      WithEmbeddedArray w(max);
+      modify_and_test(&w._a, modify, test);
+    }
+
+    // Embedded/Arena allocated
+    {
+      Arena arena(mtTest);
+      WithEmbeddedArray w(&arena, max);
+      modify_and_test(&w._a, modify, test);
+    }
+  }
+
+  static void with_cheap_array(int max, ModifyEnum modify, TestEnum test) {
+    // Resource/CHeap allocated
+    //  Combination not supported
+
+    // CHeap/CHeap allocated
+    {
+      GrowableArray<int>* a = new (ResourceObj::C_HEAP, mtTest) GrowableArray<int>(max, mtTest);
+      modify_and_test(a, modify, test);
+      delete a;
+    }
+
+    // Stack/CHeap allocated
+    {
+      GrowableArray<int> a(max, mtTest);
+      modify_and_test(&a, modify, test);
+    }
+
+    // Embedded/CHeap allocated
+    {
+      WithEmbeddedArray w(max, mtTest);
+      modify_and_test(&w._a, modify, test);
+    }
+  }
+
+  static void with_all_types(int max, ModifyEnum modify, TestEnum test) {
+    with_no_cheap_array(max, modify, test);
+    with_cheap_array(max, modify, test);
+  }
+
+  static void with_all_types_empty(TestEnum test) {
+    with_all_types(Max0, NoModify, test);
+  }
+
+  static void with_all_types_max_set(TestEnum test) {
+    with_all_types(Max1, NoModify, test);
+  }
+
+  static void with_all_types_cleared(TestEnum test) {
+    with_all_types(Max1, Append1Clear, test);
+  }
+
+  static void with_all_types_clear_and_deallocated(TestEnum test) {
+    with_all_types(Max1, Append1ClearAndDeallocate, test);
+  }
+
+  static void with_all_types_all_0(TestEnum test) {
+    with_all_types_empty(test);
+    with_all_types_max_set(test);
+    with_all_types_cleared(test);
+    with_all_types_clear_and_deallocated(test);
+  }
+
+  static void with_no_cheap_array_append1(TestNoCHeapEnum test) {
+    with_no_cheap_array(Max0, Append1, test);
+  }
+};
+
+TEST_VM_F(GrowableArrayTest, append) {
+  with_all_types_all_0(Append);
+}
+
+TEST_VM_F(GrowableArrayTest, clear) {
+  with_all_types_all_0(Clear);
+}
+
+TEST_VM_F(GrowableArrayTest, iterator) {
+  with_all_types_all_0(Iterator);
+}
+
+TEST_VM_F(GrowableArrayTest, copy) {
+  with_no_cheap_array_append1(Copy1);
+}
+
+TEST_VM_F(GrowableArrayTest, assignment) {
+  with_no_cheap_array_append1(Assignment1);
+}
+
+#ifdef ASSERT
+TEST_VM_F(GrowableArrayTest, where) {
+  WithEmbeddedArray s(1, mtTest);
+  ASSERT_FALSE(s._a.allocated_on_C_heap());
+  ASSERT_TRUE(elements_on_C_heap(&s._a));
+
+  // Resource/Resource allocated
+  {
+    ResourceMark rm;
+    GrowableArray<int>* a = new GrowableArray<int>();
+    ASSERT_TRUE(a->allocated_on_res_area());
+    ASSERT_TRUE(elements_on_stack(a));
+  }
+
+  // Resource/CHeap allocated
+  //  Combination not supported
+
+  // Resource/Arena allocated
+  //  Combination not supported
+
+  // CHeap/Resource allocated
+  //  Combination not supported
+
+  // CHeap/CHeap allocated
+  {
+    GrowableArray<int>* a = new (ResourceObj::C_HEAP, mtTest) GrowableArray<int>(0, mtTest);
+    ASSERT_TRUE(a->allocated_on_C_heap());
+    ASSERT_TRUE(elements_on_C_heap(a));
+    delete a;
+  }
+
+  // CHeap/Arena allocated
+  //  Combination not supported
+
+  // Stack/Resource allocated
+  {
+    ResourceMark rm;
+    GrowableArray<int> a(0);
+    ASSERT_TRUE(a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_stack(&a));
+  }
+
+  // Stack/CHeap allocated
+  {
+    GrowableArray<int> a(0, mtTest);
+    ASSERT_TRUE(a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_C_heap(&a));
+  }
+
+  // Stack/Arena allocated
+  {
+    Arena arena(mtTest);
+    GrowableArray<int> a(&arena, 0, 0, 0);
+    ASSERT_TRUE(a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_arena(&a));
+  }
+
+  // Embedded/Resource allocated
+  {
+    ResourceMark rm;
+    WithEmbeddedArray w(0);
+    ASSERT_TRUE(w._a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_stack(&w._a));
+  }
+
+  // Embedded/CHeap allocated
+  {
+    WithEmbeddedArray w(0, mtTest);
+    ASSERT_TRUE(w._a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_C_heap(&w._a));
+  }
+
+  // Embedded/Arena allocated
+  {
+    Arena arena(mtTest);
+    WithEmbeddedArray w(&arena, 0);
+    ASSERT_TRUE(w._a.allocated_on_stack());
+    ASSERT_TRUE(elements_on_arena(&w._a));
+  }
+}
+
+TEST_VM_ASSERT_MSG(GrowableArrayAssertingTest, copy_with_embedded_cheap,
+    "Copying of CHeap arrays not supported") {
+  WithEmbeddedArray s(1, mtTest);
+  // Intentionally asserts that copy of CHeap arrays are not allowed
+  WithEmbeddedArray c(s);
+}
+
+TEST_VM_ASSERT_MSG(GrowableArrayAssertingTest, assignment_with_embedded_cheap,
+    "Assignment of CHeap arrays not supported") {
+  WithEmbeddedArray s(1, mtTest);
+  WithEmbeddedArray c(1, mtTest);
+
+  // Intentionally asserts that assignment of CHeap arrays are not allowed
+  c = s;
+}
+
+#endif
+
+TEST(GrowableArrayCHeap, sanity) {
+  // Stack/CHeap
+  {
+    GrowableArrayCHeap<int, mtTest> a(0);
+#ifdef ASSERT
+    ASSERT_TRUE(a.allocated_on_stack());
+#endif
+    ASSERT_TRUE(a.is_empty());
+
+    a.append(1);
+    ASSERT_FALSE(a.is_empty());
+    ASSERT_EQ(a.at(0), 1);
+  }
+
+  // CHeap/CHeap
+  {
+    GrowableArrayCHeap<int, mtTest>* a = new GrowableArrayCHeap<int, mtTest>(0);
+#ifdef ASSERT
+    ASSERT_TRUE(a->allocated_on_C_heap());
+#endif
+    ASSERT_TRUE(a->is_empty());
+
+    a->append(1);
+    ASSERT_FALSE(a->is_empty());
+    ASSERT_EQ(a->at(0), 1);
+    delete a;
+  }
+
+  // CHeap/CHeap - nothrow new operator
+  {
+    GrowableArrayCHeap<int, mtTest>* a = new (std::nothrow) GrowableArrayCHeap<int, mtTest>(0);
+#ifdef ASSERT
+    ASSERT_TRUE(a->allocated_on_C_heap());
+#endif
+    ASSERT_TRUE(a->is_empty());
+
+    a->append(1);
+    ASSERT_FALSE(a->is_empty());
+    ASSERT_EQ(a->at(0), 1);
+    delete a;
+  }
+}
diff --git a/test/hotspot/gtest/utilities/test_tribool.cpp b/test/hotspot/gtest/utilities/test_tribool.cpp
new file mode 100644
index 00000000000..6d2a1cdafdf
--- /dev/null
+++ b/test/hotspot/gtest/utilities/test_tribool.cpp
@@ -0,0 +1,190 @@
+/*
+ * Copyright Amazon.com Inc. 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.
+ */
+
+#include "precompiled.hpp"
+#include "unittest.hpp"
+#include "utilities/tribool.hpp"
+
+TEST(tribool, TriBool) {
+  TriBool t1;
+  ASSERT_EQ(t1.is_default(), true);
+  ASSERT_EQ((bool)t1, false);
+
+  TriBool t2(false);
+  ASSERT_TRUE(t2.is_default() == false && (bool)t2 == false);
+
+  TriBool t3(true);
+  ASSERT_TRUE(t3.is_default() == false && (bool)t3 == true);
+
+  TriBool t4 = false;
+  ASSERT_TRUE(t4.is_default() == false && (bool)t4 == false);
+
+  if (t2 || !t3 || t4) {
+    ASSERT_TRUE(false); //boom
+  }
+
+  TriBool flags[4];
+  flags[0] = TriBool();
+  flags[1] = false;
+  flags[2] = true;
+
+  ASSERT_EQ(flags[0].is_default(), true) << "should be default";
+  ASSERT_EQ(!flags[1].is_default() && !flags[1], true) << "should be not default and not set";
+  ASSERT_EQ(!flags[2].is_default() && flags[2], true) << "should be not default and set";
+  ASSERT_EQ(flags[3].is_default() == true, true) << "should be default";
+}
+
+template <size_t SZ, typename T>
+struct Tester {
+  static void doit() {
+    // test fill_in(value)
+    control_words.fill_in(TriBool());
+    for (size_t i = 0; i < SZ; ++i) {
+      EXPECT_TRUE(control_words[i].is_default());
+    }
+
+    TriBool F = false;
+    control_words.fill_in(F);
+    for (size_t i = 0; i < SZ; ++i) {
+      EXPECT_TRUE(!control_words[i].is_default() && control_words[i] == false);
+    }
+
+    // test fill_in(beg, end)
+    TriBool Vec[4];
+    Vec[0] = TriBool();
+    Vec[1] = TriBool();
+    Vec[2] = true;
+    Vec[3] = false;
+
+    control_words.fill_in(&Vec[0], Vec + 4);
+
+    if (0 < SZ) {
+      EXPECT_TRUE(control_words[0].is_default());
+    }
+
+    if (1 < SZ) {
+      EXPECT_TRUE(control_words[1].is_default());
+    }
+
+    if (2 < SZ) {
+      EXPECT_TRUE(!control_words[2].is_default() && control_words[2] == true);
+    }
+
+    if (3 < SZ) {
+      EXPECT_TRUE(!control_words[3].is_default() && control_words[3] == false);
+    }
+
+    // test assignment
+    for (size_t i = 0; i < SZ; ++i) {
+      control_words[i] = true;
+      EXPECT_TRUE(!control_words[i].is_default() && control_words[i] == true);
+    }
+
+    for (size_t i = 0; i < SZ; ++i) {
+      control_words[i] = false;
+      EXPECT_TRUE(!control_words[i].is_default() && control_words[i] == false);
+    }
+
+    for (size_t i = 0; i < SZ; ++i) {
+      if ((i%2) == 0) {
+        control_words[i] = TriBool(true);
+      }
+      else {
+        control_words[i] = TriBool(false);
+      }
+    }
+
+    // test copy constructor(default)
+    copy = control_words;
+    for (size_t i = 0; i < SZ; ++i) {
+      if ((i%2) == 0) {
+        EXPECT_TRUE(!copy[i].is_default() && copy[i] == true)
+                    << "even value must be true.";
+      }
+      else {
+        EXPECT_TRUE(!copy[i].is_default() && copy[i] == false)
+                    << "odd value must be false.";
+      }
+    }
+
+    // test const operator[](fastpath)
+    const TriBoolArray<SZ, T>& cref = control_words;
+    for (size_t i = 0; i < SZ; ++i) {
+        if ((i%2) == 0) {
+          EXPECT_TRUE(!cref[i].is_default() && cref[i] == true)
+                      << "even value must be true.";
+        }
+        else {
+          EXPECT_TRUE(!cref[i].is_default() && cref[i] == false)
+                      << "odd value must be false.";
+        }
+    }
+
+    EXPECT_GE(sizeof(control_words) * 8, (2 * SZ)) << "allocated too less";
+    EXPECT_LE(sizeof(control_words), (((2 * SZ) / (sizeof(T) * 8) + 1) * sizeof(T)))
+            << "allocated too much";
+  }
+
+  // because doit probably can't allocate jumbo arrays on stack, use static members
+  static TriBoolArray<SZ, T> control_words;
+  static TriBoolArray<SZ, T> copy;
+};
+
+template<size_t SZ, typename T>
+TriBoolArray<SZ, T> Tester<SZ, T>::control_words;
+
+template<size_t SZ, typename T>
+TriBoolArray<SZ, T> Tester<SZ, T>::copy;
+
+TEST(tribool, TriBoolArray) {
+  Tester<1, int>::doit();
+  Tester<2, int>::doit();
+  Tester<3, int>::doit();
+  Tester<7, int>::doit();
+  Tester<8, int>::doit();
+  Tester<14, int>::doit();
+  Tester<16, int>::doit();
+  Tester<27, int>::doit();
+  Tester<32, int>::doit();
+  Tester<34, int>::doit();
+  Tester<81, int>::doit();
+  Tester<128, int>::doit();
+  Tester<328, int>::doit(); // the no of intrinsics in jdk15
+
+  Tester<1024, int>::doit();
+  Tester<1025, int>::doit();
+
+  Tester<4 <<10/*4k*/ , int>::doit();
+  Tester<16<<10/*16k*/, int>::doit();
+  Tester<32<<10/*32k*/, int>::doit();
+  Tester<1 <<20/*1M*/ , int>::doit();
+  Tester<4 <<20/*4M*/ , int>::doit();
+}
+
+TriBool global_single;
+TriBoolArray<2, unsigned int> global_tuple;
+TEST(tribool, StaticInitializer) {
+  EXPECT_TRUE(global_single.is_default());
+  EXPECT_TRUE(global_tuple[0].is_default());
+  EXPECT_TRUE(global_tuple[1].is_default());
+}
diff --git a/test/hotspot/gtest/utilities/test_valueObjArray.cpp b/test/hotspot/gtest/utilities/test_valueObjArray.cpp
new file mode 100644
index 00000000000..b9b0775cc79
--- /dev/null
+++ b/test/hotspot/gtest/utilities/test_valueObjArray.cpp
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "utilities/valueObjArray.hpp"
+#include "unittest.hpp"
+
+class ValueObjArrayTest : public ::testing::Test {
+protected:
+  class IntGenerator {
+    int _current;
+
+  public:
+    IntGenerator() : _current(0) {}
+    int operator*() const {
+      return _current;
+    }
+    IntGenerator operator++() {
+      ++_current;
+      return *this;
+    }
+  };
+
+  struct Struct {
+    int _value;
+    const char* _string;
+  };
+
+  class StructGenerator {
+    int _current;
+
+    static const char* str(int i) {
+      const char* array[] = {
+        "0",
+        "1",
+        "2",
+        "3"};
+      return array[i];
+    }
+
+  public:
+    StructGenerator() : _current(0) {}
+    Struct operator*() const {
+      assert(_current < 4, "precondition");
+      Struct s = { _current, str(_current)};
+      return s;
+    }
+    StructGenerator operator++() {
+      ++_current;
+      return *this;
+    }
+  };
+};
+
+TEST_F(ValueObjArrayTest, primitive) {
+  ValueObjArrayTest::IntGenerator g;
+  ValueObjArray<int, 4> array(g);
+  ASSERT_EQ(array.count(), 4);
+  ASSERT_EQ(*array.at(0), 0);
+  ASSERT_EQ(*array.at(1), 1);
+  ASSERT_EQ(*array.at(2), 2);
+  ASSERT_EQ(*array.at(3), 3);
+}
+
+TEST_F(ValueObjArrayTest, struct) {
+  ValueObjArrayTest::StructGenerator g;
+  ValueObjArray<Struct, 4> array(g);
+  ASSERT_EQ(array.count(), 4);
+  ASSERT_EQ(array.at(0)->_value, 0);
+  ASSERT_EQ(array.at(1)->_value, 1);
+  ASSERT_EQ(array.at(2)->_value, 2);
+  ASSERT_EQ(array.at(3)->_value, 3);
+  ASSERT_EQ(array.at(0)->_string[0], '0');
+  ASSERT_EQ(array.at(1)->_string[0], '1');
+  ASSERT_EQ(array.at(2)->_string[0], '2');
+  ASSERT_EQ(array.at(3)->_string[0], '3');
+}
diff --git a/test/hotspot/jtreg/ProblemList-aot.txt b/test/hotspot/jtreg/ProblemList-aot.txt
index e584c647175..a2fcf21e18c 100644
--- a/test/hotspot/jtreg/ProblemList-aot.txt
+++ b/test/hotspot/jtreg/ProblemList-aot.txt
@@ -85,5 +85,8 @@ compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java            8167430 gene
 compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java    8167430 generic-all
 compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java  8167430 generic-all
 
+compiler/ciReplay/TestServerVM.java      8248265 generic-all
+compiler/ciReplay/TestVMNoCompLevel.java 8248265 generic-all
+
 vmTestbase/vm/mlvm/indy/stress/java/relinkMutableCallSiteFreq/Test.java   8226689 generic-all
 vmTestbase/vm/mlvm/indy/stress/java/relinkVolatileCallSiteFreq/Test.java  8226689 generic-all
diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
index 764811a7bd8..ed71f53c8c7 100644
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -102,6 +102,7 @@ serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all
 
 serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatIntervalTest.java 8214032 generic-all
 serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatArrayCorrectnessTest.java 8224150 generic-all
+serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java 8225354 windows-all
 
 #############################################################################
 
@@ -127,6 +128,7 @@ vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestD
 vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java 7034630 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java 8065773 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java 8065773 generic-all
+vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java 8246493 generic-all
 
 vmTestbase/nsk/jdb/eval/eval001/eval001.java 8221503 generic-all
 
diff --git a/test/hotspot/jtreg/compiler/escapeAnalysis/TestGetClass.java b/test/hotspot/jtreg/compiler/escapeAnalysis/TestGetClass.java
index 7b2b587b2cf..ffdb357e556 100644
--- a/test/hotspot/jtreg/compiler/escapeAnalysis/TestGetClass.java
+++ b/test/hotspot/jtreg/compiler/escapeAnalysis/TestGetClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,9 @@
  * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getClass
  *                   -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,compiler.escapeAnalysis.TestGetClass::test
  *                   -XX:+PrintCompilation compiler.escapeAnalysis.TestGetClass
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:ControlIntrinsic=-_getClass
+ *                   -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,compiler.escapeAnalysis.TestGetClass::test
+ *                   -XX:+PrintCompilation compiler.escapeAnalysis.TestGetClass
  */
 
 package compiler.escapeAnalysis;
diff --git a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicAvailableTest.java b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicAvailableTest.java
index 1bf2c504ff4..e4a9b32b37f 100644
--- a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicAvailableTest.java
+++ b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicAvailableTest.java
@@ -39,6 +39,25 @@
  *                   -XX:+WhiteBoxAPI
  *                   -XX:-UseCRC32Intrinsics
  *                   compiler.intrinsics.IntrinsicAvailableTest
+ * @run main/othervm -Xbootclasspath/a:.
+ *                   -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:ControlIntrinsic=+_updateCRC32
+ *                   -XX:-UseCRC32Intrinsics
+ *                   compiler.intrinsics.IntrinsicAvailableTest
+ * @run main/othervm -Xbootclasspath/a:.
+ *                   -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:ControlIntrinsic=-_updateCRC32
+ *                   -XX:+UseCRC32Intrinsics
+ *                   compiler.intrinsics.IntrinsicAvailableTest
+ *
+ * @run main/othervm -Xbootclasspath/a:.
+ *                   -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:ControlIntrinsic=+_updateCRC32
+ *                   -XX:+UseCRC32Intrinsics
+ *                   compiler.intrinsics.IntrinsicAvailableTest
  */
 
 
@@ -93,7 +112,17 @@ public boolean isOsr() {
     }
 
     protected void checkIntrinsicForCompilationLevel(Executable method, int compLevel) throws Exception {
-        boolean intrinsicEnabled = Boolean.valueOf(getVMOption("UseCRC32Intrinsics"));
+        boolean intrinsicEnabled = true;
+        String controlIntrinsic = getVMOption("ControlIntrinsic", "");
+
+        if (controlIntrinsic.contains("+_updateCRC32")) {
+          intrinsicEnabled = true;
+        } else if (controlIntrinsic.contains("-_updateCRC32")) {
+          intrinsicEnabled = false;
+        }
+
+        intrinsicEnabled &= Boolean.valueOf(getVMOption("UseCRC32Intrinsics"));
+
         boolean intrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(method,
                                                                     compLevel);
 
diff --git a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java
index bacddfefa21..ea253dcbc9d 100644
--- a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java
+++ b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java
@@ -39,7 +39,26 @@
  *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt
  *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile
  *                   compiler.intrinsics.IntrinsicDisabledTest
- */
+ * @run main/othervm -Xbootclasspath/a:.
+ *                   -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:ControlIntrinsic=-_putCharVolatile,-_putInt
+ *                   -XX:ControlIntrinsic=-_putIntVolatile
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,ControlIntrinsic,-_getCharVolatile,-_getInt
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,ControlIntrinsic,-_getIntVolatile
+ *                   compiler.intrinsics.IntrinsicDisabledTest
+ * @run main/othervm -Xbootclasspath/a:.
+ *                   -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI
+ *                   -XX:ControlIntrinsic=+putIntVolatile,+_putCharVolatile,+_putInt
+ *                   -XX:DisableIntrinsic=_putCharVolatile,_putInt
+ *                   -XX:DisableIntrinsic=_putIntVolatile
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,ControlIntrinsic,+_getCharVolatile,+_getInt
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,ControlIntrinsic,+_getIntVolatile
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt
+ *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile
+ *                   compiler.intrinsics.IntrinsicDisabledTest
+*/
 
 package compiler.intrinsics;
 
diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
index 45444d4055c..e7bf30609e8 100644
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
@@ -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 @@ public void findLeastCommonAncestorTest() {
         }
     }
 
+    @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 {
     }
 
diff --git a/test/hotspot/jtreg/compiler/loopstripmining/TestStoreSunkToOuterLoop.java b/test/hotspot/jtreg/compiler/loopstripmining/TestStoreSunkToOuterLoop.java
new file mode 100644
index 00000000000..defdfc7452f
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/loopstripmining/TestStoreSunkToOuterLoop.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2020, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8247763
+ * @summary assert(outer->outcnt() == 2) failed: 'only phis' failure in LoopNode::verify_strip_mined()
+ *
+ * @run main/othervm -Xcomp -XX:CompileOnly=TestStoreSunkToOuterLoop TestStoreSunkToOuterLoop
+ *
+ */
+
+public class TestStoreSunkToOuterLoop {
+
+    public static final int N = 400;
+    public static long instanceCount=-62761L;
+    public static boolean bFld=false;
+    public static int iArrFld[]=new int[N];
+
+    public void mainTest() {
+
+        int i15=226, i16=54621, i19=780;
+        float f3=0.671F, f4=-101.846F;
+
+        i15 = 1;
+        do {
+            if (bFld) continue;
+            for (i16 = 1; i16 < 101; ++i16) {
+                iArrFld[i16 - 1] = i15;
+                instanceCount = i16;
+            }
+        } while (++i15 < 248);
+        f3 += -2061721519L;
+        for (f4 = 324; f4 > 3; f4--) {
+            for (i19 = 4; i19 < 78; ++i19) {
+                f3 -= -11;
+            }
+        }
+
+        System.out.println(instanceCount);
+    }
+
+    public static void main(String[] strArr) {
+        TestStoreSunkToOuterLoop _instance = new TestStoreSunkToOuterLoop();
+        for (int i = 0; i < 10; i++ ) {
+            _instance.mainTest();
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/compiler/stringopts/TestLongStringConcat.java b/test/hotspot/jtreg/compiler/stringopts/TestLongStringConcat.java
new file mode 100644
index 00000000000..a1cb9f774d1
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/stringopts/TestLongStringConcat.java
@@ -0,0 +1,81 @@
+/*
+ * 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
+ * @bug 8237950
+ * @summary Test very long chain of StringBuilder append calls.
+ * @run main/othervm -Xbatch compiler.stringopts.TestLongStringConcat
+ */
+
+package compiler.stringopts;
+
+public class TestLongStringConcat {
+
+    public static String test() {
+        return (new StringBuilder("")).append("1").append("2").append("3").append("4").
+            append("5").append("6").append("7").append("8").append("9").append("10").
+            append("11").append("12").append("13").append("14").append("15").append("16").
+            append("17").append("18").append("19").append("20").append("21").append("22").
+            append("23").append("24").append("25").append("26").append("27").append("28").
+            append("29").append("30").append("31").append("32").append("33").append("34").
+            append("35").append("36").append("37").append("38").append("39").append("40").
+            append("41").append("42").append("43").append("44").append("45").append("46").
+            append("47").append("48").append("49").append("50").append("51").append("52").
+            append("53").append("54").append("55").append("56").append("57").append("58").
+            append("59").append("60").append("61").append("62").append("63").append("64").
+            append("65").append("66").append("67").append("68").append("69").append("70").
+            append("71").append("72").append("73").append("74").append("75").append("76").
+            append("77").append("78").append("79").append("80").append("81").append("82").
+            append("83").append("84").append("85").append("86").append("87").append("88").
+            append("89").append("90").append("91").append("92").append("93").append("94").
+            append("95").append("96").append("97").append("98").append("99").append("100").
+            append("101").append("102").append("103").append("104").append("105").
+            append("106").append("107").append("108").append("109").append("110").
+            append("111").append("112").append("113").append("114").append("115").
+            append("116").append("117").append("118").append("119").append("120").
+            append("121").append("122").append("123").append("124").append("125").
+            append("126").append("127").append("128").append("129").append("130").
+            append("131").append("132").append("133").append("134").append("135").
+            append("136").append("137").append("138").append("139").append("140").
+            append("141").append("142").append("143").append("144").append("145").
+            append("146").append("147").append("148").append("149").append("150").
+            append("151").append("152").append("153").append("154").append("155").
+            append("156").append("157").append("158").append("159").append("160").
+            append("161").append("162").append("163").append("164").append("165").
+            append("166").append("167").append("168").append("169").append("170").
+            append("171").append("172").append("173").append("174").append("175").
+            append("176").append("177").append("178").append("179").append("180").
+            append("181").append("182").append("183").append("184").append("185").
+            append("186").append("187").append("188").append("189").append("190").
+            append("191").append("192").append("193").append("194").append("195").
+            append("196").append("197").append("198").append("199").append("200").
+            toString();
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 100_000; ++i) {
+            test();
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java
index 2d9411e94d0..1c6cecca08c 100644
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java
+++ b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,9 @@ public static Object inflateMonitor(Object monitor) throws Exception {
     public static void verifyMonitorState(Object monitor,
             boolean shouldBeInflated) {
         if (!shouldBeInflated && WHITE_BOX.isMonitorInflated(monitor)) {
-            WHITE_BOX.forceSafepoint();
+            boolean did_deflation = WHITE_BOX.deflateIdleMonitors();
+            Asserts.assertEQ(did_deflation, true,
+                             "deflateIdleMonitors() should have worked.");
         }
         Asserts.assertEQ(WHITE_BOX.isMonitorInflated(monitor), shouldBeInflated,
                 "Monitor in a wrong state.");
diff --git a/test/hotspot/jtreg/containers/docker/CheckOperatingSystemMXBean.java b/test/hotspot/jtreg/containers/docker/CheckOperatingSystemMXBean.java
index 4e17878b689..b6d1a9778a5 100644
--- a/test/hotspot/jtreg/containers/docker/CheckOperatingSystemMXBean.java
+++ b/test/hotspot/jtreg/containers/docker/CheckOperatingSystemMXBean.java
@@ -24,11 +24,20 @@
 
 import com.sun.management.OperatingSystemMXBean;
 import java.lang.management.ManagementFactory;
+import jdk.internal.platform.Metrics;
 
 public class CheckOperatingSystemMXBean {
 
     public static void main(String[] args) {
         System.out.println("Checking OperatingSystemMXBean");
+        Metrics metrics = jdk.internal.platform.Container.metrics();
+        System.out.println("Metrics instance: " + (metrics == null ? "null" : "non-null"));
+        if (metrics != null) {
+            System.out.println("Metrics.getMemoryAndSwapLimit() == " + metrics.getMemoryAndSwapLimit());
+            System.out.println("Metrics.getMemoryLimit() == " + metrics.getMemoryLimit());
+            System.out.println("Metrics.getMemoryAndSwapUsage() == " + metrics.getMemoryAndSwapUsage());
+            System.out.println("Metrics.getMemoryUsage() == " + metrics.getMemoryUsage());
+        }
 
         OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
         System.out.println(String.format("Runtime.availableProcessors: %d", Runtime.getRuntime().availableProcessors()));
diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
index f2264d6f516..da35f26a872 100644
--- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
+++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
@@ -28,6 +28,7 @@
  * @requires docker.support
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.platform
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @build PrintContainerInfo CheckOperatingSystemMXBean
@@ -237,7 +238,11 @@ private static void testOperatingSystemMXBeanAwareness(String cpuAllocation, Str
         DockerRunOptions opts = Common.newOpts(imageName, "CheckOperatingSystemMXBean")
             .addDockerOpts(
                 "--cpus", cpuAllocation
-            );
+            )
+            // CheckOperatingSystemMXBean uses Metrics (jdk.internal.platform) for
+            // diagnostics
+            .addJavaOpts("--add-exports")
+            .addJavaOpts("java.base/jdk.internal.platform=ALL-UNNAMED");
 
         DockerTestUtils.dockerRunJava(opts)
             .shouldHaveExitValue(0)
diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
index 1983cce10e8..cde1dde96a6 100644
--- a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
+++ b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
@@ -28,6 +28,7 @@
  * @requires docker.support
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.platform
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @build AttemptOOM sun.hotspot.WhiteBox PrintContainerInfo CheckOperatingSystemMXBean
@@ -142,7 +143,11 @@ private static void testOperatingSystemMXBeanAwareness(String memoryAllocation,
             .addDockerOpts(
                 "--memory", memoryAllocation,
                 "--memory-swap", swapAllocation
-            );
+            )
+            // CheckOperatingSystemMXBean uses Metrics (jdk.internal.platform) for
+            // diagnostics
+            .addJavaOpts("--add-exports")
+            .addJavaOpts("java.base/jdk.internal.platform=ALL-UNNAMED");
 
         OutputAnalyzer out = DockerTestUtils.dockerRunJava(opts);
         out.shouldHaveExitValue(0)
@@ -153,11 +158,13 @@ private static void testOperatingSystemMXBeanAwareness(String memoryAllocation,
            .shouldMatch("OperatingSystemMXBean\\.getFreeMemorySize: [1-9][0-9]+")
            .shouldMatch("OperatingSystemMXBean\\.getFreeSwapSpaceSize: [1-9][0-9]+");
         // in case of warnings like : "Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap."
-        // the getTotalSwapSpaceSize does not return the expected result, but 0
+        // the getTotalSwapSpaceSize returns the system values as the container setup isn't supported in that case.
         try {
             out.shouldContain("OperatingSystemMXBean.getTotalSwapSpaceSize: " + expectedSwap);
         } catch(RuntimeException ex) {
-            out.shouldContain("OperatingSystemMXBean.getTotalSwapSpaceSize: 0");
+            out.shouldMatch("OperatingSystemMXBean.getTotalSwapSpaceSize: [1-9][0-9]+");
+            out.shouldContain("Metrics.getMemoryLimit() == " + expectedMemory);
+            out.shouldContain("Metrics.getMemoryAndSwapLimit() == -1");
         }
     }
 
diff --git a/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java b/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java
index 76160e426b8..e2a494110e4 100644
--- a/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java
+++ b/test/hotspot/jtreg/gc/g1/humongousObjects/TestHumongousClassLoader.java
@@ -203,6 +203,10 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat
 
         gc.provoke();
 
+        boolean did_deflation = WB.deflateIdleMonitors();
+        Asserts.assertEQ(did_deflation, true,
+                         "deflateIdleMonitors() should have worked.");
+
         // Test checks
         Asserts.assertEquals(WB.isClassAlive(HUMONGOUS_CLASSLOADER_NAME), false,
                 String.format("Classloader class %s is loaded after we forget all references to it",
diff --git a/test/hotspot/jtreg/gc/whitebox/TestWBGC.java b/test/hotspot/jtreg/gc/whitebox/TestWBGC.java
index 2d1cdbf26c4..0b08d40f88d 100644
--- a/test/hotspot/jtreg/gc/whitebox/TestWBGC.java
+++ b/test/hotspot/jtreg/gc/whitebox/TestWBGC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,9 @@
 package gc.whitebox;
 
 /*
- * @test TestWBGC
+ * @test
  * @bug 8055098
- * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly.
+ * @summary Test to verify that WB methods isObjectInOldGen and youngGC work correctly.
  * @requires vm.gc != "Z" & vm.gc != "Shenandoah"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
diff --git a/test/hotspot/jtreg/gtest/GTestWrapper.java b/test/hotspot/jtreg/gtest/GTestWrapper.java
index 2c000b18372..4772ad87774 100644
--- a/test/hotspot/jtreg/gtest/GTestWrapper.java
+++ b/test/hotspot/jtreg/gtest/GTestWrapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@ public static void main(String[] args) throws Throwable {
                              .resolve(jvmVariantDir);
         }
         if (!path.toFile().exists()) {
-            throw new Error("TESTBUG: the library has not been found in " + nativePath);
+            throw new Error("TESTBUG: the library has not been found in " + nativePath + ". Did you forget to use --with-gtest to configure?");
         }
 
         Path execPath = path.resolve("gtestLauncher" + (Platform.isWindows() ? ".exe" : ""));
diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/PatchModule/Simple.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/PatchModule/Simple.java
index bbc6af73ee4..7edb1937d6b 100644
--- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/PatchModule/Simple.java
+++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/PatchModule/Simple.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
  * @run driver Simple
  */
 
+import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.compiler.InMemoryJavaCompiler;
 import jdk.test.lib.process.OutputAnalyzer;
 
@@ -76,5 +77,22 @@ public static void main(String args[]) throws Throwable {
             "-Xlog:class+path=info",
             "PatchMain", "javax.naming.spi.NamingManager")
             .assertSilentlyDisabledCDS(0, "I pass!");
+
+        // ========================================
+        if (!CDSTestUtils.DYNAMIC_DUMP) {
+            System.out.println("Dump again without --patch-module");
+            output =
+                TestCommon.dump(null,
+                    TestCommon.list("javax/naming/spi/NamingManager"));
+            output.shouldHaveExitValue(0);
+
+            TestCommon.run(
+                "-XX:+UnlockDiagnosticVMOptions",
+                "--patch-module=java.naming=" + moduleJar,
+                "-Xlog:class+load",
+                "-Xlog:class+path=info",
+                "PatchMain", "javax.naming.spi.NamingManager")
+                .assertSilentlyDisabledCDS(0, "I pass!");
+        }
     }
 }
diff --git a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
index b791d5872cb..b6d5acc7a46 100644
--- a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
+++ b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2019 SAP SE. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,12 @@
 
 /**
  * @test
- * @summary Test that the default of flag ShowCodeDetailsInExceptionMessages is 'false',
- *          i.e., make sure the VM does not print the message on default.
+ * @summary Test that the default of flag ShowCodeDetailsInExceptionMessages is 'true',
+ *          i.e., make sure the VM does print the message by default.
  * @bug 8218628
  * @library /test/lib
  * @compile -g SuppressMessagesTest.java
- * @run main/othervm SuppressMessagesTest noMessage
+ * @run main/othervm SuppressMessagesTest printMessage
  */
 /**
  * @test
diff --git a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java
index 71453b68a91..7f05e930842 100644
--- a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java
+++ b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java
@@ -64,6 +64,22 @@ public static void main(String[] args) throws Exception {
             WhiteBox wb = WhiteBox.getWhiteBox();
             if (!wb.isClassAlive(CLASS_NAME)) {
                 System.out.println("Class LoadLibraryClass was unloaded");
+                while (true) {
+                    try {
+                        System.loadLibrary("LoadLibraryClass");
+                        // Able to load the library with this class's class loader
+                        // so it must have been unloaded by myLoader.
+                        break;
+                    } catch(java.lang.UnsatisfiedLinkError e) {
+                        if (e.getMessage().contains("already loaded in another classloader")) {
+                            // Library has not been unloaded yet, so wait a little and check again.
+                            Thread.sleep(10);
+                        } else {
+                            throw new RuntimeException(
+                                "Unexpected UnsatisfiedLinkError: " + e.getMessage());
+                        }
+                    }
+                }
             }
         }
 
diff --git a/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java b/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java
new file mode 100644
index 00000000000..ae8f02196c9
--- /dev/null
+++ b/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package runtime.whitebox;
+
+/*
+ * @test
+ * @bug 8246477
+ * @summary Test to verify that WB method deflateIdleMonitors works correctly.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver runtime.whitebox.TestWBDeflateIdleMonitors
+ */
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import sun.hotspot.WhiteBox;
+
+public class TestWBDeflateIdleMonitors {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createTestJvm(
+                "-Xbootclasspath/a:.",
+                "-XX:+UnlockDiagnosticVMOptions",
+                "-XX:+WhiteBoxAPI",
+                "-Xlog:monitorinflation=info",
+                InflateMonitorsTest.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        System.out.println(output.getStdout());
+        output.shouldHaveExitValue(0);
+        output.shouldContain("WhiteBox initiated DeflateIdleMonitors");
+    }
+
+    public static class InflateMonitorsTest {
+        static WhiteBox wb = WhiteBox.getWhiteBox();
+        public static Object obj;
+
+        public static void main(String args[]) {
+            obj = new Object();
+            synchronized (obj) {
+                // HotSpot implementation detail: asking for the hash code
+                // when the object is locked causes monitor inflation.
+                if (obj.hashCode() == 0xBAD) System.out.println("!");
+                Asserts.assertEQ(wb.isMonitorInflated(obj), true,
+                                 "Monitor should be inflated.");
+            }
+            boolean did_deflation = wb.deflateIdleMonitors();
+            Asserts.assertEQ(did_deflation, true,
+                             "deflateIdleMonitors() should have worked.");
+            Asserts.assertEQ(wb.isMonitorInflated(obj), false,
+                             "Monitor should be deflated.");
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/vmTestbase/jit/t/t104/t104.gold b/test/hotspot/jtreg/vmTestbase/jit/t/t104/t104.gold
index e3a49f7ec64..64a23127c8b 100644
--- a/test/hotspot/jtreg/vmTestbase/jit/t/t104/t104.gold
+++ b/test/hotspot/jtreg/vmTestbase/jit/t/t104/t104.gold
@@ -1,2 +1,2 @@
 Exception thrown.
-java.lang.NullPointerException
+java.lang.NullPointerException: Cannot enter synchronized block because "<local1>" is null
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index de2f7a6c286..2c9a63e9e0c 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -593,6 +593,8 @@ java/io/pathNames/GeneralWin32.java                             8180264 windows-
 com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
 com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java  8030957 aix-all
 
+java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java    8247426 generic-all
+
 sun/management/jdp/JdpDefaultsTest.java                         8241865 macosx-all
 sun/management/jdp/JdpJmxRemoteDynamicPortTest.java             8241865 macosx-all
 sun/management/jdp/JdpSpecificAddressTest.java                  8241865 macosx-all
@@ -628,6 +630,8 @@ java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc6
 
 java/nio/channels/Selector/Wakeup.java                          6963118 windows-all
 
+sun/nio/ch/TestMaxCachedBufferSize.java                         8212812 macosx-all
+
 ############################################################################
 
 # jdk_rmi
@@ -699,6 +703,10 @@ javax/security/auth/kerberos/KerberosTixDateTest.java           8039280 generic-
 sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
 sun/security/provider/PolicyParser/ExtDirsChange.java           8039280 generic-all
 sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
+sun/security/provider/SecureRandom/AbstractDrbg/SpecTest.java   8247359 linux-aarch64
+sun/security/provider/SecureRandom/SHA1PRNGReseed.java          8247359 linux-aarch64
+sun/security/provider/SecureRandom/StrongSecureRandom.java      8247359 linux-aarch64
+sun/security/provider/SeedGenerator/SeedGeneratorChoice.java    8247359 linux-aarch64
 
 ############################################################################
 
@@ -910,9 +918,20 @@ javax/script/Test7.java                                         8239361 generic-
 
 jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java          8228990,8229370    generic-all
 jdk/jfr/event/compiler/TestCodeSweeper.java                     8225209    generic-all
+jdk/jfr/event/os/TestThreadContextSwitches.java                 8247776 windows-all
 
 ############################################################################
 
 # 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
+
+############################################################################
diff --git a/test/jdk/java/foreign/TestMismatch.java b/test/jdk/java/foreign/TestMismatch.java
index e57de6ca73a..5c361a82fe9 100644
--- a/test/jdk/java/foreign/TestMismatch.java
+++ b/test/jdk/java/foreign/TestMismatch.java
@@ -117,12 +117,28 @@ public void testLarge() {
             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);
         }
     }
 
diff --git a/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java
new file mode 100644
index 00000000000..82cb31d86c2
--- /dev/null
+++ b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java
@@ -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);
+            }
+        }
+    }
+}
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/src/Fields.java b/test/jdk/java/lang/invoke/unreflect/Fields.java
similarity index 100%
rename from test/jdk/java/lang/invoke/defineHiddenClass/src/Fields.java
rename to test/jdk/java/lang/invoke/unreflect/Fields.java
diff --git a/bin/nashorn/fixwhitespace.sh b/test/jdk/java/lang/invoke/unreflect/TEST.properties
similarity index 72%
rename from bin/nashorn/fixwhitespace.sh
rename to test/jdk/java/lang/invoke/unreflect/TEST.properties
index d3274700f71..2ab57ceb5d6 100644
--- a/bin/nashorn/fixwhitespace.sh
+++ b/test/jdk/java/lang/invoke/unreflect/TEST.properties
@@ -1,37 +1,24 @@
-#!/bin/bash
 #
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# 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.
 #
 
-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
+enablePreview=true
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/UnreflectTest.java b/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java
similarity index 86%
rename from test/jdk/java/lang/invoke/defineHiddenClass/UnreflectTest.java
rename to test/jdk/java/lang/invoke/unreflect/UnreflectTest.java
index f1bf40c7906..206287c57c6 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/UnreflectTest.java
+++ b/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @compile src/Fields.java
- * @run testng/othervm UnreflectTest
- * @summary Test Lookup::unreflectSetter and Lookup::unreflectVarHandle
+ * @bug 8238358 8247444
+ * @run testng/othervm --enable-preview UnreflectTest
+ * @summary Test Lookup::unreflectSetter and Lookup::unreflectVarHandle on
+ *          trusted final fields (declared in hidden classes and records)
  */
 
 import java.io.IOException;
@@ -89,6 +90,24 @@ public void testFieldsInHiddenClass() throws Throwable {
         readWriteAccessibleObject(hiddenClass, "NON_FINAL", o, false);
     }
 
+    static record TestRecord(int i) {
+        static final Object STATIC_FINAL = new Object();
+        static Object STATIC_NON_FINAL = new Object();
+    }
+
+    /*
+     * Test Lookup::unreflectSetter and Lookup::unreflectVarHandle that
+     * cannot write the value of a non-static final field in a record class
+     */
+    @SuppressWarnings("preview")
+    public void testFieldsInRecordClass() throws Throwable {
+        assertTrue(TestRecord.class.isRecord());
+        Object o = new TestRecord(1);
+        readOnlyAccessibleObject(TestRecord.class, "STATIC_FINAL", null, true);
+        readWriteAccessibleObject(TestRecord.class, "STATIC_NON_FINAL", null, false);
+        readOnlyAccessibleObject(TestRecord.class, "i", o, true);
+    }
+
     /*
      * Verify read-only access via unreflectSetter and unreflectVarHandle
      */
diff --git a/test/jdk/java/lang/reflect/records/RecordReflectionTest.java b/test/jdk/java/lang/reflect/records/RecordReflectionTest.java
index 2ad1547b575..b121bac5ef5 100644
--- a/test/jdk/java/lang/reflect/records/RecordReflectionTest.java
+++ b/test/jdk/java/lang/reflect/records/RecordReflectionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8235369 8235550
+ * @bug 8235369 8235550 8247444
  * @summary reflection test for records
  * @compile --enable-preview -source ${jdk.version} RecordReflectionTest.java
  * @run testng/othervm --enable-preview RecordReflectionTest
@@ -187,4 +187,19 @@ public void testTypeAnnotationsInRecordComp() throws Throwable {
         assertEquals(f.getAnnotatedType().getAnnotations().length, 1);
         assertEquals(f.getAnnotatedType().getAnnotations()[0].toString(), annos[0].toString());
     }
+
+    public void testReadOnlyFieldInRecord() throws Throwable {
+        R2 o = new R2(1, 2);
+        Class<?> recordClass = R2.class;
+        String fieldName = "i";
+        Field f = recordClass.getDeclaredField(fieldName);
+        assertTrue(f.trySetAccessible());
+        assertTrue(f.get(o) != null);
+        try {
+            f.set(o, null);
+            assertTrue(false, "should fail to set " + fieldName);
+        } catch (IllegalAccessException e) {
+        }
+    }
+
 }
diff --git a/test/jdk/java/nio/file/Path/Misc.java b/test/jdk/java/nio/file/Path/Misc.java
index 424a60d6bdc..ad1640c23b8 100644
--- a/test/jdk/java/nio/file/Path/Misc.java
+++ b/test/jdk/java/nio/file/Path/Misc.java
@@ -120,8 +120,22 @@ static void testToRealPath(Path dir) throws IOException {
          * Test: toRealPath() should resolve links
          */
         if (supportsLinks) {
-            Files.createSymbolicLink(link, file.toAbsolutePath());
-            assertTrue(link.toRealPath().equals(file.toRealPath()));
+            Path resolvedFile = file;
+            if (isWindows) {
+                // Path::toRealPath does not work with environments using the
+                // legacy subst mechanism. This is a workaround to keep the
+                // test working if 'dir' points to a location on a subst drive.
+                // See JDK-8213216.
+                //
+                Path tempLink = dir.resolve("tempLink");
+                Files.createSymbolicLink(tempLink, dir.toAbsolutePath());
+                Path resolvedDir = tempLink.toRealPath();
+                Files.delete(tempLink);
+                resolvedFile = resolvedDir.resolve(file.getFileName());
+            }
+
+            Files.createSymbolicLink(link, resolvedFile.toAbsolutePath());
+            assertTrue(link.toRealPath().equals(resolvedFile.toRealPath()));
             Files.delete(link);
         }
 
diff --git a/test/jdk/javax/crypto/SecretKeyFactory/security.properties b/test/jdk/javax/crypto/SecretKeyFactory/security.properties
index f855f12b990..c71970526bd 100644
--- a/test/jdk/javax/crypto/SecretKeyFactory/security.properties
+++ b/test/jdk/javax/crypto/SecretKeyFactory/security.properties
@@ -1,6 +1,3 @@
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-# ORACLE PROPRIETARY/CONFIDENTIAL.  Use is subject to license terms.
-
 jdk.security.provider.preferred=
 jdk.jar.disabledAlgorithms=
 
diff --git a/test/jdk/javax/xml/crypto/dsig/LogParameters.java b/test/jdk/javax/xml/crypto/dsig/LogParameters.java
new file mode 100644
index 00000000000..cd829761f6e
--- /dev/null
+++ b/test/jdk/javax/xml/crypto/dsig/LogParameters.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+import jdk.test.lib.hexdump.HexPrinter;
+
+import java.io.ByteArrayOutputStream;
+import java.util.logging.*;
+
+/**
+ * @test
+ * @bug 8247907
+ * @library /test/lib
+ * @modules java.xml.crypto/com.sun.org.slf4j.internal
+ */
+public class LogParameters {
+    public static void main(String[] args) {
+
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        Logger.getLogger(String.class.getName()).setLevel(Level.ALL);
+        Handler h = new StreamHandler(bout, new SimpleFormatter());
+        h.setLevel(Level.ALL);
+        Logger.getLogger(String.class.getName()).addHandler(h);
+
+        com.sun.org.slf4j.internal.Logger log =
+                com.sun.org.slf4j.internal.LoggerFactory.getLogger(String.class);
+        log.debug("I have {} {}s.", 10, "apple");
+
+        h.flush();
+
+        byte[] data = bout.toByteArray();
+        String s = new String(data);
+        if (!s.contains("LogParameters main")
+                || !s.contains("FINE: I have 10 apples.")) {
+            HexPrinter.simple().format(data);
+            throw new RuntimeException("Unexpected log output: " + s);
+        }
+    }
+}
diff --git a/test/jdk/jdk/jfr/event/oldobject/TestG1.java b/test/jdk/jdk/jfr/event/oldobject/TestG1.java
index 6cfd985b1ce..2d3f142404f 100644
--- a/test/jdk/jdk/jfr/event/oldobject/TestG1.java
+++ b/test/jdk/jdk/jfr/event/oldobject/TestG1.java
@@ -54,17 +54,21 @@ static private class FindMe {
     public static void main(String[] args) throws Exception {
         WhiteBox.setWriteAllObjectSamples(true);
 
-        try (Recording r = new Recording()) {
-            r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
-            r.start();
-            allocateFindMe();
-            System.gc();
-            r.stop();
-            List<RecordedEvent> events = Events.fromRecording(r);
-            System.out.println(events);
-            if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
-                throw new Exception("Could not find leak with " + FindMe[].class);
+        while (true) {
+            try (Recording r = new Recording()) {
+                r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
+                r.start();
+                allocateFindMe();
+                System.gc();
+                r.stop();
+                List<RecordedEvent> events = Events.fromRecording(r);
+                System.out.println(events);
+                if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
+                    return;
+                }
+                System.out.println("Could not find leaking object, retrying...");
             }
+            list.clear();
         }
     }
 
diff --git a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java b/test/jdk/jdk/jfr/event/oldobject/TestParallel.java
index 71bfb486b83..ba0b6ea4b03 100644
--- a/test/jdk/jdk/jfr/event/oldobject/TestParallel.java
+++ b/test/jdk/jdk/jfr/event/oldobject/TestParallel.java
@@ -54,17 +54,21 @@ static private class FindMe {
     public static void main(String[] args) throws Exception {
         WhiteBox.setWriteAllObjectSamples(true);
 
-        try (Recording r = new Recording()) {
-            r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
-            r.start();
-            allocateFindMe();
-            System.gc();
-            r.stop();
-            List<RecordedEvent> events = Events.fromRecording(r);
-            System.out.println(events);
-            if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
-                throw new Exception("Could not find leak with " + FindMe[].class);
+        while (true) {
+            try (Recording r = new Recording()) {
+                r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
+                r.start();
+                allocateFindMe();
+                System.gc();
+                r.stop();
+                List<RecordedEvent> events = Events.fromRecording(r);
+                System.out.println(events);
+                if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
+                    return;
+                }
+                System.out.println("Could not find leaking object, retrying...");
             }
+            list.clear();
         }
     }
 
diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java b/test/jdk/jdk/jfr/event/oldobject/TestSerial.java
index ad18a6c84f2..905b187fc14 100644
--- a/test/jdk/jdk/jfr/event/oldobject/TestSerial.java
+++ b/test/jdk/jdk/jfr/event/oldobject/TestSerial.java
@@ -54,17 +54,21 @@ static private class FindMe {
     public static void main(String[] args) throws Exception {
         WhiteBox.setWriteAllObjectSamples(true);
 
-        try (Recording r = new Recording()) {
-            r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
-            r.start();
-            allocateFindMe();
-            System.gc();
-            r.stop();
-            List<RecordedEvent> events = Events.fromRecording(r);
-            System.out.println(events);
-            if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
-                throw new Exception("Could not find leak with " + FindMe[].class);
+        while (true) {
+            try (Recording r = new Recording()) {
+                r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
+                r.start();
+                allocateFindMe();
+                System.gc();
+                r.stop();
+                List<RecordedEvent> events = Events.fromRecording(r);
+                System.out.println(events);
+                if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
+                    return;
+                }
+                System.out.println("Could not find leaking object, retrying...");
             }
+            list.clear();
         }
     }
 
diff --git a/test/jdk/jdk/jfr/event/oldobject/TestZ.java b/test/jdk/jdk/jfr/event/oldobject/TestZ.java
new file mode 100644
index 00000000000..ae5044f3801
--- /dev/null
+++ b/test/jdk/jdk/jfr/event/oldobject/TestZ.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jfr.event.oldobject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.jfr.Recording;
+import jdk.jfr.consumer.RecordedEvent;
+import jdk.jfr.internal.test.WhiteBox;
+import jdk.test.lib.jfr.EventNames;
+import jdk.test.lib.jfr.Events;
+
+/**
+ * @test
+ * @key jfr
+ * @requires vm.hasJFR & vm.gc.Z
+ * @requires vm.gc == "null"
+ * @summary Test leak profiler with ZGC
+ * @library /test/lib /test/jdk
+ * @modules jdk.jfr/jdk.jfr.internal.test
+ * @run main/othervm  -XX:TLABSize=2k -XX:+UseZGC jdk.jfr.event.oldobject.TestZ
+ */
+public class TestZ {
+
+    static private class FindMe {
+    }
+
+    public static List<FindMe[]> list = new ArrayList<>(OldObjects.MIN_SIZE);
+
+    public static void main(String[] args) throws Exception {
+        WhiteBox.setWriteAllObjectSamples(true);
+
+        while (true) {
+            try (Recording r = new Recording()) {
+                r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
+                r.start();
+                allocateFindMe();
+                System.gc();
+                r.stop();
+                List<RecordedEvent> events = Events.fromRecording(r);
+                System.out.println(events);
+                if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
+                    return;
+                }
+                System.out.println("Could not find leaking object, retrying...");
+            }
+            list.clear();
+        }
+    }
+
+    public static void allocateFindMe() {
+        for (int i = 0; i < OldObjects.MIN_SIZE; i++) {
+            // Allocate array to trigger sampling code path for interpreter / c1
+            list.add(new FindMe[0]);
+        }
+    }
+
+}
diff --git a/test/jdk/sun/misc/UnsafeFieldOffsets.java b/test/jdk/sun/misc/UnsafeFieldOffsets.java
index aeaa92206a9..e2c63c350f4 100644
--- a/test/jdk/sun/misc/UnsafeFieldOffsets.java
+++ b/test/jdk/sun/misc/UnsafeFieldOffsets.java
@@ -22,10 +22,12 @@
  */
 
 /* @test
+ * @bug 8238358 8247444
  * @summary Ensure that sun.misc.Unsafe::objectFieldOffset and staticFieldOffset
- *          throw UnsupportedOperationException on Field of a hidden class
+ *          throw UnsupportedOperationException on Field of a hidden or record class
  * @modules jdk.unsupported
- * @run main UnsafeFieldOffsets
+ * @compile --enable-preview -source ${jdk.version} UnsafeFieldOffsets.java
+ * @run testng/othervm --enable-preview UnsafeFieldOffsets
  */
 
 import sun.misc.Unsafe;
@@ -38,6 +40,9 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
 public class UnsafeFieldOffsets {
     static class Fields {
         static final Object STATIC_FINAL = new Object();
@@ -45,9 +50,14 @@ static class Fields {
         final Object FINAL = new Object();
         Object NON_FINAL = new Object();
     }
+    record TestRecord(int i) {
+        static final Object STATIC_FINAL = new Object();
+        static Object STATIC_NON_FINAL = new Object();
+    }
 
     private static Unsafe UNSAFE = getUnsafe();
     private static final Class<?> HIDDEN_CLASS = defineHiddenClass();
+    private static final Class<?> RECORD_CLASS = TestRecord.class;
 
     private static Unsafe getUnsafe() {
         try {
@@ -65,7 +75,7 @@ private static Class<?> defineHiddenClass() {
         try {
             byte[] bytes = Files.readAllBytes(cf);
             Class<?> c = MethodHandles.lookup().defineHiddenClass(bytes, true).lookupClass();
-            assertHiddenClass(c);
+            assertTrue(c.isHidden());
             return c;
         } catch (IOException e) {
             throw new UncheckedIOException(e);
@@ -74,13 +84,17 @@ private static Class<?> defineHiddenClass() {
         }
     }
 
-    public static void main(String[] args) throws Exception {
-        // non-hidden class
-        testStaticField(Fields.class, "STATIC_FINAL");
-        testStaticField(Fields.class, "STATIC_NON_FINAL");
-        testInstanceField(Fields.class, "FINAL");
-        testInstanceField(Fields.class, "NON_FINAL");
+    @Test
+    public void testNormalClass() throws Throwable {
+        // hidden class
+        testStaticField(HIDDEN_CLASS, "STATIC_FINAL");
+        testStaticField(HIDDEN_CLASS, "STATIC_NON_FINAL");
+        testInstanceField(HIDDEN_CLASS, "FINAL");
+        testInstanceField(HIDDEN_CLASS, "NON_FINAL");
+    }
 
+    @Test
+    public void testHiddenClass() throws Throwable {
         // hidden class
         testStaticField(HIDDEN_CLASS, "STATIC_FINAL");
         testStaticField(HIDDEN_CLASS, "STATIC_NON_FINAL");
@@ -88,13 +102,21 @@ public static void main(String[] args) throws Exception {
         testInstanceField(HIDDEN_CLASS, "NON_FINAL");
     }
 
+    @Test
+    public void testRecordClass() throws Throwable {
+        // record class
+        testRecordStaticField(RECORD_CLASS, "STATIC_FINAL");
+        testRecordStaticField(RECORD_CLASS, "STATIC_NON_FINAL");
+        testRecordInstanceField(RECORD_CLASS, "i");
+    }
+
     private static void testStaticField(Class<?> c, String name) throws Exception {
         Field f = c.getDeclaredField(name);
         try {
             UNSAFE.staticFieldOffset(f);
-            assertNonHiddenClass(c);
+            assertFalse(c.isHidden(), "Expected UOE thrown: " + c);
         } catch (UnsupportedOperationException e) {
-            assertHiddenClass(c);
+            assertTrue(c.isHidden(), "Expected hidden class: " + c);
         }
     }
 
@@ -102,19 +124,31 @@ private static void testInstanceField(Class<?> c, String name) throws Exception
         Field f = c.getDeclaredField(name);
         try {
             UNSAFE.objectFieldOffset(f);
-            assertNonHiddenClass(c);
+            assertFalse(c.isHidden(), "Expected UOE thrown: " + c);
         } catch (UnsupportedOperationException e) {
-            assertHiddenClass(c);
+            assertTrue(c.isHidden(), "Expected hidden class: " + c);
         }
     }
 
-    private static void assertNonHiddenClass(Class<?> c) {
-        if (c.isHidden())
-            throw new RuntimeException("Expected UOE but not thrown: " + c);
+    @SuppressWarnings("preview")
+    private static void testRecordStaticField(Class<?> c, String name) throws Exception {
+        Field f = c.getDeclaredField(name);
+        try {
+            UNSAFE.staticFieldOffset(f);
+            assertFalse(c.isRecord(), "Expected UOE thrown: " + c);
+        } catch (UnsupportedOperationException e) {
+            assertTrue(c.isRecord(), "Expected record class: " + c);
+        }
     }
 
-    private static void assertHiddenClass(Class<?> c) {
-        if (!c.isHidden())
-            throw new RuntimeException("Expected hidden class but is not: " + c);
+    @SuppressWarnings("preview")
+    private static void testRecordInstanceField(Class<?> c, String name) throws Exception {
+        Field f = c.getDeclaredField(name);
+        try {
+            UNSAFE.objectFieldOffset(f);
+            assertFalse(c.isRecord(), "Expected UOE thrown: " + c);
+        } catch (UnsupportedOperationException e) {
+            assertTrue(c.isRecord(), "Expected record class: " + c);
+        }
     }
 }
diff --git a/test/jdk/sun/security/pkcs/pkcs9/PKCS9AttrTypeTests.java b/test/jdk/sun/security/pkcs/pkcs9/PKCS9AttrTypeTests.java
new file mode 100644
index 00000000000..ae30de70556
--- /dev/null
+++ b/test/jdk/sun/security/pkcs/pkcs9/PKCS9AttrTypeTests.java
@@ -0,0 +1,203 @@
+/*
+ * 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
+ * @bug 8239950
+ * @summary Update PKCS9 Attributes to PKCS#9 v2.0 Encodings
+ * @library /test/lib
+ * @modules java.base/sun.security.pkcs
+            java.base/sun.security.util
+ */
+
+import java.io.IOException;
+import java.util.*;
+import sun.security.pkcs.PKCS9Attribute;
+import sun.security.util.DerValue;
+import jdk.test.lib.Utils;
+
+public class PKCS9AttrTypeTests {
+
+    static final Map<String, String> TEST_INPUT_GOOD =
+            new LinkedHashMap<String, String>() {{
+
+                // Challenge Password
+                put("challengePasssword as TeletexString",
+                    "301e06092a864886f70d010907311114" +
+                    "0f5468697349734150617373776f7264");
+                put("challengePasssword as PrintableString",
+                    "301e06092a864886f70d010907311113" +
+                    "0f5468697349734150617373776f7264");
+                put("challengePasssword as UniversalString",
+                    "304b06092a864886f70d010907313e1c" +
+                    "3c000000540000006800000069000000" +
+                    "73000000490000007300000041000000" +
+                    "50000000610000007300000073000000" +
+                    "770000006f0000007200000064");
+                put("challengePasssword as UTF8String",
+                    "301e06092a864886f70d01090731110c" +
+                    "0f5468697349734150617373776f7264");
+                put("challengePasssword as BMPString",
+                    "302d06092a864886f70d01090731201e" +
+                    "1e005400680069007300490073004100" +
+                    "500061007300730077006f00720064");
+
+                // Unstructured Name
+                put("unstructuredName as IA5String",
+                    "301b06092a864886f70d010902310e16" +
+                    "0c5468697349734d794e616d65");
+                put("unstructuredName as TeletexString",
+                    "301b06092a864886f70d010902310e14" +
+                    "0c5468697349734d794e616d65");
+                put("unstructuredName as PrintableString",
+                    "301b06092a864886f70d010902310e13" +
+                    "0c5468697349734d794e616d65");
+                put("unstructuredName as UniversalString",
+                    "303f06092a864886f70d01090231321c" +
+                    "30000000540000006800000069000000" +
+                    "7300000049000000730000004d000000" +
+                    "790000004e000000610000006d000000" +
+                    "65");
+                put("unstructuredName as UTF8String",
+                    "301b06092a864886f70d010902310e0c" +
+                    "0c5468697349734d794e616d65");
+                put("unstructuredName as BMPString",
+                    "302706092a864886f70d010902311a1e" +
+                    "18005400680069007300490073004d00" +
+                    "79004e0061006d0065");
+                put("unstructuredName as Multi-Valued",
+                    "302d06092a864886f70d010902312013" +
+                    "10546869734973416c736f4d794e616d" +
+                    "65160c5468697349734d794e616d65");
+
+                // Unstructured Address
+                put("unstructuredAddress as TeletexString",
+                    "301e06092a864886f70d010908311114" +
+                    "0f5468697349734d7941646472657373");
+                put("unstructuredAddress as PrintableString",
+                    "301e06092a864886f70d010908311113" +
+                    "0f5468697349734d7941646472657373");
+                put("unstructuredAddress as UniversalString",
+                    "304b06092a864886f70d010908313e1c" +
+                    "3c000000540000006800000069000000" +
+                    "7300000049000000730000004d000000" +
+                    "79000000410000006400000064000000" +
+                    "72000000650000007300000073");
+                put("unstructuredAddress as UTF8String",
+                    "301e06092a864886f70d01090831110c" +
+                    "0f5468697349734d7941646472657373");
+                put("unstructuredAddress as BMPString",
+                    "302d06092a864886f70d01090831201e" +
+                    "1e005400680069007300490073004d00" +
+                    "790041006400640072006500730073");
+                put("unstructuredAddress as Multi-Valued",
+                    "303306092a864886f70d01090831260c" +
+                    "13546869734973416c736f4d79416464" +
+                    "72657373130f5468697349734d794164" +
+                    "6472657373");
+
+                // Signing Time
+                put("signingTime as UTCTime",
+                    "301c06092a864886f70d010905310f17" +
+                    "0d3635303533313132303030305a");
+                put("signingTime as GeneralizedTime",
+                    "301e06092a864886f70d010905311118" +
+                    "0f32303530303533313132303030305a");
+            }};
+
+    static final Map<String, String> TEST_INPUT_BAD =
+            new LinkedHashMap<String, String>() {{
+
+                // Challenge Password
+                put("challengePasssword as IA5String",
+                    "301e06092a864886f70d010907311116" +
+                    "0f5468697349734150617373776f7264");
+                put("challengePassword as Multi-Valued",
+                    "303306092a864886f70d01090731260c" +
+                    "13546869734973416c736f4150617373" +
+                    "776f7264130f54686973497341506173" +
+                    "73776f7264");
+
+                // Unstructured Name
+                put("unstructuredName as UTCTime",
+                    "301c06092a864886f70d010902310f17" +
+                    "0d3635303533313132303030305a");
+
+                // Unstructured Address
+                put("unstructuredAddress as IA5String",
+                    "301e06092a864886f70d010908311116" +
+                    "0f5468697349734d7941646472657373");
+
+                // Signing Time
+                put("signingTime as Multi-Valued",
+                    "302b06092a864886f70d010905311e17" +
+                    "0d3230303432383035303030305a170d" +
+                    "3635303533313132303030305a");              // DKN
+            }};
+
+    public static void main(String[] args) throws Exception {
+        int failedTests = 0;
+
+        for (Map.Entry<String, String> entry : TEST_INPUT_GOOD.entrySet()) {
+            try {
+                System.out.print("Test - " + entry.getKey() + ": ");
+
+                // Decode each Base64 test vector into DER and place into
+                // a DerValue object to be consumed by PKCS9Attribute.
+                PKCS9Attribute p9Attr = new PKCS9Attribute(
+                        new DerValue(Utils.toByteArray(entry.getValue())));
+                System.out.println("PASS");
+                System.out.println("---------------");
+                System.out.println(p9Attr);
+                System.out.println("---------------");
+            } catch (IOException ioe) {
+                failedTests++;
+                System.out.println("FAIL:");
+                ioe.printStackTrace(System.out);
+                System.out.println();
+            }
+        }
+
+        for (Map.Entry<String, String> entry : TEST_INPUT_BAD.entrySet()) {
+            try {
+                System.out.print("Test - " + entry.getKey() + ": ");
+
+                // Decode each Base64 test vector into DER and place into
+                // a DerValue object to be consumed by PKCS9Attribute.
+                PKCS9Attribute p9Attr = new PKCS9Attribute(
+                        new DerValue(
+                            Base64.getMimeDecoder().decode(entry.getValue())));
+                failedTests++;
+                System.out.println("FAIL: Expected IOException did not occur");
+            } catch (IOException ioe) {
+                System.out.println("PASS\n" + ioe);
+            }
+
+        }
+
+        if (failedTests > 0) {
+            throw new RuntimeException(
+                    "One or more test cases failed, see output");
+        }
+    }
+}
diff --git a/test/jdk/sun/security/tools/keytool/WeakAlg.java b/test/jdk/sun/security/tools/keytool/WeakAlg.java
index 39c3d7c666d..30c95e311a9 100644
--- a/test/jdk/sun/security/tools/keytool/WeakAlg.java
+++ b/test/jdk/sun/security/tools/keytool/WeakAlg.java
@@ -259,8 +259,8 @@ static void jksTypeCheck() throws Exception {
                 .shouldContain("JKS keystore uses a proprietary format");
         kt("-exportcert -alias a -file a.crt")
                 .shouldContain("JKS keystore uses a proprietary format");
-        kt("-printcert -file a.crt") // no warning if keystore not touched
-                .shouldNotContain("Warning:");
+        kt("-printcert -file a.crt") // warning since -keystore option is supported
+                .shouldContain("JKS keystore uses a proprietary format");
         kt("-certreq -alias a -file a.req")
                 .shouldContain("JKS keystore uses a proprietary format");
         kt("-printcertreq -file a.req") // no warning if keystore not touched
@@ -283,8 +283,8 @@ static void jksTypeCheck() throws Exception {
                 .shouldContain("JCEKS keystore uses a proprietary format");
         kt("-exportcert -alias a -file a.crt")
                 .shouldContain("JCEKS keystore uses a proprietary format");
-        kt("-printcert -file a.crt")
-                .shouldNotContain("Warning:");
+        kt("-printcert -file a.crt") // warning since -keystore option is supported
+                .shouldContain("JCEKS keystore uses a proprietary format");
         kt("-certreq -alias a -file a.req")
                 .shouldContain("JCEKS keystore uses a proprietary format");
         kt("-printcertreq -file a.req")
diff --git a/test/jdk/sun/security/tools/keytool/fakecacerts/MyOwnCacerts.java b/test/jdk/sun/security/tools/keytool/fakecacerts/MyOwnCacerts.java
new file mode 100644
index 00000000000..97b67650a7e
--- /dev/null
+++ b/test/jdk/sun/security/tools/keytool/fakecacerts/MyOwnCacerts.java
@@ -0,0 +1,65 @@
+/*
+ * 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
+ * @bug 8244148
+ * @library /test/lib
+ * @library /test/jdk/sun/security/util/module_patch
+ * @build java.base/sun.security.util.FilePaths
+ * @modules java.base/jdk.internal.misc
+ * @run main MyOwnCacerts
+ */
+
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class MyOwnCacerts {
+
+    // The --patch-module must be explicitly specified on the keytool
+    // command line because it's in a separate process
+    private static final String PATCH_OPTION;
+
+    static {
+        String tmp = "";
+        for (String a : jdk.internal.misc.VM.getRuntimeArguments()) {
+            if (a.startsWith("--patch-module")) {
+                tmp = "-J" + a + " ";
+                break;
+            }
+        }
+        PATCH_OPTION = tmp;
+    }
+
+    public static void main(String[] args) throws Exception {
+        kt("-keystore mycacerts -genkeypair -alias a" +
+                " -dname CN=root -keyalg EC -storepass changeit")
+                .shouldContain("Warning: use -cacerts option");
+        kt("-list -cacerts -storepass changeit")
+                .shouldContain("Your keystore contains 1 entry");
+    }
+
+    static OutputAnalyzer kt(String s) throws Exception {
+        return SecurityTools.keytool(PATCH_OPTION + s);
+    }
+}
diff --git a/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCRL.java b/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCRL.java
new file mode 100644
index 00000000000..a71d8c95076
--- /dev/null
+++ b/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCRL.java
@@ -0,0 +1,101 @@
+/*
+ * 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
+ * @bug 8244148
+ * @summary Test keytool -printcrl with -keystore and -trustcacerts options
+ * @library /test/lib
+ * @library /test/jdk/sun/security/util/module_patch
+ * @build java.base/sun.security.util.FilePaths
+ * @modules java.base/sun.security.util
+ *          java.base/jdk.internal.misc
+ * @run main TrustedCRL
+ */
+
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.security.KeyStoreUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class TrustedCRL {
+
+    // The --patch-module must be explicitly specified on the keytool
+    // command line because it's in a separate process
+    private static final String PATCH_OPTION;
+
+    static {
+        String tmp = "";
+        for (String a : jdk.internal.misc.VM.getRuntimeArguments()) {
+            if (a.startsWith("--patch-module")) {
+                tmp = "-J" + a + " ";
+                break;
+            }
+        }
+        PATCH_OPTION = tmp;
+    }
+
+    static OutputAnalyzer kt(String cmd) throws Exception {
+        return SecurityTools.keytool(cmd + " -keystore ks"
+                + " -storepass changeit")
+                .shouldHaveExitValue(0);
+    }
+
+    static OutputAnalyzer patchcmd(String cmd, String options)
+            throws Exception {
+        return kt(PATCH_OPTION + " -" + cmd + " " + options);
+    }
+
+    static void rm(String s) throws IOException {
+        System.out.println("---------------------------------------------");
+        System.out.println("$ rm " + s);
+        Files.deleteIfExists(Paths.get(s));
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        // Test -printcrl with root CA in cacerts keystore
+        kt("-genkeypair -alias myca -dname CN=CA -keyalg RSA"
+                + " -keysize 1024 -sigalg SHA1withRSA");
+
+        kt("-exportcert -alias myca -rfc -file ca.pem");
+
+        // import root CA to mycacerts keystore
+        KeyStoreUtils.createCacerts("mycacerts", "ca.pem");
+
+        kt("-gencrl -alias myca -id 0 -file ca.crl -sigalg MD5withRSA");
+
+        patchcmd("printcrl", "-file ca.crl -trustcacerts")
+                .shouldMatch("Verified by.*in cacerts");
+
+        // Test -printcrl with root CA in local keystore
+        kt("-gencrl -alias myca -id 0 -file ca.crl");
+
+        kt("-printcrl -file ca.crl")
+                .shouldMatch("Verified by.*in keystore");
+    }
+}
diff --git a/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCert.java b/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCert.java
new file mode 100644
index 00000000000..c90b3f37eaa
--- /dev/null
+++ b/test/jdk/sun/security/tools/keytool/fakecacerts/TrustedCert.java
@@ -0,0 +1,161 @@
+/*
+ * 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
+ * @bug 8244148
+ * @summary Test keytool -printcert with -keystore and -trustcacerts options
+ * @library /test/lib
+ * @library /test/jdk/sun/security/util/module_patch
+ * @build java.base/sun.security.util.FilePaths
+ * @modules java.base/sun.security.util
+ *          java.base/jdk.internal.misc
+ * @run main TrustedCert
+ */
+
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.security.KeyStoreUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class TrustedCert {
+
+    // The --patch-module must be explicitly specified on the keytool
+    // command line because it's in a separate process
+    private static final String PATCH_OPTION;
+
+    static {
+        String tmp = "";
+        for (String a : jdk.internal.misc.VM.getRuntimeArguments()) {
+            if (a.startsWith("--patch-module")) {
+                tmp = "-J" + a + " ";
+                break;
+            }
+        }
+        PATCH_OPTION = tmp;
+    }
+
+    static OutputAnalyzer kt(String cmd, String ks) throws Exception {
+        return SecurityTools.keytool(cmd + " -keystore " + ks
+                + " -storepass changeit")
+                .shouldHaveExitValue(0);
+    }
+
+    static OutputAnalyzer kt1(String cmd, String ks) throws Exception {
+        return SecurityTools.keytool(cmd + " -keystore " + ks
+                + " -storepass changeit")
+                .shouldNotHaveExitValue(0);
+    }
+
+    static OutputAnalyzer patchcmd(String cmd, String options, String ks,
+            boolean nonzero) throws Exception {
+        if (nonzero) {
+            return kt1(PATCH_OPTION + " -" + cmd + " " + options, ks);
+        } else {
+            return kt(PATCH_OPTION + " -" + cmd + " " + options, ks);
+        }
+    }
+
+    static void rm(String s) throws IOException {
+        System.out.println("---------------------------------------------");
+        System.out.println("$ rm " + s);
+        Files.deleteIfExists(Paths.get(s));
+    }
+
+    private static void cat(String dest, String... src) throws IOException {
+        System.out.println("---------------------------------------------");
+        System.out.printf("$ cat ");
+
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        for (String s : src) {
+            System.out.printf(s + " ");
+            bout.write(Files.readAllBytes(Paths.get(s)));
+        }
+        Files.write(Paths.get(dest), bout.toByteArray());
+        System.out.println("> " + dest);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        // Test -printcert with root CA in local keystore
+        kt("-genkeypair -keyalg rsa -keysize 1024 -sigalg SHA1withRSA " +
+                "-dname CN=ROOT -ext bc:c", "root.jks");
+        kt("-genkeypair -keyalg RSA -dname CN=CA -ext bc:c", "ca.jks");
+        kt("-genkeypair -keyalg RSA -dname CN=SERVER", "server.jks");
+
+        kt("-exportcert -rfc -file root.pem", "root.jks");
+        kt("-importcert -alias root -file root.pem -noprompt", "ca.jks");
+        kt("-importcert -alias root -file root.pem -noprompt", "server.jks");
+
+        kt("-certreq -file ca.req", "ca.jks");
+        kt("-gencert -ext BC=0 -rfc -infile ca.req -outfile ca.pem", "root.jks");
+        kt("-importcert -file ca.pem", "ca.jks");
+
+        kt("-certreq -file server.req", "server.jks");
+        kt("-gencert -ext ku:c=dig,keyEncipherment -rfc -infile server.req " +
+                "-outfile server.pem", "ca.jks");
+        kt("-importcert -file server.pem", "server.jks");
+
+        cat("fullchain.pem", "server.pem", "root.pem");
+        kt("-printcert -file fullchain.pem ", "server.jks")
+                .shouldNotMatch("SHA1withRSA signature algorithm.*security risk")
+                .shouldMatch("1024-bit RSA key.*security risk");
+
+        rm("ca.jks");
+        rm("server.jks");
+        rm("mycacerts");
+
+        // Test -printcert with root CA in cacerts keystore
+        kt("-genkeypair -keyalg RSA -dname CN=CA -ext bc:c", "ca.jks");
+        kt("-genkeypair -keyalg RSA -dname CN=SERVER", "server.jks");
+
+        // import root CA to mycacerts keystore
+        KeyStoreUtils.createCacerts("mycacerts", "root.pem");
+
+        kt("-certreq -file ca.req", "ca.jks");
+        kt("-gencert -ext BC=0 -rfc -infile ca.req -outfile ca.pem", "root.jks");
+
+        patchcmd("importcert", "-file ca.pem", "ca.jks", true);
+        patchcmd("importcert", "-file ca.pem -trustcacerts", "ca.jks", false);
+
+        kt("-certreq -file server.req", "server.jks");
+        kt("-gencert -ext ku:c=dig,keyEncipherment -rfc -infile server.req " +
+                "-outfile server.pem", "ca.jks");
+        kt("-importcert -file server.pem -noprompt", "server.jks");
+
+        cat("fullchain.pem", "server.pem", "root.pem");
+
+        patchcmd("-printcert", "-file fullchain.pem -trustcacerts", "server.jks", false)
+                .shouldNotMatch("SHA1withRSA signature algorithm.*security risk")
+                .shouldMatch("1024-bit RSA key.*security risk");
+
+        patchcmd("-printcert", "-file fullchain.pem", "server.jks", false)
+                .shouldMatch("SHA1withRSA signature algorithm.*security risk")
+                .shouldMatch("1024-bit RSA key.*security risk");
+    }
+}
diff --git a/test/jdk/sun/security/util/module_patch/java.base/sun/security/util/FilePaths.java b/test/jdk/sun/security/util/module_patch/java.base/sun/security/util/FilePaths.java
new file mode 100644
index 00000000000..7743ddd7bbb
--- /dev/null
+++ b/test/jdk/sun/security/util/module_patch/java.base/sun/security/util/FilePaths.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package sun.security.util;
+
+import jdk.internal.util.StaticProperty;
+
+import java.io.File;
+
+// This is a patched version
+public class FilePaths {
+    public static String cacerts() {
+        return System.getProperty("test.cacerts", "mycacerts");
+    }
+}
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java
index 9bfe714c848..ee28452c500 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/AdditionalLauncher.java
@@ -25,7 +25,11 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.function.BiConsumer;
 import java.util.stream.Stream;
 import jdk.jpackage.test.Functional.ThrowingBiConsumer;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java
index 84e8d49a3c7..bf532274381 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java
@@ -30,7 +30,13 @@
 import java.io.PrintStream;
 import java.io.StringReader;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
 import java.util.regex.Pattern;
 import java.util.spi.ToolProvider;
 import java.util.stream.Collectors;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java
index 4bd993ee466..eb1a0675646 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Functional.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,11 @@
 package jdk.jpackage.test;
 
 import java.lang.reflect.InvocationTargetException;
-import java.util.function.*;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
 
 
 public class Functional {
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java
index c11f0356e69..745922d4111 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java
@@ -26,7 +26,13 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Supplier;
 import java.util.regex.Matcher;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java
index 58407fd8279..a607d15cbd2 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java
@@ -30,7 +30,15 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.security.SecureRandom;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Predicate;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JarBuilder.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JarBuilder.java
index 0e744a9b536..d62575d2fef 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JarBuilder.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JarBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,8 @@
 
 package jdk.jpackage.test;
 
-import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
index a88b6401c68..5f09859062b 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
@@ -48,7 +48,6 @@
 import jdk.jpackage.test.Functional.ThrowingBiConsumer;
 import jdk.jpackage.test.Functional.ThrowingConsumer;
 import jdk.jpackage.test.Functional.ThrowingRunnable;
-import jdk.jpackage.test.Functional.ThrowingSupplier;
 
 
 
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
index 799286188f4..1e6aa1f8f3b 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
@@ -29,10 +29,25 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.lang.reflect.InvocationTargetException;
-import java.nio.file.*;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardWatchEventKinds;
+import java.nio.file.StandardCopyOption;
 import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
 import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
-import java.util.*;
+import java.nio.file.WatchEvent;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.BiPredicate;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java
index 612df143d8e..27da5a0a28c 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,14 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
 import java.util.function.Function;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java
index 90297d4552e..105c8f707cd 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TestInstance.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,13 @@
 import java.lang.reflect.Method;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java
index 9ca4800a471..329627307ea 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java
@@ -25,7 +25,11 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.function.BiConsumer;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ApplicationLayoutTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ApplicationLayoutTest.java
index 584c09e89ff..7ef0a4d15bd 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ApplicationLayoutTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ApplicationLayoutTest.java
@@ -30,7 +30,7 @@
 import org.junit.Test;
 import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 
 public class ApplicationLayoutTest {
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/CompareDottedVersionTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/CompareDottedVersionTest.java
index e72e77c1f5a..283bbe26fea 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/CompareDottedVersionTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/CompareDottedVersionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 @RunWith(Parameterized.class)
 public class CompareDottedVersionTest {
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/DottedVersionTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/DottedVersionTest.java
index 86c2a5b7e90..d6ace3d88b1 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/DottedVersionTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/DottedVersionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,8 @@
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/OverridableResourceTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/OverridableResourceTest.java
index 4185206fedc..5a9041796b2 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/OverridableResourceTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/OverridableResourceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,8 @@
  */
 package jdk.incubator.jpackage.internal;
 
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -35,7 +36,11 @@
 import jdk.incubator.jpackage.internal.resources.ResourceLocator;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PathGroupTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PathGroupTest.java
index 9ae87d947b3..dbd0fd84b45 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PathGroupTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PathGroupTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,15 +27,22 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 import java.util.function.Consumer;
-import java.util.function.Predicate;
 import java.util.function.UnaryOperator;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertThat;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PlatformVersionTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PlatformVersionTest.java
index 773fa487865..2780d69b8b8 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PlatformVersionTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/PlatformVersionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,11 @@
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.lang.reflect.Method;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
diff --git a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ToolValidatorTest.java b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ToolValidatorTest.java
index c36cfdfdf02..adb579b929d 100644
--- a/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ToolValidatorTest.java
+++ b/test/jdk/tools/jpackage/junit/jdk/incubator/jpackage/internal/ToolValidatorTest.java
@@ -27,7 +27,9 @@
 import java.nio.file.Path;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 import org.junit.Test;
 
 
diff --git a/test/jdk/tools/jpackage/linux/ShortcutHintTest.java b/test/jdk/tools/jpackage/linux/ShortcutHintTest.java
index b7b125262f8..3715d98fc96 100644
--- a/test/jdk/tools/jpackage/linux/ShortcutHintTest.java
+++ b/test/jdk/tools/jpackage/linux/ShortcutHintTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 
 import java.io.IOException;
 import java.nio.file.Files;
-import java.util.Map;
 import java.nio.file.Path;
 import java.util.List;
 import jdk.jpackage.test.AdditionalLauncher;
@@ -31,8 +30,9 @@
 import jdk.jpackage.test.PackageType;
 import jdk.jpackage.test.PackageTest;
 import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.LinuxHelper;
 import jdk.jpackage.test.Annotations.Test;
-import jdk.jpackage.test.*;
 
 /**
  * Test --linux-shortcut parameter. Output of the test should be
diff --git a/test/jdk/tools/jpackage/macosx/SigningPackageTest.java b/test/jdk/tools/jpackage/macosx/SigningPackageTest.java
index 79b52f3ef2a..af7981a291b 100644
--- a/test/jdk/tools/jpackage/macosx/SigningPackageTest.java
+++ b/test/jdk/tools/jpackage/macosx/SigningPackageTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,11 @@
  */
 
 import java.nio.file.Path;
-import java.nio.file.Paths;
-import jdk.jpackage.test.*;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.MacHelper;
+import jdk.jpackage.test.TKit;
 
 /**
  * Tests generation of dmg and pkg with --mac-sign and related arguments.
diff --git a/test/jdk/tools/jpackage/share/AddLauncherTest.java b/test/jdk/tools/jpackage/share/AddLauncherTest.java
index 448514df246..431f1a2b764 100644
--- a/test/jdk/tools/jpackage/share/AddLauncherTest.java
+++ b/test/jdk/tools/jpackage/share/AddLauncherTest.java
@@ -22,13 +22,16 @@
  */
 
 import java.nio.file.Path;
-import java.util.HashMap;
 import java.util.Map;
-import java.util.List;
-import java.util.Optional;
 import java.lang.invoke.MethodHandles;
-import jdk.jpackage.test.*;
-import jdk.jpackage.test.Annotations.*;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.FileAssociations;
+import jdk.jpackage.test.AdditionalLauncher;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.JavaAppDesc;
+import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.Annotations.Test;
+import jdk.jpackage.test.Annotations.Parameter;
 
 /**
  * Test --add-launcher parameter. Output of the test should be
diff --git a/test/jdk/tools/jpackage/share/ArgumentsTest.java b/test/jdk/tools/jpackage/share/ArgumentsTest.java
index c4f8205b7e3..1cc6f715317 100644
--- a/test/jdk/tools/jpackage/share/ArgumentsTest.java
+++ b/test/jdk/tools/jpackage/share/ArgumentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,12 @@
 
 import java.nio.file.Path;
 import java.util.List;
-import jdk.jpackage.test.TKit;
 import jdk.jpackage.test.HelloApp;
 import jdk.jpackage.test.Functional.ThrowingConsumer;
 import jdk.jpackage.test.JPackageCommand;
-import jdk.jpackage.test.Annotations.*;
+import jdk.jpackage.test.Annotations.BeforeEach;
+import jdk.jpackage.test.Annotations.Test;
+import jdk.jpackage.test.Annotations.Parameter;
 
 
 /*
diff --git a/test/jdk/tools/jpackage/share/IconTest.java b/test/jdk/tools/jpackage/share/IconTest.java
index 547afe251c3..eeb138ef5f2 100644
--- a/test/jdk/tools/jpackage/share/IconTest.java
+++ b/test/jdk/tools/jpackage/share/IconTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,17 +22,29 @@
  */
 
 import java.io.IOException;
-import java.util.*;
 import java.util.stream.Stream;
 import java.util.stream.Collectors;
 import java.util.function.Consumer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
-import jdk.jpackage.test.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.LauncherIconVerifier;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.Executor;
+import jdk.jpackage.test.LinuxHelper;
+import jdk.jpackage.test.AdditionalLauncher;
 import jdk.jpackage.test.Functional.ThrowingConsumer;
 import jdk.jpackage.test.Functional.ThrowingBiConsumer;
-import jdk.jpackage.test.Annotations.*;
+import jdk.jpackage.test.Annotations.Parameters;
+import jdk.jpackage.test.Annotations.Test;
 
 /*
  * @test
diff --git a/test/jdk/tools/jpackage/share/InstallDirTest.java b/test/jdk/tools/jpackage/share/InstallDirTest.java
index 41ab9c28721..e49132d25b5 100644
--- a/test/jdk/tools/jpackage/share/InstallDirTest.java
+++ b/test/jdk/tools/jpackage/share/InstallDirTest.java
@@ -24,12 +24,10 @@
 import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.function.Supplier;
 import jdk.jpackage.test.TKit;
 import jdk.jpackage.test.PackageTest;
 import jdk.jpackage.test.PackageType;
 import jdk.jpackage.test.Functional;
-import jdk.jpackage.test.JPackageCommand;
 import jdk.jpackage.test.Annotations.Parameter;
 
 /**
diff --git a/test/jdk/tools/jpackage/share/LicenseTest.java b/test/jdk/tools/jpackage/share/LicenseTest.java
index fadfe59ad1e..ed8c86c99c7 100644
--- a/test/jdk/tools/jpackage/share/LicenseTest.java
+++ b/test/jdk/tools/jpackage/share/LicenseTest.java
@@ -24,7 +24,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Arrays;
diff --git a/test/jdk/tools/jpackage/share/RuntimePackageTest.java b/test/jdk/tools/jpackage/share/RuntimePackageTest.java
index 058cb0cccc2..94ecb12c846 100644
--- a/test/jdk/tools/jpackage/share/RuntimePackageTest.java
+++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java
@@ -28,7 +28,10 @@
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
-import jdk.jpackage.test.*;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.TKit;
 import jdk.jpackage.test.Annotations.Test;
 
 /**
diff --git a/test/jdk/tools/jpackage/share/SimplePackageTest.java b/test/jdk/tools/jpackage/share/SimplePackageTest.java
index a076828e0bc..aaf2c7e2caf 100644
--- a/test/jdk/tools/jpackage/share/SimplePackageTest.java
+++ b/test/jdk/tools/jpackage/share/SimplePackageTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import jdk.jpackage.test.TKit;
 import jdk.jpackage.test.PackageTest;
 import jdk.jpackage.test.Annotations.Test;
 
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java
index d6509dd9393..718c6d6982b 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java
@@ -32,11 +32,16 @@
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import jdk.jpackage.test.*;
-import jdk.jpackage.test.Functional.ThrowingConsumer;
-import jdk.jpackage.test.Annotations.*;
+import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.JavaAppDesc;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.HelloApp;
+import jdk.jpackage.test.Executor;
+import jdk.jpackage.test.JavaTool;
+import jdk.jpackage.test.Annotations.Test;
+import jdk.jpackage.test.Annotations.Parameter;
 
 /*
  * @test
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java
index 354036b6a37..36cf5e3ed3e 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java
@@ -28,7 +28,6 @@
 import jdk.jpackage.test.Annotations.Parameters;
 import jdk.jpackage.test.Annotations.Test;
 import jdk.jpackage.test.JPackageCommand;
-import jdk.jpackage.test.CfgFile;
 import jdk.jpackage.test.TKit;
 
 /*
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsTest.java
index 0951d826ff3..069ec10f3c1 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsTest.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/JavaOptionsTest.java
@@ -30,7 +30,6 @@
 import jdk.jpackage.test.Annotations.Test;
 import jdk.jpackage.test.JPackageCommand;
 import jdk.jpackage.test.HelloApp;
-import jdk.jpackage.test.Executor;
 import jdk.jpackage.test.TKit;
 
 /*
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java
index c11a234485c..bf0a6e34c06 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/MainClassTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,9 +36,14 @@
 import java.nio.file.Path;
 import java.util.function.Predicate;
 import java.util.jar.JarEntry;
+import jdk.jpackage.test.JavaAppDesc;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.Executor;
+import jdk.jpackage.test.HelloApp;
+import jdk.jpackage.test.JavaTool;
 import jdk.jpackage.test.Annotations.Parameters;
 import jdk.jpackage.test.Annotations.Test;
-import jdk.jpackage.test.*;
 import jdk.jpackage.test.Functional.ThrowingConsumer;
 import static jdk.jpackage.tests.MainClassTest.Script.MainClassType.*;
 
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest.java
index 13d161d51b0..77fa37ead72 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest.java
@@ -28,12 +28,17 @@
 import java.nio.file.Path;
 import java.util.Collection;
 import java.util.List;
-import java.util.Objects;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import jdk.jpackage.test.Annotations.*;
-import jdk.jpackage.test.*;
+import jdk.jpackage.test.TKit;
+import jdk.jpackage.test.JavaAppDesc;
+import jdk.jpackage.test.HelloApp;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.Annotations.Parameter;
+import jdk.jpackage.test.Annotations.Parameters;
+import jdk.jpackage.test.Annotations.Test;
 
 
 /*
diff --git a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest2.java b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest2.java
index 5666268aab0..ef1bc9d4b1a 100644
--- a/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest2.java
+++ b/test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 
 import java.io.IOException;
 import java.nio.file.Path;
-import java.util.stream.Stream;
-import jdk.jpackage.test.Functional.ThrowingSupplier;
 import jdk.jpackage.test.HelloApp;
 import jdk.jpackage.test.JavaAppDesc;
 import jdk.jpackage.test.Annotations.Test;
diff --git a/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java b/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java
index f343c74b9e2..6667ba401de 100644
--- a/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java
+++ b/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import jdk.jpackage.test.TKit;
 import jdk.jpackage.test.PackageTest;
 import jdk.jpackage.test.PackageType;
 import jdk.jpackage.test.Annotations.Test;
diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt
index 35edcf1ee4d..38aa386de32 100644
--- a/test/langtools/ProblemList.txt
+++ b/test/langtools/ProblemList.txt
@@ -26,7 +26,6 @@
 ###########################################################################
 #
 # javadoc
-jdk/javadoc/doclet/testIOException/TestIOException.java                         8164597    windows-all
 
 ###########################################################################
 #
diff --git a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java
index 05a437a0286..81732538029 100644
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java
+++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug      4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332
- *           8169819 8074407 8191030 8182765 8184205
+ *           8169819 8074407 8191030 8182765 8184205 8243533
  * @summary  test generated docs for deprecated items
  * @library  ../../lib
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -164,9 +164,28 @@ public class <span class="type-name-label">TestClass</span>
                     </td>""",
                 """
                     <td class="col-last">
-                    <div class="block"><span class="deprecated-label">Deprecated.</span>
+                    <div class="block"><span class="deprecated-label">Deprecated, for removal: This \
+                    API element is subject to removal in a future version.</span>
                     <div class="deprecation-comment">class_test4 passes.</div>
                     </div>
+                    </td>""",
+                """
+                    <td class="col-last">
+                    <div class="block"><span class="deprecated-label">Deprecated.</span>
+                    <div class="deprecation-comment">class_test5 passes.</div>
+                    </div>
+                    </td>""",
+                """
+                    <td class="col-last">
+                    <div class="block"><span class="deprecated-label">Deprecated.</span>
+                    <div class="deprecation-comment">class_test6 passes.</div>
+                    </div>
+                    </td>""",
+                """
+                    <td class="col-last">
+                    <div class="block"><span class="deprecated-label">Deprecated.</span>
+                    <div class="deprecation-comment">class_test7 passes.</div>
+                    </div>
                     </td>""");
 
         checkOutput("pkg/TestClass.html", false,
@@ -355,6 +374,78 @@ public class <span class="type-name-label">TestInterface</span>
                     </tr>
                     </tbody>
                     </table>
-                    </div>""");
+                    </div>""",
+                """
+                    <div class="deprecated-summary" id="method">
+                    <table class="summary-table">
+                    <caption><span>Methods</span></caption>
+                    <thead>
+                    <tr>
+                    <th class="col-first" scope="col">Method</th>
+                    <th class="col-last" scope="col">Description</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr class="alt-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/DeprecatedClassByAnnotation.html#method()">pkg.DeprecatedClassByAnnotation.method()</a></th>
+                    <td class="col-last"></td>
+                    </tr>
+                    <tr class="row-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestAnnotationType.html#optional()">pkg.TestAnnotationType.optional()</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">annotation_test2 passes.</div>
+                    </td>
+                    </tr>
+                    <tr class="alt-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestAnnotationType.html#required()">pkg.TestAnnotationType.required()</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">annotation_test3 passes.</div>
+                    </td>
+                    </tr>
+                    <tr class="row-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestClass.html#method()">pkg.TestClass.method()</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">class_test5 passes. This is the second sentence of deprecated description for a method.</div>
+                    </td>
+                    </tr>
+                    <tr class="alt-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestClass.html#overloadedMethod(int)">pkg.TestClass.overloadedMethod&#8203;(int)</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">class_test7 passes. Overloaded method 2.</div>
+                    </td>
+                    </tr>
+                    <tr class="row-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestClass.html#overloadedMethod(java.lang.String)">pkg.TestClass.overloadedMethod&#8203;(String)</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">class_test6 passes. Overloaded method 1.</div>
+                    </td>
+                    </tr>""",
+                """
+                    <div class="deprecated-summary" id="constructor">
+                    <table class="summary-table">
+                    <caption><span>Constructors</span></caption>
+                    <thead>
+                    <tr>
+                    <th class="col-first" scope="col">Constructor</th>
+                    <th class="col-last" scope="col">Description</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr class="alt-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/DeprecatedClassByAnnotation.html#%3Cinit%3E()">pkg.DeprecatedClassByAnnotation()</a></th>
+                    <td class="col-last"></td>
+                    </tr>
+                    <tr class="row-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestClass.html#%3Cinit%3E()">pkg.TestClass()</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">class_test3 passes. This is the second sentence of deprecated description for a constructor.</div>
+                    </td>
+                    </tr>
+                    <tr class="alt-color">
+                    <th class="col-deprecated-item-name" scope="row"><a href="pkg/TestClass.html#%3Cinit%3E(java.lang.String)">pkg.TestClass&#8203;(String)</a></th>
+                    <td class="col-last">
+                    <div class="deprecation-comment">class_test4 passes. Overloaded constructor.</div>
+                    </td>
+                    </tr>""");
     }
 }
diff --git a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java
index 0fb178252ce..82f7ab2e81f 100644
--- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java
+++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/pkg/TestClass.java
@@ -41,7 +41,23 @@ public class TestClass {
     public TestClass() {}
 
     /**
-     * @deprecated class_test4 passes. This is the second sentence of deprecated description for a method.
+     * @deprecated class_test4 passes. Overloaded constructor.
+     */
+    @Deprecated(forRemoval=true)
+    public TestClass(String s) {}
+
+    /**
+     * @deprecated class_test5 passes. This is the second sentence of deprecated description for a method.
      */
     public void method() {}
+
+    /**
+     * @deprecated class_test6 passes. Overloaded method 1.
+     */
+    public void overloadedMethod(String s) {}
+
+    /**
+     * @deprecated class_test7 passes. Overloaded method 2.
+     */
+    public void overloadedMethod(int i) {}
 }
diff --git a/test/langtools/jdk/javadoc/doclet/testHelpPage/TestHelpPage.java b/test/langtools/jdk/javadoc/doclet/testHelpPage/TestHelpPage.java
new file mode 100644
index 00000000000..a3ee65ac70d
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testHelpPage/TestHelpPage.java
@@ -0,0 +1,98 @@
+/*
+ * 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
+ * @bug 8246078
+ * @library ../../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build javadoc.tester.*
+ * @run main TestHelpPage
+ */
+
+import javadoc.tester.JavadocTester;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class TestHelpPage extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestHelpPage tester = new TestHelpPage();
+        tester.runTests();
+    }
+
+    @Test
+    public void test() {
+
+        setOutputDirectoryCheck(DirectoryCheck.NONE);
+        setAutomaticCheckLinks(false);
+        setAutomaticCheckAccessibility(false);
+
+        javadoc("--version");
+        List<String> lines = getOutputLines(Output.OUT);
+        System.out.println("lines: " + Arrays.toString(lines.toArray()));
+        String firstLine = lines.get(0);
+        Matcher m = Pattern.compile("javadoc\\s+(.*)").matcher(firstLine);
+        m.matches();
+        String vstr = m.group(1);
+        System.out.printf("vstr='%s'%n", vstr);
+        Runtime.Version v = Runtime.Version.parse(vstr);
+        System.out.printf("v=%s, v.feature()=%s%n", v, v.feature());
+
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                testSrc("TestHelpPage.java"));
+        checkExit(Exit.OK);
+
+        checking("Reference to a particular version");
+        Pattern searchSpecLink = Pattern.compile(
+                "\\Q<a href=\"https://docs.oracle.com/en/java/javase/\\E(\\d+)\\Q/docs/specs/javadoc/javadoc-search-spec.html\">\\E");
+
+        String helpContents = readOutputFile("help-doc.html");
+        Matcher m2 = searchSpecLink.matcher(helpContents);
+        if (!m2.find()) {
+            failed("Reference not found: " + helpContents);
+            return;
+        }
+
+        if (!String.valueOf(v.feature()).equals(m2.group(1))) {
+            failed("Reference to a wrong version: " + m2.group(1));
+            return;
+        }
+
+        boolean foundMore = false;
+        while (m2.find()) {
+            // print all found before failing
+            foundMore = true;
+            System.out.println(m2.group(0));
+        }
+        if (foundMore) {
+            failed("Multiple references: " + helpContents);
+        } else {
+            passed("All good");
+        }
+    }
+}
diff --git a/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java b/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java
index 73bcb7ec924..aea2233e4d2 100644
--- a/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java
+++ b/test/langtools/jdk/javadoc/doclet/testIOException/TestIOException.java
@@ -33,9 +33,19 @@
 
 import java.io.File;
 import java.io.FileWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Locale;
+import java.util.Map;
 
 import javadoc.tester.JavadocTester;
 
+/**
+ * Tests IO Exception handling.
+ *
+ * Update: Windows does not permit setting folder to be readonly.
+ * https://support.microsoft.com/en-us/help/326549/you-cannot-view-or-change-the-read-only-or-the-system-attributes-of-fo
+ */
 public class TestIOException extends JavadocTester {
 
     public static void main(String... args) throws Exception {
@@ -43,21 +53,29 @@ public static void main(String... args) throws Exception {
         tester.runTests();
     }
 
+    /**
+     * Tests a read-only directory.
+     * On Windows, this test may be skipped.
+     */
     @Test
     public void testReadOnlyDirectory() {
         File outDir = new File("out1");
         if (!outDir.mkdir()) {
-            throw new Error("Cannot create directory");
+            throw error(outDir, "Cannot create directory");
         }
         if (!outDir.setReadOnly()) {
-            throw new Error("could not set directory read-only");
+            if (skip(outDir)) {
+                return;
+            }
+            throw error(outDir, "could not set directory read-only");
         }
         if (outDir.canWrite()) {
-            throw new Error("directory is writable");
+            throw error(outDir, "directory is writable");
         }
 
         try {
             javadoc("-d", outDir.toString(),
+                    "-Xdoclint:-missing",
                     new File(testSrc, "TestIOException.java").getPath());
             checkExit(Exit.ERROR);
             checkOutput(Output.OUT, true,
@@ -67,24 +85,29 @@ public void testReadOnlyDirectory() {
         }
     }
 
+    /**
+     * Tests a read-only file.
+     * @throws Exception if an error occurred
+     */
     @Test
     public void testReadOnlyFile() throws Exception {
         File outDir = new File("out2");
         if (!outDir.mkdir()) {
-            throw new Error("Cannot create directory");
+            throw error(outDir, "Cannot create directory");
         }
         File index = new File(outDir, "index.html");
         try (FileWriter fw = new FileWriter(index)) { }
         if (!index.setReadOnly()) {
-            throw new Error("could not set index read-only");
+            throw error(index, "could not set index read-only");
         }
         if (index.canWrite()) {
-            throw new Error("index is writable");
+            throw error(index, "index is writable");
         }
 
         try {
             setOutputDirectoryCheck(DirectoryCheck.NONE);
             javadoc("-d", outDir.toString(),
+                    "-Xdoclint:-missing",
                     new File(testSrc, "TestIOException.java").getPath());
 
             checkExit(Exit.ERROR);
@@ -96,6 +119,11 @@ public void testReadOnlyFile() throws Exception {
         }
     }
 
+    /**
+     * Tests a read-only subdirectory.
+     * On Windows, this test may be skipped.
+     * @throws Exception if an error occurred
+     */
     @Test
     public void testReadOnlySubdirectory() throws Exception {
         // init source file
@@ -111,19 +139,23 @@ public void testReadOnlySubdirectory() throws Exception {
         File outDir = new File("out3");
         File pkgOutDir = new File(outDir, "p");
         if (!pkgOutDir.mkdirs()) {
-            throw new Error("Cannot create directory");
+            throw error(pkgOutDir, "Cannot create directory");
         }
         if (!pkgOutDir.setReadOnly()) {
-            throw new Error("could not set directory read-only");
+            if (skip(pkgOutDir)) {
+                return;
+            }
+            throw error(pkgOutDir, "could not set directory read-only");
         }
         if (pkgOutDir.canWrite()) {
-            throw new Error("directory is writable");
+            throw error(pkgOutDir, "directory is writable");
         }
 
         // run javadoc and check results
         try {
             setOutputDirectoryCheck(DirectoryCheck.NONE);
             javadoc("-d", outDir.toString(),
+                    "-Xdoclint:-missing",
                     src_p_C.getPath());
             checkExit(Exit.ERROR);
             checkOutput(Output.OUT, true,
@@ -134,6 +166,11 @@ public void testReadOnlySubdirectory() throws Exception {
         }
     }
 
+    /**
+     * Tests a read-only doc-files directory.
+     * On Windows, this test may be skipped.
+     * @throws Exception if an error occurred
+     */
     @Test
     public void testReadOnlyDocFilesDir() throws Exception {
         // init source files
@@ -155,18 +192,22 @@ public void testReadOnlyDocFilesDir() throws Exception {
         File pkgOutDir = new File(outDir, "p");
         File docFilesOutDir = new File(pkgOutDir, "doc-files");
         if (!docFilesOutDir.mkdirs()) {
-            throw new Error("Cannot create directory");
+            throw error(docFilesOutDir, "Cannot create directory");
         }
         if (!docFilesOutDir.setReadOnly()) {
-            throw new Error("could not set directory read-only");
+            if (skip(docFilesOutDir)) {
+                return;
+            }
+            throw error(docFilesOutDir, "could not set directory read-only");
         }
         if (docFilesOutDir.canWrite()) {
-            throw new Error("directory is writable");
+            throw error(docFilesOutDir, "directory is writable");
         }
 
         try {
             setOutputDirectoryCheck(DirectoryCheck.NONE);
             javadoc("-d", outDir.toString(),
+                    "-Xdoclint:-missing",
                     "-sourcepath", srcDir.getPath(),
                     "p");
             checkExit(Exit.ERROR);
@@ -177,5 +218,44 @@ public void testReadOnlyDocFilesDir() throws Exception {
             docFilesOutDir.setWritable(true);
         }
     }
+
+    private Error error(File f, String message) {
+        out.println(f + ": " + message);
+        showAllAttributes(f.toPath());
+        throw new Error(f + ": " + message);
+    }
+
+    private void showAllAttributes(Path p) {
+        showAttributes(p, "*");
+        showAttributes(p, "posix:*");
+        showAttributes(p, "dos:*");
+    }
+
+    private void showAttributes(Path p, String attributes) {
+        out.println("Attributes: " + attributes);
+        try {
+            Map<String, Object> map = Files.readAttributes(p, attributes);
+            map.forEach((n, v) -> out.format("  %-10s: %s%n", n, v));
+        } catch (UnsupportedOperationException e) {
+            out.println("Attributes not available " + attributes);
+        } catch (Throwable t) {
+            out.println("Error accessing attributes " + attributes + ": " + t);
+        }
+    }
+
+    private boolean skip(File dir) {
+        if (isWindows()) {
+            showAllAttributes(dir.toPath());
+            out.println("Windows: cannot set directory read only:" + dir);
+            out.println("TEST CASE SKIPPED");
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private boolean isWindows() {
+        return System.getProperty("os.name").toLowerCase(Locale.US).startsWith("windows");
+    }
 }
 
diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java
index 324f13b9d01..a416b697844 100644
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8178070 8196201 8184205 8246429
+ * @bug 8178070 8196201 8184205 8246429 8198705
  * @summary Test packages table in module summary pages
  * @library /tools/lib ../../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -167,6 +167,14 @@ public void exportSameName(Path base) throws Exception {
                     <div class="sub-title"><span class="module-label-in-type">Module</span>&nbsp;<a href="../module-summary.html">o</a></div>
                     <div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">p</a></div>
                     """);
+        checkOutput("type-search-index.js", true,
+                """
+                     {"p":"p","m":"m","l":"C"},{"p":"p","m":"o","l":"C"}""");
+        checkOutput("member-search-index.js", true,
+                """
+                     {"m":"m","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()"}""",
+                """
+                     {"m":"o","p":"p","c":"C","l":"C()","u":"%3Cinit%3E()"}""");
     }
 
     @Test
diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
index c97128c8ad9..18dd2b1c462 100644
--- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
+++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java
@@ -726,14 +726,16 @@ function getURLPrefix(ui) {
                             return ui.item.l + slash;
                         } else if (ui.item.category === catPackages && ui.item.m) {
                             return ui.item.m + slash;
-                        } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) {
-                            $.each(packageSearchIndex, function(index, item) {
-                                if (item.m && ui.item.p == item.l) {
-                                    urlPrefix = item.m + slash;
-                                }
-                            });
-                            return urlPrefix;
-                        } else {
+                        } else if (ui.item.category === catTypes || ui.item.category === catMembers) {
+                            if (ui.item.m) {
+                                urlPrefix = ui.item.m + slash;
+                            } else {
+                                $.each(packageSearchIndex, function(index, item) {
+                                    if (item.m && ui.item.p === item.l) {
+                                        urlPrefix = item.m + slash;
+                                    }
+                                });
+                            }
                             return urlPrefix;
                         }
                         return urlPrefix;
diff --git a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java
index d29adf5622d..83b70b37f86 100644
--- a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java
+++ b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug      8005091 8009686 8025633 8026567 6469562 8071982 8071984 8162363 8175200 8186332 8182765
- *           8187288
+ *           8187288 8241969
  * @summary  Make sure that type annotations are displayed correctly
  * @library  ../../lib
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -335,6 +335,35 @@ class <span class="type-name-label">ComplexBoth&lt;K extends <a href="ClassParam
                     tation in typeannos">@WldB</a>("m") java.lang.String&gt;</span>&nbsp;<span class\
                     ="member-name">returnWcExtends</span>()</div>""");
 
+        checkOutput("typeannos/SelfTest.html", true,
+                """
+                    <div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
+                    tle="class in typeannos">MyList</a>&lt;<a href="WldA.html" title="annotation in \
+                    typeannos">@WldA</a> ?&gt;</span>&nbsp;<span class="member-name">returnWcExtends\
+                    </span>()</div>""",
+                """
+                    <div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
+                    tle="class in typeannos">MyList</a>&lt;<a href="WldA.html" title="annotation in \
+                    typeannos">@WldA</a> ? extends <a href="WldA.html" title="annotation in typeanno\
+                    s">@WldA</a> <a href="MyList.html" title="class in typeannos">MyList</a>&lt;<a h\
+                    ref="WldB.html" title="annotation in typeannos">@WldB</a>("m") ?&gt;&gt;</span>&\
+                    nbsp;<span class="member-name">complex</span>()</div>""");
+
+        checkOutput("typeannos/SelfWithValue.html", true,
+                """
+                    <div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
+                    tle="class in typeannos">MyList</a>&lt;<a href="WldB.html" title="annotation in \
+                    typeannos">@WldB</a>("m") ?&gt;</span>&nbsp;<span class="member-name">returnWcEx\
+                    tends</span>()</div>""",
+                """
+                    <div class="member-signature"><span class="return-type"><a href="MyList.html" ti\
+                    tle="class in typeannos">MyList</a>&lt;<a href="WldB.html" title="annotation in \
+                    typeannos">@WldB</a>("m") ? extends <a href="MyList.html" title="class in typean\
+                    nos">MyList</a>&lt;<a href="WldB.html" title="annotation in typeannos">@WldB</a>\
+                    ("m") ? super java.lang.String&gt;&gt;</span>&nbsp;<span class="member-name">com\
+                    plex</span>()</div>""");
+
+
         // Test for receiver annotations (Receivers.java).
         checkOutput("typeannos/DefaultUnmodified.html", true,
                 """
diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java
index dbb07515b24..4c62e89b313 100644
--- a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java
+++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java
@@ -62,7 +62,7 @@
  * <p>
  * Tests are typically written as subtypes of JavadocTester, with a main
  * method that creates an instance of the test class and calls the runTests()
- * method. The runTests() methods calls all the test methods declared in the class,
+ * method. The runTests() method calls all the test methods declared in the class,
  * and then calls a method to print a summary, and throw an exception if
  * any of the test methods reported a failure.
  *
@@ -111,7 +111,7 @@
  * <p>
  * If javadoc is run more than once in a test method, you can compare the
  * results that are generated with the diff method. Since files written by
- * javadoc typically contain a timestamp, you may want to use the -notimestamp
+ * javadoc typically contain a timestamp, you may want to use the {@code -notimestamp}
  * option if you are going to compare the results from two runs of javadoc.
  *
  * <p>
@@ -122,10 +122,11 @@
  * on each file in turn with the string to be checked.
  *
  * <p>
- * You can also write you own custom check methods, which can use
- * readFile to get the contents of a file generated by javadoc,
- * and then use pass(...) or fail(...) to report whether the check
- * succeeded or not.
+ * You can also write your own custom check methods. After any setup or
+ * argument checking, the method should call {@code checking(...)},
+ * and then eventually call either {@code passed(...)} or {@code failed(...)}
+ * to report whether the check succeeded or not.
+ * Use {@code readFile} to get the contents of a file generated by javadoc.
  *
  * <p>
  * You can have many separate test methods, each identified with a @Test
@@ -573,7 +574,8 @@ public void checkLinks() {
      * The structure is is printed in plain text to the main output stream.
      * No errors are reported (unless there is a problem reading a file)
      * but missing headings are noted within the output.
-     * @params the files
+     *
+     * @param paths the files
      */
     public void showHeadings(String... paths) {
         ShowHeadings s = new ShowHeadings(out, this::readFile);
@@ -813,26 +815,64 @@ private String readFile(File baseDir, String fileName) throws Error {
         }
     }
 
+    /**
+     * Starts a check.
+     *
+     * <p>This method should be called before subsequently calling {@code pass(...)}
+     * or {@code fail(...)}.
+     *
+     * @param message a short description of the check
+     */
     protected void checking(String message) {
         numTestsRun++;
         javadocTestNum++;
         print("Starting subtest " + javadocRunNum + "." + javadocTestNum, message);
     }
 
+    /**
+     * Concludes a check for a file, reporting that the check succeeded.
+     *
+     * <p>This method should be called after previously calling {@code checking(...)}.
+     *
+     * @param file the file that was the focus of the check
+     * @param message a short description of the outcome
+     */
     protected void passed(File file, String message) {
         passed(file + ": " + message);
     }
 
+    /**
+     * Concludes a check, reporting that the check succeeded.
+     *
+     * <p>This method should be called after previously calling {@code checking(...)}.
+     *
+     * @param message a short description of the outcome
+     */
     protected void passed(String message) {
         numTestsPassed++;
         print("Passed", message);
         out.println();
     }
 
+    /**
+     * Concludes a check for a file, reporting that the check failed.
+     *
+     * <p>This method should be called after previously calling {@code checking(...)}.
+     *
+     * @param file the file that was the focus of the check
+     * @param message a short description of the outcome
+     */
     protected void failed(File file, String message) {
         failed(file + ": " + message);
     }
 
+    /**
+     * Concludes a check for a file, reporting that the check failed.
+     *
+     * <p>This method should be called after previously calling {@code checking(...)}.
+     *
+     * @param message a short description of the outcome
+     */
     protected void failed(String message) {
         print("FAILED", message);
         StackWalker.getInstance().walk(s -> {
@@ -901,8 +941,6 @@ private boolean findString(String fileString, String stringToFind) {
      * @param baseDir1 the directory in which to locate the first file
      * @param baseDir2 the directory in which to locate the second file
      * @param file the file to compare in the two base directories
-     * an error if the files do not match.
-     * @return true if the files are the same and false otherwise.
      */
     private void diff(File baseDir1, File baseDir2, String file) {
         String file1Contents = readFile(baseDir1, file);
diff --git a/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java b/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java
index 7c16d266a31..295873ddd21 100644
--- a/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java
+++ b/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004834 8007610 8129909 8182765
+ * @bug 8004834 8007610 8129909 8182765 8247815
  * @summary Add doclint support into javadoc
  * @modules jdk.compiler/com.sun.tools.javac.main
  */
@@ -178,7 +178,7 @@ void run() throws Exception {
                     Main.Result.OK,
                     EnumSet.of(Message.DL_WRN12));
 
-            test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax"),
+            test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing"),
                     Main.Result.OK,
                     EnumSet.of(Message.DL_WRN12));
 
@@ -186,7 +186,7 @@ void run() throws Exception {
                     Main.Result.ERROR,
                     EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
 
-            test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax", "-private"),
+            test(List.of(htmlVersion, rawDiags, "-Xdoclint:missing,syntax", "-private"),
                     Main.Result.ERROR,
                     EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
 
diff --git a/test/langtools/jdk/jshell/IndentUITest.java b/test/langtools/jdk/jshell/IndentUITest.java
index efa993ad359..4f39cbbfc42 100644
--- a/test/langtools/jdk/jshell/IndentUITest.java
+++ b/test/langtools/jdk/jshell/IndentUITest.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8241950
+ * @bug 8241950 8247932
  * @summary Check the UI behavior of indentation
  * @library /tools/lib
  * @modules
@@ -70,6 +70,11 @@ public void testIdent() throws Exception {
             waitOutput(out, "^void test2\\(\\) \\{\n" +
                             CONTINUATION_PROMPT + "  System.err.println\\(1\\);\n" +
                             CONTINUATION_PROMPT + "\\}");
+            inputSink.write(INTERRUPT);
+            waitOutput(out, "\u001B\\[\\?2004h" + PROMPT);
+            inputSink.write("\"\"\"\n");
+            waitOutput(out, "^\"\"\"\n" +
+                            CONTINUATION_PROMPT);
         });
     }
 
diff --git a/test/langtools/jdk/jshell/ToolSimpleTest.java b/test/langtools/jdk/jshell/ToolSimpleTest.java
index dc840d1445d..d51efae0703 100644
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java
@@ -132,7 +132,7 @@ public void testChainedThrow() {
                         + "|  Caused by: java.io.IOException: bar\n"
                         + "|        at n (#2:1)\n"
                         + "|        ...\n"
-                        + "|  Caused by: java.lang.NullPointerException\n"
+                        + "|  Caused by: java.lang.NullPointerException: Cannot invoke \"String.toString()\" because \"null\" is null\n"
                         + "|        at p (#1:1)\n"
                         + "|        ..."),
                 (a) -> assertCommand(a, "/drop p",
diff --git a/test/langtools/tools/doclint/AccessibilityTest5.java b/test/langtools/tools/doclint/AccessibilityTest5.java
new file mode 100644
index 00000000000..5e357ab15cd
--- /dev/null
+++ b/test/langtools/tools/doclint/AccessibilityTest5.java
@@ -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() { }
+}
+
diff --git a/test/langtools/tools/doclint/AccessibilityTest5.out b/test/langtools/tools/doclint/AccessibilityTest5.out
new file mode 100644
index 00000000000..23ccfda6681
--- /dev/null
+++ b/test/langtools/tools/doclint/AccessibilityTest5.out
@@ -0,0 +1,4 @@
+AccessibilityTest5.java:21: error: no summary or caption for table
+     * <table><tr><th>head<tr><td>data</table>
+                                      ^
+1 error
diff --git a/test/langtools/tools/doclint/EmptyAuthorTest.java b/test/langtools/tools/doclint/EmptyAuthorTest.java
index 0a5db470e6b..ecd7e91271c 100644
--- a/test/langtools/tools/doclint/EmptyAuthorTest.java
+++ b/test/langtools/tools/doclint/EmptyAuthorTest.java
@@ -1,11 +1,11 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptyAuthorTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptyAuthorTest.out EmptyAuthorTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptyAuthorTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptyAuthorTest.out EmptyAuthorTest.java
  */
 
 /** @author */
diff --git a/test/langtools/tools/doclint/EmptyExceptionTest.java b/test/langtools/tools/doclint/EmptyExceptionTest.java
index 6a5db240020..8a93ec69d02 100644
--- a/test/langtools/tools/doclint/EmptyExceptionTest.java
+++ b/test/langtools/tools/doclint/EmptyExceptionTest.java
@@ -1,15 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptyExceptionTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptyExceptionTest.out EmptyExceptionTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptyExceptionTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptyExceptionTest.out EmptyExceptionTest.java
  */
 
 /** . */
 public class EmptyExceptionTest {
     /** @exception NullPointerException */
-    int emptyException() throws NullPointerException { }
+    void emptyException() throws NullPointerException { }
 }
diff --git a/test/langtools/tools/doclint/EmptyParamTest.java b/test/langtools/tools/doclint/EmptyParamTest.java
index 37f76ae075c..ce92ecc19e5 100644
--- a/test/langtools/tools/doclint/EmptyParamTest.java
+++ b/test/langtools/tools/doclint/EmptyParamTest.java
@@ -1,15 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptyParamTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptyParamTest.out EmptyParamTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptyParamTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptyParamTest.out EmptyParamTest.java
  */
 
 /** . */
 public class EmptyParamTest {
     /** @param i */
-    int emptyParam(int i) { }
+    void emptyParam(int i) { }
 }
diff --git a/test/langtools/tools/doclint/EmptyReturnTest.java b/test/langtools/tools/doclint/EmptyReturnTest.java
index b0c787fe6fe..34ff7f4cbd8 100644
--- a/test/langtools/tools/doclint/EmptyReturnTest.java
+++ b/test/langtools/tools/doclint/EmptyReturnTest.java
@@ -1,15 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptyReturnTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptyReturnTest.out EmptyReturnTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptyReturnTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptyReturnTest.out EmptyReturnTest.java
  */
 
 /** . */
 public class EmptyReturnTest {
     /** @return */
-    int emptyReturn() { }
+    int emptyReturn() { return 0; }
 }
diff --git a/test/langtools/tools/doclint/EmptySerialDataTest.java b/test/langtools/tools/doclint/EmptySerialDataTest.java
index 38c04659910..f6c353069e8 100644
--- a/test/langtools/tools/doclint/EmptySerialDataTest.java
+++ b/test/langtools/tools/doclint/EmptySerialDataTest.java
@@ -1,11 +1,11 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptySerialDataTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptySerialDataTest.out EmptySerialDataTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptySerialDataTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptySerialDataTest.out EmptySerialDataTest.java
  */
 
 import java.io.ObjectOutputStream;
@@ -13,6 +13,10 @@
 
 /** . */
 public class EmptySerialDataTest implements Serializable {
-    /** @serialData */
+    /**
+     * .
+     * @serialData
+     * @param s .
+     */
     private void writeObject(ObjectOutputStream s) { }
 }
diff --git a/test/langtools/tools/doclint/EmptySerialDataTest.out b/test/langtools/tools/doclint/EmptySerialDataTest.out
index f34a77a144c..dcfa059796d 100644
--- a/test/langtools/tools/doclint/EmptySerialDataTest.out
+++ b/test/langtools/tools/doclint/EmptySerialDataTest.out
@@ -1,5 +1,5 @@
-EmptySerialDataTest.java:16: warning: no description for @serialData
-    /** @serialData */
-        ^
+EmptySerialDataTest.java:18: warning: no description for @serialData
+     * @serialData
+       ^
 1 warning
 
diff --git a/test/langtools/tools/doclint/EmptySerialFieldTest.java b/test/langtools/tools/doclint/EmptySerialFieldTest.java
index 533370969ab..79789cc6588 100644
--- a/test/langtools/tools/doclint/EmptySerialFieldTest.java
+++ b/test/langtools/tools/doclint/EmptySerialFieldTest.java
@@ -1,11 +1,11 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptySerialFieldTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptySerialFieldTest.out EmptySerialFieldTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptySerialFieldTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptySerialFieldTest.out EmptySerialFieldTest.java
  */
 
 import java.io.ObjectStreamField;
diff --git a/test/langtools/tools/doclint/EmptySinceTest.java b/test/langtools/tools/doclint/EmptySinceTest.java
index 4af2249a18c..5992cc9d901 100644
--- a/test/langtools/tools/doclint/EmptySinceTest.java
+++ b/test/langtools/tools/doclint/EmptySinceTest.java
@@ -1,15 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptySinceTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptySinceTest.out EmptySinceTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptySinceTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptySinceTest.out EmptySinceTest.java
  */
 
 /** . */
 public class EmptySinceTest {
     /** @since */
-    int emptySince() { }
+    void emptySince() { }
 }
diff --git a/test/langtools/tools/doclint/EmptyVersionTest.java b/test/langtools/tools/doclint/EmptyVersionTest.java
index 43590818cc0..e2c3799410f 100644
--- a/test/langtools/tools/doclint/EmptyVersionTest.java
+++ b/test/langtools/tools/doclint/EmptyVersionTest.java
@@ -1,15 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8247815
  * @summary Add new doclint package
  * @modules jdk.compiler/com.sun.tools.doclint
  * @build DocLintTester
- * @run main DocLintTester -Xmsgs:-syntax EmptyVersionTest.java
- * @run main DocLintTester -Xmsgs:syntax -ref EmptyVersionTest.out EmptyVersionTest.java
+ * @run main DocLintTester -Xmsgs:-missing EmptyVersionTest.java
+ * @run main DocLintTester -Xmsgs:missing -ref EmptyVersionTest.out EmptyVersionTest.java
  */
 
 /** . */
 public class EmptyVersionTest {
     /** @version */
-    int missingVersion() { }
+    void missingVersion() { }
 }
diff --git a/test/langtools/tools/doclint/MultipleDocLintOptionsTest.java b/test/langtools/tools/doclint/MultipleDocLintOptionsTest.java
index b85af8e22ca..6a306cf64cb 100644
--- a/test/langtools/tools/doclint/MultipleDocLintOptionsTest.java
+++ b/test/langtools/tools/doclint/MultipleDocLintOptionsTest.java
@@ -1,8 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8198552
+ * @bug 8198552 8247815
  * @summary Check that -Xdoclint: option can be specified multiple times
- * @compile/fail/ref=MultipleDocLintOptionsTest.out -Xdoclint:html -Xdoclint:syntax -XDrawDiagnostics MultipleDocLintOptionsTest.java
+ * @compile/fail/ref=MultipleDocLintOptionsTest.out -Xdoclint:html -Xdoclint:missing -XDrawDiagnostics MultipleDocLintOptionsTest.java
  */
 
 /** <html> */
diff --git a/test/langtools/tools/javac/doclint/DocLintTest.java b/test/langtools/tools/javac/doclint/DocLintTest.java
index 471bd084585..110c002c277 100644
--- a/test/langtools/tools/javac/doclint/DocLintTest.java
+++ b/test/langtools/tools/javac/doclint/DocLintTest.java
@@ -135,7 +135,7 @@ public CharSequence getCharContent(boolean ignoreEncoding) {
                     Main.Result.OK,
                     EnumSet.of(Message.DL_WRN12));
 
-            test(Arrays.asList(rawDiags, "-Xdoclint:syntax"),
+            test(Arrays.asList(rawDiags, "-Xdoclint:syntax,missing"),
                     Main.Result.ERROR,
                     EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
 
diff --git a/test/langtools/tools/javac/lambda/methodReference/ProtectedInaccessibleMethodRefTest2.java b/test/langtools/tools/javac/lambda/methodReference/ProtectedInaccessibleMethodRefTest2.java
index aa17b0d8530..02e1d95cf2f 100644
--- a/test/langtools/tools/javac/lambda/methodReference/ProtectedInaccessibleMethodRefTest2.java
+++ b/test/langtools/tools/javac/lambda/methodReference/ProtectedInaccessibleMethodRefTest2.java
@@ -23,45 +23,58 @@
 
 /*
  * @test
- * @bug 8234729
+ * @bug 8234729 8242214
  * @summary Javac should eagerly change code generation for method references to avert IllegalAccessError in future.
+ * @compile ProtectedInaccessibleMethodRefTest2.java
  * @run main ProtectedInaccessibleMethodRefTest2
  */
 
 import pack.I;
 import pack.J;
 
+import java.lang.reflect.Method;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.function.Function;
-import java.lang.reflect.Method;
-import java.util.concurrent.Callable;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.function.BiFunction;
 
 public final class ProtectedInaccessibleMethodRefTest2 extends I {
 
     public static void main(String... args) {
         ProtectedInaccessibleMethodRefTest2 m = new ProtectedInaccessibleMethodRefTest2();
         m.test(Paths.get("test"));
-        // Verify that the method reference has been folded into a lambda.
-        boolean lambdaFound = false;
+        // Verify that the method references have been folded into lambdas:
+        Set<String> methodNames = new HashSet<>();
         for (Method meth : ProtectedInaccessibleMethodRefTest2.class.getDeclaredMethods()) {
-            if (meth.getName().equals("lambda$test$0")) {
-                lambdaFound = true;
-                break;
-            }
+            methodNames.add(meth.getName());
         }
-        if (!lambdaFound) {
+        List<String> expectedMethods =
+                Arrays.asList("lambda$test$0", "lambda$test$1", "lambda$test$2");
+        if (!methodNames.containsAll(expectedMethods)) {
             throw new AssertionError("Did not find evidence of new code generation");
         }
     }
 
     void test(Path outputDir) {
-        Sub c = new Sub(this::readFile);
-        c.check(outputDir);
+        Sub c1 = new Sub(this::readFile);
+        c1.check(outputDir);
+        Sub c2 = new Sub(ProtectedInaccessibleMethodRefTest2::readFile, this);
+        c2.check(outputDir);
+        Sub c3 = new Sub(ProtectedInaccessibleMethodRefTest2::readFile2);
+        c3.check(outputDir);
     }
+
     public class Sub extends J {
         Sub(Function<Path,String> fileReader) {
             super(fileReader);
         }
+        Sub(BiFunction<ProtectedInaccessibleMethodRefTest2, Path,String> fileReader,
+            ProtectedInaccessibleMethodRefTest2 instance) {
+            super(p -> fileReader.apply(instance, p));
+        }
     }
 }
diff --git a/test/langtools/tools/javac/lambda/methodReference/pack/I.java b/test/langtools/tools/javac/lambda/methodReference/pack/I.java
index 02f6356a786..018ed463d92 100644
--- a/test/langtools/tools/javac/lambda/methodReference/pack/I.java
+++ b/test/langtools/tools/javac/lambda/methodReference/pack/I.java
@@ -29,4 +29,8 @@ public class I {
     protected String readFile(Path file) {
         return file.toString();
     }
+
+    protected static String readFile2(Path file) {
+        return file.toString();
+    }
 }
diff --git a/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.java b/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.java
new file mode 100644
index 00000000000..155dd5335d9
--- /dev/null
+++ b/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.java
@@ -0,0 +1,15 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8246704
+ * @summary Verify preview APIs are reported correctly when using --release.
+ * @compile/fail/ref=PreviewAPIsWithRelease.out -XDrawDiagnostics --release 14 PreviewAPIsWithRelease.java
+ */
+
+import com.sun.source.tree.Tree.Kind;
+
+public class PreviewAPIsWithRelease {
+    void test() {
+        "".stripIndent();
+        Kind r = Kind.RECORD;
+    }
+}
diff --git a/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.out b/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.out
new file mode 100644
index 00000000000..f07ff3a3b96
--- /dev/null
+++ b/test/langtools/tools/javac/platform/PreviewAPIsWithRelease.out
@@ -0,0 +1,4 @@
+PreviewAPIsWithRelease.java:12:11: compiler.err.is.preview: stripIndent()
+PreviewAPIsWithRelease.java:13:22: compiler.warn.is.preview: RECORD
+1 error
+1 warning
diff --git a/test/langtools/tools/javac/sealed/SealedCompilationTests.java b/test/langtools/tools/javac/sealed/SealedCompilationTests.java
index eacd60f6b32..5313d5a1275 100644
--- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java
+++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java
@@ -768,8 +768,14 @@ sealed class C permits Sub {}
         }
     }
 
-    public void testParameterizedPermitted() {
+    private static String[] PRIMITIVES_VOID_AND_PRIMITIVE_ARRAYS = new String[] {
+        "byte", "short", "int", "long", "float", "double", "char", "boolean", "void",
+        "byte[]", "short[]", "int[]", "long[]", "float[]", "double[]", "char[]", "boolean[]"
+    };
+
+    public void testPermitsClause() {
         for (String s : List.of(
+            // can't include a parameterized type
             """
             sealed class C<T> permits Sub<T> {}
             final class Sub<T> extends C<T> {}
@@ -777,10 +783,52 @@ final class Sub<T> extends C<T> {}
             """
             sealed class C permits Sub<String> {}
             final class Sub<T> extends C {}
+            """,
+            """
+            sealed class C permits Sub<String> {}
+            non-sealed class Sub<T> extends C {}
+            """,
+            """
+            sealed interface IC permits ID<String> {}
+            non-sealed interface ID<T> extends IC {}
+            """,
+
+            // can't include an array type
+            """
+            sealed class C<T> permits Sub[] {}
+            final class Sub<T> extends C<T> {}
+            """,
+            """
+            sealed class C permits Sub[] {}
+            non-sealed class Sub<T> extends C {}
+            """,
+            """
+            sealed interface IC permits ID[] {}
+            non-sealed interface ID<T> extends IC {}
             """
             )) {
             assertFail("compiler.err.expected", s);
         }
+
+        for (String s : List.of(
+            // can't include primitives, void or primitive arrays
+            """
+            sealed class C<T> permits # {}
+            final class Sub<T> extends C<T> {}
+            """,
+            """
+            sealed class C permits # {}
+            non-sealed class Sub<T> extends C {}
+            """,
+            """
+            sealed interface IC permits # {}
+            non-sealed interface ID<T> extends IC {}
+            """
+            )) {
+            for (String t: PRIMITIVES_VOID_AND_PRIMITIVE_ARRAYS){
+                assertFail("compiler.err.expected", s, t);
+            }
+        }
     }
 
     private Path[] findJavaFiles(Path... paths) throws IOException {
diff --git a/test/lib/jdk/test/lib/security/KeyStoreUtils.java b/test/lib/jdk/test/lib/security/KeyStoreUtils.java
index 6d1f1cf8eb8..b205de2e7ff 100644
--- a/test/lib/jdk/test/lib/security/KeyStoreUtils.java
+++ b/test/lib/jdk/test/lib/security/KeyStoreUtils.java
@@ -23,12 +23,15 @@
 
 package jdk.test.lib.security;
 
+import java.io.*;
 import java.io.ByteArrayInputStream;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.security.KeyStore;
 import java.security.PrivateKey;
 import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.KeyStore;
 import java.util.ArrayList;
 import java.util.Base64;
 import java.util.List;
@@ -289,4 +292,25 @@ public static KeyStore defaultKeyStore() throws Exception {
                 new String[] { CertUtils.DSA_CERT }));
         return createKeyStore(entries.toArray(new KeyEntry[entries.size()]));
     }
+
+    /**
+     * Creates cacerts keystore with the trusted certificate(s)
+     * @param args arguments to cacerts keystore name and trusted certificates
+     * @throws Exception if there is an error
+     *
+     */
+    public static void createCacerts(String ks, String... crts) throws Exception {
+        try (OutputStream os = new FileOutputStream(ks)) {
+            KeyStore k = KeyStore.getInstance("JKS");
+            k.load(null, null);
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            for (int pos = 0; pos < crts.length; pos++) {
+                try (InputStream is = new FileInputStream(crts[pos])) {
+                    k.setCertificateEntry("root" + pos,
+                            cf.generateCertificate(is));
+                }
+            }
+            k.store(os, "changeit".toCharArray());
+        }
+    }
 }
diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java
index 67235798bb4..2bb655610ce 100644
--- a/test/lib/sun/hotspot/WhiteBox.java
+++ b/test/lib/sun/hotspot/WhiteBox.java
@@ -110,6 +110,8 @@ public boolean isClassAlive(String name) {
 
   public  native int getSymbolRefcount(String name);
 
+  public native boolean deflateIdleMonitors();
+
   private native boolean isMonitorInflated0(Object obj);
   public         boolean isMonitorInflated(Object obj) {
     Objects.requireNonNull(obj);
diff --git a/test/micro/org/openjdk/bench/java/io/RecordDeserialization.java b/test/micro/org/openjdk/bench/java/io/RecordDeserialization.java
new file mode 100644
index 00000000000..b2dbefe3c05
--- /dev/null
+++ b/test/micro/org/openjdk/bench/java/io/RecordDeserialization.java
@@ -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);
+    }
+}
diff --git a/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java b/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java
new file mode 100644
index 00000000000..22bccdcb859
--- /dev/null
+++ b/test/micro/org/openjdk/bench/java/security/PermissionsImplies.java
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+package org.openjdk.bench.java.security;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+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.security.Permissions;
+import java.security.UnresolvedPermission;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Benchmark measuring Permissions.implies
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
+@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
+@Fork(3)
+@State(Scope.Thread)
+public class PermissionsImplies {
+
+    private Permissions withPermission = new Permissions();
+    private Permissions withoutPermission = new Permissions();
+    private Permissions withUnresolvedPermission = new Permissions();
+
+    private RuntimePermission permission = new RuntimePermission("exitVM");
+
+    @Setup
+    public void setup() {
+        withPermission.add(permission);
+        withUnresolvedPermission.add(permission);
+        withUnresolvedPermission.add(new UnresolvedPermission("java.lang.FilePermission", "foo", "write", null));
+    }
+
+    @Benchmark
+    public boolean withoutPermission() {
+        return withoutPermission.implies(permission);
+    }
+
+    @Benchmark
+    public boolean withPermission() {
+        return withPermission.implies(permission);
+    }
+
+    @Benchmark
+    public boolean withUnresolvedPermission() {
+        return withUnresolvedPermission.implies(permission);
+    }
+}
diff --git a/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java b/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java
index e5c42448163..69950eacbac 100644
--- a/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java
+++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/BulkOps.java
@@ -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 @@ public class BulkOps {
     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 unsafe_copy() {
     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);
+    }
 }