Reorganize micro sources JEP-230-microbenchmarks-branch
authorredestad
Tue, 02 Oct 2018 11:53:46 +0200
branchJEP-230-microbenchmarks-branch
changeset 56913 013359fdfeb2
parent 56909 7cf3051d8572
child 56914 796f76953273
Reorganize micro sources
make/BuildMicrobenchmark.gmk
test/micro/org/openjdk/micro/hotspot/gc/g1/WriteBarrier.java
test/micro/org/openjdk/micro/jdk/java/lang/reflect/GetMethods.java
test/micro/org/openjdk/micro/jdk/java/lang/reflect/GetMethodsWithSecurityManager.java
test/micro/org/openjdk/micro/jdk/java/util/ArraysSort.java
test/micro/org/openjdk/micro/jdk/java/util/stream/IntegerSum.java
test/micro/org/openjdk/micro/jdk/java/util/zip/Adler32.java
test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32.java
test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32C.java
test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32CNoIntrinsic.java
test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32CUnaligned.java
test/micro/org/openjdk/micro/jdk/java/util/zip/CRC32NoIntrinsic.java
test/micro/org/openjdk/micro/jdk/java/util/zip/ChecksumBenchmarks.java
test/micro/org/openjdk/micro/jdk/java/util/zip/ChecksumUnalignedBenchmarks.java
test/micro/org/openjdk/micro/jdk/java/util/zip/ZipFileDecompression.java
test/micro/org/openjdk/micro/util/SecurityManagerHelper.java
test/micro/src/classes/org/openjdk/micro/hotspot/gc/g1/WriteBarrier.java
test/micro/src/classes/org/openjdk/micro/jdk/java/lang/reflect/GetMethods.java
test/micro/src/classes/org/openjdk/micro/jdk/java/lang/reflect/GetMethodsWithSecurityManager.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/ArraysSort.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/stream/IntegerSum.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/Adler32.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32C.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32CNoIntrinsic.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32CUnaligned.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32NoIntrinsic.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ChecksumBenchmarks.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ChecksumUnalignedBenchmarks.java
test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ZipFileDecompression.java
test/micro/src/classes/org/openjdk/micro/util/SecurityManagerHelper.java
--- a/make/BuildMicrobenchmark.gmk	Fri Sep 28 15:32:29 2018 +0200
+++ b/make/BuildMicrobenchmark.gmk	Tue Oct 02 11:53:46 2018 +0200
@@ -38,7 +38,7 @@
 
 #### Variables
 
-MICROBENCHMARK_SRC := $(TOPDIR)/test/micro/src/classes
+MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
 MICROBENCHMARK_JAR := $(IMAGES_OUTPUTDIR)/test/micro/microbenchmarks.jar
 
 MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/micro/hotspot/gc/g1/WriteBarrier.java	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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	Tue Oct 02 11:53:46 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());
+    }
+}
--- a/test/micro/src/classes/org/openjdk/micro/hotspot/gc/g1/WriteBarrier.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-/*
- * 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;
-        }
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/lang/reflect/GetMethods.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * 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");
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/lang/reflect/GetMethodsWithSecurityManager.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * 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]);
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/ArraysSort.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * 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);
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/stream/IntegerSum.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * 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);
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/Adler32.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * 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();
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * 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();
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32C.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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();
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32CNoIntrinsic.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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 {
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32CUnaligned.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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();
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/CRC32NoIntrinsic.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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 {
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ChecksumBenchmarks.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * 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);
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ChecksumUnalignedBenchmarks.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * 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);
-    }
-}
--- a/test/micro/src/classes/org/openjdk/micro/jdk/java/util/zip/ZipFileDecompression.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,364 +0,0 @@
-/*
- * 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==");
-}
--- a/test/micro/src/classes/org/openjdk/micro/util/SecurityManagerHelper.java	Fri Sep 28 15:32:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * 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());
-    }
-}