[Nice-commit] Nice/src/gnu/bytecode CodeAttr.java,1.20,1.21
Brought to you by:
bonniot
From: <bo...@pr...> - 2004-02-02 00:49:30
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5036/src/gnu/bytecode Modified Files: CodeAttr.java Log Message: When a return is inside a try/finally, store the result in a method-level local bytecode variable, to make sure that the finally blocks do not use the same slot (closes #888452). Index: CodeAttr.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/CodeAttr.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CodeAttr.java 3 Nov 2003 18:32:07 -0000 1.20 --- CodeAttr.java 2 Feb 2004 00:47:33 -0000 1.21 *************** *** 415,418 **** --- 415,427 ---- } + /** Return the toplevel scope, corresponding to the current method. */ + public Scope methodScope() + { + Scope res = getCurrentScope(); + while (res.parent != null) + res = res.parent; + return res; + } + public Scope popScope () { Scope scope = locals.current_scope; *************** *** 1685,1689 **** if (saveResult && result == null) { ! result = addLocal(topType()); emitStore(result); } --- 1694,1700 ---- if (saveResult && result == null) { ! // We store the result in a method-level variable, to make sure ! // that the finally blocks do not use the same slot. ! result = methodScope().addVariable(this, topType()); emitStore(result); } |