changeset 21213:0028ab94d268

Make cache in HotSpotConstantPool.lookupType thread safe.
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 04 May 2015 19:12:50 +0200
parents 9a7125f0eeda
children bfb6e742ad0a
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Mon May 04 09:10:52 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Mon May 04 19:12:50 2015 +0200
@@ -489,8 +489,10 @@
 
     @Override
     public JavaType lookupType(int cpi, int opcode) {
-        if (cpi == this.lastTypeCpi) {
-            return this.lastType;
+        synchronized (this) {
+            if (cpi == this.lastTypeCpi) {
+                return this.lastType;
+            }
         }
         final long metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(metaspaceConstantPool, cpi);
         JavaType result = getJavaType(metaspacePointer);