[Nice-commit] Nice/src/gnu/expr Branchable.java,NONE,1.1 ApplyExp.java,1.6,1.7 LoopExp.java,1.6,1.7
Brought to you by:
bonniot
|
From: <ar...@us...> - 2003-03-19 16:45:18
|
Update of /cvsroot/nice/Nice/src/gnu/expr
In directory sc8-pr-cvs1:/tmp/cvs-serv17953/F:/nice/src/gnu/expr
Modified Files:
ApplyExp.java LoopExp.java
Added Files:
Branchable.java
Log Message:
Start of patches for generating better bytecode by reducing the number of branches.
--- NEW FILE: Branchable.java ---
package gnu.expr;
import gnu.bytecode.Label;
public interface Branchable extends Inlineable
{
/**
Jump to label if the expression yields true.
*/
public void compileJump (Compilation comp, Expression[] args, Label to);
/**
Jump to label if the expression yields false.
*/
public void compileJumpNot (Compilation comp, Expression[] args, Label to);
/**
Creates an 'if' of the expression
*/
public void compileIf (Compilation comp, Expression[] args);
/**
Creates an 'if not' of the expression
*/
public void compileIfNot (Compilation comp, Expression[] args);
}
Index: ApplyExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/expr/ApplyExp.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ApplyExp.java 10 Feb 2003 10:53:25 -0000 1.6
--- ApplyExp.java 19 Mar 2003 16:45:14 -0000 1.7
***************
*** 515,517 ****
--- 515,529 ----
}
}
+
+ public Branchable getBranchable()
+ {
+ if (func instanceof QuoteExp)
+ {
+ Object proc = ((QuoteExp) func).getValue();
+ if (proc instanceof Branchable)
+ return (Branchable)proc;
+ }
+ return null;
+ }
+
}
Index: LoopExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/expr/LoopExp.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** LoopExp.java 28 Jan 2002 20:36:54 -0000 1.6
--- LoopExp.java 19 Mar 2003 16:45:14 -0000 1.7
***************
*** 97,110 ****
{
ApplyExp app = (ApplyExp) ifExp;
! if (app.func instanceof QuoteExp)
! {
! Object proc = ((QuoteExp) app.func).getValue();
! if (proc instanceof nice.lang.inline.CompOp)
! {
! nice.lang.inline.CompOp op = (nice.lang.inline.CompOp) proc;
! op.compileJump(comp, app.args, to);
! return;
! }
! }
}
--- 97,106 ----
{
ApplyExp app = (ApplyExp) ifExp;
! Branchable branchOp = app.getBranchable();
! if (branchOp != null)
! {
! branchOp.compileJump(comp, app.args, to);
! return;
! }
}
|