nice-commit Mailing List for The Nice Programming Language (Page 97)
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-07-06 18:12:22
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8283/F:/nice/src/bossa/syntax Modified Files: ConstantExp.java MethodBodyDefinition.java Pattern.java Log Message: Implemented dispatch by integer comparision('>', '>=', '<', '<='). Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ConstantExp.java 13 Jun 2003 14:57:53 -0000 1.43 --- ConstantExp.java 6 Jul 2003 18:12:17 -0000 1.44 *************** *** 53,56 **** --- 53,61 ---- this(tc, null, representation, location); } + + public ConstantExp(Object value) + { + this.value = value; + } boolean isZero() *************** *** 80,84 **** protected LocatedString className = null; ! protected Object value; private String representation; public TypeConstructor tc; --- 85,89 ---- protected LocatedString className = null; ! public Object value; private String representation; public TypeConstructor tc; *************** *** 302,306 **** } ! long longValue() { if (value instanceof Character) --- 307,311 ---- } ! public long longValue() { if (value instanceof Character) Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** MethodBodyDefinition.java 4 Jul 2003 23:56:21 -0000 1.132 --- MethodBodyDefinition.java 6 Jul 2003 18:12:17 -0000 1.133 *************** *** 425,428 **** --- 425,437 ---- } + Monotype[] domain = declaration.getType().domain(); + + for(int n = 0; n < formals.length; n++) + { + TypeConstructor tc = Types.rawType(domain[n]).head(); + if (tc != null && formals[n].tc != null) + formals[n].setDomainTC(tc); + } + // The arguments are specialized by the patterns try{ *************** *** 434,438 **** // The arguments have types below the method declaration domain - Monotype[] domain = declaration.getType().domain(); for (int i = 0; i < monotypes.length; i++) try{ --- 443,446 ---- Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Pattern.java 5 Jul 2003 15:47:33 -0000 1.60 --- Pattern.java 6 Jul 2003 18:12:17 -0000 1.61 *************** *** 51,55 **** public Pattern(LocatedString name, TypeIdent tc, ConstantExp atValue, ! boolean exactlyAt, TypeIdent additional, TypeConstructor runtimeTC, Location location) --- 51,56 ---- public Pattern(LocatedString name, TypeIdent tc, ConstantExp atValue, ! boolean exactlyAt, int kind, ! TypeIdent additional, TypeConstructor runtimeTC, Location location) *************** *** 61,64 **** --- 62,66 ---- this.atValue = atValue; this.exactlyAt = exactlyAt; + this.compareKind = kind; this.location = location; *************** *** 75,79 **** Pattern(LocatedString name, TypeIdent tc) { ! this(name, tc, null, false, null, null, name.location()); } --- 77,81 ---- Pattern(LocatedString name, TypeIdent tc) { ! this(name, tc, null, false, NONE, null, null, name.location()); } *************** *** 86,96 **** Pattern(ConstantExp atValue) { ! this(null, null, atValue, false, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } Pattern(LocatedString name) { ! this(name, null, null, false, null, null, name.location()); } --- 88,103 ---- Pattern(ConstantExp atValue) { ! this(null, null, atValue, false, NONE, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } + Pattern(int kind, ConstantExp atValue) + { + this(null, null, atValue, false, kind, null, null, atValue.location()); + } + Pattern(LocatedString name) { ! this(name, null, null, false, NONE, null, null, name.location()); } *************** *** 348,351 **** --- 355,373 ---- return this.atValue.toString().compareTo(that.atValue.toString()) < 0; + if (this.atIntCompare() && that.atIntCompare()) + { + if (this.atLess() != that.atLess()) + return atLess(); + + long val = this.atValue.longValue(); + if (this.compareKind == LT) val--; + if (this.compareKind == GT) val++; + + return that.matchesCompareValue(val); + } + + if (that.atIntCompare()) + return this.atIntValue() && that.matchesCompareValue(this.atValue.longValue()); + if (that.atNonBoolValue()) return this.atNonBoolValue() && this.atValue.equals(that.atValue); *************** *** 369,375 **** return false; ! if (atNonBoolValue() && !atEnum()) return false; if (tag == PrimitiveType.trueBoolTC) { --- 391,400 ---- return false; ! if (atNonBoolValue() && !atEnum() ) return false; + if (atIntCompare()) + return Typing.testRigidLeq(tag, PrimitiveType.longTC); + if (tag == PrimitiveType.trueBoolTC) { *************** *** 399,405 **** --- 424,450 ---- return true; + if (atIntCompare()) + return val.value instanceof Number && matchesCompareValue(val.longValue()); + return atNonBoolValue() && atValue.equals(val); } + private boolean matchesCompareValue(long val) + { + if (compareKind == LT) + return val < atValue.longValue(); + + if (compareKind == LE) + return val <= atValue.longValue(); + + if (compareKind == GE) + return val >= atValue.longValue(); + + if (compareKind == GT) + return val > atValue.longValue(); + + return false; + } + public void setDomainEq(boolean equal) { *************** *** 411,416 **** --- 456,473 ---- if (!equal && atValue == null && Typing.testRigidLeq(tc, PrimitiveType.longTC)) User.error(location, "A pattern cannot have a primitive type that is different from the declaration."); + } + public void setDomainTC(TypeConstructor domaintc) + { + if (atIntValue()) + { + if (Typing.testRigidLeq(domaintc, PrimitiveType.intTC)) + tc = PrimitiveType.intTC; + else if (Typing.testRigidLeq(domaintc, PrimitiveType.longTC)) + tc = PrimitiveType.longTC; + } + } + public List getEnumValues () { *************** *** 434,437 **** --- 491,504 ---- public String toString() { + if (atIntCompare()) + { + String prefix = ""; + if (compareKind == LT) prefix = "<"; + if (compareKind == LE) prefix = "<="; + if (compareKind == GT) prefix = ">"; + if (compareKind == GE) prefix = ">="; + return (name!=null? name.toString() : "") + prefix + atValue; + } + if (atValue != null) return atValue.toString(); *************** *** 475,478 **** --- 542,556 ---- if (atValue != null) { + if (atIntCompare()) + { + String prefix = ""; + if (compareKind == LT) prefix = "<"; + if (compareKind == LE) prefix = "<="; + if (compareKind == GT) prefix = ">"; + if (compareKind == GE) prefix = ">="; + + return "@" + prefix + atValue; + } + if (atValue.value instanceof Number) return "@" + (atValue.longValue() >= 0 ? "+" : "") + atValue; *************** *** 534,537 **** --- 612,635 ---- name.substring(1,name.length()-1), Location.nowhere()))); + if (name.charAt(0) == '<') + { + if (name.charAt(1) == '=') + return new Pattern(LE, ConstantExp.makeNumber(new LocatedString( + name.substring(2), Location.nowhere()))); + + return new Pattern(LT, ConstantExp.makeNumber(new LocatedString( + name.substring(1), Location.nowhere()))); + } + + if (name.charAt(0) == '>') + { + if (name.charAt(1) == '=') + return new Pattern(GE, ConstantExp.makeNumber(new LocatedString( + name.substring(2), Location.nowhere()))); + + return new Pattern(GT, ConstantExp.makeNumber(new LocatedString( + name.substring(1), Location.nowhere()))); + } + if (name.charAt(0) == '=') { *************** *** 602,606 **** if (atIntValue()) ! return Gen.integerComparison("Eq", parameter, atValue.longValue()); if (atString()) --- 700,713 ---- if (atIntValue()) ! { ! String kind; ! if (compareKind == LT) kind = "Lt"; ! else if (compareKind == LE) kind = "Le"; ! else if (compareKind == GE) kind = "Ge"; ! else if (compareKind == GT) kind = "Gt"; ! else kind = "Eq"; ! ! return Gen.integerComparison(kind, parameter, atValue.longValue()); ! } if (atString()) *************** *** 634,637 **** --- 741,751 ---- private boolean exactlyAt; public ConstantExp atValue; + public int compareKind = NONE; + + public static final int NONE = 0; + public static final int LT = 1; + public static final int LE = 2; + public static final int GT = 4; + public static final int GE = 5; private Location location; *************** *** 642,646 **** } public boolean atNonBoolValue() { ! return atValue != null && !atBool() && !atNull(); } public boolean atNull() { return atValue == NullExp.instance; } --- 756,760 ---- } public boolean atNonBoolValue() { ! return atValue != null && !atBool() && !atNull() &&!atIntCompare(); } public boolean atNull() { return atValue == NullExp.instance; } *************** *** 654,656 **** --- 768,772 ---- public boolean atReference() { return atValue != null && atValue.value instanceof VarSymbol; } public boolean atEnum() { return atReference() && atValue.value instanceof EnumDefinition.EnumSymbol; } + public boolean atIntCompare() { return compareKind > 0;} + public boolean atLess() { return compareKind == LT || compareKind == LE; } } |
From: <ar...@us...> - 2003-07-06 18:12:22
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv8283/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Implemented dispatch by integer comparision('>', '>=', '<', '<='). Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.191 retrieving revision 1.192 diff -C2 -d -r1.191 -r1.192 *** Parser.jj 5 Jul 2003 15:47:34 -0000 1.191 --- Parser.jj 6 Jul 2003 18:12:17 -0000 1.192 *************** *** 1253,1256 **** --- 1253,1257 ---- ConstantExp val = null; boolean exactlyAt = false; + int kind = Pattern.NONE; Location loc = null; } *************** *** 1263,1268 **** | "#" tc=typeIdent() { exactlyAt = true; loc = tc.location(); } - | - "=" val=patternLiteral() {loc = val.location(); } ) | --- 1264,1267 ---- *************** *** 1281,1284 **** --- 1280,1295 ---- "#" tc=typeIdent() { exactlyAt = true; } | + ( ">" {kind = Pattern.GT;} + | ">=" {kind = Pattern.GE;} + | "<" {kind = Pattern.LT;} + | "<=" {kind = Pattern.LE;} + ) + ( "-" val=intConstantExp() + { val = ConstantExp.makeNumber( + new LocatedString("-"+val.toString(), val.location())); + } + | val=intConstantExp() + ) + | {} //name only ) *************** *** 1287,1291 **** [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, tc, val, exactlyAt, additional, runtimeTC, loc); } } --- 1298,1302 ---- [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, tc, val, exactlyAt, kind, additional, runtimeTC, loc); } } |
From: <ar...@us...> - 2003-07-05 17:28:29
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv8271/F:/nice/debian Modified Files: changelog Log Message: typo Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** changelog 5 Jul 2003 17:25:34 -0000 1.185 --- changelog 5 Jul 2003 17:28:27 -0000 1.186 *************** *** 5,9 **** void foo(int number); foo(number) { ... } //correct ! //void foo(n) { ... } //not valid * Added dispatch on String literals. This can be used as a switch on Strings. void foo(String color); --- 5,9 ---- void foo(int number); foo(number) { ... } //correct ! //foo(num) { ... } //not valid * Added dispatch on String literals. This can be used as a switch on Strings. void foo(String color); |
From: <ar...@us...> - 2003-07-05 17:25:37
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv7696/F:/nice/debian Modified Files: changelog Log Message: update of changelog. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** changelog 22 Jun 2003 09:57:23 -0000 1.184 --- changelog 5 Jul 2003 17:25:34 -0000 1.185 *************** *** 1,4 **** --- 1,9 ---- nice (0.9.0) unstable; urgency=low + * The names of the arguments of a default implementation of a method should + be the same as the names in the declaration. + void foo(int number); + foo(number) { ... } //correct + //void foo(n) { ... } //not valid * Added dispatch on String literals. This can be used as a switch on Strings. void foo(String color); *************** *** 8,28 **** * Added dispatch on global constants whose value is a literal. Example: let int specialValue = 7; ! void foo(int); foo(n) { /*do something*/ } ! foo(=specialValue) { /*do something else*/ } * Dispatch on global constants works also for unique references(new objects). class Color {} ! let Color red = new Color(); ! let Color blue = new Color(); ! String name(Color); name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; * Implemented simple enums. The above color example can be simplified to: ! enum Color { red, blue, green } String name(Color); ! name(=red) = "red"; ! name(=blue) = "blue"; ! name(=green) = "green"; The compiler knows now that the method "name" is completely covered. * Added operator ** to calculate powers of longs, doubles and BigIntegers. --- 13,33 ---- * Added dispatch on global constants whose value is a literal. Example: let int specialValue = 7; ! void foo(int n); foo(n) { /*do something*/ } ! foo(specialValue) { /*do something else*/ } * Dispatch on global constants works also for unique references(new objects). class Color {} ! let Color Red = new Color(); ! let Color Blue = new Color(); ! String name(Color color); name(color) = "unknown color"; ! name(Red) = "red"; ! name(Blue) = "blue"; * Implemented simple enums. The above color example can be simplified to: ! enum Color { Red, Blue, Green } String name(Color); ! name(Red) = "red"; ! name(Blue) = "blue"; ! name(Green) = "green"; The compiler knows now that the method "name" is completely covered. * Added operator ** to calculate powers of longs, doubles and BigIntegers. |
From: <ar...@us...> - 2003-07-05 17:05:26
|
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel In directory sc8-pr-cvs1:/tmp/cvs-serv4768/F:/nice/src/mlsub/typing/lowlevel Modified Files: BitVector.java Domain.java Log Message: Minor cleanup. Index: BitVector.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/BitVector.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BitVector.java 26 Jun 2003 10:37:13 -0000 1.6 --- BitVector.java 5 Jul 2003 17:05:23 -0000 1.7 *************** *** 312,333 **** /** - * do this = this & (~set) on bits >= from - */ - final public void andNot(int from, BitVector set) { - int n = Math.min(length(), set.length()); - int i = subscript(from); - if (i < n) { - andW(i, ~set.getW(i) & (-1L) << (from & MASK)); - i++; - for (; i < n; i++) { - bits1[i] &= ~set.getW(i); - } - } - } - - /** * Do this = this & (~set1 | set2) on all bits >= from **/ ! final public void andNotOr(int from, BitVector set1, BitVector set2) { int bitsLength = length(); int set1Length = set1.length(); --- 312,318 ---- /** * Do this = this & (~set1 | set2) on all bits >= from **/ ! final private void andNotOr(int from, BitVector set1, BitVector set2) { int bitsLength = length(); int set1Length = set1.length(); *************** *** 440,456 **** /** - * Do this = this ^ set - **/ - final public void xor(BitVector set) { - int setLength = set.length(); - if (setLength > 1) { - ensureChunkCapacity(setLength); - } - for (int i = setLength; i-- > 0 ;) { - xorW(i, set.getW(i)); - } - } - - /** * Gets the hashcode. */ --- 425,428 ---- *************** *** 727,754 **** } - final public int getLowestSetBitAndNotIn(BitVector set, BitVector exclude) { - int n = length(); - int setLength = set.length(); - int excludeLength = exclude.length(); - int result = 0; - for (int i = 0; i < n; i++) { - long chunk = getW(i); - if (i < setLength) { - chunk &= set.getW(i); - } else { - return UNDEFINED_INDEX; - } - if (i < excludeLength) { - chunk &= ~exclude.getW(i); - } - if (chunk != 0L) { - return result + chunkLowestSetBit(chunk); - } else { - result += 64; - } - } - return UNDEFINED_INDEX; - } - /** * Return true if this BitVector is included in set --- 699,702 ---- *************** *** 897,907 **** } - final public void slowaddProduct(BitMatrix M, BitVector v) { - int n = M.size(); - for (int i = 0; i < n; i++) { - if (v.get(i)) { - or(M.getRow(i)); - } - } - } } --- 845,847 ---- Index: Domain.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Domain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Domain.java 23 May 2003 13:05:29 -0000 1.2 --- Domain.java 5 Jul 2003 17:05:23 -0000 1.3 *************** *** 202,206 **** * Iteration thru the domain elements **/ ! int getFirstBit() { // unused method ??? int result = super.getLowestSetBit(); if (result == UNDEFINED_INDEX && containsUnit) { --- 202,206 ---- * Iteration thru the domain elements **/ ! public int getLowestSetBit() { int result = super.getLowestSetBit(); if (result == UNDEFINED_INDEX && containsUnit) { |
From: <ar...@us...> - 2003-07-05 15:47:37
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv26581/F:/nice/testsuite/compiler/methods Modified Files: globalconstant.testsuite Log Message: Removed the '=' in reference and enum patterns. Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** globalconstant.testsuite 15 Jun 2003 13:05:46 -0000 1.4 --- globalconstant.testsuite 5 Jul 2003 15:47:34 -0000 1.5 *************** *** 5,10 **** int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); ! fib(=ONE) = 1; ! fib(=TWO) = 1; /// PASS --- 5,10 ---- int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); ! fib(ONE) = 1; ! fib(TWO) = 1; /// PASS *************** *** 15,20 **** boolean foo(String); foo(s) = false; ! foo(=abc) = true; ! foo(=xyz) = false; /// FAIL --- 15,20 ---- boolean foo(String); foo(s) = false; ! foo(abc) = true; ! foo(xyz) = false; /// FAIL *************** *** 23,27 **** void foo(int); foo(n) {} ! foo(=xxx) {} foo(10) {} --- 23,27 ---- void foo(int); foo(n) {} ! foo(xxx) {} foo(10) {} *************** *** 31,35 **** void foo(int); foo(n) {} ! foo(=xxx) {} /// PASS --- 31,35 ---- void foo(int); foo(n) {} ! foo(xxx) {} /// PASS *************** *** 42,46 **** boolean foo(String); foo(s) = false; ! foo(=abc) = true; /// PASS --- 42,46 ---- boolean foo(String); foo(s) = false; ! foo(abc) = true; /// PASS *************** *** 52,57 **** boolean foo(A); foo(a) = false; ! foo(=xxx) = true; ! foo(=yyy) = false; /// PASS --- 52,57 ---- boolean foo(A); foo(a) = false; ! foo(xxx) = true; ! foo(yyy) = false; /// PASS *************** *** 63,68 **** boolean foo(A); foo(a) = false; ! foo(=xxx) = true; ! foo(=yyy) = false; /// package b import a assert(foo(xxx)); --- 63,68 ---- boolean foo(A); foo(a) = false; ! foo(xxx) = true; ! foo(yyy) = false; /// package b import a assert(foo(xxx)); *************** *** 74,79 **** void foo(A); foo(a) {} ! foo(=xxx) {} ! foo(=xxx) {} /// PASS --- 74,79 ---- void foo(A); foo(a) {} ! foo(xxx) {} ! foo(xxx) {} /// PASS *************** *** 86,92 **** String name(Color); name(color) = "unknown color"; ! name(=red) = "red"; ! name(=blue) = "blue"; ! name(=green) = "green"; /// package b import a assert red.name().equals("red"); --- 86,92 ---- String name(Color); name(color) = "unknown color"; ! name(red) = "red"; ! name(blue) = "blue"; ! name(green) = "green"; /// package b import a assert red.name().equals("red"); |
From: <ar...@us...> - 2003-07-05 15:47:37
|
Update of /cvsroot/nice/Nice/testsuite/compiler/enums In directory sc8-pr-cvs1:/tmp/cvs-serv26581/F:/nice/testsuite/compiler/enums Modified Files: enum.testsuite Log Message: Removed the '=' in reference and enum patterns. Index: enum.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/enums/enum.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** enum.testsuite 26 Jun 2003 10:44:03 -0000 1.1 --- enum.testsuite 5 Jul 2003 15:47:34 -0000 1.2 *************** *** 4,10 **** enum Color {red, blue, green} boolean foo(Color); ! foo(=red) = false; ! foo(=blue) = true; ! foo(=green) = false; /// PASS --- 4,10 ---- enum Color {red, blue, green} boolean foo(Color); ! foo(red) = false; ! foo(blue) = true; ! foo(green) = false; /// PASS *************** *** 13,19 **** enum Color {red, blue, green} boolean foo(Color); ! foo(=red) = false; ! foo(=blue) = true; ! foo(=green) = false; /// package b import a assert foo(blue); --- 13,19 ---- enum Color {red, blue, green} boolean foo(Color); ! foo(red) = false; ! foo(blue) = true; ! foo(green) = false; /// package b import a assert foo(blue); *************** *** 23,28 **** enum Color {red, blue, green} void foo(Color); ! foo(=red) = {}; ! foo(=blue) = {}; /// PASS --- 23,28 ---- enum Color {red, blue, green} void foo(Color); ! foo(red) = {}; ! foo(blue) = {}; /// PASS *************** *** 32,37 **** boolean foo(Color); foo(x) = false; ! foo(=blue) = true; ! foo(=green) = false; /// FAIL --- 32,37 ---- boolean foo(Color); foo(x) = false; ! foo(blue) = true; ! foo(green) = false; /// FAIL *************** *** 48,52 **** assert foo(green); /// Toplevel ! foo(=red) = false; ! foo(=blue) = false; ! foo(=green) = true; --- 48,52 ---- assert foo(green); /// Toplevel ! foo(red) = false; ! foo(blue) = false; ! foo(green) = true; |
From: <ar...@us...> - 2003-07-05 15:47:36
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv26581/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Removed the '=' in reference and enum patterns. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** Parser.jj 24 Jun 2003 15:28:19 -0000 1.190 --- Parser.jj 5 Jul 2003 15:47:34 -0000 1.191 *************** *** 1249,1254 **** { LocatedString name = null; - LocatedString refName = null; - Token t; TypeIdent tc=null, additional = null; TypeConstructor runtimeTC = null; --- 1249,1252 ---- *************** *** 1262,1280 **** | ( ! t="@" tc=typeIdent() { loc = tc.location(); } | ! t="#" tc=typeIdent() { exactlyAt = true; loc = tc.location(); } | ! t="=" ! ( ! val=patternLiteral() {loc = val.location(); } ! | ! refName=ident() {loc = refName.location(); } ! ) ) | name=ident() ( ! t ="@" ( val=patternLiteral() --- 1260,1273 ---- | ( ! "@" tc=typeIdent() { loc = tc.location(); } | ! "#" tc=typeIdent() { exactlyAt = true; loc = tc.location(); } | ! "=" val=patternLiteral() {loc = val.location(); } ) | name=ident() ( ! "@" ( val=patternLiteral() *************** *** 1286,1290 **** ) | ! t ="#" tc=typeIdent() { exactlyAt = true; } | {} //name only --- 1279,1283 ---- ) | ! "#" tc=typeIdent() { exactlyAt = true; } | {} //name only *************** *** 1294,1298 **** [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, refName, tc, val, exactlyAt, additional, runtimeTC, loc); } } --- 1287,1291 ---- [ "(" additional=typeIdent() ")" ] { ! return new Pattern(name, tc, val, exactlyAt, additional, runtimeTC, loc); } } |
From: <ar...@us...> - 2003-07-05 15:47:36
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv26581/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Removed the '=' in reference and enum patterns. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** Pattern.java 19 Jun 2003 16:02:02 -0000 1.59 --- Pattern.java 5 Jul 2003 15:47:33 -0000 1.60 *************** *** 49,53 **** the argument's runtime class. */ ! public Pattern(LocatedString name, LocatedString refName, TypeIdent tc, ConstantExp atValue, boolean exactlyAt, TypeIdent additional, --- 49,53 ---- the argument's runtime class. */ ! public Pattern(LocatedString name, TypeIdent tc, ConstantExp atValue, boolean exactlyAt, TypeIdent additional, *************** *** 56,60 **** { this.name = name; - this.refName = refName; this.typeConstructor = tc; this.additional = additional; --- 56,59 ---- *************** *** 76,80 **** Pattern(LocatedString name, TypeIdent tc) { ! this(name, null, tc, null, false, null, null, name.location()); } --- 75,79 ---- Pattern(LocatedString name, TypeIdent tc) { ! this(name, tc, null, false, null, null, name.location()); } *************** *** 87,97 **** Pattern(ConstantExp atValue) { ! this(null, null, null, atValue, false, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } ! Pattern(LocatedString refName) { ! this(null, refName, null, null, false, null, null, refName.location()); } --- 86,96 ---- Pattern(ConstantExp atValue) { ! this(null, null, atValue, false, null, null, atValue!=null ? atValue.location() : Location.nowhere() ); } ! Pattern(LocatedString name) { ! this(name, null, null, false, null, null, name.location()); } *************** *** 143,149 **** } - if (symbol == null) - User.error(refName, "" + refName + " is not declared"); - return symbol; } --- 142,145 ---- *************** *** 151,158 **** void resolveGlobalConstants(VarScope scope, TypeScope typeScope) { ! if (refName == null) return; - VarSymbol sym = findRefSymbol(refName); if (sym instanceof EnumDefinition.EnumSymbol) { --- 147,157 ---- void resolveGlobalConstants(VarScope scope, TypeScope typeScope) { ! if (name == null) ! return; ! ! VarSymbol sym = findRefSymbol(name); ! if (sym == null) return; if (sym instanceof EnumDefinition.EnumSymbol) { *************** *** 163,167 **** tc = val.tc; atValue = new ConstantExp(null, tc, symbol, ! refName.toString(), location); return; } --- 162,166 ---- tc = val.tc; atValue = new ConstantExp(null, tc, symbol, ! name.toString(), location); return; } *************** *** 171,175 **** { if (!symbol.constant) ! User.error(refName, "" + refName + " is not constant"); ConstantExp val = (ConstantExp)symbol.getValue(); --- 170,174 ---- { if (!symbol.constant) ! User.error(name, "" + name + " is not constant"); ConstantExp val = (ConstantExp)symbol.getValue(); *************** *** 191,198 **** tc = val.tc; atValue = new ConstantExp(null, tc, symbol, ! refName.toString(), location); } else ! User.error(refName, "The value of " + refName + "can't be used as pattern"); } --- 190,197 ---- tc = val.tc; atValue = new ConstantExp(null, tc, symbol, ! name.toString(), location); } else ! User.error(name, "The value of " + name + "can't be used as pattern"); } *************** *** 480,484 **** if (atReference()) ! return "@=" + refName; return "@" + atValue; --- 479,483 ---- if (atReference()) ! return "@=" + name; return "@" + atValue; *************** *** 622,626 **** ****************************************************************/ ! LocatedString name, refName; TypeIdent typeConstructor, additional; public TypeConstructor tc; --- 621,625 ---- ****************************************************************/ ! LocatedString name; TypeIdent typeConstructor, additional; public TypeConstructor tc; |
From: <ar...@us...> - 2003-07-04 23:56:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv29972/F:/nice/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: The name of a parameter of a default implementation should match the declaration. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** MethodBodyDefinition.java 19 Jun 2003 15:32:00 -0000 1.131 --- MethodBodyDefinition.java 4 Jul 2003 23:56:21 -0000 1.132 *************** *** 270,273 **** --- 270,286 ---- } + outer: for(Iterator it = symbols.iterator(); it.hasNext();) { + MethodDeclaration m = ((MethodDeclaration.Symbol) it.next()).getDefinition(); + if( m instanceof NiceMethod) { + FormalParameters params = m.formalParameters(); + for (int i = params.hasThis() ? 1 : 0; i < formals.length; i++) + if (formals[i].atAny() && formals[i].name != null && params.getName(i) != null && + !formals[i].name.toString().equals(params.getName(i).toString())) { + it.remove(); + continue outer; + } + } + } + if(symbols.size() == 1) return (VarSymbol) symbols.get(0); |
From: <ar...@us...> - 2003-07-04 23:50:15
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv29526/F:/nice/testsuite/compiler/classes Modified Files: typeParameters.testsuite Log Message: Added another testcase for the known bug with class typeparameters. Index: typeParameters.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/typeParameters.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** typeParameters.testsuite 24 Jun 2003 20:13:58 -0000 1.7 --- typeParameters.testsuite 4 Jul 2003 23:50:11 -0000 1.8 *************** *** 179,180 **** --- 179,190 ---- add(a@A, b@C) = super; + + /// PASS bug + // Toplevel + class A {} + void do_something( List<A> x ) {} + class B<A T> extends LinkedList<T> {} + add(x@B, o) { + do_something(x); + return super; + } |
From: <ar...@us...> - 2003-07-04 23:39:11
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv28281/F:/nice/stdlib/nice/getopt Modified Files: options.nice Log Message: The name of a parameter of a default implementation should match the declaration. Index: options.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/options.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** options.nice 15 Jun 2003 11:52:17 -0000 1.9 --- options.nice 4 Jul 2003 23:39:08 -0000 1.10 *************** *** 77,96 **** ****************************************************************/ ! option(longName, purpose, action, shortName, visible) = ! new NoParamOption(shortName: shortName, longName: longName, purpose: purpose, action: action, visible: visible); ! option(longName, purpose, optionHint, action, shortName, visible) = ! new ParamOption(shortName: shortName, ! longName: longName, purpose: purpose, optionHint: optionHint, ! actionParam: action, visible: visible); ! option(longName, purpose, optionHint, actionNoParam, actionParam, shortName, visible) = ! new OptionalParamOption(shortName: shortName, ! longName: longName, purpose: purpose, optionHint: optionHint, --- 77,96 ---- ****************************************************************/ ! option(name, purpose, action, letter, visible) = ! new NoParamOption(shortName: letter, longName: name, purpose: purpose, action: action, visible: visible); ! option(name, purpose, optionHint, actionParam, letter, visible) = ! new ParamOption(shortName: letter, ! longName: name, purpose: purpose, optionHint: optionHint, ! actionParam: actionParam, visible: visible); ! option(name, purpose, optionHint, actionNoParam, actionParam, letter, visible) = ! new OptionalParamOption(shortName: letter, ! longName: name, purpose: purpose, optionHint: optionHint, |
From: <ar...@us...> - 2003-06-30 15:22:11
|
Update of /cvsroot/nice/Nice/bin In directory sc8-pr-cvs1:/tmp/cvs-serv13983/F:/nice/bin Modified Files: nicec.bat Log Message: Update nicec.bat for new location of the main class of the compiler. Index: nicec.bat =================================================================== RCS file: /cvsroot/nice/Nice/bin/nicec.bat,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nicec.bat 29 May 2003 21:10:14 -0000 1.10 --- nicec.bat 30 Jun 2003 15:22:07 -0000 1.11 *************** *** 39,43 **** :gotNice ! java -classpath %NICE%\nice.jar;%CLASSPATH% nice.tools.compiler.fun --runtime=%NICE%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 :end --- 39,43 ---- :gotNice ! java -classpath %NICE%\nice.jar;%CLASSPATH% nice.tools.compiler.console.fun --runtime=%NICE%\nice.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 :end |
From: <bo...@us...> - 2003-06-30 13:41:49
|
Update of /cvsroot/nice/Nice/src In directory sc8-pr-cvs1:/tmp/cvs-serv28716/src Modified Files: mainClass Log Message: Main class is now nice.tools.compiler.console.fun Index: mainClass =================================================================== RCS file: /cvsroot/nice/Nice/src/mainClass,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mainClass 2 Aug 2002 07:43:15 -0000 1.3 --- mainClass 30 Jun 2003 13:41:43 -0000 1.4 *************** *** 1 **** ! Main-Class: nice.tools.compiler.fun --- 1 ---- ! Main-Class: nice.tools.compiler.console.fun |
From: <ar...@us...> - 2003-06-26 10:47:30
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv21184/F:/nice/testsuite/compiler/syntax Removed Files: enum.testsuite Log Message: Move enum testsuite to the right place. --- enum.testsuite DELETED --- |
From: <ar...@us...> - 2003-06-26 10:44:07
|
Update of /cvsroot/nice/Nice/testsuite/compiler/enums In directory sc8-pr-cvs1:/tmp/cvs-serv20762/F:/nice/testsuite/compiler/enums Added Files: enum.testsuite Log Message: Move enum testsuite to the right place. --- NEW FILE: enum.testsuite --- /// PASS assert foo(blue); /// Toplevel enum Color {red, blue, green} boolean foo(Color); foo(=red) = false; foo(=blue) = true; foo(=green) = false; /// PASS /// package a /// Toplevel enum Color {red, blue, green} boolean foo(Color); foo(=red) = false; foo(=blue) = true; foo(=green) = false; /// package b import a assert foo(blue); /// FAIL /// Toplevel enum Color {red, blue, green} void foo(Color); foo(=red) = {}; foo(=blue) = {}; /// PASS assert foo(blue); /// Toplevel enum Color {red, blue, green} boolean foo(Color); foo(x) = false; foo(=blue) = true; foo(=green) = false; /// FAIL /// Toplevel enum Single { thing } /// PASS /// package a /// Toplevel enum Color {red, blue, green} boolean foo(Color); foo(x) = false; /// package b import a assert foo(green); /// Toplevel foo(=red) = false; foo(=blue) = false; foo(=green) = true; |
From: <ar...@us...> - 2003-06-26 10:37:17
|
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel In directory sc8-pr-cvs1:/tmp/cvs-serv20124/F:/nice/src/mlsub/typing/lowlevel Modified Files: BitVector.java Interface.java K0.java Log Message: Another round of optimizations for typing.lowlevel . Index: BitVector.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/BitVector.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BitVector.java 6 Apr 2003 19:00:18 -0000 1.5 --- BitVector.java 26 Jun 2003 10:37:13 -0000 1.6 *************** *** 25,29 **** @return number of WORDS allocated */ ! private int length() { if (bits1 == null) --- 25,29 ---- @return number of WORDS allocated */ ! final private int length() { if (bits1 == null) *************** *** 36,40 **** * Convert bitIndex to a subscript into the bits[] array. */ ! private static int subscript(int bitIndex) { return bitIndex >> BITS_PER_UNIT; } --- 36,40 ---- * Convert bitIndex to a subscript into the bits[] array. */ ! final private static int subscript(int bitIndex) { return bitIndex >> BITS_PER_UNIT; } *************** *** 42,46 **** * Convert a subscript into the bits[] array to a (maximum) bitIndex. */ ! private static int bitIndex(int subscript) { return (subscript << BITS_PER_UNIT) + MASK; } --- 42,46 ---- * Convert a subscript into the bits[] array to a (maximum) bitIndex. */ ! final private static int bitIndex(int subscript) { return (subscript << BITS_PER_UNIT) + MASK; } *************** *** 50,54 **** */ public BitVector() { ! this(1 << BITS_PER_UNIT); } --- 50,55 ---- */ public BitVector() { ! bits0 = 0L; ! bits1 = null; } *************** *** 86,90 **** * @param nth the 0-origin number of the bit to ensure is there. */ ! private void ensureCapacity(int nth) { int required = subscript(nth) + 1; /* +1 to get length, not index */ if (required == 1) --- 87,91 ---- * @param nth the 0-origin number of the bit to ensure is there. */ ! final private void ensureCapacity(int nth) { int required = subscript(nth) + 1; /* +1 to get length, not index */ if (required == 1) *************** *** 107,115 **** } /** * Sets a bit. * @param bit the bit to be set */ ! public void set(int bit) { if (bit < 0) { throw new IndexOutOfBoundsException(Integer.toString(bit)); --- 108,134 ---- } + final private void ensureChunkCapacity(int required) { + if (required > length()) { + /* Ask for larger of doubled size or required size */ + int request = Math.max(2 * length(), required); + if (bits1 == null) + { + bits1 = new long[request]; + bits1[0] = bits0; + } + else + { + long[] newBits = new long[request]; + System.arraycopy(bits1, 0, newBits, 0, bits1.length); + bits1 = newBits; + } + } + } + /** * Sets a bit. * @param bit the bit to be set */ ! final public void set(int bit) { if (bit < 0) { throw new IndexOutOfBoundsException(Integer.toString(bit)); *************** *** 130,138 **** throw new IndexOutOfBoundsException(Integer.toString(bit)); } ! ensureCapacity(bit); ! if (bits1 == null) ! bits0 &= ~(1L << bit); // we know that bit <= 64 ! else ! bits1[subscript(bit)] &= ~(1L << (bit & MASK)); } --- 149,155 ---- throw new IndexOutOfBoundsException(Integer.toString(bit)); } ! int sub = subscript(bit); ! if (sub < length()) ! andW(sub, ~(1L << (bit & MASK))); } *************** *** 234,238 **** @return bits[i] */ ! private long getW(int i) { if (bits1 == null) --- 251,255 ---- @return bits[i] */ ! final private long getW(int i) { if (bits1 == null) *************** *** 247,251 **** Assumes i is a valid word index. */ ! private void setW(int i, long w) { if (bits1 == null) --- 264,268 ---- Assumes i is a valid word index. */ ! final private void setW(int i, long w) { if (bits1 == null) *************** *** 260,264 **** Assumes i is a valid word index. */ ! private void andW(int i, long w) { if (bits1 == null) --- 277,281 ---- Assumes i is a valid word index. */ ! final private void andW(int i, long w) { if (bits1 == null) *************** *** 273,277 **** Assumes i is a valid word index. */ ! private void orW(int i, long w) { if (bits1 == null) --- 290,294 ---- Assumes i is a valid word index. */ ! final private void orW(int i, long w) { if (bits1 == null) *************** *** 286,290 **** Assumes i is a valid word index. */ ! private void xorW(int i, long w) { if (bits1 == null) --- 303,307 ---- Assumes i is a valid word index. */ ! final private void xorW(int i, long w) { if (bits1 == null) *************** *** 383,392 **** **/ final public void or(BitVector set) { ! if (this == set) { ! return; ! } ! int setLength = set.nonZeroLength(); if (setLength > 1) { ! ensureCapacity(bitIndex(setLength-1)); for (int i = setLength; i-- > 0 ;) { bits1[i] |= set.bits1[i]; --- 400,406 ---- **/ final public void or(BitVector set) { ! int setLength = set.length(); if (setLength > 1) { ! ensureChunkCapacity(setLength); for (int i = setLength; i-- > 0 ;) { bits1[i] |= set.bits1[i]; *************** *** 400,434 **** /** - * Do this = this | (set1 & ~set2) - **/ - final public void orNotIn(BitVector set1, BitVector set2) { - if (this == set1) { - return; - } - int set1Length = set1.nonZeroLength(); - int set2Length = set2.length(); - if (set1Length > 0) { - ensureCapacity(bitIndex(set1Length - 1)); // XXX: problem ? - } - for (int i = set1Length; i-- > 0;) { - if (i < set2Length) { - orW(i, set1.getW(i) & ~set2.getW(i)); - } else { - orW(i, set1.getW(i)); - } - } - } - - - /** * Do this = this | (set1 & set2) **/ final public void orAnd(BitVector set1, BitVector set2) { - if (this == set1 || this == set2) { - return; - } int setLength = Math.min(set1.nonZeroLength(),set2.nonZeroLength()); ! if (setLength > 0) { ! ensureCapacity(bitIndex(setLength-1));// this might cause some problem... } for (int i = setLength; i-- > 0 ;) { --- 414,423 ---- /** * Do this = this | (set1 & set2) **/ final public void orAnd(BitVector set1, BitVector set2) { int setLength = Math.min(set1.nonZeroLength(),set2.nonZeroLength()); ! if (setLength > 1) { ! ensureChunkCapacity(setLength); } for (int i = setLength; i-- > 0 ;) { *************** *** 437,456 **** } - - /* * If there are some trailing zeros, don't count them * result is greater or equal to 1 */ ! private int nonZeroLength() { if (bits1 == null) return 1; ! int n = bits1.length; ! while (n > 1 && bits1[n-1] == 0L) { n--; } ! return n; } - /** * Do this = this ^ set --- 426,442 ---- } /* * If there are some trailing zeros, don't count them * result is greater or equal to 1 */ ! final private int nonZeroLength() { if (bits1 == null) return 1; ! int n = bits1.length-1; ! while (n > 0 && bits1[n] == 0L) { n--; } ! return n+1; } /** * Do this = this ^ set *************** *** 458,463 **** final public void xor(BitVector set) { int setLength = set.length(); ! if (setLength > 0) { ! ensureCapacity(bitIndex(setLength-1)); } for (int i = setLength; i-- > 0 ;) { --- 444,449 ---- final public void xor(BitVector set) { int setLength = set.length(); ! if (setLength > 1) { ! ensureChunkCapacity(setLength); } for (int i = setLength; i-- > 0 ;) { *************** *** 522,527 **** } - - /** * Clones the BitVector. --- 508,511 ---- *************** *** 613,617 **** } ! private static /* XXX: work around Symantec JIT bug: comment static */ int chunkLowestSetBit(long chunk) { --- 597,601 ---- } ! final private static /* XXX: work around Symantec JIT bug: comment static */ int chunkLowestSetBit(long chunk) { *************** *** 633,637 **** * set is empty. **/ ! final public int getLowestSetBit() { if (bits1 == null) { --- 617,621 ---- * set is empty. **/ ! public int getLowestSetBit() { if (bits1 == null) { *************** *** 700,704 **** } - /** * Compute the first bit set in this & ~set. --- 684,687 ---- *************** *** 802,812 **** **/ public boolean isEmpty() { ! int n = length(); ! for (int i = 0; i < n; i++) { ! if (getW(i) != 0L) { return false; ! } ! } ! return true; } --- 785,796 ---- **/ public boolean isEmpty() { ! if (bits1 == null) ! return bits0 == 0L; ! ! for (int i = bits1.length; --i>0; ) ! if (bits1[i] != 0L) return false; ! ! return bits1[0] == 0L; } *************** *** 873,877 **** } - /** * Clears the first n bits of this BitVector --- 857,860 ---- *************** *** 895,904 **** final public void addProduct(BitMatrix M, BitVector v) { int n = M.size(); ! for(int i = v.getLowestSetBit(); i >= 0; i = v.getLowestSetBit(i+1)) ! or(M.getRow(i)); } final public void slowaddProduct(BitMatrix M, BitVector v) { int n = M.size(); --- 878,900 ---- final public void addProduct(BitMatrix M, BitVector v) { int n = M.size(); ! ensureCapacity(n); for(int i = v.getLowestSetBit(); i >= 0; i = v.getLowestSetBit(i+1)) ! { ! BitVector set = M.getRow(i); ! int setLength = set.nonZeroLength(); ! if (setLength > 1) { ! for (int j = setLength; j-- > 0 ;) ! bits1[j] |= set.bits1[j]; ! } ! else ! { ! orW(0, set.getW(0)); ! } ! ! } } + final public void slowaddProduct(BitMatrix M, BitVector v) { int n = M.size(); Index: Interface.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Interface.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Interface.java 2 Jun 2003 17:58:27 -0000 1.3 --- Interface.java 26 Jun 2003 10:37:13 -0000 1.4 *************** *** 40,44 **** // the approximation of each node of the original context private final IntVect approx = new IntVect(BitVector.UNDEFINED_INDEX); ! public void setApprox(int node, int approx) { --- 40,50 ---- // the approximation of each node of the original context private final IntVect approx = new IntVect(BitVector.UNDEFINED_INDEX); ! private final BitVector hasapprox = new BitVector(); ! ! public BitVector getHasApprox() ! { ! return hasapprox; ! } ! public void setApprox(int node, int approx) { *************** *** 46,49 **** --- 52,59 ---- this.approx.setSize(node+1, BitVector.UNDEFINED_INDEX); this.approx.set(node, approx); + if (approx == BitVector.UNDEFINED_INDEX) + hasapprox.clear(node); + else + hasapprox.set(node); } *************** *** 62,69 **** --- 72,81 ---- implementors.truncate(n); approx.setSize(n,BitVector.UNDEFINED_INDEX); + hasapprox.truncate(n); } void indexMove(int src, int dest) { implementors.bitCopy(src, dest); approx.set(dest,approx.get(src)); + hasapprox.set(dest); if (k0.isRigid(src)) { // strange as the relation on the rigid indexes should already be Index: K0.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/K0.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** K0.java 2 Jun 2003 17:58:26 -0000 1.18 --- K0.java 26 Jun 2003 10:37:13 -0000 1.19 *************** *** 1026,1048 **** { changed=false; ! ! for(int iid=0; iid<nInterfaces(); iid++) { Interface i=getInterface(iid); int n1; ! //XXX optim: if we had a BitVector i.hasApprox, ! // this could be faster. ! for(int node=0; node<n; node++) ! if((n1=i.getApprox(node))!=BitVector.UNDEFINED_INDEX) // node ->_i n1 ! for(int p=0; p<n; p++) // is implementors OK ? // or should not we compute rigidImplementors first ? ! //XXX optim: use i.implementors.getXXXbit to find p candidates ! if(i.implementors.get(p) ! && leq.get(node,p)) if(this.isRigid(p)) ! if(!leq.get(n1,p)) ! throw new LowlevelUnsatisfiable ("saturateAbs: there should be "+ indexToString(n1)+" <: "+ --- 1026,1049 ---- { changed=false; ! int nInt = nInterfaces(); ! for(int iid=0; iid<nInt; iid++) { Interface i=getInterface(iid); int n1; ! BitVector hasApprox = i.getHasApprox(); ! for(int node=hasApprox.getLowestSetBit(); ! node != BitVector.UNDEFINED_INDEX; ! node = hasApprox.getNextBit(node)) ! { // node ->_i n1 ! n1=i.getApprox(node); ! for(int p = i.implementors.getLowestSetBit(); ! p != BitVector.UNDEFINED_INDEX; ! p = i.implementors.getNextBit(p)) // is implementors OK ? // or should not we compute rigidImplementors first ? ! if(leq.get(node,p) && !leq.get(n1,p)) if(this.isRigid(p)) ! throw new LowlevelUnsatisfiable ("saturateAbs: there should be "+ indexToString(n1)+" <: "+ *************** *** 1051,1068 **** "interface "+interfaceToString(iid)+"\n"+ this); - else /* Nothing to do. Cool! */ ; else ! if(!leq.get(n1,p)) ! { ! if(debugK0) System.err.println("Abs rule applied : "+ indexToString(n1)+" < "+indexToString(p)+ " using "+indexToString(node)+ " for interface "+interfaceToString(iid)); ! C .set(n1,p); ! Ct.set(p,n1); ! leq.set(n1,p); ! changed=true; ! } } if(changed) --- 1052,1068 ---- "interface "+interfaceToString(iid)+"\n"+ this); else ! { ! if(debugK0) System.err.println("Abs rule applied : "+ indexToString(n1)+" < "+indexToString(p)+ " using "+indexToString(node)+ " for interface "+interfaceToString(iid)); ! C .set(n1,p); ! Ct.set(p,n1); ! leq.set(n1,p); ! changed=true; ! } ! } } if(changed) |
From: <bo...@us...> - 2003-06-24 21:39:48
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1:/tmp/cvs-serv16246/src/bossa/util Modified Files: Location.java Log Message: Fix printing when file is null. Index: Location.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Location.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Location.java 24 Jun 2003 15:28:19 -0000 1.24 --- Location.java 24 Jun 2003 21:39:45 -0000 1.25 *************** *** 133,137 **** public String toString() { ! return nice.tools.util.System.prettyPrint(file); } --- 133,140 ---- public String toString() { ! if (file == null) ! return ""; ! else ! return nice.tools.util.System.prettyPrint(file); } |
From: <bo...@us...> - 2003-06-24 20:14:01
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv342/testsuite/compiler/classes Modified Files: typeParameters.testsuite Log Message: Issues with coverage test involving constrained class type parameters. Index: typeParameters.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/typeParameters.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** typeParameters.testsuite 23 Dec 2002 19:55:41 -0000 1.6 --- typeParameters.testsuite 24 Jun 2003 20:13:58 -0000 1.7 *************** *** 166,167 **** --- 166,180 ---- /// package b import a void dummy() {} + + /// PASS bug + class B {} + class A<T | T <: B, B <: T> extends AbstractSet<T> { } + + add(a@A, b@B) = super; + + /// PASS bug + abstract class B {} + class C extends B {} + class A<T | T <: B, B <: T> extends AbstractSet<T> { } + + add(a@A, b@C) = super; |
From: <bo...@us...> - 2003-06-24 20:07:41
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv31471/src/gnu/bytecode Modified Files: Type.java CodeAttr.java ClassType.java Log Message: In the bytecode, make method calls refer to the most precise reveiver. This improves the ability to compile on one version of the JDK and run on an earlier one, if a super-class is added in the later version (this happens in particular between JDK 1.3 and 1.4 with String and CharSequence). Incidentally, it can make the method call more efficient, especially if it changes an interface method into a class method. Index: Type.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/Type.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Type.java 4 Dec 2002 10:31:13 -0000 1.13 --- Type.java 24 Jun 2003 20:07:38 -0000 1.14 *************** *** 460,463 **** --- 460,467 ---- return null; + // Optimization + if (t1 == t2) + return t1; + if (t1.isSubtype(t2)) return t2; *************** *** 560,563 **** --- 564,576 ---- { throw new Error ("unimplemented emitCoerceFromObject for "+this); + } + + /** + Return an equivalent method when the receiver is of this type. + Return null if no more precise method exists. + */ + Method refineMethod (Method method) + { + return null; } Index: CodeAttr.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/CodeAttr.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CodeAttr.java 2 Apr 2003 21:38:17 -0000 1.16 --- CodeAttr.java 24 Jun 2003 20:07:38 -0000 1.17 *************** *** 637,643 **** public void emitPushNull () { reserve(1); put1(1); // aconst_null ! pushType(Type.pointer_type); } --- 637,651 ---- public void emitPushNull () { + emitPushNull(Type.pointer_type); + } + + /** + @param type the type <code>null</code> is considered to have. + */ + public void emitPushNull (Type type) + { reserve(1); put1(1); // aconst_null ! pushType(type); } *************** *** 1056,1061 **** throw new Error ("emitInvokeXxx static flag mis-match method.flags="+method.access_flags); if (!is_invokestatic) ! arg_count++; put1(opcode); // invokevirtual, invokespecial, or invokestatic putIndex2(getConstants().addMethodRef(method)); --- 1064,1096 ---- throw new Error ("emitInvokeXxx static flag mis-match method.flags="+method.access_flags); + while (--arg_count >= 0) + popType(); if (!is_invokestatic) ! { ! arg_count++; ! Type receiverType = popType(); ! // Don't change anything is the call is an invokespecial ! if (opcode != 183 && receiverType != method.getDeclaringClass()) ! { ! // We try to find a more precise method, given the known ! // type of the receiver. ! Method preciseMethod = receiverType.refineMethod(method); ! ! if (preciseMethod != null && ! // Don't choose a more precise method if it is an ! // interface method, and the original is a class method ! // (can happen if the original class is Object, like in ! // Object.equals, refined in List.equals). ! ((! preciseMethod.getDeclaringClass().isInterface()) || ! method.getDeclaringClass().isInterface())) ! { ! method = preciseMethod; ! // It could be that the call was an invokeinterface, and ! // now became an invokevirtual. ! if (opcode == 185 && ! method.getDeclaringClass().isInterface()) ! opcode = 182; ! } ! } ! } put1(opcode); // invokevirtual, invokespecial, or invokestatic putIndex2(getConstants().addMethodRef(method)); *************** *** 1065,1070 **** put1(0); } - while (--arg_count >= 0) - popType(); if (method.return_type.size != 0) pushType(method.return_type); --- 1100,1103 ---- *************** *** 1479,1482 **** --- 1512,1530 ---- + " while SP at end of 'else' was " + SP); } + else + { + // Reconcile the types on the stack. + for (int i = 0; i < if_stack.then_stacked_types.length; i++) + { + Type t1 = if_stack.then_stacked_types[i]; + Type t2 = stack_types[if_stack.start_stack_size + i]; + + Type common = Type.lowestCommonSuperType(t1, t2); + if (common == null) + common = Type.pointer_type; + + stack_types[if_stack.start_stack_size + i] = common; + } + } } else if (unreachable_here) Index: ClassType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassType.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ClassType.java 26 Apr 2003 15:47:02 -0000 1.14 --- ClassType.java 24 Jun 2003 20:07:38 -0000 1.15 *************** *** 712,715 **** --- 712,728 ---- } + /** + Return an equivalent method when the receiver is of this type. + Return null if no more precise method exists. + */ + Method refineMethod (Method method) + { + Method res = getMethod(method.getName(), method.arg_types); + if (res == method) + return null; + else + return res; + } + /** Do various fixups after generating code but before we can write it out. * This includes assigning constant pool indexes where needed, *************** *** 991,994 **** --- 1004,1010 ---- emitCoerceToObject(code); code.emitFi(); + + // Set the type + code.popType(); code.pushType(collectionType); } else |
From: <bo...@us...> - 2003-06-24 20:07:40
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv31471/testsuite/lib/nice/lang Modified Files: clone.testsuite Log Message: In the bytecode, make method calls refer to the most precise reveiver. This improves the ability to compile on one version of the JDK and run on an earlier one, if a super-class is added in the later version (this happens in particular between JDK 1.3 and 1.4 with String and CharSequence). Incidentally, it can make the method call more efficient, especially if it changes an interface method into a class method. Index: clone.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/clone.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** clone.testsuite 16 May 2003 00:15:02 -0000 1.1 --- clone.testsuite 24 Jun 2003 20:07:37 -0000 1.2 *************** *** 1,3 **** ! /// PASS bug let a1 = new A(x: 1); let a2 = a1.clone(); --- 1,3 ---- ! /// PASS let a1 = new A(x: 1); let a2 = a1.clone(); |
From: <bo...@us...> - 2003-06-24 20:07:40
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv31471/src/nice/tools/code Modified Files: SpecialArray.java Log Message: In the bytecode, make method calls refer to the most precise reveiver. This improves the ability to compile on one version of the JDK and run on an earlier one, if a super-class is added in the later version (this happens in particular between JDK 1.3 and 1.4 with String and CharSequence). Incidentally, it can make the method call more efficient, especially if it changes an interface method into a class method. Index: SpecialArray.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/SpecialArray.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SpecialArray.java 2 Jun 2003 18:04:42 -0000 1.13 --- SpecialArray.java 24 Jun 2003 20:07:38 -0000 1.14 *************** *** 238,244 **** code.emitPop(1); ! code.emitPushNull(); ! // Set the type ! code.popType(); code.pushType(toType); code.emitFi(); --- 238,242 ---- code.emitPop(1); ! code.emitPushNull(toType); code.emitFi(); |
From: <bo...@us...> - 2003-06-24 20:07:40
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv31471/src/gnu/expr Modified Files: Compilation.java Log Message: In the bytecode, make method calls refer to the most precise reveiver. This improves the ability to compile on one version of the JDK and run on an earlier one, if a super-class is added in the later version (this happens in particular between JDK 1.3 and 1.4 with String and CharSequence). Incidentally, it can make the method call more efficient, especially if it changes an interface method into a class method. Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Compilation.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Compilation.java 20 Feb 2003 14:58:37 -0000 1.18 --- Compilation.java 24 Jun 2003 20:07:38 -0000 1.19 *************** *** 449,453 **** { boolean val = ((PrimType) type).booleanValue(value); ! code.emitPushInt(val ? 1 : 0); return; } --- 449,453 ---- { boolean val = ((PrimType) type).booleanValue(value); ! code.emitPushBoolean(val); return; } |
From: <bo...@us...> - 2003-06-24 20:07:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv31471/testsuite/compiler/native Modified Files: methods.testsuite Log Message: In the bytecode, make method calls refer to the most precise reveiver. This improves the ability to compile on one version of the JDK and run on an earlier one, if a super-class is added in the later version (this happens in particular between JDK 1.3 and 1.4 with String and CharSequence). Incidentally, it can make the method call more efficient, especially if it changes an interface method into a class method. Index: methods.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/methods.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methods.testsuite 17 Jun 2003 09:27:41 -0000 1.3 --- methods.testsuite 24 Jun 2003 20:07:37 -0000 1.4 *************** *** 17,18 **** --- 17,25 ---- List<String> list2 = [s1, s2]; assert list1.equals(list2); + + /// PASS + assert foo(true).equals("1"); + assert foo(false).equals("2"); + ///Toplevel + String foo(boolean b) = + (b ? new Integer(1) : new Long(2)).toString(); |
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv20812/src/bossa/modules Modified Files: Package.java DirectorySourceContent.java DirectoryCompiledContent.java Content.java Compilation.nice Log Message: Refactored bossa.util.Location, to provide a higher-level view on locations, using several subclasses for the different cases. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** Package.java 22 Jun 2003 09:51:56 -0000 1.92 --- Package.java 24 Jun 2003 15:28:19 -0000 1.93 *************** *** 41,45 **** boolean isRoot) { ! return make(new LocatedString(name, bossa.util.Location.nowhereAtAll()), compilation, isRoot); } --- 41,45 ---- boolean isRoot) { ! return make(new LocatedString(name, Location.option), compilation, isRoot); } Index: DirectorySourceContent.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/DirectorySourceContent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DirectorySourceContent.java 30 Oct 2001 15:38:24 -0000 1.1 --- DirectorySourceContent.java 24 Jun 2003 15:28:19 -0000 1.2 *************** *** 67,71 **** Content.Unit[] res = new Content.Unit[sources.length]; for(int i = 0; i<res.length; i++) ! res[i] = new Content.Unit(read(sources[i]), sources[i].toString()); return res; --- 67,71 ---- Content.Unit[] res = new Content.Unit[sources.length]; for(int i = 0; i<res.length; i++) ! res[i] = new Content.Unit(read(sources[i]), sources[i]); return res; Index: DirectoryCompiledContent.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/DirectoryCompiledContent.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DirectoryCompiledContent.java 31 May 2003 17:31:49 -0000 1.7 --- DirectoryCompiledContent.java 24 Jun 2003 15:28:19 -0000 1.8 *************** *** 57,61 **** Content.Unit[] getDefinitions() { ! return new Content.Unit[]{ new Content.Unit(read(itf), itf.toString()) }; } --- 57,61 ---- Content.Unit[] getDefinitions() { ! return new Content.Unit[]{ new Content.Unit(read(itf), itf) }; } Index: Content.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Content.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Content.java 25 Nov 2002 18:58:31 -0000 1.9 --- Content.java 24 Jun 2003 15:28:19 -0000 1.10 *************** *** 102,106 **** private void read(Content.Unit unit, List imports, Set opens) { ! bossa.util.Location.setCurrentFile(unit.name); bossa.syntax.LocatedString pkgName = --- 102,106 ---- private void read(Content.Unit unit, List imports, Set opens) { ! bossa.util.Location.setCurrentFile(unit.file); bossa.syntax.LocatedString pkgName = *************** *** 114,118 **** private void read(Content.Unit unit, List definitions) { ! bossa.util.Location.setCurrentFile(unit.name); bossa.parser.Loader.open(unit.reader, definitions); } --- 114,118 ---- private void read(Content.Unit unit, List definitions) { ! bossa.util.Location.setCurrentFile(unit.file); bossa.parser.Loader.open(unit.reader, definitions); } *************** *** 249,252 **** --- 249,257 ---- static protected class Unit { + protected Unit(BufferedReader reader, File file) + { + this.reader = reader; + this.file = file; + } protected Unit(BufferedReader reader, String name) { *************** *** 256,259 **** --- 261,265 ---- BufferedReader reader; String name; + File file; } Index: Compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Compilation.nice 15 Jun 2003 11:07:45 -0000 1.24 --- Compilation.nice 24 Jun 2003 15:28:19 -0000 1.25 *************** *** 83,87 **** Package.make("nice.lang", this, false); ! this.root = Package.make(new bossa.syntax.LocatedString(packageName, new bossa.util.Location("Command line")), this, true); } --- 83,90 ---- Package.make("nice.lang", this, false); ! this.root = Package.make ! (new bossa.syntax.LocatedString(packageName, ! bossa.util.Location.option), ! this, true); } |