merge default -> JEP-230 JEP-230-microbenchmarks-branch
authorredestad
Thu, 04 Oct 2018 16:01:19 +0200
branchJEP-230-microbenchmarks-branch
changeset 56925 6dd05d35378e
parent 56922 4219852032ba (diff)
parent 52013 92383597fa21 (current diff)
child 56926 d86dd5847e6d
merge default -> JEP-230
--- a/make/Help.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/Help.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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
@@ -103,6 +103,7 @@
 	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
 	$(info $(_) JTREG="OPT1=x;OPT2=y"  # Control the JTREG test harness for run-test)
 	$(info $(_) GTEST="OPT1=x;OPT2=y"  # Control the GTEST test harness for run-test)
+	$(info $(_) MICRO="OPT1=x;OPT2=y"  # Control the MICRO test harness for run-test)
 	$(info )
 	$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\
 	    $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.))
--- a/make/InitSupport.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/InitSupport.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -50,7 +50,7 @@
 
   # Make control variables, handled by Init.gmk
   INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \
-      COMPARE_BUILD JTREG GTEST TEST_OPTS TEST_VM_OPTS
+      COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS
 
   # All known make control variables
   MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER
--- a/make/Main.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/Main.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -465,7 +465,7 @@
 ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
 
 ################################################################################
-# Build tests
+# Build tests and microbenchmarks
 #
 
 prepare-test-image:
@@ -527,12 +527,15 @@
 	     -f BuildFailureHandler.gmk images)
 endif
 
+build-microbenchmark:
+	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f test/BuildMicrobenchmark.gmk)
+
 ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
     test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
     test-image-hotspot-jtreg-graal build-test-hotspot-jtreg-graal \
-    run-test exploded-run-test
+    build-microbenchmark run-test exploded-run-test
 
 ################################################################################
 # Run tests
@@ -775,6 +778,8 @@
 
   jrtfs-jar: interim-langtools
 
+  build-microbenchmark: interim-langtools jdk.unsupported java.management
+
   ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
     ifeq ($(CREATE_BUILDJDK), true)
       # If creating a buildjdk, the interim image needs to be based on that.
@@ -1015,6 +1020,10 @@
     test-image-jdk-jtreg-native test-image-failure-handler \
     test-image-demos-jdk $(JVM_TEST_IMAGE_TARGETS)
 
+ifneq ($(JMH_CORE_JAR), )
+  test-image: build-microbenchmark
+endif
+
 ################################################################################
 
 # all-images builds all our deliverables as images.
--- a/make/RunTests.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/RunTests.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 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
@@ -107,12 +107,15 @@
 # Parse control variables
 ################################################################################
 
+### Jtreg
+
 ifneq ($(TEST_OPTS), )
   # Inform the user
   $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
 
   $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
   $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
+  $(eval $(call SetTestOpt,VM_OPTIONS,MICRO))
 
   $(eval $(call SetTestOpt,JOBS,JTREG))
   $(eval $(call SetTestOpt,TIMEOUT,JTREG))
@@ -128,6 +131,8 @@
   $(info Running tests using JTREG control variable '$(JTREG)')
 endif
 
+### Gtest
+
 $(eval $(call ParseKeywordVariable, GTEST, \
     KEYWORDS := REPEAT, \
     STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
@@ -138,6 +143,18 @@
   $(info Running tests using GTEST control variable '$(GTEST)')
 endif
 
+### Microbenchmarks
+
+$(eval $(call ParseKeywordVariable, MICRO, \
+    KEYWORDS := ITER FORK TIME WARMUP_ITER WARMUP_TIME, \
+    STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS TEST_JDK BENCHMARKS_JAR, \
+))
+
+ifneq ($(MICRO), )
+  # Inform the user
+  $(info Running tests using MICRO control variable '$(MICRO)')
+endif
+
 
 ################################################################################
 # Component-specific Jtreg settings
@@ -203,6 +220,24 @@
   )
 endef
 
+# Helper function to determine if a test specification is a microbenchmark test
+#
+# It is a microbenchmark test if it is either "micro", or "micro:" followed by an optional
+# test filter string.
+define ParseMicroTestSelection
+  $(if $(filter micro%, $1), \
+    $(if $(filter micro, $1), \
+      micro:all \
+    , \
+      $(if $(filter micro:, $1), \
+        micro:all \
+      , \
+        $1 \
+      ) \
+    ) \
+  )
+endef
+
 # Helper function that removes the TOPDIR part
 CleanupJtregPath = \
   $(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1)))
@@ -300,6 +335,9 @@
     $(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \
   ) \
   $(if $(strip $(PARSED_TESTS)), , \
+    $(eval PARSED_TESTS += $(call ParseMicroTestSelection, $(test))) \
+  ) \
+  $(if $(strip $(PARSED_TESTS)), , \
     $(eval PARSED_TESTS += $(call ParseJtregTestSelection, $(test))) \
   ) \
   $(if $(strip $(PARSED_TESTS)), , \
@@ -414,6 +452,114 @@
 
 ################################################################################
 
+### Rules for Microbenchmarks
+
+# Helper function for SetupRunMicroTest. Set a MICRO_* variable from, in order:
+# 1) Specified by user on command line
+# 2) Generic default
+#
+# Note: No spaces are allowed around the arguments.
+# Arg $1 The test ID (i.e. $1 in SetupRunMicroTest)
+# Arg $2 Base variable, e.g. MICRO_TEST_JDK
+# Arg $3 The default value (optional)
+define SetMicroValue
+  ifneq ($$($2), )
+    $1_$2 := $$($2)
+  else
+    ifneq ($3, )
+      $1_$2 := $3
+    endif
+  endif
+endef
+
+SetupRunMicroTest = $(NamedParamsMacroTemplate)
+define SetupRunMicroTestBody
+  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
+  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
+  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
+
+  $1_TEST_NAME := $$(strip $$(patsubst micro:%, %, $$($1_TEST)))
+
+  $$(eval $$(call SetMicroValue,$1,MICRO_BENCHMARKS_JAR,$$(TEST_IMAGE_DIR)/micro/microbenchmarks.jar))
+  $$(eval $$(call SetMicroValue,$1,MICRO_TEST_JDK,$$(JDK_IMAGE_DIR)))
+  $$(eval $$(call SetMicroValue,$1,MICRO_JAVA_OPTIONS))
+
+  # Current tests needs to open java.io
+  $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
+
+  # Save output as CSV file
+  $1_MICRO_BASIC_OPTIONS += -rf csv -rff $$($1_TEST_RESULTS_DIR)/jmh-result.csv
+
+  # Always specify test JVM
+  $1_MICRO_BASIC_OPTIONS += -jvm $$($1_MICRO_TEST_JDK)/bin/java
+
+  ifneq ($$(MICRO_VM_OPTIONS), )
+    $1_MICRO_VM_OPTIONS := -jvmArgs $$(MICRO_VM_OPTIONS)
+  endif
+
+  ifneq ($$(MICRO_ITER), )
+    $1_MICRO_ITER := -i $$(MICRO_ITER)
+  endif
+  ifneq ($$(MICRO_FORK), )
+    $1_MICRO_FORK := -f $$(MICRO_FORK)
+  endif
+  ifneq ($$(MICRO_TIME), )
+    $1_MICRO_TIME := -r $$(MICRO_TIME)
+  endif
+  ifneq ($$(MICRO_WARMUP_ITER), )
+    $1_MICRO_WARMUP_ITER := -wi $$(MICRO_WARMUP_ITER)
+  endif
+  ifneq ($$(MICRO_WARMUP_TIME), )
+    $1_MICRO_WARMUP_TIME := -w $$(MICRO_WARMUP_TIME)
+  endif
+
+  run-test-$1:
+	$$(call LogWarn)
+	$$(call LogWarn, Running test '$$($1_TEST)')
+	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
+	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \
+	    $$(JAVA) $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \
+	        $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \
+	        $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \
+	        $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS)  \
+	        $$($1_TEST_NAME) \
+	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/micro.txt) \
+	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	)
+
+  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/micro.txt
+
+  parse-test-$1: run-test-$1
+	$$(call LogWarn, Finished running test '$$($1_TEST)')
+	$$(call LogWarn, Test report is stored in $$(strip \
+	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
+	$$(if $$(wildcard $$($1_EXITCODE)), \
+	  $$(eval $1_EXIT_CODE := $$(shell $$(CAT) $$($1_EXITCODE))) \
+	  $$(if $$(filter 0, $$($1_EXIT_CODE)), \
+	    $$(eval $1_PASSED := 1) \
+	    $$(eval $1_ERROR := 0) \
+	  , \
+	    $$(eval $1_PASSED := 0) \
+	    $$(eval $1_ERROR := 1) \
+	  ) \
+	  $$(eval $1_FAILED := 0) \
+	  $$(eval $1_TOTAL := $$(shell \
+	      $$(EXPR) $$($1_PASSED) + $$($1_ERROR))) \
+	, \
+	  $$(eval $1_PASSED := 0) \
+	  $$(eval $1_FAILED := 0) \
+	  $$(eval $1_ERROR := 1) \
+	  $$(eval $1_TOTAL := 1) \
+	)
+
+  $1: run-test-$1 parse-test-$1
+
+  TARGETS += $1
+endef
+
+################################################################################
+
 ### Rules for Jtreg
 
 # Helper function for SetupRunJtregTest. Set a JTREG_* variable from, in order:
@@ -668,6 +814,9 @@
 UseGtestTestHandler = \
   $(if $(filter gtest:%, $1), true)
 
+UseMicroTestHandler = \
+  $(if $(filter micro:%, $1), true)
+
 UseJtregTestHandler = \
   $(if $(filter jtreg:%, $1), true)
 
@@ -689,6 +838,11 @@
         TEST := $(test), \
     )) \
   ) \
+  $(if $(call UseMicroTestHandler, $(test)), \
+    $(eval $(call SetupRunMicroTest, $(TEST_ID), \
+        TEST := $(test), \
+    )) \
+  ) \
   $(if $(call UseJtregTestHandler, $(test)), \
     $(eval $(call SetupRunJtregTest, $(TEST_ID), \
         TEST := $(test), \
--- a/make/autoconf/configure.ac	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/autoconf/configure.ac	Thu Oct 04 16:01:19 2018 +0200
@@ -180,6 +180,9 @@
 # Setup the JTReg Regression Test Harness.
 TOOLCHAIN_SETUP_JTREG
 
+# Setup the Java Microbenchmark Harness (JMH)
+LIB_TESTS_SETUP_JMH
+
 # Setup Jib dependency tool
 TOOLCHAIN_SETUP_JIB
 
--- a/make/autoconf/lib-tests.m4	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/autoconf/lib-tests.m4	Thu Oct 04 16:01:19 2018 +0200
@@ -55,3 +55,65 @@
   AC_SUBST(GRAALUNIT_LIB)
 ])
 
+###############################################################################
+#
+# Setup and check the Java Microbenchmark Harness
+#
+AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
+[
+  AC_ARG_WITH(jmh, [AS_HELP_STRING([--with-jmh],
+      [Java Microbenchmark Harness for building the OpenJDK Microbenchmark Suite])])
+
+  AC_MSG_CHECKING([for jmh (Java Microbenchmark Harness)])
+  if test "x$with_jmh" = xno || test "x$with_jmh" = x; then
+    AC_MSG_RESULT([no, disabled])
+  elif test "x$with_jmh" = xyes; then
+    AC_MSG_RESULT([no, error])
+    AC_MSG_ERROR([--with-jmh-home requires a directory containing all jars needed by JMH])
+  else
+    # Path specified
+    JMH_HOME="$with_jmh"
+    if test ! -d [$JMH_HOME]; then
+      AC_MSG_RESULT([no, error])
+      AC_MSG_ERROR([$JMH_HOME does not exist or is not a directory])
+    fi
+    BASIC_FIXUP_PATH([JMH_HOME])
+
+    jar_names="jmh-core jmh-generator-annprocess jopt-simple commons-math3"
+    for jar in $jar_names; do
+      found_jar_files=$($ECHO $(ls $JMH_HOME/$jar-*.jar 2> /dev/null))
+
+      if test "x$found_jar_files" = x; then
+        AC_MSG_RESULT([no])
+        AC_MSG_ERROR([--with-jmh does not contain $jar-*.jar])
+      elif ! test -e "$found_jar_files"; then
+        AC_MSG_RESULT([no])
+        AC_MSG_ERROR([--with-jmh contain multiple $jar-*.jar: $found_jar_files])
+      fi
+
+      found_jar_var_name=found_${jar//-/_}
+      eval $found_jar_var_name='"'$found_jar_files'"'
+    done
+    AC_MSG_RESULT([yes])
+
+    JMH_CORE_JAR=$found_jmh_core
+    JMH_GENERATOR_JAR=$found_jmh_generator_annprocess
+    JMH_JOPT_SIMPLE_JAR=$found_jopt_simple
+    JMH_COMMONS_MATH_JAR=$found_commons_math3
+
+
+    if [ [[ "$JMH_CORE_JAR" =~ jmh-core-(.*)\.jar$ ]] ] ; then
+      JMH_VERSION=${BASH_REMATCH[[1]]}
+    else
+      JMH_VERSION=unknown
+    fi
+
+    AC_MSG_NOTICE([JMH core version: $JMH_VERSION])
+  fi
+
+  AC_SUBST(JMH_CORE_JAR)
+  AC_SUBST(JMH_GENERATOR_JAR)
+  AC_SUBST(JMH_JOPT_SIMPLE_JAR)
+  AC_SUBST(JMH_COMMONS_MATH_JAR)
+  AC_SUBST(JMH_VERSION)
+])
--- a/make/autoconf/spec.gmk.in	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/autoconf/spec.gmk.in	Thu Oct 04 16:01:19 2018 +0200
@@ -353,6 +353,12 @@
 LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
 GRAALUNIT_LIB := @GRAALUNIT_LIB@
 
+JMH_CORE_JAR := @JMH_CORE_JAR@
+JMH_GENERATOR_JAR := @JMH_GENERATOR_JAR@
+JMH_JOPT_SIMPLE_JAR := @JMH_JOPT_SIMPLE_JAR@
+JMH_COMMONS_MATH_JAR := @JMH_COMMONS_MATH_JAR@
+JMH_VERSION := @JMH_VERSION@
+
 # Source file for cacerts
 CACERTS_FILE=@CACERTS_FILE@
 
--- a/make/common/FindTests.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/common/FindTests.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2017, 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
@@ -72,6 +72,9 @@
 # Add Gtest
 ALL_NAMED_TESTS += gtest
 
+# Add microbenchmarks
+ALL_NAMED_TESTS += micro
+
 ################################################################################
 
 endif # _FIND_TESTS_GMK
--- a/make/common/JarArchive.gmk	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/common/JarArchive.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -43,6 +43,7 @@
 #       For this to work, the source files must exist when the makefile is
 #       parsed.
 #   SRCS:=List of directories in where to find files to add to archive
+#   BIN:=Directory where to store build control files
 #   SUFFIXES:=File suffixes to include in jar
 #   INCLUDES:=List of directories/packages in SRCS that should be included
 #   EXCLUDES:=List of directories/packages in SRCS that should be excluded
@@ -62,10 +63,11 @@
 
   $1_JARMAIN:=$(strip $$($1_JARMAIN))
   $1_JARNAME:=$$(notdir $$($1_JAR))
-  $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
-  $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
-  $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
-  $1_BIN:=$$(dir $$($1_JAR))
+  $1_JAR_OUTPUT_DIR := $$(patsubst %/, %, $$(dir $$($1_JAR)))
+  $$(call SetIfEmpty, $1_BIN, $$($1_JAR_OUTPUT_DIR))
+  $1_MANIFEST_FILE:=$$($1_BIN)/_the.$$($1_JARNAME)_manifest
+  $1_DELETESS_FILE:=$$($1_BIN)/_the.$$($1_JARNAME)_deletess
+  $1_DELETES_FILE:=$$($1_BIN)/_the.$$($1_JARNAME)_deletes
   $$(call SetIfEmpty, $1_JAR_CMD, $$(JAR))
 
   ifeq (,$$($1_SUFFIXES))
@@ -231,11 +233,14 @@
   $1_VARDEPS := $$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$($1_MANIFEST) \
       $$($1_JARMAIN) $$($1_EXTRA_MANIFEST_ATTR) $$($1_ORIG_DEPS) $$($1_SRCS) \
       $$($1_INCLUDES) $$($1_EXCLUDES) $$($1_EXCLUDE_FILES) $$($1_EXTRA_FILES)
-  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$(dir $$($1_JAR))_the.$$($1_JARNAME).vardeps)
+  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$$($1_JARNAME).vardeps)
 
   # Here is the rule that creates/updates the jar file.
   $$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
 	$(MKDIR) -p $$($1_BIN)
+        ifneq ($$($1_JAR_OUTPUT_DIR), $$($1_BIN))
+	  $(MKDIR) -p $$($1_JAR_OUTPUT_DIR)
+        endif
 	$$($1_GREP_INCLUDE_OUTPUT)
 	$$($1_GREP_EXCLUDE_OUTPUT)
         # If the vardeps file is part of the newer prereq list, it means that
--- a/make/conf/jib-profiles.js	Thu Oct 04 14:03:13 2018 +0200
+++ b/make/conf/jib-profiles.js	Thu Oct 04 16:01:19 2018 +0200
@@ -239,7 +239,7 @@
 
     // These are the base setttings for all the main build profiles.
     common.main_profile_base = {
-        dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf"],
+        dependencies: ["boot_jdk", "gnumake", "jtreg", "jib", "autoconf", "jmh"],
         default_make_targets: ["product-bundles", "test-bundles"],
         configure_args: concat(["--enable-jtreg-failure-handler"],
             "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK",
@@ -896,6 +896,12 @@
             environment_path: input.get("jtreg", "install_path") + "/jtreg/bin"
         },
 
+        jmh: {
+            organization: common.organization,
+            ext: "tar.gz",
+            revision: "1.21+1.0"
+        },
+
         gnumake: {
             organization: common.organization,
             ext: "tar.gz",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/devkit/createJMHBundle.sh	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,50 @@
+#!/bin/bash -e
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# Create a bundle in the build directory, containing what's needed to
+# build and run JMH microbenchmarks from the OpenJDK build.
+
+JMH_VERSION=1.21
+COMMONS_MATH3_VERSION=3.2
+JOPT_SIMPLE_VERSION=4.6
+
+BUNDLE_NAME=jmh-$JMH_VERSION.tar.gz
+
+SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
+BUILD_DIR="${SCRIPT_DIR}/../../build/jmh"
+JAR_DIR="$BUILD_DIR/jars"
+
+mkdir -p $BUILD_DIR $JAR_DIR
+cd $JAR_DIR
+rm -f *
+
+wget http://central.maven.org/maven2/org/apache/commons/commons-math3/$COMMONS_MATH3_VERSION/commons-math3-$COMMONS_MATH3_VERSION.jar
+wget http://central.maven.org/maven2/net/sf/jopt-simple/jopt-simple/$JOPT_SIMPLE_VERSION/jopt-simple-$JOPT_SIMPLE_VERSION.jar
+wget http://central.maven.org/maven2/org/openjdk/jmh/jmh-core/$JMH_VERSION/jmh-core-$JMH_VERSION.jar
+wget http://central.maven.org/maven2/org/openjdk/jmh/jmh-generator-annprocess/$JMH_VERSION/jmh-generator-annprocess-$JMH_VERSION.jar
+
+tar -cvzf ../$BUNDLE_NAME *
+
+echo "Created $BUILD_DIR/$BUNDLE_NAME"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/BuildMicrobenchmark.gmk	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,113 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This must be the first rule
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+ifeq ($(JMH_CORE_JAR), )
+  $(info Error: JMH is missing. Please use configure --with-jmh.)
+  $(error Cannot continue)
+endif
+
+#### Variables
+
+MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
+MICROBENCHMARK_JAR := $(IMAGES_OUTPUTDIR)/test/micro/microbenchmarks.jar
+
+MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
+MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes
+MICROBENCHMARK_JAR_BIN := $(MICROBENCHMARK_OUTPUT)/jar
+
+JMH_UNPACKED_DIR := $(MICROBENCHMARK_OUTPUT)/jmh_jars
+JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker
+
+# External dependencies
+JMH_COMPILE_JARS := $(JMH_CORE_JAR) $(JMH_GENERATOR_JAR)
+JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JAR)
+
+MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS))
+
+###
+
+# Need double \n to get new lines and no trailing spaces
+MICROBENCHMARK_MANIFEST := Build: $(FULL_VERSION)\n\
+\nJMH-Version: $(JMH_VERSION)\n\
+\nName: OpenJDK Microbenchmark Suite
+
+
+#### Compile Targets
+
+# Building microbenchmark requires the jdk.unsupported and java.management modules,
+# and to have sjavac disabled.
+$(eval $(call SetupJavaCompiler, MICROBENCHMARK_JAVA_COMPILER, \
+    JVM := $(JAVA_SMALL) --add-modules jdk.unsupported --limit-modules java.management, \
+    JAVAC := $(NEW_JAVAC), \
+    DISABLE_SJAVAC := true, \
+    FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \
+    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
+    SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
+))
+
+# Build microbenchmark suite for the current JDK
+$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
+    SETUP := MICROBENCHMARK_JAVA_COMPILER, \
+    ADD_JAVAC_FLAGS := -cp $(MICROBENCHMARK_CLASSPATH) -Xlint -Werror, \
+    SRC := $(MICROBENCHMARK_SRC), \
+    BIN := $(MICROBENCHMARK_CLASSES), \
+))
+
+$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
+
+# Unpacking dependencies for inclusion in the benchmark JARs
+$(JMH_UNPACKED_JARS_DONE): $(JMH_RUNTIME_JARS)
+	$(RM) -r $(JMH_UNPACKED_DIR)
+	$(MKDIR) -p $(JMH_UNPACKED_DIR)
+	$(foreach jar, $(JMH_RUNTIME_JARS), \
+            $$($(UNZIP) -oq $(jar) -d $(JMH_UNPACKED_DIR)))
+	$(RM) -r $(JMH_UNPACKED_DIR)/META-INF
+	$(RM) $(JMH_UNPACKED_DIR)/*.xml
+	$(TOUCH) $@
+
+# Create benchmarks JAR file with benchmarks for both the old and new JDK
+$(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
+    DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE), \
+    SRCS := $(MICROBENCHMARK_CLASSES) $(JMH_UNPACKED_DIR), \
+    BIN := $(MICROBENCHMARK_JAR_BIN), \
+    SUFFIXES := .*, \
+    EXCLUDE_FILES:= _the.BUILD_JDK_MICROBENCHMARK_batch \
+        _the.BUILD_JDK_MICROBENCHMARK.vardeps _unpacked.marker, \
+    EXTRA_MANIFEST_ATTR := $(MICROBENCHMARK_MANIFEST), \
+    JARMAIN := org.openjdk.jmh.Main, \
+    JAR := $(MICROBENCHMARK_JAR), \
+))
+
+all: $(MICROBENCHMARK_JAR)
+
+.PHONY: all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/hotspot/gc/g1/WriteBarrier.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.hotspot.gc.g1;
+
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.OperationsPerInvocation;
+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.TearDown;
+import org.openjdk.jmh.annotations.Warmup;
+
+/**
+ * Several different tests cases of reference writes that might require write
+ * barrier depending on the GC used. Multiple sub-classes available with
+ * specific command line options set to test G1, Parallel GC and CMS.
+ *
+ * @author staffan.friberg@oracle.com (sfriberg)
+ */
+@State(Scope.Benchmark)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Warmup(iterations = 5)
+@Measurement(iterations = 5)
+@Fork(jvmArgsAppend = {"-XX:+UseG1GC", "-Xmx256m", "-Xms256m", "-Xmn64m"}, value = 5)
+public class WriteBarrier {
+
+    // Datastructures that enables writes between different parts and regions on the heap
+    private Object oldReferee_region1;
+    private Object oldReferee_region2;
+    private Object youngReferee_region3;
+    private Object youngReferee_region4;
+    private Object nullReferee = null;
+
+    private static final int OLD_REFERENCES_LENGTH = 131072;
+    private final Holder[] oldReferences = new Holder[OLD_REFERENCES_LENGTH];
+    private Holder oldReference_region1;
+    private Holder youngReference_region3;
+
+    // Keep alive to avoid them being garbage collected but not used in benchmarks
+    private final LinkedList<Holder> padding = new LinkedList<>();
+    private final LinkedList<Holder> liveData = new LinkedList<>();
+    private final HashMap<String, Long> gcCount = new HashMap<>();
+
+    /**
+     * Setup method for the benchmarks
+     *
+     * Allocate objects in a certain order to make sure the end up on the heap
+     * in the right way to later use them in tests.
+     */
+    @Setup
+    public void setup() {
+        // Allocate together and System.gc to move them to Old Space and
+        // keep in the same region by doing a fast promotion
+        oldReferee_region1 = new Object();
+        oldReference_region1 = new Holder(oldReferee_region1);
+        System.gc();
+
+        // Fill up old space to 80%
+        List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+        for (MemoryPoolMXBean pool : pools) {
+            if (pool.getName().contains("Old Gen")) {
+                pool.setUsageThreshold((pool.getUsage().getMax() / 5) * 4);
+
+                while (!pool.isUsageThresholdExceeded()) {
+                    // Allocate new referee and and then increase live data count
+                    // and force promotion until heap is full enough. The last
+                    // oldReferee will most likely be located in a different region
+                    // compared to the the initially allocated objects.
+                    oldReferee_region2 = new Object();
+                    for (int i = 0; i < 10000; i++) {
+                        liveData.add(new Holder(new byte[512], new Object()));
+                    }
+                }
+                break;
+            }
+        }
+        int index = 0;
+        for (Holder holder : liveData) {
+            if (index < oldReferences.length) {
+                oldReferences[index++] = holder;
+            }
+        }
+
+        // Allocate reference and referee together to keep them in same region
+        // Allocate Object first so they are located in the same memory order
+        // as objects in old space
+        youngReferee_region3 = new Object();
+        youngReference_region3 = new Holder(youngReferee_region3);
+
+        // Allocate padding and a new referee to make sure the reference and
+        // referee are in different regions
+        for (int i = 0; i < 2000; i++) {
+            Holder tempHolder = new Holder(new byte[500], new Object());
+            padding.add(tempHolder);
+            youngReferee_region4 = tempHolder.getReference();
+        }
+
+        /*
+         * Get GC numbers after all allocation but before any benchmark execution
+         * starts to verify that no GCs happen during the benchmarking it self as
+         * object will then move.
+         */
+        List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
+        for (GarbageCollectorMXBean gcBean : gcBeans) {
+            gcCount.put(gcBean.getName(), gcBean.getCollectionCount());
+        }
+    }
+
+    /**
+     * Invalidate any benchmark result if a GC occurs during execution of
+     * benchmark as moving objects will destroy the assumptions of the tests
+     */
+    @TearDown(Level.Iteration)
+    public void checkGCCount() {
+        List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
+        for (GarbageCollectorMXBean gcBean : gcBeans) {
+            if (gcBean.getCollectionCount() != gcCount.get(gcBean.getName())) {
+                throw new RuntimeException("A GC has happened during iteration and the microbenchmark result is invalid.");
+            }
+        }
+    }
+
+    /**
+     * Write a reference in an object located in the old space and where the
+     * written pointer is to a old object in the same region
+     */
+    @Benchmark
+    public void oldPointingToOldInSameRegion() {
+        oldReference_region1.setReference(oldReferee_region1);
+    }
+
+    /**
+     * Write a reference in an object located in the old space and where the
+     * written pointer is to a old object in a different region
+     */
+    @Benchmark
+    public void oldPointingToOldInDifferentRegion() {
+        oldReference_region1.setReference(oldReferee_region2);
+    }
+
+    /**
+     * Write a reference in an object located in the old space and where the
+     * written pointer is to an object in the young space
+     */
+    @Benchmark
+    public void oldPointingToYoungInDifferentRegion() {
+        oldReference_region1.setReference(youngReferee_region3);
+    }
+
+    /**
+     * Write a reference in an object located in the young space and where the
+     * written pointer is to an object in the old space
+     */
+    @Benchmark
+    public void youngPointingToOldInDifferentRegion() {
+        youngReference_region3.setReference(oldReferee_region2);
+    }
+
+    /**
+     * Write a reference in an object located in the young space and where the
+     * written pointer is to a young object in the same region
+     */
+    @Benchmark
+    public void youngPointingToYoungInSameRegion() {
+        youngReference_region3.setReference(youngReferee_region3);
+    }
+
+    /**
+     * Write a reference in an object located in the young space and where the
+     * written pointer is to a young object in a different region
+     */
+    @Benchmark
+    public void youngPointingToYoungInDifferentRegion() {
+        youngReference_region3.setReference(youngReferee_region4);
+    }
+
+    /**
+     * Write by compiler provable null to an object located in old space
+     */
+    @Benchmark
+    public void oldPointingToExplicitNull() {
+        oldReference_region1.setReference(null);
+    }
+
+    /**
+     * Write by compiler unprovable null to an object located in old space
+     */
+    @Benchmark
+    public void oldPointingToImplicitNull() {
+        oldReference_region1.setReference(nullReferee);
+    }
+
+    /**
+     * Write by compiler provable null to an object located in young space
+     */
+    @Benchmark
+    public void youngPointingToExplicitNull() {
+        youngReference_region3.setReference(null);
+    }
+
+    /**
+     * Write by compiler unprovable null to an object located in young space
+     */
+    @Benchmark
+    public void youngPointingToImplicitNull() {
+        youngReference_region3.setReference(nullReferee);
+    }
+
+    /**
+     * Iterate and update over many old references to point to a young object.
+     * Since they are in different regions we will need to check the card, and
+     * since we will update many different reference in different memory
+     * locations/cards the card will need to be queued as no filtering will
+     * catch it.
+     */
+    @Benchmark
+    @OperationsPerInvocation(value = OLD_REFERENCES_LENGTH)
+    public void manyOldPointingToYoung() {
+        for (Holder oldReference : oldReferences) {
+            oldReference.setReference(youngReferee_region3);
+        }
+    }
+
+    /**
+     * Iterate and update over many old references to point to explicit null.
+     */
+    @Benchmark
+    @OperationsPerInvocation(value = OLD_REFERENCES_LENGTH)
+    public void manyOldPointingToExplicitNull() {
+        for (Holder oldReference : oldReferences) {
+            oldReference.setReference(null);
+        }
+    }
+
+    /**
+     * Iterate and update over many old references to point to implicit null.
+     */
+    @Benchmark
+    @OperationsPerInvocation(value = OLD_REFERENCES_LENGTH)
+    public void manyOldPointingToImplicitNull() {
+        for (Holder oldReference : oldReferences) {
+            oldReference.setReference(nullReferee);
+        }
+    }
+
+    /*
+     * Holder object for reference and padding
+     */
+    static class Holder {
+
+        private Object reference;
+        private final byte[] padding;
+
+        public Holder(Object reference) {
+            this(null, reference);
+        }
+
+        public Holder(byte[] padding, Object reference) {
+            this.padding = padding;
+            this.reference = reference;
+        }
+
+        public void setReference(Object reference) {
+            this.reference = reference;
+        }
+
+        public Object getReference() {
+            return this.reference;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/lang/reflect/GetMethods.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.lang.reflect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Warmup;
+
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Warmup(iterations = 5)
+@Measurement(iterations = 5)
+@Fork(jvmArgsAppend = {"-Xms1g", "-Xmx1g", "-Xmn768m", "-XX:+UseParallelGC"}, value = 5)
+public class GetMethods {
+
+    public static class InternalClass {
+
+        public InternalClass() {
+        }
+
+        @Override
+        public String toString() {
+            return InternalClass.class.getName();
+        }
+    }
+
+    /**
+     * Get the constructor through reflection on a class in the same classloader
+     *
+     * @return the constructor
+     * @throws NoSuchMethodException
+     */
+    @Benchmark
+    public Constructor<InternalClass> getConstructor() throws NoSuchMethodException {
+        return InternalClass.class.getConstructor();
+    }
+
+    /**
+     * Get the constructor through reflection on a class in a different classloader
+     *
+     * @return the constructor
+     * @throws NoSuchMethodException
+     */
+    @Benchmark
+    public Constructor<String> getConstructorDifferentClassLoader() throws NoSuchMethodException {
+        return String.class.getConstructor();
+    }
+
+    /**
+     * Get the toString method through reflection on a class in the same classloader
+     *
+     * @return the toString method
+     * @throws java.lang.NoSuchMethodException
+     */
+    @Benchmark
+    public Method getMethod() throws NoSuchMethodException {
+        return InternalClass.class.getMethod("toString");
+    }
+
+    /**
+     * Get the toString method through reflection on a class in a different classloader
+     *
+     * @return the toString method
+     * @throws NoSuchMethodException
+     */
+    @Benchmark
+    public Method getMethodDifferentClassLoader() throws NoSuchMethodException {
+        return String.class.getMethod("toString");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/lang/reflect/GetMethodsWithSecurityManager.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.lang.reflect;
+
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.security.Permission;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.micro.util.SecurityManagerHelper;
+
+/**
+ * Test performance of Reflection with a Security Manager enabled
+ */
+@State(Scope.Benchmark)
+public class GetMethodsWithSecurityManager extends GetMethods {
+
+    /**
+     * Extract and load the security.policy
+     *
+     * @throws IOException
+     * @throws NoSuchAlgorithmException
+     */
+    @Setup
+    public void setup() throws IOException, NoSuchAlgorithmException {
+        SecurityManagerHelper.setupSecurityManager(new Permission[0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/ArraysSort.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util;
+
+import java.util.Arrays;
+import java.util.Random;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+@State(Scope.Thread)
+public class ArraysSort {
+
+    private final Random srand = new Random(65536);
+
+    @Param({"9000", "16392", "65536", "10485760"})
+    private int size;
+
+    private byte[] array;
+
+    @Setup
+    public final void setup() {
+        array = new byte[size];
+    }
+
+    @Setup(Level.Invocation)
+    public final void randomize() {
+        srand.setSeed(65536);
+        srand.nextBytes(array);
+    }
+
+    @Benchmark
+    public void sortBytes() {
+        Arrays.sort(array);
+    }
+
+    @Benchmark
+    public void sortBytesParallel() {
+        Arrays.parallelSort(array);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/stream/IntegerSum.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.BinaryOperator;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+/**
+ * JMH Benchmark created to mimic a JSR-166 benchmark
+ */
+@State(Scope.Benchmark)
+public class IntegerSum {
+
+    @Param({"1", "10", "100", "1000", "10000", "100000", "1000000"})
+    private int size;
+
+    private ArrayList<Integer> arrayList;
+    private HashMap<Integer, Integer> hashMap;
+    private ConcurrentHashMap<Integer, Integer> concurrentHashMap;
+
+    private static final BinaryOperator<Integer> sum = (x, y) -> x + y;
+
+    @Setup
+    public final void setup() {
+        Random srand = new Random(9820239874L);
+        Set<Integer> set = new HashSet<>(size);
+        while (set.size() < size) {
+            set.add(srand.nextInt());
+        }
+        Integer[] values = set.toArray(new Integer[size]);
+        Integer[] keys = Arrays.copyOf(values, size);
+
+        for (int i = 0; i < size; i++) {
+            swap(values, i, srand.nextInt(values.length));
+            swap(keys, i, srand.nextInt(keys.length));
+        }
+
+        arrayList = new ArrayList<>(Arrays.asList(keys));
+        hashMap = new HashMap<>(size);
+        concurrentHashMap = new ConcurrentHashMap<>(size);
+        for (int i = 0; i < size; i++) {
+            hashMap.put(keys[i], values[i]);
+            concurrentHashMap.put(keys[i], values[i]);
+        }
+
+        System.gc();
+    }
+
+    private void swap(Integer[] array, int first, int second) {
+        Integer temp = array[first];
+        array[first] = array[second];
+        array[second] = temp;
+    }
+
+    @Benchmark
+    public Integer ArrayListStream() {
+        return arrayList.stream().reduce(0, sum);
+    }
+
+    @Benchmark
+    public Integer HashMapStream() {
+        return hashMap.keySet().stream().reduce(0, sum);
+    }
+
+    @Benchmark
+    public Integer ConcurrentHashMapStream() {
+        return concurrentHashMap.keySet().stream().reduce(0, sum);
+    }
+
+    @Benchmark
+    public Integer ArrayListParallelStream() {
+        return arrayList.parallelStream().reduce(0, sum);
+    }
+
+    @Benchmark
+    public Integer HashMapParallelStream() {
+        return hashMap.keySet().parallelStream().reduce(0, sum);
+    }
+
+    @Benchmark
+    public Integer ConcurrentHashMapParallelStream() {
+        return concurrentHashMap.keySet().parallelStream().reduce(0, sum);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/Adler32.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Setup;
+
+/**
+ * Benchmark for Adler32
+ *
+ */public class Adler32 extends ChecksumBenchmarks {
+
+    @Setup
+    final public void setupAdler32() {
+        this.checksum = new java.util.zip.Adler32();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Setup;
+
+/**
+ * Benchmark for CRC32
+ *
+ */public class CRC32 extends ChecksumBenchmarks {
+
+    @Setup
+    final public void setupCRC32() {
+        this.checksum = new java.util.zip.CRC32();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32C.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Setup;
+
+/**
+ * Benchmark for CRC32C
+ *
+ */
+public class CRC32C extends ChecksumBenchmarks {
+
+    @Setup
+    final public void setupCRC32C() {
+        this.checksum = new java.util.zip.CRC32C();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32CNoIntrinsic.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Fork;
+
+/**
+ * Benchmark for CRC32 that disables any CRC32C intrinstics
+ *
+ */
+@Fork(jvmArgs = {"-XX:-UseCRC32CIntrinsics"})
+public class CRC32CNoIntrinsic extends CRC32C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32CUnaligned.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Setup;
+
+/**
+ * Benchmark for CRC32C with unaligned accesses
+ *
+ */
+public class CRC32CUnaligned extends ChecksumUnalignedBenchmarks {
+
+    @Setup
+    final public void setupCRC32C() {
+        this.checksum = new java.util.zip.CRC32C();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32NoIntrinsic.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import org.openjdk.jmh.annotations.Fork;
+
+/**
+ * Benchmark for CRC32 that disables any CRC32 intrinstics
+ *
+ */
+@Fork(jvmArgs = {"-XX:-UseCRC32Intrinsics"})
+public class CRC32NoIntrinsic extends CRC32 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/ChecksumBenchmarks.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.zip.Checksum;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.OperationsPerInvocation;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+/**
+ *
+ * Base class for benchmarking JDK supported Checksums.
+ *
+ * To use the base class extend it and use a setup method configure the checksum
+ * field.
+ * 
+ */
+@State(Scope.Thread)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+public abstract class ChecksumBenchmarks {
+
+    private final byte[] bytes_1to9 = "123456789".getBytes(StandardCharsets.US_ASCII);
+    private final byte[] byteArray_1k = new byte[1024];
+    private final byte[] byteArray_64k = new byte[65536];
+    private final ByteBuffer wrappedByteBuffer_1k = ByteBuffer.wrap(byteArray_1k);
+    private final ByteBuffer readonlyByteBuffer_1k = ByteBuffer.wrap(byteArray_1k).asReadOnlyBuffer();
+    private final ByteBuffer directByteBuffer_1k = ByteBuffer.allocateDirect(byteArray_1k.length);
+    private final ByteBuffer wrappedByteBuffer_64k = ByteBuffer.wrap(byteArray_64k);
+    private final ByteBuffer readonlyByteBuffer_64k = ByteBuffer.wrap(byteArray_64k).asReadOnlyBuffer();
+    private final ByteBuffer directByteBuffer_64k = ByteBuffer.allocateDirect(byteArray_64k.length);
+
+    @Setup
+    final public void setup() {
+        Random r = new Random(123456789L);
+        r.nextBytes(byteArray_1k);
+        r.nextBytes(byteArray_64k);
+        directByteBuffer_1k.put(byteArray_1k);
+        directByteBuffer_64k.put(byteArray_64k);
+    }
+
+    protected Checksum checksum;
+
+    @Benchmark
+    @OperationsPerInvocation(9)
+    public void byteArray_9() {
+        checksum.update(bytes_1to9);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void byteArray_1K() {
+        checksum.update(byteArray_1k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void wrappedByteBuffer_1K() {
+        wrappedByteBuffer_1k.position(0);
+        checksum.update(wrappedByteBuffer_1k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void readonlyByteBuffer_1K() {
+        readonlyByteBuffer_1k.position(0);
+        checksum.update(readonlyByteBuffer_1k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void directByteBuffer_1K() {
+        directByteBuffer_1k.position(0);
+        checksum.update(directByteBuffer_1k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(65536)
+    public void byteArray_64K() {
+        checksum.update(byteArray_64k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(65536)
+    public void wrappedByteBuffer_64K() {
+        wrappedByteBuffer_64k.position(0);
+        checksum.update(wrappedByteBuffer_64k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(65536)
+    public void readonlyByteBuffer_64K() {
+        readonlyByteBuffer_64k.position(0);
+        checksum.update(readonlyByteBuffer_64k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(65536)
+    public void directByteBuffer_64K() {
+        directByteBuffer_64k.position(0);
+        checksum.update(directByteBuffer_64k);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/ChecksumUnalignedBenchmarks.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import java.nio.ByteBuffer;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.zip.Checksum;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.OperationsPerInvocation;
+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;
+
+/**
+ *
+ * Base class for benchmarking JDK supported Checksums with unaligned memory
+ * accesses.
+ *
+ * To use the base class extend it and use a setup method configure the checksum
+ * field.
+ *
+ */
+@State(Scope.Thread)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+public abstract class ChecksumUnalignedBenchmarks {
+
+    private final byte[] unalignedByteArray_1k = new byte[1034];
+    private final ByteBuffer unalignedWrappedByteBuffer_1k = ByteBuffer.wrap(unalignedByteArray_1k);
+    private final ByteBuffer unalignedDirectByteBuffer_1k = ByteBuffer.allocateDirect(unalignedByteArray_1k.length);
+
+    @Setup
+    final public void setup() {
+        Random r = new Random(123456789L);
+        r.nextBytes(unalignedByteArray_1k);
+        unalignedDirectByteBuffer_1k.put(unalignedByteArray_1k);
+    }
+
+    protected Checksum checksum;
+
+    @Param({"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"})
+    private int offset;
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void byteArray_1K() {
+        checksum.update(unalignedByteArray_1k, offset, 1024);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void wrappedByteBuffer_1K() {
+        unalignedWrappedByteBuffer_1k.position(offset);
+        unalignedWrappedByteBuffer_1k.limit(offset + 1024);
+        checksum.update(unalignedWrappedByteBuffer_1k);
+    }
+
+    @Benchmark
+    @OperationsPerInvocation(1024)
+    public void directByteBuffer_1K() {
+        unalignedDirectByteBuffer_1k.position(offset);
+        unalignedWrappedByteBuffer_1k.limit(offset + 1024);
+        checksum.update(unalignedDirectByteBuffer_1k);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/jdk/java/util/zip/ZipFileDecompression.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.jdk.java.util.zip;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+import org.openjdk.jmh.annotations.Benchmark;
+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.TearDown;
+
+/**
+ *
+ * @author sfriberg
+ */
+@State(Scope.Benchmark)
+public class ZipFileDecompression {
+
+    public static enum FILES {
+
+        small_txt,
+        large_txt,
+        very_large_txt,
+        small_class,
+        large_class,
+        large_bin,
+        stored_file;
+    }
+
+    @Param
+    private FILES compressedFile;
+
+    private ZipFile zipFile;
+
+    private final Map<FILES, byte[]> compressedFiles = new HashMap<>();
+
+    // Thread private reusable buffers
+    @State(Scope.Thread)
+    public static class ThreadLocalBuffers {
+
+        final byte[] bytes = new byte[10 * 1024 * 1024];
+    }
+
+    /**
+     * Create ZIP file used in benchmark
+     * 
+     * @throws IOException
+     */
+    @Setup
+    public void setup() throws IOException {
+
+        File file = File.createTempFile(this.getClass().getSimpleName(), ".zip");
+        file.deleteOnExit();
+
+        try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file));
+                ByteArrayOutputStream baos = new ByteArrayOutputStream(50 * text.length)) {
+
+            // Size of entries in bytes
+            //  small_txt      csize 264     size 445
+            //  large_txt      csize 282     size 2225
+            //  very_large_txt csize 399     size 22250
+            //  small_class    csize 418     size 982
+            //  large_class    csize 4351    size 7702
+            //  large_bin      csize 1048896 size 1048576
+            //  stored_file    csize 2053    size 2048
+            writeBytes(zos, FILES.small_txt, text);
+
+            for (int i = 0; i < 5; i++) {
+                baos.write(text);
+            }
+            writeBytes(zos, FILES.large_txt, baos.toByteArray());
+            baos.reset();
+
+            for (int i = 0; i < 50; i++) {
+                baos.write(text);
+            }
+            writeBytes(zos, FILES.very_large_txt, baos.toByteArray());
+            baos.reset();
+
+            writeBytes(zos, FILES.small_class, smallKlass);
+
+            writeBytes(zos, FILES.large_class, largeKlass);
+
+            byte[] largeBinBytes = new byte[1024 * 1024];
+            new Random(543210).nextBytes(largeBinBytes);
+            writeBytes(zos, FILES.large_bin, largeBinBytes);
+
+            // No compression on this entry
+            zos.setLevel(ZipOutputStream.STORED);
+            byte[] storedBytes = new byte[2 * 1024];
+            new Random(543210).nextBytes(storedBytes);
+            writeBytes(zos, FILES.stored_file, storedBytes);
+        }
+
+        zipFile = new ZipFile(file);
+
+        verifyZipFile();
+    }
+
+    private void writeBytes(ZipOutputStream zos, FILES file, byte[] bytes) throws IOException {
+        compressedFiles.put(file, bytes); // Save for verification
+        zos.putNextEntry(new ZipEntry(file.name()));
+        zos.write(bytes);
+        zos.closeEntry();
+    }
+
+    @TearDown
+    public void teardown() throws IOException {
+        verifyZipFile();
+        zipFile.close();
+    }
+
+    private void verifyZipFile() {
+        Enumeration<? extends ZipEntry> entries = zipFile.entries();
+        int count = 0;
+        while (entries.hasMoreElements()) {
+            ZipEntry entry = entries.nextElement();
+
+            try {
+                FILES filename = FILES.valueOf(entry.getName());
+                byte[] extractedFile = new byte[(int) entry.getSize()];
+                readFully(zipFile.getInputStream(entry), entry.getSize(), extractedFile);
+                if (!Arrays.equals(compressedFiles.get(filename), extractedFile)) {
+                    throw new IllegalStateException("Uncompressed file differs from file that was compressed file " + entry.getName());
+                }
+            } catch (IOException ex) {
+                throw new IllegalStateException("Error reading Zip " + zipFile.getName());
+            } catch (IllegalArgumentException ex) {
+                throw new IllegalStateException("Generated ZIP should not contain " + entry.getName());
+            }
+            count++;
+        }
+        if (count != FILES.values().length) {
+            throw new IllegalStateException("Generated ZIP file does not contain all expected files");
+        }
+    }
+
+    @Benchmark
+    public void zipEntryInputStream(ThreadLocalBuffers tbb) throws IOException {
+        ZipEntry entry = zipFile.getEntry(compressedFile.name());
+        readFully(zipFile.getInputStream(entry), entry.getSize(), tbb.bytes);
+    }
+
+    @Benchmark
+    public void jarURLEntryInputStream(ThreadLocalBuffers tbb) throws IOException {
+        URL url = new URL("jar:file:" + zipFile.getName() + "!/" + compressedFile.name());
+        JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
+        readFully(jarConnection.getInputStream(), jarConnection.getContentLengthLong(), tbb.bytes);
+    }
+
+    private int readFully(InputStream stream, long len, byte[] bytes) throws IOException {
+        if (len > bytes.length) {
+            throw new IllegalStateException("byte[] too small to read stream");
+        }
+        int nread = 0, n = 0;
+        while (nread < len && (n = stream.read(bytes, nread, bytes.length - nread)) > 0) {
+            nread += n;
+        }
+        return nread;
+    }
+
+    // Data for ZIP file creation
+    private final byte[] text
+            = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "
+            + "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis "
+            + "nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
+            + "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore "
+            + "eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt "
+            + "in culpa qui officia deserunt mollit anim id est laborum.").getBytes();
+    private final byte[] smallKlass = Base64.getDecoder().decode(
+            "yv66vgAAADQAJgcAIgcAIwcAJAEAA2FkZAEAFShMamF2YS9sYW5nL09iamVjdDspWgEACVNpZ25h"
+            + "dHVyZQEABihURTspWgEABW9mZmVyAQADcHV0AQAVKExqYXZhL2xhbmcvT2JqZWN0OylWAQAKRXhj"
+            + "ZXB0aW9ucwcAJQEABihURTspVgEANShMamF2YS9sYW5nL09iamVjdDtKTGphdmEvdXRpbC9jb25j"
+            + "dXJyZW50L1RpbWVVbml0OylaAQAmKFRFO0pMamF2YS91dGlsL2NvbmN1cnJlbnQvVGltZVVuaXQ7"
+            + "KVoBAAR0YWtlAQAUKClMamF2YS9sYW5nL09iamVjdDsBAAUoKVRFOwEABHBvbGwBADQoSkxqYXZh"
+            + "L3V0aWwvY29uY3VycmVudC9UaW1lVW5pdDspTGphdmEvbGFuZy9PYmplY3Q7AQAlKEpMamF2YS91"
+            + "dGlsL2NvbmN1cnJlbnQvVGltZVVuaXQ7KVRFOwEAEXJlbWFpbmluZ0NhcGFjaXR5AQADKClJAQAG"
+            + "cmVtb3ZlAQAIY29udGFpbnMBAAdkcmFpblRvAQAZKExqYXZhL3V0aWwvQ29sbGVjdGlvbjspSQEA"
+            + "HyhMamF2YS91dGlsL0NvbGxlY3Rpb248LVRFOz47KUkBABooTGphdmEvdXRpbC9Db2xsZWN0aW9u"
+            + "O0kpSQEAIChMamF2YS91dGlsL0NvbGxlY3Rpb248LVRFOz47SSlJAQA+PEU6TGphdmEvbGFuZy9P"
+            + "YmplY3Q7PkxqYXZhL2xhbmcvT2JqZWN0O0xqYXZhL3V0aWwvUXVldWU8VEU7PjsBAApTb3VyY2VG"
+            + "aWxlAQASQmxvY2tpbmdRdWV1ZS5qYXZhAQAiamF2YS91dGlsL2NvbmN1cnJlbnQvQmxvY2tpbmdR"
+            + "dWV1ZQEAEGphdmEvbGFuZy9PYmplY3QBAA9qYXZhL3V0aWwvUXVldWUBAB5qYXZhL2xhbmcvSW50"
+            + "ZXJydXB0ZWRFeGNlcHRpb24GAQABAAIAAQADAAAACwQBAAQABQABAAYAAAACAAcEAQAIAAUAAQAG"
+            + "AAAAAgAHBAEACQAKAAIACwAAAAQAAQAMAAYAAAACAA0EAQAIAA4AAgALAAAABAABAAwABgAAAAIA"
+            + "DwQBABAAEQACAAsAAAAEAAEADAAGAAAAAgASBAEAEwAUAAIACwAAAAQAAQAMAAYAAAACABUEAQAW"
+            + "ABcAAAQBABgABQAABAEAGQAFAAAEAQAaABsAAQAGAAAAAgAcBAEAGgAdAAEABgAAAAIAHgACAAYA"
+            + "AAACAB8AIAAAAAIAIQ==");
+    private final byte[] largeKlass = Base64.getDecoder().decode(
+            "yv66vgAAADQBWAoAngDvBwDwCgACAPEKAAIA8gcA8woAAgD0CgACAPUKAAUA9goAAgD3A4AAAAAK"
+            + "AAUA+AoABQD5CgACAPoKAPsA8QoAAgD8CgAFAP0KAAUA/goABQD/Bf/////////kCgACAQAKAAIB"
+            + "AQoAAgECCgAFAQMKAAUBBAoAAgEFCgAFAQYKAPsBBwoA+wEICgD7AQkFAAAAAAAAAAwFAAAAAAAA"
+            + "AA0HAQoHAQsKACQA7wgBDAoAJAENCgAkAQ4KACQBDwoAIwEQCQAFAREKAPsA8goA+wD0CgAFARIJ"
+            + "AAUBEwkABQEUCgACARUKAAIBFgkABQEXCgACARgFAAAAAAAAAW0FAAAAAAAAAAQFAAAAAAAAAGQF"
+            + "AAAAAAAAAZAKARkBGgoBGQEbBQAAAAAAAAACCgACARwKAAIBHQoABQEeBQAAAAAAAAAfBQAAAAAA"
+            + "AAAcCgAFAR8JAAUBIAcBIQgBIgoASgEjCgACAQcKAAUBJAUAAAAAAAAABwoBGQElBQAAAAAAAjqx"
+            + "AwAAjqwKARkBJgoBGQEnCgEoASkDAAr5OwMACvqoAwAK/BUDAAr9gwMACv7wAwALAF0DAAsBygMA"
+            + "CwM4AwALBKUDAAsGEgMACwd/AwALCO0DAAsKWgMACwvHAwALDTQDAAsOogMACxAPAwALEXwDAAsS"
+            + "6QMACxRXAwALFcQDAAsXMQMACxieAwALGgwDAAsbeQMACxzmAwALHlMDAAsfwQMACyEuAwALIpsD"
+            + "AAskCAMACyV2AwALJuMDAAsoUAMACym9AwALKysDAAssmAMACy4FAwALL3IDAAsw4AMACzJNAwAL"
+            + "M7oDAAs1JwMACzaVAwALOAIDAAs5bwMACzrcAwALPEoDAAs9twMACz8kAwALQJEDAAtB/wMAC0Ns"
+            + "AwALRNkDAAtGRgMAC0e0AwALSSEDAAtKjgMAC0v7AwALTWkDAAtO1gMAC1BDAwALUbADAAtTHgMA"
+            + "C1SLAwALVfgDAAtXZQMAC1jTAwALWkADAAtbrQcBKgEABERhdGUBAAxJbm5lckNsYXNzZXMBAAdK"
+            + "QU5VQVJZAQABSQEADUNvbnN0YW50VmFsdWUDAAAAAQEACEZFQlJVQVJZAwAAAAIBAAVNQVJDSAMA"
+            + "AAADAQAFQVBSSUwDAAAABAEAA01BWQMAAAAFAQAESlVORQMAAAAGAQAESlVMWQMAAAAHAQAGQVVH"
+            + "VVNUAwAAAAgBAAlTRVBURU1CRVIDAAAACQEAB09DVE9CRVIDAAAACgEACE5PVkVNQkVSAwAAAAsB"
+            + "AAhERUNFTUJFUgMAAAAMAQAGU1VOREFZAQAGTU9OREFZAQAHVFVFU0RBWQEACVdFRE5FU0RBWQEA"
+            + "CFRIVVJTREFZAQAGRlJJREFZAQAIU0FUVVJEQVkBAAlCQVNFX1lFQVIDAAAHsgEAC0ZJWEVEX0RB"
+            + "VEVTAQACW0kBAA1EQVlTX0lOX01PTlRIAQAZQUNDVU1VTEFURURfREFZU19JTl9NT05USAEAHkFD"
+            + "Q1VNVUxBVEVEX0RBWVNfSU5fTU9OVEhfTEVBUAEAEyRhc3NlcnRpb25zRGlzYWJsZWQBAAFaAQAG"
+            + "PGluaXQ+AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJUYWJsZQEACHZhbGlkYXRlAQAjKExzdW4v"
+            + "dXRpbC9jYWxlbmRhci9DYWxlbmRhckRhdGU7KVoBAA1TdGFja01hcFRhYmxlBwDwAQAJbm9ybWFs"
+            + "aXplBwErBwDzBwEsAQAObm9ybWFsaXplTW9udGgBACMoTHN1bi91dGlsL2NhbGVuZGFyL0NhbGVu"
+            + "ZGFyRGF0ZTspVgEADWdldFllYXJMZW5ndGgBACMoTHN1bi91dGlsL2NhbGVuZGFyL0NhbGVuZGFy"
+            + "RGF0ZTspSQEAFWdldFllYXJMZW5ndGhJbk1vbnRocwEADmdldE1vbnRoTGVuZ3RoAQAFKElJKUkB"
+            + "AAxnZXREYXlPZlllYXIBACMoTHN1bi91dGlsL2NhbGVuZGFyL0NhbGVuZGFyRGF0ZTspSgEABihJ"
+            + "SUkpSgEADGdldEZpeGVkRGF0ZQEAKyhJSUlMc3VuL3V0aWwvY2FsZW5kYXIvQmFzZUNhbGVuZGFy"
+            + "JERhdGU7KUoBABxnZXRDYWxlbmRhckRhdGVGcm9tRml4ZWREYXRlAQAkKExzdW4vdXRpbC9jYWxl"
+            + "bmRhci9DYWxlbmRhckRhdGU7SilWAQAMZ2V0RGF5T2ZXZWVrAQAZZ2V0RGF5T2ZXZWVrRnJvbUZp"
+            + "eGVkRGF0ZQEABChKKUkBABRnZXRZZWFyRnJvbUZpeGVkRGF0ZQEAHWdldEdyZWdvcmlhblllYXJG"
+            + "cm9tRml4ZWREYXRlAQAKaXNMZWFwWWVhcgEABChJKVoBAAg8Y2xpbml0PgEAClNvdXJjZUZpbGUB"
+            + "ABFCYXNlQ2FsZW5kYXIuamF2YQwAywDMAQAjc3VuL3V0aWwvY2FsZW5kYXIvQmFzZUNhbGVuZGFy"
+            + "JERhdGUMAS0BLgwBLwEwAQAec3VuL3V0aWwvY2FsZW5kYXIvQmFzZUNhbGVuZGFyDAExATAMATIB"
+            + "MAwA3ADdDADlATAMAOUA2gwBMwDQDAE0ATUHASwMATYBNwwBOADfDAE5ANoMANcA2AwBOgE7DAE8"
+            + "AT0MAT4BOwwA4QDiDADjAOQMAT8BPQwA6gDrDAFAATUMAUEBPQwBQgE9AQAiamF2YS9sYW5nL0ls"
+            + "bGVnYWxBcmd1bWVudEV4Y2VwdGlvbgEAF2phdmEvbGFuZy9TdHJpbmdCdWlsZGVyAQAVSWxsZWdh"
+            + "bCBtb250aCB2YWx1ZTogDAFDAUQMAUMBRQwBRgFHDADLAUgMAMYAxQwA3gDgDADIAMUMAMcAxQwB"
+            + "SQDrDAFKAUsMAMQAxQwBTAFNBwFODAFPAVAMAU8A3QwBSQFRDAFSATAMAOkA5wwA5gDnDADJAMoB"
+            + "ABhqYXZhL2xhbmcvQXNzZXJ0aW9uRXJyb3IBABVuZWdhdGl2ZSBkYXkgb2Ygd2VlayAMAMsBUwwA"
+            + "4QDfDAFUAVAMAVQA3QwBVQDrBwFWDAFXAS4BACJzdW4vdXRpbC9jYWxlbmRhci9BYnN0cmFjdENh"
+            + "bGVuZGFyAQASamF2YS91dGlsL1RpbWVab25lAQAec3VuL3V0aWwvY2FsZW5kYXIvQ2FsZW5kYXJE"
+            + "YXRlAQAMaXNOb3JtYWxpemVkAQADKClaAQAIZ2V0TW9udGgBAAMoKUkBAA1nZXREYXlPZk1vbnRo"
+            + "AQARZ2V0Tm9ybWFsaXplZFllYXIBAAx2YWxpZGF0ZVRpbWUBAA1zZXROb3JtYWxpemVkAQAEKFop"
+            + "VgEAB2dldFpvbmUBABYoKUxqYXZhL3V0aWwvVGltZVpvbmU7AQAHZ2V0VGltZQEADW5vcm1hbGl6"
+            + "ZVRpbWUBAA1zZXREYXlPZk1vbnRoAQAjKEkpTHN1bi91dGlsL2NhbGVuZGFyL0NhbGVuZGFyRGF0"
+            + "ZTsBABFzZXROb3JtYWxpemVkWWVhcgEABChJKVYBAAhzZXRNb250aAEADHNldERheU9mV2VlawEA"
+            + "C3NldExlYXBZZWFyAQANc2V0Wm9uZU9mZnNldAEAEXNldERheWxpZ2h0U2F2aW5nAQAGYXBwZW5k"
+            + "AQAtKExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5nL1N0cmluZ0J1aWxkZXI7AQAcKEkpTGph"
+            + "dmEvbGFuZy9TdHJpbmdCdWlsZGVyOwEACHRvU3RyaW5nAQAUKClMamF2YS9sYW5nL1N0cmluZzsB"
+            + "ABUoTGphdmEvbGFuZy9TdHJpbmc7KVYBAANoaXQBAA1nZXRDYWNoZWRKYW4xAQADKClKAQAIc2V0"
+            + "Q2FjaGUBAAYoSUpJKVYBAB9zdW4vdXRpbC9jYWxlbmRhci9DYWxlbmRhclV0aWxzAQALZmxvb3JE"
+            + "aXZpZGUBAAUoSkopSgEABChKKVoBAA1nZXRDYWNoZWRZZWFyAQAVKExqYXZhL2xhbmcvT2JqZWN0"
+            + "OylWAQADbW9kAQATaXNHcmVnb3JpYW5MZWFwWWVhcgEAD2phdmEvbGFuZy9DbGFzcwEAFmRlc2ly"
+            + "ZWRBc3NlcnRpb25TdGF0dXMEIQAFAJ4AAAAZABkAoQCiAAEAowAAAAIApAAZAKUAogABAKMAAAAC"
+            + "AKYAGQCnAKIAAQCjAAAAAgCoABkAqQCiAAEAowAAAAIAqgAZAKsAogABAKMAAAACAKwAGQCtAKIA"
+            + "AQCjAAAAAgCuABkArwCiAAEAowAAAAIAsAAZALEAogABAKMAAAACALIAGQCzAKIAAQCjAAAAAgC0"
+            + "ABkAtQCiAAEAowAAAAIAtgAZALcAogABAKMAAAACALgAGQC5AKIAAQCjAAAAAgC6ABkAuwCiAAEA"
+            + "owAAAAIApAAZALwAogABAKMAAAACAKYAGQC9AKIAAQCjAAAAAgCoABkAvgCiAAEAowAAAAIAqgAZ"
+            + "AL8AogABAKMAAAACAKwAGQDAAKIAAQCjAAAAAgCuABkAwQCiAAEAowAAAAIAsAAaAMIAogABAKMA"
+            + "AAACAMMAGgDEAMUAAAAYAMYAxQAAABgAxwDFAAAAGADIAMUAABAYAMkAygAAABQAAQDLAMwAAQDN"
+            + "AAAAIQABAAEAAAAFKrcAAbEAAAABAM4AAAAKAAIAAAAnAAQAjwABAM8A0AABAM0AAADWAAQABgAA"
+            + "AGUrwAACTSy2AAOZAAUErCy2AAQ+HQShAAkdEAykAAUDrCy2AAY2BBUEngARFQQqLLYABx23AAik"
+            + "AAUDrCy2AAk2BRUFEgqfAA8VBSostgALnwAFA6wqK7YADJoABQOsLAS2AA0ErAAAAAIAzgAAAEIA"
+            + "EAAAAMAABQDBAAwAwgAOAMQAEwDFAB4AxgAgAMgAJgDJADkAygA7AMwAQQDNAFIAzgBUANEAXADS"
+            + "AF4A1QBjANYA0QAAABcAB/wADgcA0vwADwEB/AAYAQH8ABgBCQABANMA0AABAM0AAAIJAAcADAAA"
+            + "ASkrtgAOmQAFBKwrwAACTSy2AA9OLcYACyortgAQWASsKiy2ABE2BCostgASLLYABoUVBIVhNwUs"
+            + "tgAENgcstgAHNggqFQgVB7cACDYJFgUJlJ4ADBYFFQmFlJ4AqhYFCZSdAEQWBRQAE5SeADsqFQiE"
+            + "B/8VB7cACDYJFgUVCYVhNwUsFgWItgAVVxUHmgAPEAw2BywVCARktgAWLBUHtgAXV6cAaxYFFQmF"
+            + "lJ4APhYFFQkQHGCFlJwAMhYFFQmFZTcFhAcBLBYFiLYAFVcVBxAMpAAOLBUIBGC2ABYENgcsFQe2"
+            + "ABdXpwAnFgUqFQgVBwQstgAYYQplNwoqLBYKtgAZpwAMLCostgALtgAaKyostgAHtgAbtgAcKwO2"
+            + "AB0rA7YAHiwEtgANBKwAAAACAM4AAACeACcAAADaAAcA2wAJAN4ADgDfABMA4wAXAOQAHQDlAB8A"
+            + "6AAmAOkAKwDqADYA6wA8AOwAQgDtAEwA7wBcAPAAbADxAHkA8gCBAPMAiQD0AI4A9QCSAPYAmgD4"
+            + "AKQA+QC5APoAwQD7AMQA/ADMAP0A0wD+ANsA/wDeAQEA6AEDAPkBBAEAAQUBAwEHAQwBCQEYAQoB"
+            + "HQELASIBDAEnAQ0A0QAAACoACQn9ABUHANIHANT/ADwACQcA1QcA1gcA0gcA1AEEAQEBAAA9CTkJ"
+            + "GggAAADXANgAAQDNAAAA1gAGAAgAAAB1K8AAAk0stgAHPiy2AASFNwQWBAmUnQAxChYEZTcGHRYG"
+            + "FAAfbQphiGQ+FAAhFgYUAB9xZTcELB22ABYsFgSItgAXV6cAMRYEFAAflJ4AKB0WBAplFAAfbYhg"
+            + "PhYECmUUAB9xCmE3BCwdtgAWLBYEiLYAF1exAAAAAgDOAAAAPgAPAAABEQAFARIACgETABEBFAAY"
+            + "ARUAHgEWACoBFwA2ARgAOwEZAEMBGgBPARsAWwEcAGcBHQBsAR4AdAEgANEAAAALAAL+AEYHANIB"
+            + "BC0AAQDZANoAAQDNAAAAOwACAAIAAAAYKivAAAK2AAe2ABuZAAkRAW6nAAYRAW2sAAAAAgDOAAAA"
+            + "BgABAAABLwDRAAAABQACFEIBAAEA2wDaAAEAzQAAABsAAQACAAAAAxAMrAAAAAEAzgAAAAYAAQAA"
+            + "ATMAAQDcANoAAQDNAAAAcgAEAAQAAAA6K8AAAk0stgAEPh0EoQAJHRAMpAAeuwAjWbsAJFm3ACUS"
+            + "JrYAJx22ACi2ACm3ACq/Kiy2AAcdtwAIrAAAAAIAzgAAABYABQAAAUIABQFDAAoBRAAVAUUAMAFH"
+            + "ANEAAAAKAAL9ABUHANIBGgACANwA3QABAM0AAABIAAIABAAAABiyACscLj4cBaAADiobtgAbmQAG"
+            + "hAMBHawAAAACAM4AAAASAAQAAAFMAAYBTQATAU4AFgFQANEAAAAGAAH8ABYBAAEA3gDfAAEAzQAA"
+            + "ADgABAACAAAAFCorwAACtgAHK7YALCu2AC22AC6tAAAAAQDOAAAAEgAEAAABVAAJAVUADQFWABAB"
+            + "VAAQAN4A4AABAM0AAABPAAQABAAAABodhSobtgAbmQALsgAvHC6nAAiyADAcLoVhrQAAAAIAzgAA"
+            + "AAoAAgAAAVoABAFbANEAAAATAAJSBP8ABAAEBwDVAQEBAAIEAQABAOEA3wABAM0AAABZAAUAAgAA"
+            + "ACQrtgAOmgAIKiu2ABIqK8AAArYAByu2ACwrtgAtK8AAArYAGK0AAAACAM4AAAAaAAYAAAFhAAcB"
+            + "YgAMAWQAFQFlABkBZgAgAWQA0QAAAAMAAQwAAQDhAOIAAQDNAAACVwAIAAsAAAFEHASgAAwdBKAA"
+            + "BwSnAAQDNgUZBMYAJxkEG7YAMZkAHhUFmQAJGQS2ADKtGQS2ADIqGxwdtgAuYQplrRsRB7JkNgYV"
+            + "BpsAShUGsgAzvqIAQbIAMxUGLoU3BxkExgAcGQQbFgcqG7YAG5kACREBbqcABhEBbbYANBUFmQAI"
+            + "FgenAA8WByobHB22AC5hCmWtG4UKZTcHHYU3CRYHCZSbADQWCRQANRYHaRYHFAA3bWEWBxQAOW1l"
+            + "FgcUADttYREBbxxoEQFqZBAMbIVhYTcJpwA5FgkUADUWB2kWBxQAN7gAPWEWBxQAObgAPWUWBxQA"
+            + "O7gAPWERAW8caBEBamQQDLgAPoVhYTcJHAWkABcWCSobtgAbmQAHCqcABhQAP2U3CRkExgAhFQWZ"
+            + "ABwZBBsWCSobtgAbmQAJEQFupwAGEQFttgA0FgmtAAAAAgDOAAAAZgAZAAABbAARAW8AHwFwACQB"
+            + "cQAqAXMAOgF3AEEBeABPAXkAWAF6AF0BewB2AX0AjQGAAJMBgQCXAYMAngGEAM8BigDcAYsA5QGM"
+            + "AO4BjQD9AY4BBQGRAQoBkgEeAZYBKAGXAUEBmgDRAAAAlQASDkAB/AAaAQ//ADUACAcA1QEBAQcA"
+            + "0gEBBAADBwDSAQT/AAIACAcA1QEBAQcA0gEBBAAEBwDSAQQBAglLBPoAAP0AQQQENVIE/wACAAkH"
+            + "ANUBAQEHANIBAQQEAAIEBAL/ABwACQcA1QEBAQcA0gEBBAQAAwcA0gEE/wACAAkHANUBAQEHANIB"
+            + "AQQEAAQHANIBBAECAAEA4wDkAAEAzQAAAjUABQARAAABMSvAAAI6BBkEILYAQZkAHBkEtgBCNgUZ"
+            + "BLYAMjcGKhUFtgAbNginADQqILYAQzYFKhUFBAQBtgAYNwYqFQW2ABs2CBkEFQUWBhUImQAJEQFu"
+            + "pwAGEQFttgA0IBYGZYg2CRYGFABEYRQARmE3ChUImQAJFgoKYTcKIBYKlJsAEhUJFQiZAAcEpwAE"
+            + "BWA2CRAMFQloEQF1YDYMFQyeAA4VDBEBb2w2DKcADRUMEQFvuAA+NgwWBrIAMBUMLoVhNw0VCJkA"
+            + "DxUMBqEACRYNCmE3DSAWDWWIBGA2DyC4AEg2ELIASZoAJBUQnQAfuwBKWbsAJFm3ACUSS7YAJxUQ"
+            + "tgAotgAptwBMvxkEFQW2ABYZBBUMtgAXVxkEFQ+2ABVXGQQVELYAGhkEFQi2AE0ZBAS2AA2xAAAA"
+            + "AgDOAAAAggAgAAABpAAGAagADwGpABYBqgAdAasAKAGwAC8BsQA6AbIAQgG0AFkBtwBgAbgAbAG5"
+            + "AHEBugB3AbwAfgG9AI0BvwCYAcAAnQHBAKgBwwCyAcUAvgHGAMkBxwDPAckA2AHKAN4BywEFAcwB"
+            + "DAHNARQBzgEcAc8BIwHQASoB0QEwAdIA0QAAAGoADPwAKAcA0v8AKgAHBwDVBwDWBAcA0gEEAQAD"
+            + "BwDSAQT/AAIABwcA1QcA1gQHANIBBAEABAcA0gEEAQL9AB0BBFEB/wAAAAkHANUHANYEBwDSAQQB"
+            + "AQQAAgEBAvwAGgEJ/AAcBP0ANQEBAAEA5QDaAAEAzQAAACcAAgAEAAAACyortgBOQSC4AEisAAAA"
+            + "AQDOAAAACgACAAAB2AAGAdkAGQDmAOcAAQDNAAAAQwAEAAIAAAAaHgmUmwAMHhQAT3GIBGCsHhQA"
+            + "T7gAUYgEYKwAAAACAM4AAAAOAAMAAAHeAAYB3wAPAeEA0QAAAAMAAQ8AAQDoAOcAAQDNAAAAHgAD"
+            + "AAMAAAAGKh+2AEOsAAAAAQDOAAAABgABAAAB5QAQAOkA5wABAM0AAAFcAAQADgAAAMkfCZSeAEof"
+            + "CmVCIRQAUm2INgkhFABScYg2BRUFElRsNgoVBRJUcDYGFQYRBbVsNgsVBhEFtXA2BxUHEQFtbDYM"
+            + "FQcRAW1wBGA2CKcAVx8KZUIhFABSuAA9iDYJIRQAUrgAUYg2BRUFElS4AD42ChUFElS4AFU2BhUG"
+            + "EQW1uAA+NgsVBhEFtbgAVTYHFQcRAW24AD42DBUHEQFtuABVBGA2CBEBkBUJaBBkFQpoYAcVC2hg"
+            + "FQxgNg0VCgefAAwVDAefAAaEDQEVDawAAAACAM4AAABeABcAAAHxAAYB8gAKAfMAEgH0ABoB9QAh"
+            + "AfYAKAH3ADAB+AA4AfkAQAH6AE0B/ABRAf0AWwH+AGUB/wBuAgAAdwIBAIECAgCLAgMAlQIEAKEC"
+            + "BgC3AgcAwwIIAMYCCgDRAAAAHQAD+wBN/wBTAAsHANUEBAEBAQEBAQEBAAD8ACQBAAQA6gDQAAEA"
+            + "zQAAACQAAgACAAAADCorwAACtgAHtgAbrAAAAAEAzgAAAAYAAQAAAhMAAADqAOsAAQDNAAAAHQAB"
+            + "AAIAAAAFG7gAVqwAAAABAM4AAAAGAAEAAAIXAAgA7ADMAAEAzQAAAuIABAAAAAACrxIFtgBXmgAH"
+            + "BKcABAOzAEkQRrwKWQMSWE9ZBBJZT1kFElpPWQYSW09ZBxJcT1kIEl1PWRAGEl5PWRAHEl9PWRAI"
+            + "EmBPWRAJEmFPWRAKEmJPWRALEmNPWRAMEmRPWRANEmVPWRAOEmZPWRAPEmdPWRAQEmhPWRAREmlP"
+            + "WRASEmpPWRATEmtPWRAUEmxPWRAVEm1PWRAWEm5PWRAXEm9PWRAYEnBPWRAZEnFPWRAaEnJPWRAb"
+            + "EnNPWRAcEnRPWRAdEnVPWRAeEnZPWRAfEndPWRAgEnhPWRAhEnlPWRAiEnpPWRAjEntPWRAkEnxP"
+            + "WRAlEn1PWRAmEn5PWRAnEn9PWRAoEoBPWRApEoFPWRAqEoJPWRArEoNPWRAsEoRPWRAtEoVPWRAu"
+            + "EoZPWRAvEodPWRAwEohPWRAxEolPWRAyEopPWRAzEotPWRA0EoxPWRA1Eo1PWRA2Eo5PWRA3Eo9P"
+            + "WRA4EpBPWRA5EpFPWRA6EpJPWRA7EpNPWRA8EpRPWRA9EpVPWRA+EpZPWRA/EpdPWRBAEphPWRBB"
+            + "EplPWRBCEppPWRBDEptPWRBEEpxPWRBFEp1PswAzEA28ClkDEB9PWQQQH09ZBRAcT1kGEB9PWQcQ"
+            + "Hk9ZCBAfT1kQBhAeT1kQBxAfT1kQCBAfT1kQCRAeT1kQChAfT1kQCxAeT1kQDBAfT7MAKxANvApZ"
+            + "AxDiT1kEA09ZBRAfT1kGEDtPWQcQWk9ZCBB4T1kQBhEAl09ZEAcRALVPWRAIEQDUT1kQCREA809Z"
+            + "EAoRARFPWRALEQEwT1kQDBEBTk+zADAQDbwKWQMQ4k9ZBANPWQUQH09ZBhA8T1kHEFtPWQgQeU9Z"
+            + "EAYRAJhPWRAHEQC2T1kQCBEA1U9ZEAkRAPRPWRAKEQEST1kQCxEBMU9ZEAwRAU9PswAvsQAAAAIA"
+            + "zgAAABYABQAAACcAEABGAbUBNgIEATkCWQE9ANEAAAAFAAIMQAEAAgDtAAAAAgDuAKAAAAAKAAEA"
+            + "AgAFAJ8ECQ==");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/util/SecurityManagerHelper.java	Thu Oct 04 16:01:19 2018 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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 org.openjdk.micro.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URI;
+import java.security.NoSuchAlgorithmException;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.URIParameter;
+
+/**
+ * Help class to create and load Security Policy file from a set of Permissions
+ */
+public class SecurityManagerHelper {
+
+    /**
+     * Create and load a security manager using the provided permissions.
+     *
+     * @param perms Permissions to add to the file
+     *
+     * @throws IOException If file could not be created or written to.
+     * @throws NoSuchAlgorithmException if no Provider supports a PolicySpi
+     * implementation for the specified type.
+     */
+    public static void setupSecurityManager(Permission... perms)
+            throws IOException, NoSuchAlgorithmException {
+
+        URI policyURI = createSecurityFile(perms);
+        Policy.setPolicy(Policy.getInstance("JavaPolicy", new URIParameter(policyURI)));
+        System.setSecurityManager(new SecurityManager());
+    }
+
+    private static URI createSecurityFile(Permission... perms) throws IOException {
+
+        File policyFile = File.createTempFile("security", ".policy");
+        policyFile.deleteOnExit();
+
+        try (PrintStream writer = new PrintStream(policyFile)) {
+            writer.println("grant {");
+            for (Permission p : perms) {
+                appendPermission(writer, p);
+            }
+            // Permissions required by JMH
+            appendPermission(writer, new RuntimePermission("modifyThread"));
+            // Required when running without forking
+//            appendPermission(writer, new RuntimePermission("accessDeclaredMembers"));
+//            appendPermission(writer, new RuntimePermission("createSecurityManager"));
+//            appendPermission(writer, new ReflectPermission("suppressAccessChecks"));
+//            appendPermission(writer, new ManagementPermission("monitor"));
+//            appendPermission(writer, new PropertyPermission("jmh.scorePrecision", "read"));
+            writer.println("};");
+        }
+
+        return policyFile.toURI();
+    }
+
+    private static void appendPermission(PrintStream writer, Permission p) {
+        writer.printf("\tpermission %s \"%s\", \"%s\";\n",
+                      p.getClass().getName(), p.getName(), p.getActions());
+    }
+}