nice-commit Mailing List for The Nice Programming Language (Page 21)
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: Daniel B. <bo...@us...> - 2005-02-19 13:25:47
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13399 Modified Files: NEWS Log Message: Typo. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** NEWS 11 Feb 2005 01:39:37 -0000 1.59 --- NEWS 19 Feb 2005 13:25:31 -0000 1.60 *************** *** 23,27 **** * Java methods and fields with parametric types are given a type with UnknownTypes as type parameters instead of being ignored. ! * Number of errors and warning are printed in the console. * Bug fixes (disallowed redefinition of parameters, execution order of initializers in super classes, visibility checking of java classes, --- 23,27 ---- * Java methods and fields with parametric types are given a type with UnknownTypes as type parameters instead of being ignored. ! * Number of errors and warning are printed to the console. * Bug fixes (disallowed redefinition of parameters, execution order of initializers in super classes, visibility checking of java classes, |
From: Daniel B. <bo...@us...> - 2005-02-19 13:23:38
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12934/src/nice/tools/compiler Modified Files: native.nice Log Message: Use threads to read stdout and stderr instead of actively polling for output. Doubles native compilation speed. Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/native.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** native.nice 7 Oct 2004 22:03:41 -0000 1.8 --- native.nice 19 Feb 2005 13:23:18 -0000 1.9 *************** *** 83,104 **** let printer = new PrintWriter(w); ! while (true) ! { ! if (out.ready) ! for (?String line = out.readLine(); line != null; ! line = out.readLine()) ! printer.println(line); ! if (err.ready) ! for (?String line = err.readLine(); line != null; ! line = err.readLine()) ! printer.println(line); ! try { ! return p.exitValue(); ! } ! catch(IllegalThreadStateException e) { ! // The process is not finished yet. ! } ! } } --- 83,102 ---- let printer = new PrintWriter(w); ! let consumeOut = thread(()=> { ! for (?String line = out.readLine(); line != null; line = out.readLine()) ! printer.println(line); ! }); ! let consumeErr = thread(()=> { ! for (?String line = err.readLine(); line != null; line = err.readLine()) ! printer.println(line); ! }); ! consumeOut.start(); ! consumeErr.start(); ! ! consumeOut.join(); ! consumeErr.join(); ! ! return p.waitFor(); } |
From: Daniel B. <bo...@us...> - 2005-02-18 17:16:03
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26389/src/gnu/bytecode Modified Files: SourceMap.java Log Message: Do not repeat file_number->file_name mappings. This saves about 50% of the space. Index: SourceMap.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/SourceMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SourceMap.java 16 Feb 2005 23:31:39 -0000 1.6 --- SourceMap.java 18 Feb 2005 17:15:54 -0000 1.7 *************** *** 128,134 **** fileNumber = new Integer(lastFileNumber); fileMap.put(file, fileNumber); } - buffer.append(fileNumber.intValue()).append(' ').append(file).append('\n'); return fileNumber.intValue(); } --- 128,135 ---- fileNumber = new Integer(lastFileNumber); fileMap.put(file, fileNumber); + + buffer.append(lastFileNumber).append(' ').append(file).append('\n'); } return fileNumber.intValue(); } |
From: Daniel B. <bo...@us...> - 2005-02-16 23:31:48
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19546/src/gnu/bytecode Modified Files: SourceMap.java Log Message: Make sure to produce a valid source map while keeping its size below 65535. Index: SourceMap.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/SourceMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SourceMap.java 12 Feb 2005 13:53:37 -0000 1.5 --- SourceMap.java 16 Feb 2005 23:31:39 -0000 1.6 *************** *** 40,45 **** public int getLength() { ! // Truncate the content to keep it under 65535, because of a JVM bug. ! return Math.min(65535, getBytes().length); } --- 40,44 ---- public int getLength() { ! return getBytes().length; } *************** *** 64,69 **** { byte[] bytes = getBytes(); ! // Truncate the content to keep it under 65535, because of a JVM bug. ! out.write(bytes, 0, Math.min(65535, bytes.length)); } --- 63,67 ---- { byte[] bytes = getBytes(); ! out.write(bytes, 0, bytes.length); } *************** *** 93,96 **** --- 91,98 ---- return -1; + // Truncate the content to keep it under 65535, because of a JVM bug. + if (buffer.length() + lines.length() > 65000) + return -1; + if (! file.equals(currentFile) || line < firstLine) { |
From: Arjan B. <ar...@us...> - 2005-02-16 23:24:57
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18035/F:/nice/src/bossa/syntax Modified Files: AST.java Log Message: Avoid NPE when compiling empty packages. Index: AST.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/AST.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** AST.java 26 Nov 2004 20:26:01 -0000 1.62 --- AST.java 16 Feb 2005 23:24:49 -0000 1.63 *************** *** 27,30 **** --- 27,32 ---- { super(children, propagate); + if (this.children == null) + this.children = new LinkedList(); } |
From: Daniel B. <bo...@us...> - 2005-02-16 22:35:29
|
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5448/src/mlsub/typing/lowlevel Modified Files: K0.java Engine.java Log Message: Fix classes whose parent has less type parameters that the grand-parent, by creating a new TypeConstructor when this is discovered (fixes #1097571). Index: K0.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/K0.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** K0.java 29 Jun 2004 18:38:18 -0000 1.23 --- K0.java 16 Feb 2005 22:34:49 -0000 1.24 *************** *** 168,172 **** } ! /*********************************************************************** * Pretty printing --- 168,176 ---- } ! void discard(int x) ! { ! garbage.set(x); ! } ! /*********************************************************************** * Pretty printing Index: Engine.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Engine.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Engine.java 29 Jun 2004 18:38:18 -0000 1.34 --- Engine.java 16 Feb 2005 22:34:49 -0000 1.35 *************** *** 941,945 **** return k0.isMinimal(e.getId()); } ! public Element lowestInstance(Element e) { --- 941,951 ---- return k0.isMinimal(e.getId()); } ! ! public final void discard(Element e) ! { ! concreteElements.clear(e.getId()); ! k0.discard(e.getId()); ! } ! public Element lowestInstance(Element e) { |
From: Daniel B. <bo...@us...> - 2005-02-16 22:35:29
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5448/testsuite/compiler/classes Modified Files: specialization.testsuite Log Message: Fix classes whose parent has less type parameters that the grand-parent, by creating a new TypeConstructor when this is discovered (fixes #1097571). Index: specialization.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/specialization.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** specialization.testsuite 16 Feb 2005 12:13:17 -0000 1.10 --- specialization.testsuite 16 Feb 2005 22:34:49 -0000 1.11 *************** *** 82,87 **** } ! /// PASS bug ! // bug #1097571 /// Toplevel class A<T> {} --- 82,87 ---- } ! /// PASS ! // bug #1097571 /// Toplevel class A<T> {} *************** *** 89,94 **** class C extends B {} ! /// PASS bug ! // bug #1097571 /// Toplevel interface A<T> {} --- 89,94 ---- class C extends B {} ! /// PASS ! // bug #1097571 /// Toplevel interface A<T> {} *************** *** 97,100 **** --- 97,158 ---- /// PASS + // bug #1097571 + /// Toplevel + interface Term<T> { + T value(); + } + interface Bool implements Term<boolean> {} + class BoolImpl implements Bool { + value() = true; + } + + /// PASS + // bug #1097571 + /// Toplevel + interface Term<T> { + T value(); + } + interface Bool implements Term<boolean> {} + class BoolImpl implements Bool { + } + value(BoolImpl this) = true; + + /// PASS + /// Toplevel + class A<T,U> {} + class B<T> extends A<T,String> {} + class C extends B<boolean> {} + + /// PASS + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B { + void foo() {} + } + + /// PASS + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B {} + void foo(C this) {} + + /// PASS + C c = new C(); + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B {} + + /// PASS bug + C c = new C(0); + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B {} + new C(int x) = this(); + + /// PASS /// package a /// Toplevel *************** *** 113,114 **** --- 171,193 ---- /// package b import a B<int> b = new B(x: 0); + + /// PASS + /// package a + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B {} + + /// package b import a + C c = new C(); + + /// PASS + /// package a + /// Toplevel + class A<T> {} + class B extends A<String> {} + class C extends B {} + new C(int x) = this(); + + /// package b import a + C c = new C(0); |
From: Daniel B. <bo...@us...> - 2005-02-16 22:35:16
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5448/src/bossa/syntax Modified Files: typedef.nice monotype.nice TypeScope.java Log Message: Fix classes whose parent has less type parameters that the grand-parent, by creating a new TypeConstructor when this is discovered (fixes #1097571). Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** typedef.nice 16 Feb 2005 12:13:17 -0000 1.18 --- typedef.nice 16 Feb 2005 22:35:06 -0000 1.19 *************** *** 38,47 **** ?mlsub.typing.Monotype[?] parentParams = null; int[?] parentTypeParameterMap = null; ! { modifiers.makePublic(); ! int arity = getVariance(this); ! let tpv = notNull( typeParametersVariances ); --- 38,51 ---- ?mlsub.typing.Monotype[?] parentParams = null; int[?] parentTypeParameterMap = null; ! { modifiers.makePublic(); ! this.computeVariance(); ! } ! ! void computeVariance() ! { int arity = getVariance(this); ! let tpv = notNull( typeParametersVariances ); *************** *** 50,57 **** else this.variance = mlsub.typing.Variance.make(new int[arity]); ! this.createTC(); typeParametersVariances = null; ! if( modifiers.isFinal() ) tc.setMinimal(); --- 54,61 ---- else this.variance = mlsub.typing.Variance.make(new int[arity]); ! this.createTC(); typeParametersVariances = null; ! if( modifiers.isFinal() ) tc.setMinimal(); *************** *** 59,63 **** boolean isConcrete() = !modifiers.isAbstract(); ! boolean implementsJavaInterface(String name) { --- 63,67 ---- boolean isConcrete() = !modifiers.isAbstract(); ! boolean implementsJavaInterface(String name) { *************** *** 235,238 **** --- 239,244 ---- } + this.recomputeVariance(); + this.createContext(); } *************** *** 521,528 **** { ?mlsub.typing.Interface associatedInterface = null; ! { ! modifiers.makeInterface(); ! associatedInterface = new mlsub.typing.Interface(variance, tc); } --- 527,533 ---- { ?mlsub.typing.Interface associatedInterface = null; ! { ! modifiers.makeInterface(); } *************** *** 533,537 **** getTypeSymbol() = notNull( associatedInterface ); ! resolveClass() { --- 538,548 ---- getTypeSymbol() = notNull( associatedInterface ); ! ! computeVariance() ! { ! super; ! associatedInterface = new mlsub.typing.Interface(variance, tc); ! } ! resolveClass() { *************** *** 747,751 **** if (missing == 0) ! return new mlsub.typing.MonotypeConstructor(tc, cast(params) ); return null; --- 758,762 ---- if (missing == 0) ! return new mlsub.typing.MonotypeConstructor(def.tc, cast(params) ); return null; *************** *** 800,804 **** return null; ! return new mlsub.typing.MonotypeConstructor(tc, cast(fullParams)); } --- 811,815 ---- return null; ! return new mlsub.typing.MonotypeConstructor(def.tc, cast(fullParams)); } *************** *** 861,864 **** --- 872,917 ---- } + // Variance lookup after resolution + + void recomputeVariance(TypeDefinition this) + { + for (itf : interfaces) + { + let itfDef = getTypeDefinition(itf.associatedTC()); + if (itfDef != null) + { + this.copyVariance(itfDef); + return; + } + } + } + + recomputeVariance(ClassDefinition this) + { + let superClass = this.getSuperClassDefinition(); + if (superClass != null) + this.copyVariance(superClass); + else + super; + } + + private void copyVariance(TypeDefinition this, TypeDefinition from) + { + if (this.variance != from.variance) + { + this.variance = from.variance; + tc.discard(); + let constructors = getConstructors(tc); + this.createTC(); + if (constructors != null) + for (c : constructors) + addConstructor(tc, c.getMethodDeclaration()); + Node.getGlobalTypeScope().updateMapping(tc.toString(), tc); + classConstraint = from.classConstraint; + parentParams = from.parentParams; + parentTypeParameterMap = from.parentTypeParameterMap; + } + } + // Constructors ClassDefinition makeClass(LocatedString name, Index: monotype.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/monotype.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** monotype.nice 16 Jan 2005 00:28:21 -0000 1.11 --- monotype.nice 16 Feb 2005 22:35:06 -0000 1.12 *************** *** 141,153 **** rawResolve(tm) { try{ return sureMonotype(new mlsub.typing.MonotypeConstructor(tc, params)); } catch(mlsub.typing.BadSizeEx e){ - // See if this is a class with default type parameters - let res = getTypeWithTC(tc, params); - if (res != null) - return sureMonotype(res); - throw User.error(this, "Class " + tc + Util.has(e.expected, "type parameter", e.actual)); } --- 141,153 ---- rawResolve(tm) { + // See if this is a class with default type parameters + let res = getTypeWithTC(tc, params); + if (res != null) + return sureMonotype(res); + try{ return sureMonotype(new mlsub.typing.MonotypeConstructor(tc, params)); } catch(mlsub.typing.BadSizeEx e){ throw User.error(this, "Class " + tc + Util.has(e.expected, "type parameter", e.actual)); } Index: TypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeScope.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** TypeScope.java 20 Dec 2004 20:25:53 -0000 1.41 --- TypeScope.java 16 Feb 2005 22:35:06 -0000 1.42 *************** *** 74,77 **** --- 74,83 ---- } + /** Change a previous mapping. */ + void updateMapping(String name, TypeSymbol s) + { + map.put(name, s); + } + void addMappings(Collection names, TypeSymbol[] symbols) throws DuplicateName |
From: Daniel B. <bo...@us...> - 2005-02-16 22:35:14
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5448/src/mlsub/typing Modified Files: TypeConstructor.java Log Message: Fix classes whose parent has less type parameters that the grand-parent, by creating a new TypeConstructor when this is discovered (fixes #1097571). Index: TypeConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/TypeConstructor.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** TypeConstructor.java 17 Mar 2004 16:55:34 -0000 1.18 --- TypeConstructor.java 16 Feb 2005 22:34:50 -0000 1.19 *************** *** 93,96 **** --- 93,101 ---- } + public void discard() + { + variance.getConstraint().discard(this); + } + public int arity() { |
From: Daniel B. <bo...@us...> - 2005-02-16 16:24:42
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2996/src/bossa/modules Modified Files: Package.java Log Message: Cleanup. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** Package.java 14 Jan 2005 11:12:08 -0000 1.134 --- Package.java 16 Feb 2005 16:24:33 -0000 1.135 *************** *** 519,523 **** { JarFile runtime = null; ! if (runtimeJar != null) try { --- 519,523 ---- { JarFile runtime = null; ! if (runtimeJar != null) try { *************** *** 569,573 **** } ! private static void addEntry(String name, InputStream data, JarOutputStream out) throws IOException --- 569,573 ---- } ! private static void addEntry(String name, InputStream data, JarOutputStream out) throws IOException *************** *** 583,587 **** if (size < 1024) size = 1024; byte[] buf = new byte[size]; ! try{ int read; --- 583,587 ---- if (size < 1024) size = 1024; byte[] buf = new byte[size]; ! try{ int read; *************** *** 598,602 **** } } ! /**************************************************************** * Code generation --- 598,602 ---- } } ! /**************************************************************** * Code generation *************** *** 604,608 **** /** The name of the class package functions and method implementations ! are stored in. **/ static final String packageClassName = "fun"; --- 604,608 ---- /** The name of the class package functions and method implementations ! are stored in. **/ static final String packageClassName = "fun"; *************** *** 612,616 **** if (compiling()) return bossa.syntax.dispatch.NiceClass_createClassExp(def); ! String name = bossa.syntax.dispatch.NiceClass_getName(def).toString(); ClassType classe = source.readClass(name); --- 612,616 ---- if (compiling()) return bossa.syntax.dispatch.NiceClass_createClassExp(def); ! String name = bossa.syntax.dispatch.NiceClass_getName(def).toString(); ClassType classe = source.readClass(name); *************** *** 618,622 **** Internal.error("Compiled class " + def + " was not found"); importMethods(def, classe); ! ClassExp res = new ClassExp(classe); addUserClass(res); --- 618,622 ---- Internal.error("Compiled class " + def + " was not found"); importMethods(def, classe); ! ClassExp res = new ClassExp(classe); addUserClass(res); *************** *** 646,651 **** } ! public void addGlobalVar(gnu.expr.Declaration decl, ! boolean constant) { if (!compiling()) --- 646,650 ---- } ! public void addGlobalVar(gnu.expr.Declaration decl, boolean constant) { if (!compiling()) |
From: Daniel B. <bo...@us...> - 2005-02-16 16:18:29
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1290 Modified Files: Makefile Log Message: Make the default target not force recompilation and not archive the results, which is more practical when working on the Nice parts of the compiler. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** Makefile 7 Feb 2005 17:37:54 -0000 1.157 --- Makefile 16 Feb 2005 16:18:20 -0000 1.158 *************** *** 40,44 **** ! all: src/nice/tools/compiler/console.jar compiler2 archive2 stable: clean bootstrap compiler1 testengine archiveOld --- 40,48 ---- ! all: src/nice/tools/compiler/console.jar compiler ! ! compiler: setDate ! ${NICEC1} bossa.syntax ! ${NICEC1} -a src/nice/tools/compiler/console.jar nice.tools.compiler.console stable: clean bootstrap compiler1 testengine archiveOld |
From: Daniel B. <bo...@us...> - 2005-02-16 12:13:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4957/src/bossa/syntax Modified Files: typedef.nice methodContainer.nice importedconstructor.nice Log Message: Properly print interface of classes that specialize their parent's type parameters. Fix loading of compiled constructors for such classes. Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** importedconstructor.nice 14 Jan 2005 16:41:27 -0000 1.14 --- importedconstructor.nice 16 Feb 2005 12:13:17 -0000 1.15 *************** *** 96,101 **** let classDef = def.getDefinition(); ! let returnType = new MonotypeWrapper(type: sureMonotype ! (new mlsub.typing.MonotypeConstructor(classDef.getTC(), classDef.getTypeParameters()))); let constraint = classDef.classConstraint == null ? --- 96,101 ---- let classDef = def.getDefinition(); ! let returnType = new SureMonotypeWrapper ! (tc: classDef.getTC(), params: classDef.getTypeParameters()); let constraint = classDef.classConstraint == null ? Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** typedef.nice 16 Jan 2005 21:51:15 -0000 1.17 --- typedef.nice 16 Feb 2005 12:13:17 -0000 1.18 *************** *** 587,592 **** s.print(c.getSimpleName()); s.print(c.printTypeParameters()); ! if (c.superClass != null) ! s.print(" extends " + c.superClass); s.print(printInterfaces(" implements ", c.interfaces, c.javaInterfaces)); if (c.abs != null) --- 587,593 ---- s.print(c.getSimpleName()); s.print(c.printTypeParameters()); ! let sup = c.superClass; ! if (sup != null) ! s.print(" extends " + c.completeParams(sup)); s.print(printInterfaces(" implements ", c.interfaces, c.javaInterfaces)); if (c.abs != null) *************** *** 596,599 **** --- 597,612 ---- } + String completeParams(TypeDefinition this, mlsub.typing.TypeConstructor tc) + { + let params = completeTypeParameters + (this, + declaredClassConstraint == null ? null : notNull(declaredClassConstraint).typeParameters); + + if (params == null) + return tc.toString(); + else + return tc.toString + Util.map("<", ",", ">", params); + } + printInterface(InterfaceDefinition i, java.io.PrintWriter s) { *************** *** 740,759 **** /** ! Returns a monotype based on this tc, provided that the class ! requires exactly these type parameters because it specializes its parent. ! */ ! ?mlsub.typing.Monotype getTypeWithTC(mlsub.typing.TypeConstructor tc, mlsub.typing.Monotype[?] sourceParams ) { - ?TypeDefinition def = getTypeDefinition(tc); - - if (def == null) - return null; - let params = def.parentParams; let paramMap = def.parentTypeParameterMap; ! if (params == null || paramMap == null) return null; ! ?mlsub.typing.Monotype[] fullParams = new mlsub.typing.Monotype[params.length]; --- 753,768 ---- /** ! Compute the full type parameters for the class (including possibly implicit ! ones made necessary by a superclass with more type parameters which have ! been specialized). ! */ ! ?(mlsub.typing.Monotype[]) completeTypeParameters(TypeDefinition def, mlsub.typing.Monotype[?] sourceParams) { let params = def.parentParams; let paramMap = def.parentTypeParameterMap; ! if (params == null || paramMap == null) return null; ! ?mlsub.typing.Monotype[] fullParams = new mlsub.typing.Monotype[params.length]; *************** *** 762,766 **** if (params[i] == null) { ! fullParams[i] = notNull(sourceParams)[paramMap[i]]; used++; } --- 771,777 ---- if (params[i] == null) { ! if (sourceParams == null) ! return null; ! fullParams[i] = sourceParams[paramMap[i]]; used++; } *************** *** 771,774 **** --- 782,803 ---- return null; + return cast(fullParams); + } + + /** + Returns a monotype based on this tc, provided that the class + requires exactly these type parameters because it specializes its parent. + */ + ?mlsub.typing.Monotype getTypeWithTC(mlsub.typing.TypeConstructor tc, mlsub.typing.Monotype[?] sourceParams ) + { + ?TypeDefinition def = getTypeDefinition(tc); + + if (def == null) + return null; + + let fullParams = completeTypeParameters(def, sourceParams); + if (fullParams == null) + return null; + return new mlsub.typing.MonotypeConstructor(tc, cast(fullParams)); } Index: methodContainer.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodContainer.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methodContainer.nice 16 Jan 2005 00:28:21 -0000 1.3 --- methodContainer.nice 16 Feb 2005 12:13:17 -0000 1.4 *************** *** 26,29 **** --- 26,32 ---- ?mlsub.typing.Variance variance = null; ?ClassConstraint classConstraint = null; + /** Remember the declared class constraint, as it appears in the source. */ + ?ClassConstraint declaredClassConstraint = null; + { declaredClassConstraint = classConstraint; } mlsub.typing.AtomicConstraint[?] resolvedConstraints = null; *************** *** 90,105 **** // Always print the constraint as a prefix constraint. ! if (classConstraint == null) return; ! s.print(classConstraint); } String printTypeParameters() { ! if (classConstraint == null) return ""; ! mlsub.typing.Monotype[] typeParameters = notNull(classConstraint).typeParameters; StringBuffer res = new StringBuffer("<"); for (int n = 0; n < typeParameters.length; n++) --- 93,108 ---- // Always print the constraint as a prefix constraint. ! if (declaredClassConstraint == null) return; ! s.print(declaredClassConstraint); } String printTypeParameters() { ! if (declaredClassConstraint == null) return ""; ! mlsub.typing.Monotype[] typeParameters = notNull(declaredClassConstraint).typeParameters; StringBuffer res = new StringBuffer("<"); for (int n = 0; n < typeParameters.length; n++) *************** *** 205,207 **** return res; ! } \ No newline at end of file --- 208,210 ---- return res; ! } |
From: Daniel B. <bo...@us...> - 2005-02-16 12:13:31
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4957/testsuite/compiler/classes Modified Files: specialization.testsuite Log Message: Properly print interface of classes that specialize their parent's type parameters. Fix loading of compiled constructors for such classes. Index: specialization.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/specialization.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** specialization.testsuite 8 Jan 2005 14:46:42 -0000 1.9 --- specialization.testsuite 16 Feb 2005 12:13:17 -0000 1.10 *************** *** 95,96 **** --- 95,114 ---- interface B extends A<boolean> {} class C implements B {} + + /// PASS + /// package a + /// Toplevel + class A<T> {} + class B extends A<String> {} + + /// package b import a + B b = new B(); + + /// PASS + /// package a + /// Toplevel + class A<T,U> { T x; } + class B<T> extends A<T,String> {} + + /// package b import a + B<int> b = new B(x: 0); |
From: Daniel B. <bo...@us...> - 2005-02-13 17:49:59
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25336/debian Modified Files: changelog Log Message: Closed 0.9.10. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.243 retrieving revision 1.244 diff -C2 -d -r1.243 -r1.244 *** changelog 4 Sep 2004 19:17:47 -0000 1.243 --- changelog 13 Feb 2005 17:49:38 -0000 1.244 *************** *** 1,2 **** --- 1,9 ---- + nice (0.9.10-1) unstable; urgency=low + + * New upstream version. + * Version 0.9.9-1 was not uploaded to the Debian archive. + + -- Daniel Bonniot <bo...@us...> Sun, 13 Feb 2005 11:10:44 +0100 + nice (0.9.9-1) unstable; urgency=low |
From: Daniel B. <bo...@us...> - 2005-02-12 17:48:48
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29630/src/bossa/syntax Modified Files: pattern.nice Log Message: Make sure overrides can leave arguments with possibly-null types unspecified. Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pattern.nice 17 Jan 2005 13:16:57 -0000 1.19 --- pattern.nice 12 Feb 2005 17:48:39 -0000 1.20 *************** *** 264,268 **** return new NotNullPattern(name: name, tc: nice.tools.typing.PrimitiveType.sureTC, loc: loc); ! if (tc == null) return new VariablePattern(name: name, loc: loc); --- 264,268 ---- return new NotNullPattern(name: name, tc: nice.tools.typing.PrimitiveType.sureTC, loc: loc); ! if (tc == null || !sure) return new VariablePattern(name: name, loc: loc); |
From: Daniel B. <bo...@us...> - 2005-02-12 17:48:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29630/testsuite/compiler/methods Modified Files: overriding.testsuite Log Message: Make sure overrides can leave arguments with possibly-null types unspecified. Index: overriding.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/overriding.testsuite,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** overriding.testsuite 20 Dec 2004 22:18:02 -0000 1.11 --- overriding.testsuite 12 Feb 2005 17:48:39 -0000 1.12 *************** *** 266,267 **** --- 266,293 ---- void foo(?A x) {} override void foo(?B x) {} + + /// PASS + /// Toplevel + abstract class A + { + void foo(?String s); + } + + class B extends A + { + override void foo(?String s) {} + } + + /// PASS + /// package a + /// Toplevel + abstract class A + { + void foo(?String s); + } + /// package b import a + /// Toplevel + class B extends A + { + override void foo(?String s) {} + } |
From: Daniel B. <bo...@us...> - 2005-02-12 14:44:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20498/src/bossa/syntax Modified Files: javaFieldAccess.nice Log Message: Cleanup. Index: javaFieldAccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaFieldAccess.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** javaFieldAccess.nice 14 Jan 2005 16:41:27 -0000 1.5 --- javaFieldAccess.nice 12 Feb 2005 14:44:30 -0000 1.6 *************** *** 70,91 **** { ?gnu.bytecode.ClassType c = null; ! try { ! let type = nice.tools.code.Types.type(javaClass); if (type instanceof gnu.bytecode.ClassType) { c = type; ! assert c != null; // Typechecker limitation // remembers the fully qualified name className.content = c.getName(); ! for (?gnu.bytecode.Field f = c.getFields(); f != null; f = f.getNext() ) ! if (name.equals(f.getName())) ! return f; } else ! User.error(javaClass,"Class " + javaClass + " not found"); } ! catch(ClassCastException e) { ! User.error(javaClass, javaClass + " is a primitive type, it has no field"); } --- 70,91 ---- { ?gnu.bytecode.ClassType c = null; ! try { ! let type = nice.tools.code.Types.type(javaClass); if (type instanceof gnu.bytecode.ClassType) { c = type; ! assert c != null; // Typechecker limitation // remembers the fully qualified name className.content = c.getName(); ! for (?gnu.bytecode.Field f = c.getFields(); f != null; f = f.getNext()) ! if (name.equals(f.getName())) ! return f; } else ! User.error(javaClass, "Class "javaClass" not found"); } ! catch(ClassCastException e) { ! User.error(javaClass, javaClass + " is a primitive type, it has no field"); } |
From: Daniel B. <bo...@us...> - 2005-02-12 13:53:46
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32655/src/gnu/bytecode Modified Files: SourceMap.java Log Message: Truncate SourceDebugExtension to make sure it does not exceed 65535 bytes, to workaround a Sun JVM bug. Index: SourceMap.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/SourceMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SourceMap.java 10 Feb 2005 17:00:34 -0000 1.4 --- SourceMap.java 12 Feb 2005 13:53:37 -0000 1.5 *************** *** 38,44 **** private static final String trailer = "*E\n"; ! public int getLength() { ! return getBytes().length; } --- 38,45 ---- private static final String trailer = "*E\n"; ! public int getLength() { ! // Truncate the content to keep it under 65535, because of a JVM bug. ! return Math.min(65535, getBytes().length); } *************** *** 59,67 **** } ! public void write(java.io.DataOutputStream out) throws java.io.IOException { byte[] bytes = getBytes(); ! out.write(bytes, 0, bytes.length); } --- 60,69 ---- } ! public void write(java.io.DataOutputStream out) throws java.io.IOException { byte[] bytes = getBytes(); ! // Truncate the content to keep it under 65535, because of a JVM bug. ! out.write(bytes, 0, Math.min(65535, bytes.length)); } |
From: Daniel B. <bo...@us...> - 2005-02-11 15:37:13
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25830/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: Factored compileJump and compileJumpNot by xoring the conditions with a flag representing whether we do "Not", or not. Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ReferenceOp.java 11 Feb 2005 01:39:36 -0000 1.9 --- ReferenceOp.java 11 Feb 2005 15:37:03 -0000 1.10 *************** *** 140,143 **** --- 140,154 ---- public void compileJump (Compilation comp, Expression[] args, Label to) { + compileJump(comp, args, to, false); + } + + public void compileJumpNot (Compilation comp, Expression[] args, Label to) + { + compileJump(comp, args, to, true); + } + + private void compileJump (Compilation comp, Expression[] args, Label to, + boolean not) + { CodeAttr code = comp.getCode(); Target stack = Target.pushObject; *************** *** 149,153 **** { compile(args, comp, StackTarget.getInstance(Type.boolean_type)); ! code.emitGotoIfIntNeZero(to); } --- 160,167 ---- { compile(args, comp, StackTarget.getInstance(Type.boolean_type)); ! if (not) ! code.emitGotoIfIntEqZero(to); ! else ! code.emitGotoIfIntNeZero(to); } *************** *** 157,161 **** if (args[1].getType() instanceof PrimType) { ! if (kind == Ne) code.emitGoto(to); --- 171,175 ---- if (args[1].getType() instanceof PrimType) { ! if (not ^ kind == Ne) code.emitGoto(to); *************** *** 164,172 **** args[1].compile(comp, stack); ! if (kind == Eq) code.emitGotoIfNull(to); else code.emitGotoIfNotNull(to); - } else if (args[1] instanceof QuoteExp && --- 178,185 ---- args[1].compile(comp, stack); ! if (not ^ kind == Eq) code.emitGotoIfNull(to); else code.emitGotoIfNotNull(to); } else if (args[1] instanceof QuoteExp && *************** *** 175,179 **** if (args[0].getType() instanceof PrimType) { ! if (kind == Ne) code.emitGoto(to); --- 188,192 ---- if (args[0].getType() instanceof PrimType) { ! if (not ^ kind == Ne) code.emitGoto(to); *************** *** 182,190 **** args[0].compile(comp, stack); ! if (kind == Eq) code.emitGotoIfNull(to); else code.emitGotoIfNotNull(to); - } else --- 195,202 ---- args[0].compile(comp, stack); ! if (not ^ kind == Eq) code.emitGotoIfNull(to); else code.emitGotoIfNotNull(to); } else *************** *** 192,262 **** 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 = Target.pushObject; - - boolean prim0 = args[0].getType() instanceof PrimType; - boolean prim1 = args[1].getType() instanceof PrimType; - - if (prim1 && ! prim0 || prim0 && ! prim1) - { - compile(args, comp, StackTarget.getInstance(Type.boolean_type)); - code.emitGotoIfIntEqZero(to); - } - - else if (args[0] instanceof QuoteExp && - ((QuoteExp)args[0]).getType() == Type.nullType) - { - if (args[1].getType() instanceof PrimType) - { - if (kind == Eq) - code.emitGoto(to); - - return; - } - - 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) - { - if (args[0].getType() instanceof PrimType) - { - if (kind == Eq) - code.emitGoto(to); - - return; - } - - 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); - } } --- 204,211 ---- args[0].compile(comp, stack); args[1].compile(comp, stack); ! if (not ^ kind == Eq) code.emitGotoIfEq(to); else code.emitGotoIfNE(to); } } |
From: Daniel B. <bo...@us...> - 2005-02-11 01:40:06
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705 Modified Files: NEWS Log Message: Correctly compare possibly null values with primitive values by unwrapping the possibly null value and performing a native comparison. Wrapping the primitive value and performing reference comparison could return false even with identical values. (fixes #1090679) Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** NEWS 13 Jan 2005 23:33:00 -0000 1.58 --- NEWS 11 Feb 2005 01:39:37 -0000 1.59 *************** *** 27,31 **** initializers in super classes, visibility checking of java classes, cyclic custom constructors, methods and fields in classes with less type ! parameters, 'this' in custom constructors, ... ) -- --- 27,32 ---- initializers in super classes, visibility checking of java classes, cyclic custom constructors, methods and fields in classes with less type ! parameters, 'this' in custom constructors, comparison of possibly null ! values with primitive values, ... ) -- |
From: Daniel B. <bo...@us...> - 2005-02-11 01:39:48
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: Correctly compare possibly null values with primitive values by unwrapping the possibly null value and performing a native comparison. Wrapping the primitive value and performing reference comparison could return false even with identical values. (fixes #1090679) Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ReferenceOp.java 8 Feb 2005 19:29:51 -0000 1.8 --- ReferenceOp.java 11 Feb 2005 01:39:36 -0000 1.9 *************** *** 48,51 **** --- 48,56 ---- { Expression[] args = exp.getArgs(); + compile(args, comp, target); + } + + void compile (Expression[] args, Compilation comp, Target target) + { CodeAttr code = comp.getCode(); Target stack = Target.pushObject; *************** *** 53,58 **** Label _end = new Label(code); ! if (args[0] instanceof QuoteExp && ! ((QuoteExp)args[0]).getType() == Type.nullType) { args[1].compile(comp, stack); --- 58,76 ---- Label _end = new Label(code); ! boolean prim0 = args[0].getType() instanceof PrimType; ! boolean prim1 = args[1].getType() instanceof PrimType; ! ! if (prim1 && ! prim0) ! { ! compilePrimitive(false, args[0], args[1], comp); ! return; ! } ! else if (prim0 && ! prim1) ! { ! compilePrimitive(true, args[1], args[0], comp); ! return; ! } ! else if (args[0] instanceof QuoteExp && ! ((QuoteExp)args[0]).getType() == Type.nullType) { args[1].compile(comp, stack); *************** *** 61,65 **** else code.emitGotoIfNull(_else); - } else if (args[1] instanceof QuoteExp && --- 79,82 ---- *************** *** 71,75 **** else code.emitGotoIfNull(_else); - } else --- 88,91 ---- *************** *** 93,96 **** --- 109,141 ---- } + private void compilePrimitive + (boolean primFirst, Expression nonPrimArg, Expression primArg, + Compilation comp) + { + CodeAttr code = comp.getCode(); + Target stack = Target.pushObject; + Target primTarget = new StackTarget(primArg.getType()); + boolean eq = kind == Eq; + + if (primFirst) + primArg.compile(comp, primTarget); + nonPrimArg.compile(comp, stack); + code.emitDup(); + + code.emitIfNotNull(); + primTarget.compileFromStack(comp, code.topType()); + if (! primFirst) + primArg.compile(comp, primTarget); + code.emitIfEq(); + code.emitPushBoolean(eq); + code.emitElse(); + code.emitPushBoolean(!eq); + code.emitFi(); + code.emitElse(); + code.emitPop(primFirst ? 2 : 1); + code.emitPushBoolean(!eq); + code.emitFi(); + } + public void compileJump (Compilation comp, Expression[] args, Label to) { *************** *** 98,102 **** Target stack = Target.pushObject; ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { --- 143,156 ---- Target stack = Target.pushObject; ! boolean prim0 = args[0].getType() instanceof PrimType; ! boolean prim1 = args[1].getType() instanceof PrimType; ! ! if (prim1 && ! prim0 || prim0 && ! prim1) ! { ! compile(args, comp, StackTarget.getInstance(Type.boolean_type)); ! code.emitGotoIfIntNeZero(to); ! } ! ! else if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { *************** *** 151,155 **** Target stack = Target.pushObject; ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { --- 205,218 ---- Target stack = Target.pushObject; ! boolean prim0 = args[0].getType() instanceof PrimType; ! boolean prim1 = args[1].getType() instanceof PrimType; ! ! if (prim1 && ! prim0 || prim0 && ! prim1) ! { ! compile(args, comp, StackTarget.getInstance(Type.boolean_type)); ! code.emitGotoIfIntEqZero(to); ! } ! ! else if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { |
From: Daniel B. <bo...@us...> - 2005-02-11 01:39:47
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/operators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705/testsuite/compiler/expressions/operators Added Files: equality-primitive-optional.testsuite Log Message: Correctly compare possibly null values with primitive values by unwrapping the possibly null value and performing a native comparison. Wrapping the primitive value and performing reference comparison could return false even with identical values. (fixes #1090679) --- NEW FILE: equality-primitive-optional.testsuite --- /// COMMENT Boolean jumps, non-primitive first /// PASS // bug #1090679 var ?int charcode = 64+1; assert charcode == 65; assert !(charcode == 0); assert !(charcode == null); /// PASS var ?int charcode = 64+1; assert !(charcode != 65); assert charcode != 0; assert charcode != null; /// COMMENT Boolean jumps, primitive first /// PASS var ?int charcode = 64+1; assert 65 == charcode; assert !(0 == charcode); assert !(null == charcode); /// PASS var ?int charcode = 64+1; assert !(65 != charcode); assert 0 != charcode; assert null != charcode; /// COMMENT Boolean assignments, non-primitive first /// PASS var ?int charcode = 64+1; var res = charcode == 65; assert res; res = charcode == 0; assert !res; res = charcode == null; assert !res; /// PASS var ?int charcode = 64+1; var res = charcode != 65; assert !res; res = charcode != 0; assert res; res = charcode != null; assert res; /// COMMENT Boolean assignments, primitive first /// PASS var ?int charcode = 64+1; var res = 65 == charcode; assert res; res = 0 == charcode; assert !res; res = null == charcode; assert !res; /// PASS var ?int charcode = 64+1; var res = 65 != charcode; assert !res; res = 0 != charcode; assert res; res = null != charcode; assert res; /// PASS // check evaluation order var ?int charcode = 0; // If the left hand side is evaluated before the right, the result is true. assert (()=> charcode = 1)() == charcode; /// PASS var ?boolean b = ! false; var res = b == true; assert res; res = true == b; assert res; assert b == true; assert true == b; |
From: Arjan B. <ar...@us...> - 2005-02-10 17:00:43
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14813/F:/nice/src/gnu/bytecode Modified Files: SourceMap.java Log Message: Optimization of the SourceDebugExtension attribute size. Index: SourceMap.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/SourceMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SourceMap.java 28 Nov 2003 14:49:37 -0000 1.3 --- SourceMap.java 10 Feb 2005 17:00:34 -0000 1.4 *************** *** 13,16 **** --- 13,18 ---- package gnu.bytecode; + import java.util.*; + /** A mapping from source files to the bytecode line numbers. *************** *** 28,31 **** --- 30,34 ---- buffer.append(classfile.getName()).append('\n'); buffer.append("Default\n*S Default\n*F\n"); + fileMap = new HashMap(); } *************** *** 71,78 **** private String currentFile = null; ! private int fileNumber = 0; private int firstLine = -1; private int lastLine = -1; private int outputBase = 1; /** --- 74,82 ---- private String currentFile = null; ! private int lastFileNumber = 0; private int firstLine = -1; private int lastLine = -1; private int outputBase = 1; + private Map fileMap; /** *************** *** 102,108 **** if (currentFile != null) { ! fileNumber++; ! buffer.append(fileNumber).append(' ').append(currentFile) ! .append('\n'); int len = lastLine - firstLine + 1; lines.append("" + firstLine + '#' + fileNumber + --- 106,110 ---- if (currentFile != null) { ! int fileNumber = writeFile(currentFile); int len = lastLine - firstLine + 1; lines.append("" + firstLine + '#' + fileNumber + *************** *** 113,115 **** --- 115,132 ---- } } + + private int writeFile(String file) + { + Integer fileNumber = (Integer)fileMap.get(file); + if (fileNumber == null) + { + lastFileNumber++; + fileNumber = new Integer(lastFileNumber); + fileMap.put(file, fileNumber); + } + + buffer.append(fileNumber.intValue()).append(' ').append(file).append('\n'); + return fileNumber.intValue(); + } + } |
From: Bryn K. <xo...@us...> - 2005-02-09 21:57:56
|
Update of /cvsroot/nice/Nice/stdlib/nice/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3336/stdlib/nice/io Log Message: Directory /cvsroot/nice/Nice/stdlib/nice/io added to the repository |
From: Daniel B. <bo...@us...> - 2005-02-08 19:30:12
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24175/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: Optimization and cleanup. Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReferenceOp.java 15 Sep 2004 18:16:27 -0000 1.7 --- ReferenceOp.java 8 Feb 2005 19:29:51 -0000 1.8 *************** *** 49,57 **** 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); ! ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { --- 49,57 ---- Expression[] args = exp.getArgs(); CodeAttr code = comp.getCode(); ! Target stack = Target.pushObject; Label _else = new Label(code); Label _end = new Label(code); ! ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { *************** *** 63,67 **** } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { --- 63,67 ---- } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { *************** *** 85,93 **** 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); } --- 85,93 ---- code.emitPushBoolean(true); code.emitGoto(_end); ! code.popType(); // simulate 'else' otherwise gnu.bytecode doesn't like it _else.define(code); code.emitPushBoolean(false); _end.define(code); ! target.compileFromStack(comp, retType); } *************** *** 96,102 **** { CodeAttr code = comp.getCode(); ! Target stack = new StackTarget(Type.pointer_type); ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { --- 96,102 ---- { CodeAttr code = comp.getCode(); ! Target stack = Target.pushObject; ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { *************** *** 116,120 **** } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { --- 116,120 ---- } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { *************** *** 149,155 **** { CodeAttr code = comp.getCode(); ! Target stack = new StackTarget(Type.pointer_type); ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { --- 149,155 ---- { CodeAttr code = comp.getCode(); ! Target stack = Target.pushObject; ! if (args[0] instanceof QuoteExp && ((QuoteExp)args[0]).getType() == Type.nullType) { *************** *** 169,173 **** } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { --- 169,173 ---- } ! else if (args[1] instanceof QuoteExp && ((QuoteExp)args[1]).getType() == Type.nullType) { *************** *** 200,204 **** private static final Type retType = Type.boolean_type; ! public Type getReturnType (Expression[] args) { --- 200,204 ---- private static final Type retType = Type.boolean_type; ! public Type getReturnType (Expression[] args) { *************** *** 214,218 **** exp = arguments[0]; - if (exp != null && nice.tools.typing.Types.isSure(exp.getType().getMonotype())) bossa.util.User.warning(exp, "Comparing a non-null value with null"); --- 214,217 ---- |