changeset 18579:77b55091cca1

removed object pool sharing across unique Contexts
author Doug Simon <doug.simon@oracle.com>
date Sun, 30 Nov 2014 21:12:06 +0100
parents f262c6c5fb7a
children b76489300efa
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Context.java
diffstat 1 files changed, 2 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Context.java	Sun Nov 30 21:09:07 2014 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/remote/Context.java	Sun Nov 30 21:12:06 2014 +0100
@@ -41,7 +41,6 @@
 public class Context implements AutoCloseable {
 
     private static final ThreadLocal<Context> currentContext = new ThreadLocal<>();
-    private static final ThreadLocal<Context> previousContext = new ThreadLocal<>();
 
     private final Map<Class<?>, Fields> fieldsMap = new HashMap<>();
 
@@ -329,9 +328,6 @@
                 return srcValue;
             }
             dstValue = pool.get(srcValue);
-            if (dstValue == null && previousPool != null) {
-                dstValue = previousPool.get(srcValue);
-            }
             if (dstValue == null) {
                 if (srcValue instanceof Remote) {
                     dstValue = get(srcValue);
@@ -392,19 +388,11 @@
     public Context() {
         assert currentContext.get() == null : currentContext.get();
         currentContext.set(this);
-        Context previous = previousContext.get();
-        if (previous != null) {
-            previousPool = previous.pool;
-            pool = new IdentityHashMap<>(previousPool.size());
-        } else {
-            pool = new IdentityHashMap<>();
-            previousPool = null;
-        }
+        pool = new IdentityHashMap<>();
     }
 
     private final Map<Object, Object> proxies = new IdentityHashMap<>();
     private final Map<Object, Object> pool;
-    private final Map<Object, Object> previousPool;
 
     int invocationCacheHits;
     int invocationCacheMisses;
@@ -448,22 +436,9 @@
     public void close() {
         assert currentContext.get() == this : currentContext.get();
         if (DEBUG) {
-            int overlap = 0;
-            if (previousPool != null) {
-                for (Object key : previousPool.keySet()) {
-                    if (pool.containsKey(key)) {
-                        overlap++;
-                    }
-                }
-            }
-            if (DEBUG) {
-                System.out.printf("proxies: %d, pool: %d, overlap: %d, invocation cache hits: %d, invocation cache misses: %d%n", proxies.size(), pool.size(), overlap, invocationCacheHits,
-                                invocationCacheMisses);
-            }
+            System.out.printf("proxies: %d, pool: %d, invocation cache hits: %d, invocation cache misses: %d%n", proxies.size(), pool.size(), invocationCacheHits, invocationCacheMisses);
         }
         currentContext.set(null);
-        previousContext.set(this);
-
     }
 
     /**