nice-commit Mailing List for The Nice Programming Language (Page 120)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ar...@us...> - 2003-03-27 23:42:31
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/operators In directory sc8-pr-cvs1:/tmp/cvs-serv11005/F:/nice/testsuite/compiler/expressions/operators Modified Files: null.testsuite Log Message: Added a bug case: optionOr on primitve types. Index: null.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/operators/null.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** null.testsuite 19 Feb 2003 14:19:40 -0000 1.2 --- null.testsuite 27 Mar 2003 23:42:26 -0000 1.3 *************** *** 31,32 **** --- 31,39 ---- return map.get("") || (1,1); } + + /// PASS bug + Map<String,int> map = new HashMap(); + String s = "abc"; + map.put(s,1); + int i = map.get(s) || 0; + assert(i==0); |
From: <ar...@us...> - 2003-03-27 23:01:10
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv23760/F:/nice/stdlib/nice/lang Modified Files: array.nice graph.nice prelude.nice Log Message: Added elementNotNull and use an assertion for the check. Index: array.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/array.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** array.nice 12 Feb 2003 13:37:58 -0000 1.21 --- array.nice 27 Mar 2003 23:01:00 -0000 1.22 *************** *** 24,27 **** --- 24,34 ---- = native; + <Any T> !T[] elementsNotNull(?T[] arr) + { + assert(!arr.has(?T elem => elem == null)); + return cast(arr); + } + + /** Returns an array with the newSize first elements. The result can be the same array as the argument. Index: graph.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/graph.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** graph.nice 24 Jan 2003 12:36:47 -0000 1.15 --- graph.nice 27 Mar 2003 23:01:02 -0000 1.16 *************** *** 34,44 **** successors(node).foreach(T child=>{ int m; ! try{ ! m = notNull(mark.get(child)); ! } ! catch(NullPointerException e){ m = visit(child, successors, id, stack, mark, res); ! } ! if(m<min) min=m; --- 34,42 ---- successors(node).foreach(T child=>{ int m; ! if (mark.get(child)==null)// optionOr crashes the compiler here so we fake m = visit(child, successors, id, stack, mark, res); ! else ! m = cast(mark.get(child)); ! if(m<min) min=m; Index: prelude.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/prelude.nice,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** prelude.nice 23 Mar 2003 00:05:48 -0000 1.26 --- prelude.nice 27 Mar 2003 23:01:02 -0000 1.27 *************** *** 45,54 **** <Any T> !T notNull(?T value) { ! if (value != null) ! return cast(value); ! ! if (true) ! throw new NullPointerException("Null value"); ! return cast(null); } --- 45,50 ---- <Any T> !T notNull(?T value) { ! assert(value != null); ! return cast(value); } |
From: <ar...@us...> - 2003-03-27 21:38:47
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv19646/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: Reversed last retypings of the collection and added a retyping of addAll Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** java.nice 20 Mar 2003 21:18:51 -0000 1.18 --- java.nice 27 Mar 2003 21:38:39 -0000 1.19 *************** *** 99,119 **** native java.util.ListIterator java.util.List.listIterator(int); // Some methods use Object, when they should use a type variable. ! // It's in fact correct in java to use Object instead of a contravariant type. ! <E,T | E <: T> boolean contains(java.util.Collection<E>, T) = native boolean java.util.Collection.contains(Object); ! <E,T | E <: T> boolean remove(java.util.Collection<E>, T) = native boolean java.util.Collection.remove(Object); ! <E,T | E <: T> int indexOf(java.util.List<E>, T) = native int java.util.List.indexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.List<E>, T) = native int java.util.List.lastIndexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.Vector<E>, T, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E,T | E <: T> boolean removeElement(java.util.Vector<E>, T) = native boolean java.util.Vector.removeElement(Object); ! <E,T | E <: T> int search(java.util.Stack<E>, T) = native int java.util.Stack.search(Object); --- 99,120 ---- native java.util.ListIterator java.util.List.listIterator(int); + <T, U | U <: T> boolean addAll(Collection<T>, Collection<U>) = + native boolean java.util.Collection.addAll(java.util.Collection); // Some methods use Object, when they should use a type variable. ! <E> boolean contains(java.util.Collection<E>, E) = native boolean java.util.Collection.contains(Object); ! <E> boolean remove(java.util.Collection<E>, E) = native boolean java.util.Collection.remove(Object); ! <E> int indexOf(java.util.List<E>, E) = native int java.util.List.indexOf(Object); ! <E> int lastIndexOf(java.util.List<E>, E) = native int java.util.List.lastIndexOf(Object); ! <E> int lastIndexOf(java.util.Vector<E>, E, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E> boolean removeElement(java.util.Vector<E>, E) = native boolean java.util.Vector.removeElement(Object); ! <E> int search(java.util.Stack<E>, E) = native int java.util.Stack.search(Object); |
From: <ar...@us...> - 2003-03-27 21:38:46
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util In directory sc8-pr-cvs1:/tmp/cvs-serv19646/F:/nice/testsuite/lib/java/util Modified Files: collections.testsuite Log Message: Reversed last retypings of the collection and added a retyping of addAll Index: collections.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** collections.testsuite 20 Mar 2003 21:18:53 -0000 1.7 --- collections.testsuite 27 Mar 2003 21:38:40 -0000 1.8 *************** *** 37,56 **** assert list[0] == "A"; assert list[1] == "BA"; - - /// PASS - List<B> list = new ArrayList(); - B b = new B(); - list.add(b); - A obj = b; - assert(list.contains(obj)); - /// Toplevel - class A{} - class B extends A{} - - /// FAIL - List<B> list = new ArrayList(); - A obj = new A(); - list.contains(obj); - /// Toplevel - class A{} - class B{} --- 37,38 ---- |
From: <ar...@us...> - 2003-03-26 17:23:51
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv5671/F:/nice/src/bossa/syntax Modified Files: Arguments.java Log Message: Removed debug statement. Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Arguments.java 23 Mar 2003 23:03:01 -0000 1.15 --- Arguments.java 26 Mar 2003 17:23:46 -0000 1.16 *************** *** 237,244 **** Object noMatch = i.next(); if (noMatch instanceof FunSymbol) - { argnames.retainAll(noMatchByName(((FunSymbol)noMatch).parameters)); - User.warning(Util.map("", ", ", "", noMatchByName(((FunSymbol)noMatch).parameters))); - } } if (!argnames.isEmpty()) --- 237,241 ---- |
From: <ar...@us...> - 2003-03-24 23:40:13
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv31803/F:/nice/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: ReferenceOp generates efficient code when comparing with null. Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReferenceOp.java 23 Mar 2003 00:05:49 -0000 1.1 --- ReferenceOp.java 24 Mar 2003 23:40:09 -0000 1.2 *************** *** 52,64 **** Label _else = new Label(code); Label _end = new Label(code); ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNE(_else); else ! code.emitGotoIfEq(_else); code.emitPushBoolean(true); code.emitGoto(_end); --- 52,86 ---- Label _else = new Label(code); Label _end = new Label(code); + + if (args[0] instanceof QuoteExp && + ((QuoteExp)args[0]).getType() == Type.nullType) + { + args[1].compile(comp, stack); + if (kind == Eq) + code.emitGotoIfNotNull(_else); + else + code.emitGotoIfNull(_else); ! } ! else if (args[1] instanceof QuoteExp && ! ((QuoteExp)args[1]).getType() == Type.nullType) ! { ! args[0].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNotNull(_else); ! else ! code.emitGotoIfNull(_else); ! } else ! { ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNE(_else); ! else ! code.emitGotoIfEq(_else); + } code.emitPushBoolean(true); code.emitGoto(_end); *************** *** 76,86 **** Target stack = new StackTarget(Type.pointer_type); ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfEq(to); else ! code.emitGotoIfNE(to); } --- 98,131 ---- Target stack = new StackTarget(Type.pointer_type); ! if (args[0] instanceof QuoteExp && ! ((QuoteExp)args[0]).getType() == Type.nullType) ! { ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNull(to); ! else ! code.emitGotoIfNotNull(to); ! } ! else if (args[1] instanceof QuoteExp && ! ((QuoteExp)args[1]).getType() == Type.nullType) ! { ! args[0].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNull(to); ! else ! code.emitGotoIfNotNull(to); ! ! } else ! { ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfEq(to); ! else ! code.emitGotoIfNE(to); ! ! } } *************** *** 90,100 **** Target stack = new StackTarget(Type.pointer_type); ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNE(to); else ! code.emitGotoIfEq(to); } --- 135,168 ---- Target stack = new StackTarget(Type.pointer_type); ! if (args[0] instanceof QuoteExp && ! ((QuoteExp)args[0]).getType() == Type.nullType) ! { ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNotNull(to); ! else ! code.emitGotoIfNull(to); ! } ! else if (args[1] instanceof QuoteExp && ! ((QuoteExp)args[1]).getType() == Type.nullType) ! { ! args[0].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNotNull(to); ! else ! code.emitGotoIfNull(to); ! ! } else ! { ! args[0].compile(comp, stack); ! args[1].compile(comp, stack); ! if (kind == Eq) ! code.emitGotoIfNE(to); ! else ! code.emitGotoIfEq(to); ! ! } } |
From: <ar...@us...> - 2003-03-24 23:40:12
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv31803/F:/nice/src/gnu/bytecode Modified Files: CodeAttr.java Log Message: ReferenceOp generates efficient code when comparing with null. Index: CodeAttr.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/CodeAttr.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CodeAttr.java 20 Mar 2003 19:40:03 -0000 1.14 --- CodeAttr.java 24 Mar 2003 23:40:07 -0000 1.15 *************** *** 1217,1220 **** --- 1217,1226 ---- { emitGotoIfCompare1(label, 158); } + public final void emitGotoIfNull(Label label) + { emitGotoIfCompare1(label, 198); } //ifnull + public final void emitGotoIfNotNull(Label label) + { emitGotoIfCompare1(label, 199); } //ifnonnull + + public final void emitGotoIfCompare2 (Label label, int logop) { |
From: <ar...@us...> - 2003-03-23 23:40:48
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv27377/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: closures made of one assignment don't have to return void anymore. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** Parser.jj 14 Mar 2003 14:10:48 -0000 1.151 --- Parser.jj 23 Mar 2003 23:40:38 -0000 1.152 *************** *** 1611,1618 **** exp=Expression() { ! if (exp instanceof AssignExp) ! body=new ExpressionStmt(exp); ! else ! body=new ReturnStmt(exp); } ) --- 1611,1615 ---- exp=Expression() { ! body=new ReturnStmt(exp); } ) |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14862/F:/nice/src/bossa/syntax Modified Files: Arguments.java Block.java Constructor.java FormalParameters.java FunSymbol.java MethodDeclaration.java OverloadedSymbolExp.java Log Message: Error messages caused by mistyping the name of a named argument give more usefull information. And changed a few cosmetic things. Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Arguments.java 27 Nov 2002 16:59:48 -0000 1.14 --- Arguments.java 23 Mar 2003 23:03:01 -0000 1.15 *************** *** 13,16 **** --- 13,17 ---- package bossa.syntax; + import java.util.*; import bossa.util.*; *************** *** 185,191 **** --- 186,194 ---- if (arguments.length != arity) return false; + for (int i = 0; i<arguments.length; i++) if (arguments[i].name != null) return false; + applicationExpressions.put(symbol, inOrder()); return true; *************** *** 221,233 **** } ! String explainNoMatch() { for (int i = 0; i < arguments.length; i++) if (arguments[i].name != null) ! return " has compatible named arguments"; return " has " + arguments.length + " arguments"; } ! Argument[] arguments; } --- 224,267 ---- } ! String explainNoMatch(List /*VarSymbol*/ noMatches) { + List argnames = new LinkedList(); for (int i = 0; i < arguments.length; i++) if (arguments[i].name != null) ! argnames.add(arguments[i].name.toString()); + if (!argnames.isEmpty()) + { + for (Iterator i = noMatches.iterator(); i.hasNext();) + { + Object noMatch = i.next(); + if (noMatch instanceof FunSymbol) + { + argnames.retainAll(noMatchByName(((FunSymbol)noMatch).parameters)); + User.warning(Util.map("", ", ", "", noMatchByName(((FunSymbol)noMatch).parameters))); + } + } + if (!argnames.isEmpty()) + return " has an argument named " + argnames.get(0); + + return " has compatible named arguments"; + } return " has " + arguments.length + " arguments"; } ! ! List noMatchByName(FormalParameters parameters) ! { ! List res = new LinkedList(); ! for (int i = 0; i < arguments.length; i++) ! if (arguments[i].name != null) ! { ! String s = arguments[i].name.toString(); ! if (!parameters.hasMatchFor(s)) ! res.add(s); ! } ! ! return res; ! } ! Argument[] arguments; } Index: Block.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Block.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Block.java 6 Mar 2003 01:47:23 -0000 1.53 --- Block.java 23 Mar 2003 23:03:02 -0000 1.54 *************** *** 196,200 **** FunSymbol symbol = new FunSymbol(name, Constraint.True, parameters, ! returnType, parameters.size); symbol.syntacticType.getMonotype().nullness = Monotype.sure; return new LocalFunction(symbol, value, parameters); --- 196,200 ---- FunSymbol symbol = new FunSymbol(name, Constraint.True, parameters, ! returnType); symbol.syntacticType.getMonotype().nullness = Monotype.sure; return new LocalFunction(symbol, value, parameters); Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Constructor.java 2 Sep 2002 11:46:51 -0000 1.1 --- Constructor.java 23 Mar 2003 23:03:02 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- package bossa.syntax; + import java.util.*; import bossa.util.*; import bossa.util.Location; *************** *** 98,116 **** { String name = classe.getName(); ! StringBuffer res = new StringBuffer(); res.append("Class ").append(name); if (parameters.size == 0) ! { ! res.append(" has no fields. Therefore its constructor takes no arguments."); ! return res.toString(); ! } ! res.append(" has the following fields:\n").append(parameters); ! res.append('\n'); ! res.append("Please provide values for the fields, ") ! .append("at least for those with no default value.\n") ! .append("The syntax is:\n") ! .append("new " + name + "(field1: value1, ..., fieldN: valueN)"); return res.toString(); --- 99,125 ---- { String name = classe.getName(); ! StringBuffer res = new StringBuffer(); res.append("Class ").append(name); if (parameters.size == 0) ! { ! res.append(" has no fields. Therefore its constructor takes no arguments."); ! return res.toString(); ! } ! List nonmatching = arguments.noMatchByName(parameters); ! if (!nonmatching.isEmpty()) ! { ! res.append(" has no field named "+nonmatching.get(0)); ! return res.toString(); ! } ! ! res.append(" has the following fields:\n") ! .append(parameters) ! .append('\n') ! .append("Please provide values for the fields, ") ! .append("at least for those with no default value.\n") ! .append("The syntax is:\n") ! .append("new " + name + "(field1: value1, ..., fieldN: valueN)"); return res.toString(); Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** FormalParameters.java 27 Nov 2002 17:56:08 -0000 1.20 --- FormalParameters.java 23 Mar 2003 23:03:03 -0000 1.21 *************** *** 316,319 **** --- 316,320 ---- for (int i = 0; i < size; i++) res[i] = parameters[i].type; + return res; } *************** *** 326,329 **** --- 327,331 ---- for (int i = 0; i < size; i++) res[i] = parameters[i].getSymbol(); + return res; } *************** *** 398,401 **** --- 400,404 ---- else exps[i] = args.getExp(map[i] - 1); + args.applicationExpressions.put(symbol, exps); args.usedArguments.put(symbol, map); *************** *** 411,419 **** if (i == map.length) return true; ! else ! { ! map[i] = num + 1; ! return false; ! } } --- 414,420 ---- if (i == map.length) return true; ! ! map[i] = num + 1; ! return false; } *************** *** 426,436 **** if (i == map.length) return true; ! else ! { ! map[i] = num + 1; ! return false; ! } } /**************************************************************** * Misc. --- 427,444 ---- if (i == map.length) return true; ! ! map[i] = num + 1; ! return false; } + public boolean hasMatchFor(String s) + { + for (int i = 0; i<parameters.length; i++) + if (parameters[i].match(s)) + return true; + + return false; + } + /**************************************************************** * Misc. Index: FunSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunSymbol.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FunSymbol.java 25 Sep 2002 16:40:26 -0000 1.6 --- FunSymbol.java 23 Mar 2003 23:03:03 -0000 1.7 *************** *** 13,16 **** --- 13,17 ---- package bossa.syntax; + import java.util.*; import nice.tools.code.Types; *************** *** 19,23 **** FunSymbol(LocatedString name, Constraint constraint, FormalParameters parameters, ! Monotype returnType, int arity) { super(name, --- 20,24 ---- FunSymbol(LocatedString name, Constraint constraint, FormalParameters parameters, ! Monotype returnType) { super(name, *************** *** 25,29 **** new FunType(parameters.types(), returnType))); this.parameters = parameters; ! this.arity = arity; } --- 26,30 ---- new FunType(parameters.types(), returnType))); this.parameters = parameters; ! this.arity = parameters.size; } *************** *** 67,79 **** { if (parameters == null) // true for constructors, for instance. case might be removed if (!arguments.plainApplication(arity, this)) return 0; ! else ! return 2; else if (!parameters.match(arguments, this)) return 0; ! else ! return 2; } --- 68,80 ---- { if (parameters == null) + { // true for constructors, for instance. case might be removed if (!arguments.plainApplication(arity, this)) return 0; ! } else if (!parameters.match(arguments, this)) return 0; ! ! return 2; } Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** MethodDeclaration.java 10 Dec 2002 19:10:52 -0000 1.36 --- MethodDeclaration.java 23 Mar 2003 23:03:03 -0000 1.37 *************** *** 244,249 **** super(name, constraint, MethodDeclaration.this.formalParameters(), ! returnType, ! MethodDeclaration.this.arity); } --- 244,248 ---- super(name, constraint, MethodDeclaration.this.formalParameters(), ! returnType); } Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** OverloadedSymbolExp.java 1 Mar 2003 00:58:28 -0000 1.49 --- OverloadedSymbolExp.java 23 Mar 2003 23:03:03 -0000 1.50 *************** *** 399,404 **** if (symbols.size() <= 1) return "[" + Util.map("", "\n|", "", symbols) + "]"; ! else ! return "\n[" + Util.map("", "\n|", "", symbols) + "]"; } --- 399,404 ---- if (symbols.size() <= 1) return "[" + Util.map("", "\n|", "", symbols) + "]"; ! ! return "\n[" + Util.map("", "\n|", "", symbols) + "]"; } *************** *** 423,427 **** default: ! return "No method with name " + ident + arguments.explainNoMatch(); } } --- 423,428 ---- default: ! return "No method with name " + ident + ! arguments.explainNoMatch(removed); } } |
From: <ar...@us...> - 2003-03-23 23:03:08
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv14862/F:/nice/debian Modified Files: changelog Log Message: Error messages caused by mistyping the name of a named argument give more usefull information. And changed a few cosmetic things. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** changelog 22 Mar 2003 12:43:21 -0000 1.144 --- changelog 23 Mar 2003 23:03:04 -0000 1.145 *************** *** 1,5 **** nice (0.7.8) unstable; urgency=low ! * Some operators(&&, ||, ! and comparisons) generate better bytecode now. * Improved bytecode generation of pre\post-condition. * Implemented the enhanced for loop(similar to java 1.5 proposal). --- 1,7 ---- nice (0.7.8) unstable; urgency=low ! * Some error messages are more usefull. ! * All operators are inlined and some operators(&&, ||, ! and comparisons) ! generate better bytecode now. * Improved bytecode generation of pre\post-condition. * Implemented the enhanced for loop(similar to java 1.5 proposal). |
From: <ar...@us...> - 2003-03-23 00:05:51
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv6467/F:/nice/stdlib/nice/lang/inline Modified Files: BoolNotOp.java BoolOp.java Added Files: ReferenceOp.java Log Message: The last operators(== and != on booleans, objects and chars) that weren't inlined are inlined now. Added ReferenceOp.java for == and != on objects. Fixed also a minor bug in ShortCircuitOp caused by my previous change. --- NEW FILE: ReferenceOp.java --- /**************************************************************************/ /* N I C E */ /* A simple imperative object-oriented research language */ /* (c) Daniel Bonniot 2000 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package nice.lang.inline; import gnu.mapping.Procedure2; import gnu.expr.*; import gnu.bytecode.*; /** Inlining of native reference operators. */ public class ReferenceOp extends Procedure2 implements Inlineable, Branchable { private final static int Eq = 1, Ne = 2; public static ReferenceOp create(String param) { int kind = 0; if ("==".equals(param)) kind = Eq; else if ("!=".equals(param)) kind = Ne; else bossa.util.User.error("Unknown inlined boolean operator " + param); return new ReferenceOp(kind); } private ReferenceOp (int kind) { this.kind = kind; } private final int kind; public void compile (ApplyExp exp, Compilation comp, Target target) { Expression[] args = exp.getArgs(); CodeAttr code = comp.getCode(); Target stack = new StackTarget(Type.pointer_type); Label _else = new Label(code); Label _end = new Label(code); args[0].compile(comp, stack); args[1].compile(comp, stack); if (kind == Eq) code.emitGotoIfNE(_else); else code.emitGotoIfEq(_else); code.emitPushBoolean(true); code.emitGoto(_end); code.popType(); //simulate 'else' otherwise gnu.bytecode don't like it _else.define(code); code.emitPushBoolean(false); _end.define(code); target.compileFromStack(comp, retType); } public void compileJump (Compilation comp, Expression[] args, Label to) { CodeAttr code = comp.getCode(); Target stack = new StackTarget(Type.pointer_type); args[0].compile(comp, stack); args[1].compile(comp, stack); if (kind == Eq) code.emitGotoIfEq(to); else code.emitGotoIfNE(to); } public void compileJumpNot (Compilation comp, Expression[] args, Label to) { CodeAttr code = comp.getCode(); Target stack = new StackTarget(Type.pointer_type); args[0].compile(comp, stack); args[1].compile(comp, stack); if (kind == Eq) code.emitGotoIfNE(to); else code.emitGotoIfEq(to); } private static final Type retType = Type.boolean_type; public Type getReturnType (Expression[] args) { return retType; } // Interpretation public Object apply2 (Object arg1, Object arg2) { throw new Error("Not implemented"); } } Index: BoolNotOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BoolNotOp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BoolNotOp.java 21 Mar 2003 23:32:35 -0000 1.3 --- BoolNotOp.java 23 Mar 2003 00:05:49 -0000 1.4 *************** *** 49,52 **** --- 49,53 ---- code.emitPushBoolean(true); code.emitGoto(_end); + code.popType(); //simulate 'else' otherwise gnu.bytecode don't like it _else.define(code); code.emitPushBoolean(false); Index: BoolOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BoolOp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BoolOp.java 18 Feb 2003 12:48:52 -0000 1.3 --- BoolOp.java 23 Mar 2003 00:05:49 -0000 1.4 *************** *** 25,39 **** { private final static int - error = 0, And = 1, ! Or = 2; public static BoolOp create(String param) { ! int kind = error; if ("&".equals(param)) kind = And; else if ("|".equals(param)) kind = Or; else bossa.util.User.error("Unknown inlined boolean operator " + param); --- 25,44 ---- { private final static int And = 1, ! Or = 2, ! Xor = 3, ! Eq = 4; public static BoolOp create(String param) { ! int kind = 0; if ("&".equals(param)) kind = And; else if ("|".equals(param)) kind = Or; + else if ("^".equals(param)) + kind = Xor; + else if ("==".equals(param)) + kind = Eq; else bossa.util.User.error("Unknown inlined boolean operator " + param); *************** *** 60,63 **** --- 65,73 ---- case And: code.emitAnd(); break; case Or: code.emitIOr(); break; + case Xor: code.emitXOr(); break; + case Eq: code.emitXOr(); + code.emitPushConstant(1, Type.int_type); + code.emitXOr(); + break; } |
From: <ar...@us...> - 2003-03-23 00:05:51
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv6467/F:/nice/stdlib/nice/lang Modified Files: Native.java BooleanAlgebra.nice booleans.nice prelude.nice Log Message: The last operators(== and != on booleans, objects and chars) that weren't inlined are inlined now. Added ReferenceOp.java for == and != on objects. Fixed also a minor bug in ShortCircuitOp caused by my previous change. Index: Native.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/Native.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Native.java 14 Jan 2003 20:33:03 -0000 1.13 --- Native.java 23 Mar 2003 00:05:48 -0000 1.14 *************** *** 19,32 **** { public static Object object(Object o) { return o; } - - public static boolean eq (Object o1, Object o2) { return o1 == o2; } - public static boolean neq(Object o1, Object o2) { return o1 != o2; } - - public static boolean eq (boolean b1, boolean b2) { return b1 == b2; } - public static boolean neq(boolean b1, boolean b2) { return b1 != b2; } - public static boolean eq (char c1, char c2) { return c1 == c2; } - public static boolean neq(char c1, char c2) { return c1 != c2; } - // Operations on "polymorphic" arrays // Arrays of unknown component type are of type Object --- 19,23 ---- Index: BooleanAlgebra.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/BooleanAlgebra.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BooleanAlgebra.nice 6 Oct 2000 12:28:11 -0000 1.1 --- BooleanAlgebra.nice 23 Mar 2003 00:05:48 -0000 1.2 *************** *** 11,15 **** } - `^`(x, y) = (x & !y) | (!x & y); `->`(x, y, z) = (x & y) | (!x & z); --- 11,14 ---- Index: booleans.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/booleans.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** booleans.nice 18 Feb 2003 12:49:02 -0000 1.7 --- booleans.nice 23 Mar 2003 00:05:48 -0000 1.8 *************** *** 9,14 **** = native; ! boolean `==`(boolean, boolean) = native boolean Native.eq(boolean,boolean); ! boolean `!=`(boolean, boolean) = native boolean Native.neq(boolean,boolean); boolean TRUE() = native Boolean.TRUE; --- 9,15 ---- = native; ! boolean `==`(boolean, boolean) = inline nice.lang.inline.BoolOp("=="); ! boolean `!=`(boolean, boolean) = inline nice.lang.inline.BoolOp("^"); ! boolean TRUE() = native Boolean.TRUE; *************** *** 24,27 **** --- 25,29 ---- `&`(b1@boolean,b2@boolean) = b1 ? b2 : false; `|`(b1@boolean,b2@boolean) = b1 ? true : b2; + `^`(b1@boolean,b2@boolean) = b1 ? !b2 : b2; // same methods, but overloaded for better efficiency (no dispatch and no boxing). *************** *** 29,32 **** --- 31,35 ---- boolean `&`(boolean, boolean) = inline nice.lang.inline.BoolOp("&"); boolean `|`(boolean, boolean) = inline nice.lang.inline.BoolOp("|"); + boolean `^`(boolean, boolean) = inline nice.lang.inline.BoolOp("^"); boolean `&&`(boolean, boolean) = inline nice.lang.inline.ShortCircuitOp("&&"); Index: prelude.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/prelude.nice,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** prelude.nice 2 Jan 2003 22:18:34 -0000 1.25 --- prelude.nice 23 Mar 2003 00:05:48 -0000 1.26 *************** *** 87,95 **** ****************************************************************/ ! <Any T> boolean `==`(T,T) = native boolean Native.eq(Object,Object); ! <Any T> boolean `!=`(T,T) = native boolean Native.neq(Object, Object); ! boolean `==`(char, char) = native boolean Native.eq (char,char); ! boolean `!=`(char, char) = native boolean Native.neq(char,char); --- 87,95 ---- ****************************************************************/ ! <Any T> boolean `==`(T,T) = inline nice.lang.inline.ReferenceOp("=="); ! <Any T> boolean `!=`(T,T) = inline nice.lang.inline.ReferenceOp("!="); ! boolean `==`(char, char) = inline nice.lang.inline.CompOp("iEq"); ! boolean `!=`(char, char) = inline nice.lang.inline.CompOp("iNe"); |
From: <ar...@us...> - 2003-03-22 12:43:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv23264/F:/nice/src/bossa/syntax Modified Files: GlobalTypeScope.java TypeScope.java Log Message: In the globaltypscope are names which are case insensitve equal not allowed. Index: GlobalTypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalTypeScope.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GlobalTypeScope.java 11 Nov 2002 20:14:51 -0000 1.5 --- GlobalTypeScope.java 22 Mar 2003 12:43:21 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- package bossa.syntax; + import java.util.*; import bossa.util.*; import mlsub.typing.TypeSymbol; *************** *** 29,32 **** --- 30,43 ---- { super(null); + set = new HashSet(); + } + + void addMapping(String name, TypeSymbol s) + throws DuplicateName + { + super.addMapping(name, s); + + if (!set.add(name.toLowerCase())) + throw new DuplicateName(name); } *************** *** 86,88 **** --- 97,100 ---- public Module module; + private Set set; } Index: TypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeScope.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** TypeScope.java 29 Oct 2002 09:13:27 -0000 1.38 --- TypeScope.java 22 Mar 2003 12:43:21 -0000 1.39 *************** *** 56,60 **** class DuplicateName extends Exception { ! DuplicateName(String name, TypeSymbol old, TypeSymbol nou) { super(name + " is already declared"); --- 56,60 ---- class DuplicateName extends Exception { ! DuplicateName(String name) { super(name + " is already declared"); *************** *** 67,71 **** Object old = map.put(name,s); if (old != null) ! throw new DuplicateName(name, (TypeSymbol) old, s); } --- 67,71 ---- Object old = map.put(name,s); if (old != null) ! throw new DuplicateName(name); } |
From: <ar...@us...> - 2003-03-22 12:43:24
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv23264/F:/nice/debian Modified Files: changelog Log Message: In the globaltypscope are names which are case insensitve equal not allowed. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** changelog 20 Mar 2003 14:58:25 -0000 1.143 --- changelog 22 Mar 2003 12:43:21 -0000 1.144 *************** *** 1,5 **** nice (0.7.8) unstable; urgency=low ! * Some operators(&&, ||, ...) generate better bytecode now. * Improved bytecode generation of pre\post-condition. * Implemented the enhanced for loop(similar to java 1.5 proposal). --- 1,5 ---- nice (0.7.8) unstable; urgency=low ! * Some operators(&&, ||, ! and comparisons) generate better bytecode now. * Improved bytecode generation of pre\post-condition. * Implemented the enhanced for loop(similar to java 1.5 proposal). *************** *** 18,22 **** * Allow nested tuples on the left side of a tuple assignment: (String a, (String b, String c)) = ("a", ("b", "c")); ! * Bugfixes. -- --- 18,22 ---- * Allow nested tuples on the left side of a tuple assignment: (String a, (String b, String c)) = ("a", ("b", "c")); ! * Bugfixes (solved problems with case insentive filenames, ...). -- |
From: <ar...@us...> - 2003-03-21 23:32:38
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv22891/F:/nice/stdlib/nice/lang/inline Modified Files: BoolNotOp.java CompOp.java ShortCircuitOp.java Log Message: ShortCircuitOp implements Branchable now. Also removed CompileIf and CompileIfNot from the Brancable interface, they're to complex to have use. Index: BoolNotOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BoolNotOp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BoolNotOp.java 20 Mar 2003 19:40:04 -0000 1.2 --- BoolNotOp.java 21 Mar 2003 23:32:35 -0000 1.3 *************** *** 41,52 **** Target stack = new StackTarget(Type.boolean_type); Branchable branchOp = args[0].getBranchable(); if (branchOp != null) { ! branchOp.compileIfNot(comp, ((ApplyExp)args[0]).getArgs()); code.emitPushBoolean(true); ! code.emitElse(); code.emitPushBoolean(false); ! code.emitFi(); } else --- 41,55 ---- Target stack = new StackTarget(Type.boolean_type); Branchable branchOp = args[0].getBranchable(); + Label _else = new Label(code); + Label _end = new Label(code); if (branchOp != null) { ! branchOp.compileJump(comp, ((ApplyExp)args[0]).getArgs(), _else); code.emitPushBoolean(true); ! code.emitGoto(_end); ! _else.define(code); code.emitPushBoolean(false); ! _end.define(code); } else *************** *** 90,128 **** args[0].compile(comp, stack); code.emitGotoIfIntNeZero(to); - } - - } - - public void compileIf (Compilation comp, Expression[] args) - { - CodeAttr code = comp.getCode(); - Target stack = new StackTarget(Type.boolean_type); - Branchable branchOp = args[0].getBranchable(); - if (branchOp != null) - { - branchOp.compileIfNot(comp, ((ApplyExp)args[0]).getArgs()); - } - else - { - args[0].compile(comp, stack); - code.emitIfIntZero(); - } - - } - - public void compileIfNot (Compilation comp, Expression[] args) - { - CodeAttr code = comp.getCode(); - Target stack = new StackTarget(Type.boolean_type); - Branchable branchOp = args[0].getBranchable(); - - if (branchOp != null) - { - branchOp.compileIf(comp, ((ApplyExp)args[0]).getArgs()); - } - else - { - args[0].compile(comp, stack); - code.emitIfIntNotZero(); } --- 93,96 ---- Index: CompOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/CompOp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CompOp.java 19 Mar 2003 16:45:15 -0000 1.3 --- CompOp.java 21 Mar 2003 23:32:35 -0000 1.4 *************** *** 130,170 **** } - public void compileIf (Compilation comp, Expression[] args) - { - CodeAttr code = comp.getCode(); - Target stack = new StackTarget(argType); - - args[0].compile(comp, stack); - args[1].compile(comp, stack); - - switch(kind){ - case Eq: code.emitIfEq(); break; - case Le: code.emitIfLe(); break; - case Ge: code.emitIfGe(); break; - case Lt: code.emitIfLt(); break; - case Gt: code.emitIfGt(); break; - case Ne: code.emitIfNEq(); break; - } - } - - public void compileIfNot (Compilation comp, Expression[] args) - { - CodeAttr code = comp.getCode(); - Target stack = new StackTarget(argType); - - args[0].compile(comp, stack); - args[1].compile(comp, stack); - - switch(kind){ - case Eq: code.emitIfNEq(); break; - case Le: code.emitIfGt(); break; - case Ge: code.emitIfLt(); break; - case Lt: code.emitIfGe(); break; - case Gt: code.emitIfLe(); break; - case Ne: code.emitIfEq(); break; - } - } - - private final PrimType argType; private final Type retType = Type.boolean_type; --- 130,133 ---- Index: ShortCircuitOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ShortCircuitOp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ShortCircuitOp.java 20 Mar 2003 14:58:25 -0000 1.2 --- ShortCircuitOp.java 21 Mar 2003 23:32:35 -0000 1.3 *************** *** 22,26 **** @author Daniel Bonniot */ ! public class ShortCircuitOp extends Procedure2 implements Inlineable { private final static int --- 22,26 ---- @author Daniel Bonniot */ ! public class ShortCircuitOp extends Procedure2 implements Inlineable, Branchable { private final static int *************** *** 94,97 **** --- 94,173 ---- target.compileFromStack(comp, retType); + } + + public void compileJump (Compilation comp, Expression[] args, Label to) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + + Branchable branchOp = args[0].getBranchable(); + Branchable branchOp2 = args[1].getBranchable(); + Label _end = new Label(code); + + if (branchOp != null) + { + Expression[] brArgs = ((ApplyExp)args[0]).getArgs(); + if (kind == And) + branchOp.compileJumpNot(comp, brArgs, _end); + else + branchOp.compileJump(comp, brArgs, to); + } + else + { + args[0].compile(comp, stack); + if (kind == And) + code.emitGotoIfIntEqZero(_end); + else + code.emitGotoIfIntNeZero(to); + } + if (branchOp2 != null) + { + Expression[] brArgs = ((ApplyExp)args[1]).getArgs(); + branchOp2.compileJump(comp, brArgs, to); + } + else + { + args[1].compile(comp, stack); + code.emitGotoIfIntNeZero(to); + } + _end.define(code); + } + + public void compileJumpNot (Compilation comp, Expression[] args, Label to) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + + Branchable branchOp = args[0].getBranchable(); + Branchable branchOp2 = args[1].getBranchable(); + Label _end = new Label(code); + + if (branchOp != null) + { + Expression[] brArgs = ((ApplyExp)args[0]).getArgs(); + if (kind == And) + branchOp.compileJumpNot(comp, brArgs, to); + else + branchOp.compileJump(comp, brArgs, _end); + } + else + { + args[0].compile(comp, stack); + if (kind == And) + code.emitGotoIfIntEqZero(to); + else + code.emitGotoIfIntNeZero(_end); + } + if (branchOp2 != null) + { + Expression[] brArgs = ((ApplyExp)args[1]).getArgs(); + branchOp2.compileJumpNot(comp, brArgs, to); + } + else + { + args[1].compile(comp, stack); + code.emitGotoIfIntEqZero(to); + } + _end.define(code); } |
From: <ar...@us...> - 2003-03-21 23:32:38
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv22891/F:/nice/src/gnu/expr Modified Files: Branchable.java Log Message: ShortCircuitOp implements Branchable now. Also removed CompileIf and CompileIfNot from the Brancable interface, they're to complex to have use. Index: Branchable.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Branchable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Branchable.java 19 Mar 2003 16:45:14 -0000 1.1 --- Branchable.java 21 Mar 2003 23:32:35 -0000 1.2 *************** *** 15,28 **** 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); - - } --- 15,17 ---- |
From: <ar...@us...> - 2003-03-20 23:01:59
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv12247/F:/nice/src/nice/tools/code Modified Files: TypeImport.java Log Message: fix of bug causing a stacktrace in the compiler when a name of a existing class is mistyped by a wrong case. Index: TypeImport.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/TypeImport.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeImport.java 8 Feb 2003 16:13:21 -0000 1.3 --- TypeImport.java 20 Mar 2003 23:01:50 -0000 1.4 *************** *** 158,161 **** --- 158,162 ---- } catch(ClassNotFoundException e) {} // The class does not exist. + catch(NoClassDefFoundError e){} // idem stringToReflectClass.put(className, c); |
From: <ar...@us...> - 2003-03-20 21:18:57
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv24759/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: More precise retypings for methods using Object in the java.util Collections. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** java.nice 10 Feb 2003 10:51:20 -0000 1.17 --- java.nice 20 Mar 2003 21:18:51 -0000 1.18 *************** *** 100,118 **** ! // Some methods use Object, when they should use a type variable: ! <E> boolean contains(java.util.Collection<E>, E) = native boolean java.util.Collection.contains(Object); ! <E> boolean remove(java.util.Collection<E>, E) = native boolean java.util.Collection.remove(Object); ! <E> int indexOf(java.util.List<E>, E) = native int java.util.List.indexOf(Object); ! <E> int lastIndexOf(java.util.List<E>, E) = native int java.util.List.lastIndexOf(Object); ! <E> int lastIndexOf(java.util.Vector<E>, E, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E> boolean removeElement(java.util.Vector<E>, E) = native boolean java.util.Vector.removeElement(Object); ! <E> int search(java.util.Stack<E>, E) = native int java.util.Stack.search(Object); --- 100,119 ---- ! // Some methods use Object, when they should use a type variable. ! // It's in fact correct in java to use Object instead of a contravariant type. ! <E,T | E <: T> boolean contains(java.util.Collection<E>, T) = native boolean java.util.Collection.contains(Object); ! <E,T | E <: T> boolean remove(java.util.Collection<E>, T) = native boolean java.util.Collection.remove(Object); ! <E,T | E <: T> int indexOf(java.util.List<E>, T) = native int java.util.List.indexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.List<E>, T) = native int java.util.List.lastIndexOf(Object); ! <E,T | E <: T> int lastIndexOf(java.util.Vector<E>, T, int) = native int java.util.Vector.lastIndexOf(Object, int); ! <E,T | E <: T> boolean removeElement(java.util.Vector<E>, T) = native boolean java.util.Vector.removeElement(Object); ! <E,T | E <: T> int search(java.util.Stack<E>, T) = native int java.util.Stack.search(Object); |
From: <ar...@us...> - 2003-03-20 21:18:57
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util In directory sc8-pr-cvs1:/tmp/cvs-serv24759/F:/nice/testsuite/lib/java/util Modified Files: collections.testsuite Log Message: More precise retypings for methods using Object in the java.util Collections. Index: collections.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** collections.testsuite 4 Mar 2003 17:08:57 -0000 1.6 --- collections.testsuite 20 Mar 2003 21:18:53 -0000 1.7 *************** *** 37,38 **** --- 37,56 ---- assert list[0] == "A"; assert list[1] == "BA"; + + /// PASS + List<B> list = new ArrayList(); + B b = new B(); + list.add(b); + A obj = b; + assert(list.contains(obj)); + /// Toplevel + class A{} + class B extends A{} + + /// FAIL + List<B> list = new ArrayList(); + A obj = new A(); + list.contains(obj); + /// Toplevel + class A{} + class B{} |
From: <ar...@us...> - 2003-03-20 19:40:08
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv20786/F:/nice/stdlib/nice/lang/inline Modified Files: BoolNotOp.java Log Message: Next step in improving bytecode generation of operators, BoolNotOp implements and uses Branchable. Index: BoolNotOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BoolNotOp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BoolNotOp.java 18 Feb 2003 12:48:52 -0000 1.1 --- BoolNotOp.java 20 Mar 2003 19:40:04 -0000 1.2 *************** *** 22,26 **** @author Daniel Bonniot */ ! public class BoolNotOp extends Procedure1 implements Inlineable { private BoolNotOp() --- 22,26 ---- @author Daniel Bonniot */ ! public class BoolNotOp extends Procedure1 implements Inlineable, Branchable { private BoolNotOp() *************** *** 40,48 **** CodeAttr code = comp.getCode(); Target stack = new StackTarget(Type.boolean_type); ! args[0].compile(comp, stack); ! code.emitPushConstant(1, Type.int_type); ! code.emitXOr(); target.compileFromStack(comp, retType); } --- 40,130 ---- CodeAttr code = comp.getCode(); Target stack = new StackTarget(Type.boolean_type); + Branchable branchOp = args[0].getBranchable(); ! if (branchOp != null) ! { ! branchOp.compileIfNot(comp, ((ApplyExp)args[0]).getArgs()); ! code.emitPushBoolean(true); ! code.emitElse(); ! code.emitPushBoolean(false); ! code.emitFi(); ! } ! else ! { ! args[0].compile(comp, stack); ! code.emitPushConstant(1, Type.int_type); ! code.emitXOr(); ! } target.compileFromStack(comp, retType); + } + + public void compileJump (Compilation comp, Expression[] args, Label to) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + Branchable branchOp = args[0].getBranchable(); + + if (branchOp != null) + { + branchOp.compileJumpNot(comp, ((ApplyExp)args[0]).getArgs(), to); + } + else + { + args[0].compile(comp, stack); + code.emitGotoIfIntEqZero(to); + } + } + + public void compileJumpNot (Compilation comp, Expression[] args, Label to) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + Branchable branchOp = args[0].getBranchable(); + + if (branchOp != null) + { + branchOp.compileJump(comp, ((ApplyExp)args[0]).getArgs(), to); + } + else + { + args[0].compile(comp, stack); + code.emitGotoIfIntNeZero(to); + } + + } + + public void compileIf (Compilation comp, Expression[] args) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + Branchable branchOp = args[0].getBranchable(); + if (branchOp != null) + { + branchOp.compileIfNot(comp, ((ApplyExp)args[0]).getArgs()); + } + else + { + args[0].compile(comp, stack); + code.emitIfIntZero(); + } + + } + + public void compileIfNot (Compilation comp, Expression[] args) + { + CodeAttr code = comp.getCode(); + Target stack = new StackTarget(Type.boolean_type); + Branchable branchOp = args[0].getBranchable(); + + if (branchOp != null) + { + branchOp.compileIf(comp, ((ApplyExp)args[0]).getArgs()); + } + else + { + args[0].compile(comp, stack); + code.emitIfIntNotZero(); + } + } |
From: <ar...@us...> - 2003-03-20 19:40:07
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv20786/F:/nice/src/gnu/bytecode Modified Files: CodeAttr.java Log Message: Next step in improving bytecode generation of operators, BoolNotOp implements and uses Branchable. Index: CodeAttr.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/CodeAttr.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CodeAttr.java 19 Mar 2003 00:45:16 -0000 1.13 --- CodeAttr.java 20 Mar 2003 19:40:03 -0000 1.14 *************** *** 1274,1277 **** --- 1274,1284 ---- } + /** Compile start of conditional: if (x == 0) ... + * Also use this if you have pushed a boolean value: if (!b) ... */ + public final void emitIfIntZero() + { + emitIfCompare1(154); // ifne + } + /** Compile start of conditional: if (x <= 0) */ public final void emitIfIntLEqZero() |
From: <ar...@us...> - 2003-03-20 15:32:48
|
Update of /cvsroot/nice/swing/src/nice/ui/common In directory sc8-pr-cvs1:/tmp/cvs-serv27770/D:/nice/nice/ui/common Modified Files: common.nice Log Message: Make NiceSwing compile again with the current version of the compiler. Index: common.nice =================================================================== RCS file: /cvsroot/nice/swing/src/nice/ui/common/common.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** common.nice 13 Nov 2002 02:22:28 -0000 1.3 --- common.nice 20 Mar 2003 15:21:26 -0000 1.4 *************** *** 92,96 **** { list = new LinkedList(); ! list.add(listener); map.put(key.object(),list); } --- 92,96 ---- { list = new LinkedList(); ! notNull(list).add(listener); map.put(key.object(),list); } *************** *** 115,119 **** { list = new LinkedList(); ! list.add(listener); map.put((this.object(),key),list); } --- 115,119 ---- { list = new LinkedList(); ! notNull(list).add(listener); map.put((this.object(),key),list); } |
From: <ar...@us...> - 2003-03-20 14:58:31
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv12577/F:/nice/debian Modified Files: changelog Log Message: ShortCircuitOp makes use of Branchable if possible to generate better bytecode. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** changelog 19 Mar 2003 23:35:52 -0000 1.142 --- changelog 20 Mar 2003 14:58:25 -0000 1.143 *************** *** 1,4 **** --- 1,5 ---- nice (0.7.8) unstable; urgency=low + * Some operators(&&, ||, ...) generate better bytecode now. * Improved bytecode generation of pre\post-condition. * Implemented the enhanced for loop(similar to java 1.5 proposal). |
From: <ar...@us...> - 2003-03-20 14:58:31
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv12577/F:/nice/src/gnu/expr Modified Files: ApplyExp.java Expression.java LoopExp.java Log Message: ShortCircuitOp makes use of Branchable if possible to generate better bytecode. Index: ApplyExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ApplyExp.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ApplyExp.java 19 Mar 2003 16:45:14 -0000 1.7 --- ApplyExp.java 20 Mar 2003 14:58:23 -0000 1.8 *************** *** 516,529 **** } - public Branchable getBranchable() - { - if (func instanceof QuoteExp) - { - Object proc = ((QuoteExp) func).getValue(); - if (proc instanceof Branchable) - return (Branchable)proc; - } - return null; - } - } --- 516,518 ---- Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Expression.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Expression.java 26 Nov 2001 11:09:49 -0000 1.3 --- Expression.java 20 Mar 2003 14:58:24 -0000 1.4 *************** *** 195,197 **** --- 195,213 ---- return (flags & flag) != 0; } + + public Branchable getBranchable() + { + if (this instanceof ApplyExp) + { + Expression func = ((ApplyExp)this).func; + 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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LoopExp.java 19 Mar 2003 16:45:14 -0000 1.7 --- LoopExp.java 20 Mar 2003 14:58:24 -0000 1.8 *************** *** 89,107 **** Jump to label <code>to</code> if <code>ifExp</code> is true. ! Optimizes the case where ifExp is a integer comparison, since specific JVM bytecode handle these cases. */ private void compileIfJump(Compilation comp, Expression ifExp, Label to) { ! if (ifExp instanceof ApplyExp) ! { ! ApplyExp app = (ApplyExp) ifExp; ! Branchable branchOp = app.getBranchable(); ! if (branchOp != null) ! { ! branchOp.compileJump(comp, app.args, to); ! return; ! } ! } // General case --- 89,103 ---- Jump to label <code>to</code> if <code>ifExp</code> is true. ! Optimizes the case where ifExp is a branchable operator, since specific JVM bytecode handle these cases. */ private void compileIfJump(Compilation comp, Expression ifExp, Label to) { ! Branchable branchOp = ifExp.getBranchable(); ! if (branchOp != null) ! { ! branchOp.compileJump(comp, ((ApplyExp)ifExp).args, to); ! return; ! } // General case |
From: <ar...@us...> - 2003-03-20 14:58:30
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv12577/F:/nice/stdlib/nice/lang/inline Modified Files: ShortCircuitOp.java Log Message: ShortCircuitOp makes use of Branchable if possible to generate better bytecode. Index: ShortCircuitOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ShortCircuitOp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShortCircuitOp.java 24 Sep 2002 11:38:20 -0000 1.1 --- ShortCircuitOp.java 20 Mar 2003 14:58:25 -0000 1.2 *************** *** 53,71 **** Target stack = new StackTarget(Type.boolean_type); ! args[0].compile(comp, stack); ! code.emitIfIntNotZero(); ! if (kind == And) ! { ! args[1].compile(comp, stack); ! code.emitElse(); ! code.emitPushBoolean(false); ! } else ! { ! code.emitPushBoolean(true); ! code.emitElse(); ! args[1].compile(comp, stack); ! } ! code.emitFi(); target.compileFromStack(comp, retType); } --- 53,96 ---- Target stack = new StackTarget(Type.boolean_type); ! Branchable branchOp = args[0].getBranchable(); ! Branchable branchOp2 = args[1].getBranchable(); ! Label _else = new Label(code); ! Label _end = new Label(code); ! ! if (branchOp != null) ! { ! Expression[] brArgs = ((ApplyExp)args[0]).getArgs(); ! if (kind == And) ! branchOp.compileJumpNot(comp, brArgs, _else); ! else ! branchOp.compileJump(comp, brArgs, _else); ! } else ! { ! args[0].compile(comp, stack); ! if (kind == And) ! code.emitGotoIfIntEqZero(_else); ! else ! code.emitGotoIfIntNeZero(_else); ! } ! if (branchOp2 != null) ! { ! Expression[] brArgs = ((ApplyExp)args[1]).getArgs(); ! if (kind == And) ! branchOp2.compileJumpNot(comp, brArgs, _else); ! else ! branchOp2.compileJump(comp, brArgs, _else); ! ! code.emitPushBoolean(kind == And); ! } ! else ! args[1].compile(comp, stack); ! ! code.emitGoto(_end); ! code.popType(); //simulate 'else' otherwise gnu.bytecode don't like it ! _else.define(code); ! code.emitPushBoolean(kind != And); ! _end.define(code); ! target.compileFromStack(comp, retType); } |