aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2007-06-03 02:33:47 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2007-06-03 02:33:47 +0000
commit2c1e31d12e15b1c2fe32ad9fcdc12bdde1199e8a (patch)
tree0683d9e934ac84675ef8982340de402de86fca97
parent43af89caa275539ac3f898d10bbffaed349ea861 (diff)
downloadjavassist-2c1e31d12e15b1c2fe32ad9fcdc12bdde1199e8a.tar.gz
javassist-2c1e31d12e15b1c2fe32ad9fcdc12bdde1199e8a.zip
made the java.util.proxy package support stack map tables.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@380 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java
index a34f9a4d..be9eb25d 100644
--- a/src/main/javassist/util/proxy/ProxyFactory.java
+++ b/src/main/javassist/util/proxy/ProxyFactory.java
@@ -764,19 +764,26 @@ public class ProxyFactory {
code.addAload(0);
code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
- code.addOpcode(Opcode.DUP);
+ code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
+ code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
code.addOpcode(Opcode.IFNONNULL);
- code.addIndex(7);
- code.addOpcode(Opcode.POP);
+ code.addIndex(10);
+ code.addAload(0);
code.addGetstatic(NULL_INTERCEPTOR_HOLDER, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
+ int pc = code.currentPc();
code.addAload(0);
int s = addLoadParameters(code, cons.getParameterTypes(), 1);
code.addInvokespecial(superClass.getName(), "<init>", desc);
code.addOpcode(Opcode.RETURN);
code.setMaxLocals(s + 1);
- minfo.setCodeAttribute(code.toCodeAttribute());
+ CodeAttribute ca = code.toCodeAttribute();
+ minfo.setCodeAttribute(ca);
+
+ StackMapTable.Writer writer = new StackMapTable.Writer(32);
+ writer.sameFrame(pc);
+ ca.setAttribute(writer.toStackMapTable(cp));
return minfo;
}
@@ -840,7 +847,8 @@ public class ProxyFactory {
callFindMethod(code, "findSuperMethod", arrayVar, origIndex, meth.getName(), desc);
callFindMethod(code, "findMethod", arrayVar, delIndex, delegatorName, desc);
- code.write16bit(pc, code.currentPc() - pc + 1);
+ int pc2 = code.currentPc();
+ code.write16bit(pc, pc2 - pc + 1);
code.addAload(0);
code.addGetfield(thisClassName, HANDLER, HANDLER_TYPE);
code.addAload(0);
@@ -861,7 +869,12 @@ public class ProxyFactory {
addUnwrapper(code, retType);
addReturn(code, retType);
- forwarder.setCodeAttribute(code.toCodeAttribute());
+ CodeAttribute ca = code.toCodeAttribute();
+ forwarder.setCodeAttribute(ca);
+ StackMapTable.Writer writer = new StackMapTable.Writer(32);
+ writer.appendFrame(pc2, new int[] { StackMapTable.OBJECT },
+ new int[] { cp.addClassInfo(HOLDER_TYPE) });
+ ca.setAttribute(writer.toStackMapTable(cp));
return forwarder;
}