From: <dgr...@us...> - 2009-05-04 21:24:43
|
Revision: 8276 http://x10.svn.sourceforge.net/x10/?rev=8276&view=rev Author: dgrove-oss Date: 2009-05-04 21:24:37 +0000 (Mon, 04 May 2009) Log Message: ----------- Move definition of OPTIMIZE 'up' to polyglot.ext.x10 so that the definition can be used by both the Java and C++ backends. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java 2009-05-04 20:49:13 UTC (rev 8275) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java 2009-05-04 21:24:37 UTC (rev 8276) @@ -37,6 +37,8 @@ public static String COMPILER_FRAGMENT_DATA_DIRECTORY = "data/"; private static final String COMPILER_FRAGMENT_DATA_DIRECTORY_desc = "Advanced functionality: Directory for compiler templates"; + public static boolean OPTIMIZE = false; + private static final String OPTIMIZE_desc = "Generate optimized code"; public static boolean BAD_PLACE_RUNTIME_CHECK = true; private static final String BAD_PLACE_RUNTIME_CHECK_desc = "Generate runtime place checks"; Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java 2009-05-04 20:49:13 UTC (rev 8275) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java 2009-05-04 21:24:37 UTC (rev 8276) @@ -41,9 +41,6 @@ public static boolean DISABLE_GC = true; private static final String DISABLE_GC_desc = "Disable the linking in of the BDW conservative garbage collector"; - public static boolean OPTIMIZE = false; - private static final String OPTIMIZE_desc = "Generate optimized code"; - public static String MANIFEST = null; private static final String MANIFEST_desc = "The path to the pre-built library manifest file"; Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-04 20:49:13 UTC (rev 8275) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-04 21:24:37 UTC (rev 8276) @@ -429,7 +429,7 @@ cxxCmd.add(preArgsGC[i]); } } - if (Configuration.OPTIMIZE) { + if (polyglot.ext.x10.Configuration.OPTIMIZE) { for (String arg : preArgsOptimize) { cxxCmd.add(arg); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2009-05-11 20:00:56
|
Revision: 8297 http://x10.svn.sourceforge.net/x10/?rev=8297&view=rev Author: ipeshansky Date: 2009-05-11 20:00:53 +0000 (Mon, 11 May 2009) Log Message: ----------- Preliminary change to generate line number maps in the C++ code. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java trunk/x10.cppbackend.17/META-INF/MANIFEST.MF trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/types/X10CPPContext_c.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java 2009-05-11 19:57:33 UTC (rev 8296) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/Configuration.java 2009-05-11 20:00:53 UTC (rev 8297) @@ -37,9 +37,12 @@ public static String COMPILER_FRAGMENT_DATA_DIRECTORY = "data/"; private static final String COMPILER_FRAGMENT_DATA_DIRECTORY_desc = "Advanced functionality: Directory for compiler templates"; - public static boolean OPTIMIZE = false; - private static final String OPTIMIZE_desc = "Generate optimized code"; + public static boolean OPTIMIZE = false; + private static final String OPTIMIZE_desc = "Generate optimized code"; + public static boolean DEBUG = true; + private static final String DEBUG_desc = "Generate debug information"; + public static boolean BAD_PLACE_RUNTIME_CHECK = true; private static final String BAD_PLACE_RUNTIME_CHECK_desc = "Generate runtime place checks"; Modified: trunk/x10.cppbackend.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-05-11 19:57:33 UTC (rev 8296) +++ trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-05-11 20:00:53 UTC (rev 8297) @@ -5,6 +5,7 @@ Bundle-Version: 1.0.0 Export-Package: polyglot.ext.x10cpp, polyglot.ext.x10cpp.ast, + polyglot.ext.x10cpp.debug, polyglot.ext.x10cpp.extension, polyglot.ext.x10cpp.main, polyglot.ext.x10cpp.types, Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/types/X10CPPContext_c.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/types/X10CPPContext_c.java 2009-05-11 19:57:33 UTC (rev 8296) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/types/X10CPPContext_c.java 2009-05-11 20:00:53 UTC (rev 8297) @@ -17,11 +17,8 @@ * @author Dave Cunningham * @see X10Context_c */ -import static polyglot.ext.x10cpp.visit.Emitter.mangled_non_method_name; - import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import polyglot.ast.ClassMember; @@ -30,7 +27,6 @@ import polyglot.ext.x10.types.X10ClassDef; import polyglot.ext.x10.types.X10Context; import polyglot.ext.x10.types.X10MethodDef; -import polyglot.types.LocalInstance; import polyglot.types.Name; import polyglot.types.TypeSystem; import polyglot.types.VarInstance; @@ -52,13 +48,37 @@ public int closureId() { return g.closureId; } protected void resetClosureId() { g.closureId = -1; } + /** + * Every context has some arbitrary data, associated with string keys. + * To get the data from the current context, use {@link #getData(String)}. + * To find the data in the current or ancestor context, use {@link #findData(String)}. + * To add data to the current context, use {@link #addData(String, Object)}. + */ + protected HashMap<String, Object> data = new HashMap<String, Object>(1, 1.0f); + + /** @see #data. */ + public void addData(String key, Object value) { data.put(key, value); } + /** @see #data. */ + public Object getData(String key) { return data.get(key); } + /** @see #data. */ + public Object findData(String key) { + Object value = getData(key); + if (value == null && outer != null) + return ((X10CPPContext_c) outer).findData(key); + return value; + } + protected ArrayList<ClassMember> pendingStaticDecls; protected ArrayList<PropertyDecl> classProperties; public List<PropertyDecl> classProperties() { return classProperties; } public List<ClassMember> pendingStaticDecls() { return pendingStaticDecls; } - // Here, for each new class we reset the above structures, ready for fresh accumulation of data. + /** + * For each new class reset the classProperties and pendingStaticDecls structures, + * ready for fresh accumulation of data. + * @param props the initial set of class properties + */ public void resetStateForClass(List<PropertyDecl> props) { assert kind == SOURCE; pendingStaticDecls = new ArrayList<ClassMember>(); @@ -66,6 +86,15 @@ resetClosureId(); } + /** + * Clear the classProperties and pendingStaticDecls structures, to avoid AST node + * leakage. + */ + public void clearStateForClass() { + assert kind == SOURCE; + pendingStaticDecls = null; + classProperties = null; + } private String label; public String getLabel() { return label; } @@ -181,6 +210,7 @@ X10CPPContext_c res = (X10CPPContext_c) super.copy(); res.variables = new ArrayList<VarInstance>(); // or whatever the initial value is res.inClosure = false; + res.data = new HashMap<String, Object>(1, 1.0f); return res; } Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-11 19:57:33 UTC (rev 8296) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-11 20:00:53 UTC (rev 8297) @@ -799,7 +799,6 @@ * in the global context, for each class. */ context.resetStateForClass(n.properties()); - if (def.typeParameters().size() != 0) { // Pre-declare the void specialization for statics @@ -828,6 +827,12 @@ if (extractGenericStaticDecls(def, h)) { extractGenericStaticInits(def); } + + /* + * See comment about resetStateForClass() above. + */ + context.clearStateForClass(); + ((X10CPPTranslator)tr).setContext(context); // FIXME // [DC] disabled, see (commented out) definition of opsd above for details @@ -1392,6 +1397,7 @@ } for (Stmt s : body.statements()) { + // FIXME: constructor calls won't get line number information if (s instanceof ConstructorCall) { ConstructorCall call = (ConstructorCall)s; if (call.kind() == ConstructorCall.SUPER) { Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-11 19:57:33 UTC (rev 8296) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-11 20:00:53 UTC (rev 8297) @@ -19,6 +19,7 @@ import java.io.Writer; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -39,6 +40,7 @@ import polyglot.ext.x10cpp.Configuration; import polyglot.ext.x10cpp.X10CPPCompilerOptions; +import polyglot.ext.x10cpp.debug.LineNumberMap; import polyglot.ext.x10cpp.types.X10CPPContext_c; import polyglot.frontend.Compiler; import polyglot.frontend.ExtensionInfo; @@ -61,7 +63,9 @@ import polyglot.util.InternalCompilerError; import polyglot.util.QuotedStringTokenizer; import polyglot.util.StdErrorQueue; +import polyglot.util.StringUtil; import polyglot.visit.Translator; +import x10c.util.ClassifiedStream; import x10c.util.StreamWrapper; import x10c.util.WriterStreams; import static polyglot.ext.x10cpp.visit.SharedVarsMethods.*; @@ -226,6 +230,8 @@ return (DelegateTargetFactory) tf; } + private static final String FILE_TO_LINE_NUMBER_MAP = "FileToLineNumberMap"; + public void print(Node parent, Node n, CodeWriter w_) { if (w_ == null) return; // FIXME HACK @@ -238,8 +244,17 @@ (n instanceof ClassDecl))) { w.forceNewline(0); - w.write("//#line " + n.position().line() + " \"" + n.position().file() + "\""); + int line = n.position().line(); + String file = n.position().file(); + w.write("//#line " + line + " \"" + file + "\""); w.newline(); + if (polyglot.ext.x10.Configuration.DEBUG) { + X10CPPContext_c c = (X10CPPContext_c)context; + HashMap<String, LineNumberMap> fileToLineNumberMap = + (HashMap<String, LineNumberMap>) c.findData(FILE_TO_LINE_NUMBER_MAP); + LineNumberMap lineNumberMap = fileToLineNumberMap.get(w.getStreamName(w.currentStream().ext)); + lineNumberMap.put(w.currentStream().getLineNumber(), file, line); + } } // FIXME: [IP] Some nodes have no del() -- warn in that case @@ -272,6 +287,9 @@ pkg = p.fullName().toString(); } + X10CPPContext_c c = (X10CPPContext_c) context; + if (polyglot.ext.x10.Configuration.DEBUG) + c.addData(FILE_TO_LINE_NUMBER_MAP, new HashMap<String, LineNumberMap>()); WriterStreams wstreams = null; StreamWrapper sw = null; // Use the class name to derive a default output file name. @@ -292,7 +310,28 @@ opfPath = tf.outputName(pkg, decl.name().toString()); assert (!opfPath.endsWith("$")); if (!opfPath.endsWith("$")) outputFiles.add(opfPath); + if (polyglot.ext.x10.Configuration.DEBUG) { + HashMap<String, LineNumberMap> fileToLineNumberMap = (HashMap<String, LineNumberMap>)c.getData(FILE_TO_LINE_NUMBER_MAP); + String closures = wstreams.getStreamName(StreamWrapper.Closures); + fileToLineNumberMap.put(closures, new LineNumberMap(closures)); + String cc = wstreams.getStreamName(StreamWrapper.CC); + fileToLineNumberMap.put(cc, new LineNumberMap(cc)); + String header = wstreams.getStreamName(StreamWrapper.Header); + fileToLineNumberMap.put(header, new LineNumberMap(header)); + } translateTopLevelDecl(sw, sfn, decl); + if (polyglot.ext.x10.Configuration.DEBUG) { + HashMap<String, LineNumberMap> fileToLineNumberMap = (HashMap<String, LineNumberMap>)c.getData(FILE_TO_LINE_NUMBER_MAP); + sw.pushCurrentStream(sw.getNewStream(StreamWrapper.Closures, false)); + printLineNumberMap(sw, pkg, className, StreamWrapper.Closures, fileToLineNumberMap); + sw.popCurrentStream(); + sw.pushCurrentStream(sw.getNewStream(StreamWrapper.CC, false)); + printLineNumberMap(sw, pkg, className, StreamWrapper.CC, fileToLineNumberMap); + sw.popCurrentStream(); + sw.pushCurrentStream(sw.getNewStream(StreamWrapper.CC, false)); + printLineNumberMap(sw, pkg, className, StreamWrapper.Header, fileToLineNumberMap); + sw.popCurrentStream(); + } if (i.hasNext()) wstreams.commitStreams(); } @@ -321,6 +360,23 @@ } } + private void printLineNumberMap(StreamWrapper sw, String pkg, String className, String ext, HashMap<String, LineNumberMap> fileToLineNumberMap) { + String fName = sw.getStreamName(ext); + LineNumberMap map = fileToLineNumberMap.get(fName); + if (map.isEmpty()) + return; + sw.forceNewline(); + String lnmName = Emitter.mangled_non_method_name(pkg).replace('.','_')+"_"+Emitter.mangled_non_method_name(className); + sw.write("struct "+lnmName+"_"+ext+" { static const char* map; };"); + sw.newline(); + sw.write("const char* "+lnmName+"_"+ext+"::map = \""); + sw.write(StringUtil.escape(map.exportMap())); + String v = map.exportMap(); + LineNumberMap m = LineNumberMap.importMap(fName, v); + sw.write("\";"); + sw.newline(); + } + /* (non-Javadoc) * @see polyglot.visit.Translator#translate(polyglot.ast.Node) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <njn...@us...> - 2009-05-12 03:11:46
|
Revision: 8300 http://x10.svn.sourceforge.net/x10/?rev=8300&view=rev Author: njnystrom Date: 2009-05-12 03:11:38 +0000 (Tue, 12 May 2009) Log Message: ----------- First cut at Sn code. Added Paths: ----------- trunk/.classpath trunk/.project trunk/bin/ trunk/bin/x10/ trunk/bin/x10/sncode/ trunk/bin/x10/sncode/ByteBuffer.class trunk/bin/x10/sncode/ClassEditor$1.class trunk/bin/x10/sncode/ClassEditor$2.class trunk/bin/x10/sncode/ClassEditor$3.class trunk/bin/x10/sncode/ClassEditor$4.class trunk/bin/x10/sncode/ClassEditor$5.class trunk/bin/x10/sncode/ClassEditor.class trunk/bin/x10/sncode/ConstantPool$CWClass.class trunk/bin/x10/sncode/ConstantPool$CWItem.class trunk/bin/x10/sncode/ConstantPool$CWNameAndType.class trunk/bin/x10/sncode/ConstantPool$CWRef.class trunk/bin/x10/sncode/ConstantPool$CWString.class trunk/bin/x10/sncode/ConstantPool.class trunk/bin/x10/sncode/ConstantPoolParser.class trunk/bin/x10/sncode/Constraint$Constant.class trunk/bin/x10/sncode/Constraint$Field.class trunk/bin/x10/sncode/Constraint$Formula.class trunk/bin/x10/sncode/Constraint$Term.class trunk/bin/x10/sncode/Constraint$Var.class trunk/bin/x10/sncode/Constraint.class trunk/bin/x10/sncode/ConstraintReader.class trunk/bin/x10/sncode/ConstructorEditor.class trunk/bin/x10/sncode/Container$Mapper.class trunk/bin/x10/sncode/Container.class trunk/bin/x10/sncode/FieldEditor.class trunk/bin/x10/sncode/InvalidClassFileException.class trunk/bin/x10/sncode/MethodEditor.class trunk/bin/x10/sncode/Pair.class trunk/bin/x10/sncode/SnConstants.class trunk/bin/x10/sncode/SnFile$1.class trunk/bin/x10/sncode/SnFile.class trunk/bin/x10/sncode/Tree$Branch.class trunk/bin/x10/sncode/Tree$Leaf.class trunk/bin/x10/sncode/Tree.class trunk/bin/x10/sncode/Type$AnnotatedType.class trunk/bin/x10/sncode/Type$ConstrainedType.class trunk/bin/x10/sncode/Type$FunType.class trunk/bin/x10/sncode/Type$ParamType.class trunk/bin/x10/sncode/Type$RefType.class trunk/bin/x10/sncode/Type$ScopedType.class trunk/bin/x10/sncode/Type$StructType.class trunk/bin/x10/sncode/Type$VoidType.class trunk/bin/x10/sncode/Type.class trunk/bin/x10/sncode/TypedefEditor.class trunk/bin/x10/sncode/test/ trunk/bin/x10/sncode/test/ClassFileTest.class trunk/bin/x10/sncode/test/TypeTest.class trunk/src/ trunk/src/x10/ trunk/src/x10/sncode/ trunk/src/x10/sncode/ByteBuffer.java trunk/src/x10/sncode/ClassEditor.java trunk/src/x10/sncode/ConstantPool.java trunk/src/x10/sncode/ConstantPoolParser.java trunk/src/x10/sncode/Constraint.java trunk/src/x10/sncode/ConstraintReader.java trunk/src/x10/sncode/ConstructorEditor.java trunk/src/x10/sncode/Container.java trunk/src/x10/sncode/FieldEditor.java trunk/src/x10/sncode/InvalidClassFileException.java trunk/src/x10/sncode/MethodEditor.java trunk/src/x10/sncode/Pair.java trunk/src/x10/sncode/SnConstants.java trunk/src/x10/sncode/SnFile.java trunk/src/x10/sncode/Tree.java trunk/src/x10/sncode/Type.java trunk/src/x10/sncode/TypedefEditor.java trunk/src/x10/sncode/test/ trunk/src/x10/sncode/test/ClassFileTest.java trunk/src/x10/sncode/test/TypeTest.java Added: trunk/.classpath =================================================================== --- trunk/.classpath (rev 0) +++ trunk/.classpath 2009-05-12 03:11:38 UTC (rev 8300) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/.project =================================================================== --- trunk/.project (rev 0) +++ trunk/.project 2009-05-12 03:11:38 UTC (rev 8300) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>x10.sncode</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/bin/x10/sncode/ByteBuffer.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ByteBuffer.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor$1.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor$1.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor$2.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor$2.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor$3.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor$3.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor$4.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor$4.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor$5.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor$5.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ClassEditor.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ClassEditor.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool$CWClass.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool$CWClass.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool$CWItem.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool$CWItem.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool$CWNameAndType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool$CWNameAndType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool$CWRef.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool$CWRef.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool$CWString.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool$CWString.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPool.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPool.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstantPoolParser.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstantPoolParser.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint$Constant.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint$Constant.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint$Field.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint$Field.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint$Formula.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint$Formula.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint$Term.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint$Term.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint$Var.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint$Var.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Constraint.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Constraint.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstraintReader.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstraintReader.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/ConstructorEditor.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/ConstructorEditor.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Container$Mapper.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Container$Mapper.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Container.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Container.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/FieldEditor.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/FieldEditor.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/InvalidClassFileException.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/InvalidClassFileException.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/MethodEditor.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/MethodEditor.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Pair.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Pair.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/SnConstants.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/SnConstants.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/SnFile$1.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/SnFile$1.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/SnFile.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/SnFile.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Tree$Branch.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Tree$Branch.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Tree$Leaf.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Tree$Leaf.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Tree.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Tree.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$AnnotatedType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$AnnotatedType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$ConstrainedType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$ConstrainedType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$FunType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$FunType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$ParamType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$ParamType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$RefType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$RefType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$ScopedType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$ScopedType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$StructType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$StructType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type$VoidType.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type$VoidType.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/Type.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/Type.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/TypedefEditor.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/TypedefEditor.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/test/ClassFileTest.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/test/ClassFileTest.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/bin/x10/sncode/test/TypeTest.class =================================================================== (Binary files differ) Property changes on: trunk/bin/x10/sncode/test/TypeTest.class ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/x10/sncode/ByteBuffer.java =================================================================== --- trunk/src/x10/sncode/ByteBuffer.java (rev 0) +++ trunk/src/x10/sncode/ByteBuffer.java 2009-05-12 03:11:38 UTC (rev 8300) @@ -0,0 +1,532 @@ +package x10.sncode; + +public class ByteBuffer { + byte[] buf; + int offset; + int buflen; + + public ByteBuffer(byte[] buf) { + this.buf = buf; + this.offset = 0; + this.buflen = buf.length; + } + + public ByteBuffer() { + this(64); + } + + public ByteBuffer(int size) { + this.buf = new byte[size]; + this.offset = 0; + this.buflen = 0; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < buflen; i++) { + byte b = buf[i]; + if (b == '\\') + sb.append("\\\\"); + else if (Character.isWhitespace((char) b) || (b >= 33 && b <= 126)) + sb.append((char) b); + else { + sb.append("\\x"); + String x = Integer.toHexString(b & 0xff); + for (int j = x.length(); j < 2; j++) + sb.append("0"); + sb.append(x); + } + } + return sb.toString(); + } + + int offset() { + return offset; + } + + void skip(int n) { + this.offset += n; + } + + public void seek(int n) { + this.offset = n; + } + + void reserve(int size) { + if (buf == null) { + buf = new byte[size]; + } + else if (size > buf.length) { + byte[] newBuf = new byte[Math.max(buf.length * 2, size)]; + System.arraycopy(buf, 0, newBuf, 0, buf.length); + buf = newBuf; + } + } + + /** + * Set the 4 bytes at offset 'offset' in 'buf' to the signed 32-bit value in + * v. + */ + void addInt(int v) { + setInt(offset, v); + offset += 4; + } + + /** + * Set the 4 bytes at offset 'offset' in 'buf' to the signed 32-bit value in + * v. + */ + void setInt(int offset, int v) { + reserve(offset + 4); + buf[offset++] = (byte) (v >> 24); + buf[offset++] = (byte) (v >> 16); + buf[offset++] = (byte) (v >> 8); + buf[offset++] = (byte) v; + buflen = Math.max(offset, buflen); + } + + void setLong(int offset, long v) { + reserve(offset + 8); + setInt(offset, (int) (v >> 32)); + setInt(offset + 4, (int) v); + } + + /** + * Set the 8 bytes at offset 'offset' in 'buf' to the signed 64-bit value in + * v. + */ + public void addLong(long v) { + setLong(offset, v); + offset += 8; + } + + /** + * Set the 4 bytes at offset 'offset' in 'buf' to the float value in v. + */ + public void addFloat(float v) { + addInt(Float.floatToIntBits(v)); + } + + /** + * Set the 4 bytes at offset 'offset' in 'buf' to the float value in v. + */ + public void setFloat(int offset, float v) { + setInt(offset, Float.floatToIntBits(v)); + } + + /** + * Set the 8 bytes at offset 'offset' in 'buf' to the double value in v. + */ + public void addDouble(double v) throws IllegalArgumentException { + addLong(Double.doubleToRawLongBits(v)); + } + + /** + * Set the 8 bytes at offset 'offset' in 'buf' to the double value in v. + */ + public void setDouble(int offset, double v) throws IllegalArgumentException { + setLong(offset, Double.doubleToRawLongBits(v)); + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void setUShort(int offset, int v) throws IllegalArgumentException { + reserve(offset + 2); + buf[offset++] = (byte) (v >> 8); + buf[offset++] = (byte) v; + buflen = Math.max(offset, buflen); + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void addUShort(int v) throws IllegalArgumentException { + setUShort(offset, v); + offset += 2; + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void setUByte(int offset, int v) throws IllegalArgumentException { + reserve(offset + 1); + buf[offset++] = (byte) v; + buflen = Math.max(offset, buflen); + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void addUByte(int v) { + setUByte(offset, v); + offset++; + } + + public byte[] getBytes() { + if (buf.length == buflen) { + return buf; + } + else { + byte[] b = new byte[buflen]; + System.arraycopy(buf, 0, b, 0, buflen); + return b; + } + } + + public byte[] getBytes(int i, int len) throws InvalidClassFileException { + if (i < 0 || i + len > buflen) + throw new InvalidClassFileException(i, "cannot get raw bytes"); + byte[] b = new byte[len]; + System.arraycopy(buf, i, b, 0, len); + return b; + } + + public void addBytes(byte[] bytes) { + reserve(offset + bytes.length); + System.arraycopy(bytes, 0, buf, offset, bytes.length); + offset += bytes.length; + buflen = Math.max(offset, buflen); + } + + public void setBytes(int offset, byte[] bytes) { + reserve(offset + bytes.length); + System.arraycopy(bytes, 0, buf, offset, bytes.length); + buflen = Math.max(offset, buflen); + } + + public void addBytes(byte[] bytes, int boff, int blen) { + reserve(offset + blen); + System.arraycopy(bytes, boff, buf, offset, blen); + offset += blen; + buflen = Math.max(offset, buflen); + } + + public void setBytes(int offset, byte[] bytes, int boff, int blen) { + reserve(offset + blen); + System.arraycopy(bytes, boff, buf, offset, blen); + buflen = Math.max(offset, buflen); + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void setByte(int offset, int v) throws IllegalArgumentException { + setUByte(offset, v); + } + + /** + * Set the 2 bytes at offset 'offset' in 'buf' to the unsigned 16-bit value + * in v. + * + * @throws IllegalArgumentException + * if buf is null + */ + public void addByte(int v) { + addUByte(v); + } + + public void checkLength(int size) throws InvalidClassFileException { + if (size > buflen || size > buf.length) + throw new InvalidClassFileException(size, "Out of range."); + } + + public long getLong() throws InvalidClassFileException { + long result = getLong(offset); + offset += 8; + return result; + } + + public int getInt() throws InvalidClassFileException { + int result = getInt(offset); + offset += 4; + return result; + } + + public float getFloat() throws InvalidClassFileException { + int result = getInt(); + return Float.intBitsToFloat(result); + } + + public float getFloat(int offset) throws InvalidClassFileException { + int result = getInt(offset); + return Float.intBitsToFloat(result); + } + + public double getDouble() throws InvalidClassFileException { + long result = getLong(); + return Double.longBitsToDouble(result); + } + + public double getDouble(int offset) throws InvalidClassFileException { + long result = getLong(offset); + return Double.longBitsToDouble(result); + } + + /** + * @return the signed 32-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public int getInt(int offset) throws InvalidClassFileException { + checkLength(offset + 4); + return (buf[offset] << 24) + ((buf[offset + 1] & 0xFF) << 16) + ((buf[offset + 2] & 0xFF) << 8) + (buf[offset + 3] & 0xFF); + } + + /** + * @return the signed 64-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public long getLong(int offset) throws InvalidClassFileException { + checkLength(offset + 8); + int r1 = getInt(offset); + int r2 = getInt(offset + 4); + return ((long) r1 << 32) | (r2 & 0xFFFFFFFFL); + } + + public String getUtf8() throws InvalidClassFileException { + int count = getInt(offset); + String s = getUtf8(offset + 4, count); + offset += 4; + offset += count; + return s; + } + + public String getUtf8(int offset) throws InvalidClassFileException { + int count = getInt(offset); + return getUtf8(offset + 4, count); + } + + private InvalidClassFileException invalidUtf8(int offset) { + return new InvalidClassFileException(offset, "Invalid Java Utf8 string."); + } + + /** + * @return the value of the Utf8 string at constant pool item i + */ + private String getUtf8(int offset, int count) throws InvalidClassFileException { + int end = count + offset; + StringBuilder buf = new StringBuilder(count); + offset += 4; + while (offset < end) { + byte x = getByte(offset); + if ((x & 0x80) == 0) { + if (x == 0) { + throw invalidUtf8(offset); + } + buf.append((char) x); + offset++; + } + else if ((x & 0xE0) == 0xC0) { + if (offset + 1 >= end) { + throw invalidUtf8(offset); + } + byte y = getByte(offset + 1); + if ((y & 0xC0) != 0x80) { + throw invalidUtf8(offset); + } + buf.append((char) (((x & 0x1F) << 6) + (y & 0x3F))); + offset += 2; + } + else if ((x & 0xF0) == 0xE0) { + if (offset + 2 >= end) { + throw invalidUtf8(offset); + } + byte y = getByte(offset + 1); + byte z = getByte(offset + 2); + if ((y & 0xC0) != 0x80 || (z & 0xC0) != 0x80) { + throw invalidUtf8(offset); + } + buf.append((char) (((x & 0x0F) << 12) + ((y & 0x3F) << 6) + (z & 0x3F))); + offset += 3; + } + else { + throw invalidUtf8(offset); + } + } + return buf.toString(); + } + + public String getUtf8ToDelimiter(int offset, String delims) throws InvalidClassFileException { + int i = offset(); + String s = getUtf8ToDelimiter(delims); + seek(i); + return s; + } + + public String getUtf8ToDelimiter(String delims) throws InvalidClassFileException { + StringBuilder buf = new StringBuilder(); + while (offset < buflen && offset < this.buf.length) { + byte x = getByte(offset); + if ((x & 0x80) == 0) { + if (x == 0) { + throw invalidUtf8(offset); + } + buf.append((char) x); + offset++; + } + else if ((x & 0xE0) == 0xC0) { + byte y = getByte(offset + 1); + if ((y & 0xC0) != 0x80) { + throw invalidUtf8(offset); + } + buf.append((char) (((x & 0x1F) << 6) + (y & 0x3F))); + offset += 2; + } + else if ((x & 0xF0) == 0xE0) { + byte y = getByte(offset + 1); + byte z = getByte(offset + 2); + if ((y & 0xC0) != 0x80 || (z & 0xC0) != 0x80) { + throw invalidUtf8(offset); + } + buf.append((char) (((x & 0x0F) << 12) + ((y & 0x3F) << 6) + (z & 0x3F))); + offset += 3; + } + else { + throw invalidUtf8(offset); + } + + char c = buf.charAt(buf.length() - 1); + + if (delims.indexOf(c) >= 0) + break; + } + + return buf.toString(); + } + + public int getUShort() throws InvalidClassFileException { + int result = getUShort(offset); + offset += 2; + return result; + } + + /** + * @return the unsigned 16-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public int getUShort(int offset) throws InvalidClassFileException { + checkLength(offset + 2); + return ((buf[offset] & 0xFF) << 8) + (buf[offset + 1] & 0xFF); + } + + /** + * @return the signed 16-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public short getShort(int i) throws InvalidClassFileException { + checkLength(i + 2); + return (short) ((buf[i] << 8) + (buf[i + 1] & 0xFF)); + } + + /** + * @return the signed 8-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public byte getByte(int i) throws InvalidClassFileException { + checkLength(i + 1); + return buf[i]; + } + + /** + * @return the signed 8-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public byte getByte() throws InvalidClassFileException { + byte result = getByte(offset); + offset++; + return result; + } + + /** + * @return the unsigned 8-bit value at offset i in the class data + * @throws InvalidClassFileException + */ + public int getUByte(int i) throws InvalidClassFileException { + checkLength(i + 1); + return buf[i] & 0xFF; + } + + public void setCPIndex(int offset, int i) { + setInt(offset, i); + } + + public void addCPIndex(int i) { + addInt(i); + } + + public int getCPIndex(int i) throws InvalidClassFileException { + return getInt(i); + } + + public int getCPIndex() throws InvalidClassFileException { + return getInt(); + } + + public void setLength(int offset, int i) { + setInt(offset, i); + } + + public void addLength(int i) { + addInt(i); + } + + public int getLength(int i) throws InvalidClassFileException { + return getInt(i); + } + + public int getLength() throws InvalidClassFileException { + return getInt(); + } + + public void setCount(int offset, int i) { + setInt(offset, i); + } + + public void addCount(int i) { + addInt(i); + } + + public int getCount(int i) throws InvalidClassFileException { + return getInt(i); + } + + public int getCount() throws InvalidClassFileException { + return getInt(); + } + + public void getAttributeOffsets(int[] offsets) throws InvalidClassFileException { + int count = offsets.length - 1; + + for (int i = 0; i < count; i++) { + offsets[i] = offset(); + int nameIndex = getCPIndex(); // unused + int payloadLen = getLength(); + if (payloadLen < 0) { + throw new InvalidClassFileException(offset(), "negative attribute length: " + payloadLen); + } + skip(payloadLen); + } + + offsets[count] = offset(); + } +} Added: trunk/src/x10/sncode/ClassEditor.java =================================================================== --- trunk/src/x10/sncode/ClassEditor.java (rev 0) +++ trunk/src/x10/sncode/ClassEditor.java 2009-05-12 03:11:38 UTC (rev 8300) @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2002,2006 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package x10.sncode; + +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * This is the core class for reading class file data. + * + * ClassReader performs lazy parsing, and thus most of the methods can throw an + * InvalidClassFileException. + */ +public final class ClassEditor extends Container implements SnConstants { + /** List of fields */ + List<FieldEditor> fields; + /** List of methods */ + List<MethodEditor> methods; + /** List of constructors */ + List<ConstructorEditor> constructors; + /** List of typedefs */ + List<TypedefEditor> typedefs; + /** List of member classes */ + List<ClassEditor> memberClasses; + + List<Tree> attributes; + + String className; + Type superClass; + + List<Type> interfaces; + List<Type> typeFormals; + List<Type> typeActuals; + List<Constraint> typeActualConstraints; + + Constraint classInvariant; + + public ClassEditor() { + interfaces = new ArrayList<Type>(0); + typeFormals = new ArrayList<Type>(0); + typeActuals = new ArrayList<Type>(0); + typeActualConstraints = new ArrayList<Constraint>(0); + + fields = new ArrayList<FieldEditor>(1); + methods = new ArrayList<MethodEditor>(1); + constructors = new ArrayList<ConstructorEditor>(1); + typedefs = new ArrayList<TypedefEditor>(1); + memberClasses = new ArrayList<ClassEditor>(1); + attributes = new ArrayList<Tree>(1); + } + + public String getName() { + return className; + } + + public void setName(String s) { + className = s; + } + + public void setSuperClass(Type t) { + superClass = t; + } + + public Type getSuperClass() throws InvalidClassFileException { + return superClass; + } + + public void addInterface(Type t) { + interfaces.add(t); + } + + public List<Type> getInterfaces() { + return interfaces; + } + + public void addTypeFormal(Type t) { + typeFormals.add(t); + } + + public List<Type> getTypeFormals() { + return typeFormals; + } + + public void addTypeActual(Type t) { + typeActuals.add(t); + } + + public List<Type> getTypeActuals() { + return typeActuals; + } + + public void addTypeActualConstraint(Constraint c) { + typeActualConstraints.add(c); + } + + public List<Constraint> getTypeActualConstraints() { + return typeActualConstraints; + } + + Constraint getClassInvariant() { + return classInvariant; + } + + void setClassInvariant(Constraint t) { + classInvariant = t; + } + + List<FieldEditor> fields() { + return fields; + } + + public List<MethodEditor> methods() { + return methods; + } + + List<ConstructorEditor> constructors() { + return constructors; + } + + List<TypedefEditor> typedefs() { + return typedefs; + } + + List<ClassEditor> memberClasses() { + return memberClasses; + } + + List toList(Object o) throws InvalidClassFileException { + if (o instanceof Object[]) + return Arrays.asList((Object[]) o); + throw new InvalidClassFileException(0, "bad array " + o); + } + + public void readFrom(final SnFile sn, Tree tree) throws InvalidClassFileException { + className = (String) tree.find("Name"); + typeFormals = (List) toList(tree.find("TypeFormals")); + typeActuals = (List) toList(tree.find("TypeActuals")); + typeActualConstraints = (List) toList(tree.find("TypeActualConstraints")); + classInvariant = (Constraint) tree.find("ClassInvariant"); + superClass = (Type) tree.find("SuperClass"); + interfaces = (List<Type>) toList(tree.find("Interfaces")); + + typedefs = mapList(tree.findAll("Typedef"), new Mapper<Tree, TypedefEditor, InvalidClassFileException>() { + TypedefEditor map(Tree t) throws InvalidClassFileException { + TypedefEditor e = new TypedefEditor(); + e.readFrom(sn, t); + return e; + } + }); + fields = mapList(tree.findAll("Field"), new Mapper<Tree, FieldEditor, InvalidClassFileException>() { + FieldEditor map(Tree t) throws InvalidClassFileException { + FieldEditor e = new FieldEditor(); + e.readFrom(sn, t); + return e; + } + }); + methods = mapList(tree.findAll("Method"), new Mapper<Tree, MethodEditor, InvalidClassFileException>() { + MethodEditor map(Tree t) throws InvalidClassFileException { + MethodEditor e = new MethodEditor(); + e.readFrom(sn, t); + return e; + } + }); + constructors = mapList(tree.findAll("Constructor"), new Mapper<Tree, ConstructorEditor, InvalidClassFileException>() { + ConstructorEditor map(Tree t) throws InvalidClassFileException { + ConstructorEditor e = new ConstructorEditor(); + e.readFrom(sn, t); + return e; + } + }); + memberClasses = mapList(tree.findAll("Class"), new Mapper<Tree, ClassEditor, InvalidClassFileException>() { + ClassEditor map(Tree t) throws InvalidClassFileException { + ClassEditor e = new ClassEditor(); + e.readFrom(sn, t); + return e; + } + }); + + String[] keys = new String[] { "Name", "TypeFormals", "TypeActuals", "TypeActualConstraints", "ClassInvariant", + "SuperClass", "Interfaces", "Field", "Method", "Constructor", "Typedef", "Class" }; + + attributes = new ArrayList<Tree>(tree.getChildren().size()); + for (Iterator<Tree> i = tree.getChildren().iterator(); i.hasNext();) { + Tree ti = i.next(); + if (Arrays.asList(keys).contains(ti.key)) + ; + else + attributes.add(ti); + } + } + + public Tree makeTree() { + Tree.Branch t = new Tree.Branch("Class", new Tree.Leaf("Name", className), + new Tree.Leaf("TypeFormals", SnFile.nonnull(typeFormals).toArray(new Type[0])), + new Tree.Leaf("TypeActuals", SnFile.nonnull(typeActuals).toArray(new Type[0])), + new Tree.Leaf("TypeActualConstraints", SnFile.nonnull(typeActualConstraints).toArray(new Constraint[0])), + new Tree.Leaf("ClassInvariant", classInvariant), new Tree.Leaf("SuperClass", superClass), + new Tree.Leaf("Interfaces", SnFile.nonnull(interfaces).toArray(new Type[0]))); + for (FieldEditor f : fields) { + t.add(f.makeTree()); + } + for (MethodEditor m : methods) { + t.add(m.makeTree()); + } + for (ConstructorEditor c : constructors) { + t.add(c.makeTree()); + } + for (TypedefEditor d : typedefs) { + t.add(d.makeTree()); + } + for (ClassEditor c : memberClasses) { + t.add(c.makeTree()); + } + for (Tree a : attributes) { + t.add(a); + } + return t; + } + +} Added: trunk/src/x10/sncode/ConstantPool.java =================================================================== --- trunk/src/x10/sncode/ConstantPool.java (rev 0) +++ trunk/src/x10/sncode/ConstantPool.java 2009-05-12 03:11:38 UTC (rev 8300) @@ -0,0 +1,723 @@ +/******************************************************************************* + * Copyright (c) 2002,2006 IBM Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package x10.sncode; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This class formats and writes class data into JVM format. + */ +public final class ConstantPool implements SnConstants { + /** Inverted CP. Map from objects to index into the CP. */ + Map<Object, Integer> inverseMap = new HashMap<Object, Integer>(1); + + /** List of new CP entries added since last clearing of the list. */ + List<Object> cpItems = new ArrayList<Object>(1); + + /** + * Create a blank Sn editor with no members. + */ + public ConstantPool() { + inverseMap = new HashMap<Object, Integer>(); + cpItems = new ArrayList<Object>(); + cpItems.add(null); + } + + /** + * Copy a constant pool from some ClassReader into this class. This must be + * done before any entries are allocated in this ClassWriter's constant + * pool, and it can only be done once. If and only if this is done, it is + * safe to copy "raw" fields, methods and attributes from the ClassReader + * into this class, because the constant pool references in those fields, + * methods and attributes are guaranteed to point to the same constant pool + * items in this new class. + */ + public void setRawCP(ConstantPoolParser cp) throws InvalidClassFileException, IllegalArgumentException { + if (cp == null) { + throw new IllegalArgumentException(); + } + + cpItems.clear(); + + // item 0 + cpItems.add(null); + + int nextCPIndex = cp.getItemCount(); + + for (int i = 1; i < nextCPIndex; i++) { + byte t = cp.getItemType(i); + switch (t) { + case CONSTANT_Array: + addCPEntry(cp.getCPArray(i)); + break; + case CONSTANT_String: + addCPString(cp.getCPString(i)); + break; + case CONSTANT_Class: + addCPClass(cp.getCPClass(i)); + break; + case CONSTANT_FieldRef: + addCPFieldRef(cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)); + break; + case CONSTANT_MethodRef: + addCPMethodRef(cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)); + break; + case CONSTANT_NameAndType: + addCPNameAndType(cp.getCPNATName(i), cp.getCPNATType(i)); + break; + case CONSTANT_Integer: + addCPInt(cp.getCPInt(i)); + break; + case CONSTANT_Float: + addCPFloat(cp.getCPFloat(i)); + break; + case CONSTANT_Long: + addCPLong(cp.getCPLong(i)); + break; + case CONSTANT_Double: + addCPDouble(cp.getCPDouble(i)); + break; + case CONSTANT_Utf8: + addCPUtf8(cp.getCPUtf8(i)); + break; + case CONSTANT_Constraint: + addCPConstraint(cp.getCPConstraint(i)); + break; + case CONSTANT_Type: + addCPType(cp.getCPType(i)); + break; + case CONSTANT_ByteArray: + addCPBytes(cp.getCPBytes(i)); + break; + } + } + } + + public int addCPEntry(Object o) { + if (inverseMap == null) { + throw new IllegalArgumentException("Cannot add a new constant pool entry during makeBytes() processing!"); + } + + if (o == null) + return 0; + + Integer i = inverseMap.get(o); + if (i != null) { + return i.intValue(); + } + else { + int index = cpItems.size(); + i = new Integer(index); + inverseMap.put(o, i); + cpItems.add(o); + return index; + } + } + + /** + * Add a Utf8 string to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPUtf8(String s) { + return addCPEntry(s); + } + + /** + * Add a Utf8 string to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPConstraint(Constraint s) { + return addCPEntry(s); + } + + /** + * Add an Integer to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPInt(int i) { + return addCPEntry(new Integer(i)); + } + + /** + * Add a Float to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPFloat(float f) { + return addCPEntry(new Float(f)); + } + + /** + * Add a Float to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPBytes(byte[] b) { + return addCPEntry(b); + } + + /** + * Add a Long to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPLong(long l) { + return addCPEntry(new Long(l)); + } + + /** + * Add a Double to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPDouble(double d) { + return addCPEntry(new Double(d)); + } + + /** + * Add a String to the constant pool if necessary. + * + * @return the index of a constant pool item with the right value + */ + public int addCPString(String s) { + return addCPEntry(new CWString(s)); + } + + /** + * Add a Class to the constant pool if necessary. + * + * @param s + * the class name, in JVM format (e.g., java/lang/Object) + * @return the index of a constant pool item with the right value + */ + public int addCPClass(String s) { + if (s == null) { + throw new IllegalArgumentException("null s: " + s); + } + return addCPEntry(new CWClass(s)); + } + + /** + * Add a Type to the constant pool if necessary. + * + * @param s + * the class name, in JVM format (e.g., java/lang/Object) + * @return the index of a constant pool item with the right value + */ + public int addCPType(String s) { + if (s == null) { + throw new IllegalArgumentException("null s: " + s); + } + try { + return addCPEntry(Type.parse(s)); + } + catch (InvalidClassFileException e) { + throw new IllegalArgumentException(e); + } + } + + /** + * Add a Type to the constant pool if necessary. + * + * @param s + * the class name, in JVM format (e.g., java/lang/Object) + * @return the index of a constant pool item with the right value + */ + public int addCPType(Type s) { + if (s == null) { + throw new IllegalArgumentException("null s: " + s); + } + return addCPEntry(s); + } + + /** + * Add a FieldRef to the constant pool if necessary. + * + * @param c + * the class name, in JVM format (e.g., java/lang/Object) + * @param n + * the field name + * @param t + * the field type, in JVM format (e.g., I, Z, or + * Ljava/lang/Object;) + * @return the index of a constant pool item with the right value + */ + public int addCPFieldRef(String c, String n, String t) { + return addCPEntry(new CWRef(CONSTANT_FieldRef, c, n, t)); + } + + /** + * Add a MethodRef to the constant pool if necessary. + * + * @param c + * the class name, in JVM format (e.g., java/lang/Object) + * @param n + * the method name + * @param t + * the method type, in JVM format (e.g., V(ILjava/lang/Object;) ) + * @return the index of a constant pool item with the right value + */ + public int addCPMethodRef(String c, String n, String t) { + return addCPEntry(new CWRef(CONSTANT_MethodRef, c, n, t)); + } + + /** + * Add a NameAndType to the constant pool if necessary. + * + * @param n + * the name + * @param t + * the type, in JVM format + * @return the index of a constant pool item with the right value + */ + public int addCPNameAndType(String n, String t) { + return addCPEntry(new CWNameAndType(n, t)); + } + + void copyInto(ByteBuffer w) { + int countOffset = w.offset(); + + // Reserve a place for the number of entries. + w.addInt(0); + + // BE CAREFUL: the newCPEntries array grows during this loop. + for (int i = 1; i < cpItems.size(); i++) { + Object o = getCPEntry(i); + + w.addInt(0xdeadbeef); + + if (o instanceof CWItem) { + CWItem item = (CWItem) o; + byte t = item.getType(); + switch (t) { + case CONSTANT_Class: + w.addByte(t); + w.addInt(addCPUtf8(((CWClass) item).name)); + break; + case CONSTANT_String: + w.addByte(t); + w.addInt(addCPUtf8(((CWString) item).str)); + break; + case CONSTANT_NameAndType: { + CWNameAndType nat = (CWNameAndType) item; + w.addByte(t); + w.addInt(addCPUtf8(nat.name)); + w.addInt(addCPType(nat.type)); + break; + } + case CONSTANT_MethodRef: + case CONSTANT_FieldRef: { + CWRef ref = (CWRef) item; + w.addByte(t); + w.addInt(addCPClass(ref.container)); + w.addInt(addCPNameAndType(ref.name, ref.type)); + break; + } + default: + throw new Error("Invalid type: " + t); + } + } + else if (o instanceof String) { + String s = (String) o; + + w.addByte(CONSTANT_Utf8); + int lenOffset = w.offset(); + w.addInt(0); + + int startOffset = w.offset(); + + for (int j = 0; j < s.length(); j++) { + char ch = s.charAt(j); + if (ch == 0) { + w.addUShort(0xC080); + } + else if (ch < 0x80) { + w.addByte((byte) ch); + } + else if (ch < 0x800) { + w.addByte((byte) ((ch >> 6) | 0xC0)); + w.addByte((byte) ((ch & 0x3F) | 0x80)); + } + else { + w.addByte((byte) ((ch >> 12) | 0xE0)); + w.addByte((byte) (((ch >> 6) & 0x3F) | 0x80)); + w.addByte((byte) ((ch & 0x3F) | 0x80)); + } + } + int bytes = w.offset() - startOffset; + w.setInt(lenOffset, bytes); + } + else if (o instanceof Integer) { + w.addByte(CONSTANT_Integer); + w.addInt(((Integer) o).intValue()); + } + else if (o instanceof Long) { + w.addByte(CONSTANT_Long); + w.addLong(((Long) o).longValue()); + } + else if (o instanceof Float) { + w.addByte(CONSTANT_Float); + w.addFloat(((Float) o).floatValue()); + } + else if (o instanceof Double) { + w.addByte(CONSTANT_Double); + w.addDouble(((Double) o).doubleValue()); + } + else if (o instanceof byte[]) { + w.addByte(CONSTANT_ByteArray); + w.addLength(((byte[]) o).length); + w.addBytes((byte[]) o); + } + else if (o instanceof Object[]) { + w.addByte(CONSTANT_Array); + Object[] a = (Object[]) o; + w.addLength(a.length*CP_INDEX_SIZE); + for (int k = 0; k < a.length; k++) { + w.addCPIndex(addCPEntry(a[k])); + } + } + else if (o instanceof int[]) { + w.addByte(CONSTANT_Array); + int[] a = (int[]) o; + w.addLength(a.length*CP_INDEX_SIZE); + for (int k = 0; k < a.length; k++) { + w.addCPIndex(addCPEntry(a[k])); + } + } + else if (o instanceof long[]) { + w.addByte(CONSTANT_Array); + long[] a = (long[]) o; + w.addLength(a.length*CP_INDEX_SIZE); + for (int k = 0; k < a.length; k++) { + w.addCPIndex(addCPEntry(a[k])); + } + } + else if (o instanceof float[]) { + w.addByte(CONSTANT_Array); + float[] a = (float[]) o; + w.addLength(a.length*CP_INDEX_SIZE); + for (int k = 0; k < a.length; k++) { + w.addCPIndex(addCPEntry(a[k])); + } + } + else if (o instanceof double[]) { + w.addByte(CONSTANT_Array); + double[] a = (double[]) o; + w.addLength(a.length*CP_INDEX_SIZE); + for (int k = 0; k < a.length; k++) { + w.addCPIndex(addCPEntry(a[k])); + } + } + else if (o instanceof Constraint) { + Constraint c = (Constraint) o; + w.addByte(CONSTANT_Constraint); + c.write(w); + } + else if (o instanceof Type) { + Type c = (Type) o; + w.addByte(CONSTANT_Type); + c.writeInto(this, w); + } + else { + throw new IllegalArgumentException("bad cp item " + o + " at " + i); + } + } + + // go back and write the count + w.setInt(countOffset, cpItems.size()); + } + + /** + * @return the number of constant pool items (maximum item index plus one) + */ + public int getItemCount() { + return cpItems.size(); + } + + public Object getCPEntry(int i) { + return cpItems.get(i); + } + + /** + * @return the type of constant pool item i, or 0 if i is an unused constant + * pool item + */ + public byte getItemType(int i) throws IllegalArgumentException { + Object o = getCPEntry(i); + if (o == null) + return CONSTANT_Null; + if (o instanceof String) + return CONSTANT_Utf8; + if (o instanceof Integer) + return CONSTANT_Integer; + if (o instanceof Long) + return CONSTANT_Long; + if (o instanceof Float) + return CONSTANT_Float; + if (o instanceof Double) + return CONSTANT_Double; + if (o instanceof byte[]) + return CONSTANT_ByteArray; + if (o instanceof Object[]) + return CONSTANT_Array; + if (o instanceof CWItem) + return ((CWItem) o).getType(); + throw new IllegalArgumentException("bad constant at " + i); + } + + /** + * @return the name of the Class at constant pool item i, in JVM format + * (e.g., java/lang/Object) + */ + public String getCPClass(int i) { + return ((CWClass) getCPEntry(i)).name; + }... [truncated message content] |
From: <dgr...@us...> - 2009-05-12 17:51:47
|
Revision: 8309 http://x10.svn.sourceforge.net/x10/?rev=8309&view=rev Author: dgrove-oss Date: 2009-05-12 17:51:33 +0000 (Tue, 12 May 2009) Log Message: ----------- enable bdwgc by default on linux. Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java trunk/x10.runtime.17/build.xml Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java 2009-05-12 13:29:17 UTC (rev 8308) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/Configuration.java 2009-05-12 17:51:33 UTC (rev 8309) @@ -38,7 +38,7 @@ public static boolean VIM_MODELINE = true; private static final String VIM_MODELINE_desc = "Generate a modeline (formatting instructions) for VIm"; - public static boolean DISABLE_GC = true; + public static boolean DISABLE_GC = false; private static final String DISABLE_GC_desc = "Disable the linking in of the BDW conservative garbage collector"; public static String MANIFEST = null; Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-12 13:29:17 UTC (rev 8308) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-05-12 17:51:33 UTC (rev 8309) @@ -609,7 +609,7 @@ assert (PLATFORM.startsWith("win32_")); } - protected boolean gcEnabled() { return true; } + protected boolean gcEnabled() { return false; } protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); Modified: trunk/x10.runtime.17/build.xml =================================================================== --- trunk/x10.runtime.17/build.xml 2009-05-12 13:29:17 UTC (rev 8308) +++ trunk/x10.runtime.17/build.xml 2009-05-12 17:51:33 UTC (rev 8309) @@ -15,7 +15,7 @@ <property name="make.exe" value="make"/> <property name="bash.exe" value="bash"/> <property name="optimize" value="false" /> - <property name="DISABLE_GC" value="true" /><!-- Globally disable GC --> + <property name="DISABLE_GC" value="false" /> <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="x10.constraints.classpath"/> @@ -60,11 +60,10 @@ <!-- Determine whether or not we should be building with GC enabled --> <condition property="bdwgc.enabled"> <and> + <isfalse value="${DISABLE_GC}" /> <or> <os family="unix" name="linux"/> - <os family="windows"/> </or> - <isfalse value="${DISABLE_GC}" /> </and> </condition> <condition property="cppmake.gcarg" value="ENABLE_GC=1" else="DISABLE_GC=1"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-05-14 19:04:29
|
Revision: 8339 http://x10.svn.sourceforge.net/x10/?rev=8339&view=rev Author: dgrove-oss Date: 2009-05-14 19:04:15 +0000 (Thu, 14 May 2009) Log Message: ----------- Kenny's first cut at pulling some code from Jikes RVM's optimizing compiler for use in an an X10 optimizing middle end. Added Paths: ----------- trunk/x10.me/ trunk/x10.me/.classpath trunk/x10.me/.project trunk/x10.me/.settings/ trunk/x10.me/.settings/org.eclipse.jdt.ui.prefs trunk/x10.me/COPYRIGHT.txt trunk/x10.me/src/ trunk/x10.me/src/x10me/ trunk/x10.me/src/x10me/opt/ trunk/x10.me/src/x10me/opt/DefUse.java trunk/x10.me/src/x10me/opt/alias/ trunk/x10.me/src/x10me/opt/alias/MemoryAtom.java trunk/x10.me/src/x10me/opt/bc2ir/ trunk/x10.me/src/x10me/opt/bc2ir/BCconstants.java trunk/x10.me/src/x10me/opt/bc2ir/IRGenOptions.java trunk/x10.me/src/x10me/opt/controlflow/ trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTGraph.java trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTNode.java trunk/x10.me/src/x10me/opt/controlflow/BasicBlock.java trunk/x10.me/src/x10me/opt/controlflow/BasicBlockEnumeration.java trunk/x10.me/src/x10me/opt/controlflow/BuildLST.java trunk/x10.me/src/x10me/opt/controlflow/CFGTransformations.java trunk/x10.me/src/x10me/opt/controlflow/ControlFlowGraph.java trunk/x10.me/src/x10me/opt/controlflow/Diamond.java trunk/x10.me/src/x10me/opt/controlflow/DominanceFrontier.java trunk/x10.me/src/x10me/opt/controlflow/DominatorInfo.java trunk/x10.me/src/x10me/opt/controlflow/DominatorTree.java trunk/x10.me/src/x10me/opt/controlflow/DominatorTreeNode.java trunk/x10.me/src/x10me/opt/controlflow/DominatorTreePhase.java trunk/x10.me/src/x10me/opt/controlflow/DominatorsPhase.java trunk/x10.me/src/x10me/opt/controlflow/EmptyBasicBlockEnumeration.java trunk/x10.me/src/x10me/opt/controlflow/EstimateBlockFrequencies.java trunk/x10.me/src/x10me/opt/controlflow/LSTGraph.java trunk/x10.me/src/x10me/opt/controlflow/LSTNode.java trunk/x10.me/src/x10me/opt/controlflow/LTDominatorInfo.java trunk/x10.me/src/x10me/opt/controlflow/LTDominators.java trunk/x10.me/src/x10me/opt/controlflow/LoopAnalysis.java trunk/x10.me/src/x10me/opt/controlflow/LoopUnrolling.java trunk/x10.me/src/x10me/opt/controlflow/PostDominatorsPhase.java trunk/x10.me/src/x10me/opt/driver/ trunk/x10.me/src/x10me/opt/driver/CompilerPhase.java trunk/x10.me/src/x10me/opt/driver/DumpFile.java trunk/x10.me/src/x10me/opt/driver/OptConstants.java trunk/x10.me/src/x10me/opt/driver/OptOptions.java trunk/x10.me/src/x10me/opt/driver/SizeConstants.java trunk/x10.me/src/x10me/opt/inlining/ trunk/x10.me/src/x10me/opt/inlining/InlineOracle.java trunk/x10.me/src/x10me/opt/inlining/InlineSequence.java trunk/x10.me/src/x10me/opt/ir/ trunk/x10.me/src/x10me/opt/ir/ALoad.java trunk/x10.me/src/x10me/opt/ir/AStore.java trunk/x10.me/src/x10me/opt/ir/Add.java trunk/x10.me/src/x10me/opt/ir/Addr2int.java trunk/x10.me/src/x10me/opt/ir/Addr2long.java trunk/x10.me/src/x10me/opt/ir/Arraylength.java trunk/x10.me/src/x10me/opt/ir/Athrow.java trunk/x10.me/src/x10me/opt/ir/AthrowParent.java trunk/x10.me/src/x10me/opt/ir/Attempt.java trunk/x10.me/src/x10me/opt/ir/AttemptAddr.java trunk/x10.me/src/x10me/opt/ir/AttemptInt.java trunk/x10.me/src/x10me/opt/ir/AttemptLong.java trunk/x10.me/src/x10me/opt/ir/BBMark.java trunk/x10.me/src/x10me/opt/ir/BBend.java trunk/x10.me/src/x10me/opt/ir/Binary.java trunk/x10.me/src/x10me/opt/ir/BooleanCmp.java trunk/x10.me/src/x10me/opt/ir/BooleanCmpAddr.java trunk/x10.me/src/x10me/opt/ir/BooleanCmpDouble.java trunk/x10.me/src/x10me/opt/ir/BooleanCmpFloat.java trunk/x10.me/src/x10me/opt/ir/BooleanCmpInt.java trunk/x10.me/src/x10me/opt/ir/BooleanCmpLong.java trunk/x10.me/src/x10me/opt/ir/BooleanNot.java trunk/x10.me/src/x10me/opt/ir/BoundsCheck.java trunk/x10.me/src/x10me/opt/ir/BoundsCheckParent.java trunk/x10.me/src/x10me/opt/ir/ByteAload.java trunk/x10.me/src/x10me/opt/ir/ByteAstore.java trunk/x10.me/src/x10me/opt/ir/ByteLoad.java trunk/x10.me/src/x10me/opt/ir/ByteStore.java trunk/x10.me/src/x10me/opt/ir/CacheOp.java trunk/x10.me/src/x10me/opt/ir/Call.java trunk/x10.me/src/x10me/opt/ir/CallParent.java trunk/x10.me/src/x10me/opt/ir/Checkcast.java trunk/x10.me/src/x10me/opt/ir/CheckcastNotnull.java trunk/x10.me/src/x10me/opt/ir/CheckcastUnresolved.java trunk/x10.me/src/x10me/opt/ir/CondMove.java trunk/x10.me/src/x10me/opt/ir/Double2float.java trunk/x10.me/src/x10me/opt/ir/Double2int.java trunk/x10.me/src/x10me/opt/ir/Double2long.java trunk/x10.me/src/x10me/opt/ir/DoubleAdd.java trunk/x10.me/src/x10me/opt/ir/DoubleAload.java trunk/x10.me/src/x10me/opt/ir/DoubleAsLongBits.java trunk/x10.me/src/x10me/opt/ir/DoubleAstore.java trunk/x10.me/src/x10me/opt/ir/DoubleCmpg.java trunk/x10.me/src/x10me/opt/ir/DoubleCmpl.java trunk/x10.me/src/x10me/opt/ir/DoubleCondMove.java trunk/x10.me/src/x10me/opt/ir/DoubleDiv.java trunk/x10.me/src/x10me/opt/ir/DoubleIfcmp.java trunk/x10.me/src/x10me/opt/ir/DoubleLoad.java trunk/x10.me/src/x10me/opt/ir/DoubleMove.java trunk/x10.me/src/x10me/opt/ir/DoubleMul.java trunk/x10.me/src/x10me/opt/ir/DoubleNeg.java trunk/x10.me/src/x10me/opt/ir/DoubleRem.java trunk/x10.me/src/x10me/opt/ir/DoubleSqrt.java trunk/x10.me/src/x10me/opt/ir/DoubleStore.java trunk/x10.me/src/x10me/opt/ir/DoubleSub.java trunk/x10.me/src/x10me/opt/ir/Empty.java trunk/x10.me/src/x10me/opt/ir/ExceptionHandlerBasicBlock.java trunk/x10.me/src/x10me/opt/ir/ExceptionHandlerBasicBlockBag.java trunk/x10.me/src/x10me/opt/ir/Float2double.java trunk/x10.me/src/x10me/opt/ir/Float2int.java trunk/x10.me/src/x10me/opt/ir/Float2long.java trunk/x10.me/src/x10me/opt/ir/FloatAdd.java trunk/x10.me/src/x10me/opt/ir/FloatAload.java trunk/x10.me/src/x10me/opt/ir/FloatAsIntBits.java trunk/x10.me/src/x10me/opt/ir/FloatAstore.java trunk/x10.me/src/x10me/opt/ir/FloatCmpg.java trunk/x10.me/src/x10me/opt/ir/FloatCmpl.java trunk/x10.me/src/x10me/opt/ir/FloatCondMove.java trunk/x10.me/src/x10me/opt/ir/FloatDiv.java trunk/x10.me/src/x10me/opt/ir/FloatIfcmp.java trunk/x10.me/src/x10me/opt/ir/FloatLoad.java trunk/x10.me/src/x10me/opt/ir/FloatMove.java trunk/x10.me/src/x10me/opt/ir/FloatMul.java trunk/x10.me/src/x10me/opt/ir/FloatNeg.java trunk/x10.me/src/x10me/opt/ir/FloatRem.java trunk/x10.me/src/x10me/opt/ir/FloatSqrt.java trunk/x10.me/src/x10me/opt/ir/FloatStore.java trunk/x10.me/src/x10me/opt/ir/FloatSub.java trunk/x10.me/src/x10me/opt/ir/GetArrayElementTibFromTib.java trunk/x10.me/src/x10me/opt/ir/GetCaughtException.java trunk/x10.me/src/x10me/opt/ir/GetClassTib.java trunk/x10.me/src/x10me/opt/ir/GetDoesImplementFromTib.java trunk/x10.me/src/x10me/opt/ir/GetField.java trunk/x10.me/src/x10me/opt/ir/GetFieldParent.java trunk/x10.me/src/x10me/opt/ir/GetObjTib.java trunk/x10.me/src/x10me/opt/ir/GetStatic.java trunk/x10.me/src/x10me/opt/ir/GetStaticParent.java trunk/x10.me/src/x10me/opt/ir/GetSuperclassIdsFromTib.java trunk/x10.me/src/x10me/opt/ir/GetTimeBase.java trunk/x10.me/src/x10me/opt/ir/GetTypeFromTib.java trunk/x10.me/src/x10me/opt/ir/Goto.java trunk/x10.me/src/x10me/opt/ir/GotoParent.java trunk/x10.me/src/x10me/opt/ir/GuardCombine.java trunk/x10.me/src/x10me/opt/ir/GuardCondMove.java trunk/x10.me/src/x10me/opt/ir/GuardMove.java trunk/x10.me/src/x10me/opt/ir/GuardedBinary.java trunk/x10.me/src/x10me/opt/ir/GuardedSet.java trunk/x10.me/src/x10me/opt/ir/GuardedUnary.java trunk/x10.me/src/x10me/opt/ir/HasBranchProfile.java trunk/x10.me/src/x10me/opt/ir/HasField.java trunk/x10.me/src/x10me/opt/ir/HasGuard.java trunk/x10.me/src/x10me/opt/ir/HasGuardResult.java trunk/x10.me/src/x10me/opt/ir/HasResult.java trunk/x10.me/src/x10me/opt/ir/HasTarget.java trunk/x10.me/src/x10me/opt/ir/HasTargets.java trunk/x10.me/src/x10me/opt/ir/HasVariableOperands.java trunk/x10.me/src/x10me/opt/ir/IR.java trunk/x10.me/src/x10me/opt/ir/IREnumeration.java trunk/x10.me/src/x10me/opt/ir/IfCmp.java trunk/x10.me/src/x10me/opt/ir/IfCmp2.java trunk/x10.me/src/x10me/opt/ir/IgClassTest.java trunk/x10.me/src/x10me/opt/ir/IgMethodTest.java trunk/x10.me/src/x10me/opt/ir/IgPatchPoint.java trunk/x10.me/src/x10me/opt/ir/InlineGuard.java trunk/x10.me/src/x10me/opt/ir/InstanceOf.java trunk/x10.me/src/x10me/opt/ir/InstanceOfNotnull.java trunk/x10.me/src/x10me/opt/ir/InstanceOfParent.java trunk/x10.me/src/x10me/opt/ir/InstanceOfUnresolved.java trunk/x10.me/src/x10me/opt/ir/Instruction.java trunk/x10.me/src/x10me/opt/ir/InstructionEnumeration.java trunk/x10.me/src/x10me/opt/ir/InstrumentedCounter.java trunk/x10.me/src/x10me/opt/ir/InstrumentedEventCounter.java trunk/x10.me/src/x10me/opt/ir/Int2addrsigext.java trunk/x10.me/src/x10me/opt/ir/Int2addrzerext.java trunk/x10.me/src/x10me/opt/ir/Int2byte.java trunk/x10.me/src/x10me/opt/ir/Int2double.java trunk/x10.me/src/x10me/opt/ir/Int2float.java trunk/x10.me/src/x10me/opt/ir/Int2long.java trunk/x10.me/src/x10me/opt/ir/Int2short.java trunk/x10.me/src/x10me/opt/ir/Int2ushort.java trunk/x10.me/src/x10me/opt/ir/IntAdd.java trunk/x10.me/src/x10me/opt/ir/IntAload.java trunk/x10.me/src/x10me/opt/ir/IntAnd.java trunk/x10.me/src/x10me/opt/ir/IntAstore.java trunk/x10.me/src/x10me/opt/ir/IntBitsAsFloat.java trunk/x10.me/src/x10me/opt/ir/IntCondMove.java trunk/x10.me/src/x10me/opt/ir/IntDiv.java trunk/x10.me/src/x10me/opt/ir/IntIfcmp.java trunk/x10.me/src/x10me/opt/ir/IntIfcmp2.java trunk/x10.me/src/x10me/opt/ir/IntLoad.java trunk/x10.me/src/x10me/opt/ir/IntMove.java trunk/x10.me/src/x10me/opt/ir/IntMul.java trunk/x10.me/src/x10me/opt/ir/IntNeg.java trunk/x10.me/src/x10me/opt/ir/IntNot.java trunk/x10.me/src/x10me/opt/ir/IntOr.java trunk/x10.me/src/x10me/opt/ir/IntRem.java trunk/x10.me/src/x10me/opt/ir/IntShl.java trunk/x10.me/src/x10me/opt/ir/IntShr.java trunk/x10.me/src/x10me/opt/ir/IntStore.java trunk/x10.me/src/x10me/opt/ir/IntSub.java trunk/x10.me/src/x10me/opt/ir/IntUshr.java trunk/x10.me/src/x10me/opt/ir/IntXor.java trunk/x10.me/src/x10me/opt/ir/IntZeroCheck.java trunk/x10.me/src/x10me/opt/ir/IrPrologue.java trunk/x10.me/src/x10me/opt/ir/Label.java trunk/x10.me/src/x10me/opt/ir/Load.java trunk/x10.me/src/x10me/opt/ir/Long2addr.java trunk/x10.me/src/x10me/opt/ir/Long2double.java trunk/x10.me/src/x10me/opt/ir/Long2float.java trunk/x10.me/src/x10me/opt/ir/Long2int.java trunk/x10.me/src/x10me/opt/ir/LongAdd.java trunk/x10.me/src/x10me/opt/ir/LongAload.java trunk/x10.me/src/x10me/opt/ir/LongAnd.java trunk/x10.me/src/x10me/opt/ir/LongAstore.java trunk/x10.me/src/x10me/opt/ir/LongBitsAsDouble.java trunk/x10.me/src/x10me/opt/ir/LongCmp.java trunk/x10.me/src/x10me/opt/ir/LongCondMove.java trunk/x10.me/src/x10me/opt/ir/LongDiv.java trunk/x10.me/src/x10me/opt/ir/LongIfcmp.java trunk/x10.me/src/x10me/opt/ir/LongLoad.java trunk/x10.me/src/x10me/opt/ir/LongMove.java trunk/x10.me/src/x10me/opt/ir/LongMul.java trunk/x10.me/src/x10me/opt/ir/LongNeg.java trunk/x10.me/src/x10me/opt/ir/LongNot.java trunk/x10.me/src/x10me/opt/ir/LongOr.java trunk/x10.me/src/x10me/opt/ir/LongRem.java trunk/x10.me/src/x10me/opt/ir/LongShl.java trunk/x10.me/src/x10me/opt/ir/LongShr.java trunk/x10.me/src/x10me/opt/ir/LongStore.java trunk/x10.me/src/x10me/opt/ir/LongSub.java trunk/x10.me/src/x10me/opt/ir/LongUshr.java trunk/x10.me/src/x10me/opt/ir/LongXor.java trunk/x10.me/src/x10me/opt/ir/LongZeroCheck.java trunk/x10.me/src/x10me/opt/ir/LookupSwitch.java trunk/x10.me/src/x10me/opt/ir/LookupSwitchParent.java trunk/x10.me/src/x10me/opt/ir/LowTableSwitch.java trunk/x10.me/src/x10me/opt/ir/LowTableSwitchParent.java trunk/x10.me/src/x10me/opt/ir/MonitorEnter.java trunk/x10.me/src/x10me/opt/ir/MonitorExit.java trunk/x10.me/src/x10me/opt/ir/MonitorOp.java trunk/x10.me/src/x10me/opt/ir/Move.java trunk/x10.me/src/x10me/opt/ir/MultiANewArray.java trunk/x10.me/src/x10me/opt/ir/MustImplementInterface.java trunk/x10.me/src/x10me/opt/ir/Neg.java trunk/x10.me/src/x10me/opt/ir/New.java trunk/x10.me/src/x10me/opt/ir/NewArray.java trunk/x10.me/src/x10me/opt/ir/NewObjMultiArray.java trunk/x10.me/src/x10me/opt/ir/NewScalar.java trunk/x10.me/src/x10me/opt/ir/NewUnresolved.java trunk/x10.me/src/x10me/opt/ir/Newarray.java trunk/x10.me/src/x10me/opt/ir/NewarrayUnresolved.java trunk/x10.me/src/x10me/opt/ir/Nop.java trunk/x10.me/src/x10me/opt/ir/NullCheck.java trunk/x10.me/src/x10me/opt/ir/NullCheckParent.java trunk/x10.me/src/x10me/opt/ir/Nullary.java trunk/x10.me/src/x10me/opt/ir/ObjArrayStoreCheck.java trunk/x10.me/src/x10me/opt/ir/ObjArrayStoreCheckNotnull.java trunk/x10.me/src/x10me/opt/ir/Operators.java trunk/x10.me/src/x10me/opt/ir/Phi.java trunk/x10.me/src/x10me/opt/ir/PhiParent.java trunk/x10.me/src/x10me/opt/ir/Pi.java trunk/x10.me/src/x10me/opt/ir/Prepare.java trunk/x10.me/src/x10me/opt/ir/PrepareAddr.java trunk/x10.me/src/x10me/opt/ir/PrepareInt.java trunk/x10.me/src/x10me/opt/ir/PrepareLong.java trunk/x10.me/src/x10me/opt/ir/Prologue.java trunk/x10.me/src/x10me/opt/ir/PutField.java trunk/x10.me/src/x10me/opt/ir/PutFieldParent.java trunk/x10.me/src/x10me/opt/ir/PutStatic.java trunk/x10.me/src/x10me/opt/ir/PutStaticParent.java trunk/x10.me/src/x10me/opt/ir/ReadCeiling.java trunk/x10.me/src/x10me/opt/ir/RefAdd.java trunk/x10.me/src/x10me/opt/ir/RefAload.java trunk/x10.me/src/x10me/opt/ir/RefAnd.java trunk/x10.me/src/x10me/opt/ir/RefAstore.java trunk/x10.me/src/x10me/opt/ir/RefCondMove.java trunk/x10.me/src/x10me/opt/ir/RefIfcmp.java trunk/x10.me/src/x10me/opt/ir/RefLoad.java trunk/x10.me/src/x10me/opt/ir/RefMove.java trunk/x10.me/src/x10me/opt/ir/RefNeg.java trunk/x10.me/src/x10me/opt/ir/RefNot.java trunk/x10.me/src/x10me/opt/ir/RefOr.java trunk/x10.me/src/x10me/opt/ir/RefShl.java trunk/x10.me/src/x10me/opt/ir/RefShr.java trunk/x10.me/src/x10me/opt/ir/RefStore.java trunk/x10.me/src/x10me/opt/ir/RefSub.java trunk/x10.me/src/x10me/opt/ir/RefUshr.java trunk/x10.me/src/x10me/opt/ir/RefXor.java trunk/x10.me/src/x10me/opt/ir/Register.java trunk/x10.me/src/x10me/opt/ir/RegisterOperandEnumeration.java trunk/x10.me/src/x10me/opt/ir/RegisterPool.java trunk/x10.me/src/x10me/opt/ir/Resolve.java trunk/x10.me/src/x10me/opt/ir/ResolveMember.java trunk/x10.me/src/x10me/opt/ir/Return.java trunk/x10.me/src/x10me/opt/ir/ReturnParent.java trunk/x10.me/src/x10me/opt/ir/SetCaughtException.java trunk/x10.me/src/x10me/opt/ir/Shl.java trunk/x10.me/src/x10me/opt/ir/ShortAload.java trunk/x10.me/src/x10me/opt/ir/ShortAstore.java trunk/x10.me/src/x10me/opt/ir/ShortLoad.java trunk/x10.me/src/x10me/opt/ir/ShortStore.java trunk/x10.me/src/x10me/opt/ir/Split.java trunk/x10.me/src/x10me/opt/ir/Store.java trunk/x10.me/src/x10me/opt/ir/StoreCheck.java trunk/x10.me/src/x10me/opt/ir/Syscall.java trunk/x10.me/src/x10me/opt/ir/TableSwitch.java trunk/x10.me/src/x10me/opt/ir/TableSwitchParent.java trunk/x10.me/src/x10me/opt/ir/Trap.java trunk/x10.me/src/x10me/opt/ir/TrapParent.java trunk/x10.me/src/x10me/opt/ir/TypeCheck.java trunk/x10.me/src/x10me/opt/ir/UbyteAload.java trunk/x10.me/src/x10me/opt/ir/UbyteLoad.java trunk/x10.me/src/x10me/opt/ir/Unary.java trunk/x10.me/src/x10me/opt/ir/UnintBegin.java trunk/x10.me/src/x10me/opt/ir/UnintEnd.java trunk/x10.me/src/x10me/opt/ir/UshortAload.java trunk/x10.me/src/x10me/opt/ir/UshortLoad.java trunk/x10.me/src/x10me/opt/ir/WeightedBranchTargets.java trunk/x10.me/src/x10me/opt/ir/WriteFloor.java trunk/x10.me/src/x10me/opt/ir/YieldpointBackedge.java trunk/x10.me/src/x10me/opt/ir/YieldpointEpilogue.java trunk/x10.me/src/x10me/opt/ir/YieldpointPrologue.java trunk/x10.me/src/x10me/opt/ir/ZeroCheck.java trunk/x10.me/src/x10me/opt/ir/operand/ trunk/x10.me/src/x10me/opt/ir/operand/ALengthOperand.java trunk/x10.me/src/x10me/opt/ir/operand/AddressConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/ArrayOperand.java trunk/x10.me/src/x10me/opt/ir/operand/BasicBlockOperand.java trunk/x10.me/src/x10me/opt/ir/operand/BranchOperand.java trunk/x10.me/src/x10me/opt/ir/operand/BranchProfileOperand.java trunk/x10.me/src/x10me/opt/ir/operand/ConditionOperand.java trunk/x10.me/src/x10me/opt/ir/operand/ConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/DoubleConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/FieldOperand.java trunk/x10.me/src/x10me/opt/ir/operand/FloatConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/HeapOperand.java trunk/x10.me/src/x10me/opt/ir/operand/IntConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/LocationOperand.java trunk/x10.me/src/x10me/opt/ir/operand/LongConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/MethodOperand.java trunk/x10.me/src/x10me/opt/ir/operand/NullConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/ObjectConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/Operand.java trunk/x10.me/src/x10me/opt/ir/operand/OperandEnumeration.java trunk/x10.me/src/x10me/opt/ir/operand/RegisterOperand.java trunk/x10.me/src/x10me/opt/ir/operand/StringConstantOperand.java trunk/x10.me/src/x10me/opt/ir/operand/TrueGuardOperand.java trunk/x10.me/src/x10me/opt/ir/operand/TypeOperand.java trunk/x10.me/src/x10me/opt/ir/operand/UnreachableOperand.java trunk/x10.me/src/x10me/opt/passes/ trunk/x10.me/src/x10me/opt/passes/AdjustBranchProbabilities.java trunk/x10.me/src/x10me/opt/passes/BranchOptimizationDriver.java trunk/x10.me/src/x10me/opt/passes/BranchOptimizations.java trunk/x10.me/src/x10me/opt/passes/BranchSimplifier.java trunk/x10.me/src/x10me/opt/passes/ExpressionFolding.java trunk/x10.me/src/x10me/opt/passes/LocalCSE.java trunk/x10.me/src/x10me/opt/passes/LocalCastOptimization.java trunk/x10.me/src/x10me/opt/passes/LocalConstantProp.java trunk/x10.me/src/x10me/opt/passes/LocalCopyProp.java trunk/x10.me/src/x10me/opt/passes/ReorderingPhase.java trunk/x10.me/src/x10me/opt/passes/Simple.java trunk/x10.me/src/x10me/opt/passes/Simplifier.java trunk/x10.me/src/x10me/opt/passes/StaticSplitting.java trunk/x10.me/src/x10me/opt/passes/TailRecursionElimination.java trunk/x10.me/src/x10me/opt/passes/YieldPoints.java trunk/x10.me/src/x10me/opt/ssa/ trunk/x10.me/src/x10me/opt/ssa/EnterSSA.java trunk/x10.me/src/x10me/opt/ssa/HeapVariable.java trunk/x10.me/src/x10me/opt/ssa/SSA.java trunk/x10.me/src/x10me/opt/ssa/SSADictionary.java trunk/x10.me/src/x10me/opt/ssa/SSAOptions.java trunk/x10.me/src/x10me/opt/util/ trunk/x10.me/src/x10me/opt/util/BitSet.java trunk/x10.me/src/x10me/opt/util/BitSetMapping.java trunk/x10.me/src/x10me/opt/util/CompoundEnumerator.java trunk/x10.me/src/x10me/opt/util/DFSenumerateByFinish.java trunk/x10.me/src/x10me/opt/util/DepthFirstEnumerator.java trunk/x10.me/src/x10me/opt/util/EmptyEnumerator.java trunk/x10.me/src/x10me/opt/util/EmptyIterator.java trunk/x10.me/src/x10me/opt/util/FilterEnumerator.java trunk/x10.me/src/x10me/opt/util/FilterIterator.java trunk/x10.me/src/x10me/opt/util/FilteredDFSenumerateByFinish.java trunk/x10.me/src/x10me/opt/util/Graph.java trunk/x10.me/src/x10me/opt/util/GraphEdge.java trunk/x10.me/src/x10me/opt/util/GraphEdgeFilter.java trunk/x10.me/src/x10me/opt/util/GraphElement.java trunk/x10.me/src/x10me/opt/util/GraphNode.java trunk/x10.me/src/x10me/opt/util/GraphNodeEnumeration.java trunk/x10.me/src/x10me/opt/util/GraphNodeEnumerator.java trunk/x10.me/src/x10me/opt/util/GraphUtilities.java trunk/x10.me/src/x10me/opt/util/Queue.java trunk/x10.me/src/x10me/opt/util/ReverseDFSenumerateByFinish.java trunk/x10.me/src/x10me/opt/util/ReverseEnumerator.java trunk/x10.me/src/x10me/opt/util/ReverseFilteredDFSenumerateByFinish.java trunk/x10.me/src/x10me/opt/util/SortedGraphIterator.java trunk/x10.me/src/x10me/opt/util/SortedGraphNode.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraph.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraphEdge.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraphEdgeList.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraphNode.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraphNodeList.java trunk/x10.me/src/x10me/opt/util/SpaceEffGraphNodeListHeader.java trunk/x10.me/src/x10me/opt/util/Stack.java trunk/x10.me/src/x10me/opt/util/TopSort.java trunk/x10.me/src/x10me/opt/util/TopSortInterface.java trunk/x10.me/src/x10me/opt/util/Tree.java trunk/x10.me/src/x10me/opt/util/TreeBottomUpEnumerator.java trunk/x10.me/src/x10me/opt/util/TreeNode.java trunk/x10.me/src/x10me/opt/util/TreeNodeChildrenEnumerator.java trunk/x10.me/src/x10me/opt/util/TreeTopDownEnumerator.java trunk/x10.me/src/x10me/runtime/ trunk/x10.me/src/x10me/runtime/Entrypoints.java trunk/x10.me/src/x10me/types/ trunk/x10.me/src/x10me/types/Address.java trunk/x10.me/src/x10me/types/Extent.java trunk/x10.me/src/x10me/types/Field.java trunk/x10.me/src/x10me/types/KnownTypes.java trunk/x10.me/src/x10me/types/Method.java trunk/x10.me/src/x10me/types/Offset.java trunk/x10.me/src/x10me/types/Type.java trunk/x10.me/src/x10me/types/Word.java trunk/x10.me/src/x10me/util/ trunk/x10.me/src/x10me/util/AbstractHashMapRVM.java trunk/x10.me/src/x10me/util/AbstractHashSetRVM.java trunk/x10.me/src/x10me/util/BitVector.java trunk/x10.me/src/x10me/util/EmptyIterator.java trunk/x10.me/src/x10me/util/HashMapRVM.java trunk/x10.me/src/x10me/util/HashSetRVM.java trunk/x10.me/src/x10me/util/IdentityHashMapRVM.java trunk/x10.me/src/x10me/util/ImmutableEntryHashMapRVM.java trunk/x10.me/src/x10me/util/ImmutableEntryHashSetRVM.java trunk/x10.me/src/x10me/util/ImmutableEntryIdentityHashMapRVM.java trunk/x10.me/src/x10me/util/LinkedListIteratorRVM.java trunk/x10.me/src/x10me/util/LinkedListRVM.java trunk/x10.me/src/x10me/util/Pair.java trunk/x10.me/src/x10me/util/PriorityQueueRVM.java trunk/x10.me/src/x10me/util/StringUtilities.java Added: trunk/x10.me/.classpath =================================================================== --- trunk/x10.me/.classpath (rev 0) +++ trunk/x10.me/.classpath 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/x10.me/.project =================================================================== --- trunk/x10.me/.project (rev 0) +++ trunk/x10.me/.project 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>x10.me</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/x10.me/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/x10.me/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/x10.me/.settings/org.eclipse.jdt.ui.prefs 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,3 @@ +#Sat Apr 11 14:09:42 EDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/> Added: trunk/x10.me/COPYRIGHT.txt =================================================================== --- trunk/x10.me/COPYRIGHT.txt (rev 0) +++ trunk/x10.me/COPYRIGHT.txt 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,17 @@ +The initial contribution to Jikes RVM (Oct 2001) was copyright by the IBM +Corporation. Since 2001, a number of individuals and other entities have +contributed code to the project under the terms of the CPL/EPL in which they +retain copyright ownership. We know that at least the following +individuals/entities have copyright in one or more project files. More +precise details on the copyright status of a particular file can only be +accurately determined by examining the history of the file in question. + +In addition to all of the core team members and contributors listed +on the project web pages (http://jikesrvm.org/Acknowledgments), at least +the following organizations have copyright in one or more project files: + +Australian National University +Canisius College +IBM +University of Manchester +University of Massachusetts Property changes on: trunk/x10.me/COPYRIGHT.txt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/DefUse.java =================================================================== --- trunk/x10.me/src/x10me/opt/DefUse.java (rev 0) +++ trunk/x10.me/src/x10me/opt/DefUse.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,472 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt; + + +import x10me.opt.controlflow.BasicBlock; +import x10me.opt.ir.*; +import x10me.opt.ir.operand.*; +import x10me.types.KnownTypes; + + +/** + * This class computes du-lists and associated information. + * + * <P> Note: DU operands are stored on the USE lists, but not the DEF + * lists. + */ +public final class DefUse { + + /** + * Clear defList, useList for an IR. + * + * @param ir the IR in question + */ + public static void clearDU(IR ir) { + for (Register reg = ir.regpool.getFirstSymbolicRegister(); reg != null; reg = reg.getNext()) { + reg.defList = null; + reg.useList = null; + reg.scratch = -1; + reg.clearSeenUse(); + } + + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Cleared DU"); + } + } + + /** + * Compute the register list and def-use lists for a method. + * + * @param ir the IR in question + */ + public static void computeDU(IR ir) { + // Clear old register list (if any) + clearDU(ir); + // Create register defList and useList + for (Instruction instr = ir.firstInstructionInCodeOrder(); instr != null; instr = + instr.nextInstructionInCodeOrder()) { + + OperandEnumeration defs = instr.getDefs(); + OperandEnumeration uses = instr.getUses(); + + while (defs.hasMoreElements()) { + Operand op = defs.next(); + if (op instanceof RegisterOperand) { + RegisterOperand rop = (RegisterOperand) op; + recordDef(rop); + } + } // for ( defs = ... ) + + while (uses.hasMoreElements()) { + Operand op = uses.next(); + if (op instanceof RegisterOperand) { + RegisterOperand rop = (RegisterOperand) op; + recordUse(rop); + } + } // for ( uses = ... ) + } // for ( instr = ... ) + // Remove any symbloic registers with no uses/defs from + // the register pool. We'll waste analysis time keeping them around. + Register next; + for (Register reg = ir.regpool.getFirstSymbolicRegister(); reg != null; reg = next) { + next = reg.getNext(); + if (reg.defList == null && reg.useList == null) { + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Removing " + reg + " from the register pool"); + } + ir.regpool.removeRegister(reg); + } + } + } + + /** + * Record a use of a register + * @param regOp the operand that uses the register + */ + public static void recordUse(RegisterOperand regOp) { + Register reg = regOp.getRegister(); + regOp.append(reg.useList); + reg.useList = regOp; + reg.useCount++; + } + + /** + * Record a def/use of a register + * TODO: For now we just pretend this is a use!!!! + * + * @param regOp the operand that uses the register + */ + public static void recordDefUse(RegisterOperand regOp) { + Register reg = regOp.getRegister(); + regOp.append(reg.useList); + reg.useList = regOp; + } + + /** + * Record a def of a register + * @param regOp the operand that uses the register + */ + public static void recordDef(RegisterOperand regOp) { + Register reg = regOp.getRegister(); + regOp.append(reg.defList); + reg.defList = regOp; + } + + /** + * Record that a use of a register no longer applies + * @param regOp the operand that uses the register + */ + public static void removeUse(IR ir, RegisterOperand regOp) { + Register reg = regOp.getRegister(); + if (regOp == reg.useList) { + reg.useList = reg.useList.getNext(); + } else { + RegisterOperand prev = reg.useList; + RegisterOperand curr = prev.getNext(); + while (curr != regOp) { + prev = curr; + curr = curr.getNext(); + } + prev.setNext(curr.getNext()); + } + reg.useCount--; + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("removed a use " + regOp.instruction); + printUses(ir, reg); + } + } + + /** + * Record that a def of a register no longer applies + * @param regOp the operand that uses the register + */ + public static void removeDef(IR ir, RegisterOperand regOp) { + Register reg = regOp.getRegister(); + if (regOp == reg.defList) { + reg.defList = reg.defList.getNext(); + } else { + RegisterOperand prev = reg.defList; + RegisterOperand curr = prev.getNext(); + while (curr != regOp) { + prev = curr; + curr = curr.getNext(); + } + prev.setNext(curr.getNext()); + } + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("removed a def " + regOp.instruction); + printDefs(ir, reg); + } + } + + /** + * This code changes the use in <code>origRegOp</code> to use + * the use in <code>newRegOp</code>. + * + * <p> If the type of <code>origRegOp</code> is not a reference, but the + * type of <code>newRegOp</code> is a reference, we need to update + * <code>origRegOp</code> to be a reference. + * Otherwise, the GC map code will be incorrect. -- Mike Hind + * @param origRegOp the register operand to change + * @param newRegOp the register operand to use for the change + */ + public static void transferUse(IR ir, RegisterOperand origRegOp, RegisterOperand newRegOp) { + assert origRegOp.getRegister().getType() == newRegOp.getRegister().getType(); + Instruction inst = origRegOp.instruction; + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Transfering a use of " + origRegOp + " in " + inst + " to " + newRegOp); + } + removeUse(ir, origRegOp); + // check to see if the regOp type is NOT a ref, but the newRegOp type + // is a reference. This can occur because of magic calls. + if (!origRegOp.getType().isReferenceType() && newRegOp.getType().isReferenceType()) { + // clone the newRegOp object and use it to replace the regOp object + RegisterOperand copiedRegOp = (RegisterOperand) newRegOp.copy(); + inst.replaceOperand(origRegOp, copiedRegOp); + recordUse(copiedRegOp); + } else { + // just copy the register + origRegOp.setRegister(newRegOp.getRegister()); + if (newRegOp.getType() != KnownTypes.OBJECT_TYPE && + !newRegOp.getType().isUnboxedType() && !origRegOp.isPreciseType()) { + // copy type information from new to orig unless its an unboxed type + // (we don't want to copy type information for unboxed types as it is + // likely the result of inlining new) or the type of the original is + // precise + origRegOp.copyType(newRegOp); + } + recordUse(origRegOp); + } + if (ir.dumpFile.current != null) { + printUses(ir, origRegOp.getRegister()); + printUses(ir, newRegOp.getRegister()); + } + } + + /** + * Remove an instruction and update register lists. + */ + public static void removeInstructionAndUpdateDU(IR ir, Instruction s) { + for (OperandEnumeration e = s.getDefs(); e.hasMoreElements();) { + Operand op = e.next(); + if (op instanceof RegisterOperand) { + removeDef(ir, (RegisterOperand) op); + } + } + for (OperandEnumeration e = s.getUses(); e.hasMoreElements();) { + Operand op = e.next(); + if (op instanceof RegisterOperand) { + removeUse(ir, (RegisterOperand) op); + } + } + s.remove(); + } + + /** + * Update register lists to account for the effect of a new + * instruction s + */ + public static void updateDUForNewInstruction(Instruction s) { + for (OperandEnumeration e = s.getDefs(); e.hasMoreElements();) { + Operand op = e.next(); + if (op instanceof RegisterOperand) { + recordDef((RegisterOperand) op); + } + } + for (OperandEnumeration e = s.getUses(); e.hasMoreElements();) { + Operand op = e.next(); + if (op instanceof RegisterOperand) { + recordUse((RegisterOperand) op); + } + } + } + + /** + * Replace an instruction and update register lists. + */ + public static void replaceInstructionAndUpdateDU(IR ir, Instruction oldI, Instruction newI) { + oldI.insertBefore(newI); + removeInstructionAndUpdateDU(ir, oldI); + updateDUForNewInstruction(newI); + } + + /** + * Enumerate all operands that use a given register. + */ + public static RegisterOperandEnumeration uses(Register reg) { + return new RegOpListWalker(reg.useList); + } + + /** + * Enumerate all operands that def a given register. + */ + public static RegisterOperandEnumeration defs(Register reg) { + return new RegOpListWalker(reg.defList); + } + + /** + * Does a given register have exactly one use? + */ + static boolean exactlyOneUse(Register reg) { + return (reg.useList != null) && (reg.useList.getNext() == null); + } + + /** + * Print all the instructions that def a register. + * @param reg + */ + static void printDefs(IR ir, Register reg) { + ir.dumpFile.current.println("Definitions of " + reg); + for (RegisterOperandEnumeration e = defs(reg); e.hasMoreElements();) { + ir.dumpFile.current.println("\t" + e.next().instruction); + } + } + + /** + * Print all the instructions that usea register. + * @param reg + */ + static void printUses(IR ir, Register reg) { + ir.dumpFile.current.println("Uses of " + reg); + for (RegisterOperandEnumeration e = uses(reg); e.hasMoreElements();) { + ir.dumpFile.current.println("\t" + e.next().instruction); + } + } + + /** + * Recompute <code> isSSA </code> for all registers by traversing register + * list. + * NOTE: the DU MUST be computed BEFORE calling this function + * + * @param ir the IR in question + */ + public static void recomputeSSA(IR ir) { + // Use register /ist to enumerate register objects (FAST) + for (Register reg = ir.regpool.getFirstSymbolicRegister(); reg != null; reg = reg.getNext()) { + // Set isSSA = true iff reg has exactly one static definition. + reg.putSSA((reg.defList != null && reg.defList.getNext() == null)); + } + } + + /** + * Merge register reg2 into register reg1. + * Remove reg2 from the DU information + */ + public static void mergeRegisters(IR ir, Register reg1, Register reg2) { + RegisterOperand lastOperand; + if (reg1 == reg2) { + return; + } + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Merging " + reg2 + " into " + reg1); + printDefs(ir, reg2); + printUses(ir, reg2); + printDefs(ir, reg1); + printUses(ir, reg1); + } + // first loop through defs of reg2 (currently, there will only be one def) + lastOperand = null; + for (RegisterOperand def = reg2.defList; def != null; lastOperand = def, def = def.getNext()) { + // Change def to refer to reg1 instead + def.setRegister(reg1); + // Track lastOperand + lastOperand = def; + } + if (lastOperand != null) { + // Set reg1.defList = concat(reg2.defList, reg1.deflist) + lastOperand.setNext(reg1.defList); + reg1.defList = reg2.defList; + } + // now loop through uses + lastOperand = null; + for (RegisterOperand use = reg2.useList; use != null; use = use.getNext()) { + // Change use to refer to reg1 instead + use.setRegister(reg1); + // Track lastOperand + lastOperand = use; + } + if (lastOperand != null) { + // Set reg1.useList = concat(reg2.useList, reg1.uselist) + lastOperand.setNext(reg1.useList); + reg1.useList = reg2.useList; + } + // Remove reg2 from RegisterPool + ir.regpool.removeRegister(reg2); + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Merge complete"); + printDefs(ir, reg1); + printUses(ir, reg1); + } + } + + /** + * Recompute spansBasicBlock flags for all registers. + * + * @param ir the IR in question + */ + public static void recomputeSpansBasicBlock(IR ir) { + // clear fields + for (Register reg = ir.regpool.getFirstSymbolicRegister(); reg != null; reg = reg.getNext()) { + reg.scratch = -1; + reg.clearSpansBasicBlock(); + } + // iterate over the basic blocks + for (BasicBlock bb = ir.firstBasicBlockInCodeOrder(); bb != null; bb = bb.nextBasicBlockInCodeOrder()) { + int bbNum = bb.getNumber(); + // enumerate the instructions in the basic block + for (InstructionEnumeration e = bb.forwardRealInstrEnumerator(); e.hasMoreElements();) { + Instruction inst = e.next(); + // check each Operand in the instruction + for (OperandEnumeration ops = inst.getOperands(); ops.hasMoreElements();) { + Operand op = ops.next(); + if (op instanceof RegisterOperand) { + Register reg = ((RegisterOperand) op).getRegister(); + if (reg.isPhysical()) { + continue; + } + if (reg.spansBasicBlock()) { + continue; + } + if (seenInDifferentBlock(reg, bbNum)) { + reg.setSpansBasicBlock(); + continue; + } + if (inst instanceof Phi) { + reg.setSpansBasicBlock(); + continue; + } + logAppearance(reg, bbNum); + } + } + } + } + } + + /** + * Mark that we have seen a register in a particular + * basic block, and whether we saw a use + * + * @param reg the register + * @param bbNum the number of the basic block + */ + private static void logAppearance(Register reg, int bbNum) { + reg.scratch = bbNum; + } + + /** + * Have we seen this register in a different basic block? + * + * @param reg the register + * @param bbNum the number of the basic block + */ + private static boolean seenInDifferentBlock(Register reg, int bbNum) { + int bb = reg.scratch; + return (bb != -1) && (bb != bbNum); + } + + /** + * Utility class to encapsulate walking a use/def list. + */ + private static final class RegOpListWalker implements RegisterOperandEnumeration { + + private RegisterOperand current; + + RegOpListWalker(RegisterOperand start) { + current = start; + } + + public boolean hasMoreElements() { + return current != null; + } + + public RegisterOperand nextElement() { + return next(); + } + + public RegisterOperand next() { + if (current == null) raiseNoSuchElementException(); + RegisterOperand tmp = current; + current = current.getNext(); + return tmp; + } + + private static void raiseNoSuchElementException() { + throw new java.util.NoSuchElementException("RegOpListWalker"); + } + } +} Property changes on: trunk/x10.me/src/x10me/opt/DefUse.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/alias/MemoryAtom.java =================================================================== --- trunk/x10.me/src/x10me/opt/alias/MemoryAtom.java (rev 0) +++ trunk/x10.me/src/x10me/opt/alias/MemoryAtom.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,59 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt.alias; + +import x10me.types.Type; + +/** + * Memory element for aliasing oracle. + * + * + */ + +public class MemoryAtom { + + private Type type; + + /** + * Return <code>true</code> if the this MAY be aliased with other, + * otherwise return <code>false</code>. + * @param other the value to be compared with this. + * @return <code>true</code> if the this MAY be aliased with other, + * otherwise return <code>false</code>. + */ + public boolean mayBeAliased(MemoryAtom other) { + if (this == other) + return true; + + return this.type.isAssignableTo(other.type); + } + + /** + * Return <code>true</code> if the this MUST be aliased with other, + * otherwise return <code>false</code>. + * + * @param other the value to be compared with this. + * @return <code>true</code> if the this MUST be aliased with other, + * otherwise return <code>false</code>. + */ + public boolean mustBeAliased(MemoryAtom other) { + if (this == other) + return true; + + return false; + } +} Property changes on: trunk/x10.me/src/x10me/opt/alias/MemoryAtom.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/bc2ir/BCconstants.java =================================================================== --- trunk/x10.me/src/x10me/opt/bc2ir/BCconstants.java (rev 0) +++ trunk/x10.me/src/x10me/opt/bc2ir/BCconstants.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,39 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt.bc2ir; + +public interface BCconstants { + // the following constants are dummy bytecode indices, + // used to mark IR instructions that do not correspond + // to any original bytecode + int UNKNOWN_BCI = -1; + int PROLOGUE_BCI = -2; + int EPILOGUE_BCI = -3; + int RECTIFY_BCI = -4; + int SYNTH_CATCH_BCI = -5; + int SYNCHRONIZED_MONITORENTER_BCI = -6; + int SYNCHRONIZED_MONITOREXIT_BCI = -7; + int METHOD_COUNTER_BCI = -8; + int SSA_SYNTH_BCI = -9; + int INSTRUMENTATION_BCI = -10; + int RUNTIME_SERVICES_BCI = -11; + int EXTANT_ANALYSIS_BCI = -12; + int PROLOGUE_BLOCK_BCI = -13; + int EPILOGUE_BLOCK_BCI = -14; + int OSR_PROLOGUE = -15; + int SYNTH_LOOP_VERSIONING_BCI = -16; +} Property changes on: trunk/x10.me/src/x10me/opt/bc2ir/BCconstants.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/bc2ir/IRGenOptions.java =================================================================== --- trunk/x10.me/src/x10me/opt/bc2ir/IRGenOptions.java (rev 0) +++ trunk/x10.me/src/x10me/opt/bc2ir/IRGenOptions.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,23 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt.bc2ir; + +public class IRGenOptions { + + public static boolean DBG_OPERAND_LATTICE = false; + +} Property changes on: trunk/x10.me/src/x10me/opt/bc2ir/IRGenOptions.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTGraph.java =================================================================== --- trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTGraph.java (rev 0) +++ trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTGraph.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,54 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt.controlflow; + +import x10me.opt.ir.IR; + +/** + * Extends the functionality of a {@link LSTGraph} so that it comprises + * {@link AnnotatedLSTNode}s which have extra information in them. + * + * @see LSTGraph + * @see AnnotatedLSTNode + */ +public class AnnotatedLSTGraph extends LSTGraph { + + /** + * The main entry point + * @param ir the IR to process + */ + public static void perform(IR ir) { + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println("Creating an AnnotatedLSTGraph for " + ir.method); + } + ir.loopStructureTree = new AnnotatedLSTGraph(ir, ir.loopStructureTree); + if (ir.dumpFile.current != null) { + ir.dumpFile.current.println(ir.loopStructureTree.toString()); + } + } + + /** + * Constructor + * + * @param ir The containing IR + * @param graph The {@link LSTGraph} to convert into an annotated graph + */ + public AnnotatedLSTGraph(IR ir, LSTGraph graph) { + super(graph); + rootNode = new AnnotatedLSTNode(ir, rootNode); + } +} Property changes on: trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTGraph.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTNode.java =================================================================== --- trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTNode.java (rev 0) +++ trunk/x10.me/src/x10me/opt/controlflow/AnnotatedLSTNode.java 2009-05-14 19:04:15 UTC (rev 8339) @@ -0,0 +1,1298 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file was derived from code developed by the + * Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ + +package x10me.opt.controlflow; + +import java.util.ArrayList; +import java.util.Enumeration; + + +import x10me.opt.DefUse; +import x10me.opt.ir.*; +import x10me.opt.ir.operand.ArrayOperand; +import x10me.opt.ir.operand.BasicBlockOperand; +import x10me.opt.ir.operand.ConditionOperand; +import x10me.opt.ir.operand.ConstantOperand; +import x10me.opt.ir.operand.IntConstantOperand; +import x10me.opt.ir.operand.Operand; +import x10me.opt.ir.operand.OperandEnumeration; +import x10me.opt.ir.operand.RegisterOperand; +import x10me.opt.util.GraphNode; +import x10me.util.BitVector; + +/** + * <p>A node in the LST (Loop Structure Tree) with added information + * on: + * + * <ul><li>Whether this is a countable, affine or non-regular loop</li> + * <li>The registers being used to hold the loop iterator</li> + * <li>The initial loop iterator value</li> + * <li>The terminal loop iterator value</li> + * <li>The instruction that modifies the iterator</li> + * <li>The phi instruction that merges the redefined iterator with its original value</li> + * <li>The condition used to test for loop termination</li> + * <li>The stride operand</li> + * </ul> + * + * The information is only held on regular loops. The regular loop + * structure is: + * + * <listing> + * predecessor: + * initialLoopIterator = ...; + * header: + * phiLoopIterator = phi (initialLoopIterator, carriedLoopIterator) + * ...body1... + * carriedLoopIterator = phiLoopIterator iteratorInstr.opcode stride; + * ...body2... + * exit: + * if carriedLoopIterator condition terminalIteratorValue goto header + * successor: + * </listing> + * + * While loops (and implicitly for loops) aren't handled as they can + * be transformed to this form by {@link CFGTransformations}. + * + * TODO: + * <ul><li>More complex iterator instructions (sequences rather than single instructions)</li> + * <li>Handle longs, floats and doubles as loop iterators</li> + * <li>Consideration of more loop structures</li> + * </ul> + * </p> + * + * @see LSTNode + */ +public final class AnnotatedLSTNode extends LSTNode { + // -oO ir.dumpFile.current != null information Oo- + /** + * Flag to optionally print verbose debugging messages + */ + private static final boolean DEBUG = false; + + // -oO Cached values for convenience Oo- + /** + * A pointer to the governing IR + */ + private final IR ir; + + // -oO Blocks that get set up during the recognition of the loop Oo- + /** + * The out of loop block before the header + */ + public BasicBlock predecessor; + // N.B. the header is defined in the superclass + /** + * The in loop block that either loops or leaves the loop + */ + public BasicBlock exit; + /** + * The out of loop block following the exit block + */ + public BasicBlock successor; + + // -oO Instructions that get set up during the recognition of the loop Oo- + /** + * The if instruction within the exit block + */ + private Instruction ifCmpInstr; + /** + * The instruction that modifies the iterator + */ + private Instruction iteratorInstr; + + // Values that get determined during the recognition of the loop + /** + * The the initial iterator that comes into the phi node in the header + */ + public Operand initialIteratorValue; + /** + * The iterator that is used to loop within the exit block + */ + private Operand carriedLoopIterator; + /** + * The the phi iterator that gets modified by the stride to produce the carried iterator + */ + private Operand phiLoopIterator; + /** + * The value that ends the loop + */ + public Operand terminalIteratorValue; + /** + * The condition that is used to check for the end of loop + */ + public ConditionOperand condition; + /** + * The stride operand to the iterator instruction + */ + public Operand strideValue; + + // -oO Interfaces to the rest of the compiler Oo- + /** + * Constructor + * + * @param ir The containing IR + * @param node The node that's being annotated + */ + public AnnotatedLSTNode(IR ir, LSTNode node) { + // Clone information from non-annotated node + super(node); + this.ir = ir; + + // Process inner loops + Enumeration<GraphNode> innerLoops = node.outNodes(); + // Iterate over loops contained within this loop annotating from the inside out + while (innerLoops.hasMoreElements()) { + AnnotatedLSTNode nestedLoop = new AnnotatedLSTNode(ir, (LSTNode) innerLoops.nextElement()); + insertOut(nestedLoop); + } + // Annotate node + perform(); + } + + /** + * Is this a countable loop of the form: + * <listing> + * predecessor: + * initialLoopIterator = ConstantInitialValue; + * header: + * phiLoopIterator = phi (initialLoopIterator, carriedLoopIterator) + * ...body1... + * carriedLoopIterator = phiLoopIterator (+|-) ConstantStride; + * ...body2... + * exit: + * if carriedLoopIterator condition ConstantTerminalIteratorValue goto header + * successor: + * </listing> + * ie. lots of constant fields so we can calculate the number of + * loop iterations (handy for pre-scheduling). + * + * @return Whether this a countable loop or not + */ + public boolean isCountableLoop() { + return (initialIteratorValue != null) && + isConstant(initialIteratorValue) && + (terminalIteratorValue != null) && + isConstant(terminalIteratorValue) && + (strideValue != null) && + isConstant(strideValue) && + (iteratorInstr != null) && + ((iteratorInstr instanceof IntAdd) || (iteratorInstr instanceof IntSub)); + } + + /** + * Is this an affine loop of the form: + * <listing> + * predecessor: + * initialLoopIterator = ...; + * header: + * phiLoopIterator = phi (initialLoopIterator, carriedLoopIterator) + * ...body1... + * carriedLoopIterator = phiLoopIterator (+|-) invariantStride; + * ...body2... + * exit: + * if carriedLoopIterator condition invariantTerminalIteratorValue goto header + * successor: + * </listing> + * ie. lots of constant fields so we can calculate the number of + * loop iterations (handy for pre-scheduling). + * + * @return Whether this an affine loop or not + */ + public boolean isAffineLoop() { + return (initialIteratorValue != null) && + isLoopInvariant(ir, initialIteratorValue, loop, header) && + (terminalIteratorValue != null) && + isLoopInvariant(ir, terminalIteratorValue, loop, header) && + (strideValue != null) && + isLoopInvariant(ir, strideValue, loop, header) && + (iteratorInstr != null) && + ((iteratorInstr instanceof IntAdd) || (iteratorInstr instanceof IntSub)); + } + + /** + * Is this loop a non-regular loop? + * + * @return Whether this is a non-regular loop + */ + public boolean isNonRegularLoop() { + return !isAffineLoop(); + } + + /** + * Is this value modified by the loop? + * + * @return whether the value is modified + */ + public boolean isInvariant(Operand op) { + return isLoopInvariant(ir, op, loop, header); + } + + /** + * Is this operand related to the iterator of this loop? + * + * @param op Operand to test + * @return whether related to iterator (initial, phi or carried) + */ + public boolean isRelatedToIterator(Operand op) { + return isFixedDistanceFromPhiIterator(op); + } + + /** + * Is this operand related to the phi iterator of this loop? + * @param op Operand to test + * @return whether related to iterator (phi) + */ + public boolean isPhiLoopIterator(Operand op) { + return op.similar(phiLoopIterator); + } + + /** + * Is this operand related to the carried iterator of this loop? + * @param op Operand to test + * @return whether related to iterator (carried) + */ + public boolean isCarriedLoopIterator(Operand op) { + return op.similar(carriedLoopIterator); + } + + /** + * Is the loop iterator monotonic? + */ + public boolean isMonotonic() { + return isConstant(strideValue); + } + + /** + * Return the stride value for monotonic loops + * + * @return the constant stride value + */ + public int getMonotonicStrideValue() { + if (iteratorInstr instanceof IntSub) { + return -((IntConstantOperand) strideValue).value; + } else if (iteratorInstr instanceof IntAdd) { + return ((IntConstantOperand) strideValue).value; + } else { + throw new Error("Error reading stride value"); + } + } + + /** + * Is the loop iterator a monotonic increasing value + */ + public boolean isMonotonicIncreasing() { + if ((!isMonotonic()) || + condition.isGREATER() || + condition.isGREATER_EQUAL() || + condition.isHIGHER() || + condition.isHIGHER_EQUAL()) { + return false; + } else { + return getMonotonicStrideValue() > 0; + } + } + + /** + * Is the loop iterator a monotonic decreasing value + */ + public boolean isMonotonicDecreasing() { + if ((!isMonotonic()) || + condition.isLESS() || + condition.isLESS_EQUAL() || + condition.isLOWER() || + condition.isLOWER_EQUAL()) { + return false; + } else { + return getMonotonicStrideValue() < 0; + } + } + + /** + * Does this basic block appear in the loop? + */ + public boolean contains(BasicBlock block) { + return (block.getNumber() < loop.length()) && loop.get(block.getNumber()); + } + + // -oO Utility methods Oo- + /** + * Converts the annotated loop to a concise string + */ + public String toString() { + String ifCmpString = "??"; + if ((ifCmpInstr != null) && (ifCmpInstr instanceof IfCmp)) { + ifCmpString = ((IfCmp)ifCmpInstr).getCond().toString(); + } + return ("// pred: " + + predecessor + + "\n" + + "loop : " + + initialIteratorValue + + ";\n" + + "head {" + + header + + "}:\n" + + " " + + phiLoopIterator + + "=phi(" + + initialIteratorValue + + "," + + carriedLoopIterator + + ");\n" + + " " + + carriedLoopIterator + + "=" + + phiLoopIterator + + "+" + + strideValue + + ";\n" + + "// blocks: " + + loop + + "\n" + + "exit {" + + exit + + "}:\n" + + " if(" + + carriedLoopIterator + + " " + + ifCmpString + + " " + + terminalIteratorValue + + ")\n" + + " goto head;\n" + + "// succ: " + + successor + + "\n"); + } + + /** + * Dump a human readable descriptio... [truncated message content] |
From: <bti...@us...> - 2009-05-18 21:30:26
|
Revision: 8368 http://x10.svn.sourceforge.net/x10/?rev=8368&view=rev Author: btibbitts Date: 2009-05-18 21:30:18 +0000 (Mon, 18 May 2009) Log Message: ----------- update eclipse plugin version # Modified Paths: -------------- trunk/x10.common.17/META-INF/MANIFEST.MF trunk/x10.compiler.p3/META-INF/MANIFEST.MF Modified: trunk/x10.common.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.common.17/META-INF/MANIFEST.MF 2009-05-18 21:22:24 UTC (rev 8367) +++ trunk/x10.common.17/META-INF/MANIFEST.MF 2009-05-18 21:30:18 UTC (rev 8368) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: 17 Bundle-SymbolicName: x10.common.17 -Bundle-Version: 1.7.3.1 +Bundle-Version: 1.7.3.2 Export-Package: x10.config Modified: trunk/x10.compiler.p3/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler.p3/META-INF/MANIFEST.MF 2009-05-18 21:22:24 UTC (rev 8367) +++ trunk/x10.compiler.p3/META-INF/MANIFEST.MF 2009-05-18 21:30:18 UTC (rev 8368) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 compiler Bundle-SymbolicName: x10.compiler.p3 -Bundle-Version: 1.7.3.1 +Bundle-Version: 1.7.3.2 Bundle-Localization: plugin Require-Bundle: x10.runtime.17, x10.common.17, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bti...@us...> - 2009-05-18 21:31:12
|
Revision: 8369 http://x10.svn.sourceforge.net/x10/?rev=8369&view=rev Author: btibbitts Date: 2009-05-18 21:31:04 +0000 (Mon, 18 May 2009) Log Message: ----------- update eclipse plugin version # Modified Paths: -------------- trunk/x10.constraints/META-INF/MANIFEST.MF trunk/x10.runtime.17/META-INF/MANIFEST.MF Modified: trunk/x10.constraints/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.constraints/META-INF/MANIFEST.MF 2009-05-18 21:30:18 UTC (rev 8368) +++ trunk/x10.constraints/META-INF/MANIFEST.MF 2009-05-18 21:31:04 UTC (rev 8369) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: Constraints Bundle-SymbolicName: x10.constraints -Bundle-Version: 1.7.3.1 +Bundle-Version: 1.7.3.2 Export-Package: x10.constraint Modified: trunk/x10.runtime.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime.17/META-INF/MANIFEST.MF 2009-05-18 21:30:18 UTC (rev 8368) +++ trunk/x10.runtime.17/META-INF/MANIFEST.MF 2009-05-18 21:31:04 UTC (rev 8369) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 runtime Bundle-SymbolicName: x10.runtime.17 -Bundle-Version: 1.7.3.1 +Bundle-Version: 1.7.3.2 Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... Require-Bundle: x10.common.17, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2009-05-22 12:57:07
|
Revision: 8403 http://x10.svn.sourceforge.net/x10/?rev=8403&view=rev Author: sparksparkspark Date: 2009-05-22 12:56:58 +0000 (Fri, 22 May 2009) Log Message: ----------- can now run ant with -DNO_CHECKS=true to avoid NPE and BPE checks Second attempt at yesterday's fine-tuning of class_cast generation. Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime.17/build.xml trunk/x10.runtime.17/src-cpp/Makefile Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-21 23:29:07 UTC (rev 8402) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-22 12:56:58 UTC (rev 8403) @@ -2251,15 +2251,22 @@ if (tn instanceof X10CanonicalTypeNode) { X10CanonicalTypeNode xtn = (X10CanonicalTypeNode) tn; - Type t = X10TypeMixin.baseType(xtn.type()); + Type t = X10TypeMixin.baseType(xtn.type()); + Type f = X10TypeMixin.baseType(c.expr().type()); - X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); + Type t_ = X10TypeMixin.stripConstraints(t); + Type f_ = X10TypeMixin.stripConstraints(f); - if (false || xts.typeDeepBaseEquals(t,c.expr().type())) { + X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); + + + if (xts.typeEquals(f_, t_)) { + c.printSubExpr(c.expr(), true, sw, tr); + } else if (c.conversionType()==X10Cast_c.ConversionType.SUBTYPE && xts.isSubtype(f_, t_)) { c.printSubExpr(c.expr(), true, sw, tr); } else { sw.write("x10aux::class_cast<"); - emitter.printType(t, sw); + emitter.printType(t_, sw); sw.write(" >("); c.printSubExpr(c.expr(), true, sw, tr); sw.write(")"); Modified: trunk/x10.runtime.17/build.xml =================================================================== --- trunk/x10.runtime.17/build.xml 2009-05-21 23:29:07 UTC (rev 8402) +++ trunk/x10.runtime.17/build.xml 2009-05-22 12:56:58 UTC (rev 8403) @@ -14,8 +14,9 @@ <property name="bdwgc.dir" location="${basedir}/src-cpp/bdwgc"/> <property name="make.exe" value="make"/> <property name="bash.exe" value="bash"/> - <property name="optimize" value="false" /> + <property name="optimize" value="true" /> <property name="DISABLE_GC" value="false" /> + <property name="NO_CHECKS" value="false" /> <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="x10.constraints.classpath"/> @@ -72,6 +73,9 @@ <condition property="cppmake.optimize" value="OPTIMIZE=1" else="DEBUG=1"> <istrue value="${optimize}" /> </condition> + <condition property="cppmake.no_checks" value="NO_CHECKS=1" else="CHECKS=1"> + <istrue value="${NO_CHECKS}" /> + </condition> <condition property="x10c.optimize" value="-O" else=""> <istrue value="${optimize}" /> </condition> @@ -110,6 +114,7 @@ <arg value="install" /> <arg value="${cppmake.gcarg}" /> <arg value="${cppmake.optimize}" /> + <arg value="${cppmake.no_checks}" /> </exec> </target> <target name="dist" depends="dist-java,dist-cpp" description="generate part of the distribution"> @@ -196,6 +201,7 @@ <arg value="-j${available.procs}" /> <arg value="${cppmake.gcarg}" /> <arg value="${cppmake.optimize}" /> + <arg value="${cppmake.no_checks}" /> </exec> </target> Modified: trunk/x10.runtime.17/src-cpp/Makefile =================================================================== --- trunk/x10.runtime.17/src-cpp/Makefile 2009-05-21 23:29:07 UTC (rev 8402) +++ trunk/x10.runtime.17/src-cpp/Makefile 2009-05-22 12:56:58 UTC (rev 8403) @@ -28,6 +28,11 @@ X10CPPFLAGS += -optimize endif +ifdef NO_CHECKS + CXXFLAGS += -DNDEBUG -DNO_CHECKS + CFLAGS += -DNDEBUG -DNO_CHECKS +endif + ifdef ENABLE_CUDA CXXFLAGS += -DX10_USE_CUDA_HOST INCLUDE_DIRS += -I/usr/local/cuda/include This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-05-23 02:03:34
|
Revision: 8409 http://x10.svn.sourceforge.net/x10/?rev=8409&view=rev Author: dgrove-oss Date: 2009-05-23 02:02:52 +0000 (Sat, 23 May 2009) Log Message: ----------- Move the static field holding the RTT of type T from T::RTT::it to T::rtt. This is basically a no-op in terms of how things work, but is a useful step to prepare to switch from the current scheme (each type declares it's own subclass of the RTT class) to the new scheme (each type creates an instance of the sole RTT class). Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h trunk/x10.runtime.17/src-cpp/x10/io/IOException.h trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h trunk/x10.runtime.17/src-cpp/x10/lang/Box.h trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h trunk/x10.runtime.17/src-cpp/x10/lang/Error.h trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h trunk/x10.runtime.17/src-cpp/x10/lang/Object.h trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h trunk/x10.runtime.17/src-cpp/x10/lang/String.h trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h trunk/x10.runtime.17/src-cpp/x10/lang/Value.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h trunk/x10.runtime.17/src-cpp/x10/runtime/InterruptedException.h trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.h trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.h trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicInteger.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicLong.h trunk/x10.runtime.17/src-cpp/x10aux/RTT.h trunk/x10.runtime.17/src-cpp/x10aux/pgas.cc Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-05-23 02:02:52 UTC (rev 8409) @@ -100,7 +100,7 @@ "x10_boolean", "x10_byte", "x10_char", "x10_short", "x10_int", "x10_long", "x10_float", "x10_double", // X10 implementation names - "FMGL", "TYPENAME", "RTT", "DEFINE_RTT", "DEFINE_SPECIAL_RTT", + "FMGL", "TYPENAME", "RTT", "rtt", "DEFINE_RTT", "DEFINE_SPECIAL_RTT", // Additionally, anything starting with a '_' is reserved, and may clash }; private static boolean isCPPKeyword(String name) { @@ -546,7 +546,6 @@ int num_parents = 1 + ct.interfaces().size(); h.write("class RTT : public x10aux::RuntimeType {"); h.newline(4); h.begin(0); h.write("public:"); h.newline(); - h.write("static RTT * const it;"); h.newline(); h.write("virtual void init() {"); h.newline(4); h.begin(0); h.write("initParents("+num_parents); h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); @@ -579,6 +578,7 @@ } h.write("}"); h.end(); h.newline(); h.write("};"); h.newline(); + h.write("static RTT * const rtt;"); h.newline(); h.write("virtual const x10aux::RuntimeType *_type () const {"); h.newline(4); h.begin(0); h.write("return x10aux::getRTT"+chevrons(translateType(ct))+"();"); h.end(); h.newline(); h.write("}"); h.newline(); h.forceNewline(); @@ -588,7 +588,7 @@ h.write("DEFINE_RTT("+translateType(ct)+");"); } else { printTemplateSignature(ct.typeArguments(), h); - h.write("typename "+translateType(ct)+"::RTT * const "+translateType(ct)+"::RTT::it = "); + h.write("typename "+translateType(ct)+"::RTT * const "+translateType(ct)+"::rtt = "); h.newline(4); h.write("new (x10aux::alloc<typename "+translateType(ct)+"::RTT>()) "+ "typename "+translateType(ct)+"::RTT();"); Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-05-23 02:02:52 UTC (rev 8409) @@ -2841,7 +2841,7 @@ inc.write("const x10aux::RuntimeType *_type() const {"+ " return x10aux::getRTT<"+superType+" >(); }"); inc.newline(); - inc.write("struct RTT { static x10aux::RuntimeType * it; };"); + inc.write("static x10aux::RuntimeType * rtt;"); inc.newline(); inc.forceNewline(); inc.write(emitter.translateType(xts.String(), true)+" toString() {"); @@ -2855,7 +2855,7 @@ if (in_template_closure) emitter.printTemplateSignature(freeTypeParams, inc); - inc.write("x10aux::RuntimeType * "+cnamet+"::RTT::it = const_cast<x10aux::RuntimeType *>(x10aux::getRTT<"+superType+" >());"); + inc.write("x10aux::RuntimeType * "+cnamet+"::rtt = const_cast<x10aux::RuntimeType *>(x10aux::getRTT<"+superType+" >());"); inc.newline(); inc.forceNewline(); if (in_template_closure) Modified: trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<IOException>()); } virtual const char *name() const { return "x10.io.EOFException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<EOFException>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -12,10 +12,8 @@ public NativeInputStream { public: - class RTT : public x10aux::RuntimeType { - public: - static RTT* const it; - + class RTT : public x10aux::RuntimeType { + public: virtual void init() { initParents(1,x10aux::getRTT<NativeInputStream>()); } @@ -25,6 +23,7 @@ } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<FileInputStream>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,12 +14,13 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<IOException>()); } virtual const char *name() const { return "x10.io.FileNotFoundException"; } }; + static RTT* const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<FileNotFoundException>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,8 +14,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<NativeOutputStream>()); } @@ -25,6 +23,8 @@ } }; + static RTT* const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<FileOutputStream>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/IOException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,14 +14,13 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::Exception>()); } virtual const char *name() const { return "x10.io.IOException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<IOException>(); Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -19,8 +19,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::Ref>()); } @@ -30,6 +28,8 @@ } }; + static RTT* const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<NativeFile>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -15,8 +15,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::Value>()); } @@ -26,6 +24,8 @@ } }; + static RTT* const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<NativeInputStream>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -16,8 +16,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::Value>()); } @@ -27,6 +25,8 @@ } }; + static RTT* const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<NativeOutputStream>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} virtual const char *name() const {return "x10.lang.ArrayIndexOutOfBoundsException";} }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<ArrayIndexOutOfBoundsException>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} virtual const char *name() const { return "x10.lang.BadPlaceException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<BadPlaceException>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Box.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -22,7 +22,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT *it; virtual void init() { initParents(1,x10aux::getRTT<Ref>()); } @@ -33,6 +32,7 @@ } }; + static RTT *rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Box<T> >(); @@ -61,7 +61,7 @@ }; - template<class T> typename Box<T>::RTT *Box<T>::RTT::it = + template<class T> typename Box<T>::RTT *Box<T>::rtt = new (x10aux::alloc<typename Box<T>::RTT>()) typename Box<T>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} virtual const char *name() const { return "x10.lang.ClassCastException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<ClassCastException>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Error.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -15,10 +15,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Throwable>()); } virtual const char *name() const { return "x10.lang.Error"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Error>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -15,10 +15,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Throwable>()); } virtual const char *name() const { return "x10.lang.Exception"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Exception>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -19,6 +18,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_0<R> >(); } @@ -26,7 +26,7 @@ virtual ~Fun_0_0() { } virtual R apply() = 0; }; - template<class R> typename Fun_0_0<R>::RTT * const Fun_0_0<R>::RTT::it = + template<class R> typename Fun_0_0<R>::RTT * const Fun_0_0<R>::rtt = new (x10aux::alloc<typename Fun_0_0<R>::RTT>()) typename Fun_0_0<R>::RTT(); } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -21,6 +20,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_1<P1,R> >(); } @@ -28,7 +28,7 @@ virtual ~Fun_0_1() { } virtual R apply(P1 p1) = 0; }; - template<class P1, class R> typename Fun_0_1<P1,R>::RTT * const Fun_0_1<P1,R>::RTT::it = + template<class P1, class R> typename Fun_0_1<P1,R>::RTT * const Fun_0_1<P1,R>::rtt = new (x10aux::alloc<typename Fun_0_1<P1,R>::RTT>()) typename Fun_0_1<P1,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -22,6 +21,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_2<P1,P2,R> >(); } @@ -30,7 +30,7 @@ virtual R apply(P1 p1, P2 p2) = 0; }; template<class P1, class P2, class R> - typename Fun_0_2<P1,P2,R>::RTT * const Fun_0_2<P1,P2,R>::RTT::it = + typename Fun_0_2<P1,P2,R>::RTT * const Fun_0_2<P1,P2,R>::rtt = new (x10aux::alloc<typename Fun_0_2<P1,P2,R>::RTT>()) typename Fun_0_2<P1,P2,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -23,6 +22,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_3<P1,P2,P3,R> >(); } @@ -31,7 +31,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3) = 0; }; template<class P1, class P2, class P3, class R> - typename Fun_0_3<P1,P2,P3,R>::RTT * const Fun_0_3<P1,P2,P3,R>::RTT::it = + typename Fun_0_3<P1,P2,P3,R>::RTT * const Fun_0_3<P1,P2,P3,R>::rtt = new (x10aux::alloc<typename Fun_0_3<P1,P2,P3,R>::RTT>()) typename Fun_0_3<P1,P2,P3,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -24,6 +23,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_4<P1,P2,P3,P4,R> >(); } @@ -32,7 +32,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4) = 0; }; template<class P1, class P2, class P3, class P4, class R> - typename Fun_0_4<P1,P2,P3,P4,R>::RTT * const Fun_0_4<P1,P2,P3,P4,R>::RTT::it = + typename Fun_0_4<P1,P2,P3,P4,R>::RTT * const Fun_0_4<P1,P2,P3,P4,R>::rtt = new (x10aux::alloc<typename Fun_0_4<P1,P2,P3,P4,R>::RTT>()) typename Fun_0_4<P1,P2,P3,P4,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -25,6 +24,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_5<P1,P2,P3,P4,P5,R> >(); } @@ -33,7 +33,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class R> - typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT * const Fun_0_5<P1,P2,P3,P4,P5,R>::RTT::it = + typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT * const Fun_0_5<P1,P2,P3,P4,P5,R>::rtt = new (x10aux::alloc<typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT>()) typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,7 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; + static RTT * const rtt; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -34,7 +34,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class R> - typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT * const Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT::it = + typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT * const Fun_0_6<P1,P2,P3,P4,P5,P6,R>::rtt = new (x10aux::alloc<typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT>()) typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -27,6 +26,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R> >(); } @@ -35,7 +35,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R> - typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT * const Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT::it = + typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT * const Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::rtt = new (x10aux::alloc<typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT>()) typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -28,6 +27,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R> >(); } @@ -36,7 +36,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class R> - typename Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::RTT * const Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::RTT::it = + typename Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::RTT * const Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::rtt = new (x10aux::alloc<typename Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::RTT>()) typename Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -29,6 +28,8 @@ return name; } }; + static RTT * const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R> >(); } @@ -37,7 +38,7 @@ virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class R> - typename Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::RTT * const Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::RTT::it = + typename Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::RTT * const Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::rtt = new (x10aux::alloc<typename Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::RTT>()) typename Fun_0_9<P1,P2,P3,P4,P5,P6,P7,P8,P9,R>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -20,13 +19,14 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Iterable<T> >(); } virtual x10aux::ref<Iterator<T > > iterator() = 0; }; - template<class T> typename Iterable<T>::RTT * const Iterable<T>::RTT::it = + template<class T> typename Iterable<T>::RTT * const Iterable<T>::rtt = new (x10aux::alloc<typename Iterable<T>::RTT>()) typename Iterable<T>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -20,8 +20,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT* it; - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } @@ -34,6 +32,8 @@ } }; + static RTT* rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Iterator<T> >(); @@ -46,7 +46,7 @@ }; template<class T> - typename Iterator<T>::RTT *Iterator<T>::RTT::it = + typename Iterator<T>::RTT *Iterator<T>::rtt = new (x10aux::alloc<typename Iterator<T>::RTT>()) typename Iterator<T>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} virtual const char *name() const { return "x10.lang.NullPointerException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<NullPointerException>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Object.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Object.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Object.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -26,15 +26,13 @@ class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(0); } virtual const char *name() const { return "x10.lang.Object"; } - }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Object>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<x10::lang::Error>());} virtual const char *name() const { return "x10.lang.OutOfMemoryError"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<OutOfMemoryError>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -26,7 +26,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(3,x10aux::getRTT<Ref>(), x10aux::getRTT<Settable<x10_int,T> >(), @@ -40,6 +39,7 @@ } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Rail<T> >(); @@ -68,7 +68,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(2,x10aux::getRTT<Ref>(), @@ -83,6 +82,7 @@ } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Iterator>(); } @@ -157,10 +157,10 @@ }; - template<class T> typename Rail<T>::RTT * const Rail<T>::RTT::it = + template<class T> typename Rail<T>::RTT * const Rail<T>::rtt = new (x10aux::alloc<typename Rail<T>::RTT>()) typename Rail<T>::RTT(); - template<class T> typename Rail<T>::Iterator::RTT * const Rail<T>::Iterator::RTT::it = + template<class T> typename Rail<T>::Iterator::RTT * const Rail<T>::Iterator::rtt = new (x10aux::alloc<typename Rail<T>::Iterator::RTT>()) typename Rail<T>::Iterator::RTT(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -18,8 +18,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } @@ -29,6 +27,7 @@ } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Ref>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -14,10 +14,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Exception>()); } virtual const char *name() const { return "x10.lang.RuntimeException"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<RuntimeException>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -21,13 +20,14 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Settable<I, V> >(); } virtual V set(V v, I i) = 0; }; - template<class I, class V> typename Settable<I, V>::RTT * const Settable<I, V>::RTT::it = + template<class I, class V> typename Settable<I, V>::RTT * const Settable<I, V>::rtt = new (x10aux::alloc<typename Settable<I, V>::RTT>()) typename Settable<I, V>::RTT(); } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/String.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/String.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/String.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -29,10 +29,10 @@ class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Value>()); } virtual const char *name() const { return "x10.lang.String"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<String>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -30,10 +30,10 @@ class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Value>()); } virtual const char *name() const { return "x10.lang.Throwable"; } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Throwable>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -27,7 +27,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(3,x10aux::getRTT<Value>(), x10aux::getRTT<Fun_0_1<x10_int,T> >(), @@ -40,6 +39,7 @@ } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<ValRail<T> >(); @@ -70,8 +70,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT * const it; - virtual void init() { initParents(2,x10aux::getRTT<x10::lang::Iterator<T> >(), x10aux::getRTT<Ref>()); @@ -85,6 +83,8 @@ } }; + static RTT * const rtt; + virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Iterator>(); } @@ -230,11 +230,11 @@ x10aux::DeserializationDispatcher ::addDeserializer(ValRail<T>::template _deserialize<Object>); - template<class T> typename ValRail<T>::RTT * const ValRail<T>::RTT::it = + template<class T> typename ValRail<T>::RTT * const ValRail<T>::rtt = new (x10aux::alloc<typename ValRail<T>::RTT>()) typename ValRail<T>::RTT(); template<class T> typename ValRail<T>::Iterator::RTT * const - ValRail<T>::Iterator::RTT::it = + ValRail<T>::Iterator::rtt = new (x10aux::alloc<typename ValRail<T>::Iterator::RTT>()) typename ValRail<T>::Iterator::RTT(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Value.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Value.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Value.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -18,7 +18,6 @@ class RTT : public x10aux::RuntimeType { public: - static RTT* const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } @@ -27,6 +26,7 @@ } }; + static RTT* const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<Value>(); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -13,10 +13,10 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { return "x10.lang.VoidFun"; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_0>(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -20,6 +19,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_1<P1> >(); } @@ -27,7 +27,7 @@ virtual ~VoidFun_0_1() { } virtual void apply(P1 p1) = 0; }; - template<class P1> typename VoidFun_0_1<P1>::RTT * const VoidFun_0_1<P1>::RTT::it = + template<class P1> typename VoidFun_0_1<P1>::RTT * const VoidFun_0_1<P1>::rtt = new (x10aux::alloc<typename VoidFun_0_1<P1>::RTT>()) typename VoidFun_0_1<P1>::RTT(); } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -21,6 +20,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_2<P1,P2> >(); } @@ -28,7 +28,7 @@ virtual ~VoidFun_0_2() { } virtual void apply(P1 p1, P2 p2) = 0; }; - template<class P1, class P2> typename VoidFun_0_2<P1,P2>::RTT * const VoidFun_0_2<P1,P2>::RTT::it = + template<class P1, class P2> typename VoidFun_0_2<P1,P2>::RTT * const VoidFun_0_2<P1,P2>::rtt = new (x10aux::alloc<typename VoidFun_0_2<P1,P2>::RTT>()) typename VoidFun_0_2<P1,P2>::RTT(); } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -22,6 +21,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_3<P1,P2,P3> >(); } @@ -29,7 +29,7 @@ virtual ~VoidFun_0_3() { } virtual void apply(P1 p1, P2 p2, P3 p3) = 0; }; - template<class P1, class P2, class P3> typename VoidFun_0_3<P1,P2,P3>::RTT * const VoidFun_0_3<P1,P2,P3>::RTT::it = + template<class P1, class P2, class P3> typename VoidFun_0_3<P1,P2,P3>::RTT * const VoidFun_0_3<P1,P2,P3>::rtt = new (x10aux::alloc<typename VoidFun_0_3<P1,P2,P3>::RTT>()) typename VoidFun_0_3<P1,P2,P3>::RTT(); } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -23,6 +22,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_4<P1,P2,P3,P4> >(); } @@ -31,7 +31,7 @@ virtual void apply(P1 p1, P2 p2, P3 p3, P4 p4) = 0; }; template<class P1, class P2, class P3, class P4> - typename VoidFun_0_4<P1,P2,P3,P4>::RTT * const VoidFun_0_4<P1,P2,P3,P4>::RTT::it = + typename VoidFun_0_4<P1,P2,P3,P4>::RTT * const VoidFun_0_4<P1,P2,P3,P4>::rtt = new (x10aux::alloc<typename VoidFun_0_4<P1,P2,P3,P4>::RTT>()) typename VoidFun_0_4<P1,P2,P3,P4>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -24,6 +23,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_5<P1,P2,P3,P4,P5> >(); } @@ -32,7 +32,7 @@ virtual void apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) = 0; }; template<class P1, class P2, class P3, class P4, class P5> - typename VoidFun_0_5<P1,P2,P3,P4,P5>::RTT * const VoidFun_0_5<P1,P2,P3,P4,P5>::RTT::it = + typename VoidFun_0_5<P1,P2,P3,P4,P5>::RTT * const VoidFun_0_5<P1,P2,P3,P4,P5>::rtt = new (x10aux::alloc<typename VoidFun_0_5<P1,P2,P3,P4,P5>::RTT>()) typename VoidFun_0_5<P1,P2,P3,P4,P5>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -25,6 +24,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_6<P1,P2,P3,P4,P5,P6> >(); } @@ -33,7 +33,7 @@ virtual void apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6> - typename VoidFun_0_6<P1,P2,P3,P4,P5,P6>::RTT * const VoidFun_0_6<P1,P2,P3,P4,P5,P6>::RTT::it = + typename VoidFun_0_6<P1,P2,P3,P4,P5,P6>::RTT * const VoidFun_0_6<P1,P2,P3,P4,P5,P6>::rtt = new (x10aux::alloc<typename VoidFun_0_6<P1,P2,P3,P4,P5,P6>::RTT>()) typename VoidFun_0_6<P1,P2,P3,P4,P5,P6>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -26,6 +25,7 @@ return name; } }; + static RTT * const rtt; virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7> >(); } @@ -34,7 +34,7 @@ virtual void apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7> - typename VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::RTT * const VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::RTT::it = + typename VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::RTT * const VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::rtt = new (x10aux::alloc<typename VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::RTT>()) typename VoidFun_0_7<P1,P2,P3,P4,P5,P6,P7>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,7 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; + static RTT * const rtt; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -35,7 +35,7 @@ virtual void apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> - typename VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::RTT * const VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::RTT::it = + typename VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::RTT * const VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::rtt = new (x10aux::alloc<typename VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::RTT>()) typename VoidFun_0_8<P1,P2,P3,P4,P5,P6,P7,P8>::RTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h 2009-05-22 21:26:46 UTC (rev 8408) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h 2009-05-23 02:02:52 UTC (rev 8409) @@ -11,7 +11,6 @@ public: class RTT : public x10aux::RuntimeType { public: - static RTT * const it; virtual void init() { initParents(1,x10aux::getRTT<Object>()); } virtual const char *name() const { static const char *name = @@ -28,6 +27,7 @@ ... [truncated message content] |
From: <bti...@us...> - 2009-05-28 12:48:20
|
Revision: 8424 http://x10.svn.sourceforge.net/x10/?rev=8424&view=rev Author: btibbitts Date: 2009-05-28 12:19:01 +0000 (Thu, 28 May 2009) Log Message: ----------- bump version for 1.7.4 Modified Paths: -------------- trunk/x10.common.17/META-INF/MANIFEST.MF trunk/x10.constraints/META-INF/MANIFEST.MF trunk/x10.runtime.17/META-INF/MANIFEST.MF Modified: trunk/x10.common.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.common.17/META-INF/MANIFEST.MF 2009-05-28 12:18:22 UTC (rev 8423) +++ trunk/x10.common.17/META-INF/MANIFEST.MF 2009-05-28 12:19:01 UTC (rev 8424) @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: 17 +Bundle-Name: Common Bundle-SymbolicName: x10.common.17 -Bundle-Version: 1.7.3.2 +Bundle-Version: 1.7.4.0 Export-Package: x10.config Modified: trunk/x10.constraints/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.constraints/META-INF/MANIFEST.MF 2009-05-28 12:18:22 UTC (rev 8423) +++ trunk/x10.constraints/META-INF/MANIFEST.MF 2009-05-28 12:19:01 UTC (rev 8424) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: Constraints Bundle-SymbolicName: x10.constraints -Bundle-Version: 1.7.3.2 +Bundle-Version: 1.7.4.0 Export-Package: x10.constraint Modified: trunk/x10.runtime.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime.17/META-INF/MANIFEST.MF 2009-05-28 12:18:22 UTC (rev 8423) +++ trunk/x10.runtime.17/META-INF/MANIFEST.MF 2009-05-28 12:19:01 UTC (rev 8424) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 runtime Bundle-SymbolicName: x10.runtime.17 -Bundle-Version: 1.7.3.2 +Bundle-Version: 1.7.4.0 Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... Require-Bundle: x10.common.17, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-05-28 16:20:28
|
Revision: 8425 http://x10.svn.sourceforge.net/x10/?rev=8425&view=rev Author: dgrove-oss Date: 2009-05-28 16:20:18 +0000 (Thu, 28 May 2009) Log Message: ----------- WIP XTENLANG-401 : C++ codesize reduction Change generated RTT code such that instead of defining a subclass of x10aux::RuntimeType for every class and then creating an instance of it, we instead just create an instance of x10aux::RuntimeType. This change reduces the size of libx10lib17.a from 140MB to 85MB on my machine and reduces executable size for typical small X10 programs by 20-25% (both stripped and unstripped sizes). Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc trunk/x10.runtime.17/src-cpp/x10/io/IOException.h trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h trunk/x10.runtime.17/src-cpp/x10/lang/Box.h trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc trunk/x10.runtime.17/src-cpp/x10/lang/Error.h trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h trunk/x10.runtime.17/src-cpp/x10/lang/Object.cc trunk/x10.runtime.17/src-cpp/x10/lang/Object.h trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.cc trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h trunk/x10.runtime.17/src-cpp/x10/lang/Ref.cc trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.cc trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h trunk/x10.runtime.17/src-cpp/x10/lang/String.cc trunk/x10.runtime.17/src-cpp/x10/lang/String.h trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h trunk/x10.runtime.17/src-cpp/x10/lang/Value.cc trunk/x10.runtime.17/src-cpp/x10/lang/Value.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.cc trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_0.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h trunk/x10.runtime.17/src-cpp/x10/runtime/InterruptedException.cc trunk/x10.runtime.17/src-cpp/x10/runtime/InterruptedException.h trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.h trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.h trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicInteger.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicInteger.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicLong.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicLong.h trunk/x10.runtime.17/src-cpp/x10aux/RTT.cc trunk/x10.runtime.17/src-cpp/x10aux/RTT.h trunk/x10.runtime.17/src-cpp/x10aux/iterator_utils.h trunk/x10.runtime.17/src-cpp/x10aux/pgas.cc trunk/x10.runtime.17/src-cpp/x10aux/pgas.h trunk/x10.runtime.17/src-cpp/x10aux/ref.h Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-05-28 16:20:18 UTC (rev 8425) @@ -100,7 +100,7 @@ "x10_boolean", "x10_byte", "x10_char", "x10_short", "x10_int", "x10_long", "x10_float", "x10_double", // X10 implementation names - "FMGL", "TYPENAME", "RTT", "rtt", "DEFINE_RTT", "DEFINE_SPECIAL_RTT", + "FMGL", "TYPENAME", "getRTT", "rtt", "RTT_H_DECLS", "RTT_CC_DECLS1", // Additionally, anything starting with a '_' is reserved, and may clash }; private static boolean isCPPKeyword(String name) { @@ -540,7 +540,8 @@ printTemplateSignature(((X10ClassType)cd.asType()).typeArguments(), h); } - void printRTT(X10ClassType ct, ClassifiedStream h) { + + void printRTTOriginal(X10ClassType ct, ClassifiedStream h) { X10TypeSystem_c xts = (X10TypeSystem_c) ct.typeSystem(); String x10name = ct.fullName().toString(); int num_parents = 1 + ct.interfaces().size(); @@ -583,8 +584,66 @@ h.write("return x10aux::getRTT"+chevrons(translateType(ct))+"();"); h.end(); h.newline(); h.write("}"); h.newline(); h.forceNewline(); } - void printRTTDefn(X10ClassType ct, CodeWriter h) { + + void printRTT(X10ClassType ct, ClassifiedStream h) { + X10TypeSystem_c xts = (X10TypeSystem_c) ct.typeSystem(); + String x10name = ct.fullName().toString(); + int num_parents = 1 + ct.interfaces().size(); + if (ct.typeArguments().isEmpty()) { + h.write("RTT_H_DECLS"); h.newline(); + } else { + h.write("static const x10aux::RuntimeType* rtt;"); h.newline(); + h.write("static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; }"); h.newline(); + h.write("static const x10aux::RuntimeType* _initRTT() {"); h.newline(4); h.begin(0); + h.write("const char *name ="); h.newline(4); + h.write("x10aux::alloc_printf("); h.begin(0); + h.write("\""+x10name+"["); + String comma = ""; + for (Type param : ct.typeArguments()) { + h.write(comma+"%s"); + comma = ","; + } + h.write("]\""); + for (Type param : ct.typeArguments()) { + h.write(","); h.newline(); + h.write("x10aux::getRTT"+chevrons(translateType(param))+"()->name()"); + } + h.write(");") ; h.end(); h.newline(); + h.write("const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, "+num_parents); + h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); + for (Type iface : ct.interfaces()) { + h.write(", x10aux::getRTT"+chevrons(translateType(iface))+"()"); + } + h.write(");"); h.newline(); + h.write("return x10aux::RuntimeType::installRTT(&rtt, cand);"); h.end(); h.newline(); + h.write("}"); h.newline(); + h.write("virtual const x10aux::RuntimeType *_type() const { return getRTT(); }"); h.newline(); h.forceNewline(); + } + } + + void printRTTDefn(X10ClassType ct, CodeWriter h) { if (ct.typeArguments().isEmpty()) { + X10TypeSystem_c xts = (X10TypeSystem_c) ct.typeSystem(); + int num_parents = 1 + ct.interfaces().size(); + h.write("const x10aux::RuntimeType* "+translateType(ct)+"::rtt = NULL;"); h.newline(); + h.write("const x10aux::RuntimeType* "+translateType(ct)+"::_initRTT() {"); h.newline(4); h.begin(0); + h.write("const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(\""+ct.fullName()+"\", "+num_parents); + h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); + for (Type iface : ct.interfaces()) { + h.write(", x10aux::getRTT"+chevrons(translateType(iface))+"()"); + } + h.write(");"); h.newline(); + h.write("return x10aux::RuntimeType::installRTT(&rtt, cand);"); h.end(); h.newline(); + h.write("}"); h.newline(); + } else { + printTemplateSignature(ct.typeArguments(), h); + h.write("const x10aux::RuntimeType* "+translateType(ct)+"::rtt = NULL;"); + } + h.newline(); + } + + void printRTTDefnOriginal(X10ClassType ct, CodeWriter h) { + if (ct.typeArguments().isEmpty()) { h.write("DEFINE_RTT("+translateType(ct)+");"); } else { printTemplateSignature(ct.typeArguments(), h); Modified: trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -8,8 +8,7 @@ const serialization_id_t EOFException::_serialization_id = DeserializationDispatcher::addDeserializer(EOFException::_deserializer<Object>); - - -DEFINE_RTT(EOFException); +RTT_CC_DECLS1(EOFException, "x10.io.EOFException", IOException) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,17 +12,8 @@ class EOFException : public IOException { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<IOException>()); } - virtual const char *name() const { return "x10.io.EOFException"; } - }; - static RTT* const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<EOFException>(); - } + RTT_H_DECLS; - static x10aux::ref<EOFException> _make() { return (new (x10aux::alloc<EOFException>()) EOFException()) ->_constructor(); } @@ -53,10 +44,7 @@ this_->_deserialize_body(buf); return this_; } - - }; - } } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -7,6 +7,6 @@ x10aux::ref<FileInputStream> FileInputStream::STANDARD_IN = new (x10aux::alloc<FileInputStream>()) FileInputStream(stdin); +RTT_CC_DECLS1(FileInputStream, "x10.io.FileReader.FileInputStream", NativeInputStream) -DEFINE_RTT(FileInputStream); // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,22 +12,8 @@ public NativeInputStream { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<NativeInputStream>()); - } - - virtual const char *name() const { - return "x10.io.FileReader.FileInputStream"; - } + RTT_H_DECLS; - }; - static RTT* const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<FileInputStream>(); - } - FileInputStream(FILE *f) : FILEPtrInputStream(f) { } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,5 +9,6 @@ const serialization_id_t FileNotFoundException::_serialization_id = DeserializationDispatcher::addDeserializer(FileNotFoundException::_deserializer<Object>); -DEFINE_RTT(FileNotFoundException); +RTT_CC_DECLS1(FileNotFoundException, "x10.io.FileNotFoundException", IOException) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,20 +12,8 @@ class FileNotFoundException : public IOException { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<IOException>()); - } - virtual const char *name() const { return "x10.io.FileNotFoundException"; } - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<FileNotFoundException>(); - } - - static x10aux::ref<FileNotFoundException> _make() { return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException()) ->_constructor(); @@ -62,10 +50,7 @@ this_->_deserialize_body(buf); return this_; } - - }; - } } Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -10,6 +10,6 @@ x10aux::ref<FileOutputStream> FileOutputStream::STANDARD_ERR = new (x10aux::alloc<FileOutputStream>()) FileOutputStream(stderr); +RTT_CC_DECLS1(FileOutputStream, "x10.io.FileWriter.FileOutputStream", NativeOutputStream) -DEFINE_RTT(FileOutputStream); // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,22 +12,7 @@ public x10::io::NativeOutputStream { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<NativeOutputStream>()); - } - - virtual const char *name() const { - return "x10.io.FileWriter.FileOutputStream"; - } - - }; - static RTT* const rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<FileOutputStream>(); - } + RTT_H_DECLS; FileOutputStream(FILE *f) : FILEPtrOutputStream(f) { } Modified: trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -10,6 +10,6 @@ const serialization_id_t IOException::_serialization_id = DeserializationDispatcher::addDeserializer(IOException::_deserializer<Object>); +RTT_CC_DECLS1(IOException,"x10.io.IOException",Exception) -DEFINE_RTT(IOException); // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/IOException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,20 +12,8 @@ class IOException : public x10::lang::Exception { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<x10::lang::Exception>()); - } - - virtual const char *name() const { return "x10.io.IOException"; } - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<IOException>(); - } - static x10aux::ref<IOException> _make() { return (new (x10aux::alloc<IOException>()) IOException()) ->_constructor(); } @@ -55,13 +43,9 @@ this_->_deserialize_body(buf); return this_; } - - }; - } } - #endif // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -6,5 +6,6 @@ using namespace x10::io; using namespace x10aux; -DEFINE_RTT(NativeFile); +RTT_CC_DECLS1(NativeFile, "x10.io.File.NativeFile", Ref) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -17,23 +17,8 @@ class NativeFile : public x10::lang::Ref { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<x10::lang::Ref>()); - } + RTT_H_DECLS; - virtual const char *name() const { - return "x10.io.File.NativeFile"; - } - - }; - static RTT* const rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<NativeFile>(); - } - private: x10aux::ref<x10::lang::String> name; Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -33,5 +33,6 @@ } -DEFINE_RTT(NativeInputStream); +RTT_CC_DECLS1(NativeInputStream, "x10.io.InputStreamReader.InputStream", Value) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeInputStream.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,25 +12,9 @@ namespace io { class NativeInputStream : public x10::lang::Value { - public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<x10::lang::Value>()); - } - - virtual const char *name() const { - return "x10.io.InputStreamReader.InputStream"; - } - - }; - static RTT* const rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<NativeInputStream>(); - } + public: + RTT_H_DECLS; - protected: @@ -63,7 +47,6 @@ virtual x10_boolean markSupported() { return false; } }; - } } Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -55,6 +55,6 @@ } */ +RTT_CC_DECLS1(NativeOutputStream, "x10.io.OutputStreamWriter.OutputStream", Value) -DEFINE_RTT(NativeOutputStream); // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeOutputStream.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -14,23 +14,8 @@ class NativeOutputStream : public x10::lang::Value { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { - initParents(1,x10aux::getRTT<x10::lang::Value>()); - } - - virtual const char *name() const { - return "x10.io.OutputStreamWriter.OutputStream"; - } + RTT_H_DECLS; - }; - static RTT* const rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<NativeOutputStream>(); - } - virtual void write(const char* str) = 0; public: Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,6 +9,6 @@ DeserializationDispatcher ::addDeserializer(ArrayIndexOutOfBoundsException::_deserializer<Object>); +RTT_CC_DECLS1(ArrayIndexOutOfBoundsException, "x10.lang.ArrayIndexOutOfBoundsException", RuntimeException) -DEFINE_RTT(ArrayIndexOutOfBoundsException); // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,17 +12,8 @@ class ArrayIndexOutOfBoundsException : public RuntimeException { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} - virtual const char *name() const {return "x10.lang.ArrayIndexOutOfBoundsException";} - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<ArrayIndexOutOfBoundsException>(); - } - static x10aux::ref<ArrayIndexOutOfBoundsException> _make() { return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) @@ -72,6 +63,5 @@ } } - #endif // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -8,5 +8,6 @@ const serialization_id_t BadPlaceException::_serialization_id = DeserializationDispatcher::addDeserializer(BadPlaceException::_deserializer<Object>); -DEFINE_RTT(BadPlaceException); +RTT_CC_DECLS1(BadPlaceException, "x10.lang.BadPlaceException", x10::lang::RuntimeException) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,18 +12,8 @@ class BadPlaceException : public RuntimeException { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} - virtual const char *name() const { return "x10.lang.BadPlaceException"; } - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<BadPlaceException>(); - } - - static x10aux::ref<BadPlaceException> _make() { return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException()) Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Box.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -17,26 +17,17 @@ class String; template<class T> class Box : public Ref { - - public: - - class RTT : public x10aux::RuntimeType { - public: - - virtual void init() { initParents(1,x10aux::getRTT<Ref>()); } - - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Box[%s]",x10aux::getRTT<T>()->name()); - return name; - } - - }; - static RTT *rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Box<T> >(); + public: + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Box[%s]",x10aux::getRTT<T>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Ref::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } static x10aux::ref<Box<T> > _make(T contents_) { return (new (x10aux::alloc<Box<T> >())Box<T>())->_constructor(contents_); @@ -61,9 +52,7 @@ }; - template<class T> typename Box<T>::RTT *Box<T>::rtt = - new (x10aux::alloc<typename Box<T>::RTT>()) typename Box<T>::RTT(); - + template<class T> const x10aux::RuntimeType *Box<T>::rtt = NULL; } } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -8,5 +8,6 @@ const serialization_id_t ClassCastException::_serialization_id = DeserializationDispatcher::addDeserializer(ClassCastException::_deserializer<Object>); -DEFINE_RTT(ClassCastException); +RTT_CC_DECLS1(ClassCastException, "x10.lang.ClassCastException", RuntimeException) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -12,18 +12,8 @@ class ClassCastException : public RuntimeException { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<x10::lang::RuntimeException>());} - virtual const char *name() const { return "x10.lang.ClassCastException"; } - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<ClassCastException>(); - } - - static x10aux::ref<ClassCastException> _make() { return (new (x10aux::alloc<ClassCastException>()) ClassCastException()) Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -8,5 +8,6 @@ const serialization_id_t Error::_serialization_id = DeserializationDispatcher::addDeserializer(Error::_deserializer<Object>); -DEFINE_RTT(Error); +RTT_CC_DECLS1(Error, "x10.lang.Error", Throwable) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Error.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -13,18 +13,8 @@ class Error : public Throwable { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Throwable>()); } - virtual const char *name() const { return "x10.lang.Error"; } - }; - static RTT* const rtt; - - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Error>(); - } - - + RTT_H_DECLS; + static x10aux::ref<Error> _make() { return (new (x10aux::alloc<Error>()) Error())->_constructor(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc 2009-05-28 16:20:18 UTC (rev 8425) @@ -8,5 +8,6 @@ const serialization_id_t Exception::_serialization_id = DeserializationDispatcher::addDeserializer(Exception::_deserializer<Object>); -DEFINE_RTT(Exception); +RTT_CC_DECLS1(Exception, "x10.lang.Exception", Throwable) + // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -13,18 +13,8 @@ class Exception : public Throwable { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Throwable>()); } - virtual const char *name() const { return "x10.lang.Exception"; } - }; - static RTT* const rtt; + RTT_H_DECLS; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Exception>(); - } - - static x10aux::ref<Exception> _make() { return (new (x10aux::alloc<Exception>()) Exception())->_constructor(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,25 +9,22 @@ namespace lang { template<class R> class Fun_0_0 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_0[%s]",x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_0<R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_0[%s]",x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_0() { } virtual R apply() = 0; }; - template<class R> typename Fun_0_0<R>::RTT * const Fun_0_0<R>::rtt = - new (x10aux::alloc<typename Fun_0_0<R>::RTT>()) typename Fun_0_0<R>::RTT(); + + template<class R> const x10aux::RuntimeType* Fun_0_0<R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,28 +9,24 @@ namespace lang { template<class P1, class R> class Fun_0_1 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_1[%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_1<P1,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_1[%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_1() { } virtual R apply(P1 p1) = 0; }; - template<class P1, class R> typename Fun_0_1<P1,R>::RTT * const Fun_0_1<P1,R>::rtt = - new (x10aux::alloc<typename Fun_0_1<P1,R>::RTT>()) - typename Fun_0_1<P1,R>::RTT(); + + template<class P1, class R> const x10aux::RuntimeType* Fun_0_1<P1,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,30 +9,25 @@ namespace lang { template<class P1, class P2, class R> class Fun_0_2 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_2[%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_2<P1,P2,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_2[%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_2() { }; virtual R apply(P1 p1, P2 p2) = 0; }; - template<class P1, class P2, class R> - typename Fun_0_2<P1,P2,R>::RTT * const Fun_0_2<P1,P2,R>::rtt = - new (x10aux::alloc<typename Fun_0_2<P1,P2,R>::RTT>()) - typename Fun_0_2<P1,P2,R>::RTT(); + + template<class P1, class P2, class R> const x10aux::RuntimeType* Fun_0_2<P1,P2,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,31 +9,26 @@ namespace lang { template<class P1, class P2, class P3, class R> class Fun_0_3 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_3[%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_3<P1,P2,P3,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_3[%s,%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<P3>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } - + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } + virtual ~Fun_0_3() { }; virtual R apply(P1 p1, P2 p2, P3 p3) = 0; }; - template<class P1, class P2, class P3, class R> - typename Fun_0_3<P1,P2,P3,R>::RTT * const Fun_0_3<P1,P2,P3,R>::rtt = - new (x10aux::alloc<typename Fun_0_3<P1,P2,P3,R>::RTT>()) - typename Fun_0_3<P1,P2,P3,R>::RTT(); + + template<class P1, class P2, class P3, class R> const x10aux::RuntimeType* Fun_0_3<P1,P2,P3,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,32 +9,27 @@ namespace lang { template<class P1, class P2, class P3, class P4, class R> class Fun_0_4 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_4[%s,%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<P4>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_4<P1,P2,P3,P4,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_4[%s,%s,%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<P3>()->name(), + x10aux::getRTT<P4>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_4() { }; virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4) = 0; }; template<class P1, class P2, class P3, class P4, class R> - typename Fun_0_4<P1,P2,P3,P4,R>::RTT * const Fun_0_4<P1,P2,P3,P4,R>::rtt = - new (x10aux::alloc<typename Fun_0_4<P1,P2,P3,P4,R>::RTT>()) - typename Fun_0_4<P1,P2,P3,P4,R>::RTT(); + const x10aux::RuntimeType* Fun_0_4<P1,P2,P3,P4,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,33 +9,28 @@ namespace lang { template<class P1, class P2, class P3, class P4, class P5, class R> class Fun_0_5 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_5[%s,%s,%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<P4>()->name(), - x10aux::getRTT<P5>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_5<P1,P2,P3,P4,P5,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_5[%s,%s,%s,%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<P3>()->name(), + x10aux::getRTT<P4>()->name(), + x10aux::getRTT<P5>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_5() { }; virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class R> - typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT * const Fun_0_5<P1,P2,P3,P4,P5,R>::rtt = - new (x10aux::alloc<typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT>()) - typename Fun_0_5<P1,P2,P3,P4,P5,R>::RTT(); + const x10aux::RuntimeType* Fun_0_5<P1,P2,P3,P4,P5,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,34 +9,29 @@ namespace lang { template<class P1, class P2, class P3, class P4, class P5, class P6, class R> class Fun_0_6 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - static RTT * const rtt; - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_6[%s,%s,%s,%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<P4>()->name(), - x10aux::getRTT<P5>()->name(), - x10aux::getRTT<P6>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_6<P1,P2,P3,P4,P5,P6,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_6[%s,%s,%s,%s,%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<P3>()->name(), + x10aux::getRTT<P4>()->name(), + x10aux::getRTT<P5>()->name(), + x10aux::getRTT<P6>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_6() { }; virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class R> - typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT * const Fun_0_6<P1,P2,P3,P4,P5,P6,R>::rtt = - new (x10aux::alloc<typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT>()) - typename Fun_0_6<P1,P2,P3,P4,P5,P6,R>::RTT(); + const x10aux::RuntimeType* Fun_0_6<P1,P2,P3,P4,P5,P6,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,35 +9,30 @@ namespace lang { template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R> class Fun_0_7 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_7[%s,%s,%s,%s,%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<P4>()->name(), - x10aux::getRTT<P5>()->name(), - x10aux::getRTT<P6>()->name(), - x10aux::getRTT<P7>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R> >(); + static const x10aux::RuntimeType* rtt; + static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } + static const x10aux::RuntimeType* _initRTT() { + const char *name = + x10aux::alloc_printf("x10.lang.Fun_0_7[%s,%s,%s,%s,%s,%s,%s,%s]", + x10aux::getRTT<P1>()->name(), + x10aux::getRTT<P2>()->name(), + x10aux::getRTT<P3>()->name(), + x10aux::getRTT<P4>()->name(), + x10aux::getRTT<P5>()->name(), + x10aux::getRTT<P6>()->name(), + x10aux::getRTT<P7>()->name(), + x10aux::getRTT<R>()->name()); + const x10aux::RuntimeType *parent = x10::lang::Object::getRTT(); + const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, 1, parent); + return x10aux::RuntimeType::installRTT(&rtt, cand); } + virtual const x10aux::RuntimeType *_type() const { return getRTT(); } virtual ~Fun_0_7() { }; virtual R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) = 0; }; template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class R> - typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT * const Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::rtt = - new (x10aux::alloc<typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT>()) - typename Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::RTT(); + const x10aux::RuntimeType* Fun_0_7<P1,P2,P3,P4,P5,P6,P7,R>::rtt = NULL; } } #endif Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-05-28 12:19:01 UTC (rev 8424) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-05-28 16:20:18 UTC (rev 8425) @@ -9,36 +9,32 @@ namespace lang { template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class R> class Fun_0_8 : public virtual Object { public: - class RTT : public x10aux::RuntimeType { - public: - virtual void init() { initParents(1,x10aux::getRTT<Object>()); } - virtual const char *name() const { - static const char *name = - x10aux::alloc_printf("x10.lang.Fun_0_8[%s,%s,%s,%s,%s,%s,%s,%s,%s]", - x10aux::getRTT<P1>()->name(), - x10aux::getRTT<P2>()->name(), - x10aux::getRTT<P3>()->name(), - x10aux::getRTT<P4>()->name(), - x10aux::getRTT<P5>()->name(), - x10aux::getRTT<P6>()->name(), - x10aux::getRTT<P7>()->name(), - x10aux::getRTT<P8>()->name(), - x10aux::getRTT<R>()->name()); - return name; - } - }; - static RTT * const rtt; - virtual const x10aux::RuntimeType *_type() const { - return x10aux::getRTT<Fun_0_8<P1,P2,P3,P4,P5,P6,P7,P8,R> >(); + ... [truncated message content] |
From: <dgr...@us...> - 2009-06-03 15:09:47
|
Revision: 8450 http://x10.svn.sourceforge.net/x10/?rev=8450&view=rev Author: dgrove-oss Date: 2009-06-03 15:09:40 +0000 (Wed, 03 Jun 2009) Log Message: ----------- Add pragmas.h as a single location for defining macros to encpasulate C++ compiler pargas (eg noreturn, noinline, etc). Currently only defined for g++; need to define for xlC as well. Tweaks to how we generate the initRTT function for generic types to cut a couple more Mb out of libx10rt17.a. After this, I don't think there is any significant gain available by tuning RTT-related code. I'm going to move on to look at serialization/deseralization. Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java trunk/x10.runtime.17/src-cpp/x10/lang/Box.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h trunk/x10.runtime.17/src-cpp/x10aux/RTT.cc trunk/x10.runtime.17/src-cpp/x10aux/RTT.h trunk/x10.runtime.17/src-cpp/x10aux/config.h trunk/x10.runtime.17/src-cpp/x10aux/throw.h Added Paths: ----------- trunk/x10.runtime.17/src-cpp/x10aux/pragmas.h Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java 2009-06-03 15:09:40 UTC (rev 8450) @@ -549,7 +549,7 @@ } else { h.write("static const x10aux::RuntimeType* rtt;"); h.newline(); h.write("static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; }"); h.newline(); - h.write("static const x10aux::RuntimeType* _initRTT() {"); h.newline(4); h.begin(0); + h.write("static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE {"); h.newline(4); h.begin(0); h.write("const char *name ="); h.newline(4); h.write("x10aux::alloc_printf("); h.begin(0); h.write("\""+x10name+"["); @@ -564,13 +564,22 @@ h.write("x10aux::getRTT"+chevrons(translateType(param))+"()->name()"); } h.write(");") ; h.end(); h.newline(); - h.write("const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, "+num_parents); - h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); - for (Type iface : ct.interfaces()) { - h.write(", x10aux::getRTT"+chevrons(translateType(iface))+"()"); + if (num_parents <= 5) { + h.write("return x10aux::RuntimeType::allocAndInstallRTT(&rtt, name"); + h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); + for (Type iface : ct.interfaces()) { + h.write(", x10aux::getRTT"+chevrons(translateType(iface))+"()"); + } + h.write(");"); h.end(); h.newline(); + } else { + h.write("const x10aux::RuntimeType *cand = new (x10aux::alloc<x10aux::RuntimeType >()) x10aux::RuntimeType(name, "+num_parents); + h.write(", x10aux::getRTT" + chevrons(ct.superClass()==null ? translateType(xts.Ref()) : translateType(ct.superClass())) + "()"); + for (Type iface : ct.interfaces()) { + h.write(", x10aux::getRTT"+chevrons(translateType(iface))+"()"); + } + h.write(");"); h.newline(); + h.write("return x10aux::RuntimeType::installRTT(&rtt, cand);"); h.end(); h.newline(); } - h.write(");"); h.newline(); - h.write("return x10aux::RuntimeType::installRTT(&rtt, cand);"); h.end(); h.newline(); h.write("}"); h.newline(); h.write("virtual const x10aux::RuntimeType *_type() const { return getRTT(); }"); h.newline(); h.forceNewline(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Box.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Box.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -22,7 +22,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Box(&rtt, x10aux::getRTT<T>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_0.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -14,7 +14,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_0(&rtt, x10aux::getRTT<R>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_1.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -16,7 +16,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_1(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<R>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_2.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -17,7 +17,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_2(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<R>()); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_3.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -17,7 +17,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_3(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<R>()); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_4.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -19,7 +19,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_4(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<R>()); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_5.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -20,7 +20,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_5(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<R>()); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_6.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -21,7 +21,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_6(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_7.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -21,7 +21,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_7(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_8.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -22,7 +22,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Fun_0_8(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Fun_0_9.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -11,7 +11,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { const char *name = x10aux::alloc_printf("x10.lang.Fun_0_9[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]", x10aux::getRTT<P1>()->name(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Iterable.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -14,7 +14,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Iterable(&rtt, x10aux::getRTT<T>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Iterator.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -20,7 +20,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Iterator(&rtt, x10aux::getRTT<T>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -29,7 +29,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Rail(&rtt, x10aux::getRTT<T>(), x10aux::getRTT<Settable<x10_int,T> >(), x10aux::getRTT<Iterable<T> >()); } @@ -57,7 +57,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_RailIterator(&rtt, x10aux::getRTT<T>(), x10aux::getRTT<x10::lang::Iterator<T> >()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Settable.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -16,7 +16,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_Settable(&rtt, x10aux::getRTT<I>(), x10aux::getRTT<V>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -31,7 +31,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_ValRail(&rtt, x10aux::getRTT<T>(), x10aux::getRTT<Fun_0_1<x10_int,T> >(), x10aux::getRTT<Iterable<T> >()); } @@ -61,7 +61,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_ValRailIterator(&rtt, x10aux::getRTT<T>(), x10aux::getRTT<x10::lang::Iterator<T> >()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_1.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -15,7 +15,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_1(&rtt, x10aux::getRTT<P1>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_2.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -16,7 +16,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_2(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_3.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -17,7 +17,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_3(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>()); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_4.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -18,7 +18,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_4(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>()); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_5.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -19,7 +19,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_5(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>()); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_6.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -20,7 +20,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_6(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>()); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_7.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -21,7 +21,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_7(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_8.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -22,7 +22,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_8(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/lang/VoidFun_0_9.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -23,7 +23,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::lang::_initRTTHelper_VoidFun_0_9(&rtt, x10aux::getRTT<P1>(), x10aux::getRTT<P2>(), x10aux::getRTT<P3>(), x10aux::getRTT<P4>(), x10aux::getRTT<P5>(), x10aux::getRTT<P6>(), Modified: trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10/util/GrowableRail.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -20,7 +20,7 @@ public: static const x10aux::RuntimeType* rtt; static const x10aux::RuntimeType* getRTT() { return NULL == rtt ? _initRTT() : rtt; } - static const x10aux::RuntimeType* _initRTT() { + static const x10aux::RuntimeType* _initRTT() X10_PRAGMA_NOINLINE { return x10::util::_initRTTHelper_GrowableRail(&rtt, x10aux::getRTT<T>()); } virtual const x10aux::RuntimeType *_type() const { return getRTT(); } Modified: trunk/x10.runtime.17/src-cpp/x10aux/RTT.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/RTT.cc 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10aux/RTT.cc 2009-06-03 15:09:40 UTC (rev 8450) @@ -68,6 +68,36 @@ DoubleType = new (alloc<RuntimeType >()) RuntimeType("x10.lang.Double", 1, ObjectType); } +const RuntimeType* +RuntimeType::allocAndInstallRTT(const RuntimeType **location, const char* name, const RuntimeType *p1) { + return installRTT(location, new (alloc<RuntimeType >()) RuntimeType(name, 1, p1)); +} + +const RuntimeType* +RuntimeType::allocAndInstallRTT(const RuntimeType **location, const char* name, const RuntimeType *p1, + const RuntimeType *p2) { + return installRTT(location, new (alloc<RuntimeType >()) RuntimeType(name, 2, p1, p2)); +} + +const RuntimeType* +RuntimeType::allocAndInstallRTT(const RuntimeType **location, const char* name, const RuntimeType *p1, + const RuntimeType *p2, const RuntimeType *p3) { + return installRTT(location, new (alloc<RuntimeType >()) RuntimeType(name, 3, p1, p2, p3)); +} + +const RuntimeType* +RuntimeType::allocAndInstallRTT(const RuntimeType **location, const char* name, const RuntimeType *p1, + const RuntimeType *p2, const RuntimeType *p3, const RuntimeType *p4) { + return installRTT(location, new (alloc<RuntimeType >()) RuntimeType(name, 4, p1, p2, p3, p4)); +} + +const RuntimeType* +RuntimeType::allocAndInstallRTT(const RuntimeType **location, const char* name, const RuntimeType *p1, + const RuntimeType *p2, const RuntimeType *p3, const RuntimeType *p4, + const RuntimeType *p5) { + return installRTT(location, new (alloc<RuntimeType >()) RuntimeType(name, 5, p1, p2, p3, p4, p5)); +} + pthread_mutex_t RuntimeType::installLock; pthread_mutexattr_t RuntimeType::installLockAttr; Modified: trunk/x10.runtime.17/src-cpp/x10aux/RTT.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/RTT.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10aux/RTT.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -77,6 +77,24 @@ return other == this; } + /* + * Helper functions to use in defining _initRTT methods in templates to reduce code space impact + */ + static const RuntimeType* allocAndInstallRTT(const RuntimeType **location, const char* name, + const RuntimeType *p1); + static const RuntimeType* allocAndInstallRTT(const RuntimeType **location, const char* name, + const RuntimeType *p1, const RuntimeType *p2); + static const RuntimeType* allocAndInstallRTT(const RuntimeType **location, const char* name, + const RuntimeType *p1, const RuntimeType *p2, + const RuntimeType *p3); + static const RuntimeType* allocAndInstallRTT(const RuntimeType **location, const char* name, + const RuntimeType *p1, const RuntimeType *p2, + const RuntimeType *p3, const RuntimeType *p4); + static const RuntimeType* allocAndInstallRTT(const RuntimeType **location, const char* name, + const RuntimeType *p1, const RuntimeType *p2, + const RuntimeType *p3, const RuntimeType *p4, + const RuntimeType *p5); + static const RuntimeType* installRTT(const RuntimeType **location, const RuntimeType *rtt); static void bootstrap(); }; Modified: trunk/x10.runtime.17/src-cpp/x10aux/config.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/config.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10aux/config.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -92,6 +92,8 @@ #include <x10/x10.h> //pgas +#include <x10aux/pragmas.h> + #define _DEBUG_MSG(col,type,msg) do { \ std::stringstream ss; \ ss << ANSI_BOLD << x10_here() << ": " col << type << ": " ANSI_RESET << msg; \ Added: trunk/x10.runtime.17/src-cpp/x10aux/pragmas.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/pragmas.h (rev 0) +++ trunk/x10.runtime.17/src-cpp/x10aux/pragmas.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -0,0 +1,29 @@ +#ifndef X10AUX_PRAGMAS_H +#define X10AUX_PRAGMAS_H + +/* + * A header file to define portable names for compiler-specific pragmas + */ + +/* + * use this to indicate that a function will not return (eg throw) + */ +#if defined __GNUC__ && !defined __CUDA_ARCH__ +#define X10_PRAGMA_NORETURN __attribute__ ((noreturn)) +#else +#define X10_PRAGMA_NORETURN +#endif + +/* + * Use this to prevent the function from being inlined. + * Intended use case: infrequently executed code that + * appears in header files due to our use of templates. + */ +#if defined __GNUC__ +#define X10_PRAGMA_NOINLINE __attribute__ ((noinline)) +#else +#define X10_PRAGMA_NOINLINE +#endif + +#endif + Property changes on: trunk/x10.runtime.17/src-cpp/x10aux/pragmas.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/x10.runtime.17/src-cpp/x10aux/throw.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/throw.h 2009-06-02 18:42:29 UTC (rev 8449) +++ trunk/x10.runtime.17/src-cpp/x10aux/throw.h 2009-06-03 15:09:40 UTC (rev 8450) @@ -7,19 +7,11 @@ #include <x10/lang/Throwable.h> -#if defined __GNUC__ && !defined __CUDA_ARCH__ -// stops the compiler warning about functions that don't return but do throw -#define NORETURN __attribute__ ((noreturn)) -#else -#define NORETURN -#endif - - namespace x10aux { - template<class T> void throwException() NORETURN; + template<class T> void throwException() X10_PRAGMA_NORETURN; - void throwException(x10aux::ref<x10::lang::Throwable> e) NORETURN; + void throwException(x10aux::ref<x10::lang::Throwable> e) X10_PRAGMA_NORETURN; inline void throwException(x10aux::ref<x10::lang::Throwable> e) { throw e->fillInStackTrace(); @@ -31,7 +23,5 @@ } -#undef NORETURN - #endif // vim:tabstop=4:shiftwidth=4:expandtab This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-06-03 22:29:01
|
Revision: 8457 http://x10.svn.sourceforge.net/x10/?rev=8457&view=rev Author: dgrove-oss Date: 2009-06-03 22:28:59 +0000 (Wed, 03 Jun 2009) Log Message: ----------- Move the "_make" method (the part of the constructor that allocates storage by calling x10aux::alloc and calls the real _constructor method) from the .h to the .cc file for all non-generic classes. This yield a major reduction in code size (libx10lib17.a reduced from 73Mb to 45Mb) as these _make methods were being indiscriminately inlined. Long term, one would expect that there will be some frequently executed allocation sites that we do want to inline, but we'll get that done either in the X10 "middle end" or by using profile-directed optimization & whole program inlining in the post compiler. Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc trunk/x10.runtime.17/src-cpp/x10/io/IOException.h trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc trunk/x10.runtime.17/src-cpp/x10/lang/Error.h trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.cc trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h trunk/x10.runtime.17/src-cpp/x10/lang/Ref.cc trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.cc trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h trunk/x10.runtime.17/src-cpp/x10/lang/String.cc trunk/x10.runtime.17/src-cpp/x10/lang/String.h trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.cc trunk/x10.runtime.17/src-cpp/x10/lang/Value.cc trunk/x10.runtime.17/src-cpp/x10/lang/Value.h trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.h trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicInteger.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicInteger.h trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicLong.cc trunk/x10.runtime.17/src-cpp/x10/util/concurrent/atomic/AtomicLong.h Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-06-03 22:28:59 UTC (rev 8457) @@ -1342,22 +1342,28 @@ sw.pushCurrentStream(h); emitter.printHeader(dec, sw, tr, false, MAKE, make_ref(typeName)); sw.popCurrentStream(); - h.allowBreak(0, " "); h.write("{"); h.newline(4); h.begin(0); - h.write(make_ref(typeName)+" this_ = "+ - "new (x10aux::alloc"+chevrons(typeName)+"()) "+typeName+"();"); h.newline(); - h.write("this_->"+CONSTRUCTOR+"("); + h.write(";") ; h.newline(); + h.forceNewline(); + emitter.printHeader(dec, sw, tr, true, MAKE, make_ref(typeName)); + + + + sw.allowBreak(0, " "); sw.write("{"); sw.newline(4); sw.begin(0); + sw.write(make_ref(typeName)+" this_ = "+ + "new (x10aux::alloc"+chevrons(typeName)+"()) "+typeName+"();"); sw.newline(); + sw.write("this_->"+CONSTRUCTOR+"("); for (Iterator i = dec.formals().iterator(); i.hasNext(); ) { Formal f = (Formal) i.next(); - h.write(mangled_non_method_name(f.name().id().toString())); + sw.write(mangled_non_method_name(f.name().id().toString())); if (i.hasNext()) { - h.write(","); - h.allowBreak(0, " "); + sw.write(","); + sw.allowBreak(0, " "); } } - h.write(");"); h.newline(); - h.write("return this_;"); - h.end(); h.newline(); - h.write("}"); h.newline(); // no gap between _make and _constructor + sw.write(");"); sw.newline(); + sw.write("return this_;"); + sw.end(); sw.newline(); + sw.write("}"); sw.newline(); sw.forceNewline(); } sw.pushCurrentStream(h); Modified: trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/EOFException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -9,6 +9,27 @@ const serialization_id_t EOFException::_serialization_id = DeserializationDispatcher::addDeserializer(EOFException::_deserializer<Object>); +x10aux::ref<EOFException> +EOFException::_make() { + return (new (x10aux::alloc<EOFException>()) EOFException())->_constructor(); +} + +x10aux::ref<EOFException> +EOFException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<EOFException>()) EOFException())->_constructor(message); +} + +x10aux::ref<EOFException> +EOFException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<EOFException>()) EOFException())->_constructor(cause); +} + +x10aux::ref<EOFException> +EOFException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<EOFException>()) EOFException())->_constructor(message, cause); +} + + RTT_CC_DECLS1(EOFException, "x10.io.EOFException", IOException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/EOFException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,22 +14,11 @@ public: RTT_H_DECLS; - static x10aux::ref<EOFException> _make() - { return (new (x10aux::alloc<EOFException>()) EOFException()) ->_constructor(); } - - static x10aux::ref<EOFException> _make(x10aux::ref<x10::lang::String> message) - { return (new (x10aux::alloc<EOFException>()) EOFException()) ->_constructor(message); } - - static x10aux::ref<EOFException> _make(x10aux::ref<Throwable> cause) - { return (new (x10aux::alloc<EOFException>()) EOFException()) ->_constructor(cause); } - + static x10aux::ref<EOFException> _make(); + static x10aux::ref<EOFException> _make(x10aux::ref<x10::lang::String> message); + static x10aux::ref<EOFException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<EOFException> _make(x10aux::ref<x10::lang::String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<EOFException>()) EOFException()) - ->_constructor(message, cause); - } - + x10aux::ref<Throwable> cause); static const x10aux::serialization_id_t _serialization_id; Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -7,6 +7,11 @@ x10aux::ref<FileInputStream> FileInputStream::STANDARD_IN = new (x10aux::alloc<FileInputStream>()) FileInputStream(stdin); +x10aux::ref<FileInputStream> +FileInputStream::_make(x10aux::ref<x10::lang::String> name) { + return new (x10aux::alloc<FileInputStream>()) FileInputStream (FILEPtrStream::open_file(name, "r")); +} + RTT_CC_DECLS1(FileInputStream, "x10.io.FileReader.FileInputStream", NativeInputStream) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileInputStream.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -17,10 +17,7 @@ FileInputStream(FILE *f) : FILEPtrInputStream(f) { } - static x10aux::ref<FileInputStream> _make(x10aux::ref<x10::lang::String> name) { - return new (x10aux::alloc<FileInputStream>()) - FileInputStream (FILEPtrStream::open_file(name, "r")); - } + static x10aux::ref<FileInputStream> _make(x10aux::ref<x10::lang::String> name); virtual char * gets(char *buf, int sz) { return x10aux::io::FILEPtrInputStream::gets(buf,sz); Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -9,6 +9,26 @@ const serialization_id_t FileNotFoundException::_serialization_id = DeserializationDispatcher::addDeserializer(FileNotFoundException::_deserializer<Object>); +x10aux::ref<FileNotFoundException> +FileNotFoundException::_make() { + return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException())->_constructor(); +} + +x10aux::ref<FileNotFoundException> +FileNotFoundException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException())->_constructor(message); +} + +x10aux::ref<FileNotFoundException> +FileNotFoundException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException())->_constructor(cause); +} + +x10aux::ref<FileNotFoundException> +FileNotFoundException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException())->_constructor(message, cause); +} + RTT_CC_DECLS1(FileNotFoundException, "x10.io.FileNotFoundException", IOException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileNotFoundException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,29 +14,12 @@ public: RTT_H_DECLS; - static x10aux::ref<FileNotFoundException> _make() { - return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException()) - ->_constructor(); - } - - static x10aux::ref<FileNotFoundException> _make(x10aux::ref<x10::lang::String> message){ - return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException()) - ->_constructor(message); - } - - static x10aux::ref<FileNotFoundException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException()) - ->_constructor(cause); - } - + static x10aux::ref<FileNotFoundException> _make(); + static x10aux::ref<FileNotFoundException> _make(x10aux::ref<x10::lang::String> message); + static x10aux::ref<FileNotFoundException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<FileNotFoundException> _make(x10aux::ref<x10::lang::String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<FileNotFoundException>()) FileNotFoundException()) - ->_constructor(message, cause); - } + x10aux::ref<Throwable> cause); - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -10,6 +10,11 @@ x10aux::ref<FileOutputStream> FileOutputStream::STANDARD_ERR = new (x10aux::alloc<FileOutputStream>()) FileOutputStream(stderr); +x10aux::ref<FileOutputStream> +FileOutputStream::_make(x10aux::ref<x10::lang::String> name) { + return new (x10aux::alloc<FileOutputStream>()) FileOutputStream (FILEPtrStream::open_file(name, "w")); +} + RTT_CC_DECLS1(FileOutputStream, "x10.io.FileWriter.FileOutputStream", NativeOutputStream) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/FileOutputStream.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -17,10 +17,7 @@ FileOutputStream(FILE *f) : FILEPtrOutputStream(f) { } - static x10aux::ref<FileOutputStream> _make(x10aux::ref<x10::lang::String> name) { - return new (x10aux::alloc<FileOutputStream>()) - FileOutputStream (FILEPtrStream::open_file(name, "w")); - } + static x10aux::ref<FileOutputStream> _make(x10aux::ref<x10::lang::String> name); virtual void write(const char *str) { x10aux::io::FILEPtrOutputStream::write(str); Modified: trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/IOException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -10,6 +10,27 @@ const serialization_id_t IOException::_serialization_id = DeserializationDispatcher::addDeserializer(IOException::_deserializer<Object>); +x10aux::ref<IOException> +IOException::_make() { + return (new (x10aux::alloc<IOException>()) IOException())->_constructor(); +} + +x10aux::ref<IOException> +IOException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<IOException>()) IOException())->_constructor(message); +} + +x10aux::ref<IOException> +IOException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<IOException>()) IOException())->_constructor(cause); +} + +x10aux::ref<IOException> +IOException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<IOException>()) IOException())->_constructor(message, cause); +} + + RTT_CC_DECLS1(IOException,"x10.io.IOException",Exception) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/IOException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/IOException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,22 +14,11 @@ public: RTT_H_DECLS; - static x10aux::ref<IOException> _make() - { return (new (x10aux::alloc<IOException>()) IOException()) ->_constructor(); } - - static x10aux::ref<IOException> _make(x10aux::ref<x10::lang::String> message) - { return (new (x10aux::alloc<IOException>()) IOException()) ->_constructor(message); } - - static x10aux::ref<IOException> _make(x10aux::ref<Throwable> cause) - { return (new (x10aux::alloc<IOException>()) IOException()) ->_constructor(cause); } - + static x10aux::ref<IOException> _make(); + static x10aux::ref<IOException> _make(x10aux::ref<x10::lang::String> message); + static x10aux::ref<IOException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<IOException> _make(x10aux::ref<x10::lang::String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<IOException>()) IOException()) - ->_constructor(message, cause); - } - + x10aux::ref<Throwable> cause); static const x10aux::serialization_id_t _serialization_id; Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -6,6 +6,11 @@ using namespace x10::io; using namespace x10aux; +x10aux::ref<NativeFile> +NativeFile::_make(x10aux::ref<x10::lang::String> s) { + return (new (x10aux::alloc<NativeFile>()) NativeFile())->_constructor(s); +} + RTT_CC_DECLS1(NativeFile, "x10.io.File.NativeFile", Ref) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/io/NativeFile.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -25,9 +25,7 @@ public: - static x10aux::ref<NativeFile> _make(x10aux::ref<x10::lang::String> s) { - return (new (x10aux::alloc<NativeFile>()) NativeFile())->_constructor(s); - } + static x10aux::ref<NativeFile> _make(x10aux::ref<x10::lang::String> s); x10aux::ref<NativeFile> _constructor(x10aux::ref<x10::lang::String> s) { name = s; return this; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -9,6 +9,26 @@ DeserializationDispatcher ::addDeserializer(ArrayIndexOutOfBoundsException::_deserializer<Object>); +x10aux::ref<ArrayIndexOutOfBoundsException> +ArrayIndexOutOfBoundsException::_make() { + return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) ArrayIndexOutOfBoundsException())->_constructor(); +} + +x10aux::ref<ArrayIndexOutOfBoundsException> +ArrayIndexOutOfBoundsException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) ArrayIndexOutOfBoundsException())->_constructor(message); +} + +x10aux::ref<ArrayIndexOutOfBoundsException> +ArrayIndexOutOfBoundsException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) ArrayIndexOutOfBoundsException())->_constructor(cause); +} + +x10aux::ref<ArrayIndexOutOfBoundsException> +ArrayIndexOutOfBoundsException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) ArrayIndexOutOfBoundsException())->_constructor(message, cause); +} + RTT_CC_DECLS1(ArrayIndexOutOfBoundsException, "x10.lang.ArrayIndexOutOfBoundsException", RuntimeException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ArrayIndexOutOfBoundsException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,33 +14,11 @@ public: RTT_H_DECLS; - static x10aux::ref<ArrayIndexOutOfBoundsException> _make() - { - return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) - ArrayIndexOutOfBoundsException()) - ->_constructor(); - } - - static x10aux::ref<ArrayIndexOutOfBoundsException> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) - ArrayIndexOutOfBoundsException()) - ->_constructor(message); - } - - static x10aux::ref<ArrayIndexOutOfBoundsException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) - ArrayIndexOutOfBoundsException()) - ->_constructor(cause); - } - + static x10aux::ref<ArrayIndexOutOfBoundsException> _make(); + static x10aux::ref<ArrayIndexOutOfBoundsException> _make(x10aux::ref<String> message); + static x10aux::ref<ArrayIndexOutOfBoundsException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<ArrayIndexOutOfBoundsException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<ArrayIndexOutOfBoundsException>()) - ArrayIndexOutOfBoundsException()) - ->_constructor(message, cause); - } - + x10aux::ref<Throwable> cause); static const x10aux::serialization_id_t _serialization_id; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,27 @@ const serialization_id_t BadPlaceException::_serialization_id = DeserializationDispatcher::addDeserializer(BadPlaceException::_deserializer<Object>); +x10aux::ref<BadPlaceException> +BadPlaceException::_make() { + return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException())->_constructor(); +} + +x10aux::ref<BadPlaceException> +BadPlaceException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException())->_constructor(message); +} + +x10aux::ref<BadPlaceException> +BadPlaceException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException())->_constructor(cause); +} + +x10aux::ref<BadPlaceException> +BadPlaceException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException())->_constructor(message, cause); +} + + RTT_CC_DECLS1(BadPlaceException, "x10.lang.BadPlaceException", x10::lang::RuntimeException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/BadPlaceException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,30 +14,12 @@ public: RTT_H_DECLS; - static x10aux::ref<BadPlaceException> _make() - { - return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException()) - ->_constructor(); - } - - static x10aux::ref<BadPlaceException> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException()) - ->_constructor(message); - } - - static x10aux::ref<BadPlaceException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException()) - ->_constructor(cause); - } - + static x10aux::ref<BadPlaceException> _make(); + static x10aux::ref<BadPlaceException> _make(x10aux::ref<String> message); + static x10aux::ref<BadPlaceException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<BadPlaceException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<BadPlaceException>()) BadPlaceException()) - ->_constructor(message, cause); - } + x10aux::ref<Throwable> cause); - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,26 @@ const serialization_id_t ClassCastException::_serialization_id = DeserializationDispatcher::addDeserializer(ClassCastException::_deserializer<Object>); +x10aux::ref<ClassCastException> +ClassCastException::_make() { + return (new (x10aux::alloc<ClassCastException>()) ClassCastException())->_constructor(); +} + +x10aux::ref<ClassCastException> +ClassCastException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<ClassCastException>()) ClassCastException())->_constructor(message); +} + +x10aux::ref<ClassCastException> +ClassCastException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<ClassCastException>()) ClassCastException())->_constructor(cause); +} + +x10aux::ref<ClassCastException> +ClassCastException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<ClassCastException>()) ClassCastException())->_constructor(message, cause); +} + RTT_CC_DECLS1(ClassCastException, "x10.lang.ClassCastException", RuntimeException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ClassCastException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,31 +14,12 @@ public: RTT_H_DECLS; - static x10aux::ref<ClassCastException> _make() - { - return (new (x10aux::alloc<ClassCastException>()) ClassCastException()) - ->_constructor(); - } - - static x10aux::ref<ClassCastException> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<ClassCastException>()) ClassCastException()) - ->_constructor(message); - } - - static x10aux::ref<ClassCastException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<ClassCastException>()) ClassCastException()) - ->_constructor(cause); - } - + static x10aux::ref<ClassCastException> _make(); + static x10aux::ref<ClassCastException> _make(x10aux::ref<String> message); + static x10aux::ref<ClassCastException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<ClassCastException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<ClassCastException>()) ClassCastException()) - ->_constructor(message, cause); - } + x10aux::ref<Throwable> cause); - - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Error.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,27 @@ const serialization_id_t Error::_serialization_id = DeserializationDispatcher::addDeserializer(Error::_deserializer<Object>); +x10aux::ref<Error> +Error::_make() { + return (new (x10aux::alloc<Error>()) Error())->_constructor(); +} + +x10aux::ref<Error> +Error::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<Error>()) Error())->_constructor(message); +} + +x10aux::ref<Error> +Error::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Error>()) Error())->_constructor(cause); +} + +x10aux::ref<Error> +Error::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Error>()) Error())->_constructor(message, cause); +} + + RTT_CC_DECLS1(Error, "x10.lang.Error", Throwable) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Error.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Error.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -15,27 +15,12 @@ public: RTT_H_DECLS; - static x10aux::ref<Error> _make() - { return (new (x10aux::alloc<Error>()) Error())->_constructor(); } - - static x10aux::ref<Error> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<Error>()) Error()) - ->_constructor(message); - } - - static x10aux::ref<Error> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<Error>()) Error()) - ->_constructor(cause); - } - + static x10aux::ref<Error> _make(); + static x10aux::ref<Error> _make(x10aux::ref<String> message); + static x10aux::ref<Error> _make(x10aux::ref<Throwable> cause); static x10aux::ref<Error> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<Error>()) Error()) - ->_constructor(message, cause); - } + x10aux::ref<Throwable> cause); - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Exception.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,27 @@ const serialization_id_t Exception::_serialization_id = DeserializationDispatcher::addDeserializer(Exception::_deserializer<Object>); +x10aux::ref<Exception> +Exception::_make() { + return (new (x10aux::alloc<Exception>()) Exception())->_constructor(); +} + +x10aux::ref<Exception> +Exception::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<Exception>()) Exception())->_constructor(message); +} + +x10aux::ref<Exception> +Exception::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Exception>()) Exception())->_constructor(cause); +} + +x10aux::ref<Exception> +Exception::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Exception>()) Exception())->_constructor(message, cause); +} + + RTT_CC_DECLS1(Exception, "x10.lang.Exception", Throwable) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Exception.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -15,26 +15,11 @@ public: RTT_H_DECLS; - static x10aux::ref<Exception> _make() - { return (new (x10aux::alloc<Exception>()) Exception())->_constructor(); } - - static x10aux::ref<Exception> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<Exception>()) Exception()) - ->_constructor(message); - } - - static x10aux::ref<Exception> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<Exception>()) Exception()) - ->_constructor(cause); - } - + static x10aux::ref<Exception> _make(); + static x10aux::ref<Exception> _make(x10aux::ref<String> message); + static x10aux::ref<Exception> _make(x10aux::ref<Throwable> cause); static x10aux::ref<Exception> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<Exception>()) Exception()) - ->_constructor(message, cause); - } - + x10aux::ref<Throwable> cause); static const x10aux::serialization_id_t _serialization_id; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,26 @@ const serialization_id_t NullPointerException::_serialization_id = DeserializationDispatcher::addDeserializer(NullPointerException::_deserializer<Object>); +x10aux::ref<NullPointerException> +NullPointerException::_make() { + return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(); +} + +x10aux::ref<NullPointerException> +NullPointerException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(message); +} + +x10aux::ref<NullPointerException> +NullPointerException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(cause); +} + +x10aux::ref<NullPointerException> +NullPointerException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(message, cause); +} + RTT_CC_DECLS1(NullPointerException, "x10.lang.NullPointerException", RuntimeException) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,30 +14,12 @@ public: RTT_H_DECLS; - static x10aux::ref<NullPointerException> _make() - { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException()) - ->_constructor(); - } - - static x10aux::ref<NullPointerException> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException()) - ->_constructor(message); - } - - static x10aux::ref<NullPointerException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException()) - ->_constructor(cause); - } - + static x10aux::ref<NullPointerException> _make(); + static x10aux::ref<NullPointerException> _make(x10aux::ref<String> message); + static x10aux::ref<NullPointerException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<NullPointerException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException()) - ->_constructor(message, cause); - } + x10aux::ref<Throwable> cause); - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,6 +8,17 @@ const serialization_id_t OutOfMemoryError::_serialization_id = DeserializationDispatcher::addDeserializer(OutOfMemoryError::_deserializer<Object>); +x10aux::ref<OutOfMemoryError> +OutOfMemoryError::_make() { + return (new (x10aux::alloc<OutOfMemoryError>()) OutOfMemoryError())->_constructor(); +} + +x10aux::ref<OutOfMemoryError> +OutOfMemoryError::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<OutOfMemoryError>()) OutOfMemoryError())->_constructor(message); +} + + RTT_CC_DECLS1(OutOfMemoryError, "x10.lang.OutOfMemoryError", Error) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/OutOfMemoryError.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,18 +14,10 @@ public: RTT_H_DECLS; - static x10aux::ref<OutOfMemoryError> _make() - { - return (new (x10aux::alloc<OutOfMemoryError>()) OutOfMemoryError()) - ->_constructor(); - } + static x10aux::ref<OutOfMemoryError> _make(); - static x10aux::ref<OutOfMemoryError> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<OutOfMemoryError>()) OutOfMemoryError()) - ->_constructor(message); - } + static x10aux::ref<OutOfMemoryError> _make(x10aux::ref<String> message); - static const x10aux::serialization_id_t _serialization_id; virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Ref.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Ref.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Ref.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -7,6 +7,11 @@ using namespace x10::lang; using namespace x10aux; +x10aux::ref<Ref> +Ref::_make() { + return (new (x10aux::alloc<Ref>()) Ref())->_constructor(); +} + x10_int x10::lang::Ref::hashCode() { return (x10_int) (int64_t)(void*)this; } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -18,9 +18,7 @@ public: RTT_H_DECLS; - static x10aux::ref<Ref> _make() { - return (new (x10aux::alloc<Ref>()) Ref())->_constructor(); - } + static x10aux::ref<Ref> _make(); x10aux::ref<Ref> _constructor() { return this; } @@ -30,7 +28,6 @@ x10aux::serialization_buffer &buf, x10aux::addr_map &m) { - // don't send an id, just serialise the ref (null/local/remote -- we don't care) buf.write(x10aux::ref_serialize(this_.get()),m); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -8,5 +8,25 @@ const serialization_id_t RuntimeException::_serialization_id = DeserializationDispatcher::addDeserializer(RuntimeException::_deserializer<Object>); +x10aux::ref<RuntimeException> +RuntimeException::_make() { + return (new (x10aux::alloc<RuntimeException>()) RuntimeException())->_constructor(); +} + +x10aux::ref<RuntimeException> +RuntimeException::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<RuntimeException>()) RuntimeException())->_constructor(message); +} + +x10aux::ref<RuntimeException> +RuntimeException::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<RuntimeException>()) RuntimeException())->_constructor(cause); +} + +x10aux::ref<RuntimeException> +RuntimeException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<RuntimeException>()) RuntimeException())->_constructor(message, cause); +} + RTT_CC_DECLS1(RuntimeException, "x10.lang.RuntimeException", Exception) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/RuntimeException.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -14,26 +14,11 @@ public: RTT_H_DECLS; - static x10aux::ref<RuntimeException> _make() - { return (new (x10aux::alloc<RuntimeException>()) RuntimeException())->_constructor(); } - - static x10aux::ref<RuntimeException> _make(x10aux::ref<String> message) { - return (new (x10aux::alloc<RuntimeException>()) RuntimeException()) - ->_constructor(message); - } - - static x10aux::ref<RuntimeException> _make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<RuntimeException>()) RuntimeException()) - ->_constructor(cause); - } - + static x10aux::ref<RuntimeException> _make(); + static x10aux::ref<RuntimeException> _make(x10aux::ref<String> message); + static x10aux::ref<RuntimeException> _make(x10aux::ref<Throwable> cause); static x10aux::ref<RuntimeException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { - return (new (x10aux::alloc<RuntimeException>()) RuntimeException()) - ->_constructor(message, cause); - } - + x10aux::ref<Throwable> cause); static const x10aux::serialization_id_t _serialization_id; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/String.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/String.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/String.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -16,6 +16,21 @@ using namespace x10::lang; using namespace x10aux; +x10aux::ref<String> +String::_make(const char *content, bool steal) { + x10aux::ref<String> this_ = new (x10aux::alloc<String>()) String(); + if (!steal) content = strdup(content); + this_->_constructor(content,strlen(content)); + return this_; +} + +x10aux::ref<String> +String::_make(x10aux::ref<String> s) { + x10aux::ref<String> this_ = new (x10aux::alloc<String>()) String(); + this_->_constructor(s->FMGL(content), s->FMGL(content_length)); + return this_; +} + x10_int String::hashCode() { return x10aux::hash(reinterpret_cast<const unsigned char*>(FMGL(content)), length()); } @@ -183,6 +198,26 @@ const serialization_id_t String::_serialization_id = DeserializationDispatcher::addDeserializer(String::_deserialize<Object>); +void +String::_serialize(x10aux::ref<String> this_, x10aux::serialization_buffer &buf, x10aux::addr_map &m) { + if (this_==x10aux::null) { + String v; + v._serialize_body(buf,m); + } else { + this_->_serialize_body(buf, m); + } +} + +void +String::_serialize_body(x10aux::serialization_buffer& buf, x10aux::addr_map &m) { + // only support strings that are shorter than 4billion chars + x10_int sz = FMGL(content_length); + buf.write(sz,m); + for (x10_int i=0 ; i<sz ; ++i) { + buf.write((x10_char)FMGL(content)[i],m); + } +} + RTT_CC_DECLS1(String, "x10.lang.String", Value) // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10/lang/String.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/String.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/String.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -32,31 +32,24 @@ // steal false for string literals which ought not to be freed. // Leave it false for 'static' malloced char* such as the RTT type // names that also ought not to be freed. - static x10aux::ref<String> _make(const char *content, bool steal = false) { - x10aux::ref<String> this_ = new (x10aux::alloc<String>()) String(); - if (!steal) content = strdup(content); - this_->_constructor(content,strlen(content)); - return this_; - } + static x10aux::ref<String> _make(const char *content, bool steal = false); x10aux::ref<String> _constructor(const char *content, std::size_t content_length) { this->FMGL(content) = content; this->FMGL(content_length) = content_length; return this; } - static x10aux::ref<String> _make(x10aux::ref<String> s) { - x10aux::ref<String> this_ = new (x10aux::alloc<String>()) String(); - this_->_constructor(s->FMGL(content), s->FMGL(content_length)); - return this_; - } + static x10aux::ref<String> _make(x10aux::ref<String> s); // This is for string literals, brought out here so we have easier control // (Can later make this return a String without allocation) - static x10aux::ref<String> Lit(const char *s) - { return _make(s); } + static x10aux::ref<String> Lit(const char *s) { + return _make(s); + } // Useful when we have a malloced char* instead of a literal - static x10aux::ref<String> Steal(const char *s) - { return _make(s, true); } + static x10aux::ref<String> Steal(const char *s) { + return _make(s, true); + } /* operator x10aux::ref<Value> () { @@ -91,15 +84,7 @@ static void _serialize(x10aux::ref<String> this_, x10aux::serialization_buffer &buf, - x10aux::addr_map &m) - { - if (this_==x10aux::null) { - String v; - v._serialize_body(buf,m); - } else { - this_->_serialize_body(buf, m); - } - } + x10aux::addr_map &m); template<class T> static x10aux::ref<T> _deserialize(x10aux::serialization_buffer &buf){ x10_int sz = buf.read<x10_int>(); @@ -120,14 +105,7 @@ buf.write(_serialization_id, m); } - virtual void _serialize_body(x10aux::serialization_buffer& buf, x10aux::addr_map &m) { - // only support strings that are shorter than 4billion chars - x10_int sz = FMGL(content_length); - buf.write(sz,m); - for (x10_int i=0 ; i<sz ; ++i) { - buf.write((x10_char)FMGL(content)[i],m); - } - } + virtual void _serialize_body(x10aux::serialization_buffer& buf, x10aux::addr_map &m); static x10aux::ref<String> format(x10aux::ref<String> format, x10aux::ref<ValRail<x10aux::ref<Object> > > parms); Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -22,6 +22,38 @@ const serialization_id_t Throwable::_serialization_id = DeserializationDispatcher::addDeserializer(Throwable::_deserializer<Object>); +void +Throwable::_serialize_body(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { + buf.write(FMGL(cause),m); + buf.write(FMGL(message),m); +} + +void +Throwable::_deserialize_body(x10aux::serialization_buffer &buf) { + FMGL(cause) = buf.read<x10aux::ref<Box<x10aux::ref<Throwable> > > >(); + FMGL(message) = buf.read<x10aux::ref<String> >(); +} + +x10aux::ref<Throwable> +Throwable::_make() { + return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(); +} + +x10aux::ref<Throwable> +Throwable::_make(x10aux::ref<String> message) { + return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(message); +} + +x10aux::ref<Throwable> +Throwable::_make(x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(cause); +} + +x10aux::ref<Throwable> +Throwable::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { + return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(message, cause); +} + x10aux::ref<Throwable> Throwable::_constructor(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -28,20 +28,11 @@ void *FMGL(trace)[MAX_TRACE_SIZE]; int FMGL(trace_size); - - static x10aux::ref<Throwable> _make() - { return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(); } - - static x10aux::ref<Throwable> _make(x10aux::ref<String> message) - { return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(message); } - - static x10aux::ref<Throwable> _make(x10aux::ref<Throwable> cause) - { return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(cause); } - + static x10aux::ref<Throwable> _make(); + static x10aux::ref<Throwable> _make(x10aux::ref<String> message); + static x10aux::ref<Throwable> _make(x10aux::ref<Throwable> cause); static x10aux::ref<Throwable> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause) - { return (new (x10aux::alloc<Throwable>()) Throwable())->_constructor(message, cause); } - + x10aux::ref<Throwable> cause); protected: x10aux::ref<Throwable> _constructor() { return _constructor(x10aux::null, x10aux::null); @@ -75,10 +66,7 @@ buf.write(_serialization_id,m); } - virtual void _serialize_body(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { - buf.write(FMGL(cause),m); - buf.write(FMGL(message),m); - } + virtual void _serialize_body(x10aux::serialization_buffer &buf, x10aux::addr_map &m); template<class T> static x10aux::ref<T> _deserializer(x10aux::serialization_buffer &buf){ @@ -87,11 +75,7 @@ return this_; } - void _deserialize_body(x10aux::serialization_buffer &buf) { - FMGL(cause) = buf.read<x10aux::ref<Box<x10aux::ref<Throwable> > > >(); - FMGL(message) = buf.read<x10aux::ref<String> >(); - } - + void _deserialize_body(x10aux::serialization_buffer &buf); }; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -30,3 +30,4 @@ } } + Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Value.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Value.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Value.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -12,6 +12,10 @@ const serialization_id_t Value::_serialization_id = DeserializationDispatcher::addDeserializer(Value::_deserializer<Object>); +x10aux::ref<Value> Value::_make() { + return (new (x10aux::alloc<Value>()) Value())->_constructor(); +} + x10aux::ref<x10::lang::String> x10::lang::Value::toString() { return String::Lit("Value without toString defined."); } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Value.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Value.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Value.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -17,22 +17,19 @@ public: RTT_H_DECLS; - static x10aux::ref<Value> _make() - { return (new (x10aux::alloc<Value>()) Value())->_constructor(); } + static x10aux::ref<Value> _make(); x10aux::ref<Value> _constructor() { return this; } - static const x10aux::serialization_id_t _serialization_id; - virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { buf.write(_serialization_id,m); - }; + } virtual void _serialize_body(x10aux::serialization_buffer &, x10aux::addr_map &) { // there are no fields - }; + } template<class T> @@ -45,8 +42,6 @@ // there are no fields } - - virtual x10_int hashCode() { // All instances of Value are equal, so their hashcodes can be too. return 0; Modified: trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -18,6 +18,13 @@ using namespace x10::runtime; using namespace x10aux; +x10aux::ref<Deque> +Deque::_make() { + x10aux::ref<Deque> this_ = new (x10aux::alloc<Deque>()) Deque(); + this_->_constructor(); + return this_; +} + ref<Deque> Deque::_constructor() { queue = x10aux::alloc<Slots>(sizeof(Slots) + (INITIAL_QUEUE_CAPACITY * sizeof(void*))); memset(queue->data, 0, (INITIAL_QUEUE_CAPACITY * sizeof(void*))); Modified: trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.h 2009-06-03 22:28:59 UTC (rev 8457) @@ -25,11 +25,7 @@ public: RTT_H_DECLS; - static x10aux::ref<Deque> _make() { - x10aux::ref<Deque> this_ = new (x10aux::alloc<Deque>()) Deque(); - this_->_constructor(); - return this_; - } + static x10aux::ref<Deque> _make(); x10aux::ref<Deque> _constructor(); Modified: trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.cc 2009-06-03 22:22:10 UTC (rev 8456) +++ trunk/x10.runtime.17/src-cpp/x10/runtime/Lock.cc 2009-06-03 22:28:59 UTC (rev 8457) @@ -27,6 +27,13 @@ using namespace x10aux; +x10aux::ref<Lock> +Lock::_make() { + x10aux::ref<Lock> this_ = new (x10aux::alloc<Lock>()) Lock(); + this_-... [truncated message content] |
From: <dgr...@us...> - 2009-06-05 19:26:20
|
Revision: 8470 http://x10.svn.sourceforge.net/x10/?rev=8470&view=rev Author: dgrove-oss Date: 2009-06-05 19:25:07 +0000 (Fri, 05 Jun 2009) Log Message: ----------- When compiling with optimization, disable C-level assertions. Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java trunk/x10.runtime.17/src-cpp/Makefile Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-06-05 19:24:12 UTC (rev 8469) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-06-05 19:25:07 UTC (rev 8470) @@ -486,6 +486,7 @@ public static final String[] preArgsOptimize = new String[] { "-O2", "-finline-functions", + "-DNDEBUG" }; private final X10CPPCompilerOptions options; Modified: trunk/x10.runtime.17/src-cpp/Makefile =================================================================== --- trunk/x10.runtime.17/src-cpp/Makefile 2009-06-05 19:24:12 UTC (rev 8469) +++ trunk/x10.runtime.17/src-cpp/Makefile 2009-06-05 19:25:07 UTC (rev 8470) @@ -23,8 +23,8 @@ endif ifdef OPTIMIZE - CXXFLAGS += -O2 -finline-functions - CFLAGS += -O2 -finline-functions + CXXFLAGS += -O2 -finline-functions -DNDEBUG + CFLAGS += -O2 -finline-functions -DNDEBUG X10CPPFLAGS += -optimize endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <njn...@us...> - 2009-06-11 19:02:35
|
Revision: 8496 http://x10.svn.sourceforge.net/x10/?rev=8496&view=rev Author: njnystrom Date: 2009-06-11 19:02:27 +0000 (Thu, 11 Jun 2009) Log Message: ----------- - Type system refactoring. Add Context to isSubtype, typeEquals, etc. Now require Polyglot 3.1. - Remove self-constraints from constraint system. Instead pass in an environment constraint (sigma) computed from the Context. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbDepTypeNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbMacroTypeNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Async_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Await_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/ClosureCall_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Contains_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/FunctionTypeNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Future_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Tuple_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckExprGoal.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckReturnTypeGoal.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeDecl_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10AmbTypeNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Binary_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Boxed_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Call_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10CanonicalTypeNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Cast_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ClassBody_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ClassDecl.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ClassDecl_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ClockedLoop_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Conditional_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ConstructorCall_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Disamb_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10FieldDecl_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Field_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Formal_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10If_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Instanceof_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10LocalAssign_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Loop_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10MethodDecl_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10New_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Return_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Special_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Unary_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10While_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/extension/X10Ext_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/query/QueryEngine.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ClosureDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ClosureInstance.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ClosureInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/MacroType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ParameterType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeParamSubst.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ArraysMixin.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ConstructorDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ConstructorInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldDef.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodDef.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10PrimitiveType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ProcedureDef.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ProcedureInstance.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeMixin.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeObjectMixin.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/AnnotationChecker.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/ConstantPropagator.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/ExprFlattener.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Inliner.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10Caster.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10InnerClassRemover.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10LocalClassRemover.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler.p3/src/x10/parser/X10KWLexer.gi trunk/x10.compiler.p3/src/x10/parser/X10Parser.java trunk/x10.compiler.p3/src/x10/parser/X10Parserprs.java trunk/x10.compiler.p3/src/x10/parser/X10Parsersym.java trunk/x10.compiler.p3/src/x10/parser/x10.g trunk/x10.constraints/src/x10/constraint/Solver.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XField_c.java trunk/x10.constraints/src/x10/constraint/XFormula_c.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerm_c.java trunk/x10.constraints/stuff/x10/constraint/tests/EntailmentTest.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/types/X10CPPTypeSystem_c.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/ASTQuery.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/Emitter.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/SharedVarsMethods.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cuda/types/X10CUDATypeSystem_c.java trunk/x10.runtime.17/src-java/x10/types/ConstrainedType.java Added Paths: ----------- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/Subst.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeConstraint.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeConstraint_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeConstraint.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeConstraint_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeEnv.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeEnv_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10XLocal_c.java Removed Paths: ------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/PathType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/PathType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeSolver.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeProperty.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypePropertyAsPathTypeTransform.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/TypeProperty_c.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbDepTypeNode_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbDepTypeNode_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbDepTypeNode_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -18,6 +18,7 @@ import polyglot.ast.TypeNode_c; import polyglot.ext.x10.extension.X10Del; import polyglot.ext.x10.extension.X10Del_c; +import polyglot.ext.x10.types.TypeConstraint; import polyglot.ext.x10.types.X10ClassType; import polyglot.ext.x10.types.X10Context; import polyglot.ext.x10.types.X10TypeMixin; @@ -124,23 +125,11 @@ DepParameterExpr dep = (DepParameterExpr) n.visitChild(n.dep, childtc); - XConstraint c = Types.get(dep.xconstraint()); + XConstraint c = Types.get(dep.valueConstraint()); t = X10TypeMixin.xclause(t, c); sym.update(t); - Expr cond = dep != null ? dep.condition() : null; - - if (dep != null && cond != dep.condition()) { - dep = dep.condition(cond); - } - else if (dep == null && cond != null) { - dep = nf.DepParameterExpr(position(), cond); - XConstraint cc = (XConstraint) ts.xtypeTranslator().constraint(Collections.EMPTY_LIST, cond, (X10Context) tc.context()); - dep = dep.xconstraint(Types.ref(cc)); - dep = (DepParameterExpr) dep.disambiguate(tc).typeCheck(tc).checkConstants(tc); - } - CanonicalTypeNode result = nf.X10CanonicalTypeNode(position(), sym, dep); return postprocess(result, n, childtc); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbMacroTypeNode_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbMacroTypeNode_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AmbMacroTypeNode_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -217,7 +217,7 @@ if (prefix == null) { // Search the context. - Named n = c.find(ts.TypeDefMatcher(null, name.id(), typeArgs, argTypes)); + Named n = c.find(ts.TypeDefMatcher(null, name.id(), typeArgs, argTypes, c)); if (n instanceof MacroType) { mt = (MacroType) n; } @@ -226,7 +226,7 @@ if (prefix instanceof TypeNode) { TypeNode tn = (TypeNode) prefix; Type container = tn.type(); - mt = ts.findTypeDef(container, ts.TypeDefMatcher(container, name.id(), typeArgs, argTypes), tc.context().currentClassDef()); + mt = ts.findTypeDef(container, ts.TypeDefMatcher(container, name.id(), typeArgs, argTypes, c), c); } } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -28,10 +28,4 @@ */ public AssignPropertyCall args(List<Expr> args); public List<Expr> args(); - - /** Return a copy of this node with this.expr equal to the given expr. - * @see polyglot.ext.x10.ast.Await#expr(polyglot.ast.Expr) - */ - public AssignPropertyCall typeArgs(List<TypeNode> args); - public List<TypeNode> typeArgs(); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -54,32 +54,28 @@ */ public class AssignPropertyCall_c extends Stmt_c implements AssignPropertyCall { - List<TypeNode> typeArgs; List<Expr> arguments; /** * @param pos + * @param arguments * @param target * @param name - * @param arguments */ - public AssignPropertyCall_c(Position pos, List<TypeNode> typeArgs, List<Expr> arguments) { + public AssignPropertyCall_c(Position pos, List<Expr> arguments) { super(pos); - this.typeArgs = TypedList.copyAndCheck(typeArgs, TypeNode.class, true); this.arguments = TypedList.copyAndCheck(arguments, Expr.class, true); } public Term firstChild() { - return listChild(typeArgs, listChild(arguments, null)); + return listChild(arguments, null); } /* (non-Javadoc) * @see polyglot.ast.Term#acceptCFG(polyglot.visit.CFGBuilder, java.util.List) */ public List acceptCFG(CFGBuilder v, List succs) { - if (! typeArgs.isEmpty()) - v.visitCFGList(typeArgs, listChild(arguments, this), ENTRY); v.visitCFGList(arguments, this, EXIT); return succs; } @@ -99,25 +95,9 @@ return arguments; } - /** Return a copy of this node with this.expr equal to the given expr. - * @see polyglot.ext.x10.ast.Await#expr(polyglot.ast.Expr) - */ - public AssignPropertyCall typeArgs( List<TypeNode> args ) { - if (args == typeArgs) return this; - AssignPropertyCall_c n = (AssignPropertyCall_c) copy(); - n.typeArgs = TypedList.copyAndCheck(args, TypeNode.class, true); - return n; - } - - public List<TypeNode> typeArgs() { - return typeArgs; - } - public String toString() { StringBuffer sb = new StringBuffer(); sb.append("property"); - if (! typeArgs.isEmpty()) - sb.append(typeArgs); sb.append("("); boolean first = true; for (Expr e : arguments) { @@ -148,22 +128,14 @@ // property for the class reachable through the constructor. List<FieldInstance> definedProperties = ((X10ParsedClassType) thisConstructor.asInstance().container()).definedProperties(); - List<Type> definedTypeProperties = - ((X10ParsedClassType) thisConstructor.asInstance().container()).typeProperties(); int pSize = definedProperties.size(); int aSize = arguments.size(); if (aSize != pSize) { throw new SemanticException("The property initializer must have the same number of arguments as properties for the class.", position()); } - int tpSize = definedTypeProperties.size(); - int taSize = typeArgs.size(); - if (taSize != tpSize) { - throw new SemanticException("The property initializer must have the same number of type arguments as type properties for the class.", - position()); - } - checkAssignments(tc, pos, thisConstructor, definedProperties, definedTypeProperties); + checkAssignments(tc, pos, thisConstructor, definedProperties); List<Stmt> s = new ArrayList<Stmt>(pSize); @@ -189,17 +161,22 @@ return nf.AssignPropertyBody(pos, s, thisConstructor, definedProperties).del().typeCheck(tc); } - protected void checkAssignments(ContextVisitor tc, Position pos, X10ConstructorDef thisConstructor, List<FieldInstance> definedProperties, List<Type> definedTypeProperties) + protected void checkAssignments(ContextVisitor tc, Position pos, X10ConstructorDef thisConstructor, List<FieldInstance> definedProperties) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - Context ctx = tc.context(); + X10Context ctx = (X10Context) tc.context(); if (Types.get(thisConstructor.returnType()) instanceof UnknownType) { throw new SemanticException(); } Type returnType = Types.get(thisConstructor.returnType()); - XConstraint result = X10TypeMixin.xclause(returnType); +// XConstraint result = X10TypeMixin.xclause(returnType); + XConstraint result = X10TypeMixin.realX(returnType); + + if (result.valid()) + result = null; + if (result != null) { XConstraint known = Types.get(thisConstructor.supClause()); known = (known==null ? new XConstraint_c() : known.copy()); @@ -215,8 +192,6 @@ Type initType = initializer.type(); final FieldInstance fii = definedProperties.get(i); XVar prop = (XVar) ts.xtypeTranslator().trans(known, known.self(), fii); - prop.setSelfConstraint(new XRef_c<XConstraint>() { - public XConstraint compute() { return X10TypeMixin.realX(fii.type()); } }); // Add in the real clause of the initializer with [self.prop/self] XConstraint c = X10TypeMixin.realX(initType); @@ -231,23 +206,11 @@ } } - for (int i = 0; i < typeArgs.size(); i++) { - TypeNode tn = typeArgs.get(i); - Type pt = definedTypeProperties.get(i); - XVar prop = (XVar) ts.xtypeTranslator().trans(pt); - prop = (XVar) prop.subst(known.self(), (XRoot) prop.rootVar()); - - // Add in the real clause of the initializer with [self.prop/self] - XTerm t = ts.xtypeTranslator().trans(known, tn, (X10Context) ctx); - known.addBinding(prop, t); - } - - // bind this==self; sup clause may constrain this. if (thisVar != null) known.addSelfBinding(thisVar); - if (! known.entails(result)) { + if (! known.entails(result, ctx.constraintProjection(known, result))) { throw new SemanticException("Instances created by this constructor satisfy " + known + "; this is not strong enough to entail the return constraint " + result, position()); @@ -262,9 +225,8 @@ /** Visit the children of the statement. */ public Node visitChildren(NodeVisitor v) { - List<TypeNode> typeArgs = visitList(this.typeArgs, v); List<Expr> args = visitList(this.arguments, v); - return typeArgs(typeArgs).args(args); + return args(args); } Expr expr; Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Async_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Async_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -11,25 +11,20 @@ import java.util.Iterator; import java.util.List; -import polyglot.ast.Block; -import polyglot.ast.CompoundStmt; import polyglot.ast.Expr; import polyglot.ast.Formal; import polyglot.ast.Node; import polyglot.ast.Stmt; +import polyglot.ast.Stmt_c; import polyglot.ast.Term; -import polyglot.ast.TypeNode; -import polyglot.ast.Stmt_c; import polyglot.ext.x10.types.X10Context; import polyglot.ext.x10.types.X10MethodDef; import polyglot.ext.x10.types.X10TypeSystem; import polyglot.main.Report; -import polyglot.types.CodeDef; import polyglot.types.Context; import polyglot.types.Ref; import polyglot.types.SemanticException; import polyglot.types.Type; -import polyglot.types.TypeSystem; import polyglot.util.CodeWriter; import polyglot.util.CollectionUtil; import polyglot.util.Position; @@ -39,6 +34,11 @@ import polyglot.visit.FlowGraph; import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; +import x10.constraint.XConstraint; +import x10.constraint.XConstraint_c; +import x10.constraint.XFailure; +import x10.constraint.XTerm; +import x10.constraint.XTerms; /** * Created on Oct 5, 2004 @@ -133,40 +133,65 @@ /** * The evaluation of place and list of clocks is not in the scope of the async. */ - public Context enterScope(Context c) { + public Context enterChildScope(Node child, Context c) { if (Report.should_report(TOPICS, 5)) Report.report(5, "enter async scope"); - X10TypeSystem ts = (X10TypeSystem) c.typeSystem(); - X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); - if (c.currentCode() instanceof X10MethodDef) { - X10MethodDef outer = (X10MethodDef) c.currentCode(); - List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); - if (!capturedTypes.isEmpty()) { - asyncInstance = ((X10MethodDef) asyncInstance.copy()); - asyncInstance.setTypeParameters(capturedTypes); + X10Context xc = (X10Context) c; + if (child == this.body) { + X10TypeSystem ts = (X10TypeSystem) c.typeSystem(); + X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); + if (xc.currentCode() instanceof X10MethodDef) { + X10MethodDef outer = (X10MethodDef) c.currentCode(); + List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); + if (!capturedTypes.isEmpty()) { + asyncInstance = ((X10MethodDef) asyncInstance.copy()); + asyncInstance.setTypeParameters(capturedTypes); + } } + xc = (X10Context) xc.pushCode(asyncInstance); + + /* + + // Change the place constraint to here==p + if (xc == c) + xc = (X10Context) xc.pushBlock(); + + XConstraint_c pc = new XConstraint_c(); + XTerm here = ts.xtypeTranslator().transHere(); + XTerm there = null; + try { + if (place != null) + there = ts.xtypeTranslator().trans(pc, place, xc); + else + there = ts.xtypeTranslator().transHere(); + } + catch (SemanticException e) { + // The place cannot be represented as a constraint term. + } + + if (there == null) + there = pc.genEQV(XTerms.makeFreshName("place"), false); + + try { + pc.addBinding(here, there); + } + catch (XFailure e) { + } + + xc.setCurrentPlaceConstraint(pc); + + */ } - c = c.pushCode(asyncInstance); - return c; + return xc; } - /** - * The evaluation of place and list of clocks is not in the scope of the async. - */ - public Context enterChildScope(Node child, Context c) { - if (child != this.body) { - c = c.pop(); - } - return c; - } - public Node typeCheck(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); Type placeType = place.type(); Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place()); + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); if (! placeIsPlace) { throw new SemanticException( "Place expression of async must be of type \"" + @@ -180,7 +205,7 @@ for (Iterator i = clocks().iterator(); i.hasNext(); ) { Expr tn = (Expr) i.next(); Type t = tn.type(); - if (! t.isSubtype(ts.Clock())) { + if (! t.isSubtype(ts.Clock(), tc.context())) { throw new SemanticException("Type \"" + t + "\" must be x10.lang.clock.", tn.position()); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -90,7 +90,7 @@ Type placeType = place.type(); Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place()); + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); if ( ! placeIsPlace ) { if (! placeIsPlace) { throw new SemanticException( Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -144,7 +144,7 @@ Type placeType = place.type(); Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place()); + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); if (! placeIsPlace) { throw new SemanticException( "Place expression of at must be of type \"" + Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Await_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Await_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Await_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -85,7 +85,7 @@ public Node typeCheck(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - if (! ts.isSubtype(expr_.type(), ts.Boolean()) ) + if (! ts.isSubtype(expr_.type(), ts.Boolean(), tc.context()) ) throw new SemanticException("The argument to await, " + expr_ +", must be of type boolean.", position()); X10Context c = (X10Context) tc.context(); if (c.inNonBlockingCode()) Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/ClosureCall_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/ClosureCall_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/ClosureCall_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -23,14 +23,16 @@ import polyglot.ast.ProcedureCall; import polyglot.ast.Term; import polyglot.ast.TypeNode; -import polyglot.ext.x10.ast.X10Call_c.DumbMethodMatcher; import polyglot.ext.x10.types.ClosureDef; import polyglot.ext.x10.types.ClosureInstance; import polyglot.ext.x10.types.ClosureType; import polyglot.ext.x10.types.X10MethodInstance; import polyglot.ext.x10.types.X10MethodInstance_c; import polyglot.ext.x10.types.X10TypeSystem; +import polyglot.ext.x10.types.X10TypeSystem_c; +import polyglot.ext.x10.types.X10TypeSystem_c.DumbMethodMatcher; import polyglot.types.ClassDef; +import polyglot.types.Context; import polyglot.types.ErrorRef_c; import polyglot.types.Matcher; import polyglot.types.MethodDef; @@ -227,13 +229,14 @@ static Pair<MethodInstance,List<Expr>> tryImplicitConversions(final ClosureCall_c n, ContextVisitor tc, Type targetType, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { final X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - ClassDef currentClassDef = tc.context().currentClassDef(); + final Context context = tc.context(); + ClassDef currentClassDef = context.currentClassDef(); - List<MethodInstance> methods = ts.findAcceptableMethods(targetType, new DumbMethodMatcher(targetType, Name.make("apply"), typeArgs, argTypes), currentClassDef); + List<MethodInstance> methods = ts.findAcceptableMethods(targetType, new X10TypeSystem_c.DumbMethodMatcher(targetType, Name.make("apply"), typeArgs, argTypes, context)); Pair<MethodInstance,List<Expr>> p = X10New_c.<MethodDef,MethodInstance>tryImplicitConversions(n, tc, targetType, methods, new X10New_c.MatcherMaker<MethodInstance>() { public Matcher<MethodInstance> matcher(Type ct, List<Type> typeArgs, List<Type> argTypes) { - return ts.MethodMatcher(ct, Name.make("apply"), typeArgs, argTypes); + return ts.MethodMatcher(ct, Name.make("apply"), typeArgs, argTypes, context); } }); @@ -270,7 +273,8 @@ // First try to find the method without implicit conversions. try { - mi = ts.findMethod(targetType, ts.MethodMatcher(targetType, Name.make("apply"), typeArgs, actualTypes), tc.context().currentClassDef()); + Context context = tc.context(); + mi = ts.findMethod(targetType, ts.MethodMatcher(targetType, Name.make("apply"), typeArgs, actualTypes, context)); args = this.arguments; } catch (SemanticException e) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -29,6 +29,7 @@ import polyglot.ext.x10.types.ClosureDef; import polyglot.ext.x10.types.X10ClassDef; import polyglot.ext.x10.types.X10MemberDef; +import polyglot.ext.x10.types.X10TypeMixin; import polyglot.ext.x10.types.X10TypeSystem; import polyglot.frontend.Globals; import polyglot.main.Report; @@ -59,6 +60,7 @@ import polyglot.visit.TypeBuilder; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; +import x10.constraint.XConstraint; import x10.constraint.XRoot; import x10.constraint.XTerms; @@ -239,7 +241,7 @@ Collections.<Ref<? extends Type>>emptyList(), Collections.<Ref<? extends Type>>emptyList(), thisVar, - Collections.<LocalDef>emptyList(), null, Collections.<Ref<? extends Type>>emptyList()); + Collections.<LocalDef>emptyList(), null, null, Collections.<Ref<? extends Type>>emptyList()); if (returnType() instanceof UnknownTypeNode) { mi.inferReturnType(true); @@ -251,8 +253,10 @@ Closure_c n = (Closure_c) this.del().visitChildren(tb2); - if (n.guard() != null) - mi.setGuard(n.guard().xconstraint()); + if (n.guard() != null) { + mi.setGuard(n.guard().valueConstraint()); + mi.setTypeGuard(n.guard().typeConstraint()); + } List<Ref<? extends Type>> typeParameters = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); for (TypeParamNode tpn : n.typeParameters()) { @@ -375,7 +379,18 @@ ClassDef cd = x10ts.closureAnonymousClassDef(def); return n.type(cd.asType()); } + + @Override + public Node conformanceCheck(ContextVisitor tc) throws SemanticException { + for (TypeNode type : throwTypes()) { + XConstraint rc = X10TypeMixin.xclause(type.type()); + if (rc != null && ! rc.valid()) + throw new SemanticException("Cannot throw a dependent type.", type.position()); + } + return super.conformanceCheck(tc); + } + public Term firstChild() { return listChild(typeParameters(), listChild(formals(), returnType)); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Contains_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Contains_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Contains_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -19,15 +19,12 @@ import polyglot.ast.Expr_c; import polyglot.ast.Node; import polyglot.ast.Term; -import polyglot.ext.x10.types.PathType_c; import polyglot.ext.x10.types.X10MethodInstance; -import polyglot.ext.x10.types.X10TypeMixin; import polyglot.ext.x10.types.X10TypeSystem; -import polyglot.ext.x10.types.X10TypeSystem_c; import polyglot.types.ClassDef; -import polyglot.types.SemanticException; +import polyglot.types.Context; import polyglot.types.Name; -import polyglot.types.StructType; +import polyglot.types.SemanticException; import polyglot.types.Type; import polyglot.util.CodeWriter; import polyglot.util.Position; @@ -116,8 +113,9 @@ // Check if there is a method with the appropriate name and type with the left operand as receiver. try { List<Type> args = Collections.singletonList(itemType); - ClassDef curr = tc.context().currentClassDef(); - X10MethodInstance mi = (X10MethodInstance) ts.findMethod(collType, ts.MethodMatcher(collType, Name.make("$in"), args), curr); + Context context = tc.context(); + ClassDef curr = context.currentClassDef(); + X10MethodInstance mi = (X10MethodInstance) ts.findMethod(collType, ts.MethodMatcher(collType, Name.make("$in"), args, context)); return type(mi.returnType()); } catch (SemanticException e) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -18,6 +18,7 @@ import polyglot.ast.Expr; import polyglot.ast.Formal; import polyglot.ast.TypeNode; +import polyglot.ext.x10.types.TypeConstraint; import polyglot.types.Ref; import x10.constraint.XConstraint; @@ -30,9 +31,12 @@ List<Formal> formals(); DepParameterExpr formals(List<Formal> formals); - Expr condition(); - DepParameterExpr condition(Expr cond); + List<Expr> condition(); + DepParameterExpr condition(List<Expr> cond); - Ref<XConstraint> xconstraint(); - DepParameterExpr xconstraint(Ref<XConstraint> c); + Ref<XConstraint> valueConstraint(); + DepParameterExpr valueConstraint(Ref<XConstraint> c); + + Ref<TypeConstraint> typeConstraint(); + DepParameterExpr typeConstraint(Ref<TypeConstraint> c); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/DepParameterExpr_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -13,20 +13,21 @@ package polyglot.ext.x10.ast; import java.util.Collections; +import java.util.LinkedList; import java.util.List; +import polyglot.ast.Binary; import polyglot.ast.Expr; import polyglot.ast.Formal; import polyglot.ast.Node; +import polyglot.ast.NodeFactory; import polyglot.ast.Node_c; import polyglot.ast.TypeCheckFragmentGoal; -import polyglot.ext.x10.types.ClosureDef; +import polyglot.ext.x10.types.TypeConstraint; +import polyglot.ext.x10.types.TypeConstraint_c; import polyglot.ext.x10.types.X10Context; -import polyglot.ext.x10.types.X10ProcedureDef; import polyglot.ext.x10.types.X10TypeSystem; -import polyglot.ext.x10.types.XTypeTranslator; import polyglot.frontend.SetResolverGoal; -import polyglot.types.CodeDef; import polyglot.types.Context; import polyglot.types.LazyRef; import polyglot.types.Ref; @@ -44,8 +45,6 @@ import polyglot.visit.TypeChecker; import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; -import x10.constraint.XRoot; -import x10.constraint.XTerm; /** An immutable representation of a dependent type constraint. * The corresponding syntax is [T](e){x: T; c} @@ -60,23 +59,25 @@ /** The boolean condition of a parameteric type. * Maybe null. */ - protected Expr condition; + protected List<Expr> condition; - private Ref<XConstraint> xconstraint; + private Ref<XConstraint> valueConstraint; + private Ref<TypeConstraint> typeConstraint; /** * @param pos */ - public DepParameterExpr_c(Position pos, List<Formal> formals, Expr cond) { + public DepParameterExpr_c(Position pos, List<Formal> formals, List<Expr> e) { super(pos); if (formals == null) this.formals = Collections.EMPTY_LIST; else this.formals = TypedList.copyAndCheck(formals, Formal.class, true); - this.condition = cond; + assert e != null; + this.condition = TypedList.copyAndCheck(e, Expr.class, true); } - public DepParameterExpr_c(Position pos, Expr cond) { - this(pos, null, cond); + public DepParameterExpr_c(Position pos, List<Expr> e) { + this(pos, null, e); } @Override public Context enterChildScope(Node child, Context c) { @@ -101,16 +102,26 @@ return super.enterChildScope(child, c); } - public Ref<XConstraint> xconstraint() { - return xconstraint; + public Ref<XConstraint> valueConstraint() { + return valueConstraint; } - public DepParameterExpr xconstraint(Ref<XConstraint> c) { + public DepParameterExpr valueConstraint(Ref<XConstraint> c) { DepParameterExpr_c n = (DepParameterExpr_c) copy(); - n.xconstraint = c; + n.valueConstraint = c; return n; } + public Ref<TypeConstraint> typeConstraint() { + return typeConstraint; + } + + public DepParameterExpr typeConstraint(Ref<TypeConstraint> c) { + DepParameterExpr_c n = (DepParameterExpr_c) copy(); + n.typeConstraint = c; + return n; + } + public List<Formal> formals() { return this.formals; } @@ -120,16 +131,16 @@ return n; } - public Expr condition() { + public List<Expr> condition() { return this.condition; } - public DepParameterExpr condition( Expr condition) { + public DepParameterExpr condition( List<Expr> condition) { DepParameterExpr_c n = (DepParameterExpr_c) copy(); n.condition = condition; return n; } - protected DepParameterExpr reconstruct( List<Formal> formals, Expr condition ) { + protected DepParameterExpr reconstruct( List<Formal> formals, List<Expr> condition ) { if (formals == this.formals && condition == this.condition) return this; DepParameterExpr_c n = (DepParameterExpr_c) copy(); @@ -141,23 +152,31 @@ @Override public Node visitChildren(NodeVisitor v) { List<Formal> formals = visitList(this.formals, v); - Expr condition = (Expr) visitChild(this.condition, v); + List<Expr> condition = (List<Expr>) visitList(this.condition, v); return reconstruct(formals, condition); } public Node buildTypes(TypeBuilder tb) throws SemanticException { DepParameterExpr_c n = (DepParameterExpr_c) copy(); - n.xconstraint = Types.<XConstraint>lazyRef(new XConstraint_c(), new SetResolverGoal(tb.job())); + n.valueConstraint = Types.<XConstraint>lazyRef(new XConstraint_c(), new SetResolverGoal(tb.job())); + n.typeConstraint = Types.<TypeConstraint>lazyRef(new TypeConstraint_c(), new SetResolverGoal(tb.job())); return n; } public void setResolver(Node parent, final TypeCheckPreparer v) { TypeChecker tc = new TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo()); tc = (TypeChecker) tc.context(v.context().freeze()); - - LazyRef<XConstraint> xr = (LazyRef<XConstraint>) xconstraint; - assert xr != null : "setResolver pass run before buildTypes for " + this; - xr.setResolver(new TypeCheckFragmentGoal(parent, this, tc, xr, false)); + + { + LazyRef<XConstraint> xr = (LazyRef<XConstraint>) valueConstraint; + assert xr != null : "setResolver pass run before buildTypes for " + this; + xr.setResolver(new TypeCheckFragmentGoal(parent, this, tc, xr, false)); + } + { + LazyRef<TypeConstraint> xr = (LazyRef<TypeConstraint>) typeConstraint; + assert xr != null : "setResolver pass run before buildTypes for " + this; + xr.setResolver(new TypeCheckFragmentGoal(parent, this, tc, xr, false)); + } } @Override @@ -165,9 +184,7 @@ DepParameterExpr_c n = (DepParameterExpr_c) super.disambiguate(ar); if (((X10Context) ar.context()).inAnnotation() && condition == null) { - Expr lit = ar.nodeFactory().BooleanLit(position(), true); - lit = (Expr) this.visitChild(lit, ar); - return n.condition(lit); + return n.condition(Collections.EMPTY_LIST); } return n; @@ -186,17 +203,50 @@ // position()); } - Type t = condition.type(); + Expr values = null; + Expr types = null; + + LinkedList<Expr> cond = new LinkedList<Expr>(); + cond.addAll(condition); + + while (! cond.isEmpty()) { + Expr e = cond.removeFirst(); + Type t = e.type(); + + if (! t.isBoolean()) + throw new SemanticError("The type of the constraint "+ e + + " must be boolean, not " + t + ".", position()); + + if (e instanceof Binary) { + Binary b = (Binary) e; + if (b.operator() == Binary.COND_AND || b.operator() == Binary.BIT_AND) { + cond.addFirst(b.left()); + cond.addFirst(b.right()); + continue; + } + } + + NodeFactory nf = tc.nodeFactory(); + + if (e instanceof SubtypeTest) { + if (types == null) + types = e; + else + types = nf.Binary(new Position(types.position(), e.position()), types, Binary.COND_AND, e).type(ts.Boolean()); + } + else { + if (values == null) + values = e; + else + values = nf.Binary(new Position(values.position(), e.position()), values, Binary.COND_AND, e).type(ts.Boolean()); + } + } - if (! t.isBoolean()) - throw new SemanticError("The type of the dependent clause, "+ condition - + ", must be boolean and not " + t + ".", position()); + XConstraint xvc = ts.xtypeTranslator().constraint(formals, values, (X10Context) tc.context()); + ((LazyRef<XConstraint>) valueConstraint).update(xvc); -// if (cd instanceof ClosureDef) { -// thisVar = null; -// } - XConstraint xc = ts.xtypeTranslator().constraint(formals, condition, (X10Context) tc.context()); - ((LazyRef<XConstraint>) xconstraint).update(xc); + TypeConstraint xtc = ts.xtypeTranslator().typeConstraint(formals, types, (X10Context) tc.context()); + ((LazyRef<TypeConstraint>) typeConstraint).update(xtc); return this; } @@ -234,9 +284,10 @@ if (! sep.equals("")) sep = "; "; - if (condition != null) { - w.write(sep); - printBlock( condition, w, tr); + for (Expr e: condition) { + w.write(sep); + printBlock( e, w, tr); + sep = ", "; } w.write("}"); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/FunctionTypeNode_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/FunctionTypeNode_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/FunctionTypeNode_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -89,7 +89,8 @@ Type result = ts.closureType(position(), returnType.typeRef(), typeParams, formalTypes, formalNames, - guard != null ? guard.xconstraint() : null, + guard != null ? guard.valueConstraint() : null, + guard != null ? guard.typeConstraint() : null, throwTypes); // Context c = ar.context(); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Future_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Future_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Future_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -90,7 +90,7 @@ Type placeType = place.type(); Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place()); + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); if ( ! placeIsPlace ) { if (! placeIsPlace) { throw new SemanticException( Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -35,7 +35,9 @@ import polyglot.ext.x10.types.X10MethodInstance; import polyglot.ext.x10.types.X10TypeMixin; import polyglot.ext.x10.types.X10TypeSystem; +import polyglot.frontend.Globals; import polyglot.types.ClassDef; +import polyglot.types.Context; import polyglot.types.Flags; import polyglot.types.MethodInstance; import polyglot.types.SemanticException; @@ -97,13 +99,23 @@ Call c = nf.Call(position(), array, nf.Id(position(), apply), index); if (mi != null) { X10TypeSystem xts = (X10TypeSystem) mi.typeSystem(); + if (true) { + ContextVisitor tc = new ContextVisitor(Globals.currentJob(), xts, nf); + tc = tc.context(xts.emptyContext()); + try { + return (Expr) c.del().disambiguate(tc).typeCheck(tc).checkConstants(tc); + } + catch (SemanticException e) { + assert false; + } + } List<Type> argTypes = new ArrayList<Type>(mi.formalTypes()); argTypes.remove(0); MethodInstance ami = null; try { + Context context = xts.emptyContext(); // ### not right -- should do context(this) ami = xts.findMethod(mi.container(), - xts.MethodMatcher(mi.container(), apply, argTypes), - mi.container().toClass().def()); + xts.MethodMatcher(mi.container(), apply, argTypes, context)); } catch (SemanticException e) { assert (false); } @@ -194,7 +206,22 @@ X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10TypeSystem xts = ts; - + + if (op != Assign.ASSIGN) { + Name methodName = Name.make("apply"); + + List<Expr> args = new ArrayList<Expr>(); + args.addAll(index); + X10Call_c n = (X10Call_c) nf.X10Call(position(), array, nf.Id(position(), methodName), Collections.EMPTY_LIST, args); + + try { + n = (X10Call_c) n.del().disambiguate(tc).typeCheck(tc).checkConstants(tc); + } + catch (SemanticException e) { + throw new SemanticException("Cannot assign to element of " + array.type() + "; " + e.getMessage(), position()); + } + } + Name methodName = Name.make("set"); List<Expr> args = new ArrayList<Expr>(); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Tuple_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Tuple_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Tuple_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -132,7 +132,7 @@ for (Expr e : elements) { if (e == child) { - if (ts.numericConversionValid(base, e.constantValue())) { + if (ts.numericConversionValid(base, e.constantValue(), av.context())) { return child.type(); } else { @@ -164,7 +164,7 @@ type = e.type(); } else { - type = ts.leastCommonAncestor(type, e.type()); + type = ts.leastCommonAncestor(type, e.type(), tc.context()); } } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckExprGoal.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckExprGoal.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckExprGoal.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -21,6 +21,7 @@ import polyglot.types.LazyRef; import polyglot.types.Type; import polyglot.util.CollectionUtil; +import polyglot.util.ErrorInfo; import polyglot.visit.TypeChecker; public class TypeCheckExprGoal extends AbstractGoal_c { @@ -50,6 +51,7 @@ assert g.hasBeenReached(); if (state() == Goal.Status.RUNNING_RECURSIVE) { + v.job().compiler().errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR, "Could not infer type; possible recursive or ambiguous initialization.", n.position()); r.update(v.typeSystem().unknownType(n.position())); return false; } @@ -77,4 +79,9 @@ return false; } } + + @Override + public String toString() { + return name() + "[" + n + "] (" + stateString() + ")"; + } } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckReturnTypeGoal.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckReturnTypeGoal.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeCheckReturnTypeGoal.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -18,10 +18,6 @@ @Override public boolean runTask() { TypeSystem ts = v.typeSystem(); - if (r.locked()) { - ((Ref<Type>) r).update(ts.unknownType(n.position())); - return mightFail; - } boolean result = super.runTask(); if (result) { if (r.getCached() instanceof UnknownType) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeDecl_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeDecl_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeDecl_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -22,23 +22,19 @@ import polyglot.ext.x10.types.AnnotatedType; import polyglot.ext.x10.types.ConstrainedType; import polyglot.ext.x10.types.MacroType; -import polyglot.ext.x10.types.PathType; import polyglot.ext.x10.types.TypeDef; import polyglot.ext.x10.types.TypeDef_c; import polyglot.ext.x10.types.X10ClassDef; -import polyglot.ext.x10.types.X10MemberDef; import polyglot.ext.x10.types.X10ParsedClassType; import polyglot.ext.x10.types.X10TypeMixin; import polyglot.ext.x10.types.X10TypeSystem; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.Context; -import polyglot.types.Def; import polyglot.types.Flags; import polyglot.types.LazyRef; import polyglot.types.LocalDef; import polyglot.types.MemberDef; -import polyglot.types.Name; import polyglot.types.Named; import polyglot.types.Package; import polyglot.types.QName; @@ -55,11 +51,7 @@ import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; import x10.constraint.XFailure; -import x10.constraint.XName; -import x10.constraint.XNameWrapper; -import x10.constraint.XRef_c; import x10.constraint.XRoot; -import x10.constraint.XTerms; public class TypeDecl_c extends Term_c implements TypeDecl { private TypeNode type; @@ -239,7 +231,7 @@ typeDef = new TypeDef_c(ts, position(), Flags.NONE, name.id(), null, Collections.EMPTY_LIST, thisVar, - Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, null); + Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, null, null); } else { if (ct == null) @@ -248,7 +240,7 @@ typeDef = new TypeDef_c(ts, position(), topLevel ? flags.flags().Static() : flags.flags(), name.id(), Types.ref(ct.asType()), Collections.EMPTY_LIST, thisVar, - Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, null); + Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, null, null); ct.addMemberType(typeDef); } @@ -290,10 +282,12 @@ } typeDef.setFormalTypes(formalTypes); typeDef.setFormalNames(formalNames); - - if (n.guard != null) - typeDef.setGuard(n.guard.xconstraint()); + if (n.guard != null) { + typeDef.setGuard(n.guard.valueConstraint()); + typeDef.setTypeGuard(n.guard.typeConstraint()); + } + if (n.type != null) { TypeNode tn = (TypeNode) n.visitChild(n.type, tb2); n = (TypeDecl_c) n.type(tn); @@ -342,10 +336,6 @@ for (Type t : ct.interfaces()) checkCycles(t); } - if (type instanceof PathType) { - PathType ct = (PathType) type; - checkCycles(ct.baseType()); - } if (type instanceof AnnotatedType) { AnnotatedType ct = (AnnotatedType) type; checkCycles(ct.baseType()); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -11,7 +11,6 @@ import polyglot.ast.Id; import polyglot.ast.Term; import polyglot.ext.x10.types.ParameterType; -import polyglot.ext.x10.types.TypeProperty; import polyglot.types.Ref; import polyglot.types.Type; @@ -21,6 +20,6 @@ ParameterType type(); TypeParamNode type(ParameterType type); - public TypeProperty.Variance variance(); - public TypeParamNode variance(TypeProperty.Variance variance); + public ParameterType.Variance variance(); + public TypeParamNode variance(ParameterType.Variance variance); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypeParamNode_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -16,26 +16,14 @@ import polyglot.ast.Term_c; import polyglot.ext.x10.types.ParameterType; import polyglot.ext.x10.types.ParameterType_c; -import polyglot.ext.x10.types.TypeDef; -import polyglot.ext.x10.types.TypeProperty; -import polyglot.ext.x10.types.TypeProperty_c; import polyglot.ext.x10.types.X10Context; import polyglot.ext.x10.types.X10TypeSystem; -import polyglot.ext.x10.types.TypeProperty.Variance; -import polyglot.types.ClassDef; -import polyglot.types.CodeDef; import polyglot.types.Context; import polyglot.types.Def; -import polyglot.types.FieldDef; import polyglot.types.Named; -import polyglot.types.ProcedureDef; -import polyglot.types.Qualifier; -import polyglot.types.Ref; import polyglot.types.SemanticException; -import polyglot.types.Type; import polyglot.types.Types; import polyglot.util.CodeWriter; -import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.CFGBuilder; import polyglot.visit.NodeVisitor; @@ -45,9 +33,9 @@ public class TypeParamNode_c extends Term_c implements TypeParamNode { protected Id name; protected ParameterType type; - TypeProperty.Variance variance; + ParameterType.Variance variance; - public TypeParamNode_c(Position pos, Id name, TypeProperty.Variance variance) { + public TypeParamNode_c(Position pos, Id name, ParameterType.Variance variance) { super(pos); this.name = name; this.variance = variance; @@ -63,11 +51,11 @@ return n; } - public TypeProperty.Variance variance() { + public ParameterType.Variance variance() { return variance; } - public TypeParamNode variance(TypeProperty.Variance variance) { + public TypeParamNode variance(ParameterType.Variance variance) { TypeParamNode_c n = (TypeParamNode_c) copy(); n.variance = variance; return n; Deleted: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -1,22 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package polyglot.ext.x10.ast; - -import polyglot.ast.Id; -import polyglot.ast.Node; -import polyglot.ext.x10.types.TypeProperty; - -public interface TypePropertyNode extends Node { - Id name(); - TypePropertyNode name(Id id); - - TypeProperty typeProperty(); - public TypeProperty.Variance variance(); - public TypePropertyNode variance(TypeProperty.Variance variance); -} Deleted: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode_c.java 2009-06-11 18:55:55 UTC (rev 8495) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/TypePropertyNode_c.java 2009-06-11 19:02:27 UTC (rev 8496) @@ -1,107 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package polyglot.ext.x10.ast; - -import java.util.List; - -import polyglot.ast.Id; -import polyglot.ast.Node; -import polyglot.ast.Node_c; -import polyglot.ast.Term; -import polyglot.ast.Term_c; -import polyglot.ext.x10.types.ParameterType_c; -import polyglot.ext.x10.types.TypeProperty; -import polyglot.ext.x10.types.TypeProperty_c; -import polyglot.ext.x10.types.X10ClassDef; -import polyglot.ext.x10.types.X10ClassType; -import polyglot.ext.x10.types.X10Context; -import polyglot.ext.x10.types.X10TypeSystem; -import polyglot.types.Context; -import polyglot.types.Named; -import polyglot.types.Qualifier; -import polyglot.types.Ref; -import polyglot.types.SemanticException; -import polyglot.types.Type; -import polyglot.types.Types; -import polyglot.util.CodeWriter; -import polyglot.util.Position; -import polyglot.visit.CFGBuilder; -import polyglot.visit.NodeVisitor; -import polyglot.visit.PrettyPrinter; -import polyglot.visit.TypeBuilder; - -public class TypePropertyNode_c extends Node_c implements TypePropertyNode { - protected Id name; -... [truncated message content] |
From: <spa...@us...> - 2009-06-11 23:25:21
|
Revision: 8518 http://x10.svn.sourceforge.net/x10/?rev=8518&view=rev Author: sparksparkspark Date: 2009-06-11 23:25:18 +0000 (Thu, 11 Jun 2009) Log Message: ----------- 1) Tweak build scripts to build generated cc,h,inc files before everything else 2) Build a single archive file with both generated and hand-written code in it. 3) Make NullPointerException an X10 class again (just to test that we nolonger need these dependencies to be part of the native library) 4) Remove use of DEPENDENCIES.txt (if we want to do this, we should do it by explicitly calling the initialisers from template_main). Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java trunk/x10.runtime.17/src-cpp/DEPENDENCIES.txt trunk/x10.runtime.17/src-cpp/Makefile trunk/x10.runtime.17/src-cpp/x10rt17.h trunk/x10.runtime.17/src-x10/x10/lang/NullPointerException.x10 Removed Paths: ------------- trunk/x10.runtime.17/src-cpp/test.cc trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-06-11 23:25:18 UTC (rev 8518) @@ -445,7 +445,7 @@ public static final String TRANSPORT = System.getenv("X10RT_TRANSPORT")==null?DEFAULT_TRANSPORT:System.getenv("X10RT_TRANSPORT"); public static final boolean USE_XLC = System.getenv("USE_XLC")!=null; - public static final String MANIFEST = "libx10lib17.mft"; + public static final String MANIFEST = "libx10.mft"; public static final String[] MANIFEST_LOCATIONS = new String[] { X10LANG, X10LANG+"/lib", @@ -465,8 +465,7 @@ "-L"+X10LIB+"/lib", "-L"+X10LANG, "-L"+X10LANG+"/lib", // dist - "-lx10lib17", - "-lx10rt17", + "-lx10", "-lupcrts_"+TRANSPORT, "-ldl", "-lm", Modified: trunk/x10.runtime.17/src-cpp/DEPENDENCIES.txt =================================================================== --- trunk/x10.runtime.17/src-cpp/DEPENDENCIES.txt 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/DEPENDENCIES.txt 2009-06-11 23:25:18 UTC (rev 8518) @@ -1,3 +1,5 @@ +NOTE this file is no-longer used, it is here for historical reference only + x10/runtime/NativeRuntime.cc x10/lang/Place.cc x10/runtime/Runtime.cc Modified: trunk/x10.runtime.17/src-cpp/Makefile =================================================================== --- trunk/x10.runtime.17/src-cpp/Makefile 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/Makefile 2009-06-11 23:25:18 UTC (rev 8518) @@ -22,14 +22,16 @@ INCLUDE_DIRS += -I$(BDWGC_INCLUDE_DIR) endif +#avoid specifying -NDEBUG twice ifdef OPTIMIZE - CXXFLAGS += -DNDEBUG + USE_NDEBUG := -DNDEBUG X10CPPFLAGS += -optimize endif - ifdef NO_CHECKS - CXXFLAGS += -DNDEBUG -DNO_CHECKS + USE_NDEBUG := -DNDEBUG + CXXFLAGS += -DNO_CHECKS endif +CXXFLAGS += $(USE_NDEBUG) ifdef ENABLE_CUDA CXXFLAGS += -DX10_USE_CUDA_HOST @@ -37,7 +39,7 @@ ALL_CUDA_OBJECTS += x10aux/cuda/cuda_utils.o endif -CXXFLAGS += $(INCLUDE_DIRS) +CXXFLAGS += $(INCLUDE_DIRS) -Igen ifeq ($(shell uname -s),AIX) @@ -86,9 +88,6 @@ INSTDIR = $(call abspath,../../x10.dist) -XRCPP_ARCHIVE = libx10rt17.a -XRX_ARCHIVE = libx10lib17.a -XRX_MANIFEST = libx10lib17.mft @@ -96,18 +95,60 @@ # Targets # ########### -all: $(X10LIB)/include/x10/x10.h $(XRCPP_ARCHIVE) +XRX_ARCHIVE = libx10.a +XRX_MANIFEST = libx10.mft -xrx: $(XRX_ARCHIVE) +# if this doesn't exist, we need to build pgas first +PGAS_SANITY_CHECK=$(X10LIB)/include/x10/x10.h -.PHONY: all xrx +# this builds everything +xrx: $(XRX_ARCHIVE) $(PGAS_SANTIY_CHECK) +.PHONY: xrx -################################ -# XRCPP Manually-written Files # -################################ +################### +# Generated Files # +################### + +# First thing to do: compile x10 files to cc,h,inc + + +# A list of all .x10 files (relative to the src-cpp dir) that we should build +# into the xrx lib. +XRXFILES = $(shell find ../src-x10 -name '*.x10') + +#enable asserts, do not look in jar for x10 files +X10CPPFLAGS += -J-ea -rtdev -disable CheckNativeAnnotations -commandlineonly + +# Generate .cc .inc and .h files for all the X10 classes defined in the above +# .x10 files. Rebuilding occurs if the x10 backend is updated or if any of the +# currently present x10 files are newer than the 'all-cpp-generated' file. +# Note that nothing gets rebuilt if one of the .x10 files is deleted, however +# this simply means there will be more symbols in the archive than there should +# be. This is harmless and equivalent to the old behaviour of this Makefile, +# i.e. a make clean is needed. +gen/all-cpp-generated: $(XRXFILES) $(INSTDIR)/lib/x10cpp.jar + @echo "Regenerating XRX cc/h/inc files" + mkdir -p gen + @#prune .svn dirs (they probably don't contain *.x10 files so this is just an optimisation) + cd ../src-x10 && find * -name .svn -prune -o -name \*.x10 -print | \ + xargs "$(INSTDIR)"/bin/x10c++ -c $(X10CPPFLAGS) -sourcepath . -d ../src-cpp/gen + touch $@ + +# $(XRX_MANIFEST) is a list of all .cc files (relative to the ./gen dir) that +# should be included in the $(XRX_ARCHIVE). +$(XRX_MANIFEST): gen/all-cpp-generated + (cd gen && find * -name \*.cc -print) > $@ + + + + +########################## +# Manually-written Files # +########################## + ALL_XRCPP_OBJECTS = \ x10aux/alloc.o \ x10aux/assert.o \ @@ -155,7 +196,6 @@ x10/lang/Fun.o \ x10/lang/Iterator.o \ x10/lang/Iterable.o \ - x10/lang/NullPointerException.o \ x10/lang/Object.o \ x10/lang/Rail.o \ x10/lang/Ref.o \ @@ -174,48 +214,20 @@ x10/util/concurrent/atomic/AtomicInteger.o \ x10/util/concurrent/atomic/AtomicLong.o +ALL_MANUAL_OBJECTS=$(ALL_XRCPP_OBJECTS) $(ALL_CUDA_OBJECTS) -$(XRCPP_ARCHIVE): $(ALL_XRCPP_OBJECTS) $(ALL_CUDA_OBJECTS) - $(AR) $(ARFLAGS) $@ $^ -######################### -# XRX 'Generated' Files # -######################### - -# A list of all .x10 files (relative to the src-cpp dir) that we should build -# into the xrx lib. -XRXFILES = $(shell find ../src-x10 -name '*.x10') - -# Generate .cc .inc and .h files for all the X10 classes defined in the above -# .x10 files. Rebuilding occurs if the x10 backend is updated or if any of the -# currently present x10 files are newer than the 'all-cpp-generated' file. -# Note that nothing gets rebuilt if one of the .x10 files is deleted, however -# this simply means there will be more symbols in the archive than there should -# be. This is harmless and equivalent to the old behaviour of this Makefile, -# i.e. a make clean is needed. -gen/all-cpp-generated: $(XRXFILES) $(INSTDIR)/lib/x10cpp.jar test.o - @echo "Regenerating XRX cc/h/inc files" - mkdir -p gen - cd ../src-x10 && find * -name .svn -prune -o -name \*.x10 -print | xargs "$(INSTDIR)"/bin/x10c++ $(X10CPPFLAGS) -d ../src-cpp/gen -J-ea -rtdev -sourcepath . -disable CheckNativeAnnotations -commandlineonly -c - touch $@ - -# $(XRX_MANIFEST) is a list of all .cc files (relative to the ./gen dir) that -# should be included in the $(XRX_ARCHIVE). There is a hack to ensure the -# contents of DEPENDENCIES.txt appear before everything else. -$(XRX_MANIFEST): gen/all-cpp-generated - (cd gen && find * -name \*.cc -print) | grep -f DEPENDENCIES.txt -v > gen/MANIFEST.raw - cat DEPENDENCIES.txt gen/MANIFEST.raw > $@ - # This target will build the XRX cc files into object files gen/all-o-generated: gen/all-cpp-generated $(XRX_MANIFEST) - CXXFLAGS="$(CXXFLAGS) -Igen" $(MAKE) $(MAKEFLAGS) $(shell sed -e 's@^\(.*\).cc$$@gen/\1.o@' $(XRX_MANIFEST)) + $(MAKE) $(MAKEFLAGS) $(shell sed -e 's@^\(.*\).cc$$@gen/\1.o@' $(XRX_MANIFEST)) touch $@ -$(XRX_ARCHIVE): gen/all-o-generated $(XRX_MANIFEST) - cd gen && $(AR) $(ARFLAGS) $@ $(shell sed -e 's@.cc$$@.o@' $(XRX_MANIFEST)) - @-cp gen/$@ . +$(XRX_ARCHIVE): gen/all-o-generated $(XRX_MANIFEST) $(ALL_MANUAL_OBJECTS) + $(AR) $(ARFLAGS) $@ \ + $(shell sed -e 's@^\(.*\).cc$$@gen/\1.o@' $(XRX_MANIFEST)) \ + $(ALL_MANUAL_OBJECTS) # The dummy files are needed to avoid rebuilds so must not be removed as # intermediate files usually are. @@ -223,7 +235,7 @@ -################### +################## # Install Targets # ################### @@ -241,7 +253,6 @@ find x10 -name \*.h | tar cf - $(INC_FLAG) | (cd $(INSTDIR)/include && tar xvf -) find x10aux -name \*.h | tar cf - $(INC_FLAG) | (cd $(INSTDIR)/include && tar xvf -) cp -p x10rt17.h $(INSTDIR)/include - cp -p $(XRCPP_ARCHIVE) $(INSTDIR)/lib cp -p $(XRX_ARCHIVE) $(INSTDIR)/lib cp -p $(XRX_MANIFEST) $(INSTDIR)/lib @@ -253,7 +264,15 @@ # Standard Stuff # ################## -%.o: %.cc %.h +# disable default rules +%:%.o +%:%.c +%:%.cc + +# want to make sure the x10 code has been compiled to cc,h,inc since the +# manually written code may #include some of the generated headers + +%.o: %.cc %.h gen/all-cpp-generated $(CXX) $(CXXFLAGS) -c $< -o $@ @@ -261,16 +280,21 @@ find . -name gen -prune -o \( -name '*.cc' -o -name '*.h' \) -print0 | xargs -r0 makedepend -I $(INCLUDE_DIRS) -fdepend.mk -clean: - find . -name gen -prune -o \( -name '*.h.gch' -o -name '*.o' -o -name '*.rpo' \) -print0 | xargs -0 -t rm -fr - rm -rf gen $(XRCPP_ARCHIVE) $(XRX_ARCHIVE) $(XRX_MANIFEST) +#nuke only object code +cleanobj: + find . \( -name '*.h.gch' -o -name '*.o' -o -name '*.rpo' \) -print0 | xargs -0 -t rm -fr +#nuke everything +cleangen: + rm -rf gen $(XRX_ARCHIVE) $(XRX_MANIFEST) +clean: cleanobj cleangen + squeakyclean: clean find . \( -name '*~' -o -name '*.bak' \) -print0 | xargs -r0 -t rm -f -.PHONY: depend clean squeakyclean +.PHONY: depend clean cleanobj cleangen squeakyclean # Optional file -- generated by makedepend (run "make depend"). Deleted: trunk/x10.runtime.17/src-cpp/test.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/test.cc 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/test.cc 2009-06-11 23:25:18 UTC (rev 8518) @@ -1,11 +0,0 @@ -#include <x10rt17.h> - -// The purpose of this file is just to include all the other headers to -// allow easy checking of syntax, etc. - -// One can run "make test.o all" instead of just "make" to additionally -// compile this file. - -// (Note that "make all" and "make" are equivalent.) - -// vim:tabstop=4:shiftwidth=4:expandtab Deleted: trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.cc 2009-06-11 23:25:18 UTC (rev 8518) @@ -1,33 +0,0 @@ -#include <x10aux/config.h> - -#include <x10/lang/NullPointerException.h> - -using namespace x10::lang; -using namespace x10aux; - -const serialization_id_t NullPointerException::_serialization_id = - DeserializationDispatcher::addDeserializer(NullPointerException::_deserializer<Object>); - -x10aux::ref<NullPointerException> -NullPointerException::_make() { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(); -} - -x10aux::ref<NullPointerException> -NullPointerException::_make(x10aux::ref<String> message) { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(message); -} - -x10aux::ref<NullPointerException> -NullPointerException::_make(x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(cause); -} - -x10aux::ref<NullPointerException> -NullPointerException::_make(x10aux::ref<String> message, x10aux::ref<Throwable> cause) { - return (new (x10aux::alloc<NullPointerException>()) NullPointerException())->_constructor(message, cause); -} - -RTT_CC_DECLS1(NullPointerException, "x10.lang.NullPointerException", RuntimeException) - -// vim:tabstop=4:shiftwidth=4:expandtab Deleted: trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/x10/lang/NullPointerException.h 2009-06-11 23:25:18 UTC (rev 8518) @@ -1,43 +0,0 @@ -#ifndef X10_LANG_NULLPOINTEREXCEPTION_H -#define X10_LANG_NULLPOINTEREXCEPTION_H - -#include <x10aux/config.h> -#include <x10aux/RTT.h> - -#include <x10/lang/RuntimeException.h> - -namespace x10 { - - namespace lang { - - class NullPointerException : public RuntimeException { - public: - RTT_H_DECLS; - - static x10aux::ref<NullPointerException> _make(); - static x10aux::ref<NullPointerException> _make(x10aux::ref<String> message); - static x10aux::ref<NullPointerException> _make(x10aux::ref<Throwable> cause); - static x10aux::ref<NullPointerException> _make(x10aux::ref<String> message, - x10aux::ref<Throwable> cause); - - static const x10aux::serialization_id_t _serialization_id; - - virtual void _serialize_id(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { - buf.write(_serialization_id,m); - } - - template<class T> static x10aux::ref<T> _deserializer(x10aux::serialization_buffer &buf); - }; - - template<class T> x10aux::ref<T> NullPointerException::_deserializer(x10aux::serialization_buffer &buf){ - x10aux::ref<NullPointerException> this_ = - new (x10aux::alloc<NullPointerException>()) NullPointerException(); - this_->_deserialize_body(buf); - return this_; - } - } -} - - -#endif -// vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10rt17.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10rt17.h 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-cpp/x10rt17.h 2009-06-11 23:25:18 UTC (rev 8518) @@ -64,7 +64,6 @@ #include <x10/lang/Fun_0_3.h> #include <x10/lang/Iterator.h> #include <x10/lang/Iterable.h> -#include <x10/lang/NullPointerException.h> #include <x10/lang/Object.h> #include <x10/lang/OutOfMemoryError.h> #include <x10/lang/Rail.h> Modified: trunk/x10.runtime.17/src-x10/x10/lang/NullPointerException.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/NullPointerException.x10 2009-06-11 22:14:06 UTC (rev 8517) +++ trunk/x10.runtime.17/src-x10/x10/lang/NullPointerException.x10 2009-06-11 23:25:18 UTC (rev 8518) @@ -12,7 +12,6 @@ import x10.compiler.NativeRep; @NativeRep("java", "java.lang.NullPointerException", null, null) -@NativeRep("c++", "x10aux::ref<x10::lang::NullPointerException>", "x10::lang::NullPointerException", null) public value NullPointerException extends RuntimeException { public def this() { super(); } public def this(message: String) { super(message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-07-10 22:11:35
|
Revision: 10666 http://x10.svn.sourceforge.net/x10/?rev=10666&view=rev Author: dgrove-oss Date: 2009-07-10 22:11:32 +0000 (Fri, 10 Jul 2009) Log Message: ----------- Better version of r10660. Instead of including bootstrap.h in all the .cc files, just include it in the Main template. Modified Paths: -------------- trunk/x10.cppbackend.17/data/MainMP.xcd trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h trunk/x10.runtime.17/src-cpp/x10aux/system_utils.h Modified: trunk/x10.cppbackend.17/data/MainMP.xcd =================================================================== --- trunk/x10.cppbackend.17/data/MainMP.xcd 2009-07-10 20:15:33 UTC (rev 10665) +++ trunk/x10.cppbackend.17/data/MainMP.xcd 2009-07-10 22:11:32 UTC (rev 10666) @@ -1,6 +1,7 @@ // SYNOPSIS: #0.main(...) ##include <x10/runtime/Runtime.h> +##include <x10aux/bootstrap.h> extern "C" { int main(int ac, char **av) { return x10aux::template_main<x10::runtime::Runtime,#0 >(ac,av); } } Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-07-10 20:15:33 UTC (rev 10665) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-07-10 22:11:32 UTC (rev 10666) @@ -673,7 +673,6 @@ } w.write("#include <"+cheader+">"); w.newline(); - w.write("#include <x10aux/bootstrap.h>"); w.newline(); // needed in case the body includes a main method w.forceNewline(0); w.forceNewline(0); Modified: trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h 2009-07-10 20:15:33 UTC (rev 10665) +++ trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h 2009-07-10 22:11:32 UTC (rev 10666) @@ -5,6 +5,7 @@ #include <x10aux/pgas.h> #include <x10aux/alloc.h> #include <x10aux/string_utils.h> +#include <x10aux/system_utils.h> #include <x10aux/init_dispatcher.h> #include <x10/lang/VoidFun_0_0.h> @@ -22,8 +23,6 @@ namespace x10aux { - extern x10_int exitCode; - typedef void (*ApplicationMainFunction)(ref<x10::lang::Rail<ref<x10::lang::String> > >); class BootStrapClosure : public x10::lang::Value, Modified: trunk/x10.runtime.17/src-cpp/x10aux/system_utils.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/system_utils.h 2009-07-10 20:15:33 UTC (rev 10665) +++ trunk/x10.runtime.17/src-cpp/x10aux/system_utils.h 2009-07-10 22:11:32 UTC (rev 10666) @@ -4,6 +4,9 @@ #include <x10aux/config.h> namespace x10aux { + + extern x10_int exitCode; + class system_utils { public: static void exit(x10_int code); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2009-07-24 19:07:47
|
Revision: 10871 http://x10.svn.sourceforge.net/x10/?rev=10871&view=rev Author: ipeshansky Date: 2009-07-24 19:07:39 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Apply a variant of Ganesh's patch to fix XTENLANG-477. Modified Paths: -------------- trunk/x10.runtime.17/src-cpp/x10aux/double_utils.cc trunk/x10.runtime.17/src-cpp/x10aux/float_utils.cc Added Paths: ----------- trunk/x10.tests/examples/Issues/XTENLANG_477.x10 Modified: trunk/x10.runtime.17/src-cpp/x10aux/double_utils.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/double_utils.cc 2009-07-24 16:57:51 UTC (rev 10870) +++ trunk/x10.runtime.17/src-cpp/x10aux/double_utils.cc 2009-07-24 19:07:39 UTC (rev 10871) @@ -25,9 +25,9 @@ } x10_double x10aux::double_utils::parseDouble(const ref<String>& s) { - (void) s; - assert(false); /* FIXME: STUBBED NATIVE */ - return 0; + // FIXME: what about null? + // FIXME: NumberFormatException + return strtod(s->c_str(), NULL); } x10_boolean x10aux::double_utils::isNaN(x10_double x) { Modified: trunk/x10.runtime.17/src-cpp/x10aux/float_utils.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/float_utils.cc 2009-07-24 16:57:51 UTC (rev 10870) +++ trunk/x10.runtime.17/src-cpp/x10aux/float_utils.cc 2009-07-24 19:07:39 UTC (rev 10871) @@ -27,7 +27,7 @@ x10_float x10aux::float_utils::parseFloat(const ref<String>& s) { // FIXME: what about null? // FIXME: NumberFormatException - return atof(s->c_str()); + return strtof(s->c_str(), NULL); } x10_boolean x10aux::float_utils::isNaN(x10_float x) { Added: trunk/x10.tests/examples/Issues/XTENLANG_477.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_477.x10 (rev 0) +++ trunk/x10.tests/examples/Issues/XTENLANG_477.x10 2009-07-24 19:07:39 UTC (rev 10871) @@ -0,0 +1,22 @@ +// (C) Copyright IBM Corporation 2009 +// This file is part of X10 Test. * + +import harness.x10Test; + +/** + * @author igor 7/2009 + */ + +public class XTENLANG_477 extends x10Test { + + public def run(): boolean { + val x = "3.14159265359"; + val d = Double.parseDouble(x); + return d == 3.14159265359; + } + + public static def main(Rail[String]) { + new XTENLANG_477().execute(); + } +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-07-27 21:58:02
|
Revision: 10890 http://x10.svn.sourceforge.net/x10/?rev=10890&view=rev Author: dgrove-oss Date: 2009-07-27 21:57:56 +0000 (Mon, 27 Jul 2009) Log Message: ----------- move a useful utility function for finding all the interfaces implemented by a class from ITable to X10TypeSystem. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/ITable.java trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java 2009-07-27 21:56:06 UTC (rev 10889) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java 2009-07-27 21:57:56 UTC (rev 10890) @@ -40,21 +40,21 @@ /** * Parts of this code are taken from the pao extension in the polyglot * framework. - * + * * @author Christoph von Praun * @author vj */ public interface X10TypeSystem extends TypeSystem { public Name DUMMY_PACKAGE_CLASS_NAME = Name.make("_"); - + boolean isSubtype(Type t1, Type t2, Context context); - + /** * Add an annotation to a type object, optionally replacing existing * annotations that are subtypes of annoType. */ void addAnnotation(X10Def o, Type annoType, boolean replace); - + AnnotatedType AnnotatedType(Position pos, Type baseType, List<Type> annotations); Type boxOf(Position p, Ref<? extends Type> t); @@ -71,7 +71,7 @@ * found because the method we find depends on whether the method is * accessible from that class. We also check if the field is accessible from * the context 'c'. - * + * * @exception SemanticException * if the method cannot be found or is inaccessible. */ @@ -81,7 +81,7 @@ * Find a constructor. We need to pass the class from which the constructor * is being found because the constructor we find depends on whether the * constructor is accessible from that class. - * + * * @exception SemanticException * if the constructor cannot be found or is inaccessible. */ @@ -92,6 +92,16 @@ */ ClosureInstance createClosureInstance(Position pos, Ref<? extends ClosureDef> def); + /** + * Returns an immutable list of all the interfaces + * which the type implements excluding itself and x10.lang.Object. + * This is different from {@link #Interface()} in that this method + * traverses the class hierarchy to collect all implemented interfaces + * instead of shallowly returning just the interfaces directly implemented + * by the type. + */ + List<X10ClassType> allImplementedInterfaces(X10ClassType type); + XTerm here(); Type Place(); // needed for here, async (p) S, future (p) e, etc @@ -157,14 +167,14 @@ /** * Return the ClassType object for the x10.lang.Rail interface. - * + * * @return */ Type Rail(); /** * Return the ClassType object for the x10.lang.ValRail interface. - * + * * @return */ Type ValRail(); @@ -195,7 +205,7 @@ boolean isValueType(Type me, X10Context context); boolean isReferenceType(Type me, X10Context context); - + boolean isUByte(Type t); boolean isUShort(Type t); boolean isUInt(Type t); @@ -226,7 +236,7 @@ /** * Is a type constrained (i.e. its depClause is != null) If me is a * nullable, then the basetype is checked. - * + * * @param me * Type to check * @return true if type has a depClause. @@ -244,14 +254,14 @@ * True if the two types are equal, ignoring their dep clauses. * @param other * @param context TODO - * + * * @return */ boolean typeBaseEquals(Type me, Type other, Context context); /** * True if the two types are equal, ignoring their dep clauses and the dep clauses of their type arguments recursively. - * + * * @param other * @return */ @@ -299,7 +309,7 @@ ClosureType closureType(Position position, Ref<? extends Type> typeRef, List<Ref<? extends Type>> typeParams, List<Ref<? extends Type>> formalTypes, List<LocalDef> formalNames, Ref<XConstraint> guard, Ref<TypeConstraint> typeGuard, List<Ref<? extends Type>> throwTypes); - + Type expandMacros(Type arg); // /** Run fromType thorugh a coercion function to toType, if possible, returning the return type of the coercion function, or return null. */ @@ -311,7 +321,7 @@ boolean consistent(XConstraint c); boolean consistent(TypeConstraint c, X10Context context); - /** Return true if constraints in the type are all consistent. + /** Return true if constraints in the type are all consistent. * @param context TODO*/ boolean consistent(Type t, X10Context context); @@ -324,7 +334,7 @@ Type Region(); Type Iterator(Type formalType); - + X10FieldDef fieldDef(Position pos, Ref<? extends StructType> container, Flags flags, Ref<? extends Type> type, Name name, XRoot thisVar); @@ -334,6 +344,6 @@ boolean isSigned(Type l); boolean numericConversionValid(Type toType, Type fromType, Object constantValue, Context context); - + } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2009-07-27 21:56:06 UTC (rev 10889) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2009-07-27 21:57:56 UTC (rev 10890) @@ -83,7 +83,7 @@ /** * A TypeSystem implementation for X10. - * + * * @author Christian Grothoff * @author Christoph von Praun * @author vj @@ -704,7 +704,7 @@ assert_(container); // Named n = classContextResolver(container, currClass).find(name); - // + // // if (n instanceof MacroType) { // return (MacroType) n; // } @@ -1004,10 +1004,43 @@ return new ClosureInstance_c(this, pos, def); } + public List<X10ClassType> allImplementedInterfaces(X10ClassType c) { + ArrayList<X10ClassType> ans = new ArrayList<X10ClassType>(); + allImplementedInterfaces(c, ans); + return ans; + } + + private void allImplementedInterfaces(X10ClassType c, ArrayList<X10ClassType> l) { + Context context = createContext(); + if (c.typeEquals(Object(), context)) { + return; + } + + for (Type old : l) { + if (c.typeEquals(old, context)) { + return; /* Already been here */ + } + } + + if (c.flags().isInterface()) { + l.add(c); + } + + if (c.superClass() != null) { + allImplementedInterfaces((X10ClassType)X10TypeMixin.baseType(c.superClass()), l); + } + + for (Type parent : c.interfaces()) { + allImplementedInterfaces((X10ClassType)X10TypeMixin.baseType(parent), l); + } + } + + + public final Context createContext() { return emptyContext(); } - + public Context emptyContext() { return new X10Context_c(this); } @@ -1060,12 +1093,12 @@ } protected final X10Flags X10_LOCAL_VARIABLE_FLAGS = (X10Flags) legalLocalFlags(); - + @Override public Flags legalFieldFlags() { return X10Flags.toX10Flags(super.legalFieldFlags()).Property(); } - + protected final X10Flags X10_FIELD_VARIABLE_FLAGS = (X10Flags) legalFieldFlags(); @Override @@ -1166,7 +1199,7 @@ // protected final PrimitiveType USHORT_ = createPrimitive("ushort"); // protected final PrimitiveType UINT_ = createPrimitive("uint"); // protected final PrimitiveType ULONG_ = createPrimitive("ulong"); - // + // // public Type UByte() { return UBYTE_; } // public Type UShort() { return USHORT_; } // public Type UInt() { return UINT_; } @@ -1603,7 +1636,7 @@ public boolean numericConversionValid(Type t, java.lang.Object value, Context context) { return env(context).numericConversionValid(t, value); } - + public boolean numericConversionValid(Type t, Type fromType, java.lang.Object value, Context context) { return env(context).numericConversionValid(t, fromType, value); } @@ -1946,7 +1979,7 @@ if (isByte(t1) || isByte(t2)) return Int(); - + if (isUShort(t1) || isUShort(t2)) return Int(); Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/ITable.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/ITable.java 2009-07-27 21:56:06 UTC (rev 10889) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/ITable.java 2009-07-27 21:57:56 UTC (rev 10890) @@ -11,6 +11,7 @@ import polyglot.ext.x10.types.X10MethodDef; import polyglot.ext.x10.types.X10MethodInstance; import polyglot.ext.x10.types.X10TypeMixin; +import polyglot.ext.x10.types.X10TypeSystem; import polyglot.ext.x10.types.X10TypeSystem_c; import polyglot.types.Context; import polyglot.types.MethodInstance; @@ -57,7 +58,7 @@ ArrayList<MethodInstance> uniqueMethods = new ArrayList<MethodInstance>(); uniqueMethods.addAll(interfaceType.methods()); - for (X10ClassType superInterface : allImplementedInterfaces(interfaceType)) { + for (X10ClassType superInterface : ((X10TypeSystem)interfaceType.typeSystem()).allImplementedInterfaces(interfaceType)) { for (MethodInstance newMethod : superInterface.methods()) { boolean duplicate = false; for (MethodInstance oldMethod : uniqueMethods) { @@ -88,43 +89,6 @@ } /** - * Return a list of all interfaces directly and indirectly - * implemented by the argument class, excluding x10.lang.Object. - * If c is an interface, this method does not include c in the result! - */ - public static List<X10ClassType> allImplementedInterfaces(X10ClassType c) { - ArrayList<X10ClassType> ans = new ArrayList<X10ClassType>(); - allImplementedInterfaces(c, ans); - return ans; - } - - private static void allImplementedInterfaces(X10ClassType c, ArrayList<X10ClassType> l) { - X10TypeSystem_c xts = (X10TypeSystem_c) c.typeSystem(); - Context context = xts.createContext(); - if (c.typeEquals(xts.Object(), context)) { - return; - } - - for (X10ClassType old : l) { - if (c.typeEquals(old, context)) { - return; /* Already been here */ - } - } - - if (c.flags().isInterface()) { - l.add(c); - } - - if (c.superClass() != null) { - allImplementedInterfaces((X10ClassType)X10TypeMixin.baseType(c.superClass()), l); - } - - for (Type parent : c.interfaces()) { - allImplementedInterfaces((X10ClassType)X10TypeMixin.baseType(parent), l); - } - } - - /** * @return the canonically ordered array of MethodDecls that * are included in the itable for this interface. This is * a set union of the methods directly declared by the interface and Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-07-27 21:56:06 UTC (rev 10889) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-07-27 21:57:56 UTC (rev 10890) @@ -1013,6 +1013,7 @@ X10ClassType currentClass = (X10ClassType) context.currentClass(); X10ClassType superClass = (X10ClassType) X10TypeMixin.baseType(currentClass.superClass()); boolean isInterface = currentClass.flags().isInterface(); + X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); ClassifiedStream h = sw.header(); @@ -1080,7 +1081,7 @@ h.write("return x10::lang::Object::"+DESERIALIZE_METHOD+"<__T>(buf);"); h.end(); h.newline(); h.write("}"); h.newline(); h.forceNewline(); } else { - List<X10ClassType> allInterfaces = ITable.allImplementedInterfaces(currentClass); + List<X10ClassType> allInterfaces = xts.allImplementedInterfaces(currentClass); int numInterfaces = allInterfaces.size(); if (numInterfaces > 0 && !currentClass.flags().isAbstract()) { /* ITables declarations */ @@ -1117,7 +1118,6 @@ if (!members.isEmpty()) { String className = emitter.translateType(currentClass); - X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); h.write(VOID + " " + INSTANCE_INIT + "();"); h.newline(); h.forceNewline(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-09-14 20:08:59
|
Revision: 11214 http://x10.svn.sourceforge.net/x10/?rev=11214&view=rev Author: dgrove-oss Date: 2009-09-14 20:08:51 +0000 (Mon, 14 Sep 2009) Log Message: ----------- Implement a class_cast_unchecked function in x10aux and use it C++ codegen for casts that are injected by the backend solely to make C++ level types match for the purpose of resolving overloads. Because the program was type-correct at the X10 level, we know that none of the cases injected by the C++ backend actually need to be checked dynamically: they are guaranteed to succeed because the X10 program is type correct. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10Cast.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10aux/class_cast.h Modified: trunk/x10.compiler/src/x10/ast/X10Cast.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Cast.java 2009-09-14 20:04:22 UTC (rev 11213) +++ trunk/x10.compiler/src/x10/ast/X10Cast.java 2009-09-14 20:08:51 UTC (rev 11214) @@ -18,6 +18,7 @@ SUBTYPE, UNBOXING, BOXING, + UNCHECKED } public ConversionType conversionType(); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-14 20:04:22 UTC (rev 11213) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-14 20:08:51 UTC (rev 11214) @@ -2282,7 +2282,7 @@ if (!xts.typeDeepBaseEquals(fType, a.type(), context)) { Position pos = a.position(); a = nf.X10Cast(pos, nf.CanonicalTypeNode(pos, fType), a, - X10Cast.ConversionType.CHECKED).type(fType); + X10Cast.ConversionType.UNCHECKED).type(fType); } return a; } @@ -2680,6 +2680,7 @@ case CHECKED: case PRIMITIVE: case SUBTYPE: + case UNCHECKED: if (tn instanceof X10CanonicalTypeNode) { X10CanonicalTypeNode xtn = (X10CanonicalTypeNode) tn; @@ -2698,7 +2699,11 @@ } else if (c.conversionType()==X10Cast_c.ConversionType.SUBTYPE && xts.isSubtype(f_, t_, context)) { c.printSubExpr(c.expr(), true, sw, tr); } else { - sw.write("x10aux::class_cast<"); + if (c.conversionType()==X10Cast_c.ConversionType.UNCHECKED) { + sw.write("x10aux::class_cast_unchecked<"); + } else { + sw.write("x10aux::class_cast<"); + } emitter.printType(t_, sw); sw.write(" >("); c.printSubExpr(c.expr(), true, sw, tr); Modified: trunk/x10.runtime/src-cpp/x10aux/class_cast.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/class_cast.h 2009-09-14 20:04:22 UTC (rev 11213) +++ trunk/x10.runtime/src-cpp/x10aux/class_cast.h 2009-09-14 20:08:51 UTC (rev 11214) @@ -16,6 +16,7 @@ extern void throwClassCastException() X10_PRAGMA_NORETURN; template<typename T, typename F> GPUSAFE T class_cast(F obj); + template<typename T, typename F> GPUSAFE T class_cast(F obj, bool checked); template<class T> struct CAST_TRACER { CAST_TRACER(T val_) : val(val_) { } @@ -52,7 +53,7 @@ template<class T, class F> struct ClassCastNotBothRef<ref<T>,F> { // All possibilities accounted for, if you got here something has gone wrong - static ref<T> _ (F obj) { + static ref<T> _ (F obj, bool checked) { throwClassCastException(); return NULL; } @@ -60,7 +61,7 @@ template<class T, class F> struct ClassCastNotBothRef<T,ref<F> > { // All possibilities accounted for, if you got here something has gone wrong - static T _ (ref<F> obj) { + static T _ (ref<F> obj, bool checked) { throwClassCastException(); return NULL; } @@ -69,9 +70,9 @@ // Box primitives on casting to interfaces #define PRIMITIVE_INTERFACE_CAST(T,F) \ template<> struct ClassCastNotBothRef<ref<T>,F> { \ - static GPUSAFE ref<T> _ (F obj) { \ + static GPUSAFE ref<T> _ (F obj, bool checked) { \ _CAST_(TYPENAME(F) <<" converted to "<<TYPENAME(ref<T>)); \ - return class_cast<ref<T> >(box(obj)); \ + return class_cast<ref<T> >(box(obj), checked); \ } \ } PRIMITIVE_INTERFACE_CAST(x10::lang::Object, x10_boolean); @@ -103,9 +104,9 @@ // Unbox primitives on down-casting from interfaces #define INTERFACE_PRIMITIVE_CAST(T,F) \ template<> struct ClassCastNotBothRef<T,ref<F> > { \ - static GPUSAFE T _ (ref<F> obj) { \ + static GPUSAFE T _ (ref<F> obj, bool checked) { \ _CAST_(TYPENAME(ref<F>) <<" converted to "<<TYPENAME(T)); \ - return unbox(class_cast<ref<x10::lang::Box<T> > >(obj)); \ + return unbox(class_cast<ref<x10::lang::Box<T> > >(obj, checked)); \ } \ } INTERFACE_PRIMITIVE_CAST(x10_boolean, x10::lang::Object); @@ -180,68 +181,70 @@ PRIMITIVE_VALUE_CAST2(x10_uint); PRIMITIVE_VALUE_CAST2(x10_ulong); - template<class T> static GPUSAFE ref<T> real_class_cast(ref<x10::lang::Object> obj) { + template<class T> static GPUSAFE ref<T> real_class_cast(ref<x10::lang::Object> obj, bool checked) { if (obj == x10aux::null) { // NULL passes any class cast check and remains NULL _CAST_("Special case: null gets cast to "<<TYPENAME(ref<T>)); return obj; } - const RuntimeType *from = obj->_type(); - const RuntimeType *to = getRTT<ref<T> >(); - #ifndef NO_EXCEPTIONS - _CAST_(from->name()<<" to "<<to->name()); - if (!from->subtypeOf(to)) { - throwClassCastException(); + if (checked) { + const RuntimeType *from = obj->_type(); + const RuntimeType *to = getRTT<ref<T> >(); + #ifndef NO_EXCEPTIONS + _CAST_(from->name()<<" to "<<to->name()); + if (!from->subtypeOf(to)) { + throwClassCastException(); + } + #else + (void) from; (void) to; + _CAST_("UNCHECKED! "<<from->name()<<" to "<<to->name()); + #endif } - #else - (void) from; (void) to; - _CAST_("UNCHECKED! "<<from->name()<<" to "<<to->name()); - #endif return static_cast<ref<T> >(obj); } // ClassCastBothRef - template<class T, class F> struct ClassCastBothRef { static GPUSAFE ref<T> _(ref<F> obj) { - return real_class_cast<T>(obj); + template<class T, class F> struct ClassCastBothRef { static GPUSAFE ref<T> _(ref<F> obj, bool checked) { + return real_class_cast<T>(obj, checked); } }; // Boxing of ref types template<class T> struct ClassCastBothRef<x10::lang::Box<ref<T> >,T> { - static GPUSAFE ref<x10::lang::Box<ref<T> > > _(ref<T> obj) { + static GPUSAFE ref<x10::lang::Box<ref<T> > > _(ref<T> obj, bool checked) { return box(obj); } }; // Unboxing of ref types template<class T> struct ClassCastBothRef<T,x10::lang::Box<ref<T> > > { - static GPUSAFE ref<T> _(ref<x10::lang::Box<ref<T> > > obj) { + static GPUSAFE ref<T> _(ref<x10::lang::Box<ref<T> > > obj, bool checked) { return unbox(obj); } }; // ClassCastNotPrimitive - template<class T, class F> struct ClassCastNotPrimitive { static GPUSAFE T _(F obj) { - return ClassCastNotBothRef<T,F>::_(obj); + template<class T, class F> struct ClassCastNotPrimitive { static GPUSAFE T _(F obj, bool checked) { + return ClassCastNotBothRef<T,F>::_(obj, checked); } }; template<class T, class F> struct ClassCastNotPrimitive<ref<T>,ref<F> > { - static GPUSAFE ref<T> _(ref<F> obj) { + static GPUSAFE ref<T> _(ref<F> obj, bool checked) { _CAST_("Ref to ref cast "<<TYPENAME(T)<<" to "<<TYPENAME(T)); - return ClassCastBothRef<T,F>::_(obj); + return ClassCastBothRef<T,F>::_(obj, checked); } }; // This is the second level that recognises primitive casts - template<class T, class F> struct ClassCastPrimitive { static GPUSAFE T _(F obj) { + template<class T, class F> struct ClassCastPrimitive { static GPUSAFE T _(F obj, bool checked) { // if we get here it's not a primitive cast _CAST_("Not a primitive cast "<<TYPENAME(T)<<" to "<<TYPENAME(T)); - return ClassCastNotPrimitive<T,F>::_(obj); + return ClassCastNotPrimitive<T,F>::_(obj, checked); } }; #define PRIMITIVE_CAST(T,F) \ template<> struct ClassCastPrimitive<T,F> { \ - static GPUSAFE T _ (F obj) { \ + static GPUSAFE T _ (F obj, bool checked) { \ _CAST_(TYPENAME(F) <<" converted to "<<TYPENAME(T)); \ return static_cast<T>(obj); \ } \ @@ -310,19 +313,26 @@ // first level of template specialisation that recognises <T,T> // (needed because generic classes can be instantiated in ways that make casts redundant) - template<class T, class F> struct ClassCast { static GPUSAFE T _ (F obj) { - return ClassCastPrimitive<T,F>::_(obj); + template<class T, class F> struct ClassCast { static GPUSAFE T _ (F obj, bool checked) { + return ClassCastPrimitive<T,F>::_(obj, checked); } }; - template<class T> struct ClassCast<T,T> { static GPUSAFE T _ (T obj) { + template<class T> struct ClassCast<T,T> { static GPUSAFE T _ (T obj, bool checked) { // nothing to do (until we have constraints) _CAST_("Identity cast to/from "<<TYPENAME(T)); return obj; } }; template<typename T, typename F> GPUSAFE T class_cast(F obj) { - return ClassCast<T,F>::_(obj); + return ClassCast<T,F>::_(obj, true); } + template<typename T, typename F> GPUSAFE T class_cast(F obj, bool checked) { + return ClassCast<T,F>::_(obj, checked); + } + + template<typename T, typename F> GPUSAFE T class_cast_unchecked(F obj) { + return ClassCast<T,F>::_(obj, false); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-09-20 09:32:26
|
Revision: 11262 http://x10.svn.sourceforge.net/x10/?rev=11262&view=rev Author: vj0 Date: 2009-09-20 09:32:18 +0000 (Sun, 20 Sep 2009) Log Message: ----------- Sun Sep 20 05:11:13 2009 * Merged X10ArrayMixin into X10TypeMixin. * Fixed the problem that receiver deptype was not correctly gettint propogated to field access. Added X10TypeMix.ensureSelfBound(Type t) which ensures that self is bound in the type, hence selfBinding is a representative for the type that can be used when computing the type of field accesses ad method invocations on a receiver of this type. This required ensuring that _selfXXX variables prefer to be bound. Hack. Fixed code in X10TypeSystem_c.X10FieldMatcher.instantiate. * Ensured that Subst.subst does not modify input constraint. * Force a recomputation of rightType on X10FieldInstance_c in case rightType is unknown. * Ensure that depclauses are preserved when looking for upperbounds. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/ConstantDistMaker_c.java trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java trunk/x10.compiler/src/x10/ast/RegionMaker_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.compiler/src/x10/query/QueryEngine.java trunk/x10.compiler/src/x10/types/ConstrainedType.java trunk/x10.compiler/src/x10/types/ConstrainedType_c.java trunk/x10.compiler/src/x10/types/Subst.java trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.constraints/src/x10/constraint/XTerm_c.java trunk/x10.runtime/src-x10/x10/array/PolyRow.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/lang/Place.x10 trunk/x10.runtime/src-x10/x10/lang/_.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStruct.x10 Added Paths: ----------- trunk/x10.tests/examples/Constructs/Place/FieldReceiverIsExpr.x10 Removed Paths: ------------- trunk/x10.compiler/src/x10/types/X10ArraysMixin.java Modified: trunk/x10.compiler/src/x10/ast/ConstantDistMaker_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ConstantDistMaker_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/ast/ConstantDistMaker_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -22,7 +22,6 @@ import polyglot.util.Position; import polyglot.visit.TypeChecker; import x10.constraint.XTerm; -import x10.types.X10ArraysMixin; import x10.types.X10TypeSystem; /** Modified: trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -115,7 +115,7 @@ try { pt = XConstrainedTerm.instantiate(d, term); } catch (XFailure z) { - assert false; + throw new InternalCompilerError("Cannot construct placeTerm from " + term + " and constraint " + d + "."); } @@ -136,7 +136,7 @@ } } else throw new SemanticException( - "Place expression must be of type \"" + + "Place expression |" + place + "| must be of type \"" + ts.Place() + "\", or " + ts.Ref() + ", not \"" + place.type() + "\".", place.position()); } @@ -154,8 +154,8 @@ } ClosureDef def = (ClosureDef) this.codeDef(); if (def.placeTerm() == null) { - def.setPlaceTerm(computePlaceTerm((Expr) visitChild(place, v), - (X10Context) tc.context(), ts)); + Expr e = (Expr) visitChild(place, v); + def.setPlaceTerm(computePlaceTerm(e, (X10Context) tc.context(), ts)); } // now that placeTerm is set in this node, continue visiting children // enterScope will ensure that placeTerm is installed in the context. Modified: trunk/x10.compiler/src/x10/ast/RegionMaker_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/RegionMaker_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/ast/RegionMaker_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -21,7 +21,6 @@ import polyglot.types.Type; import polyglot.util.Position; import polyglot.visit.TypeChecker; -import x10.types.X10ArraysMixin; import x10.types.X10TypeSystem; /** Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -42,6 +42,7 @@ import x10.constraint.XRoot; import x10.constraint.XTerm; import x10.constraint.XVar; +import x10.types.ConstrainedType; import x10.types.ParameterType; import x10.types.Subst; import x10.types.X10ClassType; @@ -96,10 +97,12 @@ return n; } public Node typeCheck1(ContextVisitor tc) throws SemanticException { - X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - X10Context c = (X10Context) tc.context(); - + final X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + final X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); + final X10Context c = (X10Context) tc.context(); + //System.err.println("X10Field_c: Examining " + this + " at " + + // position() + " in depTypeMode=" + c.inDepType()); + Type tType = target.type(); @@ -124,7 +127,8 @@ if (fi != null) { // Found! X10Field_c result = this; - Type t = rightType(fi.rightType(), fi.x10Def(), target, c); + Type t = c.inDepType()? rightType(fi.rightType(), fi.x10Def(), target, c) + : fieldRightType(fi.rightType(), fi.x10Def(), target, c); result = (X10Field_c) result.fieldInstance(fi).type(t); return result; } @@ -138,6 +142,7 @@ } try { + X10FieldInstance fi = (X10FieldInstance) ts.findField(tType, ts.FieldMatcher(tType, name.id(), c)); if (fi == null) { throw new InternalCompilerError("Cannot access field " + name + @@ -145,7 +150,8 @@ position()); } X10Field_c result = this; - Type type = rightType(fi.rightType(), fi.x10Def(), target, c); + Type type = c.inDepType()? rightType(fi.rightType(), fi.x10Def(), target, c) : + fieldRightType(fi.rightType(), fi.x10Def(), target, c); if (type instanceof UnknownType) { throw new SemanticException(); } @@ -174,11 +180,9 @@ checkFieldAccessesInDepClausesAreFinal(result, tc); + result.checkFieldPlaceType(tc); - if (ENABLE_PLACE_TYPES) - result.checkFieldPlaceType(tc); - - //Report.report(1, "X10Field_c: typeCheck " + result+ " has type " + result.type()); + //System.err.println("X10Field_c: typeCheck " + result+ " has type " + result.type()); return result; } catch (NoMemberException e) { if (target instanceof Expr) { @@ -190,7 +194,10 @@ if (X10Flags.toX10Flags(mi.flags()).isProperty()) { Call call = nf.Call(pos, target, this.name); call = call.methodInstance(mi); - call = (Call) call.type(rightType(mi.rightType(), mi.x10Def(), target, c)); + Type nt = c.inDepType() ? + rightType(mi.rightType(), mi.x10Def(), target, c) + :fieldRightType(mi.rightType(), mi.x10Def(), target, c); + call = (Call) call.type(nt); return call; } } @@ -223,9 +230,47 @@ t = Subst.subst(t, (new XVar[] { receiver }), (new XRoot[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); } } + //System.err.println("X10Field_c: rightType returns " + t); return t; } + public static Type fieldRightType(Type t, X10MemberDef fi, Receiver target, Context c) throws SemanticException { + XConstraint x = X10TypeMixin.xclause(t); + if (x != null && fi.thisVar() != null) { + x = x.copy(); + // Need to add the target's constraints in here because the target may not + // be a variable. hence the type information wont be in the context. + if (target instanceof Expr) { + XConstraint xc = X10TypeMixin.xclause(target.type()); + if (xc != null && ! xc.valid()) { + xc = xc.copy(); + try { + XVar receiver = X10TypeMixin.selfVarBinding(target.type()); + assert receiver != null; + /*if (receiver == null) { + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + XTerm r = ts.xtypeTranslator().trans((XConstraint) null, target, (X10Context) c); + if (r instanceof XVar) { + receiver = (XVar) r; + } + + if (receiver == null) + receiver = XConstraint_c.genUQV(); + }*/ + xc = xc.substitute(receiver, xc.self()); + x.addIn(xc); + x=x.substitute(receiver, fi.thisVar()); + t = X10TypeMixin.addConstraint(X10TypeMixin.baseType(t), x); + } catch (XFailure z) { + // should not happen + } + } + } + } + //System.err.println("X10Field_c: fieldRightType returns " + t); + return t; + } + private static final boolean ENABLE_PLACE_TYPES = true; public void checkFieldPlaceType( ContextVisitor tc) Modified: trunk/x10.compiler/src/x10/ast/X10Loop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -53,7 +53,6 @@ import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.Subst; -import x10.types.X10ArraysMixin; import x10.types.X10ClassType; import x10.types.X10Context; import x10.types.X10FieldInstance; Modified: trunk/x10.compiler/src/x10/query/QueryEngine.java =================================================================== --- trunk/x10.compiler/src/x10/query/QueryEngine.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/query/QueryEngine.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -19,10 +19,10 @@ import x10.Configuration; import x10.ExtensionInfo; import x10.ast.SettableAssign; -import x10.types.X10ArraysMixin; import x10.types.X10ClassType; import x10.types.X10Context; import x10.types.X10Type; +import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; /** @@ -54,8 +54,8 @@ public boolean isRectangularRankOneLowZero(SettableAssign a, X10Context context) { Type t = a.array().type(); X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - if (X10ArraysMixin.isX10Array(t)) - return X10ArraysMixin.isRail(t, context) || (X10ArraysMixin.isZeroBased(t, context) && X10ArraysMixin.isRankOne(t, context) && X10ArraysMixin.isRect(t, context)); + if (X10TypeMixin.isX10Array(t)) + return X10TypeMixin.isRail(t, context) || (X10TypeMixin.isZeroBased(t, context) && X10TypeMixin.isRankOne(t, context) && X10TypeMixin.isRect(t, context)); else return false; } @@ -82,8 +82,8 @@ public boolean needsHereCheck(SettableAssign a, X10Context context) { Type lt = a.leftType(); X10TypeSystem ts = (X10TypeSystem) lt.typeSystem(); - if (X10ArraysMixin.isX10Array(lt)) { - return needsHereCheck(X10ArraysMixin.arrayBaseType(lt), context); + if (X10TypeMixin.isX10Array(lt)) { + return needsHereCheck(X10TypeMixin.arrayBaseType(lt), context); } return false; } Modified: trunk/x10.compiler/src/x10/types/ConstrainedType.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/ConstrainedType.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -32,5 +32,7 @@ void checkRealClause() throws SemanticException; + + void ensureSelfBound(); //XConstraint realX(); } Modified: trunk/x10.compiler/src/x10/types/ConstrainedType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -224,11 +224,48 @@ @Override public List<FieldInstance> fields() { Type base = baseType.get(); + XConstraint c = getRealXClause(); + final XVar thisVar = thisVar(); + /*try { + c = c.substitute(thisVar, c.self()); + } catch (XFailure f) { + throw new InternalCompilerError("Unexpected failure when substituting thisVar() for self in " + c); + }*/ + final XConstraint cc = c; if (base instanceof StructType) { - return ((StructType) base).fields(); + final List<FieldInstance> fis = ((StructType) base).fields(); + return fis; + /*return new TransformingList<FieldInstance, FieldInstance>(fis, new Transformation<FieldInstance, FieldInstance>() { + public FieldInstance transform(FieldInstance o) { + assert o instanceof X10FieldInstance; + X10FieldInstance xo = (X10FieldInstance) o; + Type t = xo.rightType(); + // Now need to add the constainer's constraint. + t = X10TypeMixin.addConstraint(t, cc); + + FieldInstance o1 = o.type(t); + return o1; + } + });*/ + } return Collections.emptyList(); } + + public void ensureSelfBound() { + assert constraint != null; + XVar self = X10TypeMixin.selfVarBinding(this); + if (self == null) { + self = XConstraint_c.genEQV(); + XConstraint c = constraint.get(); + try { + c.addSelfBinding(self); + } catch (XFailure z) { + // cannot happen + } + constraint.update(c); + } + } // vj: Revised substantially 08/11/09 Modified: trunk/x10.compiler/src/x10/types/Subst.java =================================================================== --- trunk/x10.compiler/src/x10/types/Subst.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/Subst.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -42,6 +42,7 @@ Type base = X10TypeMixin.baseType(t); XConstraint c = X10TypeMixin.xclause(t); + if (t instanceof X10ParsedClassType) { X10ParsedClassType ct = (X10ParsedClassType) t; List<Type> newArgs = new ArrayList<Type>(); @@ -53,6 +54,7 @@ return ct.typeArguments(newArgs); } else if (c != null) { + c = c.copy(); base = subst(base, y, x); try { Deleted: trunk/x10.compiler/src/x10/types/X10ArraysMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ArraysMixin.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10ArraysMixin.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -1,227 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.types; - -import java.util.Collections; - -import polyglot.types.ClassDef; -import polyglot.types.ClassType; -import polyglot.types.Context; -import polyglot.types.FieldInstance; -import polyglot.types.Name; -import polyglot.types.SemanticException; -import polyglot.types.Type; -import polyglot.util.InternalCompilerError; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; -import x10.constraint.XFailure; -import x10.constraint.XTerm; -import x10.constraint.XTerms; -import x10.constraint.XVar; - -public class X10ArraysMixin { - - - public static boolean isX10Array(Type t) { - return isVarArray(t); - } - - public static boolean isVarArray(Type t) { - X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - Type tt = X10TypeMixin.baseType(t); - Type at = X10TypeMixin.baseType(ts.Array()); - if (tt instanceof ClassType && at instanceof ClassType) { - ClassDef tdef = ((ClassType) tt).def(); - ClassDef adef = ((ClassType) at).def(); - return ts.descendsFrom(tdef, adef); - } - return false; - } - - public static Type arrayBaseType(Type t) { - t = X10TypeMixin.baseType(t); - if (t instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) t; - X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - ClassType a = (ClassType) ts.Array(); - if (ct.def() == a.def()) - return ct.typeArguments().get(0); - else - arrayBaseType(ct.superClass()); - } - return null; - } - - public static Type railBaseType(Type t) { - t = X10TypeMixin.baseType(t); - if (t instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) t; - X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - ClassType a = (ClassType) ts.Rail(); - ClassType v = (ClassType) ts.ValRail(); - if (ct.def() == a.def() || ct.def() == v.def()) - return ct.typeArguments().get(0); - else - arrayBaseType(ct.superClass()); - } - return null; - } - - protected static Type addBinding(Type t, XVar v1, XVar v2) { - return X10TypeMixin.addBinding(t, v1, v2); - } - - public static X10FieldInstance getProperty(Type t, Name propName) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - try { - Context c = xts.emptyContext(); - X10FieldInstance fi = (X10FieldInstance) xts.findField(t, xts.FieldMatcher(t, propName, c)); - if (fi != null && fi.isProperty()) { - return fi; - } - } - catch (SemanticException e) { - // ignore - } - return null; - } - - protected static boolean amIProperty(Type t, Name propName, X10Context context) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - XConstraint r = X10TypeMixin.realX(t); - - // first try self.p - X10FieldInstance fi = getProperty(t, propName); - if (fi != null) { - try { - XConstraint c = new XConstraint_c(); - XVar term = xts.xtypeTranslator().trans(c, c.self(), fi); - c.addBinding(term, xts.xtypeTranslator().trans(true)); - return r.entails(c, context.constraintProjection(r, c)); - } - catch (XFailure f) { - return false; - } - catch (SemanticException f) { - return false; - } - } - else { - // try self.p() - try { - X10MethodInstance mi = xts.findMethod(t, xts.MethodMatcher(t, propName, Collections.EMPTY_LIST, xts.emptyContext())); - XTerm body = mi.body(); - XConstraint c = new XConstraint_c(); - body = body.subst(c.self(), mi.x10Def().thisVar()); - c.addTerm(body); - return r.entails(c, context.constraintProjection(r, c)); - } - catch (XFailure f) { - return false; - } - catch (SemanticException f) { - return false; - } - } - } - - public static boolean isRect(Type t, X10Context context) { - return amIProperty(t, Name.make("rect"), context); - } - - public static XTerm onePlace(Type t) { - return find(t, Name.make("onePlace")); - } - - private static XTerm findProperty(Type t, Name propName) { - XConstraint c = X10TypeMixin.realX(t); - if (c == null) return null; - - // TODO: check dist.region.p and region.p - try { - FieldInstance fi = getProperty(t, propName); - if (fi != null) - return c.find(XTerms.makeName(fi.def())); - } - catch (XFailure e) { - } - return null; - } - - public static boolean isZeroBased(Type t, X10Context context) { - if (isRail(t, context)) return true; - return amIProperty(t, Name.make("zeroBased"), context); - } - - public static boolean isRail(Type t, X10Context context) { - return amIProperty(t, Name.make("rail"), context); - } - - public static XTerm distribution(Type t) { - return findProperty(t, Name.make("dist")); - } - - public static XTerm region(Type t) { - return findProperty(t, Name.make("region")); - } - - public static XTerm rank(Type t, X10Context context) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - if (isRail(t, context)) - return xts.ONE(); - return findOrSythesize(t, Name.make("rank")); - } - - private static XTerm findOrSythesize(Type t, Name propName) { - return find(t, propName); - } - - public static XTerm find(Type t, Name propName) { - XTerm val = findProperty(t, propName); - - if (val == null) { - XConstraint c = X10TypeMixin.realX(t); - if (c != null) { - // build the synthetic term. - XTerm var = X10TypeMixin.selfVar(c); - if (var !=null) { - X10FieldInstance fi = getProperty(t, propName); - if (fi != null) { - - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - val = xts.xtypeTranslator().trans(c, var, fi); - - } - } - } - } - return val; - } - - public static boolean isRankOne(Type t, X10Context context) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - return isRail(t, context) || xts.ONE().equals(rank(t, context)); - } - public static boolean isRankTwo(Type t, X10Context context) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - return xts.TWO().equals(rank(t, context)); - } - public static boolean isRankThree(Type t, X10Context context) { - X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); - return xts.THREE().equals(rank(t, context)); - } - - public static XVar self(Type t) { - XConstraint c = X10TypeMixin.realX(t); - if (c == null) - return null; - return X10TypeMixin.selfVar(c); - } - -} Modified: trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -56,6 +56,7 @@ n.guard = s; return n; } + public List<Type> annotations() { return X10TypeObjectMixin.annotations(this); @@ -89,11 +90,18 @@ public Type rightType() { X10TypeSystem xts = (X10TypeSystem) ts; - - if (rightType == null) { + + // vj: Force a recomputation if rightType is UnknownType. + // this.type() may have changed -- though this.type might not!! + // However we have no way of resetting rightType when + // this.type() changes. However, this.type() should change only + // monotonically from uknown to some known value. + // Hence force a recompute each time rightType() is called + // if .rightType is an UnknownType. + if (rightType == null || rightType instanceof UnknownType) { Type t = type(); - // If the field is final, replace T by T(:self==t). + // If the field is final, replace T by T{self==t} Flags flags = flags(); if (flags.isFinal()) { Modified: trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -60,47 +60,40 @@ Type rightType; public Type rightType() { - if (rightType == null) { - Type t = type(); - - // If the local variable is final, replace T by T{self==t}, - // do this even if depclause==null - Flags flags = flags(); + if (rightType != null) + return rightType; - if (flags.isFinal()) { - if (t instanceof UnknownType) { - rightType = t; - } - else { - try { - XConstraint c = X10TypeMixin.xclause(t); - if (c == null) - c = new XConstraint_c(); - else - c = c.copy(); - X10TypeSystem xts = (X10TypeSystem) ts; - XLocal var = xts.xtypeTranslator().trans(this, t); - c.addSelfBinding(var); - rightType = X10TypeMixin.xclause(X10TypeMixin.baseType(t), c); - } - catch (SemanticException f) { - throw new InternalCompilerError("Could not add self binding.", f); - } - catch (XFailure f) { - throw new InternalCompilerError("Could not add self binding.", f); - } - } - } - else { - rightType = t; - } - - assert rightType != null; + rightType = type(); + assert rightType != null : "The type() for " + this + " at " + position() + " is null."; + Flags flags = flags(); + if ((! flags.isFinal())|| rightType instanceof UnknownType) { + return rightType; } - - return rightType; + // If the local variable is final, replace T by T{self==t}, + // do this even if depclause==null + try { + XConstraint c = X10TypeMixin.xclause(rightType); + if (c == null) + c = new XConstraint_c(); + else + c = c.copy(); + X10TypeSystem xts = (X10TypeSystem) ts; + XLocal var = xts.xtypeTranslator().trans(this, rightType); + c.addSelfBinding(var); + rightType = X10TypeMixin.xclause(X10TypeMixin.baseType(rightType), c); + assert rightType != null; + return rightType; + } + catch (SemanticException f) { + throw new InternalCompilerError("Could not add self binding.", f); + } + catch (XFailure f) { + throw new InternalCompilerError("Could not add self binding.", f); + } } + + public String toString() { String s = "local " + X10Flags.toX10Flags(flags()).prettyPrint() + name() + ": " + type(); return s; Modified: trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -451,14 +451,13 @@ while (! worklist.isEmpty()) { Type w = worklist.removeFirst(); - // Expand macros, remove constraints - Type expanded = X10TypeMixin.baseType(w); + - if (visited.contains(expanded)) { + if (visited.contains(w)) { continue; } - visited.add(expanded); + visited.add(w); // // Get constraints from the type's where clause. // XConstraint wc = X10TypeMixin.xclause(w); @@ -467,6 +466,8 @@ // worklist.addAll(b); // } + // Expand macros, remove constraints + Type expanded = X10TypeMixin.baseType(w); if (expanded instanceof ParameterType) { ParameterType pt = (ParameterType) expanded; X10Def def = (X10Def) Types.get(pt.def()); @@ -478,7 +479,7 @@ } continue; } - result.add(expanded); + result.add(w); } if (kind == Bound.UPPER && result.isEmpty()) Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -20,6 +20,7 @@ import polyglot.ast.Unary; import polyglot.ast.Binary.Operator; import polyglot.frontend.Globals; +import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.Context; import polyglot.types.FieldInstance; @@ -44,6 +45,7 @@ import x10.constraint.XPromise; import x10.constraint.XRoot; import x10.constraint.XTerm; +import x10.constraint.XTerms; import x10.constraint.XVar; /** @@ -53,6 +55,22 @@ public class X10TypeMixin { + public static X10FieldInstance getProperty(Type t, Name propName) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + try { + Context c = xts.emptyContext(); + t = X10TypeMixin.ensureSelfBound(t); + X10FieldInstance fi = (X10FieldInstance) xts.findField(t, xts.FieldMatcher(t, propName, c)); + if (fi != null && fi.isProperty()) { + return fi; + } + } + catch (SemanticException e) { + // ignore + } + return null; + } + public static Type instantiate(Type t, Type... typeArg) { if (t instanceof X10ParsedClassType) { X10ParsedClassType ct = (X10ParsedClassType) t; @@ -411,20 +429,20 @@ } public static Type setSelfVar(Type t, XVar v) throws SemanticException { - XConstraint c = xclause(t); - if (c == null) { - c = new XConstraint_c(); - } - else { - c = c.copy(); - } - try { - c.addSelfBinding(v); - } - catch (XFailure e) { - throw new SemanticException(e.getMessage(), t.position()); - } - return xclause(X10TypeMixin.baseType(t), c); + XConstraint c = xclause(t); + if (c == null) { + c = new XConstraint_c(); + } + else { + c = c.copy(); + } + try { + c.addSelfBinding(v); + } + catch (XFailure e) { + throw new SemanticException(e.getMessage(), t.position()); + } + return xclause(X10TypeMixin.baseType(t), c); } public static Type setThisVar(Type t, XVar v) throws SemanticException { @@ -608,4 +626,210 @@ } } } + + protected static boolean amIProperty(Type t, Name propName, X10Context context) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + XConstraint r = realX(t); + + // first try self.p + X10FieldInstance fi = getProperty(t, propName); + if (fi != null) { + try { + XConstraint c = new XConstraint_c(); + XVar term = xts.xtypeTranslator().trans(c, c.self(), fi); + c.addBinding(term, xts.xtypeTranslator().trans(true)); + return r.entails(c, context.constraintProjection(r, c)); + } + catch (XFailure f) { + return false; + } + catch (SemanticException f) { + return false; + } + } + else { + // try self.p() + try { + X10MethodInstance mi = xts.findMethod(t, xts.MethodMatcher(t, propName, Collections.EMPTY_LIST, xts.emptyContext())); + XTerm body = mi.body(); + XConstraint c = new XConstraint_c(); + body = body.subst(c.self(), mi.x10Def().thisVar()); + c.addTerm(body); + return r.entails(c, context.constraintProjection(r, c)); + } + catch (XFailure f) { + return false; + } + catch (SemanticException f) { + return false; + } + } + } + + public static boolean isRect(Type t, X10Context context) { + return amIProperty(t, Name.make("rect"), context); + } + + public static XTerm onePlace(Type t) { + return find(t, Name.make("onePlace")); + } + + public static boolean isZeroBased(Type t, X10Context context) { + if (isRail(t, context)) return true; + return amIProperty(t, Name.make("zeroBased"), context); + } + + public static boolean isRail(Type t, X10Context context) { + return amIProperty(t, Name.make("rail"), context); + } + + public static XTerm distribution(Type t) { + return findProperty(t, Name.make("dist")); + } + + public static XTerm region(Type t) { + return findProperty(t, Name.make("region")); + } + + public static XTerm find(Type t, Name propName) { + XTerm val = findProperty(t, propName); + + if (val == null) { + XConstraint c = realX(t); + if (c != null) { + // build the synthetic term. + XTerm var = selfVar(c); + if (var !=null) { + X10FieldInstance fi = getProperty(t, propName); + if (fi != null) { + + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + val = xts.xtypeTranslator().trans(c, var, fi); + + } + } + } + } + return val; + } + + public static boolean isRankOne(Type t, X10Context context) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + return isRail(t, context) || xts.ONE().equals(X10TypeMixin.rank(t, context)); + } + + public static boolean isRankTwo(Type t, X10Context context) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + return xts.TWO().equals(X10TypeMixin.rank(t, context)); + } + + public static boolean isRankThree(Type t, X10Context context) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + return xts.THREE().equals(X10TypeMixin.rank(t, context)); + } + + static XTerm findProperty(Type t, Name propName) { + XConstraint c = realX(t); + if (c == null) return null; + + // TODO: check dist.region.p and region.p + try { + FieldInstance fi = getProperty(t, propName); + if (fi != null) + return c.find(XTerms.makeName(fi.def())); + } + catch (XFailure e) { + } + return null; + } + + public static XTerm rank(Type t, X10Context context) { + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + if (isRail(t, context)) + return xts.ONE(); + return findOrSythesize(t, Name.make("rank")); + } + + public static Type railBaseType(Type t) { + t = baseType(t); + if (t instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) t; + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + ClassType a = (ClassType) ts.Rail(); + ClassType v = (ClassType) ts.ValRail(); + if (ct.def() == a.def() || ct.def() == v.def()) + return ct.typeArguments().get(0); + else + arrayBaseType(ct.superClass()); + } + return null; + } + + public static Type arrayBaseType(Type t) { + t = baseType(t); + if (t instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) t; + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + ClassType a = (ClassType) ts.Array(); + if (ct.def() == a.def()) + return ct.typeArguments().get(0); + else + arrayBaseType(ct.superClass()); + } + return null; + } + + public static boolean isVarArray(Type t) { + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + Type tt = baseType(t); + Type at = baseType(ts.Array()); + if (tt instanceof ClassType && at instanceof ClassType) { + ClassDef tdef = ((ClassType) tt).def(); + ClassDef adef = ((ClassType) at).def(); + return ts.descendsFrom(tdef, adef); + } + return false; + } + + public static boolean isX10Array(Type t) { + return isVarArray(t); + } + + static XTerm findOrSythesize(Type t, Name propName) { + return find(t, propName); + } + + public static XVar self(Type t) { + XConstraint c = realX(t); + if (c == null) + return null; + return selfVar(c); + } + /** + * We need to ensure that there is a symbolic name for this type. i.e. self is bound to some variable. + * So if it is not, please create a new EQV and bind self to it. + * + * This is done in particular before getting field instances of this type. This ensures + * that the field instance can be computed accurately, that is the constraint + * self = t.f can be added to it, where t is the selfBinding for the container (i.e. this). + * + */ + + public static Type ensureSelfBound(Type t) { + if (t instanceof ConstrainedType) { + ((ConstrainedType) t).ensureSelfBound(); + return t; + } + XVar v = selfVarBinding(t); + if (v !=null) + return t; + try { + t = setSelfVar(t, XConstraint_c.genEQV()); + } catch (SemanticException z) { + + } + if (selfVarBinding(t) == null) + assert selfVarBinding(t) != null; + return t; + } } Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -2261,6 +2261,7 @@ } public X10FieldMatcher FieldMatcher(Type container, Name name, Context context) { + container = X10TypeMixin.ensureSelfBound(container); return new X10FieldMatcher(container, name, context); } @@ -2275,29 +2276,32 @@ if (fi == null) return null; - Type c = container != null ? container : fi.container(); + Type c = container != null + ? container + : fi.container(); XVar v = X10TypeMixin.selfVarBinding(c); - if (v == null) - v = new XConstraint_c().genEQV(); + // ensureBound should have been called on container. + X10TypeSystem ts = (X10TypeSystem) fi.typeSystem(); - XRoot oldThis = ts.xtypeTranslator().transThisWithoutTypeConstraint(); - if (XTypeTranslator.THIS_VAR) - oldThis = fi.x10Def().thisVar(); - - Type t = fi.type(); - Type newT = oldThis == null ? t - : Subst.subst(t, (new XVar[] { v }), (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); + XRoot oldThis = fi.x10Def().thisVar(); + if (oldThis != null && v == null) + assert false; // TODO: vj: 08/11/09 // Shouldnt we be setting thisVar on the type? - + Type t = fi.type(); Type rt = fi.rightType(); - Type newRT = oldThis == null ? rt : Subst.subst(rt, (new XVar[] { v }), (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); - - if (!ts.consistent(newT, (X10Context) context) || !ts.consistent(newRT, (X10Context) context)) { + if (v != null && oldThis != null) { + t = Subst.subst(t, (new XVar[] { v }), + (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); + rt = Subst.subst(rt, (new XVar[] { v }), (new XRoot[] { oldThis }), + new Type[] {}, new ParameterType[] {}); + rt = X10TypeMixin.setThisVar(rt, v); + } + if (!ts.consistent(t, (X10Context) context) || !ts.consistent(rt, (X10Context) context)) { throw new SemanticException("Type of field access is not consistent."); } - return fi.type(newT, newRT); + return fi.type(t, rt); } } @@ -2563,15 +2567,17 @@ public boolean isHere(Receiver r, X10Context xc) { try { XConstraint pc = xc.currentPlaceTerm().xconstraint(); - XTerm target = xtypeTranslator().trans(pc, r, xc); Type rType = r.type(); + XTerm target = X10TypeMixin.selfVarBinding(rType); // if (target == null) { + target = xtypeTranslator().trans(pc, r, xc); + if (target == null) // The receiver is not named. So make up a new name. // The only thing we know about the name is that it is of rType, - target = XConstraint_c.genUQV(); + target = XConstraint_c.genEQV(); } - rType = X10TypeMixin.setSelfVar(rType, (XVar) target); - + // rType = X10TypeMixin.setSelfVar(rType, (XVar) target); + rType = Subst.subst(rType, target, (XRoot) X10TypeMixin.selfVar(rType)); assert xc.currentPlaceTerm() != null; assert locVar(target, xc) != null; pc.addBinding(locVar(target,xc), xc.currentPlaceTerm().term()); @@ -2593,4 +2599,10 @@ return false; } + + public FieldInstance findField(Type container, TypeSystem_c.FieldMatcher matcher) + throws SemanticException { + container = X10TypeMixin.ensureSelfBound(container); + return super.findField(container, matcher); + } } Modified: trunk/x10.compiler/src/x10/util/Synthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/Synthesizer.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/util/Synthesizer.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -55,7 +55,6 @@ import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.ClosureDef; -import x10.types.X10ArraysMixin; import x10.types.X10Context; import x10.types.X10Context_c; import x10.types.X10FieldInstance; @@ -153,7 +152,7 @@ public static XTerm makeProperty(Type type, XVar receiver, String name) { X10FieldInstance fi = - X10ArraysMixin.getProperty(type, Name.make(name)); + X10TypeMixin.getProperty(type, Name.make(name)); XName field = XTerms.makeName(fi.def(), Types.get(fi.def().container()) + "#" + fi.name().toString()); Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -153,7 +153,6 @@ import x10.types.ClosureType; import x10.types.MacroType; import x10.types.ParameterType; -import x10.types.X10ArraysMixin; import x10.types.X10ClassDef; import x10.types.X10ClassType; import x10.types.X10ConstructorDef; @@ -309,7 +308,7 @@ X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); Flags flags = n.flags().flags(); - + if (n.name().id().toString().equals("main") && flags.isPublic() && flags.isStatic() && @@ -1152,7 +1151,7 @@ /* TODO: case: for (point p:D) -- discuss with vj */ /* handled cases: exploded syntax like: for (point p[i,j]:D) and for (point [i,j]:D) */ - if (Configuration.LOOP_OPTIMIZATIONS && form.hasExplodedVars() && (ts.isSubtype(f.domain().type(), ts.Region(), context) || ts.isSubtype(f.domain().type(), ts.Dist(), context)) && X10ArraysMixin.isRect(f.domain().type(), context)) { + if (Configuration.LOOP_OPTIMIZATIONS && form.hasExplodedVars() && (ts.isSubtype(f.domain().type(), ts.Region(), context) || ts.isSubtype(f.domain().type(), ts.Dist(), context)) && X10TypeMixin.isRect(f.domain().type(), context)) { String regVar = getId().toString(); List<Name> idxs = new ArrayList<Name>(); List<Name> lims = new ArrayList<Name>(); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -189,7 +189,6 @@ import x10.types.ClosureInstance; import x10.types.ParameterType; import x10.types.ParameterType_c; -import x10.types.X10ArraysMixin; import x10.types.X10ClassDef; import x10.types.X10ClassType; import x10.types.X10ConstructorInstance; @@ -2870,7 +2869,7 @@ Type dType = domain.type(); if (Configuration.LOOP_OPTIMIZATIONS && form.hasExplodedVars() && form.isUnnamed() && xts.isPoint(form.type().type()) && - (X10ArraysMixin.isRect(dType, context))) + (X10TypeMixin.isRect(dType, context))) { assert (xts.isPoint(form.type().type())); assert (xts.isX10Array(dType) || xts.isDistribution(dType) || xts.isRegion(dType)); Modified: trunk/x10.constraints/src/x10/constraint/XTerm_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerm_c.java 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.constraints/src/x10/constraint/XTerm_c.java 2009-09-20 09:32:18 UTC (rev 11262) @@ -61,7 +61,7 @@ } public boolean prefersBeingBound() { - return hasEQV(); + return toString().startsWith("_self") || hasEQV(); } protected boolean isAtomicFormula = false; Modified: trunk/x10.runtime/src-x10/x10/array/PolyRow.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyRow.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.runtime/src-x10/x10/array/PolyRow.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -32,17 +32,15 @@ // // - def this(as: ValRail[int]): PolyRow(as.length-1) { - super(as); - property(as.length-1); - } - def this(as: Rail[int]): PolyRow(as.length-1) { + def this(as: ValRail[int])= this(as, as.length-1); + + private def this(as: ValRail[int], n:int): PolyRow(n) { super(as); - property(as.length-1); + property(n); } - def this(p:Point, k:int) { + def this(p:Point, k:int) { super(p.rank+1, (i:nat) => i<p.rank? p(i) : k); property(p.rank); } Modified: trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -48,7 +48,7 @@ max3 = pm.rank>=4 && pm.isBounded()? pm.rectMax()(3) : 0; } - public static def make1(val min: Rail[int]!, val max: Rail[int]!): Region{self.rank==min.length&&self.rect} { // XTENLANG-4 + public static def make1(min: Rail[int]!, max: Rail[int]!): Region{self.rank==min.length&&self.rect} { // XTENLANG-4 if (max.length!=min.length) throw U.illegal("min and max must have same length"); Modified: trunk/x10.runtime/src-x10/x10/lang/Place.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Place.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.runtime/src-x10/x10/lang/Place.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -12,15 +12,18 @@ * @author Christian Grothoff * @author Raj Barik, Vivek Sarkar * @author tardieu + * @author vj */ public final value Place(id: int) { public const MAX_PLACES = x10.runtime.NativeRuntime.MAX_PLACES; - public const places:ValRail[Place] = Rail.makeVal[Place](MAX_PLACES, ((id: int) => new Place(id))); - public const FIRST_PLACE:Place = place(0); + public const places = Rail.makeVal[Place](MAX_PLACES, ((id: int) => new Place(id))); + public const FIRST_PLACE: Place(0) = places(0) as Place(0); - public def this(id: int) = property(id); + public def this(id: int):Place{self.id==id} { + property(id); + } - public static def place(id: int): Place = places(id); + public static def place(id: int) = places(id); public def next(): Place = next(1); Modified: trunk/x10.runtime/src-x10/x10/lang/_.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/_.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.runtime/src-x10/x10/lang/_.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -60,20 +60,21 @@ public static type int32 = int; public static type int64 = long; - public static type Point(r: Int) = Point{rank==r}; + public static type Point(r: Int) = Point{self.rank==r}; + public static type Place(id:Int) = Place{self.id==id}; - public static type Region(r:Nat) = Region{rank==r}; - public static type RectRegion(r:Nat) = Region{rect && rank==r}; + public static type Region(r:Nat) = Region{self.rank==r}; + public static type RectRegion(r:Nat) = Region{self.rect && self.rank==r}; - public static type Dist(r:Nat) = Dist{rank==r}; - public static type Dist(r:Region) = Dist{region==r}; + public static type Dist(r:Nat) = Dist{self.rank==r}; + public static type Dist(r:Region) = Dist{self.region==r}; - public static type Array[T](r:Nat) = Array[T]{rank==r}; - public static type Array[T](r:Region) = Array[T]{region==r}; - public static type Array[T](d:Dist) = Array[T]{dist==d}; + public static type Array[T](r:Nat) = Array[T]{self.rank==r}; + public static type Array[T](r:Region) = Array[T]{self.region==r}; + public static type Array[T](d:Dist) = Array[T]{self.dist==d}; - public static type ValRail[T](n:Nat) = ValRail[T]{length==n}; - public static type Rail[T](n:Nat) = Rail[T]{length==n}; + public static type ValRail[T](n:Nat) = ValRail[T]{self.length==n}; + public static type Rail[T](n:Nat) = Rail[T]{self.length==n}; public static type Console = x10.io.Console; } Modified: trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -16,15 +16,15 @@ */ public class B_CheckThisTypeInCall extends x10Test { class Test(rank:Int) { - class R(rank:Int) { - def check( tt:Test{self.rank==this.rank}) {} - def this(r:Int){property(r);} - } - def this(r:Int){property(r);} - var r:R!{self.rank == this.rank} =null; - def m(t:Test{self.rank==this.rank}) { - r.check(t); - } + class R(rank:Int) { + def check( tt:Test{self.rank==this.rank}) {} + def this(r:Int){property(r);} + } + def this(r:Int){property(r);} + var r:R!{self.rank == this.rank} =null; + def m(t:Test{self.rank==this.rank}) { + r.check(t); + } } public def run() = true; Added: trunk/x10.tests/examples/Constructs/Place/FieldReceiverIsExpr.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/FieldReceiverIsExpr.x10 (rev 0) +++ trunk/x10.tests/examples/Constructs/Place/FieldReceiverIsExpr.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -0,0 +1,35 @@ +/* + * + * (C) Copyright IBM Corporation 2006 + * + * This file is part of X10 Test. + * + */ +import harness.x10Test; + +/** + * + * Test that constraints are correctly propagated through when a field's receiver is an expression e. + * The expression may be of type Foo!. If the field Foo.f is declared of type Fum!, then it must be the + * case that e.f's location is statically known to be here. + + * @author vj + */ +public class FieldReceiverIsExpr extends x10Test { + + class F { + val f:F!; + def m(){} + def this(f:F!) { this.f=f;} + } + def m() { + (new F(null) as F!).f.m(); + } + + public def run() = true; + + public static def main(Rail[String]) { + new FieldReceiverIsExpr().execute(); + } + +} Modified: trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStruct.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStruct.x10 2009-09-18 22:13:30 UTC (rev 11261) +++ trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStruct.x10 2009-09-20 09:32:18 UTC (rev 11262) @@ -22,7 +22,7 @@ } } - val c = new C[String]("1"); + val c = C[String]("1"); public def run02(): boolean = { val p = Place.places(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2009-09-28 19:56:30
|
Revision: 11311 http://x10.svn.sourceforge.net/x10/?rev=11311&view=rev Author: tardieu Date: 2009-09-28 19:56:23 +0000 (Mon, 28 Sep 2009) Log Message: ----------- added support for GC on MacOSX added -enable-thread-local-alloc to GC configuration added GC_INIT() call in alloc.h Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/x10aux/alloc.h trunk/x10.runtime/src-cpp/x10aux/bootstrap.h Added Paths: ----------- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) @@ -232,6 +232,8 @@ return new AIX_CXXCommandBuilder(options); if (PLATFORM.startsWith("sunos_")) return new SunOS_CXXCommandBuilder(options); + if (PLATFORM.startsWith("macosx_")) + return new MacOSX_CXXCommandBuilder(options); eq.enqueue(ErrorInfo.WARNING, "Unknown platform '"+PLATFORM+"'; using the default post-compiler (g++)"); return new CXXCommandBuilder(options); Added: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java (rev 0) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) @@ -0,0 +1,26 @@ +/** + * + */ +package x10cpp.postcompiler; + +import java.util.ArrayList; + +import polyglot.main.Options; + +public class MacOSX_CXXCommandBuilder extends CXXCommandBuilder { + + public MacOSX_CXXCommandBuilder(Options options) { + super(options); + assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); + } + + protected boolean gcEnabled() { return true; } + + protected void addPreArgs(ArrayList<String> cxxCmd) { + super.addPreArgs(cxxCmd); + } + + protected void addPostArgs(ArrayList<String> cxxCmd) { + super.addPostArgs(cxxCmd); + } +} Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/build.xml 2009-09-28 19:56:23 UTC (rev 11311) @@ -66,6 +66,7 @@ <isfalse value="${DISABLE_GC}" /> <or> <os family="unix" name="linux"/> + <os family="mac"/> </or> </and> </condition> @@ -227,6 +228,8 @@ <exec executable="${bash.exe}" dir="${bdwgc.dir}/src" failonerror="true"> <arg value="${bdwgc.dir}/src/configure" /> <arg value="-enable-threads=posix" /> + <arg value="-enable-thread-local-alloc" /> + <arg value="CFLAGS=-D_XOPEN_SOURCE" /> <arg value="--prefix=${bdwgc.platform.dir}/install" /> </exec> <exec executable="${make.exe}" dir="${bdwgc.dir}/src" failonerror="true"> Modified: trunk/x10.runtime/src-cpp/x10aux/alloc.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 19:56:23 UTC (rev 11311) @@ -4,9 +4,7 @@ #include <x10aux/config.h> #ifdef X10_USE_BDWGC -#ifdef __linux__ -#define GC_LINUX_THREADS -#endif +#define GC_THREADS #include "gc.h" #endif @@ -41,9 +39,15 @@ void throwOOME() X10_PRAGMA_NORETURN; + static bool gc_init_done = false; + template<class T> T* alloc(size_t size = sizeof(T)) { _M_("Allocating " << size << " bytes of type " << TYPENAME(T)); #ifdef X10_USE_BDWGC + if (!gc_init_done) { + gc_init_done = true; + GC_INIT(); + } T* ret = (T*)GC_MALLOC(size); #else T* ret = (T*)malloc(size); Modified: trunk/x10.runtime/src-cpp/x10aux/bootstrap.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 19:56:23 UTC (rev 11311) @@ -1,13 +1,6 @@ #ifndef X10AUX_BOOTSTRAP_H #define X10AUX_BOOTSTRAP_H -#ifdef X10_USE_BDWGC -#ifdef __linux__ -#define GC_LINUX_THREADS -#endif -#include "gc.h" -#endif - #include <x10aux/config.h> #include <x10aux/alloc.h> #include <x10aux/place_local.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Cunningham, D. <dav...@im...> - 2009-09-28 23:28:24
|
GC_INIT is called on line 72 of bootstrap.h in the template_main function, but maybe this wasn't early enough. ________________________________________ From: x10...@li... [x10...@li...] On Behalf Of ta...@us... [ta...@us...] Sent: 28 September 2009 15:56 To: x10...@li... Subject: [X10-commits] SF.net SVN: x10:[11311] trunk Revision: 11311 http://x10.svn.sourceforge.net/x10/?rev=11311&view=rev Author: tardieu Date: 2009-09-28 19:56:23 +0000 (Mon, 28 Sep 2009) Log Message: ----------- added support for GC on MacOSX added -enable-thread-local-alloc to GC configuration added GC_INIT() call in alloc.h Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/x10aux/alloc.h trunk/x10.runtime/src-cpp/x10aux/bootstrap.h Added Paths: ----------- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) @@ -232,6 +232,8 @@ return new AIX_CXXCommandBuilder(options); if (PLATFORM.startsWith("sunos_")) return new SunOS_CXXCommandBuilder(options); + if (PLATFORM.startsWith("macosx_")) + return new MacOSX_CXXCommandBuilder(options); eq.enqueue(ErrorInfo.WARNING, "Unknown platform '"+PLATFORM+"'; using the default post-compiler (g++)"); return new CXXCommandBuilder(options); Added: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java (rev 0) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) @@ -0,0 +1,26 @@ +/** + * + */ +package x10cpp.postcompiler; + +import java.util.ArrayList; + +import polyglot.main.Options; + +public class MacOSX_CXXCommandBuilder extends CXXCommandBuilder { + + public MacOSX_CXXCommandBuilder(Options options) { + super(options); + assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); + } + + protected boolean gcEnabled() { return true; } + + protected void addPreArgs(ArrayList<String> cxxCmd) { + super.addPreArgs(cxxCmd); + } + + protected void addPostArgs(ArrayList<String> cxxCmd) { + super.addPostArgs(cxxCmd); + } +} Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/build.xml 2009-09-28 19:56:23 UTC (rev 11311) @@ -66,6 +66,7 @@ <isfalse value="${DISABLE_GC}" /> <or> <os family="unix" name="linux"/> + <os family="mac"/> </or> </and> </condition> @@ -227,6 +228,8 @@ <exec executable="${bash.exe}" dir="${bdwgc.dir}/src" failonerror="true"> <arg value="${bdwgc.dir}/src/configure" /> <arg value="-enable-threads=posix" /> + <arg value="-enable-thread-local-alloc" /> + <arg value="CFLAGS=-D_XOPEN_SOURCE" /> <arg value="--prefix=${bdwgc.platform.dir}/install" /> </exec> <exec executable="${make.exe}" dir="${bdwgc.dir}/src" failonerror="true"> Modified: trunk/x10.runtime/src-cpp/x10aux/alloc.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 19:56:23 UTC (rev 11311) @@ -4,9 +4,7 @@ #include <x10aux/config.h> #ifdef X10_USE_BDWGC -#ifdef __linux__ -#define GC_LINUX_THREADS -#endif +#define GC_THREADS #include "gc.h" #endif @@ -41,9 +39,15 @@ void throwOOME() X10_PRAGMA_NORETURN; + static bool gc_init_done = false; + template<class T> T* alloc(size_t size = sizeof(T)) { _M_("Allocating " << size << " bytes of type " << TYPENAME(T)); #ifdef X10_USE_BDWGC + if (!gc_init_done) { + gc_init_done = true; + GC_INIT(); + } T* ret = (T*)GC_MALLOC(size); #else T* ret = (T*)malloc(size); Modified: trunk/x10.runtime/src-cpp/x10aux/bootstrap.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 13:19:46 UTC (rev 11310) +++ trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 19:56:23 UTC (rev 11311) @@ -1,13 +1,6 @@ #ifndef X10AUX_BOOTSTRAP_H #define X10AUX_BOOTSTRAP_H -#ifdef X10_USE_BDWGC -#ifdef __linux__ -#define GC_LINUX_THREADS -#endif -#include "gc.h" -#endif - #include <x10aux/config.h> #include <x10aux/alloc.h> #include <x10aux/place_local.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ X10-commits mailing list X10...@li... https://lists.sourceforge.net/lists/listinfo/x10-commits |
From: David P G. <gr...@us...> - 2009-09-29 01:13:47
|
Apparently this wasn't early enough on MacOSX. Static initialization with calls to GC_ALLOC is happening before the call to GC_INIT. Checking on every call to alloc isn't a good long term solution since obviously there is some overhead for that. We need to find the right way to get in and make the call to GC_INIT happen very early in the startup process (ie, either before the C main gets called, or we have to be much more careful about what we do in C++-level static initializers). --dave "Cunningham, David" <dav...@im...> wrote on 09/28/2009 07:28:04 PM: > From: > > "Cunningham, David" <dav...@im...> > > To: > > "ta...@us..." <ta...@us...>, > "x10...@li..." <x10...@li...> > > Date: > > 09/28/2009 07:29 PM > > Subject: > > Re: [X10-commits] SF.net SVN: x10:[11311] trunk > > GC_INIT is called on line 72 of bootstrap.h in the template_main > function, but maybe this wasn't early enough. > ________________________________________ > From: x10...@li... [x10-commits- > bo...@li...] On Behalf Of > ta...@us... [ta...@us...] > Sent: 28 September 2009 15:56 > To: x10...@li... > Subject: [X10-commits] SF.net SVN: x10:[11311] trunk > > Revision: 11311 > http://x10.svn.sourceforge.net/x10/?rev=11311&view=rev > Author: tardieu > Date: 2009-09-28 19:56:23 +0000 (Mon, 28 Sep 2009) > > Log Message: > ----------- > added support for GC on MacOSX > added -enable-thread-local-alloc to GC configuration > added GC_INIT() call in alloc.h > > Modified Paths: > -------------- > trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java > trunk/x10.runtime/build.xml > trunk/x10.runtime/src-cpp/x10aux/alloc.h > trunk/x10.runtime/src-cpp/x10aux/bootstrap.h > > Added Paths: > ----------- > trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java > > Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java > =================================================================== > --- trunk/x10.compiler/src/x10cpp/postcompiler/ > CXXCommandBuilder.java 2009-09-28 13:19:46 UTC (rev 11310) > +++ trunk/x10.compiler/src/x10cpp/postcompiler/ > CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) > @@ -232,6 +232,8 @@ > return new AIX_CXXCommandBuilder(options); > if (PLATFORM.startsWith("sunos_")) > return new SunOS_CXXCommandBuilder(options); > + if (PLATFORM.startsWith("macosx_")) > + return new MacOSX_CXXCommandBuilder(options); > eq.enqueue(ErrorInfo.WARNING, > "Unknown platform '"+PLATFORM+"'; using the default > post-compiler (g++)"); > return new CXXCommandBuilder(options); > > Added: trunk/x10.compiler/src/x10cpp/postcompiler/ > MacOSX_CXXCommandBuilder.java > =================================================================== > --- trunk/x10.compiler/src/x10cpp/postcompiler/ > MacOSX_CXXCommandBuilder.java (rev 0) > +++ trunk/x10.compiler/src/x10cpp/postcompiler/ > MacOSX_CXXCommandBuilder.java 2009-09-28 19:56:23 UTC (rev 11311) > @@ -0,0 +1,26 @@ > +/** > + * > + */ > +package x10cpp.postcompiler; > + > +import java.util.ArrayList; > + > +import polyglot.main.Options; > + > +public class MacOSX_CXXCommandBuilder extends CXXCommandBuilder { > + > + public MacOSX_CXXCommandBuilder(Options options) { > + super(options); > + assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); > + } > + > + protected boolean gcEnabled() { return true; } > + > + protected void addPreArgs(ArrayList<String> cxxCmd) { > + super.addPreArgs(cxxCmd); > + } > + > + protected void addPostArgs(ArrayList<String> cxxCmd) { > + super.addPostArgs(cxxCmd); > + } > +} > > Modified: trunk/x10.runtime/build.xml > =================================================================== > --- trunk/x10.runtime/build.xml 2009-09-28 13:19:46 UTC (rev 11310) > +++ trunk/x10.runtime/build.xml 2009-09-28 19:56:23 UTC (rev 11311) > @@ -66,6 +66,7 @@ > <isfalse value="${DISABLE_GC}" /> > <or> > <os family="unix" name="linux"/> > + <os family="mac"/> > </or> > </and> > </condition> > @@ -227,6 +228,8 @@ > <exec executable="${bash.exe}" dir="${bdwgc.dir}/src" > failonerror="true"> > <arg value="${bdwgc.dir}/src/configure" /> > <arg value="-enable-threads=posix" /> > + <arg value="-enable-thread-local-alloc" /> > + <arg value="CFLAGS=-D_XOPEN_SOURCE" /> > <arg value="--prefix=${bdwgc.platform.dir}/install" /> > </exec> > <exec executable="${make.exe}" dir="${bdwgc.dir}/src" > failonerror="true"> > > Modified: trunk/x10.runtime/src-cpp/x10aux/alloc.h > =================================================================== > --- trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 13:19:46 > UTC (rev 11310) > +++ trunk/x10.runtime/src-cpp/x10aux/alloc.h 2009-09-28 19:56:23 > UTC (rev 11311) > @@ -4,9 +4,7 @@ > #include <x10aux/config.h> > > #ifdef X10_USE_BDWGC > -#ifdef __linux__ > -#define GC_LINUX_THREADS > -#endif > +#define GC_THREADS > #include "gc.h" > #endif > > @@ -41,9 +39,15 @@ > > void throwOOME() X10_PRAGMA_NORETURN; > > + static bool gc_init_done = false; > + > template<class T> T* alloc(size_t size = sizeof(T)) { > _M_("Allocating " << size << " bytes of type " << TYPENAME(T)); > #ifdef X10_USE_BDWGC > + if (!gc_init_done) { > + gc_init_done = true; > + GC_INIT(); > + } > T* ret = (T*)GC_MALLOC(size); > #else > T* ret = (T*)malloc(size); > > Modified: trunk/x10.runtime/src-cpp/x10aux/bootstrap.h > =================================================================== > --- trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 > 13:19:46 UTC (rev 11310) > +++ trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-09-28 > 19:56:23 UTC (rev 11311) > @@ -1,13 +1,6 @@ > #ifndef X10AUX_BOOTSTRAP_H > #define X10AUX_BOOTSTRAP_H > > -#ifdef X10_USE_BDWGC > -#ifdef __linux__ > -#define GC_LINUX_THREADS > -#endif > -#include "gc.h" > -#endif > - > #include <x10aux/config.h> > #include <x10aux/alloc.h> > #include <x10aux/place_local.h> > > > This was sent by the SourceForge.net collaborative development > platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > X10-commits mailing list > X10...@li... > https://lists.sourceforge.net/lists/listinfo/x10-commits > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > X10-commits mailing list > X10...@li... > https://lists.sourceforge.net/lists/listinfo/x10-commits |
From: <spa...@us...> - 2009-11-16 09:02:03
|
Revision: 12072 http://x10.svn.sourceforge.net/x10/?rev=12072&view=rev Author: sparksparkspark Date: 2009-11-16 09:01:57 +0000 (Mon, 16 Nov 2009) Log Message: ----------- Moved the Cell from SPMD into x10.lang (beside Box) Modified Paths: -------------- trunk/x10.dist/samples/KMeansSPMD.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/lang/Cell.x10 Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2009-11-16 09:01:05 UTC (rev 12071) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2009-11-16 09:01:57 UTC (rev 12072) @@ -51,13 +51,6 @@ Rail.make[Float](CLUSTERS*DIM, (i:Int) => central_clusters(i)); val central_cluster_counts = Rail.make[Int](CLUSTERS, (i:Int) => 0); - class Cell[T] { - private var value:T; - def this(v:T) { this.value = v; } - global def get() = at (this) value; - global def set(v:T) { at (this) { value = v; }; } - } - val finished = new Cell[Boolean](false); // SPMD style for algorithm val clk = Clock.make(); Added: trunk/x10.runtime/src-x10/x10/lang/Cell.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Cell.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/lang/Cell.x10 2009-11-16 09:01:57 UTC (rev 12072) @@ -0,0 +1,17 @@ +package x10.lang; + +public final class Cell[T] { + + private var value:T; + + public def this (x:T) { value = x; } + + public global def toString () = at (this) value.toString(); + + public global def apply () = at (this) value; + public global def apply (x:T) { at (this) value = x; } + + public static operator[T] (x:Cell[T]) = x(); + public static operator[T] (x:T) = new Cell[T](x); + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |