aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2011-12-10 00:52:28 +0000
committeraclement <aclement>2011-12-10 00:52:28 +0000
commited319e3d0272a724e0c08a03219c53755186d0ec (patch)
treedd413fd7a568b7b599e0aa1e573126ad4159e561 /org.aspectj.ajdt.core
parent0a812fa86f631e589a6be69890f0f3d0005d930c (diff)
downloadaspectj-ed319e3d0272a724e0c08a03219c53755186d0ec.tar.gz
aspectj-ed319e3d0272a724e0c08a03219c53755186d0ec.zip
enhanced to tell codestream more information about exceptions/local vars - to enable stack frame creation
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
index 07d779258..977c6efa6 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
@@ -24,6 +24,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.aspectj.weaver.AjcMemberMaker;
public class AspectClinit extends Clinit {
@@ -79,17 +80,34 @@ public class AspectClinit extends Clinit {
)),null);
}
+
+ boolean creatingStackMap = (codeStream.generateAttributes & (
+ ClassFileConstants.ATTR_STACK_MAP_TABLE
+ | ClassFileConstants.ATTR_STACK_MAP))!=0;
+
if (initFailureField != null) {
// Changes to this exception handling code may require changes to
// BcelClassWeaver.isInitFailureHandler()
handlerLabel.placeEnd();
BranchLabel endLabel = new BranchLabel(codeStream);
codeStream.goto_(endLabel);
+ // In order to keep stack map computation happy, need to give it more information, about the exception type
+ // here and the local variable being used to track the exception (in the catch block)
+ codeStream.pushExceptionOnStack(this.scope.getJavaLangThrowable());
handlerLabel.place();
+ LocalVariableBinding localVariableBinding = null;
+ if (creatingStackMap) {
+ localVariableBinding = new LocalVariableBinding("throwable".toCharArray(), this.scope.getJavaLangThrowable(), 0, false); //$NON-NLS-1$
+ codeStream.addVariable(localVariableBinding);
+ localVariableBinding.recordInitializationStartPC(codeStream.position);
+ }
codeStream.astore_0(); // Bug #52394
// CHECK THIS...
codeStream.addVariable(new LocalVariableBinding("caughtException".toCharArray(),initFailureField.type,ClassFileConstants.AccPrivate,false));
codeStream.aload_0();
+ if (creatingStackMap) {
+ localVariableBinding.recordInitializationEndPC(codeStream.position);
+ }
codeStream.fieldAccess(Opcodes.OPC_putstatic, initFailureField, null);
endLabel.place();
}