Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline
In directory sc8-pr-cvs1:/tmp/cvs-serv18292/F:/nice/stdlib/nice/lang/inline
Modified Files:
Assert.java
Log Message:
Generating better bytecode for pre/post-conditions i.e. no duplicate checks whether assertions are turned on or not.
Index: Assert.java
===================================================================
RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/Assert.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Assert.java 25 Oct 2002 13:06:06 -0000 1.2
--- Assert.java 19 Mar 2003 00:45:17 -0000 1.3
***************
*** 29,38 ****
public class Assert extends ProcedureN implements Inlineable
{
public static Assert create(String param)
{
! return instance;
}
! private static Assert instance = new Assert();
public void compile (ApplyExp exp, Compilation comp, Target target)
--- 29,48 ----
public class Assert extends ProcedureN implements Inlineable
{
+ public Assert(boolean assertEnableCheck)
+ {
+ this.assertEnableCheck = assertEnableCheck;
+ }
+
public static Assert create(String param)
{
! if (param == null)
! return instance;
! return contractInstance;
}
+
+ private boolean assertEnableCheck;
! private static Assert instance = new Assert(true);
! private static Assert contractInstance = new Assert(false);
public void compile (ApplyExp exp, Compilation comp, Target target)
***************
*** 42,47 ****
Label end = new Label(code);
! code.ifAssertionsDisabledGoto
! (((ClassExp)comp.topLambda).getAssertionEnabledField(), end);
args[0].compile(comp, Type.boolean_type);
--- 52,58 ----
Label end = new Label(code);
! if (this.assertEnableCheck)
! code.ifAssertionsDisabledGoto
! (((ClassExp)comp.topLambda).getAssertionEnabledField(), end);
args[0].compile(comp, Type.boolean_type);
|