void-packages/srcpkgs/openjdk8/patches/004_8087218-pr2740.patch

24 lines
1.3 KiB
Diff

# HG changeset patch
# User vlivanov
# Date 1447818025 0
# Wed Nov 18 03:40:25 2015 +0000
# Node ID cbdd812ea25e27919983c363fd416b492846e426
# Parent 3b05ef40e997e8234f396a55cf238e9b01472f12
8087218, PR2740: Constant fold loads from final instance fields in VM anonymous classes
Reviewed-by: jrose, rbackman
diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciField.cpp openjdk/hotspot/src/share/vm/ci/ciField.cpp
--- openjdk.orig/hotspot/src/share/vm/ci/ciField.cpp 2017-04-20 14:31:49.000000000 +0100
+++ openjdk/hotspot/src/share/vm/ci/ciField.cpp 2017-05-10 14:55:11.722924914 +0100
@@ -187,6 +187,10 @@
// Even if general trusting is disabled, trust system-built closures in these packages.
if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke"))
return true;
+ // Trust VM anonymous classes. They are private API (sun.misc.Unsafe) and can't be serialized,
+ // so there is no hacking of finals going on with them.
+ if (holder->is_anonymous())
+ return true;
// Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
// more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||