nice-commit Mailing List for The Nice Programming Language (Page 73)
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: <bo...@us...> - 2003-11-27 00:21:24
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv4508/src/gnu/bytecode Modified Files: Type.java ClassFileInput.java Log Message: Delete ClassTypes from the cache, to avoid memory usage from groing for multiple compilations in the same JVM. Index: Type.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/Type.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Type.java 23 Nov 2003 19:15:15 -0000 1.16 --- Type.java 27 Nov 2003 00:21:20 -0000 1.17 *************** *** 28,33 **** } // Maps java.lang.Class to corresponding Type. ! private static java.util.Hashtable mapClassToType; /** Maps Java type name (e.g. "java.lang.String[]") to corresponding Type. */ --- 28,51 ---- } + public static void free(java.util.Map t) + { + for (java.util.Iterator e = t.entrySet().iterator(); e.hasNext();) + { + java.util.Map.Entry k = (java.util.Map.Entry) e.next(); + if (((Type) k.getValue()).collectable) + e.remove(); + } + } + + public boolean collectable; + + public static void reset() + { + mapClassToType.clear(); + free(mapNameToType); + } + // Maps java.lang.Class to corresponding Type. ! private static java.util.Map mapClassToType; /** Maps Java type name (e.g. "java.lang.String[]") to corresponding Type. */ *************** *** 113,122 **** mapNameToType.put(name, type); } ! /** Register that the Type for class is type. */ public static void registerTypeForClass(Class clas, Type type) { if (mapClassToType == null) ! mapClassToType = new java.util.Hashtable(100); mapClassToType.put(clas, type); type.reflectClass = clas; --- 131,140 ---- mapNameToType.put(name, type); } ! /** Register that the Type for class is type. */ public static void registerTypeForClass(Class clas, Type type) { if (mapClassToType == null) ! mapClassToType = new java.util.HashMap(100); mapClassToType.put(clas, type); type.reflectClass = clas; *************** *** 179,182 **** --- 197,201 ---- type.reflectClass = reflectClass; registerTypeForClass(reflectClass, type); + type.collectable = true; return type; } Index: ClassFileInput.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassFileInput.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClassFileInput.java 29 Oct 2003 12:42:41 -0000 1.4 --- ClassFileInput.java 27 Nov 2003 00:21:20 -0000 1.5 *************** *** 67,71 **** */ if (ctype.constants != null) ! ctype = new ClassType(name); // Read the class from the file. --- 67,74 ---- */ if (ctype.constants != null) ! { ! ctype = new ClassType(name); ! ctype.collectable = true; ! } // Read the class from the file. |
From: <bo...@us...> - 2003-11-27 00:21:24
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv4508/src/bossa/modules Modified Files: Package.java Log Message: Delete ClassTypes from the cache, to avoid memory usage from groing for multiple compilations in the same JVM. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Package.java 17 Nov 2003 20:26:25 -0000 1.102 --- Package.java 27 Nov 2003 00:21:20 -0000 1.103 *************** *** 292,295 **** --- 292,296 ---- TypeConstructors.reset(); JavaClasses.reset(); + gnu.bytecode.Type.reset(); } |
From: <bo...@us...> - 2003-11-26 16:25:58
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv3482/src/bossa/syntax Modified Files: NiceClass.java Constructor.java Log Message: Do not regenerate constructors for compiled packages. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** NiceClass.java 26 Nov 2003 10:06:30 -0000 1.71 --- NiceClass.java 26 Nov 2003 16:25:55 -0000 1.72 *************** *** 549,553 **** + serialUIDFieldString() + Util.map("", ";\n", ";\n", overrides) - + Util.map("{\n", "\n", "}\n", initializers) + "}\n\n" ); --- 549,552 ---- Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Constructor.java 11 Aug 2003 19:31:31 -0000 1.7 --- Constructor.java 26 Nov 2003 16:25:55 -0000 1.8 *************** *** 57,78 **** { getCode(); ! ConstructorExp lambda = // lambdaOmitDefaults is null if the two versions are identical ! omitDefaults && lambdaOmitDefaults != null ! ? lambdaOmitDefaults : this.lambda; ! return new QuoteExp(new InitializeProc(lambda)); } ! /** The constructor, with all the arguments. */ ! private ConstructorExp lambda; ! /** The constructor, with only non-default. */ ! private ConstructorExp lambdaOmitDefaults; protected Expression computeCode() { ! this.lambdaOmitDefaults = createBytecode(true); ! this.lambda = createBytecode(false); ! return new QuoteExp(new InstantiateProc(this.lambda)); } --- 57,80 ---- { getCode(); ! return // lambdaOmitDefaults is null if the two versions are identical ! omitDefaults && initializeOmitDefaults != null ! ? initializeOmitDefaults : initialize; } ! /** Call the constructor, with all the arguments. */ ! private Expression initialize; ! /** Call the constructor, with only non-default arguments. */ ! private Expression initializeOmitDefaults; ! ! /** Instantiate the class, calling the constructor with all the arguments. */ ! private Expression instantiate; protected Expression computeCode() { ! createBytecode(true); ! createBytecode(false); ! return instantiate; } *************** *** 81,85 **** default values as parameters, but use that default instead. */ ! private ConstructorExp createBytecode(boolean omitDefaults) { ClassType thisType = (ClassType) javaReturnType(); --- 83,87 ---- default values as parameters, but use that default instead. */ ! private void createBytecode(boolean omitDefaults) { ClassType thisType = (ClassType) javaReturnType(); *************** *** 104,113 **** // no default to omit! if (omitDefaults && args.size() == fullArgs.length) ! return null; ConstructorExp lambda = Gen.createConstructor ! (thisType, ! (Type[]) argTypes.toArray(new Type[argTypes.size()]), ! (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()])); Expression[] body = --- 106,133 ---- // no default to omit! if (omitDefaults && args.size() == fullArgs.length) ! return; ! ! Type[] argTypesArray = (Type[]) argTypes.toArray(new Type[argTypes.size()]); ! MonoSymbol[] argsArray = (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()]); ! ! if (classe.definition.inInterfaceFile()) ! { ! Method m = classe.getClassExp().getClassType().getDeclaredMethod ! ("<init>", argTypesArray); ! ! if (omitDefaults) ! { ! initializeOmitDefaults = new QuoteExp(new InitializeProc(m)); ! } ! else ! { ! initialize = new QuoteExp(new InitializeProc(m)); ! instantiate = new QuoteExp(new InstantiateProc(m)); ! } ! return; ! } ConstructorExp lambda = Gen.createConstructor ! (thisType, argTypesArray, argsArray); Expression[] body = *************** *** 140,144 **** classe.getClassExp().addMethod(lambda); ! return lambda; } --- 160,172 ---- classe.getClassExp().addMethod(lambda); ! if (omitDefaults) ! { ! initializeOmitDefaults = new QuoteExp(new InitializeProc(lambda)); ! } ! else ! { ! initialize = new QuoteExp(new InitializeProc(lambda)); ! instantiate = new QuoteExp(new InstantiateProc(lambda)); ! } } |
From: <bo...@us...> - 2003-11-26 16:25:57
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv3482/src/gnu/bytecode Modified Files: ClassType.java Log Message: Do not regenerate constructors for compiled packages. Index: ClassType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassType.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ClassType.java 3 Nov 2003 18:32:07 -0000 1.19 --- ClassType.java 26 Nov 2003 16:25:54 -0000 1.20 *************** *** 556,562 **** { if (arg_types[i] != method_args[i] && ! !(arg_types[i] instanceof PrimType && ! method_args[i] instanceof PrimType && ! arg_types[i].getSignature().equals(method_args[i].getSignature()))) { //System.out.println(arg_types[i]+" ("+arg_types[i].getClass()+") != "+method_args[i]+" ("+method_args[i].getClass()+")"); --- 556,560 ---- { if (arg_types[i] != method_args[i] && ! !(arg_types[i].getSignature().equals(method_args[i].getSignature()))) { //System.out.println(arg_types[i]+" ("+arg_types[i].getClass()+") != "+method_args[i]+" ("+method_args[i].getClass()+")"); |
From: <bo...@us...> - 2003-11-26 16:25:57
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1:/tmp/cvs-serv3482/testsuite/compiler/classes/constructors Modified Files: compilation.testsuite Log Message: Do not regenerate constructors for compiled packages. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/compilation.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** compilation.testsuite 28 Oct 2003 12:12:47 -0000 1.5 --- compilation.testsuite 26 Nov 2003 16:25:54 -0000 1.6 *************** *** 70,71 **** --- 70,82 ---- let SymbolTable<String> t = new SymbolTable(); } + + /// PASS + /// package a + /// Toplevel + public class AA<T> { + public ?AA<T> x; + } + /// package c import a + ; + /// package d import a,c + new AA(x:null); |
From: <bo...@us...> - 2003-11-26 10:06:34
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv28049/src/bossa/syntax Modified Files: NiceClass.java Log Message: Only create getters and setters when compiling the package for the first time. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** NiceClass.java 24 Nov 2003 14:47:50 -0000 1.70 --- NiceClass.java 26 Nov 2003 10:06:30 -0000 1.71 *************** *** 214,222 **** method.fieldDecl.setFlag(isVolatile , gnu.expr.Declaration.VOLATILE); ! String fname = sym.getName().toString(); ! String suffix = Character.toUpperCase(fname.charAt(0)) + fname.substring(1); ! createGetter(suffix); ! if (!isFinal) ! createSetter(suffix); } --- 214,225 ---- method.fieldDecl.setFlag(isVolatile , gnu.expr.Declaration.VOLATILE); ! if (! definition.inInterfaceFile()) ! { ! String fname = sym.getName().toString(); ! String suffix = Character.toUpperCase(fname.charAt(0)) + fname.substring(1); ! createGetter(suffix); ! if (!isFinal) ! createSetter(suffix); ! } } |
From: <ar...@us...> - 2003-11-26 09:04:59
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv17470/F:/nice/testsuite/compiler/methods Modified Files: globalconstant.testsuite Log Message: Fix ambiguety in testcase. Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** globalconstant.testsuite 14 Aug 2003 09:34:47 -0000 1.8 --- globalconstant.testsuite 26 Nov 2003 09:04:56 -0000 1.9 *************** *** 85,89 **** let Color green = new Color(); String name(Color); ! name(color) = "unknown color"; name(red) = "red"; name(blue) = "blue"; --- 85,89 ---- let Color green = new Color(); String name(Color); ! name(color(Color)) = "unknown color"; name(red) = "red"; name(blue) = "blue"; |
From: <ar...@us...> - 2003-11-26 08:50:28
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15512/F:/nice/src/bossa/syntax Modified Files: RetypedJavaMethod.java Log Message: Changed 2 more user errors in a ignored retyping warnings because they can happen when compiling with java 1.3 . Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RetypedJavaMethod.java 21 Nov 2003 08:09:59 -0000 1.11 --- RetypedJavaMethod.java 26 Nov 2003 08:50:23 -0000 1.12 *************** *** 160,164 **** holder.getDeclaredMethod(methodName, javaArgType.length); } catch (Error e) { ! User.error(this, "The types of the arguments don't exactly match any of the declarations"); } if (reflectMethod == null) --- 160,164 ---- holder.getDeclaredMethod(methodName, javaArgType.length); } catch (Error e) { ! setIgnoredRetyping(this, "Ignored retyping because no declaration exist with " + javaArgType.length + " arguments"); } if (reflectMethod == null) *************** *** 176,180 **** } ! User.error(className, "The types of the arguments don't match the declaration:\n" + reflectMethod); --- 176,180 ---- } ! setIgnoredRetyping(className, "Ignored retyping because The types of the arguments don't match the declaration:\n" + reflectMethod); |
From: <ar...@us...> - 2003-11-26 00:29:35
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv3872/F:/nice/stdlib/nice/lang Modified Files: java.nice Added Files: java-io.nice Log Message: Move retypings of java.io to a new file and added few more retypings. --- NEW FILE: java-io.nice --- /**************************************************************************** * N I C E * * A high-level object-oriented research language * * (c) Daniel Bonniot 2003 * * * * This package is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * * * * As a special exception, the copyright holders of this library give you * * permission to link this library with independent modules to produce an * * executable, regardless of the license terms of these independent * * modules, and to copy and distribute the resulting executable under * * terms of your choice. * ****************************************************************************/ /** Retypings for the java.io package */ import java.io.*; import java.net.*; /** In Java, System.out and System.err are possibly null. In Nice we prevent this to happen, and give them a non-null type. */ // prevents to stdout and stderr to be set to null void setStdout (PrintStream ps) = native void System.setOut(PrintStream); void setStderr (PrintStream ps) = native void System.setErr(PrintStream); PrintStream stdout () = native System.out; PrintStream stderr () = native System.err; /** Convenience: printing on the standard output. */ <Any T> void print (T object) = System.out.print (object); <Any T> void println (T object) = System.out.println(object); // Constructors BufferedInputStream BufferedInputStream(InputStream) = native new BufferedInputStream(InputStream); BufferedInputStream BufferedInputStream(InputStream, int) = native new BufferedInputStream(InputStream, int); BufferedOutputStream BufferedOutputStream(OutputStream) = native new BufferedOutputStream(OutputStream); BufferedOutputStream BufferedOutputStream(OutputStream, int) = native new BufferedOutputStream(OutputStream, int); BufferedReader BufferedReader(Reader) = native new BufferedReader(Reader); BufferedReader BufferedReader(Reader,int) = native new BufferedReader(Reader, int); BufferedWriter BufferedWriter(Writer) = native new BufferedWriter(Writer); BufferedWriter BufferedWriter(Writer, int) = native new BufferedWriter(Writer, int); ByteArrayInputStream ByteArrayInputStream(byte[]) = native new ByteArrayInputStream(byte[]); ByteArrayInputStream ByteArrayInputStream(byte[], int, int) = native new ByteArrayInputStream(byte[], int, int); ByteArrayOutputStream ByteArrayOutputStream(int) = native new ByteArrayOutputStream(int); CharArrayReader CharArrayReader(char[]) = native new CharArrayReader(char[]); CharArrayReader CharArrayReader(char[], int, int) = native new CharArrayReader(char[], int, int); DataInputStream DataInputStream(InputStream) = native new DataInputStream(InputStream); DataOutputStream DataOutputStream(OutputStream) = native new DataOutputStream(OutputStream); File File(?File, String) = native new File(File, String); File File(String) = native new File(String); File File(?String, String) = native new File(String, String); File File(URI) = native new File(URI); FileInputStream FileInputStream(File) = native new FileInputStream(File); FileInputStream FileInputStream(FileDescriptor) = native new FileInputStream(FileDescriptor); FileInputStream FileInputStream(String) = native new FileInputStream(String); FileOutputStream FileOutputStream(File) = native new FileOutputStream(File); FileOutputStream FileOutputStream(File, boolean) = native new FileOutputStream(File, boolean); FileOutputStream FileOutputStream(FileDescriptor) = native new FileOutputStream(FileDescriptor); FileOutputStream FileOutputStream(String) = native new FileOutputStream(String); FileOutputStream FileOutputStream(String, boolean) = native new FileOutputStream(String, boolean); FilePermission FilePermission(String, String) = native new FilePermission(String, String); FileReader FileReader(File) = native new FileReader(File); FileReader FileReader(FileDescriptor) = native new FileReader(FileDescriptor); FileReader FileReader(String) = native new FileReader(String); FileWriter FileWriter(File) = native new FileWriter(File); FileWriter FileWriter(File, boolean) = native new FileWriter(File, boolean); FileWriter FileWriter(FileDescriptor) = native new FileWriter(FileDescriptor); FileWriter FileWriter(String) = native new FileWriter(String); FileWriter FileWriter(String, boolean) = native new FileWriter(String, boolean); FilterInputStream FilterInputStream(InputStream) = native new FilterInputStream(InputStream); FilterOutputStream FilterOutputStream(OutputStream) = native new FilterOutputStream(OutputStream); FilterReader FilterReader(Reader) = native new FilterReader(Reader); FilterWriter FilterWriter(Writer) = native new FilterWriter(Writer); // InputStreams int read(InputStream, byte[]) = native int InputStream.read(byte[]); int read(InputStream, byte[], int, int) = native int InputStream.read( byte[], int, int); void unread(PushbackInputStream, byte[]) = native void PushbackInputStream.unread(byte[]); void unread(PushbackInputStream, byte[], int, int) = native void PushbackInputStream.unread( byte[], int, int); void connect(PipedInputStream, PipedOutputStream) = native void PipedInputStream.connect(PipedOutputStream); // OutputStreams void write(OutputStream, byte[]) = native void OutputStream.write(byte[]); void write(OutputStream, byte[], int, int) = native void OutputStream.write( byte[], int, int); byte[] toByteArray(ByteArrayOutputStream) = native byte[] ByteArrayOutputStream.toByteArray(); String toString(ByteArrayOutputStream, String) = native String ByteArrayOutputStream.toString(String); void writeTo(ByteArrayOutputStream, OutputStream) = native void ByteArrayOutputStream.writeTo(OutputStream); <T> void print(PrintStream, T) = native void PrintStream.print(Object); void print(PrintStream, String) = native void PrintStream.print(String); void print(PrintStream, char[]) = native void PrintStream.print(char[]); <T> void println(PrintStream, T) = native void PrintStream.println(Object); void println(PrintStream, String) = native void PrintStream.println(String); void println(PrintStream, char[]) = native void PrintStream.println(char[]); void connect(PipedOutputStream, PipedInputStream) = native void PipedOutputStream.connect(PipedInputStream); // Readers int read(Reader, char[]) = native int Reader.read(char[]); int read(Reader, char[], int, int) = native int Reader.read(char[], int, int); ?String readLine(BufferedReader) = native String BufferedReader.readLine(); void unread(PushbackReader, char[]) = native void PushbackReader.unread(char[]); void unread(PushbackReader, char[], int, int) = native void PushbackReader.unread(char[], int, int); ?String getEncoding(InputStreamReader) = native String InputStreamReader.getEncoding(); void connect(PipedReader, PipedWriter) = native void PipedReader.connect(PipedWriter); // Writers void write(Writer, char[]) = native void Writer.write(char[]); void write(Writer, char[], int, int) = native void Writer.write(char[], int, int); void write(Writer, String) = native void Writer.write(String); void write(Writer, String, int, int) = native void Writer.write(String, int, int); char[] toCharArray(CharArrayWriter) = native char[] CharArrayWriter.toCharArray(); void writeTo(CharArrayWriter, Writer) = native void CharArrayWriter.writeTo(Writer); ?String getEncoding(OutputStreamWriter) = native String OutputStreamWriter.getEncoding(); void connect(PipedWriter, PipedReader) = native void PipedWriter.connect(PipedReader); <T> void print(PrintWriter, T) = native void PrintWriter.print(Object); void print(PrintWriter, String) = native void PrintWriter.print(String); void print(PrintWriter, char[]) = native void PrintWriter.print(char[]); <T> void println(PrintWriter, T) = native void PrintWriter.println(Object); void println(PrintWriter, String) = native void PrintWriter.println(String); void println(PrintWriter, char[]) = native void PrintWriter.println(char[]); StringBuffer getBuffer(StringWriter) = native StringBuffer StringWriter.getBuffer(); // File File createTempFile(String, ?String) = native File File.createTempFile(String, String); File createTempFile(String, ?String, ?File) = native File File.createTempFile(String, String, File); File getAbsoluteFile(File) = native File File.getAbsoluteFile(); String getAbsolutePath(File) = native String File.getAbsolutePath(); File getCanonicalFile(File) = native File File.getCanonicalFile(); String getCanonicalPath(File) = native String File.getCanonicalPath(); String getName(File) = native String File.getName(); ?String getParent(File) = native String File.getParent(); ?File getParentFile(File) = native File File.getParentFile(); String getPath(File) = native String File.getPath(); ?(String[]) list(File) = native String[] File.list(); ?(String[]) list(File, FilenameFilter) = native String[] File.list(FilenameFilter); ?(File[]) listFiles(File) = native File[] File.listFiles(); ?(File[]) listFiles(File, FileFilter) = native File[] File.listFiles(FileFilter); ?(File[]) listFiles(File, FilenameFilter) = native File[] File.listFiles(FilenameFilter); ?(File[]) listRoots() = native File[] File.listRoots(); URI toURI(File) = native URI File.toURI(); URL toURL(File) = native URL File.toURL(); // DataInput/Output void readFully(DataInput, byte[]) = native void DataInput.readFully(byte[]); void readFully(DataInput, byte[], int, int) = native void DataInput.readFully( byte[], int, int); ?String readLine(DataInput) = native String DataInput.readLine(); String readUTF(DataInput) = native String DataInput.readUTF(); void write(DataOutput, byte[]) = native void DataOutput.write(byte[]); void write(DataOutput, byte[], int, int) = native void DataOutput.write( byte[], int, int); void writeBytes(DataOutput, String) = native void DataOutput.writeBytes(String); void writeChars(DataOutput, String) = native void DataOutput.writeChars(String); void writeUTF(DataOutput, String) = native void DataOutput.writeUTF(String); // Serialization <T> void writeObject(ObjectOutput, T) = native void ObjectOutput.writeObject(Object); <T> T readObject(ObjectInput) = native Object ObjectInput.readObject(); void readExternal(Externalizable, ObjectInput) = native void Externalizable.readExternal(ObjectInput); void writeExternal(Externalizable, ObjectOutput) = native void Externalizable.writeExternal(ObjectOutput); // Other boolean accept(FileFilter, File) = native boolean FileFilter.accept(File); boolean accept(FilenameFilter, File, String) = native boolean FilenameFilter.accept(File, String); Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** java.nice 19 Nov 2003 16:04:45 -0000 1.44 --- java.nice 26 Nov 2003 00:29:31 -0000 1.45 *************** *** 29,33 **** import java.text.*; - import java.io.*; import java.lang.reflect.*; --- 29,32 ---- *************** *** 80,114 **** DateFormat getDateInstance() = native DateFormat DateFormat.getDateInstance(); DateFormat getDateInstance(int style) = native DateFormat DateFormat.getDateInstance(int); - - // PACKAGE: java.io - - <Any T> void print (PrintStream ps, T object) = - native void PrintStream.print (Object); - <Any T> void println (PrintStream ps, T object) = - native void PrintStream.println(Object); - String getAbsolutePath (File) = native String File.getAbsolutePath(); - - ?String readLine(BufferedReader) = native String BufferedReader.readLine(); - ?String readLine(DataInput) = native String DataInput.readLine(); - - /** - In Java, System.out and System.err are possibly null. - In Nice we prevent this to happen, and give them a non-null type. - */ - - // prevents to stdout and stderr to be set to null - void setStdout (PrintStream ps) = native void System.setOut(PrintStream); - void setStderr (PrintStream ps) = native void System.setErr(PrintStream); - - PrintStream stdout () = native System.out; - PrintStream stderr () = native System.err; - - /** Convenience: printing on the standard output. */ - <Any T> void print (T object) = System.out.print (object); - <Any T> void println (T object) = System.out.println(object); - - // Serialization - <Any T> void writeObject(ObjectOutput, T) = native void ObjectOutput.writeObject(Object); - <Any T> T readObject(ObjectInput) = native Object ObjectInput.readObject(); // PACKAGE: java.util --- 79,82 ---- |
From: <bo...@us...> - 2003-11-25 19:23:01
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/tuples In directory sc8-pr-cvs1:/tmp/cvs-serv1841/testsuite/compiler/expressions/tuples Modified Files: compilation.testsuite Log Message: Make the bytecode TupleType a subclass of SpecialArray so that polymorphic tuples also get automatically converted to their monomorphic version as needed. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/tuples/compilation.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** compilation.testsuite 4 Jun 2003 18:46:30 -0000 1.7 --- compilation.testsuite 25 Nov 2003 19:22:58 -0000 1.8 *************** *** 45,49 **** i += j; ! /// PASS bug (String fst, String snd) = foo("abc","xyz"); /// Toplevel --- 45,49 ---- i += j; ! /// PASS (String fst, String snd) = foo("abc","xyz"); /// Toplevel |
From: <bo...@us...> - 2003-11-25 19:23:01
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1:/tmp/cvs-serv1841/src/nice/tools/code Modified Files: TupleType.java SpecialArray.java Log Message: Make the bytecode TupleType a subclass of SpecialArray so that polymorphic tuples also get automatically converted to their monomorphic version as needed. Index: TupleType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/TupleType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TupleType.java 17 Mar 2003 20:11:42 -0000 1.1 --- TupleType.java 25 Nov 2003 19:22:58 -0000 1.2 *************** *** 22,26 **** import gnu.bytecode.*; ! public class TupleType extends ArrayType { TupleType (Type arrayType, Type[] componentTypes) --- 22,26 ---- import gnu.bytecode.*; ! public class TupleType extends SpecialArray { TupleType (Type arrayType, Type[] componentTypes) Index: SpecialArray.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/SpecialArray.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SpecialArray.java 24 Jun 2003 20:07:38 -0000 1.14 --- SpecialArray.java 25 Nov 2003 19:22:58 -0000 1.15 *************** *** 11,15 **** */ ! public final class SpecialArray extends gnu.bytecode.ArrayType { /** --- 11,15 ---- */ ! public class SpecialArray extends gnu.bytecode.ArrayType { /** *************** *** 27,31 **** return res; ! return new SpecialArray(elements, prefix, false); } --- 27,31 ---- return res; ! return new SpecialArray(elements, prefix, false, true); } *************** *** 33,37 **** { if (unknownTypeArray == null) ! unknownTypeArray = new SpecialArray(objectType, null, true); return unknownTypeArray; } --- 33,37 ---- { if (unknownTypeArray == null) ! unknownTypeArray = new SpecialArray(objectType, null, true, true); return unknownTypeArray; } *************** *** 49,53 **** private boolean unknown; ! private SpecialArray (Type elements, String prefix, boolean unknown) { super (elements); --- 49,61 ---- private boolean unknown; ! protected SpecialArray (Type elements) ! { ! this(elements, ! elements instanceof PrimType ? elements.getName() : null, ! false, false); ! } ! ! private SpecialArray (Type elements, String prefix, boolean unknown, ! boolean register) { super (elements); *************** *** 65,69 **** field.setType(objectType); ! if (!unknown) { Class c = elements.getReflectClass(); --- 73,77 ---- field.setType(objectType); ! if (register && !unknown) { Class c = elements.getReflectClass(); |
From: <bo...@us...> - 2003-11-25 19:23:01
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv1841/debian Modified Files: changelog Log Message: Make the bytecode TupleType a subclass of SpecialArray so that polymorphic tuples also get automatically converted to their monomorphic version as needed. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.230 retrieving revision 1.231 diff -C2 -d -r1.230 -r1.231 *** changelog 25 Nov 2003 12:34:36 -0000 1.230 --- changelog 25 Nov 2003 19:22:58 -0000 1.231 *************** *** 12,16 **** final long serialVersionUID = 123456789L; } ! * Bug fixes (accessing static fields of an superclass or interface, ...) -- --- 12,17 ---- final long serialVersionUID = 123456789L; } ! * Bug fixes (accessing static fields of an superclass or interface, ! compilation of polymorphic tuples, ...) -- |
From: <bo...@us...> - 2003-11-25 15:22:01
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv14181/testsuite/compiler/classes Added Files: properties.testsuite Log Message: Examples using properties, to formalize a first level of support. --- NEW FILE: properties.testsuite --- /// PASS bug let a = new A(); assert a.x == 1; a.x = 5; assert a.x == 5; a.x = 105; assert a.x == 105; let b = new B(); assert b.x == 1; b.x = 5; assert b.x == 1; b.x = 105; assert b.x == 105; /// Toplevel class A { int x = 1; } class B extends A { setX(value) { if (value > 100) super; return x; } } /// PASS bug let a = new A(); assert a.x == 1; a.x = -1; assert a.x == 1; a.x = 5; assert a.x == 5; a.x = 105; assert a.x == 105; let b = new B(); assert b.x == 1; b.x = -1; assert b.x == 1; b.x = 5; assert b.x == 1; b.x = 105; assert b.x == 105; /// Toplevel class A { private int _x = 1; int getX() = _x; // a custom setter, that checks the value int setX(int value) { if (value > 0) _x = value; return _x; } } class B extends A { setX(value) { if (value > 100) super; return x; } } |
From: <bo...@us...> - 2003-11-25 14:12:34
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv8432/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Do not make arguments of known pure higher-order functions capture variables, since they do not escape the call. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** instanceof.testsuite 25 Nov 2003 09:43:04 -0000 1.16 --- instanceof.testsuite 25 Nov 2003 10:31:01 -0000 1.17 *************** *** 3,6 **** --- 3,9 ---- class B extends A { int life = 42; } + // An arbitrary higher-order function, that might let its argument escape. + <T,U> void use(T->U f) {} + /// PASS A a; *************** *** 261,265 **** /// PASS ! new LinkedList().foreach(A arg => { arg = new B(); if (arg instanceof B) { --- 264,268 ---- /// PASS ! use(A arg => { arg = new B(); if (arg instanceof B) { *************** *** 286,287 **** --- 289,313 ---- } }; + + /// PASS + // We know that foreach does not let its arguments escape. + A x = new A(); + new LinkedList().foreach(A arg => { + x = arg; + }); + if (x instanceof B) + assert x.life == 42; + + /// FAIL + A x = new A(); + void ?-> void f = null; + [0].foreach(int arg => { + // This anonymous function escapes, even though it is inside an arg of + // foreach. + f = () => x = new A(); + }); + if (x instanceof B) { + if (f != null) + f(); + assert x.life == 42; + } |
From: <bo...@us...> - 2003-11-25 12:35:20
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8432/src/bossa/syntax Modified Files: analyse.nice Log Message: Do not make arguments of known pure higher-order functions capture variables, since they do not escape the call. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** analyse.nice 25 Nov 2003 10:02:31 -0000 1.89 --- analyse.nice 25 Nov 2003 10:31:01 -0000 1.90 *************** *** 278,286 **** } ! void analyse(Arguments, Info); ! analyse(args@Arguments, info) { for (int i = 0; i < args.size(); i++) ! args.setExp(i, analyse(args.getExp(i), info)); } --- 278,285 ---- } ! void analyse(Arguments args, Info info, boolean noEscape) { for (int i = 0; i < args.size(); i++) ! args.setExp(i, analyse(args.getExp(i), info, noEscape: noEscape)); } *************** *** 307,311 **** markAsCallFirstArg(notNull(args.getExp(0))); ! args.analyse(info); if (e.infix) --- 306,313 ---- markAsCallFirstArg(notNull(args.getExp(0))); ! boolean noEscape = args.size() == 2 && ! (e.isCallTo("foreach") || e.isCallTo("forbreak") || e.isCallTo("map") || ! e.isCallTo("filter")); ! args.analyse(info, noEscape); if (e.infix) *************** *** 393,397 **** } ! analyse(e@FunExp, info) { let savedDepth = info.anonFunDepth; --- 395,404 ---- } ! ?Expression analyse(Expression e, Info info, boolean noEscape) = ! analyse(e, info); ! ! analyse(e@FunExp, info) = analyse(e, info, false); ! ! analyse(e@FunExp, info@Info, noEscape) { let savedDepth = info.anonFunDepth; *************** *** 400,404 **** info.beginInner(); info.begin(); ! info.anonFunDepth = info.depth; if (e.constraint != Constraint.True && e.constraint != null) --- 407,412 ---- info.beginInner(); info.begin(); ! if (! noEscape) ! info.anonFunDepth = info.depth; if (e.constraint != Constraint.True && e.constraint != null) *************** *** 554,558 **** analyse(e@NewExp, info) { ! e.arguments.analyse(info); e.resolve(info.typeMap); return e; --- 562,566 ---- analyse(e@NewExp, info) { ! e.arguments.analyse(info, noEscape: false); e.resolve(info.typeMap); return e; |
From: <bo...@us...> - 2003-11-25 12:34:39
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv13201/debian Modified Files: changelog Log Message: There is now complete support for serialization: readObject, writeObject, readResolve and writeReplace methods can be written and be recognized by the serialization process. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.229 retrieving revision 1.230 diff -C2 -d -r1.229 -r1.230 *** changelog 23 Nov 2003 16:25:17 -0000 1.229 --- changelog 25 Nov 2003 12:34:36 -0000 1.230 *************** *** 5,9 **** instance: println("x has value "x" and y has value "y); ! * A custom serialVersionUID can be set for Nice classes using a final field. class X implements java.io.Serializable { final long serialVersionUID = 123456789L; --- 5,12 ---- instance: println("x has value "x" and y has value "y); ! * There is now complete support for serialization: ! readObject, writeObject, readResolve and writeReplace methods can be ! written and be recognized by the serialization process. ! A custom serialVersionUID can be set for Nice classes using a final field: class X implements java.io.Serializable { final long serialVersionUID = 123456789L; |
From: <bo...@us...> - 2003-11-25 10:43:05
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv629/src/bossa/syntax Modified Files: analyse.nice Log Message: Moved the handling of qualified method calls in a separate method to simplify the structure of the code. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** analyse.nice 24 Nov 2003 20:49:42 -0000 1.88 --- analyse.nice 25 Nov 2003 10:02:31 -0000 1.89 *************** *** 314,367 **** if (e.declaringClass != null) ! { ! ?LocatedString funName = identString(e.function); ! if (funName == null) ! throw notNull(bossa.util.Internal.error ! (e.function, "This is not a valid class member")); ! ! int arity = args.size(); ! ! if ((! e.hasBrackets) && (arity == 0)) ! // This case is like java.lang.Byte.toString: ! // look for a method with that name and any arity, ! // since the method is not called but just referenced. ! { ! List<VarSymbol> possibilities = JavaClasses.findJavaMethods ! (e.declaringClass, funName.toString()); ! ! if (possibilities.size() == 0) ! throw error(e, "Class " + notNull(e.declaringClass).getName() + ! " has no static method or static field named " + ! funName); ! ! /* ! If there is a field access, then we consider this an access ! to the static field. Otherwise, it is a reference to ! the method, not applied. ! */ ! if (possibilities.has(VarSymbol s => s.isFieldAccess())) ! { ! e.function = newOverloadedSymbolExp(possibilities, funName); ! return e; ! } ! else ! return newOverloadedSymbolExp(possibilities, funName); ! } ! ! List<VarSymbol> possibilities = JavaClasses.findJavaMethods ! (e.declaringClass, funName.toString(), arity); ! ! if (possibilities.size() == 0) ! throw error(e, "Class " + notNull(e.declaringClass).getName() + ! (arity == 0 ? " has no static method or static field named " : ! arity == 1 ? " has no method or field named " : ! " has no method named ") + ! funName); ! ! e.function = newOverloadedSymbolExp(possibilities, funName); - return e; - } - ?PackageExp pkg = args.packageExp(); if (pkg != null) --- 314,319 ---- if (e.declaringClass != null) ! return analyseQualifiedCall(e, info); ?PackageExp pkg = args.packageExp(); if (pkg != null) *************** *** 387,390 **** --- 339,395 ---- return e; } + + Expression analyseQualifiedCall(CallExp e, Info info) + { + Arguments args = e.arguments; + + ?LocatedString funName = identString(e.function); + if (funName == null) + throw notNull(bossa.util.Internal.error + (e.function, "This is not a valid class member")); + + int arity = args.size(); + + if ((! e.hasBrackets) && (arity == 0)) + // This case is like java.lang.Byte.toString: + // look for a method with that name and any arity, + // since the method is not called but just referenced. + { + List<VarSymbol> possibilities = JavaClasses.findJavaMethods + (e.declaringClass, funName.toString()); + + if (possibilities.size() == 0) + throw error(e, "Class " + notNull(e.declaringClass).getName() + + " has no static method or static field named " + + funName); + + /* + If there is a field access, then we consider this an access + to the static field. Otherwise, it is a reference to + the method, not applied. + */ + if (possibilities.has(VarSymbol s => s.isFieldAccess())) + { + e.function = newOverloadedSymbolExp(possibilities, funName); + return e; + } + else + return newOverloadedSymbolExp(possibilities, funName); + } + + List<VarSymbol> possibilities = JavaClasses.findJavaMethods + (e.declaringClass, funName.toString(), arity); + + if (possibilities.size() == 0) + throw error(e, "Class " + notNull(e.declaringClass).getName() + + (arity == 0 ? " has no static method or static field named " : + arity == 1 ? " has no method or field named " : + " has no method named ") + + funName); + + e.function = newOverloadedSymbolExp(possibilities, funName); + + return e; + } analyse(e@FunExp, info) |
From: <bo...@us...> - 2003-11-25 10:42:57
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv29947/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Removed duplicate testcase. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** instanceof.testsuite 24 Nov 2003 20:49:42 -0000 1.15 --- instanceof.testsuite 25 Nov 2003 09:43:04 -0000 1.16 *************** *** 280,292 **** /// PASS - Vector<A> ll = new Vector(); - ll.foreach(A arg => { - arg = new B(); - if (arg instanceof B) { - int x = arg.life; - } - }); - - /// PASS let A a = new B(); void->void f = () => { --- 280,283 ---- |
From: <bo...@us...> - 2003-11-25 10:42:56
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv11222/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Arguments of known pure higher-order functions capture variables can be typechecked in the current dynamic type environment, since they do not escape the call. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** instanceof.testsuite 25 Nov 2003 10:31:01 -0000 1.17 --- instanceof.testsuite 25 Nov 2003 10:41:10 -0000 1.18 *************** *** 312,313 **** --- 312,321 ---- assert x.life == 42; } + + /// PASS + // We know that foreach does not let its arguments escape. + A x = new A(); + if (x instanceof B) + new LinkedList().foreach(A arg => { + assert x.life == 42; + }); |
From: <bo...@us...> - 2003-11-25 10:42:56
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv11222/src/bossa/syntax Modified Files: typecheck.nice analyse.nice FunExp.java Log Message: Arguments of known pure higher-order functions capture variables can be typechecked in the current dynamic type environment, since they do not escape the call. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** typecheck.nice 24 Nov 2003 19:22:02 -0000 1.89 --- typecheck.nice 25 Nov 2003 10:41:10 -0000 1.90 *************** *** 225,229 **** Node.setCurrentFunction(e); ! let needExit = enterClosure(); try { typecheck(e.body); --- 225,229 ---- Node.setCurrentFunction(e); ! let needExit = e.mightEscape && enterClosure(); try { typecheck(e.body); Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** analyse.nice 25 Nov 2003 10:31:01 -0000 1.90 --- analyse.nice 25 Nov 2003 10:41:10 -0000 1.91 *************** *** 407,411 **** info.beginInner(); info.begin(); ! if (! noEscape) info.anonFunDepth = info.depth; --- 407,413 ---- info.beginInner(); info.begin(); ! if (noEscape) ! e.mightEscape = false; ! else info.anonFunDepth = info.depth; Index: FunExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunExp.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** FunExp.java 2 Jun 2003 19:05:31 -0000 1.43 --- FunExp.java 25 Nov 2003 10:41:10 -0000 1.44 *************** *** 144,146 **** --- 144,147 ---- Constraint cst; Statement body; + boolean mightEscape = true; } |
From: <ar...@us...> - 2003-11-24 23:56:29
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv20395/F:/nice/testsuite/compiler/classes Modified Files: serialization.testsuite Log Message: Make readResolve and writeReplace member methods when they are declared in a Nice class. Index: serialization.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/serialization.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** serialization.testsuite 24 Nov 2003 17:27:22 -0000 1.3 --- serialization.testsuite 24 Nov 2003 23:56:25 -0000 1.4 *************** *** 84,85 **** --- 84,112 ---- ok = in.readBoolean(); } + + /// PASS + A a = serializeThenDeserialize(new A(x: 1)); + assert a.x == 5; + /// Toplevel + import java.io.*; + + class A implements Serializable + { + int x; + + Object writeReplace() + { + if(x==1) + return object(new A(x: 10)); + else + return object(this); + } + + Object readResolve() + { + if (x == 10) + return object(new A(x: 5)); + else + return object(this); + } + } |
From: <ar...@us...> - 2003-11-24 23:56:29
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv20395/F:/nice/src/bossa/syntax Modified Files: MethodImplementation.java Log Message: Make readResolve and writeReplace member methods when they are declared in a Nice class. Index: MethodImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MethodImplementation.java 24 Nov 2003 14:47:50 -0000 1.2 --- MethodImplementation.java 24 Nov 2003 23:56:25 -0000 1.3 *************** *** 194,224 **** { final int arity = formals.length; ! if (arity != 2) return; ! String name = this.name.toString(); ! ! if (name.equals("writeObject") || name.equals("readObject")) ! { ! ClassDefinition def = ClassDefinition.get(firstArgument()); ! if (def == null || ! (def.getImplementation() instanceof NiceClass)) ! return; ! NiceClass c = (NiceClass) def.getImplementation(); ! gnu.expr.Expression[] params = new gnu.expr.Expression[arity]; ! gnu.expr.LambdaExp method = Gen.createMemberMethod (name.toString(), c.getClassExp().getType(), ! new Type[]{declaration.javaArgTypes()[1]}, declaration.javaReturnType(), params); ! Gen.setMethodBody(method, ! new gnu.expr.ApplyExp(getRefExp(), params)); - c.getClassExp().addMethod(method, true); - } } --- 194,225 ---- { final int arity = formals.length; + String name = this.name.toString(); + boolean isPrivate; ! if ((arity == 2) && (name.equals("writeObject") || name.equals("readObject"))) ! isPrivate = true; ! else if ((arity == 1) && (name.equals("writeReplace") || name.equals("readResolve"))) ! isPrivate = false; ! else return; ! ClassDefinition def = ClassDefinition.get(firstArgument()); ! if (def == null || ! (def.getImplementation() instanceof NiceClass)) ! return; ! NiceClass c = (NiceClass) def.getImplementation(); ! gnu.expr.Expression[] params = new gnu.expr.Expression[arity]; ! gnu.expr.LambdaExp method = Gen.createMemberMethod (name.toString(), c.getClassExp().getType(), ! arity==2 ? new Type[]{declaration.javaArgTypes()[1]} : null, declaration.javaReturnType(), params); ! Gen.setMethodBody(method, new gnu.expr.ApplyExp(getRefExp(), params)); ! ! c.getClassExp().addMethod(method, isPrivate); } |
From: <bo...@us...> - 2003-11-24 22:26:24
|
Update of /cvsroot/nice/tester In directory sc8-pr-cvs1:/tmp/cvs-serv2085 Modified Files: Project run Log Message: Only upload a new development version when all tests succeeded, not just the bootstrap/testsuite Index: Project =================================================================== RCS file: /cvsroot/nice/tester/Project,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Project 13 Nov 2003 16:57:55 -0000 1.8 --- Project 24 Nov 2003 22:26:21 -0000 1.9 *************** *** 10,16 **** cd Nice && make universe - - # If we got here, the whole bootstrap process succeeded. - if [ NICE_MASTER ]; then - scp ./share/java/nice.jar bo...@sh...:/home/groups/n/ni/nice/htdocs - fi --- 10,11 ---- Index: run =================================================================== RCS file: /cvsroot/nice/tester/run,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** run 22 Jun 2003 10:11:44 -0000 1.9 --- run 24 Nov 2003 22:26:21 -0000 1.10 *************** *** 67,72 **** --- 67,74 ---- if ../Project; then echo "Bootstrap OK" > $config.res + failed=false else echo "Bootstrap FAILURE" > $config.res + failed=true fi *************** *** 89,93 **** case "$code" in 0) echo "OK" ;; ! 1) echo "FAILURE" ;; 2) echo "SKIP" ;; 3) echo "IMPOSSIBLE" ;; --- 91,95 ---- case "$code" in 0) echo "OK" ;; ! 1) echo "FAILURE" ; failed=true ;; 2) echo "SKIP" ;; 3) echo "IMPOSSIBLE" ;; *************** *** 111,114 **** --- 113,122 ---- else scp -p ./*.id ./*.res ./*.html $us...@sh...:$results_dir + + # If everything went OK, upload the new development version. + if [ $failed = false -a "$NICE_MASTER" ]; then + scp Nice/share/java/nice.jar bo...@sh...:/home/groups/n/ni/nice/htdocs + fi + fi |
From: <bo...@us...> - 2003-11-24 20:49:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv13812/src/bossa/syntax Modified Files: analyse.nice Log Message: Only capture variables when they are assigned to. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** analyse.nice 24 Nov 2003 19:22:02 -0000 1.87 --- analyse.nice 24 Nov 2003 20:49:42 -0000 1.88 *************** *** 437,441 **** if (sym instanceof MonoSymbol) { ! if (sym.depth < info.anonFunDepth) sym.captured = true; --- 437,441 ---- if (sym instanceof MonoSymbol) { ! if (assigned && sym.depth < info.anonFunDepth) sym.captured = true; |
From: <bo...@us...> - 2003-11-24 20:49:45
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv13812/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Only capture variables when they are assigned to. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** instanceof.testsuite 24 Nov 2003 19:22:02 -0000 1.14 --- instanceof.testsuite 24 Nov 2003 20:49:42 -0000 1.15 *************** *** 287,288 **** --- 287,296 ---- } }); + + /// PASS + let A a = new B(); + void->void f = () => { + if (a instanceof B) { + int x = a.life; + } + }; |