aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAndy Clement <andrew.clement@gmail.com>2013-03-22 15:08:25 -0700
committerAndy Clement <andrew.clement@gmail.com>2013-03-22 15:08:25 -0700
commitdd41751ab24f1e37318c6ee03b036bd5361995fc (patch)
treeb2373ffe5980f58a63ae88722072d49e5f7ac01a /runtime
parentf8c2a9aff1c7cad6a967bd26734be31fce628e96 (diff)
downloadaspectj-dd41751ab24f1e37318c6ee03b036bd5361995fc.tar.gz
aspectj-dd41751ab24f1e37318c6ee03b036bd5361995fc.zip
Cleaning up thread locals when counters/stacks hit zero
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/org/aspectj/runtime/internal/CFlowCounter.java3
-rw-r--r--runtime/src/org/aspectj/runtime/internal/CFlowStack.java6
-rw-r--r--runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java1
-rw-r--r--runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java4
-rw-r--r--runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java1
-rw-r--r--runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java7
-rw-r--r--runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java4
7 files changed, 25 insertions, 1 deletions
diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java
index 8bda3ed39..633458195 100644
--- a/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java
+++ b/runtime/src/org/aspectj/runtime/internal/CFlowCounter.java
@@ -39,6 +39,9 @@ public class CFlowCounter {
public void dec() {
flowHeightHandler.dec();
+ if (!flowHeightHandler.isNotZero()) {
+ flowHeightHandler.removeThreadCounter();
+ }
}
public boolean isValid() {
diff --git a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java
index 1bb0d5d1d..48308f145 100644
--- a/runtime/src/org/aspectj/runtime/internal/CFlowStack.java
+++ b/runtime/src/org/aspectj/runtime/internal/CFlowStack.java
@@ -81,7 +81,11 @@ public class CFlowStack {
}
public void pop() {
- getThreadStack().pop();
+ Stack s = getThreadStack();
+ s.pop();
+ if (s.isEmpty()) {
+ stackProxy.removeThreadStack();
+ }
}
public Object peek() {
diff --git a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java
index 79f96a6a3..1fa064cee 100644
--- a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java
+++ b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounter.java
@@ -18,4 +18,5 @@ public interface ThreadCounter {
public void inc();
public void dec();
public boolean isNotZero();
+ public void removeThreadCounter();
} \ No newline at end of file
diff --git a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java
index 174e55255..71aaacd62 100644
--- a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java
+++ b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadCounterImpl11.java
@@ -71,4 +71,8 @@ public class ThreadCounterImpl11 implements ThreadCounter {
return getThreadCounter().value!=0;
}
+ public void removeThreadCounter() {
+ // TODO
+ }
+
}
diff --git a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java
index b211e1d3e..7290163d2 100644
--- a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java
+++ b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStack.java
@@ -18,5 +18,6 @@ import java.util.Stack;
public interface ThreadStack {
public Stack getThreadStack();
+ public void removeThreadStack();
}
diff --git a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java
index da7437710..2437f06b0 100644
--- a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java
+++ b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackFactoryImpl.java
@@ -23,6 +23,9 @@ public class ThreadStackFactoryImpl implements ThreadStackFactory {
public Stack getThreadStack() {
return (Stack)get();
}
+ public void removeThreadStack() {
+ this.remove();
+ }
}
public ThreadStack getNewThreadStack() {
@@ -38,6 +41,10 @@ public class ThreadStackFactoryImpl implements ThreadStackFactory {
return (Counter)get();
}
+ public void removeThreadCounter() {
+ this.remove();
+ }
+
public void inc() { getThreadCounter().value++; }
public void dec() { getThreadCounter().value--; }
public boolean isNotZero() { return getThreadCounter().value!= 0; }
diff --git a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java
index af43f5f3d..51f09cadd 100644
--- a/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java
+++ b/runtime/src/org/aspectj/runtime/internal/cflowstack/ThreadStackImpl11.java
@@ -52,4 +52,8 @@ public class ThreadStackImpl11 implements ThreadStack {
return cached_stack;
}
+ public void removeThreadStack() {
+ // TODO
+ }
+
}