--- 8147844.hs.03/hotspot.patch 2016-03-09 15:00:32.000000000 -0800 +++ 8147844.hs.04/hotspot.patch 2016-03-09 15:07:19.000000000 -0800 +--- old/src/cpu/x86/vm/vm_version_x86.hpp 2016-03-09 15:07:05.000000000 -0800 ++++ new/src/cpu/x86/vm/vm_version_x86.hpp 2016-03-09 15:07:05.000000000 -0800 @@ -839,6 +839,11 @@ static uint32_t get_xsave_header_upper_segment() { return _cpuid_info.xem_xcr0_edx; @@ -20,13 +20,13 @@ + + // SSE2 and later processors implement a 'pause' instruction + // that can be used for efficient implementation of -+ // the intrinsic for java.lang.Runtime.onSpinWait() ++ // the intrinsic for java.lang.Thread.onSpinWait() + static bool supports_on_spin_wait() { return supports_sse2(); } }; #endif // CPU_X86_VM_VM_VERSION_X86_HPP ---- old/src/share/vm/classfile/vmSymbols.hpp 2016-02-15 10:21:13.000000000 +0300 -+++ new/src/share/vm/classfile/vmSymbols.hpp 2016-02-15 10:21:13.000000000 +0300 -@@ -76,6 +76,7 @@ template(java_lang_Integer_IntegerCache, "java/lang/Integer$IntegerCache") \ template(java_lang_Long, "java/lang/Long") \ template(java_lang_Long_LongCache, "java/lang/Long$LongCache") \ -+ template(java_lang_Runtime, "java/lang/Runtime") \ template(java_lang_Shutdown, "java/lang/Shutdown") \ template(java_lang_ref_Reference, "java/lang/ref/Reference") \ template(java_lang_ref_SoftReference, "java/lang/ref/SoftReference") \ -@@ -863,6 +864,10 @@ +--- old/src/share/vm/classfile/vmSymbols.hpp 2016-03-09 15:07:12.000000000 -0800 ++++ new/src/share/vm/classfile/vmSymbols.hpp 2016-03-09 15:07:12.000000000 -0800 +@@ -863,6 +863,10 @@ do_name( newArray_name, "newArray") \ do_signature(newArray_signature, "(Ljava/lang/Class;I)Ljava/lang/Object;") \ \ -+ do_intrinsic(_onSpinWait, java_lang_Runtime, onSpinWait_name, onSpinWait_signature, F_S) \ ++ do_intrinsic(_onSpinWait, java_lang_Thread, onSpinWait_name, onSpinWait_signature, F_S) \ + do_name( onSpinWait_name, "onSpinWait") \ + do_alias( onSpinWait_signature, void_method_signature) \ + \ do_intrinsic(_copyOf, java_util_Arrays, copyOf_name, copyOf_signature, F_S) \ do_name( copyOf_name, "copyOf") \ do_signature(copyOf_signature, "([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object;") \ ---- old/src/share/vm/runtime/vm_version.hpp 2016-02-15 10:21:19.000000000 +0300 -+++ new/src/share/vm/runtime/vm_version.hpp 2016-02-15 10:21:19.000000000 +0300 +--- old/src/share/vm/runtime/vm_version.hpp 2016-03-09 15:07:18.000000000 -0800 ++++ new/src/share/vm/runtime/vm_version.hpp 2016-03-09 15:07:18.000000000 -0800 @@ -162,6 +162,10 @@ // Calculates and returns the number of parallel threads. May // be VM version specific. static unsigned int calc_parallel_worker_threads(); + + // Does this compiler support intrinsification -+ // of java.lang.Runtime.onSpinWait() ++ // of java.lang.Thread.onSpinWait() + static bool supports_on_spin_wait() { return false; } }; #ifdef TARGET_ARCH_x86 ---- /dev/null 2016-02-15 10:21:20.000000000 +0300 -+++ new/test/compiler/onSpinWait/TestOnSpinWait.java 2016-02-15 10:21:20.000000000 +0300 -@@ -0,0 +1,70 @@ +--- /dev/null 2016-03-09 15:07:19.000000000 -0800 ++++ new/test/compiler/onSpinWait/TestOnSpinWait.java 2016-03-09 15:07:18.000000000 -0800 +@@ -0,0 +1,86 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright 2016 Azul Systems, Inc. All Rights Reserved. @@ -310,7 +302,7 @@ + +/** + * @test TestOnSpinWait -+ * @summary C2: (x86 only) checks that java.lang.Runtime.onSpinWait is intrinsified ++ * @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified + * @bug 8147844 + * @library /testlibrary + * @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64" @@ -324,9 +316,11 @@ +public class TestOnSpinWait { + + public static void main(String[] args) throws Exception { ++ ++ // Test C1 compiler + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", -+ "-XX:-TieredCompilation", "-Xbatch", ++ "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", + "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); + @@ -334,9 +328,23 @@ + + analyzer.shouldHaveExitValue(0); + ++ // The test is applicable only to C1 (present in Server VM). ++ analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) intrinsic"); ++ ++ // Test C2 compiler ++ pb = ProcessTools.createJavaProcessBuilder( ++ "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", ++ "-XX:-TieredCompilation", "-Xbatch", ++ "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", ++ "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); ++ ++ analyzer = new OutputAnalyzer(pb.start()); ++ ++ analyzer.shouldHaveExitValue(0); ++ + // The test is applicable only to C2 (present in Server VM). + if (analyzer.getStderr().contains("Server VM")) { -+ analyzer.shouldContain("java.lang.Runtime::onSpinWait (1 bytes) (intrinsic)"); ++ analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) (intrinsic)"); + } + } + @@ -350,7 +358,7 @@ + } + } + static void test() { -+ java.lang.Runtime.onSpinWait(); ++ java.lang.Thread.onSpinWait(); + } + } +}