From: <ipe...@us...> - 2010-06-28 01:11:59
|
Revision: 14697 http://x10.svn.sourceforge.net/x10/?rev=14697&view=rev Author: ipeshansky Date: 2010-06-28 01:11:53 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Remove references to polyglot.bytecode and asm. Modified Paths: -------------- trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/build.xml trunk/x10.dist/build.xml Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler/META-INF/MANIFEST.MF 2010-06-27 19:15:11 UTC (rev 14696) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2010-06-28 01:11:53 UTC (rev 14697) @@ -7,7 +7,6 @@ Require-Bundle: x10.common, x10.constraints, polyglot3;bundle-version="3.2.0", - polyglot.bytecode;bundle-version="1.0.0", lpg.runtime.java;bundle-version="2.0.18" Export-Package: x10, x10.ast, Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2010-06-27 19:15:11 UTC (rev 14696) +++ trunk/x10.compiler/build.xml 2010-06-28 01:11:53 UTC (rev 14697) @@ -15,12 +15,10 @@ <property name="config" value="*.cfg"/> <property name="lpg.jar" value="lpg.jar"/> <property name="polyglot.jar" value="polyglot3.jar"/> - <property name="asm.jar" value="asm.jar"/> <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="lpg.classpath"/> <path refid="polyglot.classpath"/> - <path refid="asm.classpath"/> <path refid="x10.constraints.classpath"/> <path refid="x10.common.classpath"/> </path> @@ -33,9 +31,6 @@ <path id="polyglot.classpath"> <pathelement location="${lib}/${polyglot.jar}"/> </path> - <path id="asm.classpath"> - <pathelement location="${lib}/${asm.jar}"/> - </path> <path id="x10.constraints.classpath"> <pathelement location="${x10.constraints.location}/classes"/> </path> Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2010-06-27 19:15:11 UTC (rev 14696) +++ trunk/x10.dist/build.xml 2010-06-28 01:11:53 UTC (rev 14697) @@ -15,12 +15,6 @@ <property name="polyglot.jar" value="polyglot3.jar"/> <property name="polyglot.url" value="http://polyglot-compiler.googlecode.com/svn/trunk/updates/plugins"/> <property name="polyglot.jar.url" value="${polyglot.url}/polyglot3_3.2.0.jar"/> - <property name="polyglot.bytecode.jar" value="polyglot-bytecode.jar"/> - <property name="polyglot.bytecode.url" value="http://polyglot-compiler.googlecode.com/svn/trunk/polyglot.bytecode/lib"/> - <property name="polyglot.bytecode.jar.url" value="${polyglot.bytecode.url}/polyglot-bytecode.jar"/> - <property name="asm.jar" value="asm.jar"/> - <property name="asm.url" value="http://polyglot-compiler.googlecode.com/svn/trunk/polyglot.bytecode/lib"/> - <property name="asm.jar.url" value="${asm.url}/asm-all-3.2.jar"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> <property name="constraints.jar" value="x10constraints.jar"/> <property name="x10.common.location" location="${x10.home}/x10.common"/> @@ -43,12 +37,6 @@ <condition property="local.polyglot.jar" value="${env.LOCAL_POLYGLOT_JAR}"> <isset property="env.LOCAL_POLYGLOT_JAR"/> </condition> - <condition property="local.polyglot.bytecode.jar" value="${env.LOCAL_POLYGLOT_BYTECODE_JAR}"> - <isset property="env.LOCAL_POLYGLOT_BYTECODE_JAR"/> - </condition> - <condition property="local.asm.jar" value="${env.LOCAL_ASM_JAR}"> - <isset property="env.LOCAL_ASM_JAR"/> - </condition> <condition property="local.lpg.jar" value="${env.LOCAL_LPG_JAR}"> <isset property="env.LOCAL_LPG_JAR"/> </condition> @@ -110,15 +98,11 @@ <available property="lpg.jar.present" file="${lib}/${lpg.jar}"/> <available property="ecj.jar.present" file="${lib}/${ecj.jar}"/> <available property="polyglot.jar.present" file="${lib}/${polyglot.jar}"/> - <available property="polyglot.bytecode.jar.present" file="${lib}/${polyglot.bytecode.jar}"/> - <available property="asm.jar.present" file="${lib}/${asm.jar}"/> <condition property="cache.up-to-date"> <and> <isset property="lpg.jar.present"/> <isset property="ecj.jar.present"/> <isset property="polyglot.jar.present"/> - <isset property="polyglot.bytecode.jar.present"/> - <isset property="asm.jar.present"/> </and> </condition> </target> @@ -163,34 +147,8 @@ <fail message="Unable to find ${polyglot.jar} at ${local.polyglot.jar}" unless="polyglot.jar.present"/> </target> - <target name="polyglot-bytecode-jar" depends="init,polyglot-bytecode-local-jar" unless="local.polyglot.bytecode.jar"> - <mkdir dir="${lib}"/> - <get usetimestamp="true" src="${polyglot.bytecode.jar.url}" dest="${lib}/${polyglot.bytecode.jar}"/> - <available property="polyglot.bytecode.jar.present" file="${lib}/${polyglot.bytecode.jar}"/> - <fail message="Unable to get ${polyglot.bytecode.jar} from ${polyglot.bytecode.jar.url}" unless="polyglot.bytecode.jar.present"/> - </target> - <target name="polyglot-bytecode-local-jar" depends="init" if="local.polyglot.bytecode.jar"> - <mkdir dir="${lib}"/> - <copy file="${local.polyglot.bytecode.jar}" tofile="${lib}/${polyglot.bytecode.jar}"/> - <available property="polyglot.bytecode.jar.present" file="${lib}/${polyglot.bytecode.jar}"/> - <fail message="Unable to find ${polyglot.bytecode.jar} at ${local.polyglot.bytecode.jar}" unless="polyglot.bytecode.jar.present"/> - </target> + <target name="update-jar-cache" depends="init,lpg-jar,ecj-jar,polyglot-jar"/> - <target name="asm-jar" depends="init,asm-local-jar" unless="local.asm.jar"> - <mkdir dir="${lib}"/> - <get usetimestamp="true" src="${asm.jar.url}" dest="${lib}/${asm.jar}"/> - <available property="asm.jar.present" file="${lib}/${asm.jar}"/> - <fail message="Unable to get ${asm.jar} from ${asm.jar.url}" unless="asm.jar.present"/> - </target> - <target name="asm-local-jar" depends="init" if="local.asm.jar"> - <mkdir dir="${lib}"/> - <copy file="${local.asm.jar}" tofile="${lib}/${asm.jar}"/> - <available property="asm.jar.present" file="${lib}/${asm.jar}"/> - <fail message="Unable to find ${asm.jar} at ${local.asm.jar}" unless="asm.jar.present"/> - </target> - - <target name="update-jar-cache" depends="init,lpg-jar,ecj-jar,polyglot-jar,polyglot-bytecode-jar,asm-jar"/> - <target name="prereq-jars" depends="init,check-jar-cache" unless="cache.up-to-date"> <antcall target="update-jar-cache"/> </target> @@ -352,13 +310,9 @@ #PATH_SEP='${path.separator}' #CONFIG_FILE='${config}' POLYGLOT_JAR='${polyglot.jar}' -POLYGLOT_BYTECODE_JAR='${polyglot.bytecode.jar}' -ASM_JAR='${asm.jar}' LPG_JAR='${lpg.jar}' ECJ_JAR='${ecj.jar}' POLYGLOT_URL='${polyglot.jar.url}' -POLYGLOT_BYTECODE_URL='${polyglot.bytecode.jar.url}' -ASM_URL='${asm.jar.url}' LPG_URL='${lpg.jar.url}' ECJ_URL='${ecj.jar.url}' @@ -515,7 +469,7 @@ <zip destfile="${src.zip.location}/x10-${src.zip.version}.zip"> <zipfileset prefix="" dir="${basedir}" includes="epl-v10.html,RELEASE.NOTES,BUILD"/> <zipfileset prefix="" dir="${x10.tests.location}" includes="TESTING"/> - <zipfileset prefix="x10.dist" dir="${basedir}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes=".launchConfigs/*,.classpath,.project,README,INSTALL,build*,exportPlugin.xml,bin/*.in,bin/x10c++,lib/${polyglot.jar},lib/${polyglot.bytecode.jar},lib/${asm.jar},lib/${lpg.jar},lib/${ecj.jar},samples/**"/> + <zipfileset prefix="x10.dist" dir="${basedir}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes=".launchConfigs/*,.classpath,.project,README,INSTALL,build*,exportPlugin.xml,bin/*.in,bin/x10c++,lib/${polyglot.jar},lib/${lpg.jar},lib/${ecj.jar},samples/**"/> <zipfileset prefix="x10.compiler" dir="${x10.compiler.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.runtime" dir="${x10.runtime.location}" excludes="releng/**,**/.*.swp,classes/**,src-cpp/gen/**"/> <zipfileset prefix="x10.constraints" dir="${x10.constraints.location}" excludes="releng/**,**/.*.swp,classes/**"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-06-30 05:10:33
|
Revision: 14712 http://x10.svn.sourceforge.net/x10/?rev=14712&view=rev Author: ipeshansky Date: 2010-06-30 03:12:08 +0000 (Wed, 30 Jun 2010) Log Message: ----------- Better desugaring of '++' and '--' (thanks, Bowen!). No more need for special treatment of these in the Java backend. Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10c/visit/Desugarer.java Removed Paths: ------------- trunk/x10.runtime/src-java/x10/core/UnaryPost.java trunk/x10.runtime/src-x10/x10/compiler/UnaryPost.x10 Modified: trunk/x10.compiler/src/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-06-30 01:58:08 UTC (rev 14711) +++ trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-06-30 03:12:08 UTC (rev 14712) @@ -826,28 +826,16 @@ return a; } - // x++ -> ((t:Int)=>t-1)(x+=1) or x-- -> ((t:Int)=>t+1)(x-=1) + // x++ -> (x+=1)-1 or x-- -> (x-=1)+1 protected Expr unaryPost(Position pos, X10Unary_c.Operator op, Expr e) throws SemanticException { Type ret = e.type(); - CanonicalTypeNode retTN = xnf.CanonicalTypeNode(pos, ret); Expr one = getLiteral(pos, ret, 1); Assign.Operator asgn = (op == X10Unary_c.POST_INC) ? Assign.ADD_ASSIGN : Assign.SUB_ASSIGN; X10Binary_c.Operator bin = (op == X10Unary_c.POST_INC) ? X10Binary_c.SUB : X10Binary_c.ADD; - Name t = Name.make("t"); - LocalDef fDef = xts.localDef(pos, xts.NoFlags(), Types.ref(ret), t); - Formal formal = xnf.Formal(pos, xnf.FlagsNode(pos, xts.NoFlags()), - retTN, xnf.Id(pos, t)).localDef(fDef); - List<Formal> parms = Arrays.asList(new Formal[] { formal }); - Expr tLocal = xnf.Local(pos, xnf.Id(pos, t)).localInstance(fDef.asInstance()).type(ret); - Expr adjust = visitBinary((X10Binary_c) xnf.Binary(pos, tLocal, bin, one).type(ret)); - Block block = xnf.Block(pos, xnf.Return(pos, adjust)); - Closure c = synth.makeClosure(pos, ret, parms, block, (X10Context) context); - X10MethodInstance ci = c.closureDef().asType().applyMethod(); Expr incr = assign(pos, e, asgn, one); if (e instanceof X10Call) incr = visitSettableAssign((SettableAssign_c) incr); - List<Expr> args = new ArrayList<Expr>(Arrays.asList(new Expr[] { incr })); - return xnf.ClosureCall(pos, c, args).closureInstance(ci).type(ret); + return visitBinary((X10Binary_c) xnf.Binary(pos, incr, bin, one).type(ret)); } // desugar unary operators Modified: trunk/x10.compiler/src/x10c/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10c/visit/Desugarer.java 2010-06-30 01:58:08 UTC (rev 14711) +++ trunk/x10.compiler/src/x10c/visit/Desugarer.java 2010-06-30 03:12:08 UTC (rev 14712) @@ -47,30 +47,7 @@ this.xnf = (X10NodeFactory) nf; } - private static final QName UNARY_POST = QName.make("x10.compiler.UnaryPost"); - private static final Name BEFORE_INCREMENT = Name.make("beforeIncrement"); - private static final Name BEFORE_DECREMENT = Name.make("beforeDecrement"); - @Override - protected Expr unaryPost(Position pos, Operator op, Expr e) throws SemanticException { - Type ret = e.type(); - if (ret.isNumeric()) { - CanonicalTypeNode retTN = xnf.CanonicalTypeNode(pos, ret); - Expr one = xnf.X10Cast(pos, retTN, (Expr) xnf.IntLit(pos, IntLit.INT, 1).typeCheck(this), Converter.ConversionType.PRIMITIVE).type(ret); - Assign.Operator asgn = (op == X10Unary_c.POST_INC) ? Assign.ADD_ASSIGN : Assign.SUB_ASSIGN; - Expr incr = assign(pos, e, asgn, one); - if (e instanceof X10Call) incr = visitSettableAssign((SettableAssign_c) incr); - List<Expr> args = Collections.singletonList(incr); - Type unaryPost = xts.typeForName(UNARY_POST); - Name beforeIncDec = (op == X10Unary_c.POST_INC) ? BEFORE_INCREMENT : BEFORE_DECREMENT; - List<Type> actualTypes = Collections.singletonList(ret); - X10MethodInstance mi = xts.findMethod(unaryPost, xts.MethodMatcher(unaryPost, beforeIncDec, Collections.EMPTY_LIST, actualTypes, context)); - return xnf.X10Call(pos, xnf.CanonicalTypeNode(pos, unaryPost), xnf.Id(pos, beforeIncDec), Collections.EMPTY_LIST, args).methodInstance(mi).type(ret); - } - return super.unaryPost(pos, op, e); - } - - @Override protected Expr visitSettableAssign(SettableAssign_c n) throws SemanticException { if (n.operator() != Assign.ASSIGN) { X10Call left = (X10Call) n.left(xnf, this); Deleted: trunk/x10.runtime/src-java/x10/core/UnaryPost.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/UnaryPost.java 2010-06-30 01:58:08 UTC (rev 14711) +++ trunk/x10.runtime/src-java/x10/core/UnaryPost.java 2010-06-30 03:12:08 UTC (rev 14712) @@ -1,27 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.core; - -public class UnaryPost { - public static byte beforeIncrement(byte t) { return (byte)(t - 1); } - public static byte beforeDecrement(byte t) { return (byte)(t + 1); } - public static short beforeIncrement(short t) { return (short)(t - 1); } - public static short beforeDecrement(short t) { return (short)(t + 1); } - public static int beforeIncrement(int t) { return t - 1; } - public static int beforeDecrement(int t) { return t + 1; } - public static long beforeIncrement(long t) { return t - 1L; } - public static long beforeDecrement(long t) { return t + 1L; } - public static float beforeIncrement(float t) { return t - 1.0F; } - public static float beforeDecrement(float t) { return t + 1.0F; } - public static double beforeIncrement(double t) { return t - 1.0; } - public static double beforeDecrement(double t) { return t + 1.0; } -} Deleted: trunk/x10.runtime/src-x10/x10/compiler/UnaryPost.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/UnaryPost.x10 2010-06-30 01:58:08 UTC (rev 14711) +++ trunk/x10.runtime/src-x10/x10/compiler/UnaryPost.x10 2010-06-30 03:12:08 UTC (rev 14712) @@ -1,41 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.compiler; - -import x10.compiler.Native; - -public abstract class UnaryPost { - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Byte): Byte = (v - 1) as Byte; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Byte): Byte = (v + 1) as Byte; - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Short): Short = (v - 1) as Short; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Short): Short = (v + 1) as Short; - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Int): Int = v - 1; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Int): Int = v + 1; - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Long): Long = v - 1L; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Long): Long = v + 1L; - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Float): Float = v - 1.0F; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Float): Float = v + 1.0F; - @Native("java", "x10.core.UnaryPost.beforeIncrement(#1)") - public static global safe def beforeIncrement(v:Double): Double = v - 1.0; - @Native("java", "x10.core.UnaryPost.beforeDecrement(#1)") - public static global safe def beforeDecrement(v:Double): Double = v + 1.0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-07-01 17:37:04
|
Revision: 14720 http://x10.svn.sourceforge.net/x10/?rev=14720&view=rev Author: ipeshansky Date: 2010-07-01 17:36:57 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Change annotation used by the C++ backend to put code in the header to @Header, leaving @Inline for the inliner. Inliner improvements: Support inlining void methods. Better support for inlining generic methods. Better detection of statically known method targets. Avoid re-typechecking the current job. Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/Inliner.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-x10/x10/array/Array.x10 trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 trunk/x10.runtime/src-x10/x10/compiler/Inline.x10 trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Header.x10 Property Changed: ---------------- trunk/x10.runtime/src-x10/x10/compiler/CUDADirectParams.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 Modified: trunk/x10.compiler/src/x10/visit/Inliner.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Inliner.java 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.compiler/src/x10/visit/Inliner.java 2010-07-01 17:36:57 UTC (rev 14720) @@ -46,6 +46,7 @@ import polyglot.ast.Local; import polyglot.ast.LocalAssign; import polyglot.ast.LocalDecl; +import polyglot.ast.MethodDecl; import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; @@ -79,12 +80,14 @@ import polyglot.types.Types; import polyglot.util.InternalCompilerError; import polyglot.util.Position; +import polyglot.util.SubtypeSet; import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; import polyglot.visit.TypeCheckPreparer; import x10.Configuration; import x10.ast.Closure; import x10.ast.ClosureCall; +import x10.ast.DepParameterExpr; import x10.ast.ParExpr; import x10.ast.SettableAssign; import x10.ast.StmtExpr; @@ -158,13 +161,15 @@ super(job, ts, nf); } + public static final QName INLINE_ANNOTATION = QName.make("x10.compiler.Inline"); + @Override public NodeVisitor begin() { try { - InlineType = (Type) ts.systemResolver().find(QName.make("x10.compiler.Inline")); + InlineType = (Type) ts.systemResolver().find(INLINE_ANNOTATION); } catch (SemanticException e) { - System.out.println("Unable to find x10.compiler.Inline: "+e); + System.out.println("Unable to find "+INLINE_ANNOTATION+": "+e); InlineType = null; } return super.begin(); @@ -178,12 +183,14 @@ private X10MethodDecl getDeclaration(final X10MethodDef md) { if (md.annotationsMatching(InlineType).isEmpty()) return null; - if (!md.flags().isStatic() && !md.flags().isFinal()) return null; X10ClassDef cd = getContainer(md); + if (!md.flags().isStatic() && !md.flags().isFinal() && !cd.flags().isFinal() && !cd.isStruct()) return null; Job job = cd.job(); if (job == null) return null; Node ast = job.ast(); - ast = ast.visit(new X10TypeChecker(job, ts, nf, job.nodeMemo()).begin()); + if (job != this.job()) { + ast = ast.visit(new X10TypeChecker(job, ts, nf, job.nodeMemo()).begin()); + } // job.ast(ast); // System.out.println("==> Typechecked "+cd); final X10MethodDecl[] decl = new X10MethodDecl[1]; @@ -210,19 +217,20 @@ } private Type instantiate(X10MethodInstance mi, List<Type> tArgs, ParameterType t) { - List<Type> tParms = mi.typeParameters(); + List<Ref<? extends Type>> mParms = mi.x10Def().typeParameters(); + List<Type> mArgs = mi.typeParameters(); int i = 0; - for (Type tp : tParms) { - if (t.typeEquals(tp, context)) - return tArgs.get(i); + for (Ref<? extends Type> tpr : mParms) { + if (t.typeEquals(tpr.get(), context)) + return mArgs.get(i); ++i; } X10ClassType ct = (X10ClassType) mi.container(); X10ClassDef cd = ct.x10Def(); tArgs = ct.typeArguments(); - List<ParameterType> tPs = cd.typeParameters(); + List<ParameterType> tParms = cd.typeParameters(); i = 0; - for (ParameterType pt : tPs) { + for (ParameterType pt : tParms) { if (t.typeEquals(pt, context)) return tArgs.get(i); ++i; @@ -252,7 +260,6 @@ for (TypeNode tn : c.typeArguments()) { tArgs.add(tn.type()); } - List<Type> tParms = mi.typeParameters(); final HashMap<Name, LocalDef> vars = new HashMap<Name, LocalDef>(); return (X10MethodDecl) decl.visit(new ContextVisitor(job, ts, nf) { protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException { @@ -288,17 +295,19 @@ } if (n instanceof LocalDecl) { LocalDecl d = (LocalDecl) n; - if (d.type() != ((LocalDecl) old).type()) { + boolean sigChanged = d.type() != ((LocalDecl) old).type(); + if (sigChanged) { LocalDef ld = d.localDef(); Name name = ld.name(); LocalDef ild = ts.localDef(ld.position(), ld.flags(), d.type().typeRef(), name); - vars.put(name, ild); + vars.put(name, ild); // FIXME: scoping return d.localDef(ild); } } if (n instanceof Formal) { Formal f = (Formal) n; - if (f.type() != ((Formal) old).type()) { + boolean sigChanged = f.type() != ((Formal) old).type(); + if (sigChanged) { LocalDef ld = f.localDef(); Name name = ld.name(); LocalDef ild = ts.localDef(ld.position(), ld.flags(), f.type().typeRef(), name); @@ -306,6 +315,53 @@ return f.localDef(ild); } } + if (n instanceof ClassDecl) { + ClassDecl d = (ClassDecl) n; + boolean sigChanged = d.superClass() != ((ClassDecl) old).superClass(); + List<TypeNode> interfaces = d.interfaces(); + List<TypeNode> oldInterfaces = ((ClassDecl) old).interfaces(); + for (int i = 0; i < interfaces.size(); i++) { + sigChanged |= interfaces.get(i) != oldInterfaces.get(i); + } + if (sigChanged) { + throw new InternalCompilerError("Inlining of code with instantiated local classes not supported"); + } + } + if (n instanceof X10MethodDecl) { + X10MethodDecl d = (X10MethodDecl) n; + boolean sigChanged = d.returnType() != ((X10MethodDecl) old).returnType(); + List<Ref<? extends Type>> argTypes = new ArrayList<Ref<? extends Type>>(); + List<LocalDef> formalNames = new ArrayList<LocalDef>(); + List<Formal> params = d.formals(); + List<Formal> oldParams = ((X10MethodDecl) old).formals(); + for (int i = 0; i < params.size(); i++) { + Formal p = params.get(i); + sigChanged |= p != oldParams.get(i); + argTypes.add(p.type().typeRef()); + formalNames.add(p.localDef()); + } + sigChanged |= d.guard() != ((X10MethodDecl) old).guard(); + List<Ref <? extends Type>> excTypes = new ArrayList<Ref<? extends Type>>(); + SubtypeSet excs = d.exceptions(); + SubtypeSet oldExcs = ((X10MethodDecl) old).exceptions(); + for (Type et : excs) { + sigChanged |= !oldExcs.contains(et); + excTypes.add(Types.ref(et)); + } + sigChanged |= d.offerType() != ((X10MethodDecl) old).offerType(); + if (sigChanged) { + X10MethodDef md = (X10MethodDef) d.methodDef(); + X10TypeSystem xts = (X10TypeSystem) ts; + DepParameterExpr g = d.guard(); + TypeNode ot = d.offerType(); + X10MethodDef imd = xts.methodDef(md.position(), md.container(), md.flags(), d.returnType().typeRef(), + md.name(), md.typeParameters(), argTypes, md.thisVar(), formalNames, + g == null ? null : g.valueConstraint(), + g == null ? null : g.typeConstraint(), excTypes, + ot == null ? null : ot.typeRef(), null /* the body will never be used */); + return d.methodDef(imd); + } + } return n; } }.context(context())); @@ -1146,7 +1202,9 @@ } } Expr e = ret.expr(); - e = cast(e, retType); + if (e != null) { + e = cast(e, retType); + } X10NodeFactory xnf = (X10NodeFactory) nodeFactory(); X10TypeSystem xts = (X10TypeSystem) typeSystem(); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-01 17:36:57 UTC (rev 14720) @@ -1798,6 +1798,8 @@ return sb.toString(); } + public static final QName HEADER_ANNOTATION = QName.make("x10.compiler.Header"); + public void visit(MethodDecl_c dec) { // TODO: if method overrides another method with generic // types, check if C++ does the right thing. @@ -1841,7 +1843,7 @@ boolean inlineInClassDecl = false; boolean inlineDirective = false; try { - Type annotation = (Type) xts.systemResolver().find(QName.make("x10.compiler.Inline")); + Type annotation = (Type) xts.systemResolver().find(HEADER_ANNOTATION); if (!((X10Ext) dec.ext()).annotationMatching(annotation).isEmpty()) { if (container.x10Def().typeParameters().size() == 0) { inlineInClassDecl = true; @@ -1934,7 +1936,7 @@ boolean inlineInClassDecl = false; try { - Type annotation = (Type) xts.systemResolver().find(QName.make("x10.compiler.Inline")); + Type annotation = (Type) xts.systemResolver().find(HEADER_ANNOTATION); if (!((X10Ext) dec.ext()).annotationMatching(annotation).isEmpty()) { inlineInClassDecl = true; } Modified: trunk/x10.runtime/src-x10/x10/array/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-07-01 17:36:57 UTC (rev 14720) @@ -11,6 +11,7 @@ package x10.array; +import x10.compiler.Header; import x10.compiler.Inline; import x10.compiler.Native; import x10.util.IndexedMemoryChunk; @@ -105,7 +106,7 @@ * * @return the IndexedMemoryChunk[T] that is the backing storage for the Array object. */ - public @Inline def raw() = raw; + public @Header @Inline def raw() = raw; // TODO: This is a hack around the way regions are currently defined. @@ -260,7 +261,7 @@ * @see #apply(Point) * @see #set(T, Int) */ - public safe @Inline def apply(i0:int){rank==1}:T { + public safe @Header @Inline def apply(i0:int){rank==1}:T { if (checkBounds()) baseRegion.check(bounds, i0); return raw(layout.offset(i0)); } @@ -276,7 +277,7 @@ * @see #apply(Point) * @see #set(T, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int){rank==2}:T { + public safe @Header @Inline def apply(i0:int, i1:int){rank==2}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1); return raw(layout.offset(i0,i1)); } @@ -293,7 +294,7 @@ * @see #apply(Point) * @see #set(T, Int, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int, i2:int){rank==3}:T { + public safe @Header @Inline def apply(i0:int, i1:int, i2:int){rank==3}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1, i2); return raw(layout.offset(i0, i1, i2)); } @@ -311,7 +312,7 @@ * @see #apply(Point) * @see #set(T, Int, Int, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int, i2:int, i3:int){rank==4}:T { + public safe @Header @Inline def apply(i0:int, i1:int, i2:int, i3:int){rank==4}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1, i2, i3); return raw(layout.offset(i0, i1, i2, i3)); } @@ -325,7 +326,7 @@ * @see #apply(Int) * @see #set(T, Point) */ - public safe @Inline def apply(pt:Point{self.rank==this.rank}):T { + public safe @Header @Inline def apply(pt:Point{self.rank==this.rank}):T { if (checkBounds()) { baseRegion.check(bounds, pt); } @@ -345,7 +346,7 @@ * @see #apply(Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int){rank==1}:T { + public safe @Header @Inline def set(v:T, i0:int){rank==1}:T { if (checkBounds()) baseRegion.check(bounds, i0); raw(layout.offset(i0)) = v; return v; @@ -364,7 +365,7 @@ * @see #apply(Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int){rank==2}:T { + public safe @Header @Inline def set(v:T, i0:int, i1:int){rank==2}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1); raw(layout.offset(i0,i1)) = v; return v; @@ -384,7 +385,7 @@ * @see #apply(Int, Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int, i2:int){rank==3}:T { + public safe @Header @Inline def set(v:T, i0:int, i1:int, i2:int){rank==3}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1, i2); raw(layout.offset(i0, i1, i2)) = v; return v; @@ -405,7 +406,7 @@ * @see #apply(Int, Int, Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int, i2:int, i3:int){rank==4}:T { + public safe @Header @Inline def set(v:T, i0:int, i1:int, i2:int, i3:int){rank==4}:T { if (checkBounds()) baseRegion.check(bounds, i0, i1, i2, i3); raw(layout.offset(i0, i1, i2, i3)) = v; return v; @@ -422,7 +423,7 @@ * @see #apply(Point) * @see #set(T, Int) */ - public safe @Inline def set(v:T, p:Point{self.rank==this.rank}):T { + public safe @Header @Inline def set(v:T, p:Point{self.rank==this.rank}):T { if (checkBounds()) { baseRegion.check(bounds, p); } Modified: trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 2010-07-01 17:36:57 UTC (rev 14720) @@ -11,6 +11,7 @@ package x10.array; +import x10.compiler.Header; import x10.compiler.Inline; /** @@ -69,7 +70,7 @@ // Layout // - final global @Inline def size(): int { + final global @Header @Inline def size(): int { return size; } @@ -80,25 +81,25 @@ return offset; } - final global @Inline def offset(i0: int): int { + final global @Header @Inline def offset(i0: int): int { var offset:int = i0 - min0; return offset; } - final global @Inline def offset(i0: int, i1: int): int { + final global @Header @Inline def offset(i0: int, i1: int): int { var offset:int = i0 - min0; offset = offset*delta1 + i1 - min1; return offset; } - final global @Inline def offset(i0: int, i1: int, i2: int): int { + final global @Header @Inline def offset(i0: int, i1: int, i2: int): int { var offset:int = i0 - min0; offset = offset*delta1 + i1 - min1; offset = offset*delta2 + i2 - min2; return offset; } - final global @Inline def offset(i0: int, i1: int, i2: int, i3: int): int { + final global @Header @Inline def offset(i0: int, i1: int, i2: int, i3: int): int { var offset:int = i0 - min0; offset = offset*delta1 + i1 - min1; offset = offset*delta2 + i2 - min2; Property changes on: trunk/x10.runtime/src-x10/x10/compiler/CUDADirectParams.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Copied: trunk/x10.runtime/src-x10/x10/compiler/Header.x10 (from rev 14715, trunk/x10.runtime/src-x10/x10/compiler/Inline.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/Header.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/Header.x10 2010-07-01 17:36:57 UTC (rev 14720) @@ -0,0 +1,29 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.MethodAnnotation; + +/** + * This annotation is used to allow the programmer + * to direct the compiler to mark the method as 'inline' + * in the C++ backend and generate code for it in the + * header file. + * WARNING: This annotation can only + * be correctly applied to methods of generic types + * and to methods whose bodies only operate + * on fields/methods of the annotated method's class + * and on primitive structs. If the annotation is + * improperly applied, the generated C++ code won't + * compile. + */ +public interface Header extends MethodAnnotation { } Modified: trunk/x10.runtime/src-x10/x10/compiler/Inline.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/Inline.x10 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.runtime/src-x10/x10/compiler/Inline.x10 2010-07-01 17:36:57 UTC (rev 14720) @@ -15,22 +15,11 @@ /** * This annotation is used to allow the programmer - * to direct the compiler to unconditionally inline - * the annotated method whenever a call expression is + * to direct the compiler to unconditionally inline + * the annotated method whenever a call expression is * statically resolved to invoke the method.</p> * - * Implementation Limitations: - * In the current implementation, this annotation - * is only processed by the C++ backend and can only - * be correctly applied to methods of generic types - * and to methods whose bodies only operate - * on fields/methods of the annotated method's class - * and on primitive structs. If the annotation is - * improperly applied, the generated C++ code won't - * compile.</p> - * - * Eventually this annotation will be processed by the - * X10 compiler's common optimizer and the implementation - * limitations listed above will be lifted. + * This annotation is processed by the X10 compiler's + * common optimizer. */ public interface Inline extends MethodAnnotation { } Property changes on: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Property changes on: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Property changes on: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Property changes on: trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 2010-07-01 17:32:02 UTC (rev 14719) +++ trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 2010-07-01 17:36:57 UTC (rev 14720) @@ -11,6 +11,7 @@ package x10.util; +import x10.compiler.Header; import x10.compiler.Inline; import x10.compiler.Native; import x10.compiler.NativeRep; @@ -78,7 +79,7 @@ * @param i The index to retreive. * @return The value at that index. */ - public safe @Inline def apply(index:int) = chunk.apply(index); + public safe @Header @Inline def apply(index:int) = chunk.apply(index); /** @@ -87,7 +88,7 @@ * @param i The index to retreive. * @return The value at that index. */ - public safe @Inline def apply(index:long) = chunk.apply(index); + public safe @Header @Inline def apply(index:long) = chunk.apply(index); /** * Operator that allows assignment of IndexedMemoryChunk elements by index. @@ -96,7 +97,7 @@ * @param i The index of the element to be changed. * @return The new value. */ - public safe @Inline def set(value:T, index:int) = chunk.set(value, index); + public safe @Header @Inline def set(value:T, index:int) = chunk.set(value, index); /** @@ -106,14 +107,14 @@ * @param i The index of the element to be changed. * @return The new value. */ - public safe @Inline def set(value:T, index:long) = chunk.set(value, index); + public safe @Header @Inline def set(value:T, index:long) = chunk.set(value, index); /* TODO: Java codegen doesn't support static overloading on signed vs. unsigned. - public safe @Inline def apply(index:uint) = chunk.apply(index); - public safe @Inline def apply(index:ulong) = chunk.apply(index); - public safe @Inline def set(value:T, index:uint) = chunk.set(value, index); - public safe @Inline def set(value:T, index:ulong) = chunk.set(value, index); + public safe @Header @Inline def apply(index:uint) = chunk.apply(index); + public safe @Header @Inline def apply(index:ulong) = chunk.apply(index); + public safe @Header @Inline def set(value:T, index:uint) = chunk.set(value, index); + public safe @Header @Inline def set(value:T, index:ulong) = chunk.set(value, index); */ @@ -155,4 +156,4 @@ native safe def set(value:T, index:ulong):void; */ } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-07-08 17:10:07
|
Revision: 14781 http://x10.svn.sourceforge.net/x10/?rev=14781&view=rev Author: yzibin Date: 2010-07-08 17:09:54 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Fixed XTENLANG-889, removed "Struct class" (The common superclass of all structs) and updated the C++ and Java back ends, fixed places that caused dynamic-checks in XRX (now XRX compiles under -STATIC_CALLS), fixed XTENLANG-1514. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/errors/Errors.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/checker/Converter.java trunk/x10.compiler/src/x10/util/RunTestSuite.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/InstanceInvariantChecker.java trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java trunk/x10.compiler/src/x10/visit/PositionInvariantChecker.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java trunk/x10.compiler/src/x10cpp/visit/StructMethodAnalyzer.java trunk/x10.runtime/src-java/x10/core/Struct.java trunk/x10.runtime/src-java/x10/rtt/Equality.java trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 trunk/x10.runtime/src-x10/x10/array/Region.x10 trunk/x10.runtime/src-x10/x10/lang/Place.x10 trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 trunk/x10.tests/examples/Constructs/Generics/Generics_ERR_MustFailCompile.x10 trunk/x10.tests/examples/Issues/XTENLANG_1466.x10 Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -18,64 +18,45 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Set; import polyglot.ast.Block; import polyglot.ast.ClassBody; import polyglot.ast.ClassDecl; import polyglot.ast.ClassDecl_c; import polyglot.ast.ClassMember; -import polyglot.ast.ConstructorCall; import polyglot.ast.ConstructorDecl; import polyglot.ast.Expr; import polyglot.ast.FlagsNode; import polyglot.ast.Formal; import polyglot.ast.Id; -import polyglot.ast.Local; import polyglot.ast.MethodDecl; -import polyglot.ast.MethodDecl_c; -import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; -import polyglot.ast.PackageNode; -import polyglot.ast.SourceFile; import polyglot.ast.Stmt; import polyglot.ast.Term; -import polyglot.ast.TopLevelDecl; import polyglot.ast.TypeNode; -import polyglot.ast.CanonicalTypeNode; -import polyglot.frontend.Globals; import polyglot.frontend.Job; -import polyglot.frontend.Scheduler; import polyglot.frontend.Source; -import polyglot.main.Report; import polyglot.types.ClassDef; import polyglot.types.ClassType; -import polyglot.types.ConstructorDef; import polyglot.types.Context; -import polyglot.types.Context_c; import polyglot.types.FieldDef; import polyglot.types.FieldInstance; import polyglot.types.Flags; import polyglot.types.LazyRef; import polyglot.types.LazyRef_c; -import polyglot.types.LocalDef; import polyglot.types.MethodInstance; import polyglot.types.Name; import polyglot.types.Named; import polyglot.types.ObjectType; -import polyglot.types.Package; import polyglot.types.QName; import polyglot.types.Ref; -import polyglot.types.Ref_c; import polyglot.types.ReferenceType; import polyglot.types.SemanticException; -import polyglot.types.StructType; import polyglot.types.Type; import polyglot.types.TypeSystem; import polyglot.types.Types; import polyglot.types.UnknownType; -import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.TypedList; import polyglot.visit.CFGBuilder; @@ -83,16 +64,12 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.PruningVisitor; import polyglot.visit.TypeBuilder; -import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; import x10.constraint.XFailure; -import x10.constraint.XVar; -import x10.constraint.XTerm; import x10.errors.Errors; import x10.extension.X10Del; import x10.extension.X10Del_c; -import x10.extension.X10Ext; import x10.types.MacroType; import x10.types.ParameterType; import x10.types.TypeDef; @@ -100,20 +77,15 @@ import x10.types.X10ClassDef_c; import x10.types.X10ClassType; import x10.types.X10Context; -import x10.types.X10Def; import x10.types.X10FieldInstance; import x10.types.X10Flags; import x10.types.X10MethodDef; -import x10.types.X10MethodInstance; -import x10.types.X10ParsedClassType; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.XConstrainedTerm; import x10.util.Synthesizer; import x10.visit.ChangePositionVisitor; @@ -231,13 +203,13 @@ thisType.superType(null); } else if (superClass == null && X10Flags.toX10Flags(flags().flags()).isStruct()) { - final LazyRef<Type> Struct = Types.lazyRef(null); + /* final LazyRef<Type> Struct = Types.lazyRef(null); Struct.setResolver(new Runnable() { public void run() { Struct.update(xts.Struct()); } - }); - thisType.superType(Struct); + }); */ + thisType.superType(null); } else if (superClass == null) { superRef.setResolver(new Runnable() { @@ -258,7 +230,7 @@ // For every struct and interface, add the implicit Any interface. X10Flags flags = X10Flags.toX10Flags(flags().flags()); - if (flags.isStruct() + if (flags.isStruct() || (flags.isInterface() && ! name.toString().equals("Any")) || xts.isParameterType(thisType.asType())) { thisType.addInterface(xts.lazyAny()); @@ -424,7 +396,10 @@ for (TypeParamNode tpn : n.typeParameters()) { def.addTypeParameter(tpn.type(), tpn.variance()); } - + + if (X10Flags.toX10Flags(flags().flags()).isStruct()) + n = x10.util.Struct.addStructMethods(tb,n); + return n; } @@ -652,10 +627,10 @@ NodeFactory nf = tc.nodeFactory(); if (type.superType() != null) { - if (((X10ClassDef) type).isStruct()) { - if (! (X10TypeMixin.isX10Struct(type.superType().get()))) { + if (!((X10ClassDef) type).isStruct()) { + if ((X10TypeMixin.isX10Struct(type.superType().get()))) { Errors.issue(tc.job(), - new Errors.StructMustHaveStructSupertype(type.superType(), + new Errors.ClassMustHaveClassSupertype(type.superType(), type, position())); } Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -125,7 +125,11 @@ DepParameterExpr DepParameterExpr(Position pos, List<Expr> cond); DepParameterExpr DepParameterExpr(Position pos, List<Formal> formals, List<Expr> cond); - MethodDecl X10MethodDecl(Position pos, FlagsNode flags, + + X10MethodDecl MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, + Id name, + List<Formal> formals, List<TypeNode> throwTypes, Block body); + X10MethodDecl X10MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, Id name, List<TypeParamNode> typeParams, List<Formal> formals, DepParameterExpr guard, List<TypeNode> throwTypes, TypeNode offerType, Block body); SettableAssign SettableAssign(Position pos, Expr a, List<Expr> indices, Assign.Operator op, Expr rhs); @@ -179,4 +183,6 @@ TypeNode HasType(TypeNode tn); Offer Offer(Position pos, Expr e); FinishExpr FinishExpr(Position p, Expr e, Stmt s); + + } Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -652,19 +652,19 @@ } @Override - public MethodDecl MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, + public X10MethodDecl MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, Id name, List<Formal> formals, List<TypeNode> throwTypes, Block body) { return X10MethodDecl(pos, flags, returnType, name, Collections.EMPTY_LIST, formals, null, throwTypes, null, body); } - public MethodDecl X10MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, Id name, List<TypeParamNode> typeParams, List<Formal> formals, + public X10MethodDecl X10MethodDecl(Position pos, FlagsNode flags, TypeNode returnType, Id name, List<TypeParamNode> typeParams, List<Formal> formals, DepParameterExpr guard, List<TypeNode> throwTypes, TypeNode offerType, Block body) { - MethodDecl n = new X10MethodDecl_c(pos, flags, returnType, name, typeParams, + X10MethodDecl n = new X10MethodDecl_c(pos, flags, returnType, name, typeParams, formals, guard, throwTypes, offerType, body); - n = (MethodDecl)n.ext(extFactory().extMethodDecl()); - n = (MethodDecl)n.del(delFactory().delMethodDecl()); + n = (X10MethodDecl)n.ext(extFactory().extMethodDecl()); + n = (X10MethodDecl)n.del(delFactory().delMethodDecl()); return n; } Modified: trunk/x10.compiler/src/x10/errors/Errors.java =================================================================== --- trunk/x10.compiler/src/x10/errors/Errors.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/errors/Errors.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -736,16 +736,16 @@ } } - public static class StructMustHaveStructSupertype extends SemanticException { + public static class ClassMustHaveClassSupertype extends SemanticException { private static final long serialVersionUID = -7826831387240378409L; - public StructMustHaveStructSupertype(Ref<? extends Type> superType, ClassDef type, Position pos) { + public ClassMustHaveClassSupertype(Ref<? extends Type> superType, ClassDef type, Position pos) { super(superType + " cannot be the superclass for " + type + - "; a struct must subclass a struct.", pos); + "; a class must subclass a class.", pos); } public boolean equals(Object o) { - if (o==null || ! (o instanceof StructMustHaveStructSupertype) ) + if (o==null || ! (o instanceof ClassMustHaveClassSupertype) ) return false; - return((StructMustHaveStructSupertype)o).position().equals(position()); + return((ClassMustHaveClassSupertype)o).position().equals(position()); } } public static class NoCollectingFinishFound extends SemanticException { Modified: trunk/x10.compiler/src/x10/types/X10Flags.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10Flags.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/types/X10Flags.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -27,25 +27,25 @@ */ public class X10Flags extends Flags { public static final Set X10_FLAGS = new TreeSet(); - public static final Flags EXTERN = createFlag("extern", null); - public static final Flags VALUE = createFlag("value", null); - public static final Flags REFERENCE = createFlag("reference", null); - public static final Flags ATOMIC = createFlag("atomic", null); - public static final Flags PURE = createFlag("pure", null); - public static final Flags MUTABLE = createFlag("mutable", null); - public static final Flags SAFE = createFlag("safe", null); - // public static final Flags LOCAL = createFlag("local", null); - public static final Flags NON_BLOCKING = createFlag("nonblocking", null); - public static final Flags SEQUENTIAL = createFlag("sequential", null); - public static final Flags INCOMPLETE = createFlag("incomplete", null); - public static final Flags PROPERTY = createFlag("property", null); - public static final Flags SHARED = createFlag("shared", null); - public static final Flags GLOBAL = createFlag("global", null); - // public static final Flags ROOTED = createFlag("rooted", null); - public static final Flags STRUCT = createFlag("struct", null); - public static final Flags PROTO = createFlag("proto", null); - public static final Flags PINNED = createFlag("pinned", null); - public static final Flags HASTYPE = createFlag("hastype", null); // can only be created through a <: Type declaration. + public static final X10Flags EXTERN = createFlag("extern", null); + public static final X10Flags VALUE = createFlag("value", null); + public static final X10Flags REFERENCE = createFlag("reference", null); + public static final X10Flags ATOMIC = createFlag("atomic", null); + public static final X10Flags PURE = createFlag("pure", null); + public static final X10Flags MUTABLE = createFlag("mutable", null); + public static final X10Flags SAFE = createFlag("safe", null); + // public static final X10Flags LOCAL = createFlag("local", null); + public static final X10Flags NON_BLOCKING = createFlag("nonblocking", null); + public static final X10Flags SEQUENTIAL = createFlag("sequential", null); + public static final X10Flags INCOMPLETE = createFlag("incomplete", null); + public static final X10Flags PROPERTY = createFlag("property", null); + public static final X10Flags SHARED = createFlag("shared", null); + public static final X10Flags GLOBAL = createFlag("global", null); + // public static final X10Flags ROOTED = createFlag("rooted", null); + public static final X10Flags STRUCT = createFlag("struct", null); + public static final X10Flags PROTO = createFlag("proto", null); + public static final X10Flags PINNED = createFlag("pinned", null); + public static final X10Flags HASTYPE = createFlag("hastype", null); // can only be created through a <: Type declaration. /** * Return a new Flags object with a new name. Should be called only once per @@ -58,7 +58,7 @@ * to print before all other flags, null if we should print at * the end. */ - public static Flags createFlag(String name, Flags after) { + public static X10Flags createFlag(String name, Flags after) { addToOrder(name, after); X10_FLAGS.add(name); return new X10Flags(name); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -420,7 +420,6 @@ boolean isX10DistArray(Type me); Context emptyContext(); - Type Struct(); boolean isExactlyFunctionType(Type t); Name homeName(); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -85,6 +85,7 @@ import polyglot.visit.TypeBuilder; import x10.ast.X10NodeFactory; import x10.ast.X10StringLit_c; +import x10.ast.X10ClassDecl_c; import x10.constraint.XFailure; import x10.constraint.XLit; import x10.constraint.XName; @@ -1094,7 +1095,7 @@ public CodeDef asyncCodeInstance(boolean isStatic) { // Need to create a new one on each call. Portions of this methodDef, such as thisVar may be destructively modified later. - return methodDef(Position.COMPILER_GENERATED, Types.ref((StructType) Runtime()), isStatic ? Public().Static() : Public(), + return methodDef(Position.COMPILER_GENERATED, Types.ref((StructType) Runtime()), isStatic ? Public().Static() : Public(), Types.ref(VOID_), Name.make(DUMMY_ASYNC), Collections.EMPTY_LIST, Collections.EMPTY_LIST); } @@ -1324,12 +1325,6 @@ }); return ANY; } - Type STRUCT_ = null; - public Type Struct() { - if (STRUCT_ != null) - return STRUCT_; - return STRUCT_ = x10.util.Struct.makeDef(this).asType(); - } public Type String() { if (STRING_ != null) return STRING_; @@ -1744,7 +1739,8 @@ } public boolean isStruct(Type me) { - return typeEquals(me, Struct(), emptyContext()); + return X10TypeMixin.isX10Struct(me); + //typeEquals(me, Struct(), emptyContext()); } public boolean isClock(Type me) { Modified: trunk/x10.compiler/src/x10/types/checker/Converter.java =================================================================== --- trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -142,6 +142,8 @@ result = check(nf.X10Cast(e.position(), tn, e, ct),tc); } if (dynamicCallp) { + if (Configuration.STATIC_CALLS) + throw new SemanticException("Expression " + e + " cannot be cast to type " + tn.type() + ".", e.position()); Warnings.issue(tc.job(), Warnings.CastingExprToType(e, tn.type(), e.position())); } } @@ -197,7 +199,7 @@ Type toType = formals.get(j); try { - Expr e2 = attemptCoercion(!(Configuration.STATIC_CALLS), tc, e, toType); + Expr e2 = attemptCoercion(true, tc, e, toType); transformedArgs.add(e2); transformedArgTypes.add(e2.type()); } Modified: trunk/x10.compiler/src/x10/util/RunTestSuite.java =================================================================== --- trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -76,7 +76,7 @@ "C:\\cygwin\\home\\Yoav\\intellij\\sourceforge\\x10.tests,C:\\cygwin\\home\\Yoav\\intellij\\sourceforge\\x10.dist\\samples,C:\\cygwin\\home\\Yoav\\intellij\\sourceforge\\x10.runtime\\src-x10"; List<String> remainingArgs = new ArrayList<String>(Arrays.asList(args)); remainingArgs.remove(0); - remainingArgs.add("-STATIC_CALLS"); + //remainingArgs.add("-STATIC_CALLS"); final String dirName = args[0]; ArrayList<File> files = new ArrayList<File>(10); @@ -173,10 +173,18 @@ } } // 2. report all the remaining errors that didn't have a matching ERR marker - if (errors.size()>0) { + // first report warnings + int warningCount = 0; + for (ErrorInfo err : errors) + if (err.getErrorKind()==ErrorInfo.WARNING) { + System.err.println(err); + warningCount++; + } + if (errors.size()>warningCount) { System.err.println("\nThe following errors did not have a matching ERR marker:\n\n"); for (ErrorInfo err : errors) - System.err.println("Position: "+err.getPosition()+"\nMessage: "+err+"\n"); + if (err.getErrorKind()!=ErrorInfo.WARNING) + System.err.println("Position: "+err.getPosition()+"\nMessage: "+err+"\n"); } // todo: check that for each file (without errors) we generated a *.class file, and load them and run their main method (except for the ones with _MustFailTimeout) } Modified: trunk/x10.compiler/src/x10/util/Struct.java =================================================================== --- trunk/x10.compiler/src/x10/util/Struct.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/util/Struct.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -11,86 +11,95 @@ package x10.util; +import java.util.*; import java.util.ArrayList; -import java.util.Collections; import java.util.List; +import java.util.HashSet; import polyglot.ast.Expr; -import polyglot.ast.MethodDecl; +import polyglot.ast.Block; +import polyglot.ast.Stmt; +import polyglot.ast.Binary; +import polyglot.ast.FieldDecl; +import polyglot.ast.ClassMember; +import polyglot.ast.FieldDecl_c; +import polyglot.ast.IntLit; +import polyglot.ast.Assign; +import polyglot.ast.Local; +import polyglot.ast.MethodDecl_c; +import polyglot.ast.Unary; import polyglot.ast.TypeNode; -import polyglot.types.ClassDef; -import polyglot.types.ClassType; +import polyglot.ast.Formal; +import polyglot.ast.Id; import polyglot.types.Flags; import polyglot.types.LazyRef; import polyglot.types.LocalDef; import polyglot.types.Name; import polyglot.types.QName; import polyglot.types.Ref; -import polyglot.types.SemanticException; import polyglot.types.Type; import polyglot.types.Types; import polyglot.util.Position; -import x10.ast.AnnotationNode; +import polyglot.visit.TypeBuilder; import x10.ast.X10StringLit_c; +import x10.ast.X10ClassDecl_c; +import x10.ast.X10NodeFactory; +import x10.ast.X10MethodDecl; +import x10.ast.TypeParamNode; import x10.constraint.XName; import x10.constraint.XNameWrapper; import x10.constraint.XVar; import x10.constraint.XTerms; -import x10.extension.X10Ext; import x10.types.X10ClassDef; -import x10.types.X10ClassDef_c; -import x10.types.X10ClassType; -import x10.types.X10ConstructorDef; import x10.types.X10Flags; import x10.types.X10MethodDef; import x10.types.X10ParsedClassType; -import x10.types.X10ParsedClassType_c; -import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10cpp.visit.SharedVarsMethods; public class Struct { - public static X10ClassDef makeDef(final X10TypeSystem_c xts) { + private final static java.util.Set<String> ignoreTypes = new HashSet<String>(); - final Position pos = Position.COMPILER_GENERATED; + static { + ignoreTypes.add("Boolean"); + ignoreTypes.add("Byte"); + ignoreTypes.add("UByte"); + ignoreTypes.add("Char"); + ignoreTypes.add("Short"); + ignoreTypes.add("UShort"); + ignoreTypes.add("Int"); + ignoreTypes.add("UInt"); + ignoreTypes.add("Long"); + ignoreTypes.add("ULong"); + ignoreTypes.add("Float"); + ignoreTypes.add("Double"); + ignoreTypes.add("Place"); + } - String name = "Struct"; - X10ClassDef cd = (X10ClassDef) new X10ClassDef_c(xts, null) { - @Override - public ClassType asType() { - if (asType == null) { - X10ClassDef cd = this; - asType = new X10ParsedClassType_c(this); - } - return asType; - } - }; + public static X10ClassDecl_c addStructMethods(TypeBuilder tb, X10ClassDecl_c n) { + final X10TypeSystem_c xts = (X10TypeSystem_c) tb.typeSystem(); + final X10ClassDef cd = (X10ClassDef) n.classDef(); + X10ParsedClassType ct = (X10ParsedClassType) cd.asType(); - cd.position(pos); - cd.name(Name.make(name)); - try { - cd.setPackage(Types.ref(xts.packageForName(QName.make("x10.lang")))); - } - catch (SemanticException e) { - assert false; - } + QName fullName = cd.fullName(); - QName fullName = QName.make("x10.lang", name); - cd.kind(ClassDef.TOP_LEVEL); - cd.superType(null); // base class has no superclass - - cd.setInterfaces(Collections.<Ref<? extends Type>> singletonList(xts.lazyAny())); - cd.flags(X10Flags.toX10Flags(Flags.PUBLIC.Abstract()).Struct()); + String strName = fullName.name().toString(); + final QName qualifier = fullName.qualifier(); - // NOTE: don't call cd.asType() until after the type parameters are - // added. - X10ParsedClassType ct = (X10ParsedClassType) cd.asType(); - xts.systemResolver().install(fullName, ct); + final ArrayList<Ref<? extends Type>> interfacesList = new ArrayList<Ref<? extends Type>>(cd.interfaces()); + interfacesList.add(xts.lazyAny()); + cd.setInterfaces(interfacesList); + final Position pos = Position.COMPILER_GENERATED; + String fullNameWithThis = fullName + "#this"; //String fullNameWithThis = "this"; XName thisName = new XNameWrapper<Object>(new Object(), fullNameWithThis); XVar thisVar = XTerms.makeLocal(thisName); + + + final LazyRef<X10ParsedClassType> PLACE = Types.lazyRef(null); PLACE.setResolver(new Runnable() { public void run() { @@ -115,14 +124,8 @@ OBJECT.update((X10ParsedClassType) xts.Object()); } }); - X10ConstructorDef ci = (X10ConstructorDef) xts.constructorDef(pos, Types.ref(ct), Flags.PUBLIC.Native(), - Collections.EMPTY_LIST, - Collections.EMPTY_LIST); - cd.addConstructor(ci); X10MethodDef mi; - List<Expr> list; - X10ClassType ann; // @Native("java", "x10.lang.Place.place(x10.core.Ref.home(#0))") // property def home():Place @@ -137,7 +140,7 @@ null, null, Collections.EMPTY_LIST, - null, //offerTye + null, //offerType null); final LazyRef<X10ParsedClassType> NATIVE_LOC = Types.lazyRef(null); NATIVE_LOC.setResolver(new Runnable() { @@ -181,6 +184,7 @@ mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_AT_1)); cd.addMethod(mi); + /* // @Native("java", "x10.core.Ref.typeName(#0)") // @Native("c++", "x10aux::type_name(#0)") // native final global safe def typeName():String; @@ -226,38 +230,8 @@ mi.setDefAnnotations(tn_ann); //mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_TYPE_NAME)); cd.addMethod(mi); + */ - // @Native("java", "\"<struct>\"") - // native global safe def toString():String; - mi = xts.methodDef(pos, - Types.ref(ct), - X10Flags.toX10Flags(Flags.PUBLIC.Native()).Global().Safe(), - STRING, - Name.make("toString"), - Collections.EMPTY_LIST, - Collections.EMPTY_LIST, - thisVar, - Collections.EMPTY_LIST, - null, - null, - Collections.EMPTY_LIST, - null, // offerType - null - ); - final LazyRef<X10ParsedClassType> NATIVE_TYPE_NAME2 = Types.lazyRef(null); - NATIVE_TYPE_NAME2.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "\"<struct>\"")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_TYPE_NAME2.update(ann); - } - }); - - mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_TYPE_NAME2)); - cd.addMethod(mi); - // @Native("java", "x10.core.Ref.at(#0, #1.id)") // property def at(p:Place):boolean; parameters = xts.dummyLocalDefs(Collections.<Ref<? extends Type>> singletonList(PLACE)); @@ -287,43 +261,178 @@ mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_AT_2)); cd.addMethod(mi); - //@NativeRep("java", "x10.core.Struct", null, null) - final LazyRef<X10ParsedClassType> NATIVE_REP = Types.lazyRef(null); - NATIVE_REP.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(4); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "x10.core.Struct")); - list.add(null); - list.add(null); - X10ParsedClassType ann = (X10ParsedClassType) ((X10ParsedClassType) xts.NativeRep()).propertyInitializers(list); - NATIVE_REP.update(ann); - } - }); + // Now I add the auto-generated methods (equals(Any), equals(SomeStruct), hashCode(), toString()) + // if the programmer didn't already defined them + // primitive classes do not define hashCode, and we should not auto-create hashCode for them, + // or the java backend will translate: + // var x:Int; x.hashCode + // to + // x.hashCode() + // and it should translate it to: + // ((Object)x).hashCode() - //@NativeRep("c++", "x10::lang::Struct", "x10::lang::Struct", null) - final LazyRef<X10ParsedClassType> NATIVE_REP_CPP = Types.lazyRef(null); - NATIVE_REP_CPP.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(4); - list.add(new X10StringLit_c(pos, "c++")); - list.add(new X10StringLit_c(pos, "x10::lang::Struct")); - list.add(new X10StringLit_c(pos, "x10::lang::Struct")); - list.add(null); - X10ParsedClassType ann = (X10ParsedClassType) ((X10ParsedClassType) xts.NativeRep()).propertyInitializers(list); + boolean isPrim = (qualifier!=null && qualifier.toString().equals("x10.lang") && ignoreTypes.contains(strName)); + boolean seenToString = isPrim; + boolean seenHashCode = isPrim; + boolean seenEquals = isPrim; - NATIVE_REP_CPP.update(ann); + + + + for (ClassMember member : n.body().members()) + if (member instanceof MethodDecl_c) { + MethodDecl_c mdecl = (MethodDecl_c) member; + final Flags methodFlags = mdecl.flags().flags(); + if (methodFlags.isStatic() || methodFlags.isAbstract()) continue; + + // The compiler provides implementations of equals, hashCode, and toString if + // there are no user-defined implementations. So, we need to search the struct's members + // and determine which methods to auto-generate and which ones are user-provided. + if (mdecl.name().id().toString().equals("toString") && + mdecl.formals().isEmpty()) { + seenToString = true; + } + if (mdecl.name().id().toString().equals("hashCode") && + mdecl.formals().isEmpty()) { + seenHashCode = true; + } + if (mdecl.name().id().toString().equals("equals") && + mdecl.formals().size() == 1) { + seenEquals = true; + } + } + + + // I use the AST instead of the type, because the type hasn't been built yet (so ct.fields() is empty!) + // I modify the AST before type-checking, because I want to connect calls to "equals" + // with the correct "equals(SomeStruct)" or "equals(Any)" + // This is important for C++ efficiency (to prevent auto-boxing of structs in equality checking) + ArrayList<FieldDecl> fields = new ArrayList<FieldDecl>(); + fields.addAll(n.properties()); + for (ClassMember member : n.body().members()) + if (member instanceof FieldDecl_c) { + FieldDecl_c field = (FieldDecl_c) member; + if (field.flags().flags().isStatic()) continue; + fields.add(field); } - }); - List<Ref<? extends Type>> cd_ann = new ArrayList<Ref<? extends Type>>(); - cd_ann.add(NATIVE_REP); - cd_ann.add(NATIVE_REP_CPP); - cd.setDefAnnotations(cd_ann); - //cd.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_REP)); - return cd; + final Flags flags = X10Flags.GLOBAL.Safe().Public().Final(); + final X10NodeFactory nf = (X10NodeFactory)tb.nodeFactory(); + final TypeNode intTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Int")); + final TypeNode boolTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Boolean")); + final TypeNode stringTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","String")); + final TypeNode anyTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Any")); + final List<TypeParamNode> typeParamNodeList = n.typeParameters(); + List<TypeNode> params = new ArrayList<TypeNode>(); + for (TypeParamNode p : typeParamNodeList) + params.add(nf.TypeNodeFromQualifiedName(pos,QName.make(null,p.name().id()))); + final TypeNode structTypeNode = typeParamNodeList.isEmpty() ? nf.TypeNodeFromQualifiedName(pos,fullName) : + nf.AmbDepTypeNode(pos, null, + nf.Id(pos,fullName.name()), params, Collections.EMPTY_LIST, null); + ArrayList<Stmt> bodyStmts; + Expr expr; + Block block; + String methodName; + X10MethodDecl md; + + + // final public global safe def typeName():String { return "FULL_NAME"; } + bodyStmts = new ArrayList<Stmt>(); + expr = nf.StringLit(pos, fullName.toString()); + bodyStmts.add(nf.Return(pos, expr)); + block = nf.Block(pos).statements(bodyStmts); + methodName = "typeName"; + md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),stringTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,block); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + + if (!seenToString) { + // final public global safe def toString():String { + // return "struct NAME:"+" FIELD1="+FIELD1+...; + // or + // return "struct NAME"; // if there are no fields + // } + bodyStmts = new ArrayList<Stmt>(); + expr = nf.StringLit(pos, "struct " + fullName + (fields.size()==0?"":":")); + for (FieldDecl fi : fields) { + String name = fi.name().toString(); + expr = nf.Binary(pos,expr, Binary.ADD,nf.StringLit(pos," "+name+"=")); + expr = nf.Binary(pos,expr, Binary.ADD,nf.Field(pos,nf.This(pos),nf.Id(pos,name))); + } + bodyStmts.add(nf.Return(pos, expr)); + block = nf.Block(pos).statements(bodyStmts); + methodName = "toString"; + md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),stringTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,block); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + } + if (!seenHashCode) { + // final public global safe def hashCode():Int { + // var result:Int = 0; + // result = 31*result + FIELD1.hashCode(); + // ... + // return result; + // } + bodyStmts = new ArrayList<Stmt>(); + bodyStmts.add(nf.LocalDecl(pos, nf.FlagsNode(pos,Flags.NONE), intTypeNode,nf.Id(pos,"result"),nf.IntLit(pos, IntLit.INT,0))); + final Local target = nf.Local(pos, nf.Id(pos, "result")); + for (FieldDecl fi : fields) { + String name = fi.name().toString(); + bodyStmts.add(nf.Eval(pos,nf.Assign(pos, target, Assign.ASSIGN, + nf.Binary(pos, + nf.Binary(pos,nf.IntLit(pos,IntLit.INT,31),Binary.MUL,target), + Binary.ADD, + nf.Call(pos,nf.Field(pos,nf.This(pos),nf.Id(pos,name)),nf.Id(pos,"hashCode")))))); + } + bodyStmts.add(nf.Return(pos, target)); + block = nf.Block(pos).statements(bodyStmts); + methodName = "hashCode"; + md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),intTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,block); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + } + // _struct_equals is used for == even when the user defined equals + // (both backends need to convert == to _struct_equals) + for (boolean isStructEquals : new boolean[]{false,true}) { + methodName = isStructEquals ? SharedVarsMethods.STRUCT_EQUALS_METHOD : "equals"; + if (!isStructEquals && seenEquals) continue; + + // final public global safe def equals(other:Any):Boolean { + // if (!(other instanceof NAME)) return false; + // return equals(other as NAME); + // } + bodyStmts = new ArrayList<Stmt>(); + Expr other =nf.Local(pos,nf.Id(pos,"other")); + bodyStmts.add(nf.If(pos, nf.Unary(pos, Unary.NOT, + nf.Instanceof(pos,other,structTypeNode)), + nf.Return(pos,nf.BooleanLit(pos,false)))); + bodyStmts.add(nf.Return(pos,nf.Call(pos,nf.Id(pos,methodName),nf.Cast(pos,structTypeNode,other)))); + block = nf.Block(pos).statements(bodyStmts); + Formal formal = nf.Formal(pos,nf.FlagsNode(pos,Flags.NONE),anyTypeNode,nf.Id(pos,"other")); + md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),boolTypeNode,nf.Id(pos,Name.make(methodName)), Collections.singletonList(formal),Collections.EMPTY_LIST,block); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + + // final public global safe def equals(other:NAME):Boolean { + // return true && FIELD1==other.FIELD1 && ...; + // } + bodyStmts = new ArrayList<Stmt>(); + Expr res = fields.isEmpty() ? nf.BooleanLit(pos, true) : null; + for (FieldDecl fi : fields) { + String name = fi.name().toString(); + final Id id = nf.Id(pos, name); + Expr right = nf.Binary(pos,nf.Field(pos,nf.This(pos),id),Binary.EQ,nf.Field(pos,other,id)); + if (res==null) + res = right; + else + res = nf.Binary(pos,res,Binary.COND_AND,right); + } + bodyStmts.add(nf.Return(pos, res)); + block = nf.Block(pos).statements(bodyStmts); + formal = nf.Formal(pos,nf.FlagsNode(pos,Flags.NONE),structTypeNode,nf.Id(pos,"other")); + md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),boolTypeNode,nf.Id(pos,Name.make(methodName)),Collections.singletonList(formal),Collections.EMPTY_LIST,block); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + } + + return n; } } Modified: trunk/x10.compiler/src/x10/util/Synthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -740,7 +740,7 @@ try { c.addBinding(id, XTerms.makeLit(0)); Type type = X10TypeMixin.xclause(xts.Place(), c); - return makeStaticField(Position.COMPILER_GENERATED, xts.Place(), + return makeStaticField(Position.COMPILER_GENERATED, xts.Place(), Name.make("FIRST_PLACE"), type, new X10Context_c(xts)); } catch (XFailure z) { // wont happen Modified: trunk/x10.compiler/src/x10/visit/InstanceInvariantChecker.java =================================================================== --- trunk/x10.compiler/src/x10/visit/InstanceInvariantChecker.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/visit/InstanceInvariantChecker.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -18,6 +18,7 @@ import polyglot.visit.NodeVisitor; import polyglot.frontend.Job; import polyglot.main.Report; +import polyglot.types.SemanticException; import x10.ast.AnnotationNode_c; import x10.ast.DepParameterExpr; import x10.ast.X10Formal_c; @@ -33,20 +34,20 @@ this.job = job; } - public NodeVisitor enter(Node n) - { + public Node visitEdgeNoOverride(Node parent, Node n) { try { if (Report.should_report("InstanceInvariantChecker", 2)) Report.report(2, "Checking invariants for: " + n); checkInvariants(n); + n.del().visitChildren(this); // if there is an error, I don't recurse to the children - } catch (AssertionError e) { + } catch (SemanticException e) { String msg = e.getMessage()+("!")+ (" n=")+(n).toString(); job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR,msg,n.position()); } - return this; + return n; } private boolean isAmbiguous(Node n){ @@ -56,42 +57,45 @@ } return false; } + private void myAssert(boolean cond, String msg) throws SemanticException { + if (!cond) + throw new SemanticException(msg); + } - private void checkInvariants(Node n) { - assert (n != null) : "Cannot visit null"; + private void checkInvariants(Node n) throws SemanticException { + myAssert(n != null,"Cannot visit null"); - if (isAmbiguous(n)) - assert false : "Ambiguous node found in AST"; + myAssert(!isAmbiguous(n), "Ambiguous node found in AST"); if (n instanceof Typed) { - assert ((Typed)n).type()!=null; + myAssert(((Typed)n).type()!=null,"Typed node is missing type"); } if (n instanceof ClassMember) { - assert ((ClassMember)n).memberDef()!=null; + myAssert(((ClassMember)n).memberDef()!=null,"ClassMember missing memberDef"); } if (n instanceof VarDecl) { - assert ((VarDecl)n).localDef()!=null; + myAssert(((VarDecl)n).localDef()!=null,"VarDecl missing localDef"); } if (n instanceof ProcedureCall) { - assert ((ProcedureCall)n).procedureInstance()!=null; + myAssert(((ProcedureCall)n).procedureInstance()!=null,"ProcedureCall missing procedureInstance"); } if (n instanceof NamedVariable) { - assert ((NamedVariable)n).varInstance()!=null; + myAssert(((NamedVariable)n).varInstance()!=null,"NamedVariable missing varInstance"); } if (n instanceof FieldAssign) { - assert ((FieldAssign)n).fieldInstance()!=null; + myAssert(((FieldAssign)n).fieldInstance()!=null,"FieldAssign missing fieldInstance"); } // x10 specific if (n instanceof Closure) { - assert ((Closure)n).closureDef()!=null; + myAssert(((Closure)n).closureDef()!=null,"Closure missing closureDef"); } if (n instanceof AssignPropertyBody) { - assert ((AssignPropertyBody)n).constructorInstance()!=null; + myAssert(((AssignPropertyBody)n).constructorInstance()!=null,"AssignPropertyBody missing constructorInstance"); } if (n instanceof SettableAssign) { - assert ((SettableAssign)n).methodInstance()!=null; + myAssert(((SettableAssign)n).methodInstance()!=null,"SettableAssign missing methodInstance"); } } } \ No newline at end of file Modified: trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -20,17 +20,16 @@ import polyglot.ast.CanonicalTypeNode; import polyglot.ast.ClassBody; import polyglot.ast.ClassMember; -import polyglot.ast.ConstructorDecl; import polyglot.ast.Expr; import polyglot.ast.Formal; import polyglot.ast.Id; -import polyglot.ast.IntLit; import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; import polyglot.ast.Receiver; import polyglot.ast.Stmt; import polyglot.ast.TypeNode; +import polyglot.ast.ConstructorCall; import polyglot.frontend.Job; import polyglot.main.Report; import polyglot.types.ConstructorInstance; @@ -51,12 +50,10 @@ import polyglot.util.Position; import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; -import x10.ast.AnnotationNode; import x10.ast.X10ConstructorDecl; import x10.ast.X10ClassDecl; import x10.ast.X10MethodDecl; import x10.ast.X10NodeFactory; -import x10.extension.X10Ext; import x10.types.ParameterType; import x10.types.X10Def; import x10.types.X10ConstructorDef; @@ -201,18 +198,22 @@ Expr assign = xnf.FieldAssign(p, special, fid, Assign.ASSIGN, init).fieldInstance(fdef.asInstance()).type(ftype); Formal f = xnf.Formal(p, xnf.FlagsNode(p, X10Flags.FINAL), ftnode, xnf.Id(p, id0)).localDef(ldef); + ArrayList<Stmt> ctorBlock = new ArrayList<Stmt>(); // super constructor def (noarg) - ConstructorDef sdef = xts.findConstructor(cdecl.superClass().type(), - xts.ConstructorMatcher(cdecl.superClass().type(), Collections.<Type>emptyList(), context)).def(); + final TypeNode superClass = cdecl.superClass(); + if (superClass!=null) { + ConstructorDef sdef = xts.findConstructor(superClass.type(), + xts.ConstructorMatcher(superClass.type(), Collections.<Type>emptyList(), context)).def(); + ctorBlock.add(xnf.SuperCall(p, Collections.<Expr>emptyList()).constructorInstance(sdef.asInstance())); + } + ctorBlock.add(xnf.Eval(p, assign)); X10ConstructorDecl xd = (X10ConstructorDecl) xnf.ConstructorDecl(p, xnf.FlagsNode(p, X10Flags.PRIVATE), cdecl.name(), Collections.<Formal>singletonList(f), Collections.<TypeNode>emptyList(), - xnf.Block(p, - xnf.SuperCall(p, Collections.<Expr>emptyList()).constructorInstance(sdef.asInstance()), - xnf.Eval(p, assign))); + xnf.Block(p,ctorBlock)); xd.typeParameters(cdecl.typeParameters()); xd.returnType(ftnode); Modified: trunk/x10.compiler/src/x10/visit/PositionInvariantChecker.java =================================================================== --- trunk/x10.compiler/src/x10/visit/PositionInvariantChecker.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/visit/PositionInvariantChecker.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -9,6 +9,7 @@ import polyglot.visit.NodeVisitor; import polyglot.frontend.Job; import polyglot.main.Report; +import polyglot.types.SemanticException; import x10.ast.AnnotationNode_c; import x10.ast.X10Formal_c; @@ -22,15 +23,16 @@ previousGoalName = previousName; } - public NodeVisitor enter(Node parent, Node n) - { + public Node visitEdgeNoOverride(Node parent, Node n) { try { if (Report.should_report("PositionInvariantChecker", 2)) Report.report(2, "Checking invariants for: " + n); checkInvariants(parent, n); + n.del().visitChildren(this); // if there is an error, I don't recurse to the children - } catch (AssertionError e) { + + } catch (SemanticException e) { String msg = "After goal "+previousGoalName+": "+ e.getMessage()+("!")+ (" parentPos=")+(parent.position())+ @@ -40,22 +42,26 @@ job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR,msg,n.position()); } - return this; + return n; } - private void checkInvariants(Node parent, Node n) { + private void myAssert(boolean cond, String msg) throws SemanticException { + if (!cond) + throw new SemanticException(msg); + } + private void checkInvariants(Node parent, Node n) throws SemanticException { if (parent == null) return; - assert (n != null) : "Cannot visit null"; + myAssert(n != null,"Cannot visit null"); Position pPos = parent.position(); Position nPos = n.position(); - assert ((pPos != null) && (nPos != null)) : "Positions must never be null"; + myAssert((pPos != null) && (nPos != null),"Positions must never be null"); if (nPos.isCompilerGenerated()) return; if (pPos.isCompilerGenerated()) { - //assert (nPos.isCompilerGenerated()) : "If your parent is COMPILER_GENERATED, then you must be COMPILER_GENERATED"; + //myAssert(nPos.isCompilerGenerated()) : "If your parent is COMPILER_GENERATED, then you must be COMPILER_GENERATED"; // todo: take from some ancestor return; } - assert (equals(pPos.file(), nPos.file())) : "Positions must have the same file"; - assert (equals(pPos.path(), nPos.path())) : "Positions must have the same path"; + myAssert(equals(pPos.file(), nPos.file()),"Positions must have the same file"); + myAssert(equals(pPos.path(), nPos.path()),"Positions must have the same path"); /* todo: remove this. @@ -98,15 +104,9 @@ checkNumbers(pPos.endColumn(), nPos.endColumn(), false); } - public static void checkNumbers(int pNum, int nNum, boolean isBeginning) { - assert nNum>=0 && pNum>=0 : "We have unknown numbers"; - /* - if (nNum < 0) return; - if (pNum < 0) { - assert (nNum < 0) : "If your parent has no number, then you cannot have a number"; - return; - } */ - assert isBeginning ? pNum<=nNum : pNum>=nNum : ("Illegal containment of positions! parentNum=")+(pNum)+(" nodeNum=")+(nNum)+((isBeginning) ? " and parent should be before child" : " and parent should be after child"); + public void checkNumbers(int pNum, int nNum, boolean isBeginning) throws SemanticException { + myAssert(nNum>=0 && pNum>=0,"We have unknown numbers"); + myAssert(isBeginning ? pNum<=nNum : pNum>=nNum,"Illegal containment of positions"); } public static boolean equals(Object o1, Object o2) { Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -637,15 +637,22 @@ w.write(">"); } - if (n.superClass() != null) { + final TypeNode superClassNode = n.superClass(); + if (superClassNode!= null || flags.isStruct()) { w.allowBreak(0); w.write("extends "); - Type superType = n.superClass().type(); - // FIXME: HACK! If a class extends x10.lang.Object, swipe in x10.core.Ref - if (!xts.typeEquals(superType, xts.Object(), context)) - er.printType(superType, PRINT_TYPE_PARAMS | BOX_PRIMITIVES | NO_VARIANCE); - else - w.write("x10.core.Ref"); + if (flags.isStruct()) { + assert superClassNode==null : superClassNode; + w.write("x10.core.Struct"); + } else { + assert superClassNode!=null; + Type superType = superClassNode.type(); + // FIXME: HACK! If a class extends x10.lang.Object, swipe in x10.core.Ref + if (!xts.typeEquals(superType, xts.Object(), context)) + er.printType(superType, PRINT_TYPE_PARAMS | BOX_PRIMITIVES | NO_VARIANCE); + else + w.write("x10.core.Ref"); + } } // Filter out x10.lang.Any from the interfaces. @@ -736,34 +743,7 @@ n.print(n.body(), w, tr); w.newline(); - // Generate structEquals for structs - if (flags.isStruct()) { - w.write("final public boolean structEquals(final java.lang.Object o) {"); - w.newline(4); - w.begin(0); - w.write("if (!(o instanceof " + def.fullName() +")) return false;"); - w.newline(); - for (PropertyDecl pd : n.properties()) { - w.write("if (!x10.rtt.Equality.equalsequals(this." + pd.name() + ", ((" + def.fullName() + ") o)." + pd.name() + ")) return false;"); - w.newline(); - } - for (ClassMember member : n.body().members()) { - if (member instanceof FieldDecl_c) { - FieldDecl_c field = (FieldDecl_c) member; - if (field.flags().flags().isStatic()) continue; - w.write("if (!x10.rtt.Equality.equalsequals(this." + field.name() + ", ((" + def.fullName() + ") o)." + field.name() + ")) return false;"); - w.newline(); - } - } - w.write("return true;"); - w.newline(); - w.end(); - w.write("}"); - w.newline(); - w.newline(); - } - w.write("}"); w.newline(0); @@ -929,7 +909,7 @@ w.write(")"); w.write(" || "); - new RuntimeTypeExpander(er, xts.Struct()).expand(tr); + w.write("x10.rtt.Types.runtimeType(x10.core.Struct.class)"); // new RuntimeTypeExpander(er, xts.Struct()).expand(tr); w.write("."); w.write("instanceof$("); tr.print(c, c.expr(), w); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-08 13:11:35 UTC (rev 14780) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-08 17:09:54 UTC (rev 14781) @@ -48,10 +48,6 @@ import static x10cpp.visit.SharedVarsMethods.make_ref; import static x10cpp.visit.SharedVarsMethods.refsAsPointers; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -105,7 +101,6 @@ import polyglot.ast.LocalClassDecl_c; import polyglot.ast.LocalDecl_c; import polyglot.ast.Local_c; -import polyglot.ast.Loop_c; import polyglot.ast.MethodDecl_c; import polyglot.ast.New_c; import polyglot.ast.Node; @@ -190,7 +185,6 @@ import x10.ast.X10Call_c; import x10.ast.X10CanonicalTypeNode; import x10.ast.X10CanonicalTypeNode_c; -import x10.ast.X10Cast; import x10.ast.X10Cast_c; import x10.ast.X10ClassDecl_c; import x10.ast.X10Field_c; @@ -200,7 +194,6 @@ import x10.ast.X10Local_c; import x10.ast.X10MethodDecl; import x10.ast.X10NodeFactory; -import x10.ast.X10Special; import x10.ast.X10Special_c; import x10.ast.X10Unary_c; import x10.extension.X10Ext; @@ -865,6 +858,10 @@ h.forceNewline(0); if (isStruct) { Emitter.openNamespaces(sh, pkgName); + if (def.fullName().toString().equals("x10.lang.Place")) { + sh.write("class Any; class String; // Forward reference are required in Place to prevent circularity"); + sh.newline(); + } sh.newline(0); sh.forceNewline(0); } @@ -1293,12 +1290,9 @@ private void visitStructBody(ClassBody_c n, X10CPPContext_c context, X10ClassType currentClass, X10ClassType superClass, X10TypeSystem xts) { + assert superClass==null : "Struct cannot have a superclass! superClass="+superClass; ClassifiedStream sh = context.structHeader; ClassifiedStream h = sw.header(); - boolean seenToString = false; - boolean seenHashCode = false; // autodefine hashCode if not userdefined - boolean seenEqualsAny = false; // autodefine equals(Any) if not userdefined - boolean seenEqualsSelf = false; // autodefine equals(S) if not userdefined String StructCType = Emitter.translateType(currentClass, false); @@ -1340,78 +1334,8 @@ } prev = member; n.printBlock(member, sw, tr); - - // The compiler provides implementations of equals, hashCode, and toString if - // there are no user-defined implementations. So, we need to search the struct's members - // and determine which methods to auto-generate and which ones are user-provided. - if (member instanceof MethodDecl_c) { - MethodDecl_c mdecl = (MethodDecl_c)member; - if (!mdecl.flags().flags().isAbstract() && - mdecl.name().id().toString().equals("toString") && - mdecl.formals().isEmpty() && - !mdecl.flags().flags().isStatic() && - xts.typeBaseEquals(xts.String(), mdecl.returnType().type(), context)) { - seenToString = true; - } - if (mdecl.name().id().toString().equals("hashCode") && - mdecl.formals().isEmpty() && - !mdecl.flags().flags().isStatic() && - xts.typeBaseEquals(xts.Int(), mdecl.returnType().type(), context)) { - seenHashCode = true; - } - if (mdecl.name().id().toString().equals("equals") && - mdecl.formals().size() == 1 && - xts.typeBaseEquals(xts.Any(), mdecl.formals().get(0).type().type(), context) && - !mdecl.flags().flags().isStatic() && - xts.typeBaseEquals(xts.Boolean(), mdecl.returnType().type(), context)) { - seenEqualsAny = true; - } - if (mdecl.name().id().toString().equals("equals") && - mdecl.formals().size() == 1 && - xts.typeBaseEquals(currentClass, mdecl.formals().get(0).type().type(), context) && - !mdecl.flags().flags().isStatic() && - xts.typeBaseEquals(xts.Boolean(), mdecl.returnType().type(), context)) { - seenEqualsSelf = true; - } - - } } - // Generate structEquals for structs - emitter.printType(xts.Boolean(), sh); - sh.write(" " + mangled_method_name(STRUCT_EQUALS_METHOD) + "("); - sh.write(StructCType + " that"); - sh.write(") {"); - sh.newline(4); - sh.begin(0); - if (superClass != null) { - sh.write("if (!this->" + Emitter.translateType(superClass) - + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) - + "(that))"); - sh.newline(4); - sh.begin(0); - sh.write("return false;"); - sh.end(); - sh.newline(); - } - for (FieldInstance fi : currentClass.fields()) { - if (!fi.flags().isStatic()) { - String na... [truncated message content] |
From: <ipe...@us...> - 2010-07-08 22:30:51
|
Revision: 14787 http://x10.svn.sourceforge.net/x10/?rev=14787&view=rev Author: ipeshansky Date: 2010-07-08 22:30:45 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Fix XTENLANG-1522. C++ assertions can now be turned on at runtime by setting X10_ENABLE_ASSERTIONS in the environment. Turn assertion generation in the compiler on by default and add a "-noassert" option to disable it. Modified Paths: -------------- trunk/x10.compiler/src/x10/X10CompilerOptions.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10aux/assert.cc trunk/x10.runtime/src-cpp/x10aux/assert.h trunk/x10.runtime/src-cpp/x10aux/config.h Modified: trunk/x10.compiler/src/x10/X10CompilerOptions.java =================================================================== --- trunk/x10.compiler/src/x10/X10CompilerOptions.java 2010-07-08 21:33:55 UTC (rev 14786) +++ trunk/x10.compiler/src/x10/X10CompilerOptions.java 2010-07-08 22:30:45 UTC (rev 14787) @@ -24,6 +24,7 @@ public X10CompilerOptions(ExtensionInfo extension) { super(extension); serialize_type_info = false; // turn off type info serialization for X10 + assertions = true; // turn on assertion generation for X10 } protected int parseCommand(String args[], int index, Set source) @@ -32,6 +33,11 @@ int i = super.parseCommand(args, index, source); if (i != index) return i; + if (args[i].equals("-noassert")) { + assertions = false; + return ++i; + } + try { Configuration.parseArgument(args[index]); return ++index; @@ -56,6 +62,7 @@ */ public void usage(PrintStream out) { super.usage(out); + usageForFlag(out, "-noassert", "turn off assertion generation"); String[][] options = Configuration.options(); for (int i = 0; i < options.length; i++) { String[] optinfo = options[i]; Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-08 21:33:55 UTC (rev 14786) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-07-08 22:30:45 UTC (rev 14787) @@ -2227,6 +2227,10 @@ if (!tr.job().extensionInfo().getOptions().assertions) return; + sw.write("#ifndef NO_ASSERTIONS"); + sw.newline(); + sw.write("if (x10aux::x10__assertions_enabled)"); + sw.newline(4); sw.begin(0); sw.write("x10aux::x10__assert("); n.print(n.cond(), sw, tr); if (n.errorMessage() != null) { @@ -2235,6 +2239,8 @@ n.print(n.errorMessage(), sw, tr); } sw.write(");"); + sw.end(); sw.newline(); + sw.write("#endif//NO_ASSERTIONS"); sw.newline(); } Modified: trunk/x10.runtime/src-cpp/x10aux/assert.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/assert.cc 2010-07-08 21:33:55 UTC (rev 14786) +++ trunk/x10.runtime/src-cpp/x10aux/assert.cc 2010-07-08 22:30:45 UTC (rev 14787) @@ -12,12 +12,14 @@ #include <x10aux/config.h> #include <x10aux/assert.h> #include <stdio.h> +#include <stdlib.h> #include <x10/lang/String.h> using namespace x10aux; using namespace x10::lang; +#ifndef NO_ASSERTIONS void x10aux::x10__assertion_failed(const ref<x10::lang::String>& message) { if (message == null) { fprintf(stderr,"Assertion failed.\n"); @@ -27,4 +29,7 @@ abort(); } +const bool x10aux::x10__assertions_enabled = ::getenv("X10_ENABLE_ASSERTIONS"); +#endif//NO_ASSERTIONS + // vim: textwidth=80:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime/src-cpp/x10aux/assert.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/assert.h 2010-07-08 21:33:55 UTC (rev 14786) +++ trunk/x10.runtime/src-cpp/x10aux/assert.h 2010-07-08 22:30:45 UTC (rev 14787) @@ -17,6 +17,7 @@ namespace x10 { namespace lang { class String; } } +#ifndef NO_ASSERTIONS namespace x10aux { extern const bool x10__assertions_enabled; @@ -28,6 +29,7 @@ x10__assertion_failed(message); } } +#endif//NO_ASSERTIONS #endif Modified: trunk/x10.runtime/src-cpp/x10aux/config.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/config.h 2010-07-08 21:33:55 UTC (rev 14786) +++ trunk/x10.runtime/src-cpp/x10aux/config.h 2010-07-08 22:30:45 UTC (rev 14787) @@ -15,10 +15,11 @@ /* * The following performance macros are supported: * NO_EXCEPTIONS - remove all exception-related code - * NO_CHECKS - same as NO_BOUNDS_CHECKS NO_NULL_CHECKS NO_PLACE_CHECKS + * NO_CHECKS - same as NO_BOUNDS_CHECKS NO_NULL_CHECKS NO_PLACE_CHECKS NO_ASSERTIONS * NO_BOUNDS_CHECKS - remove all bounds-checking code * NO_NULL_CHECKS - remove all null-checking code * NO_PLACE_CHECKS - remove all place-checking code + * NO_ASSERTIONS - remove all assertion checking code * NO_IOSTREAM - remove all iostream-related code * * The following #defines make be specified by the enclosing build @@ -69,6 +70,9 @@ #ifndef NO_PLACE_CHECKS #define NO_PLACE_CHECKS #endif//NO_PLACE_CHECKS +#ifndef NO_ASSERTIONS +#define NO_ASSERTIONS +#endif//NO_ASSERTIONS #endif #ifndef NDEBUG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-07-09 19:41:26
|
Revision: 14798 http://x10.svn.sourceforge.net/x10/?rev=14798&view=rev Author: dgrove-oss Date: 2010-07-09 19:41:19 +0000 (Fri, 09 Jul 2010) Log Message: ----------- minor cleanups of x10doc in x10.array.Array rename lift to map Modified Paths: -------------- trunk/x10.runtime/src-x10/x10/array/Array.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 Added Paths: ----------- trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 Removed Paths: ------------- trunk/x10.tests/examples/Constructs/Array/ArrayLift.x10 Modified: trunk/x10.runtime/src-x10/x10/array/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-07-09 19:41:19 UTC (rev 14798) @@ -103,13 +103,15 @@ * The specifics of this mapping are unspecified, although it would be reasonable to assume that * if the rect property is true, then every element of the backing IndexedMemoryChunk[T] actually * contatins a valid element of T. Furthermore, for a multi-dimensional array it is currently true - * (and likely to remain true) that the layout used is compatible with the expected by - * platform BLAS libraries. + * (and likely to remain true) that the layout used is a row-major layout (like C, unlike Fortran) + * and is compatible with the layout expected by platform BLAS libraries that operate on row-major + * C arrays. * * @return the IndexedMemoryChunk[T] that is the backing storage for the Array object. */ public @Header @Inline def raw() = raw; + /** * Construct an Array over the region reg whose elements are zero-initialized; * in future releases of X10, this method will only be callable if sizeof(T) bytes @@ -122,7 +124,7 @@ layout = new RectLayout(reg.min(), reg.max()); val n = layout.size(); - raw = IndexedMemoryChunk[T](n); + raw = IndexedMemoryChunk[T](n, true); rawLength = n; } @@ -161,9 +163,17 @@ layout = new RectLayout(reg.min(), reg.max()); val n = layout.size(); val r = IndexedMemoryChunk[T](n); - for (var i:int = 0; i<n; i++) { - r(i) = init; - } + if (reg.rect) { + // Can be optimized into a simple fill of the backing IndexedMemoryChunk + // because every element of the chunk is used by a point in the region. + for (var i:int = 0; i<n; i++) { + r(i) = init; + } + } else { + for (p:Point(reg.rank) in reg) { + r(layout.offset(p))= init; + } + } raw = r; rawLength = n; } @@ -191,7 +201,6 @@ * since this is a constructor. */ public def this(rail:ValRail[T]!):Array[T]{self.rank==1,rect,zeroBased} { - // TODO: could make this more efficient by optimizing rail copy. this(Region.makeRectangular(0, rail.length-1), ((i):Point(1)) => rail(i)); } @@ -459,42 +468,41 @@ /** - * Lift this array using the given unary operation. - * Apply the operation pointwise to the elements of this array. - * Return a new array with the same region as this array. - * Each element of the new array is the result of applying the given operation to the - * corresponding element of this array. - * + * Map the given unary operation onto the elements of this array + * constructing a new result array such that for all points <code>p</code> + * in <code>this.region</code>, + * <code>result(p) == op(this(p))</code>.<p> + * * @param op the given unary operation - * @return a new array with the same region as this array. + * @return a new array with the same region as this array where <code>result(p) == op(this(p))</code> + * * @see #reduce((T,T)=>T,T) * @see #scan((T,T)=>T,T) */ - public def lift(op:(T)=>T):Array[T](region)! { - // TODO: parallelize this operation. + public def map(op:(T)=>T):Array[T](region)! { return new Array[T](region, (p:Point(this.rank))=>op(apply(p))); } /** - * Lift this array using the given unary operation. - * Apply the operation pointwise to the elements of this array - * storing the result in the destination array. - * Each element of destination will be set to be the result of - * applying the given operation to the corresponding element of this array. + * Map the given unary operation onto the elements of this array + * storing the results in the dst array such that for all points <code>p</code> + * in <code>this.region</code>, + * <code>dst(p) == op(this(p))</code>.<p> * - * @param dst the destination array for the lift operation + * @param dst the destination array for the results of the map operation * @param op the given unary operation - * @return dst after applying the lift operation. + * @return dst after applying the map operation. + * * @see #reduce((T,T)=>T,T) * @see #scan((T,T)=>T,T) */ - public def lift(dst:Array[T](region)!, op:(T)=>T):Array[T](region)! { + public def map(dst:Array[T](region)!, op:(T)=>T):Array[T](region)!{self==dst} { // TODO: parallelize these loops. if (region.rect) { // In a rect region, every element in the backing raw IndexedMemoryChunk[T] // is included in the points of region, therfore we can optimize - // the traversal and simply lift on the IndexedMemoryChunk itself. + // the traversal and simply map on the IndexedMemoryChunk itself. for (var i:int =0; i<rawLength; i++) { dst.raw(i) = op(raw(i)); } @@ -508,45 +516,41 @@ /** - * Lift this array and a second source array using the given binary operation. - * Apply the operation pointwise to the elements of this array and the - * argument src array, returning a new array with the same region as this array. - * Each element of the new array is the result of applying the given operation to the - * corresponding element of this array and src. + * Map the given binary operation onto the elements of this array + * and the other src array, storing the results in a new result array + * such that for all points <code>p</code> in <code>this.region</code>, + * <code>result(p) == op(this(p), src(p))</code>.<p> * * @param op the given binary operation * @param src the other src array - * @return a new array with the same region as this array containing the result of the lift. + * @return a new array with the same region as this array containing the result of the map * @see #reduce((T,T)=>T,T) * @see #scan((T,T)=>T,T) */ - public def lift(src:Array[T](this.region)!, op:(T,T)=>T):Array[T](region)! { - // TODO: parallelize this operation. + public def map(src:Array[T](this.region)!, op:(T,T)=>T):Array[T](region)! { return new Array[T](region, (p:Point(this.rank))=>op(apply(p), src(p))); } /** - * Lift this array and a second source array using the given binary operation. - * Apply the operation pointwise to the elements of this array and the - * other array storing the result in the destination array. - * Each element of destination will be set to be the result of - * applying the given operation to the corresponding element of this array - * and the src array. + * Map the given binary operation onto the elements of this array + * and the other src array, storing the results in the given dst array + * such that for all points <code>p</code> in <code>this.region</code>, + * <code>dst(p) == op(this(p), src(p))</code>.<p> * - * @param dst the destination array for the lift operation - * @param src the second source array for the lift operation + * @param dst the destination array for the map operation + * @param src the second source array for the map operation * @param op the given binary operation - * @return destination after applying the lift operation. + * @return destination after applying the map operation. * @see #reduce((T,T)=>T,T) * @see #scan((T,T)=>T,T) */ - public def lift(dst:Array[T](region)!, src:Array[T](region)!, op:(T,T)=>T):Array[T](region)! { + public def map(dst:Array[T](region)!, src:Array[T](region)!, op:(T,T)=>T):Array[T](region)! { // TODO: parallelize these loops. if (region.rect) { // In a rect region, every element in the backing raw IndexedMemoryChunk[T] // is included in the points of region, therfore we can optimize - // the traversal and simply lift on the IndexedMemoryChunk itself. + // the traversal and simply map on the IndexedMemoryChunk itself. for (var i:int =0; i<rawLength; i++) { dst.raw(i) = op(raw(i), src.raw(i)); } @@ -568,7 +572,7 @@ * @param op the given binary operation * @param unit the given initial value * @return the final result of the reduction. - * @see #lift((T)=>T) + * @see #map((T)=>T) * @see #scan((T,T)=>T,T) */ public def reduce(op:(T,T)=>T, unit:T):T { @@ -601,7 +605,7 @@ * @param op the given binary operation * @param unit the given initial value * @return a new array containing the result of the scan - * @see #lift((T)=>T) + * @see #map((T)=>T) * @see #reduce((T,T)=>T,T) */ public def scan(op:(T,T)=>T, unit:T): Array[T](region)! = scan(new Array[T](region), op, unit); // TODO: private constructor to avoid useless zeroing @@ -618,7 +622,7 @@ * @param op the given binary operation * @param unit the given initial value * @return a new array containing the result of the scan - * @see #lift((T)=>T) + * @see #map((T)=>T) * @see #reduce((T,T)=>T,T) */ public def scan(dst:Array[T](region)!, op:(T,T)=>T, unit:T): Array[T](region)! { Modified: trunk/x10.runtime/src-x10/x10/array/DistArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-07-09 19:41:19 UTC (rev 14798) @@ -316,18 +316,17 @@ // operations // - public global def lift(op:(T)=>T): DistArray[T](dist) + public global def map(op:(T)=>T): DistArray[T](dist) = make[T](dist, ((p:Point)=>op(this(p as Point(rank))))); - public global def lift(r:Region(rank), op:(T)=>T): DistArray[T] + public global def map(r:Region(rank), op:(T)=>T): DistArray[T] = make[T](dist | r, ((p:Point)=>op(this(p as Point(rank))))); - public global def lift(src:DistArray[T](this.dist), op:(T,T)=>T):DistArray[T](dist) + public global def map(src:DistArray[T](this.dist), op:(T,T)=>T):DistArray[T](dist) = make[T](dist, ((p:Point)=>op(this(p as Point(rank)), src(p as Point(rank))))); - - public global def lift(src:DistArray[T](this.dist), r:Region(rank), op:(T,T)=>T):DistArray[T](rank) + public global def map(src:DistArray[T](this.dist), r:Region(rank), op:(T,T)=>T):DistArray[T](rank) = make[T]((dist | r) as Dist(rank), ((p:Point)=>op(this(p as Point(rank)), src(p as Point(rank))))); public global def reduce(op:(T,T)=>T, unit:T):T { Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside 2010-07-09 19:41:19 UTC (rev 14798) @@ -54,7 +54,7 @@ arrEq(ia1.scan(Int.+, 0), DistArray.make[Int](D, (var Point (i): Point): int => (ia1 | 0..i).reduce(Int.+, 0))); - arrEq(makeArray(D01, 1).lift(Int.+, makeArray(D01, -4)), + arrEq(makeArray(D01, 1).map(Int.+, makeArray(D01, -4)), makeArray(D01, -3)); // are we still supporting +,-,... on arrays? Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside 2010-07-09 19:41:19 UTC (rev 14798) @@ -17,7 +17,7 @@ /** * Constant promotions to arrays: (D n) * disjoint union and overlay of arrays - * array lift, scan and reduce. + * array map, scan and reduce. * * @author kemal 4/2005 */ @@ -58,7 +58,7 @@ arrEq(ia1.scan(Int.+, 0), DistArray.make[Int](D, (var Point (i): Point): int => (ia1 | 0..i).reduce(Int.+))); - arrEq(makeArray(D01, 1).lift(Int.+, makeArray(D01, -4)), makeArray(D01, -3)); + arrEq(makeArray(D01, 1).map(Int.+, makeArray(D01, -4)), makeArray(D01, -3)); // are we still supporting +,-,... on arrays? arrEq(makeArray(D01, 1) + makeArray(D01, -4), makeArray(D01, -3) * makeArray(D01, 1)); Deleted: trunk/x10.tests/examples/Constructs/Array/ArrayLift.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayLift.x10 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.tests/examples/Constructs/Array/ArrayLift.x10 2010-07-09 19:41:19 UTC (rev 14798) @@ -1,57 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -/** - * @author bdlucas - */ - -public class ArrayLift extends TestArray { - - public const N: int = 9; - - public def run(): boolean { - chk(Place.places.length == 4, "This test must be run with 4 places"); - - val dist = Dist.makeBlock(0..N); - prDist("dist", dist); - - pr("--- original"); - val a: DistArray[double](dist) = DistArray.make[double](dist, (p:Point)=>p(0) as double); - for (pt:Point(1) in a) { - val x = (future(a.dist(pt)) a(pt)).force(); - out.print(x + " "); - } - out.println(); - - pr("--- lifted"); - val b = a.lift((a:double)=>1.5*a) as DistArray[double](dist); - for (pt:Point(1) in b) { - val x = (future(b.dist(pt)) b(pt)).force(); - out.print(x + " "); - } - out.println(); - - return status(); - } - - public static def main(var args: Rail[String]): void = { - new ArrayLift().execute(); - } - - def expected() = - "--- dist: Dist(0->[0..2],1->[3..5],2->[6..7],3->[8..9])\n" + - "0 0 0 1 1 1 2 2 3 3 \n" + - "--- original\n" + - "0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 \n" + - "--- lifted\n" + - "0.0 1.5 3.0 4.5 6.0 7.5 9.0 10.5 12.0 13.5 \n"; - -} Copied: trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 (from rev 14790, trunk/x10.tests/examples/Constructs/Array/ArrayLift.x10) =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 (rev 0) +++ trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 2010-07-09 19:41:19 UTC (rev 14798) @@ -0,0 +1,57 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +/** + * @author bdlucas + */ + +public class ArrayMap extends TestArray { + + public const N: int = 9; + + public def run(): boolean { + chk(Place.places.length == 4, "This test must be run with 4 places"); + + val dist = Dist.makeBlock(0..N); + prDist("dist", dist); + + pr("--- original"); + val a: DistArray[double](dist) = DistArray.make[double](dist, (p:Point)=>p(0) as double); + for (pt:Point(1) in a) { + val x = (future(a.dist(pt)) a(pt)).force(); + out.print(x + " "); + } + out.println(); + + pr("--- mapped"); + val b = a.map((a:double)=>1.5*a) as DistArray[double](dist); + for (pt:Point(1) in b) { + val x = (future(b.dist(pt)) b(pt)).force(); + out.print(x + " "); + } + out.println(); + + return status(); + } + + public static def main(var args: Rail[String]): void = { + new ArrayMap().execute(); + } + + def expected() = + "--- dist: Dist(0->[0..2],1->[3..5],2->[6..7],3->[8..9])\n" + + "0 0 0 1 1 1 2 2 3 3 \n" + + "--- original\n" + + "0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 \n" + + "--- mapped\n" + + "0.0 1.5 3.0 4.5 6.0 7.5 9.0 10.5 12.0 13.5 \n"; + +} Modified: trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside =================================================================== --- trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside 2010-07-09 19:41:19 UTC (rev 14798) @@ -17,7 +17,7 @@ /** * Tests miscellaneous features together: async, future, atomic, - * distributed array, dist ops, reduction, scan, lift. + * distributed array, dist ops, reduction, scan, map. * * @author kemal 12/2004 */ @@ -102,8 +102,8 @@ chk(sum == (future(D(pNP_1)) y(pNP_1)).force()); chk(sum == (future(D(NP-1)) y(NP-1)).force()); - // test lift - val z: DistArray[int]{dist==D} = x.lift(Int.+, y) as DistArray[int]{dist==D}; + // test map + val z: DistArray[int]{dist==D} = x.map(Int.+, y) as DistArray[int]{dist==D}; finish ateach (val pi in D) chk(z(pi) == x(pi) + y(pi)); Modified: trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 2010-07-09 19:14:24 UTC (rev 14797) +++ trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 2010-07-09 19:41:19 UTC (rev 14798) @@ -23,7 +23,7 @@ def incr(A: Array[Int]!): Array[Int] = { val f = (x: Int) => x+1; // e.g., f(1) == 2 - return A.lift(f); + return A.map(f); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-07-14 15:58:31
|
Revision: 14867 http://x10.svn.sourceforge.net/x10/?rev=14867&view=rev Author: dgrove-oss Date: 2010-07-14 15:58:24 +0000 (Wed, 14 Jul 2010) Log Message: ----------- Minor reorganization of samples directory, put all the CUDA examples in a CUDA sub-directory. Tell test scripts about this new directory Tell package release script to pick up entire samples directory. Modified Paths: -------------- trunk/x10.dist/releng/packageCPPRelease.sh trunk/x10.tests/bin/xtestScriptCT++ trunk/x10.tests/bin/xtestScriptCT0 Added Paths: ----------- trunk/x10.dist/samples/CUDA/ trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 trunk/x10.dist/samples/CUDA/CUDAKernelTest.x10 trunk/x10.dist/samples/CUDA/CUDATopology.x10 trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 Removed Paths: ------------- trunk/x10.dist/samples/CUDABlackScholes.x10 trunk/x10.dist/samples/CUDAKernelTest.x10 trunk/x10.dist/samples/CUDATopology.x10 trunk/x10.dist/samples/KMeansCUDA.x10 Modified: trunk/x10.dist/releng/packageCPPRelease.sh =================================================================== --- trunk/x10.dist/releng/packageCPPRelease.sh 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.dist/releng/packageCPPRelease.sh 2010-07-14 15:58:24 UTC (rev 14867) @@ -57,4 +57,4 @@ [ "$cdir" = "/" ] && cdir="$cdir." cd "$top" -tar -cvzf "$cdir/$tarfile" INSTALL.txt README.txt RELEASE.NOTES.txt bin/{runx10,setupX10,x10,x10c,x10c++,mpirunx10,launcher,manager,daemon} epl-v10.html etc include lib/*.jar lib/{${PLAT_LIBPAT}} samples/*.x10 +tar -cvzf "$cdir/$tarfile" INSTALL.txt README.txt RELEASE.NOTES.txt bin/{runx10,setupX10,x10,x10c,x10c++,mpirunx10,launcher,manager,daemon} epl-v10.html etc include lib/*.jar lib/{${PLAT_LIBPAT}} samples Copied: trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 (from rev 14866, trunk/x10.dist/samples/CUDABlackScholes.x10) =================================================================== --- trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 (rev 0) +++ trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -0,0 +1,160 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.io.Console; +import x10.compiler.CUDA; +import x10.compiler.CUDADirectParams; +import x10.compiler.CUDAUtilities; +import x10.compiler.Native; +import x10.util.Random; + +/* + * This sample evaluates fair call and put prices for a + * given set of European options by Black-Scholes formula. + * + * This program is inteneded to run on NVIDIA GPU accelerators + */ + +public class CUDABlackScholes { + + static def doBlackScholes(p:Place, + optionYears:Rail[Float]{self.at(p)}, + stockPrice:Rail[Float]{self.at(p)}, + optionStrike:Rail[Float]{self.at(p)}, + callResult:Rail[Float]{self.at(p)}, + putResult:Rail[Float]{self.at(p)}, + opt_N:Int, + R:Float, + V:Float) { + val blocks = 480; + val threads = 128; + finish async (p) @CUDA @CUDADirectParams { + //val blocks = CUDAUtilities.autoBlocks(), + // threads = CUDAUtilities.autoThreads(); + for ((block) in 0..blocks-1) { + for ((thread) in 0..threads-1) async { + val tid = block * threads + thread; + val tids = blocks * threads; + for (var opt:Int=tid; opt < opt_N; opt+=tids) { + // Constants for Polynomial approximation of cumulative normal distribution + val A1 = 0.31938153f; + val A2 = -0.356563782f; + val A3 = 1.781477937f; + val A4 = -1.821255978f; + val A5 = 1.330274429f; + val RSQRT2PI = 0.39894228040143267793994605993438f; + + val T = optionYears(opt); + val S = stockPrice(opt); + val X = optionStrike(opt); + val sqrtT = Math.sqrt(T); + val d1 = (Math.log(S/X) + (R + 0.5f * V * V) * T) / (V * sqrtT); + val d2 = d1 - V * sqrtT; + + val K1 = 1.0f / (1.0f + 0.2316419f * Math.abs(d1)); + val K2 = 1.0f / (1.0f + 0.2316419f * Math.abs(d2)); + var CNDD1:Float = RSQRT2PI * Math.exp(- 0.5f * d1 * d1) * + (K1 * (A1 + K1 * (A2 + K1 * (A3 + K1 * (A4 + K1 * A5))))); + var CNDD2:Float = RSQRT2PI * Math.exp(- 0.5f * d2 * d2) * + (K2 * (A1 + K2 * (A2 + K2 * (A3 + K2 * (A4 + K2 * A5))))); + + if(d1 > 0) CNDD1 = 1.0f - CNDD1; + if(d2 > 0) CNDD2 = 1.0f - CNDD2; + + //Calculate Call and Put simultaneously + val expRT = Math.exp(- R * T); + callResult(opt) = S * CNDD1 - X * expRT * CNDD2; + putResult(opt) = X * expRT * (1.0f - CNDD2) - S * (1.0f - CNDD1); + } + } + } + } + } + + public static def main (args: Rail[String]!) { + + // Problem parameters + val OPT_N = 4000000; + val NUM_ITERATIONS = 512; + val RISKFREE = 0.02f; + val VOLATILITY = 0.30f; + + val gpu = here.child(0); + val cpu = here; + val rand = new Random(); + + // Host arrays + val h_CallResultCPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); + val h_PutResultCPU = Rail.make[Float](OPT_N, (Int)=>-1.0 as Float); + val h_CallResultGPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); + val h_PutResultGPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); + val h_StockPrice = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); + val h_OptionStrike = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); + val h_OptionYears = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); + + // Device arrays + val d_CallResult = Rail.makeRemote(gpu, OPT_N, (Int)=>0.0 as Float); + val d_PutResult = Rail.makeRemote(gpu, OPT_N, (Int)=>0.0 as Float); + val d_StockPrice = Rail.makeRemote(gpu, OPT_N, h_StockPrice); + val d_OptionStrike = Rail.makeRemote(gpu, OPT_N, h_OptionStrike); + val d_OptionYears = Rail.makeRemote(gpu, OPT_N, h_OptionYears); + + val gpuTimeStart = System.nanoTime(); + for (var i:Int=0; i < NUM_ITERATIONS; i++) { + doBlackScholes(gpu, + d_OptionYears, + d_StockPrice, + d_OptionStrike, + d_CallResult, + d_PutResult, + OPT_N, + RISKFREE, + VOLATILITY); + } + var gpuTime:Float = System.nanoTime() - gpuTimeStart; + gpuTime /= (NUM_ITERATIONS as Float); + Console.OUT.println("Options count : " + 2 * OPT_N); + Console.OUT.println("BlackScholesGPU() time : " + gpuTime/(1.0e-6f) + " msec"); + Console.OUT.println("Effective memory bandwidth: " + (5 * OPT_N * 4) * 1.0e-9f / (gpuTime * 1.0E-9f) + " GB/s"); + Console.OUT.println("Gigaoptions per second : " + ((2 * OPT_N) * 1.0e-9f) / (gpuTime * 1.0e-9f)); + + // Read back GPU results + finish { + h_CallResultGPU.copyFrom(0, d_CallResult, 0, OPT_N); + h_PutResultGPU.copyFrom(0, d_PutResult, 0, OPT_N); + } + // Run BlackScholes on CPU to test results against + doBlackScholes(cpu, + h_OptionYears, + h_StockPrice, + h_OptionStrike, + h_CallResultCPU, + h_PutResultCPU, + OPT_N, + RISKFREE, + VOLATILITY); + // Check results + var sum_delta:Float = 0.0f; + var sum_ref:Float = 0.0f; + var max_delta:Float = 0.0f; + for (var i:Int=0; i < OPT_N; i++) { + val ref_val = h_CallResultCPU(i); + val delta = Math.abs(ref_val - h_CallResultGPU(i)); + if(delta > max_delta) max_delta = delta; + sum_delta += delta; + sum_ref += Math.abs(ref_val); + } + val L1norm = sum_delta / sum_ref; + Console.OUT.println("L1 norm: " + L1norm); + Console.OUT.println("Max absolute error: " + max_delta); + Console.OUT.println((L1norm < 1e-6f) ? "TEST PASSED" : "TEST FAILED"); + } +} Copied: trunk/x10.dist/samples/CUDA/CUDAKernelTest.x10 (from rev 14866, trunk/x10.dist/samples/CUDAKernelTest.x10) =================================================================== --- trunk/x10.dist/samples/CUDA/CUDAKernelTest.x10 (rev 0) +++ trunk/x10.dist/samples/CUDA/CUDAKernelTest.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -0,0 +1,72 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.io.Console; +import x10.compiler.CUDA; + +public class CUDAKernelTest { + + static def doWork (init:Rail[Float]!, recv:Rail[Float]!, p:Place, len:Int) { + val remote = Rail.makeRemote(p,len,(Int)=>0.0 as Float); // allocate + + //finish init.copyTo(0, remote, 0, len); // dma there + val init_ = init as ValRail[Float]; + + finish async (p) @CUDA { + for ((block):Point in 0..7) { + for ((thread):Point in 0..63) async { + val tid = block*64 + thread; + val tids = 8*64; + for (var i:Int=tid ; i<len ; i+=tids) { + //remote(i) = Math.sqrt(remote(i)); + remote(i) = Math.sqrt(init_(i)); + } + } + } + } + + finish recv.copyFrom(0, remote, 0, len); // dma back + + // validate + var success:Boolean = true; + for ((i) in 0..remote.length-1) { + if (Math.abs(1 - (recv(i)*recv(i))/(i as Float)) > 1E-6f) { + Console.ERR.println("recv("+i+"): "+recv(i)+" * "+recv(i)+" = "+(recv(i)*recv(i))); + success = false; + } + } + Console.OUT.println((success?"SUCCESS":"FAIL")+" at "+p); + } + + public static def main (args : Rail[String]!) { + val len = args.length==1 ? Int.parse(args(0)) : 1000; + + for (host in Place.places) at (host) { + + val init = Rail.make[Float](len,(i:Int)=>i as Float); + val recv = Rail.make[Float](len,(i:Int)=>0.0 as Float); + + var done_work:Boolean = false; + + for (gpu in here.children()) if (gpu.isCUDA()) { + doWork(init, recv, gpu, len); + done_work = true; + } + + if (!done_work) { + doWork(init, recv, here, len); + } + } + } +} + +// vim: shiftwidth=4:tabstop=4:expandtab + Copied: trunk/x10.dist/samples/CUDA/CUDATopology.x10 (from rev 14866, trunk/x10.dist/samples/CUDATopology.x10) =================================================================== --- trunk/x10.dist/samples/CUDA/CUDATopology.x10 (rev 0) +++ trunk/x10.dist/samples/CUDA/CUDATopology.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -0,0 +1,43 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.io.Console; + +public class CUDATopology { + public static def main (args : Rail[String]) { + for (p in Place.places) { + at (p) { + Console.OUT.println("Dumping places at place: "+p); + for (p2 in Place.places) { + Console.OUT.println("Place: "+p2); + Console.OUT.println(" Parent: "+p2.parent()); + Console.OUT.println(" NumChildren: "+p2.numChildren()); + if (p2.isCUDA()) Console.OUT.println(" Is a CUDA place"); + if (p2.isHost()) Console.OUT.println(" Is a Host place"); + if (p2.isSPE()) Console.OUT.println(" Is a SPE place"); + val children = p2.children(); + for (c in children) { + Console.OUT.println(" Child "+c.childIndex()+": "+c); + Console.OUT.println(" Parent: "+c.parent()); + Console.OUT.println(" NumChildren: "+c.numChildren()); + if (c.isCUDA()) Console.OUT.println(" Is a CUDA place"); + if (c.isHost()) Console.OUT.println(" Is a Host place"); + if (c.isSPE()) Console.OUT.println(" Is a SPE place"); + } + } + Console.OUT.println(); + } + } + } +} + +// vim: shiftwidth=8:tabstop=8:expandtab + Copied: trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 (from rev 14866, trunk/x10.dist/samples/KMeansCUDA.x10) =================================================================== --- trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 (rev 0) +++ trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -0,0 +1,342 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.io.Console; + +import x10.io.File; +import x10.io.Marshal; +import x10.io.IOException; + +import x10.util.DistributedRail; +import x10.util.Pair; +import x10.util.HashMap; + +import x10.util.OptionsParser; +import x10.util.Option; + +import x10.compiler.Unroll; +import x10.compiler.CUDA; +import x10.compiler.CUDAUtilities; +import x10.compiler.Native; + + +/* +final class DistributedRail[T] implements Settable[Int,T], Iterable[T] { + global val data : PlaceLocalHandle[Rail[T]]; + global val firstPlace : Place; + global val localRails = PlaceLocalHandle.make[HashMap[Activity!, Rail[T]!]](Dist.makeUnique(), ()=>new HashMap[Activity!, Rail[T]!]()); + global val original : ValRail[T]; + global val original_len : Int; + + global val done = PlaceLocalHandle.make[Cell[Boolean]](Dist.makeUnique(), ()=>new Cell[Boolean](false)); + + public def this (len:Int, init:ValRail[T]) { + val vr = ValRail.make(len, init); + data = PlaceLocalHandle.make[Rail[T]](Dist.makeUnique(), ()=>Rail.make(len,vr)); + firstPlace = here; + original = vr; + original_len = len; + } + + public def this (len:Int, init:(Int)=>T) { + val vr = ValRail.make(len, init); + data = PlaceLocalHandle.make[Rail[T]](Dist.makeUnique(), ()=>Rail.make(len,vr)); + firstPlace = here; + original = vr; + original_len = len; + } + + public static safe operator[S] (x:DistributedRail[S]) = x() as ValRail[S]; + + public global safe def apply () { + val a = Runtime.activity(); + val r = localRails().getOrElse(a, null); + if (r==null) { + val r_ = Rail.make(original_len, original); + localRails().put(a, r_); + return r_; + } + return r; + } + + public global safe def get() = data(); + + public global safe def drop() { localRails().remove(Runtime.activity()); } + + public global safe def apply (i:Int) = this()(i); + + public global safe def set (v:T, i:Int) = this()(i) = v; + + public global safe def iterator () = this().iterator(); + + // TODO: remove this once collection API gets improved so that + // entries returns a Set[Map.Entry[K,V]!]! + private static global def placeCastHack[T](x:T) = x as T!; + + private global def reduceLocal (op:(T,T)=>T) { + val master = data(); + var first:Boolean = true; + for (e in localRails().entries()) { + val r = placeCastHack(e).getValue(); + if (first) { + finish r.copyTo(0, master, 0, r.length); + first = false; + } else { + for (var i:Int=0 ; i<master.length ; ++i) { + master(i) = op(master(i), r(i)); + } + } + } + } + + private global def reduceGlobal (op:(T,T)=>T) { + if (firstPlace!=here) { + val local_ = data(); + { + val local = local_ as ValRail[T]; + val data_ = data; + at (firstPlace) { + val master = data_(); + atomic for (var i:Int=0 ; i<master.length ; ++i) { + master(i) = op(master(i), local(i)); + } + } + } + //next; // every place has transmitted contents to master + val handle = data; // avoid 'this' being serialised + finish local_.copyFrom(0, firstPlace, ()=>Pair[Rail[T],Int](handle(),0), local_.length); + } else { + //next; + } + } + + private global def bcastLocal (op:(T,T)=>T) { + val master = data(); + for (e in localRails().entries()) { + val r = placeCastHack(e).getValue(); + finish r.copyFrom(0, master, 0, r.length); + } + } + + // op must be commutative + public global def collectiveReduce (op:(T,T)=>T) { + var i_won:Boolean = false; + atomic { + if (!done().value) { + i_won = true; + done().value = true; + } + } + //next; // activity rails populated at this place + if (i_won) { + // single thread per place mode + reduceLocal(op); + //next; // every place has local rail populated + reduceGlobal(op); // there's one 'next' in here too + bcastLocal(op); + done().value = false; + } else { + //next; + //next; + } + //next; // every place has finished reading from place 0 + } + +} +*/ + + +public class KMeansCUDA { + + public static def printClusters (clusters:Rail[Float]!, dims:Int) { + for (var d:Int=0 ; d<dims ; ++d) { + for (var k:Int=0 ; k<clusters.length/dims ; ++k) { + if (k>0) Console.OUT.print(" "); + Console.OUT.printf("%.2f",clusters(k*dims+d)); + } + Console.OUT.println(); + } + } + +/* + @Native("c++", "#4") + private static global def placePun[T](x:T) = x as T!; +*/ + + private static def round_up (x:UInt, n:UInt) = (x-1) - ((x-1)%n) + n; + + public static def main (args : Rail[String]!) { + try { + val opts = new OptionsParser(args, [ + Option("q","quiet","just print time taken"), + Option("v","verbose","print out each iteration") + ], [ + Option("p","points","location of data file"), + Option("i","iterations","quit after this many iterations"), + Option("c","clusters","number of clusters to find"), + Option("s","slices","factor by which to oversubscribe computational resources"), + Option("n","num","quantity of points")]); + // The casts can go on resolution of XTENLANG-1413 + val fname = opts("-p", "points.dat"), num_clusters=opts("-c",8) as UInt, + num_slices=opts("-s",4) as UInt, num_global_points=opts("-n", 100000) as UInt, + iterations=opts("-i",500) as UInt; + val verbose = opts("-v"), quiet = opts("-q"); + + val MEM_ALIGN = 32; // FOR CUDA + + if (!quiet) + Console.OUT.println("points: "+num_global_points+" clusters: "+num_clusters+" dim: "+4); + + // file is dimension-major + val file = new File(fname), fr = file.openRead(); + val init_points = (Int) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); + val num_file_points = file.size() / 4 / 4 as Int; + val file_points = ValRail.make(num_file_points*4, init_points); + + var results : Rail[Float]!; + + // clusters are dimension-major + val clusters = new DistributedRail[Float](num_clusters*4, file_points); + val cluster_counts = new DistributedRail[Int](num_clusters, (Int)=>0); + + finish async { + + // SPMD style for algorithm + val clk = Clock.make(); + + val num_slice_points = num_global_points / num_slices; + + for ((slice) in 0..num_slices-1) { + + for (h in Place.places) for (gpu in h.children()) async (h) clocked(clk) { + + // carve out local portion of points (point-major) + val num_local_points = num_slice_points / Place.NUM_ACCELS; + val offset = slice*num_slice_points + (gpu.id - Place.MAX_PLACES) * num_local_points; + if (!quiet) + Console.OUT.println(gpu+" gets "+offset+" len "+num_local_points); + val num_local_points_stride = round_up(num_local_points,MEM_ALIGN); + val init = (i:Int) => { + val d=i/num_local_points_stride, p=i%num_local_points_stride; + return p<num_local_points ? file_points(((p+offset)%num_file_points)*4 + d) : 0; + }; + + // these are pretty big so allocate up front + val host_points = Rail.make(num_local_points_stride*4 as Int, init); + val gpu_points = Rail.makeRemote(gpu, num_local_points_stride*4 as Int, host_points); + val host_nearest = Rail.make[Int](num_local_points as Int, (Int)=>0 as Int); + val gpu_nearest = Rail.makeRemote[Int](gpu, num_local_points as Int, (Int)=>0 as Int); + + //next; + + val start_time = System.currentTimeMillis(); + + main_loop: for (var iter:UInt=0 ; iter<iterations ; iter++) { + + val clusters_copy = clusters as ValRail[Float]; + + var k_start_time : Long = System.currentTimeMillis(); + // classify kernel + finish async (gpu) @CUDA { + val blocks = CUDAUtilities.autoBlocks(), + threads = CUDAUtilities.autoThreads(); + for ((block) in 0..blocks-1) { + val clustercache = Rail.make[Float](num_clusters*4, clusters_copy); + for ((thread) in 0..threads-1) async { + val tid = block * threads + thread; + val tids = blocks * threads; + for (var p:UInt=tid ; p<num_local_points ; p+=tids) { + var closest:Int = -1; + var closest_dist:Float = Float.MAX_VALUE; + @Unroll(20) for ((k) in 0..num_clusters-1) { + // Pythagoras (in d dimensions) + var dist : Float = 0; + for ((d) in 0..3) { + val tmp = gpu_points(p+d*num_local_points_stride) + - clustercache(k*4+d); + dist += tmp * tmp; + } + // record closest cluster seen so far + if (dist < closest_dist) { + closest_dist = dist; + closest = k; + } + } + gpu_nearest(p) = closest; + } + } + } + } + Console.OUT.println("kernel: "+(System.currentTimeMillis() - k_start_time)); + + // bring gpu results onto host + k_start_time = System.currentTimeMillis(); + finish host_nearest.copyFrom(0, gpu_nearest, 0, num_local_points as Int); + Console.OUT.println("dma: "+(System.currentTimeMillis() - k_start_time)); + + // compute new clusters + + // hoist from loop for performance reasons + val host_clusters = clusters(); + val host_cluster_counts = cluster_counts(); + + host_clusters.reset(0); + host_cluster_counts.reset(0); + + k_start_time = System.currentTimeMillis(); + for (var p:UInt=0 ; p<num_local_points ; p++) { + val closest = host_nearest(p); + for (var d:UInt=0 ; d<4u ; ++d) + host_clusters(closest*4+d) += host_points(p+d*num_local_points_stride); + host_cluster_counts(closest)++; + } + Console.OUT.println("reaverage: "+(System.currentTimeMillis() - k_start_time)); + + clusters.collectiveReduce(Float.+); + cluster_counts.collectiveReduce(Int.+); + + for (var k:UInt=0 ; k<num_clusters ; ++k) { + for (var d:UInt=0 ; d<4u ; ++d) host_clusters(k*4u+d) /= host_cluster_counts(k); + } + + if (offset==0u && verbose) { + Console.OUT.println("Iteration: "+iter); + printClusters(clusters() as Rail[Float]!,4u); + } + + // TEST FOR CONVERGENCE + for (var j:UInt=0 ; j<num_clusters*4 ; ++j) { + if (true/*||Math.abs(clusters_copy(j)-clusters(j))>0.0001*/) continue main_loop; + } + + break; + + } // main_loop + + if (offset==0u) { + val stop_time = System.currentTimeMillis(); + if (!quiet) Console.OUT.print(num_global_points+" "+num_clusters+" 4 "); + Console.OUT.println((stop_time-start_time)/1E3); + } + + } // gpus + + } // slice + + } // finish + + } catch (e : Throwable) { + e.printStackTrace(Console.ERR); + } + } +} + +// vim: shiftwidth=4:tabstop=4:expandtab Deleted: trunk/x10.dist/samples/CUDABlackScholes.x10 =================================================================== --- trunk/x10.dist/samples/CUDABlackScholes.x10 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.dist/samples/CUDABlackScholes.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -1,160 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -import x10.io.Console; -import x10.compiler.CUDA; -import x10.compiler.CUDADirectParams; -import x10.compiler.CUDAUtilities; -import x10.compiler.Native; -import x10.util.Random; - -/* - * This sample evaluates fair call and put prices for a - * given set of European options by Black-Scholes formula. - * - * This program is inteneded to run on NVIDIA GPU accelerators - */ - -public class CUDABlackScholes { - - static def doBlackScholes(p:Place, - optionYears:Rail[Float]{self.at(p)}, - stockPrice:Rail[Float]{self.at(p)}, - optionStrike:Rail[Float]{self.at(p)}, - callResult:Rail[Float]{self.at(p)}, - putResult:Rail[Float]{self.at(p)}, - opt_N:Int, - R:Float, - V:Float) { - val blocks = 480; - val threads = 128; - finish async (p) @CUDA @CUDADirectParams { - //val blocks = CUDAUtilities.autoBlocks(), - // threads = CUDAUtilities.autoThreads(); - for ((block) in 0..blocks-1) { - for ((thread) in 0..threads-1) async { - val tid = block * threads + thread; - val tids = blocks * threads; - for (var opt:Int=tid; opt < opt_N; opt+=tids) { - // Constants for Polynomial approximation of cumulative normal distribution - val A1 = 0.31938153f; - val A2 = -0.356563782f; - val A3 = 1.781477937f; - val A4 = -1.821255978f; - val A5 = 1.330274429f; - val RSQRT2PI = 0.39894228040143267793994605993438f; - - val T = optionYears(opt); - val S = stockPrice(opt); - val X = optionStrike(opt); - val sqrtT = Math.sqrt(T); - val d1 = (Math.log(S/X) + (R + 0.5f * V * V) * T) / (V * sqrtT); - val d2 = d1 - V * sqrtT; - - val K1 = 1.0f / (1.0f + 0.2316419f * Math.abs(d1)); - val K2 = 1.0f / (1.0f + 0.2316419f * Math.abs(d2)); - var CNDD1:Float = RSQRT2PI * Math.exp(- 0.5f * d1 * d1) * - (K1 * (A1 + K1 * (A2 + K1 * (A3 + K1 * (A4 + K1 * A5))))); - var CNDD2:Float = RSQRT2PI * Math.exp(- 0.5f * d2 * d2) * - (K2 * (A1 + K2 * (A2 + K2 * (A3 + K2 * (A4 + K2 * A5))))); - - if(d1 > 0) CNDD1 = 1.0f - CNDD1; - if(d2 > 0) CNDD2 = 1.0f - CNDD2; - - //Calculate Call and Put simultaneously - val expRT = Math.exp(- R * T); - callResult(opt) = S * CNDD1 - X * expRT * CNDD2; - putResult(opt) = X * expRT * (1.0f - CNDD2) - S * (1.0f - CNDD1); - } - } - } - } - } - - public static def main (args: Rail[String]!) { - - // Problem parameters - val OPT_N = 4000000; - val NUM_ITERATIONS = 512; - val RISKFREE = 0.02f; - val VOLATILITY = 0.30f; - - val gpu = here.child(0); - val cpu = here; - val rand = new Random(); - - // Host arrays - val h_CallResultCPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); - val h_PutResultCPU = Rail.make[Float](OPT_N, (Int)=>-1.0 as Float); - val h_CallResultGPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); - val h_PutResultGPU = Rail.make[Float](OPT_N, (Int)=>0.0 as Float); - val h_StockPrice = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); - val h_OptionStrike = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); - val h_OptionYears = Rail.make[Float](OPT_N, (Int)=>rand.nextFloat() as Float); - - // Device arrays - val d_CallResult = Rail.makeRemote(gpu, OPT_N, (Int)=>0.0 as Float); - val d_PutResult = Rail.makeRemote(gpu, OPT_N, (Int)=>0.0 as Float); - val d_StockPrice = Rail.makeRemote(gpu, OPT_N, h_StockPrice); - val d_OptionStrike = Rail.makeRemote(gpu, OPT_N, h_OptionStrike); - val d_OptionYears = Rail.makeRemote(gpu, OPT_N, h_OptionYears); - - val gpuTimeStart = System.nanoTime(); - for (var i:Int=0; i < NUM_ITERATIONS; i++) { - doBlackScholes(gpu, - d_OptionYears, - d_StockPrice, - d_OptionStrike, - d_CallResult, - d_PutResult, - OPT_N, - RISKFREE, - VOLATILITY); - } - var gpuTime:Float = System.nanoTime() - gpuTimeStart; - gpuTime /= (NUM_ITERATIONS as Float); - Console.OUT.println("Options count : " + 2 * OPT_N); - Console.OUT.println("BlackScholesGPU() time : " + gpuTime/(1.0e-6f) + " msec"); - Console.OUT.println("Effective memory bandwidth: " + (5 * OPT_N * 4) * 1.0e-9f / (gpuTime * 1.0E-9f) + " GB/s"); - Console.OUT.println("Gigaoptions per second : " + ((2 * OPT_N) * 1.0e-9f) / (gpuTime * 1.0e-9f)); - - // Read back GPU results - finish { - h_CallResultGPU.copyFrom(0, d_CallResult, 0, OPT_N); - h_PutResultGPU.copyFrom(0, d_PutResult, 0, OPT_N); - } - // Run BlackScholes on CPU to test results against - doBlackScholes(cpu, - h_OptionYears, - h_StockPrice, - h_OptionStrike, - h_CallResultCPU, - h_PutResultCPU, - OPT_N, - RISKFREE, - VOLATILITY); - // Check results - var sum_delta:Float = 0.0f; - var sum_ref:Float = 0.0f; - var max_delta:Float = 0.0f; - for (var i:Int=0; i < OPT_N; i++) { - val ref_val = h_CallResultCPU(i); - val delta = Math.abs(ref_val - h_CallResultGPU(i)); - if(delta > max_delta) max_delta = delta; - sum_delta += delta; - sum_ref += Math.abs(ref_val); - } - val L1norm = sum_delta / sum_ref; - Console.OUT.println("L1 norm: " + L1norm); - Console.OUT.println("Max absolute error: " + max_delta); - Console.OUT.println((L1norm < 1e-6f) ? "TEST PASSED" : "TEST FAILED"); - } -} Deleted: trunk/x10.dist/samples/CUDAKernelTest.x10 =================================================================== --- trunk/x10.dist/samples/CUDAKernelTest.x10 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.dist/samples/CUDAKernelTest.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -1,72 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -import x10.io.Console; -import x10.compiler.CUDA; - -public class CUDAKernelTest { - - static def doWork (init:Rail[Float]!, recv:Rail[Float]!, p:Place, len:Int) { - val remote = Rail.makeRemote(p,len,(Int)=>0.0 as Float); // allocate - - //finish init.copyTo(0, remote, 0, len); // dma there - val init_ = init as ValRail[Float]; - - finish async (p) @CUDA { - for ((block):Point in 0..7) { - for ((thread):Point in 0..63) async { - val tid = block*64 + thread; - val tids = 8*64; - for (var i:Int=tid ; i<len ; i+=tids) { - //remote(i) = Math.sqrt(remote(i)); - remote(i) = Math.sqrt(init_(i)); - } - } - } - } - - finish recv.copyFrom(0, remote, 0, len); // dma back - - // validate - var success:Boolean = true; - for ((i) in 0..remote.length-1) { - if (Math.abs(1 - (recv(i)*recv(i))/(i as Float)) > 1E-6f) { - Console.ERR.println("recv("+i+"): "+recv(i)+" * "+recv(i)+" = "+(recv(i)*recv(i))); - success = false; - } - } - Console.OUT.println((success?"SUCCESS":"FAIL")+" at "+p); - } - - public static def main (args : Rail[String]!) { - val len = args.length==1 ? Int.parse(args(0)) : 1000; - - for (host in Place.places) at (host) { - - val init = Rail.make[Float](len,(i:Int)=>i as Float); - val recv = Rail.make[Float](len,(i:Int)=>0.0 as Float); - - var done_work:Boolean = false; - - for (gpu in here.children()) if (gpu.isCUDA()) { - doWork(init, recv, gpu, len); - done_work = true; - } - - if (!done_work) { - doWork(init, recv, here, len); - } - } - } -} - -// vim: shiftwidth=4:tabstop=4:expandtab - Deleted: trunk/x10.dist/samples/CUDATopology.x10 =================================================================== --- trunk/x10.dist/samples/CUDATopology.x10 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.dist/samples/CUDATopology.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -1,43 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -import x10.io.Console; - -public class CUDATopology { - public static def main (args : Rail[String]) { - for (p in Place.places) { - at (p) { - Console.OUT.println("Dumping places at place: "+p); - for (p2 in Place.places) { - Console.OUT.println("Place: "+p2); - Console.OUT.println(" Parent: "+p2.parent()); - Console.OUT.println(" NumChildren: "+p2.numChildren()); - if (p2.isCUDA()) Console.OUT.println(" Is a CUDA place"); - if (p2.isHost()) Console.OUT.println(" Is a Host place"); - if (p2.isSPE()) Console.OUT.println(" Is a SPE place"); - val children = p2.children(); - for (c in children) { - Console.OUT.println(" Child "+c.childIndex()+": "+c); - Console.OUT.println(" Parent: "+c.parent()); - Console.OUT.println(" NumChildren: "+c.numChildren()); - if (c.isCUDA()) Console.OUT.println(" Is a CUDA place"); - if (c.isHost()) Console.OUT.println(" Is a Host place"); - if (c.isSPE()) Console.OUT.println(" Is a SPE place"); - } - } - Console.OUT.println(); - } - } - } -} - -// vim: shiftwidth=8:tabstop=8:expandtab - Deleted: trunk/x10.dist/samples/KMeansCUDA.x10 =================================================================== --- trunk/x10.dist/samples/KMeansCUDA.x10 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.dist/samples/KMeansCUDA.x10 2010-07-14 15:58:24 UTC (rev 14867) @@ -1,342 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -import x10.io.Console; - -import x10.io.File; -import x10.io.Marshal; -import x10.io.IOException; - -import x10.util.DistributedRail; -import x10.util.Pair; -import x10.util.HashMap; - -import x10.util.OptionsParser; -import x10.util.Option; - -import x10.compiler.Unroll; -import x10.compiler.CUDA; -import x10.compiler.CUDAUtilities; -import x10.compiler.Native; - - -/* -final class DistributedRail[T] implements Settable[Int,T], Iterable[T] { - global val data : PlaceLocalHandle[Rail[T]]; - global val firstPlace : Place; - global val localRails = PlaceLocalHandle.make[HashMap[Activity!, Rail[T]!]](Dist.makeUnique(), ()=>new HashMap[Activity!, Rail[T]!]()); - global val original : ValRail[T]; - global val original_len : Int; - - global val done = PlaceLocalHandle.make[Cell[Boolean]](Dist.makeUnique(), ()=>new Cell[Boolean](false)); - - public def this (len:Int, init:ValRail[T]) { - val vr = ValRail.make(len, init); - data = PlaceLocalHandle.make[Rail[T]](Dist.makeUnique(), ()=>Rail.make(len,vr)); - firstPlace = here; - original = vr; - original_len = len; - } - - public def this (len:Int, init:(Int)=>T) { - val vr = ValRail.make(len, init); - data = PlaceLocalHandle.make[Rail[T]](Dist.makeUnique(), ()=>Rail.make(len,vr)); - firstPlace = here; - original = vr; - original_len = len; - } - - public static safe operator[S] (x:DistributedRail[S]) = x() as ValRail[S]; - - public global safe def apply () { - val a = Runtime.activity(); - val r = localRails().getOrElse(a, null); - if (r==null) { - val r_ = Rail.make(original_len, original); - localRails().put(a, r_); - return r_; - } - return r; - } - - public global safe def get() = data(); - - public global safe def drop() { localRails().remove(Runtime.activity()); } - - public global safe def apply (i:Int) = this()(i); - - public global safe def set (v:T, i:Int) = this()(i) = v; - - public global safe def iterator () = this().iterator(); - - // TODO: remove this once collection API gets improved so that - // entries returns a Set[Map.Entry[K,V]!]! - private static global def placeCastHack[T](x:T) = x as T!; - - private global def reduceLocal (op:(T,T)=>T) { - val master = data(); - var first:Boolean = true; - for (e in localRails().entries()) { - val r = placeCastHack(e).getValue(); - if (first) { - finish r.copyTo(0, master, 0, r.length); - first = false; - } else { - for (var i:Int=0 ; i<master.length ; ++i) { - master(i) = op(master(i), r(i)); - } - } - } - } - - private global def reduceGlobal (op:(T,T)=>T) { - if (firstPlace!=here) { - val local_ = data(); - { - val local = local_ as ValRail[T]; - val data_ = data; - at (firstPlace) { - val master = data_(); - atomic for (var i:Int=0 ; i<master.length ; ++i) { - master(i) = op(master(i), local(i)); - } - } - } - //next; // every place has transmitted contents to master - val handle = data; // avoid 'this' being serialised - finish local_.copyFrom(0, firstPlace, ()=>Pair[Rail[T],Int](handle(),0), local_.length); - } else { - //next; - } - } - - private global def bcastLocal (op:(T,T)=>T) { - val master = data(); - for (e in localRails().entries()) { - val r = placeCastHack(e).getValue(); - finish r.copyFrom(0, master, 0, r.length); - } - } - - // op must be commutative - public global def collectiveReduce (op:(T,T)=>T) { - var i_won:Boolean = false; - atomic { - if (!done().value) { - i_won = true; - done().value = true; - } - } - //next; // activity rails populated at this place - if (i_won) { - // single thread per place mode - reduceLocal(op); - //next; // every place has local rail populated - reduceGlobal(op); // there's one 'next' in here too - bcastLocal(op); - done().value = false; - } else { - //next; - //next; - } - //next; // every place has finished reading from place 0 - } - -} -*/ - - -public class KMeansCUDA { - - public static def printClusters (clusters:Rail[Float]!, dims:Int) { - for (var d:Int=0 ; d<dims ; ++d) { - for (var k:Int=0 ; k<clusters.length/dims ; ++k) { - if (k>0) Console.OUT.print(" "); - Console.OUT.printf("%.2f",clusters(k*dims+d)); - } - Console.OUT.println(); - } - } - -/* - @Native("c++", "#4") - private static global def placePun[T](x:T) = x as T!; -*/ - - private static def round_up (x:UInt, n:UInt) = (x-1) - ((x-1)%n) + n; - - public static def main (args : Rail[String]!) { - try { - val opts = new OptionsParser(args, [ - Option("q","quiet","just print time taken"), - Option("v","verbose","print out each iteration") - ], [ - Option("p","points","location of data file"), - Option("i","iterations","quit after this many iterations"), - Option("c","clusters","number of clusters to find"), - Option("s","slices","factor by which to oversubscribe computational resources"), - Option("n","num","quantity of points")]); - // The casts can go on resolution of XTENLANG-1413 - val fname = opts("-p", "points.dat"), num_clusters=opts("-c",8) as UInt, - num_slices=opts("-s",4) as UInt, num_global_points=opts("-n", 100000) as UInt, - iterations=opts("-i",500) as UInt; - val verbose = opts("-v"), quiet = opts("-q"); - - val MEM_ALIGN = 32; // FOR CUDA - - if (!quiet) - Console.OUT.println("points: "+num_global_points+" clusters: "+num_clusters+" dim: "+4); - - // file is dimension-major - val file = new File(fname), fr = file.openRead(); - val init_points = (Int) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); - val num_file_points = file.size() / 4 / 4 as Int; - val file_points = ValRail.make(num_file_points*4, init_points); - - var results : Rail[Float]!; - - // clusters are dimension-major - val clusters = new DistributedRail[Float](num_clusters*4, file_points); - val cluster_counts = new DistributedRail[Int](num_clusters, (Int)=>0); - - finish async { - - // SPMD style for algorithm - val clk = Clock.make(); - - val num_slice_points = num_global_points / num_slices; - - for ((slice) in 0..num_slices-1) { - - for (h in Place.places) for (gpu in h.children()) async (h) clocked(clk) { - - // carve out local portion of points (point-major) - val num_local_points = num_slice_points / Place.NUM_ACCELS; - val offset = slice*num_slice_points + (gpu.id - Place.MAX_PLACES) * num_local_points; - if (!quiet) - Console.OUT.println(gpu+" gets "+offset+" len "+num_local_points); - val num_local_points_stride = round_up(num_local_points,MEM_ALIGN); - val init = (i:Int) => { - val d=i/num_local_points_stride, p=i%num_local_points_stride; - return p<num_local_points ? file_points(((p+offset)%num_file_points)*4 + d) : 0; - }; - - // these are pretty big so allocate up front - val host_points = Rail.make(num_local_points_stride*4 as Int, init); - val gpu_points = Rail.makeRemote(gpu, num_local_points_stride*4 as Int, host_points); - val host_nearest = Rail.make[Int](num_local_points as Int, (Int)=>0 as Int); - val gpu_nearest = Rail.makeRemote[Int](gpu, num_local_points as Int, (Int)=>0 as Int); - - //next; - - val start_time = System.currentTimeMillis(); - - main_loop: for (var iter:UInt=0 ; iter<iterations ; iter++) { - - val clusters_copy = clusters as ValRail[Float]; - - var k_start_time : Long = System.currentTimeMillis(); - // classify kernel - finish async (gpu) @CUDA { - val blocks = CUDAUtilities.autoBlocks(), - threads = CUDAUtilities.autoThreads(); - for ((block) in 0..blocks-1) { - val clustercache = Rail.make[Float](num_clusters*4, clusters_copy); - for ((thread) in 0..threads-1) async { - val tid = block * threads + thread; - val tids = blocks * threads; - for (var p:UInt=tid ; p<num_local_points ; p+=tids) { - var closest:Int = -1; - var closest_dist:Float = Float.MAX_VALUE; - @Unroll(20) for ((k) in 0..num_clusters-1) { - // Pythagoras (in d dimensions) - var dist : Float = 0; - for ((d) in 0..3) { - val tmp = gpu_points(p+d*num_local_points_stride) - - clustercache(k*4+d); - dist += tmp * tmp; - } - // record closest cluster seen so far - if (dist < closest_dist) { - closest_dist = dist; - closest = k; - } - } - gpu_nearest(p) = closest; - } - } - } - } - Console.OUT.println("kernel: "+(System.currentTimeMillis() - k_start_time)); - - // bring gpu results onto host - k_start_time = System.currentTimeMillis(); - finish host_nearest.copyFrom(0, gpu_nearest, 0, num_local_points as Int); - Console.OUT.println("dma: "+(System.currentTimeMillis() - k_start_time)); - - // compute new clusters - - // hoist from loop for performance reasons - val host_clusters = clusters(); - val host_cluster_counts = cluster_counts(); - - host_clusters.reset(0); - host_cluster_counts.reset(0); - - k_start_time = System.currentTimeMillis(); - for (var p:UInt=0 ; p<num_local_points ; p++) { - val closest = host_nearest(p); - for (var d:UInt=0 ; d<4u ; ++d) - host_clusters(closest*4+d) += host_points(p+d*num_local_points_stride); - host_cluster_counts(closest)++; - } - Console.OUT.println("reaverage: "+(System.currentTimeMillis() - k_start_time)); - - clusters.collectiveReduce(Float.+); - cluster_counts.collectiveReduce(Int.+); - - for (var k:UInt=0 ; k<num_clusters ; ++k) { - for (var d:UInt=0 ; d<4u ; ++d) host_clusters(k*4u+d) /= host_cluster_counts(k); - } - - if (offset==0u && verbose) { - Console.OUT.println("Iteration: "+iter); - printClusters(clusters() as Rail[Float]!,4u); - } - - // TEST FOR CONVERGENCE - for (var j:UInt=0 ; j<num_clusters*4 ; ++j) { - if (true/*||Math.abs(clusters_copy(j)-clusters(j))>0.0001*/) continue main_loop; - } - - break; - - } // main_loop - - if (offset==0u) { - val stop_time = System.currentTimeMillis(); - if (!quiet) Console.OUT.print(num_global_points+" "+num_clusters+" 4 "); - Console.OUT.println((stop_time-start_time)/1E3); - } - - } // gpus - - } // slice - - } // finish - - } catch (e : Throwable) { - e.printStackTrace(Console.ERR); - } - } -} - -// vim: shiftwidth=4:tabstop=4:expandtab Modified: trunk/x10.tests/bin/xtestScriptCT++ =================================================================== --- trunk/x10.tests/bin/xtestScriptCT++ 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.tests/bin/xtestScriptCT++ 2010-07-14 15:58:24 UTC (rev 14867) @@ -687,7 +687,7 @@ __cat_test_x10c_sourcepath="$tcroot" __cat_test_x10c_classpath="${EXTRA_CLASSPATH}" __cat_test_x10c_directory="$testDir" - comp_cmd="${X10CPP} $extra_opts $X10CPP_EXTRA_OPTS -t -v -report postcompile=1 -MAIN_CLASS=$tctarget -sourcepath $tcroot -sourcepath $X10_HOME/x10.dist/samples -sourcepath $X10_HOME/x10.dist/samples/tutorial -d $tcroot $tc $extendList ${X10TEST_PATH}/x10lib/harness/x10Test.x10" + comp_cmd="${X10CPP} $extra_opts $X10CPP_EXTRA_OPTS -t -v -report postcompile=1 -MAIN_CLASS=$tctarget -sourcepath $tcroot -sourcepath $X10_HOME/x10.dist/samples -sourcepath $X10_HOME/x10.dist/samples/tutorial -sourcepath $X10_HOME/x10.dist/samples/CUDA -d $tcroot $tc $extendList ${X10TEST_PATH}/x10lib/harness/x10Test.x10" tccompdat=${tcroot}/${tctarget}.comp printf "\n****** $tDir $className ******\n\n" >> $tccompdat Modified: trunk/x10.tests/bin/xtestScriptCT0 =================================================================== --- trunk/x10.tests/bin/xtestScriptCT0 2010-07-14 14:42:00 UTC (rev 14866) +++ trunk/x10.tests/bin/xtestScriptCT0 2010-07-14 15:58:24 UTC (rev 14867) @@ -814,8 +814,8 @@ __cat_test_x10c_sourcepath="$x10lib:$testDir" __cat_test_x10c_classpath="$extraClassPath" __cat_test_x10c_directory="$testDir" - __cat_test_x10c_command="$(echo runWithTimeLimit "$tdir" "$className" "\"$X10DIST\"/bin/x10c -t -v -sourcepath $x10lib -sourcepath $testDir -sourcepath \"$X10_DIST\"/samples -sourcepath \"$X10_DIST\"/samples/tutorial -classpath \"$extraClassPath\" $classpath -d $testDir $X10C_EXTRA_OPTS $options $x10FileName $dependList $extendList ./x10lib/harness/x10Test.x10" "" "")" - runWithTimeLimit "$tdir" "$className" "\"$X10DIST\"/bin/x10c -t -v -sourcepath $x10lib -sourcepath $testDir -sourcepath \"$X10DIST\"/samples -sourcepath \"$X10DIST\"/samples/tutorial -classpath \"$extraClassPath\" $classpath -d $testDir $X10C_EXTRA_OPTS $options $x10FileName $dependList $extendList ./x10lib/harness/x10Test.x10" "" "" + __cat_test_x10c_command="$(echo runWithTimeLimit "$tdir" "$className" "\"$X10DIST\"/bin/x10c -t -v -sourcepath $x10lib -sourcepath $testDir -sourcepath \"$X10_DIST\"/samples -sourcepath \"$X10_DIST\"/samples/tutorial -sourcepath \"$X10_DIST\"/samples/CUDA -classpath \"$extraClassPath\" $classpath -d $testDir $X10C_EXTRA_OPTS $options $x10FileName $dependList $extendList ./x10lib/harness/x10Test.x10" "" "")" + runWithTimeLimit "$tdir" "$className" "\"$X10DIST\"/bin/x10c -t -v -sourcepath $x10lib -sourcepath $testDir -sourcepath \"$X10DIST\"/samples -sourcepath \"$X10DIST\"/samples/tutorial -sourcepath \"$X10_DIST\"/samples/CUDA -classpath \"$extraClassPath\" $classpath -d $testDir $X10C_EXTRA_OPTS $options $x10FileName $dependList $extendList ./x10lib/harness/x10Test.x10" "" "" local runRC=$? if [[ $runRC != 0 ]]; then echo "" >> logDetail.$tdir.$className This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-07-14 21:19:09
|
Revision: 14884 http://x10.svn.sourceforge.net/x10/?rev=14884&view=rev Author: dgrove-oss Date: 2010-07-14 21:19:03 +0000 (Wed, 14 Jul 2010) Log Message: ----------- XTENLANG-1054 : Make Dist.toString print the place/region relationship in the same order as it appears in X10 source code. Modified Paths: -------------- trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 trunk/x10.tests/examples/Constructs/Distribution/PolyConst1.x10 Modified: trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 2010-07-14 20:45:56 UTC (rev 14883) +++ trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 2010-07-14 21:19:03 UTC (rev 14884) @@ -373,7 +373,7 @@ var first: boolean = true; for (p:Place in places) { if (!first) s += ","; - s += p.id + "->" + get(p); + s += get(p) + "->" + p.id; first = false; } s += ")"; Modified: trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 2010-07-14 20:45:56 UTC (rev 14883) +++ trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 2010-07-14 21:19:03 UTC (rev 14884) @@ -47,7 +47,7 @@ } def expected() = - "--- dist: Dist(0->[0..2],1->[3..5],2->[6..7],3->[8..9])\n" + + "--- dist: Dist([0..2]->0,[3..5]->1,[6..7]->2,[8..9]->3)\n" + "0 0 0 1 1 1 2 2 3 3 \n" + "--- original\n" + "0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 \n" + Modified: trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 2010-07-14 20:45:56 UTC (rev 14883) +++ trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 2010-07-14 21:19:03 UTC (rev 14884) @@ -52,7 +52,7 @@ } def expected() = - "--- dist: Dist(0->[0..2],1->[3..5],2->[6..7],3->[8..9])\n" + + "--- dist: Dist([0..2]->0,[3..5]->1,[6..7]->2,[8..9]->3)\n" + "0 0 0 1 1 1 2 2 3 3 \n" + "--- original\n" + "0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 \n" + Modified: trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 2010-07-14 20:45:56 UTC (rev 14883) +++ trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 2010-07-14 21:19:03 UTC (rev 14884) @@ -30,12 +30,12 @@ def expected() = "r [1..4,1..7]\n"+ - "--- block 0: Dist(0->[1..1,1..7],1->[2..2,1..7],2->[3..3,1..7],3->[4..4,1..7])\n"+ + "--- block 0: Dist([1..1,1..7]->0,[2..2,1..7]->1,[3..3,1..7]->2,[4..4,1..7]->3)\n"+ " 1 . 0 0 0 0 0 0 0 . . \n"+ " 2 . 1 1 1 1 1 1 1 . . \n"+ " 3 . 2 2 2 2 2 2 2 . . \n"+ " 4 . 3 3 3 3 3 3 3 . . \n"+ - "--- block 1: Dist(0->[1..4,1..2],1->[1..4,3..4],2->[1..4,5..6],3->[1..4,7..7])\n"+ + "--- block 1: Dist([1..4,1..2]->0,[1..4,3..4]->1,[1..4,5..6]->2,[1..4,7..7]->3)\n"+ " 1 . 0 0 1 1 2 2 3 . . \n"+ " 2 . 0 0 1 1 2 2 3 . . \n"+ " 3 . 0 0 1 1 2 2 3 . . \n"+ Modified: trunk/x10.tests/examples/Constructs/Distribution/PolyConst1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Distribution/PolyConst1.x10 2010-07-14 20:45:56 UTC (rev 14883) +++ trunk/x10.tests/examples/Constructs/Distribution/PolyConst1.x10 2010-07-14 21:19:03 UTC (rev 14884) @@ -38,9 +38,9 @@ def expected() = "r [0..9,0..9]\n"+ - "d Dist(0->[0..9,0..9])\n"+ - "a Array(Dist(0->[0..9,0..9]))\n"+ - "b Array(Dist(0->[0..9,0..9]))\n"; + "d Dist([0..9,0..9]->0)\n"+ + "a Array(Dist([0..9,0..9]->0))\n"+ + "b Array(Dist([0..9,0..9]->0))\n"; public static def main(Rail[String]) { new PolyConst1().execute(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-07-16 14:46:43
|
Revision: 14938 http://x10.svn.sourceforge.net/x10/?rev=14938&view=rev Author: tardieu Date: 2010-07-16 14:46:37 +0000 (Fri, 16 Jul 2010) Log Message: ----------- The @Uninitialized annotation on a var field instructs the frontend not to implicitely initialize this field in constructors to the type default value. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Uninitialized.x10 Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-07-16 14:20:35 UTC (rev 14937) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-07-16 14:46:37 UTC (rev 14938) @@ -410,8 +410,10 @@ X10FieldDecl_c n = (X10FieldDecl_c) this.type(nf.CanonicalTypeNode(type().position(), type)); - // Add an initializer to uninitialized var fields. - if (! n.flags().flags().isFinal() && n.init() == null) { + // Add an initializer to uninitialized var field unless field is annotated @Uninitialized. + Type at = (Type) ts.systemResolver().find(QName.make("x10.compiler.Uninitialized")); + + if (! n.flags().flags().isFinal() && n.init() == null && ((X10FieldDef) n.fieldDef()).annotationsMatching(at).isEmpty()) { Type t = n.type().type(); Expr e = null; if (t.isBoolean()) { Added: trunk/x10.runtime/src-x10/x10/compiler/Uninitialized.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/Uninitialized.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/Uninitialized.x10 2010-07-16 14:46:37 UTC (rev 14938) @@ -0,0 +1,20 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.FieldAnnotation; + +/** + * The @Uninitialized annotation on a var field instructs the frontend not to implicitely + * initialize this field in constructors to the type default value. + */ +public interface Uninitialized extends FieldAnnotation { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-07-16 15:16:21
|
Revision: 14943 http://x10.svn.sourceforge.net/x10/?rev=14943&view=rev Author: tardieu Date: 2010-07-16 15:16:10 +0000 (Fri, 16 Jul 2010) Log Message: ----------- moved super constructor call synthesis from parser to FieldInitializerMover frontend visitor added @NoSuperCall annotation to instruct frontend not to insert super(...) in a given constructor Modified Paths: -------------- trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/visit/FieldInitializerMover.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/NoSuperCall.x10 Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-16 15:06:06 UTC (rev 14942) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-16 15:16:10 UTC (rev 14943) @@ -13,7 +13,7 @@ import lpg.runtime.*; -//#line 32 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" +//#line 32 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; @@ -293,7 +293,7 @@ // - //#line 326 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 326 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" private ErrorQueue eq; private X10TypeSystem ts; private X10NodeFactory nf; @@ -895,10 +895,10 @@ // Rule 1: TypeName ::= TypeName . ErrorId // case 1: { - //#line 8 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 6 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 8 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 6 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName TypeName = (ParsedName) getRhsSym(1); - //#line 8 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 8 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -911,10 +911,10 @@ // Rule 2: PackageName ::= PackageName . ErrorId // case 2: { - //#line 18 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 16 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 18 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 16 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageName = (ParsedName) getRhsSym(1); - //#line 18 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 18 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -927,10 +927,10 @@ // Rule 3: ExpressionName ::= AmbiguousName . ErrorId // case 3: { - //#line 28 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 26 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 28 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 26 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 28 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 28 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -943,10 +943,10 @@ // Rule 4: MethodName ::= AmbiguousName . ErrorId // case 4: { - //#line 38 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 36 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 38 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 36 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 38 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 38 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -959,10 +959,10 @@ // Rule 5: PackageOrTypeName ::= PackageOrTypeName . ErrorId // case 5: { - //#line 48 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 46 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 48 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 46 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageOrTypeName = (ParsedName) getRhsSym(1); - //#line 48 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 48 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -975,10 +975,10 @@ // Rule 6: AmbiguousName ::= AmbiguousName . ErrorId // case 6: { - //#line 58 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 56 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 58 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 56 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 58 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 58 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -991,10 +991,10 @@ // Rule 7: FieldAccess ::= Primary . ErrorId // case 7: { - //#line 68 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 66 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 68 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 66 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); - //#line 68 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 68 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(), Primary, nf.Id(pos(getRightSpan()), "*"))); break; @@ -1004,9 +1004,9 @@ // Rule 8: FieldAccess ::= super . ErrorId // case 8: { - //#line 74 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 74 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 74 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 74 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getLeftSpan())), nf.Id(pos(getRightSpan()), "*"))); break; @@ -1016,12 +1016,12 @@ // Rule 9: FieldAccess ::= ClassName . super$sup . ErrorId // case 9: { - //#line 80 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 78 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 80 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 78 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); - //#line 78 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 78 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); - //#line 80 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 80 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getRhsFirstTokenIndex(3)), ClassName.toType()), nf.Id(pos(getRightSpan()), "*"))); break; @@ -1031,12 +1031,12 @@ // Rule 10: MethodInvocation ::= MethodPrimaryPrefix ( ArgumentListopt ) // case 10: { - //#line 87 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 85 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 87 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 85 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" Object MethodPrimaryPrefix = (Object) getRhsSym(1); - //#line 85 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 85 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 87 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 87 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" Expr Primary = (Expr) ((Object[]) MethodPrimaryPrefix)[0]; polyglot.lex.Identifier identifier = (polyglot.lex.Identifier) ((Object[]) MethodPrimaryPrefix)[1]; setResult(nf.Call(pos(), Primary, nf.Id(pos(), identifier.getIdentifier()), ArgumentListopt)); @@ -1047,12 +1047,12 @@ // Rule 11: MethodInvocation ::= MethodSuperPrefix ( ArgumentListopt ) // case 11: { - //#line 94 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 92 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 94 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 92 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" polyglot.lex.Identifier MethodSuperPrefix = (polyglot.lex.Identifier) getRhsSym(1); - //#line 92 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 92 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 94 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 94 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" polyglot.lex.Identifier identifier = MethodSuperPrefix; setResult(nf.Call(pos(), nf.Super(pos(getLeftSpan())), nf.Id(pos(), identifier.getIdentifier()), ArgumentListopt)); break; @@ -1062,12 +1062,12 @@ // Rule 12: MethodInvocation ::= MethodClassNameSuperPrefix ( ArgumentListopt ) // case 12: { - //#line 100 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 98 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 100 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 98 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" Object MethodClassNameSuperPrefix = (Object) getRhsSym(1); - //#line 98 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 98 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 100 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 100 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" ParsedName ClassName = (ParsedName) ((Object[]) MethodClassNameSuperPrefix)[0]; JPGPosition super_pos = (JPGPosition) ((Object[]) MethodClassNameSuperPrefix)[1]; polyglot.lex.Identifier identifier = (polyglot.lex.Identifier) ((Object[]) MethodClassNameSuperPrefix)[2]; @@ -1079,12 +1079,12 @@ // Rule 13: MethodPrimaryPrefix ::= Primary . ErrorId$ErrorId // case 13: { - //#line 109 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 107 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 109 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 107 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); - //#line 107 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 107 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(3); - //#line 109 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 109 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[2]; a[0] = Primary; a[1] = id(getRhsFirstTokenIndex(3)); @@ -1096,10 +1096,10 @@ // Rule 14: MethodSuperPrefix ::= super . ErrorId$ErrorId // case 14: { - //#line 117 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 115 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 117 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 115 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(3); - //#line 117 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 117 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(id(getRhsFirstTokenIndex(3))); break; } @@ -1108,14 +1108,14 @@ // Rule 15: MethodClassNameSuperPrefix ::= ClassName . super$sup . ErrorId$ErrorId // case 15: { - //#line 122 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 120 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 122 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); - //#line 120 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); - //#line 120 "C:/eclipsews/head5/x10.compiler/src/x10/parser/MissingId.gi" + //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(5); - //#line 122 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 122 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[3]; a[0] = ClassName; a[1] = pos(getRhsFirstTokenIndex(3)); @@ -1128,20 +1128,20 @@ // Rule 16: TypeDefDeclaration ::= TypeDefModifiersopt type Identifier TypeParametersopt FormalParametersopt WhereClauseopt = Type ; // case 16: { - //#line 923 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 923 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeDefModifiersopt = (List) getRhsSym(1); - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List FormalParametersopt = (List) getRhsSym(5); - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 921 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(8); - //#line 923 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 923 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" FlagsNode f = extractFlags(TypeDefModifiersopt); List annotations = extractAnnotations(TypeDefModifiersopt); for (Formal v : (List<Formal>) FormalParametersopt) { @@ -1157,10 +1157,10 @@ // Rule 17: Properties ::= ( PropertyList ) // case 17: { - //#line 936 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 934 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 936 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 934 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List PropertyList = (List) getRhsSym(2); - //#line 936 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 936 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" setResult(PropertyList); break; } @@ -1168,10 +1168,10 @@ // Rule 18: PropertyList ::= Property // case 18: { - //#line 941 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 939 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 941 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 939 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" PropertyDecl Property = (PropertyDecl) getRhsSym(1); - //#line 941 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 941 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), PropertyDecl.class, false); l.add(Property); setResult(l); @@ -1182,12 +1182,12 @@ // Rule 19: PropertyList ::= PropertyList , Property // case 19: { - //#line 948 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 946 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 948 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 946 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List PropertyList = (List) getRhsSym(1); - //#line 946 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 946 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" PropertyDecl Property = (PropertyDecl) getRhsSym(3); - //#line 948 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 948 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" PropertyList.add(Property); break; } @@ -1196,14 +1196,14 @@ // Rule 20: Property ::= Annotationsopt Identifier ResultType // case 20: { - //#line 955 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 953 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 955 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Annotationsopt = (List) getRhsSym(1); - //#line 953 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(2); - //#line 953 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode ResultType = (TypeNode) getRhsSym(3); - //#line 955 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 955 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" List annotations = extractAnnotations(Annotationsopt); PropertyDecl cd = nf.PropertyDecl(pos(), nf.FlagsNode(pos(), Flags.PUBLIC.Final()), ResultType, Identifier); cd = (PropertyDecl) ((X10Ext) cd.ext()).annotations(annotations); @@ -1215,26 +1215,26 @@ // Rule 21: MethodDeclaration ::= MethodModifiersopt def Identifier TypeParametersopt FormalParameters WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 21: { - //#line 964 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 964 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 962 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 964 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 964 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" ProcedureDecl pd; if (Identifier.id().toString().equals("this")) { pd = nf.X10ConstructorDecl(pos(), @@ -1270,28 +1270,28 @@ // Rule 22: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) BinOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 22: { - //#line 996 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 996 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(7); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(9); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(11); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(12); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(13); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(14); - //#line 994 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(15); - //#line 996 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 996 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1313,26 +1313,26 @@ // Rule 23: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt PrefixOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 23: { - //#line 1014 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1014 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Unary.Operator PrefixOp = (Unary.Operator) getRhsSym(4); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(6); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(8); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(9); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(10); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(11); - //#line 1012 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(12); - //#line 1014 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1014 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1354,26 +1354,26 @@ // Rule 24: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt this BinOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 24: { - //#line 1032 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1032 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(5); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(7); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1030 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1032 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1032 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1396,26 +1396,26 @@ // Rule 25: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) BinOp this WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 25: { - //#line 1051 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1051 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(7); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1049 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1051 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1051 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" Name op = X10Binary_c.invBinaryMethodName(BinOp); MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), @@ -1439,24 +1439,24 @@ // Rule 26: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt PrefixOp this WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 26: { - //#line 1071 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1071 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Unary.Operator PrefixOp = (Unary.Operator) getRhsSym(4); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 1069 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 1071 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1071 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1478,24 +1478,24 @@ // Rule 27: MethodDeclaration ::= MethodModifiersopt operator this TypeParametersopt FormalParameters WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 27: { - //#line 1089 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1089 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 1087 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 1089 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1089 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1517,26 +1517,26 @@ // Rule 28: MethodDeclaration ::= MethodModifiersopt operator this TypeParametersopt FormalParameters = ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 28: { - //#line 1107 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1107 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(8); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(10); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(11); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(12); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(13); - //#line 1105 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(14); - //#line 1107 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1107 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1558,24 +1558,24 @@ // Rule 29: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) as Type WhereClauseopt Throwsopt Offersopt MethodBody // case 29: { - //#line 1125 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1125 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(8); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(10); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(11); - //#line 1123 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(12); - //#line 1125 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1125 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), Type, @@ -1597,24 +1597,24 @@ // Rule 30: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) as ? WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 30: { - //#line 1143 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1143 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1141 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1143 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1143 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1636,24 +1636,24 @@ // Rule 31: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 31: { - //#line 1161 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1161 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(7); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(8); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(9); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(10); - //#line 1159 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(11); - //#line 1161 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1161 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1675,22 +1675,22 @@ // Rule 32: PropertyMethodDeclaration ::= MethodModifiersopt property Identifier TypeParametersopt FormalParameters WhereClauseopt HasResultTypeopt MethodBody // case 32: { - //#line 1180 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1180 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1178 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1178 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(8); - //#line 1180 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1180 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt, X10Flags.PROPERTY), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1710,18 +1710,18 @@ // Rule 33: PropertyMethodDeclaration ::= MethodModifiersopt property Identifier WhereClauseopt HasResultTypeopt MethodBody // case 33: { - //#line 1196 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1194 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1196 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1194 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1194 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1194 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 1194 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1194 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(4); - //#line 1194 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1194 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(5); - //#line 1194 "C:/eclipsews/head5/x10.compiler/src/x10/parser/x10.g" + //#line 1194 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(6); - //#line 1196 "C:/eclipsews/head5/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1196 "/Users/tardieu/workspace/lpg.gene... [truncated message content] |
From: <pgc...@us...> - 2010-07-18 00:19:45
|
Revision: 14975 http://x10.svn.sourceforge.net/x10/?rev=14975&view=rev Author: pgcharles Date: 2010-07-18 00:19:37 +0000 (Sun, 18 Jul 2010) Log Message: ----------- Move Cast Expressions to the same precedence levels as PostfixExpressions in the grammar (x10.g). Fix the X10 runtime and the x10 tests accordingly. Modified Paths: -------------- trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/GCSpheres.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/StructSpheres.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 trunk/x10.runtime/src-x10/x10/io/Marshal.x10 trunk/x10.runtime/src-x10/x10/lang/Rail__NativeRep.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.tests/examples/Benchmarks/DistRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-16 22:33:39 UTC (rev 14974) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-18 00:19:37 UTC (rev 14975) @@ -13,7 +13,7 @@ import lpg.runtime.*; -//#line 32 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" +//#line 32 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; @@ -293,7 +293,7 @@ // - //#line 326 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 326 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" private ErrorQueue eq; private X10TypeSystem ts; private X10NodeFactory nf; @@ -895,10 +895,10 @@ // Rule 1: TypeName ::= TypeName . ErrorId // case 1: { - //#line 8 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 6 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 8 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 6 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName TypeName = (ParsedName) getRhsSym(1); - //#line 8 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 8 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -911,10 +911,10 @@ // Rule 2: PackageName ::= PackageName . ErrorId // case 2: { - //#line 18 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 16 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 18 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 16 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageName = (ParsedName) getRhsSym(1); - //#line 18 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 18 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -927,10 +927,10 @@ // Rule 3: ExpressionName ::= AmbiguousName . ErrorId // case 3: { - //#line 28 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 26 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 28 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 26 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 28 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 28 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -943,10 +943,10 @@ // Rule 4: MethodName ::= AmbiguousName . ErrorId // case 4: { - //#line 38 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 36 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 38 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 36 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 38 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 38 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -959,10 +959,10 @@ // Rule 5: PackageOrTypeName ::= PackageOrTypeName . ErrorId // case 5: { - //#line 48 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 46 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 48 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 46 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageOrTypeName = (ParsedName) getRhsSym(1); - //#line 48 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 48 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -975,10 +975,10 @@ // Rule 6: AmbiguousName ::= AmbiguousName . ErrorId // case 6: { - //#line 58 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 56 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 58 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 56 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 58 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 58 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -991,10 +991,10 @@ // Rule 7: FieldAccess ::= Primary . ErrorId // case 7: { - //#line 68 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 66 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 68 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 66 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); - //#line 68 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 68 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(), Primary, nf.Id(pos(getRightSpan()), "*"))); break; @@ -1004,9 +1004,9 @@ // Rule 8: FieldAccess ::= super . ErrorId // case 8: { - //#line 74 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 74 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 74 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 74 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getLeftSpan())), nf.Id(pos(getRightSpan()), "*"))); break; @@ -1016,12 +1016,12 @@ // Rule 9: FieldAccess ::= ClassName . super$sup . ErrorId // case 9: { - //#line 80 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 78 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 80 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 78 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); - //#line 78 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 78 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); - //#line 80 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 80 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getRhsFirstTokenIndex(3)), ClassName.toType()), nf.Id(pos(getRightSpan()), "*"))); break; @@ -1031,12 +1031,12 @@ // Rule 10: MethodInvocation ::= MethodPrimaryPrefix ( ArgumentListopt ) // case 10: { - //#line 87 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 85 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 87 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 85 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" Object MethodPrimaryPrefix = (Object) getRhsSym(1); - //#line 85 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 85 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 87 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 87 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" Expr Primary = (Expr) ((Object[]) MethodPrimaryPrefix)[0]; polyglot.lex.Identifier identifier = (polyglot.lex.Identifier) ((Object[]) MethodPrimaryPrefix)[1]; setResult(nf.Call(pos(), Primary, nf.Id(pos(), identifier.getIdentifier()), ArgumentListopt)); @@ -1047,12 +1047,12 @@ // Rule 11: MethodInvocation ::= MethodSuperPrefix ( ArgumentListopt ) // case 11: { - //#line 94 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 92 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 94 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 92 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" polyglot.lex.Identifier MethodSuperPrefix = (polyglot.lex.Identifier) getRhsSym(1); - //#line 92 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 92 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 94 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 94 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" polyglot.lex.Identifier identifier = MethodSuperPrefix; setResult(nf.Call(pos(), nf.Super(pos(getLeftSpan())), nf.Id(pos(), identifier.getIdentifier()), ArgumentListopt)); break; @@ -1062,12 +1062,12 @@ // Rule 12: MethodInvocation ::= MethodClassNameSuperPrefix ( ArgumentListopt ) // case 12: { - //#line 100 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 98 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 100 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 98 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" Object MethodClassNameSuperPrefix = (Object) getRhsSym(1); - //#line 98 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 98 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" List ArgumentListopt = (List) getRhsSym(3); - //#line 100 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 100 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" ParsedName ClassName = (ParsedName) ((Object[]) MethodClassNameSuperPrefix)[0]; JPGPosition super_pos = (JPGPosition) ((Object[]) MethodClassNameSuperPrefix)[1]; polyglot.lex.Identifier identifier = (polyglot.lex.Identifier) ((Object[]) MethodClassNameSuperPrefix)[2]; @@ -1079,12 +1079,12 @@ // Rule 13: MethodPrimaryPrefix ::= Primary . ErrorId$ErrorId // case 13: { - //#line 109 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 107 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 109 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 107 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); - //#line 107 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 107 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(3); - //#line 109 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 109 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[2]; a[0] = Primary; a[1] = id(getRhsFirstTokenIndex(3)); @@ -1096,10 +1096,10 @@ // Rule 14: MethodSuperPrefix ::= super . ErrorId$ErrorId // case 14: { - //#line 117 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 115 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 117 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 115 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(3); - //#line 117 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 117 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(id(getRhsFirstTokenIndex(3))); break; } @@ -1108,14 +1108,14 @@ // Rule 15: MethodClassNameSuperPrefix ::= ClassName . super$sup . ErrorId$ErrorId // case 15: { - //#line 122 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 122 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 120 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); - //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 120 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); - //#line 120 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/MissingId.gi" + //#line 120 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/MissingId.gi" IToken ErrorId = (IToken) getRhsIToken(5); - //#line 122 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 122 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[3]; a[0] = ClassName; a[1] = pos(getRhsFirstTokenIndex(3)); @@ -1128,20 +1128,20 @@ // Rule 16: TypeDefDeclaration ::= TypeDefModifiersopt type Identifier TypeParametersopt FormalParametersopt WhereClauseopt = Type ; // case 16: { - //#line 923 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 923 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeDefModifiersopt = (List) getRhsSym(1); - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List FormalParametersopt = (List) getRhsSym(5); - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 921 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 921 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(8); - //#line 923 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 923 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" FlagsNode f = extractFlags(TypeDefModifiersopt); List annotations = extractAnnotations(TypeDefModifiersopt); for (Formal v : (List<Formal>) FormalParametersopt) { @@ -1157,10 +1157,10 @@ // Rule 17: Properties ::= ( PropertyList ) // case 17: { - //#line 936 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 934 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 936 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 934 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List PropertyList = (List) getRhsSym(2); - //#line 936 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 936 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" setResult(PropertyList); break; } @@ -1168,10 +1168,10 @@ // Rule 18: PropertyList ::= Property // case 18: { - //#line 941 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 939 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 941 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 939 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" PropertyDecl Property = (PropertyDecl) getRhsSym(1); - //#line 941 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 941 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), PropertyDecl.class, false); l.add(Property); setResult(l); @@ -1182,12 +1182,12 @@ // Rule 19: PropertyList ::= PropertyList , Property // case 19: { - //#line 948 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 946 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 948 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 946 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List PropertyList = (List) getRhsSym(1); - //#line 946 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 946 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" PropertyDecl Property = (PropertyDecl) getRhsSym(3); - //#line 948 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 948 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" PropertyList.add(Property); break; } @@ -1196,14 +1196,14 @@ // Rule 20: Property ::= Annotationsopt Identifier ResultType // case 20: { - //#line 955 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 955 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 953 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Annotationsopt = (List) getRhsSym(1); - //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 953 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(2); - //#line 953 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 953 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode ResultType = (TypeNode) getRhsSym(3); - //#line 955 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 955 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" List annotations = extractAnnotations(Annotationsopt); PropertyDecl cd = nf.PropertyDecl(pos(), nf.FlagsNode(pos(), Flags.PUBLIC.Final()), ResultType, Identifier); cd = (PropertyDecl) ((X10Ext) cd.ext()).annotations(annotations); @@ -1215,26 +1215,26 @@ // Rule 21: MethodDeclaration ::= MethodModifiersopt def Identifier TypeParametersopt FormalParameters WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 21: { - //#line 964 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 964 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 962 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 962 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 964 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 964 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" ProcedureDecl pd; if (Identifier.id().toString().equals("this")) { pd = nf.X10ConstructorDecl(pos(), @@ -1270,28 +1270,28 @@ // Rule 22: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) BinOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 22: { - //#line 996 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 996 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(7); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(9); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(11); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(12); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(13); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(14); - //#line 994 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 994 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(15); - //#line 996 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 996 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1313,26 +1313,26 @@ // Rule 23: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt PrefixOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 23: { - //#line 1014 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1014 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Unary.Operator PrefixOp = (Unary.Operator) getRhsSym(4); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(6); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(8); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(9); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(10); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(11); - //#line 1012 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1012 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(12); - //#line 1014 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1014 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1354,26 +1354,26 @@ // Rule 24: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt this BinOp ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 24: { - //#line 1032 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1032 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(5); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(7); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1030 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1030 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1032 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1032 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1396,26 +1396,26 @@ // Rule 25: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) BinOp this WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 25: { - //#line 1051 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1051 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Binary.Operator BinOp = (Binary.Operator) getRhsSym(7); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1049 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1049 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1051 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1051 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" Name op = X10Binary_c.invBinaryMethodName(BinOp); MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), @@ -1439,24 +1439,24 @@ // Rule 26: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt PrefixOp this WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 26: { - //#line 1071 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1071 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Unary.Operator PrefixOp = (Unary.Operator) getRhsSym(4); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 1069 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1069 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 1071 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1071 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1478,24 +1478,24 @@ // Rule 27: MethodDeclaration ::= MethodModifiersopt operator this TypeParametersopt FormalParameters WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 27: { - //#line 1089 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1089 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(9); - //#line 1087 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1087 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(10); - //#line 1089 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1089 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1517,26 +1517,26 @@ // Rule 28: MethodDeclaration ::= MethodModifiersopt operator this TypeParametersopt FormalParameters = ( FormalParameter$fp2 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 28: { - //#line 1107 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1107 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp2 = (X10Formal) getRhsSym(8); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(10); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(11); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(12); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(13); - //#line 1105 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1105 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(14); - //#line 1107 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1107 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1558,24 +1558,24 @@ // Rule 29: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) as Type WhereClauseopt Throwsopt Offersopt MethodBody // case 29: { - //#line 1125 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1125 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(8); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(10); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(11); - //#line 1123 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1123 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(12); - //#line 1125 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1125 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), Type, @@ -1597,24 +1597,24 @@ // Rule 30: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) as ? WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 30: { - //#line 1143 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1143 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(9); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode HasResultTypeopt = (TypeNode) getRhsSym(10); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(11); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" TypeNode Offersopt = (TypeNode) getRhsSym(12); - //#line 1141 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1141 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" Block MethodBody = (Block) getRhsSym(13); - //#line 1143 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1143 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" MethodDecl md = nf.X10MethodDecl(pos(), extractFlags(MethodModifiersopt), HasResultTypeopt == null ? nf.UnknownTypeNode(pos()) : HasResultTypeopt, @@ -1636,24 +1636,24 @@ // Rule 31: MethodDeclaration ::= MethodModifiersopt operator TypeParametersopt ( FormalParameter$fp1 ) WhereClauseopt HasResultTypeopt Throwsopt Offersopt MethodBody // case 31: { - //#line 1161 "/Users/tardieu/workspace/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1161 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1159 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List MethodModifiersopt = (List) getRhsSym(1); - //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(3); - //#line 1159 "/Users/tardieu/workspace/x10.compiler/src/x10/parser/x10.g" + //#line 1159 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal fp1 = (X10Formal) getRhsSym(5); - ... [truncated message content] |
From: <yz...@us...> - 2010-07-19 20:51:21
|
Revision: 15015 http://x10.svn.sourceforge.net/x10/?rev=15015&view=rev Author: yzibin Date: 2010-07-19 20:51:14 +0000 (Mon, 19 Jul 2010) Log Message: ----------- 1. Fixed XTENLANG-1561 (added position info instead of using COMPILER_GENERATED) 2. Fixed parsing issue: ran&mask as int is parsed as: ran&(mask as int) so I explicitly wrote: (ran&mask) as int Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/ClosureCall_c.java trunk/x10.compiler/src/x10/ast/PropertyDecl_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 Modified: trunk/x10.compiler/src/x10/ast/ClosureCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -24,7 +24,6 @@ import polyglot.ast.ProcedureCall; import polyglot.ast.Term; import polyglot.ast.TypeNode; -import polyglot.types.ClassDef; import polyglot.types.Context; import polyglot.types.ErrorRef_c; import polyglot.types.Flags; @@ -32,20 +31,14 @@ import polyglot.types.MethodDef; import polyglot.types.MethodInstance; import polyglot.types.ProcedureInstance; -import polyglot.types.Ref; import polyglot.types.SemanticException; import polyglot.types.Name; import polyglot.types.Type; -import polyglot.types.TypeSystem; -import polyglot.types.Types; import polyglot.types.UnknownType; import polyglot.util.CodeWriter; import polyglot.util.CollectionUtil; -import polyglot.util.InternalCompilerError; import polyglot.util.Pair; import polyglot.util.Position; -import polyglot.util.Transformation; -import polyglot.util.TransformingList; import polyglot.util.TypedList; import polyglot.visit.AscriptionVisitor; import polyglot.visit.CFGBuilder; @@ -53,10 +46,7 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; import polyglot.visit.TypeBuilder; -import x10.types.ClosureDef; -import x10.types.ClosureInstance; import x10.types.FunctionType; -import x10.types.X10Context; import x10.types.X10MethodInstance; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; @@ -332,7 +322,7 @@ // throw new SemanticException("Invalid closure call; target does not implement " + ct + ".", position()); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10Call_c n = (X10Call_c) nf.X10Call(position(), target(), - nf.Id(Position.COMPILER_GENERATED, mi.name().toString()), Collections.EMPTY_LIST, args); + nf.Id(X10NodeFactory_c.compilerGenerated(position()), mi.name().toString()), Collections.EMPTY_LIST, args); n = (X10Call_c) n.methodInstance(mi).type(mi.returnType()); return n; } Modified: trunk/x10.compiler/src/x10/ast/PropertyDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PropertyDecl_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/PropertyDecl_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -14,7 +14,6 @@ import java.util.Collections; import java.util.List; -import polyglot.ast.ArrayInit; import polyglot.ast.Block; import polyglot.ast.ClassBody; import polyglot.ast.Expr; @@ -24,21 +23,12 @@ import polyglot.ast.MethodDecl; import polyglot.ast.Node; import polyglot.ast.Stmt; -import polyglot.ast.StringLit; import polyglot.ast.TypeNode; -import polyglot.types.FieldDef; import polyglot.types.Flags; import polyglot.types.SemanticException; -import polyglot.types.TypeSystem; -import polyglot.types.UnknownType; import polyglot.util.Position; -import polyglot.visit.ContextVisitor; import polyglot.visit.TypeBuilder; -import x10.types.X10Context; -import x10.types.X10FieldDef; -import x10.types.X10FieldInstance; -import x10.types.X10Flags; -import x10.types.X10TypeSystem; +import x10.types.*; public class PropertyDecl_c extends X10FieldDecl_c implements PropertyDecl { public PropertyDecl_c(Position pos, FlagsNode flags, TypeNode type, @@ -97,10 +87,11 @@ } return body; } - + + private Position getCompilerGenPos() { return X10NodeFactory_c.compilerGenerated(position()); } protected MethodDecl getter(X10NodeFactory nf) { X10TypeSystem ts = (X10TypeSystem) nf.extensionInfo().typeSystem(); - Position pos = Position.COMPILER_GENERATED; + Position pos = getCompilerGenPos(); Flags flags = X10Flags.PROPERTY.Public().Final(); List<Formal> formals = Collections.EMPTY_LIST; List<TypeNode> throwTypes = Collections.EMPTY_LIST; @@ -121,7 +112,7 @@ * <RAJ> */ protected MethodDecl abstractGetter(X10NodeFactory nf) { - MethodDecl abstractGetter = nf.MethodDecl(Position.COMPILER_GENERATED, nf.FlagsNode(Position.COMPILER_GENERATED, X10Flags.PROPERTY.Public().Abstract()), type, name, + MethodDecl abstractGetter = nf.MethodDecl(getCompilerGenPos(), nf.FlagsNode(getCompilerGenPos(), X10Flags.PROPERTY.Public().Abstract()), type, name, Collections.EMPTY_LIST, Collections.EMPTY_LIST, null); return abstractGetter; } Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -529,7 +529,7 @@ if (! n.flags().flags().isAbstract()) return n; - Position CG = Position.COMPILER_GENERATED; + Position CG = X10NodeFactory_c.compilerGenerated(body()); X10TypeSystem_c xts = (X10TypeSystem_c) tc.typeSystem(); X10NodeFactory xnf = (X10NodeFactory) tc.nodeFactory(); X10ClassType targetType = (X10ClassType) n.classDef().asType(); @@ -981,7 +981,7 @@ TypeSystem ts, NodeFactory nf) throws SemanticException { X10ClassDef thisType = (X10ClassDef) _thisType; - Position pos = Position.COMPILER_GENERATED; //body().position().startOf(); + Position pos = X10NodeFactory_c.compilerGenerated(body()); X10NodeFactory xnf = (X10NodeFactory) nf; Block block = null; Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -11,13 +11,11 @@ package x10.ast; -import java.awt.Container; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; -import polyglot.ast.ClassBody; import polyglot.ast.ConstructorCall; import polyglot.ast.ConstructorCall_c; import polyglot.ast.Expr; @@ -33,7 +31,6 @@ import polyglot.types.Matcher; import polyglot.types.QName; import polyglot.types.SemanticException; -import polyglot.types.StructType; import polyglot.types.Type; import polyglot.types.TypeSystem; import polyglot.types.Types; @@ -46,7 +43,6 @@ import x10.ast.X10New_c.MatcherMaker; import x10.types.X10ConstructorDef; import x10.types.X10ConstructorInstance; -import x10.types.X10MethodInstance; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; @@ -127,7 +123,7 @@ || ts.typeEquals(type, ts.Object(), tc.context())) { // the super() call inserted by the parser needs to be thrown out X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - return nf.Empty(Position.COMPILER_GENERATED); + return nf.Empty(X10NodeFactory_c.compilerGenerated(position())); } throw new InternalCompilerError("Unexpected null supertype for " + this, position()); Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -46,7 +46,6 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.TypeBuilder; import polyglot.visit.TypeChecker; -import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.errors.Errors; import x10.extension.X10Del; @@ -62,7 +61,6 @@ import x10.types.checker.Converter; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.XConstrainedTerm; import x10.types.matcher.DumbConstructorMatcher; import x10.visit.X10TypeChecker; @@ -214,13 +212,14 @@ // Create the qualifier. Expr q; + Position cg = X10NodeFactory_c.compilerGenerated(position()); if (outer.typeEquals(c.currentClass(), ar.context())) { - q = nf.This(Position.COMPILER_GENERATED); + q = nf.This(cg); } else { - q = nf.This(Position.COMPILER_GENERATED, - nf.CanonicalTypeNode(Position.COMPILER_GENERATED, outer)); + q = nf.This(cg, + nf.CanonicalTypeNode(cg, outer)); } q = q.type(outer); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -15,74 +15,9 @@ import java.util.LinkedList; import java.util.List; -import polyglot.ast.AmbAssign; -import polyglot.ast.AmbExpr; -import polyglot.ast.AmbQualifierNode; -import polyglot.ast.AmbTypeNode; -import polyglot.ast.Assign; -import polyglot.ast.Binary; -import polyglot.ast.Block; -import polyglot.ast.BooleanLit; -import polyglot.ast.Call; -import polyglot.ast.CanonicalTypeNode; -import polyglot.ast.Cast; -import polyglot.ast.CharLit; -import polyglot.ast.ClassBody; -import polyglot.ast.ClassDecl; -import polyglot.ast.ClassMember; -import polyglot.ast.Conditional; -import polyglot.ast.ConstructorCall; -import polyglot.ast.ConstructorDecl; -import polyglot.ast.DelFactory; -import polyglot.ast.Disamb; -import polyglot.ast.Do; -import polyglot.ast.Expr; -import polyglot.ast.ExtFactory; -import polyglot.ast.Field; -import polyglot.ast.FieldAssign; -import polyglot.ast.FieldDecl; -import polyglot.ast.FlagsNode; -import polyglot.ast.FloatLit; -import polyglot.ast.For; -import polyglot.ast.ForInit; -import polyglot.ast.ForUpdate; -import polyglot.ast.For_c; -import polyglot.ast.Formal; -import polyglot.ast.Id; -import polyglot.ast.If; -import polyglot.ast.Import; -import polyglot.ast.Initializer; -import polyglot.ast.Initializer_c; -import polyglot.ast.Instanceof; -import polyglot.ast.IntLit; -import polyglot.ast.Local; -import polyglot.ast.LocalAssign; -import polyglot.ast.LocalDecl; -import polyglot.ast.MethodDecl; -import polyglot.ast.New; -import polyglot.ast.NodeFactory; -import polyglot.ast.NodeFactory_c; -import polyglot.ast.PackageNode; -import polyglot.ast.Prefix; -import polyglot.ast.Receiver; -import polyglot.ast.Return; -import polyglot.ast.SourceFile; -import polyglot.ast.Special; -import polyglot.ast.Stmt; -import polyglot.ast.StringLit; -import polyglot.ast.TopLevelDecl; -import polyglot.ast.Try; -import polyglot.ast.Try_c; -import polyglot.ast.TypeNode; -import polyglot.ast.Unary; -import polyglot.ast.While; +import polyglot.ast.*; import polyglot.ast.Assign.Operator; -import polyglot.types.FieldInstance; -import polyglot.types.Name; -import polyglot.types.QName; -import polyglot.types.Ref; -import polyglot.types.Type; -import polyglot.types.TypeSystem; +import polyglot.types.*; import polyglot.util.CollectionUtil; import polyglot.util.Position; import polyglot.util.TypedList; @@ -903,5 +838,14 @@ return n; } - + + public static Position compilerGenerated(Node n) { + return compilerGenerated(n==null ? null : n.position()); + } + public static Position compilerGenerated(TypeObject n) { + return compilerGenerated(n==null ? null : n.position()); + } + public static Position compilerGenerated(Position pos) { + return pos==null ? Position.COMPILER_GENERATED : pos.startOf().markCompilerGenerated(); + } } Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -20,20 +20,14 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Arrays; import java.io.File; -import x10.ast.X10Binary_c; -import x10.ast.X10Unary_c; import polyglot.types.QName; import polyglot.types.Name; import polyglot.ast.AmbExpr; -import polyglot.ast.AmbTypeNode; import polyglot.ast.Assign; import polyglot.ast.Binary; import polyglot.ast.Block; -import polyglot.ast.Call; -import polyglot.ast.CanonicalTypeNode; import polyglot.ast.Case; import polyglot.ast.Catch; import polyglot.ast.ClassBody; @@ -50,16 +44,13 @@ import polyglot.ast.Formal; import polyglot.ast.Id; import polyglot.ast.Import; -import polyglot.ast.Initializer; import polyglot.ast.IntLit; import polyglot.ast.LocalDecl; import polyglot.ast.MethodDecl; import polyglot.ast.FieldDecl; -import polyglot.ast.New; import polyglot.ast.NodeFactory; import polyglot.ast.PackageNode; import polyglot.ast.ProcedureDecl; -import polyglot.ast.Receiver; import polyglot.ast.SourceFile; import polyglot.ast.Stmt; import polyglot.ast.SwitchElement; @@ -68,30 +59,9 @@ import polyglot.ast.Unary; import polyglot.ast.FlagsNode; import polyglot.parse.ParsedName; -import x10.ast.AddFlags; -import x10.ast.AnnotationNode; -import x10.ast.Closure; -import x10.ast.ClosureCall; -import x10.ast.Here; -import x10.ast.DepParameterExpr; -import x10.ast.Tuple; -import x10.ast.When; -import x10.ast.X10Formal; -import x10.ast.X10Formal_c; -import x10.ast.X10Loop; -import x10.ast.X10Call; -import x10.ast.ConstantDistMaker; -import x10.ast.TypeDecl; -import x10.ast.TypeParamNode; -import x10.ast.X10NodeFactory; -import x10.types.ParameterType; -import x10.types.X10TypeSystem; -import x10.types.X10TypeSystem_c; -import x10.ast.PropertyDecl; -import x10.ast.RegionMaker; import x10.ast.X10Binary_c; import x10.ast.X10Unary_c; -import x10.ast.X10IntLit_c; +import x10.ast.*; import x10.extension.X10Ext; import polyglot.frontend.FileSource; import polyglot.frontend.Parser; @@ -100,33 +70,26 @@ import polyglot.lex.DoubleLiteral; import polyglot.lex.FloatLiteral; import polyglot.lex.Identifier; -import polyglot.lex.IntegerLiteral; import polyglot.lex.LongLiteral; import polyglot.lex.NullLiteral; import polyglot.lex.Operator; import polyglot.lex.StringLiteral; -import polyglot.main.Report; import polyglot.parse.VarDeclarator; import polyglot.types.Flags; -import x10.types.X10Flags; +import x10.types.*; import x10.types.checker.Converter; -import polyglot.types.SemanticException; -import polyglot.types.Type; import polyglot.types.TypeSystem; import polyglot.util.CollectionUtil; import polyglot.util.ErrorInfo; import polyglot.util.ErrorQueue; -import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.TypedList; -import polyglot.util.CollectionUtil; import lpg.runtime.BacktrackingParser; import lpg.runtime.BadParseException; import lpg.runtime.BadParseSymFileException; import lpg.runtime.DiagnoseParser; import lpg.runtime.IToken; -import lpg.runtime.LexStream; import lpg.runtime.NotBacktrackParseTableException; import lpg.runtime.NullExportedSymbolsException; import lpg.runtime.NullTerminalSymbolsException; @@ -2265,7 +2228,7 @@ X10Formal FormalParameter = (X10Formal) getRhsSym(1); //#line 1459 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Formal.class, false); - l.add(FormalParameter.flags(nf.FlagsNode(Position.COMPILER_GENERATED, Flags.FINAL))); + l.add(FormalParameter.flags(nf.FlagsNode(X10NodeFactory_c.compilerGenerated(FormalParameter), Flags.FINAL))); setResult(l); break; } @@ -2280,7 +2243,7 @@ //#line 1464 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/x10.compiler/src/x10/parser/x10.g" X10Formal FormalParameter = (X10Formal) getRhsSym(3); //#line 1466 "/Users/pcharles/IMP-workspace-3.6.0/x10-trunk/lpg.generator/templates/java/btParserTemplateF.gi" - ExistentialList.add(FormalParameter.flags(nf.FlagsNode(Position.COMPILER_GENERATED, Flags.FINAL))); + ExistentialList.add(FormalParameter.flags(nf.FlagsNode(X10NodeFactory_c.compilerGenerated(FormalParameter), Flags.FINAL))); break; } Modified: trunk/x10.compiler/src/x10/parser/x10.g =================================================================== --- trunk/x10.compiler/src/x10/parser/x10.g 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/parser/x10.g 2010-07-19 20:51:14 UTC (rev 15015) @@ -1457,13 +1457,13 @@ ExistentialList ::= FormalParameter /.$BeginJava List l = new TypedList(new LinkedList(), Formal.class, false); - l.add(FormalParameter.flags(nf.FlagsNode(Position.COMPILER_GENERATED, Flags.FINAL))); + l.add(FormalParameter.flags(nf.FlagsNode(X10NodeFactory_c.compilerGenerated(FormalParameter), Flags.FINAL))); setResult(l); $EndJava ./ | ExistentialList ; FormalParameter /.$BeginJava - ExistentialList.add(FormalParameter.flags(nf.FlagsNode(Position.COMPILER_GENERATED, Flags.FINAL))); + ExistentialList.add(FormalParameter.flags(nf.FlagsNode(X10NodeFactory_c.compilerGenerated(FormalParameter), Flags.FINAL))); $EndJava ./ Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -24,16 +24,13 @@ import java.util.Set; import polyglot.ast.Binary; -import polyglot.ast.Expr; import polyglot.ast.Id; -import polyglot.ast.Receiver; import polyglot.ast.TypeNode; import polyglot.frontend.ExtensionInfo; import polyglot.frontend.Globals; import polyglot.frontend.Goal; import polyglot.frontend.Source; import polyglot.main.Report; -import polyglot.types.ArrayType; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.CodeDef; @@ -64,7 +61,6 @@ import polyglot.types.ProcedureInstance; import polyglot.types.QName; import polyglot.types.Ref; -import polyglot.types.Ref_c; import polyglot.types.SemanticException; import polyglot.types.StructType; import polyglot.types.TopLevelResolver; @@ -84,8 +80,7 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.TypeBuilder; import x10.ast.X10NodeFactory; -import x10.ast.X10StringLit_c; -import x10.ast.X10ClassDecl_c; +import x10.ast.X10NodeFactory_c; import x10.constraint.XFailure; import x10.constraint.XLit; import x10.constraint.XName; @@ -94,12 +89,9 @@ import x10.constraint.XTerms; import x10.constraint.XVar; import x10.parser.X10ParsedName; -import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; import x10.types.constraints.SubtypeConstraint; -import x10.types.constraints.SubtypeConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.XConstrainedTerm; import x10.types.matcher.X10ConstructorMatcher; import x10.types.matcher.X10FieldMatcher; import x10.types.matcher.X10MemberTypeMatcher; @@ -674,7 +666,7 @@ return createFakeField(unknownClassDef().asType(), Flags.PUBLIC.Static(), name); } public X10FieldInstance createFakeField(ClassType container, Flags flags, Name name) { - Position pos = Position.COMPILER_GENERATED; + Position pos = X10NodeFactory_c.compilerGenerated(container); Type type = unknownType(pos); XVar thisVar = XTerms.makeEQV(); List<Ref<? extends Type>> excTypes = Collections.emptyList(); @@ -690,7 +682,7 @@ return createFakeMethod(unknownClassDef().asType(), Flags.PUBLIC.Static(), name, typeArgs, argTypes); } public X10MethodInstance createFakeMethod(ClassType container, Flags flags, Name name, List<Type> typeArgs, List<Type> argTypes) { - Position pos = Position.COMPILER_GENERATED; + Position pos = X10NodeFactory_c.compilerGenerated(container); Type returnType = unknownType(pos); List<Ref<? extends Type>> args = new ArrayList<Ref<? extends Type>>(); List<LocalDef> formalNames = new ArrayList<LocalDef>(); @@ -717,7 +709,7 @@ return createFakeConstructor(typeForNameSilent(containerName).typeArguments(typeArgs), argTypes); } public X10ConstructorInstance createFakeConstructor(ClassType container, List<Type> argTypes) { - Position pos = Position.COMPILER_GENERATED; + Position pos = X10NodeFactory_c.compilerGenerated(container); List<Ref<? extends Type>> args = new ArrayList<Ref<? extends Type>>(); List<LocalDef> formalNames = new ArrayList<LocalDef>(); int i = 0; @@ -1791,7 +1783,7 @@ } public VarDef createSelf(Type t) { - VarDef v = localDef(Position.COMPILER_GENERATED, Flags.PUBLIC, Types.ref(t), Name.make("self")); + VarDef v = localDef(X10NodeFactory_c.compilerGenerated(t), Flags.PUBLIC, Types.ref(t), Name.make("self")); return v; } Modified: trunk/x10.compiler/src/x10/util/Struct.java =================================================================== --- trunk/x10.compiler/src/x10/util/Struct.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/util/Struct.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -41,20 +41,12 @@ import polyglot.types.Types; import polyglot.util.Position; import polyglot.visit.TypeBuilder; -import x10.ast.X10StringLit_c; -import x10.ast.X10ClassDecl_c; -import x10.ast.X10NodeFactory; -import x10.ast.X10MethodDecl; -import x10.ast.TypeParamNode; +import x10.ast.*; import x10.constraint.XName; import x10.constraint.XNameWrapper; import x10.constraint.XVar; import x10.constraint.XTerms; -import x10.types.X10ClassDef; -import x10.types.X10Flags; -import x10.types.X10MethodDef; -import x10.types.X10ParsedClassType; -import x10.types.X10TypeSystem_c; +import x10.types.*; import x10cpp.visit.SharedVarsMethods; public class Struct { @@ -90,7 +82,7 @@ interfacesList.add(xts.lazyAny()); cd.setInterfaces(interfacesList); - final Position pos = Position.COMPILER_GENERATED; + final Position pos = X10NodeFactory_c.compilerGenerated(n.body()); String fullNameWithThis = fullName + "#this"; //String fullNameWithThis = "this"; Modified: trunk/x10.compiler/src/x10/util/Synthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -64,17 +64,7 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.TypeBuilder; import polyglot.visit.TypeChecker; -import x10.ast.AnnotationNode; -import x10.ast.Closure; -import x10.ast.DepParameterExpr; -import x10.ast.X10CanonicalTypeNode; -import x10.ast.X10ClassDecl; -import x10.ast.X10ClassDecl_c; -import x10.ast.X10ConstructorDecl; -import x10.ast.X10Formal; -import x10.ast.X10MethodDecl; -import x10.ast.X10NodeFactory; -import x10.ast.X10Special; +import x10.ast.*; import x10.constraint.XDisEquals; import x10.constraint.XEQV; import x10.constraint.XEquals; @@ -173,7 +163,7 @@ Type returnType, List<Type> trow, Block block) { - Position CG = Position.COMPILER_GENERATED; + Position CG = X10NodeFactory_c.compilerGenerated(ct.body()); List<Expr> args = new ArrayList<Expr>(); //FIXME: what's the usage of the args? List<Ref<? extends Type>> argTypes = new ArrayList<Ref<? extends Type>>(); List<Formal> formals = new ArrayList<Formal>(fmls.size()); @@ -301,7 +291,7 @@ public For makeForLoop(Position pos, X10Formal formal, Expr low, Expr high, Stmt body, X10Context context) { - Position CG = Position.COMPILER_GENERATED; + Position CG = X10NodeFactory_c.compilerGenerated(pos); List<Stmt> inits = new ArrayList<Stmt>(); // FIXME: use formal here directly, instead of local Expr local = makeLocalVar(CG, null, low, inits, context); Modified: trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-07-19 20:51:14 UTC (rev 15015) @@ -29,7 +29,6 @@ import polyglot.ast.Receiver; import polyglot.ast.Stmt; import polyglot.ast.TypeNode; -import polyglot.ast.ConstructorCall; import polyglot.frontend.Job; import polyglot.main.Report; import polyglot.types.ConstructorInstance; @@ -50,10 +49,7 @@ import polyglot.util.Position; import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; -import x10.ast.X10ConstructorDecl; -import x10.ast.X10ClassDecl; -import x10.ast.X10MethodDecl; -import x10.ast.X10NodeFactory; +import x10.ast.*; import x10.types.ParameterType; import x10.types.X10Def; import x10.types.X10ConstructorDef; @@ -153,7 +149,7 @@ ClassBody cbody = cdecl.body(); List<ClassMember> cmembers = new ArrayList<ClassMember>(); - Position p = Position.COMPILER_GENERATED; + Position p = X10NodeFactory_c.compilerGenerated(cbody); // create fake def for native class X10ClassDef fake = (X10ClassDef) xts.createClassDef(); Modified: trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 2010-07-19 20:35:25 UTC (rev 15014) +++ trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 2010-07-19 20:51:14 UTC (rev 15015) @@ -47,7 +47,7 @@ final def update(ran:long) { //a(ran&mask as int) ^= ran; - val index = ran&mask as int; + val index = (ran&mask) as int; a(index) = a(index) ^ ran; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-07-21 20:52:59
|
Revision: 15071 http://x10.svn.sourceforge.net/x10/?rev=15071&view=rev Author: yzibin Date: 2010-07-21 20:52:51 +0000 (Wed, 21 Jul 2010) Log Message: ----------- Fixed the test-suite after front-end changes: * you can't use inequalities in constraints (e.g., Int{self>1} ) * the priority of "as" was increased, so "1+2 as Byte" is now parsed as "1+(2 as Byte)" and not as it used to be "(1+2) as Byte" Modified Paths: -------------- trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 trunk/x10.tests/examples/Constructs/Call/ConConstructor1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConInstance1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg_2.x10 trunk/x10.tests/examples/Constructs/Call/ConInstanceHere.x10 trunk/x10.tests/examples/Constructs/Class/ConstructorsWithInferredTypes.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall3.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeThisClause.x10 trunk/x10.tests/examples/Constructs/Instanceof/ConstrainedTypeTests.x10 trunk/x10.tests/examples/Constructs/Rail/RailCopy.x10 trunk/x10.tests/examples/Samples/HeatTransferTest_v0.x10 trunk/x10.tests/tests/Constructs/Proto/CovariantCall.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoAssignField.x10 Modified: trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 =================================================================== --- trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.dist/samples/CUDA/KMeansCUDA.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -198,7 +198,7 @@ // file is dimension-major val file = new File(fname), fr = file.openRead(); val init_points = (Int) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); - val num_file_points = file.size() / 4 / 4 as Int; + val num_file_points = (file.size() / 4 / 4) as Int; val file_points = ValRail.make(num_file_points*4, init_points); var results : Rail[Float]!; @@ -230,8 +230,8 @@ }; // these are pretty big so allocate up front - val host_points = Rail.make(num_local_points_stride*4 as Int, init); - val gpu_points = Rail.makeRemote(gpu, num_local_points_stride*4 as Int, host_points); + val host_points = Rail.make((num_local_points_stride*4) as Int, init); + val gpu_points = Rail.makeRemote(gpu, (num_local_points_stride*4) as Int, host_points); val host_nearest = Rail.make[Int](num_local_points as Int, (Int)=>0 as Int); val gpu_nearest = Rail.makeRemote[Int](gpu, num_local_points as Int, (Int)=>0 as Int); Modified: trunk/x10.dist/samples/FRASimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FRASimpleDist.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.dist/samples/FRASimpleDist.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -119,7 +119,7 @@ async (Place.places(i)) { val table = tables(); var err:int = 0; - for ((j) in table.a) + for ((j) in table.a) // DYNAMIC_CHECK (because it is inside "async (Place.places(i)) {") if (table.a(j) != j) err++; println("Found " + err + " errors."); } Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -27,9 +27,9 @@ static type Real=Double; const n = 3, epsilon = 1.0e-5; - val BigD = [0..n+1, 0..n+1] as Region; - val D = [1..n, 1..n] as Region; - val LastRow = [0..0, 1..n] as Region; + val BigD = [0..n+1, 0..n+1] as Region(2); + val D = [1..n, 1..n] as Region(2); + val LastRow = [0..0, 1..n] as Region(2); val A = new Array[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); val Temp = new Array[Real](BigD,(p:Point(BigD.rank))=>{ A(p) }); Modified: trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -47,11 +47,11 @@ //this top level future runs in D[1] since a[0]==v1 && v1.home()==D[1] var i0: int = (future((future(a.dist(0)){a(0)}).force().home()) - { (future(a.dist(0)){a(0)}).force().v }).force(); + { (future(a.dist(0)){a(0)}).force().v }).force(); // DYNAMIC_CHECK //this top level future runs in D[0] since a[1]==v2 && v2.home()==D[0] var i1: int = (future((future(a.dist(1)){a(1)}).force().home()) - { (future(a.dist(1)){a(1)}).force().v }).force(); + { (future(a.dist(1)){a(1)}).force().v }).force(); // DYNAMIC_CHECK return i0 + 1 == i1; } Modified: trunk/x10.tests/examples/Constructs/Call/ConConstructor1Arg.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Call/ConConstructor1Arg.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Call/ConConstructor1Arg.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -21,7 +21,7 @@ def this(A{self.i==2}){} def this(i:Int) { // This call will compile only if -strictCalls is not set. - this(new A(i)); + this(new A(i)); // DYNAMIC_CHECK } public def run(): boolean { Modified: trunk/x10.tests/examples/Constructs/Call/ConInstance1Arg.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Call/ConInstance1Arg.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Call/ConInstance1Arg.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -23,7 +23,7 @@ def n(i:Int) { val a = new A(i); // This call will compile only if -strictCalls is not set. - m(a); + m(a); // DYNAMIC_CHECK } public def run(): boolean { Modified: trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg_2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg_2.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg_2.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -24,7 +24,7 @@ def n(i:Int) { val a = new A(i); // This call will compile only if -strictCalls is not set. - m(a, i+1); + m(a, i+1); // DYNAMIC_CHECK } public def run(): boolean { Modified: trunk/x10.tests/examples/Constructs/Call/ConInstanceHere.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Call/ConInstanceHere.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Call/ConInstanceHere.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -21,7 +21,7 @@ def n() { at (here.next()) { // This call will compile only if -strictCalls is not set. - m(); + m(); // DYNAMIC_CHECK } } Modified: trunk/x10.tests/examples/Constructs/Class/ConstructorsWithInferredTypes.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Class/ConstructorsWithInferredTypes.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Class/ConstructorsWithInferredTypes.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -25,6 +25,8 @@ public def run(): boolean = { val s0 : Spot{x==0} = new Spot(); val s1 : Spot{x==1} = new Spot(1); + val q0 : Spot2{x==0} = new Spot2(); // todo: today we have a DYNAMIC_CHECK, but it should be inferred correctly + val q1 : Spot2{x==1} = new Spot2(1); // todo: today we have a DYNAMIC_CHECK, but it should be inferred correctly // If this compiles then it's fine. return true; } @@ -35,6 +37,10 @@ } class Spot(x:Int) { + def this():Spot{self.x==0} {property(0);} + def this(xx:Int):Spot{self.x==xx} {property(xx);} +} +class Spot2(x:Int) { def this() {property(0);} def this(xx:Int) {property(xx);} } Modified: trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -80,7 +80,7 @@ val f0: foo! = new foo() { public def apply(): void = { - val cx = ca(x.zero()); + val cx = ca(x.zero()); // DYNAMIC_CHECK async clocked(cx) { // clock use error next; } @@ -89,7 +89,7 @@ val f1: foo! = new foo() { public def apply(): void = { - val cx = ca(x.one()); + val cx = ca(x.one()); // DYNAMIC_CHECK async clocked(cx) { // no clock use error next; } Modified: trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -74,7 +74,7 @@ var f0: foo! = new foo() { public def apply(): void = { - val cx: Clock = ca(x.zero()); + val cx: Clock = ca(x.zero());// DYNAMIC_CHECK async clocked(cx) { //clock use error next; } @@ -83,7 +83,7 @@ var f1: foo! = new foo() { public def apply(): void = { - val cx: Clock = ca(x.one()); + val cx: Clock = ca(x.one());// DYNAMIC_CHECK async clocked(cx) { //no clock use error next; } Modified: trunk/x10.tests/examples/Constructs/Closures/ClosureCall3.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/ClosureCall3.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Closures/ClosureCall3.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -20,7 +20,12 @@ public class ClosureCall3 extends ClosureTest { public def run(): boolean = { - val y = (x:Int)=> x; + val y = (x:Int)=> x; // DYNAMIC_CHECK todo: we should infer type (x:Int)=>Int{self==x}, + // but closures have a bug: + //Semantic Error: Cannot assign expression to target. + // Expression: (val x: x10.lang.Int){}: x10.lang.Int{self==x} => { return x; } + // Type: (a1:x10.lang.Int)=> x10.lang.Int{self==x} + // Expected type: (a1:x10.lang.Int)=> x10.lang.Int{self==x} val z :Int(1) = y(1); return result; } Modified: trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -27,7 +27,11 @@ def a() = 2; class D { def a() = 4; - val sum = (()=>(ClosureEnclosingScope6.this.a+C.this.a()+D.this.a()+a()))(); + val sum = (()=>( + ClosureEnclosingScope6.this.a // DYNAMIC_CHECK + + + C.this.a()+ // DYNAMIC_CHECK + D.this.a()+a()))(); } } Modified: trunk/x10.tests/examples/Constructs/DepType/DepTypeThisClause.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/DepTypeThisClause.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/DepType/DepTypeThisClause.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -35,7 +35,7 @@ */ public def run():boolean{ - val IAmThree : DepTypeThisClause{self.i==3 && self.home == here} = new DepTypeThisClause(3,171); + val IAmThree : DepTypeThisClause!{self.i==3} = new DepTypeThisClause(3,171); val ret : boolean(true) = IAmThree.NotReallyRun(); return ret; } Modified: trunk/x10.tests/examples/Constructs/Instanceof/ConstrainedTypeTests.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Instanceof/ConstrainedTypeTests.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Instanceof/ConstrainedTypeTests.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -22,7 +22,7 @@ var res3: boolean = !(X10DepTypeSubClassOneB <: Int); var res4: boolean = !(X10DepTypeSubClassOneB{a==2} <: X10DepTypeClassOneB{p==2}); var res5: boolean = !(X10DepTypeSubClassOneB{a==3} <: X10DepTypeClassOneB{p==2}); - var res6: boolean = X10DepTypeSubClassOneB{p==2} <: X10DepTypeClassOneB{p==2 && p > 1 && p < 10}; + var res6: boolean = X10DepTypeSubClassOneB{p==2} <: X10DepTypeClassOneB{p==2 && p!=3 && p!=4}; x10.io.Console.OUT.println("X10DepTypeClassOneB == X10DepTypeClassOneB -> "+res1); x10.io.Console.OUT.println("X10DepTypeSubClassOneB <: X10DepTypeClassOneB -> "+res2); x10.io.Console.OUT.println("X10DepTypeSubClassOneB <: Int -> "+(!res3)); Modified: trunk/x10.tests/examples/Constructs/Rail/RailCopy.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Rail/RailCopy.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Constructs/Rail/RailCopy.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -172,11 +172,11 @@ Console.ERR.println("| "+(here==p?" Local copy test ":" Remote copy test ")+" |"); Console.ERR.println("========================="); for (i in [1, 4200, 500000]) { - failures += test(i, p, (i:Int)=>(65+(i%26)) as Char, (i:Int)=>'x', "Char"+i); - failures += test(i, p, (i:Int)=>i+1000 as Byte, (i:Int)=>0 as Byte, "Byte"+i); - failures += test(i, p, (i:Int)=>i-1000 as Int, (i:Int)=>0 as Int, "Int"+i); - failures += test(i, p, (i:Int)=>i/1000.0 as Float, (i:Int)=>0 as Float, "Float"+i); - failures += test(i, p, (i:Int)=>Math.pow(-i,3) as Double, (i:Int)=>0 as Double, "Double"+i); + failures += test(i, p, (i:Int)=>((65+(i%26)) as Char), (i:Int)=>'x', "Char"+i); + failures += test(i, p, (i:Int)=>((i+1000) as Byte), (i:Int)=>(0 as Byte), "Byte"+i); + failures += test(i, p, (i:Int)=>((i-1000) as Int), (i:Int)=>(0 as Int), "Int"+i); + failures += test(i, p, (i:Int)=>((i/1000.0) as Float), (i:Int)=>(0 as Float), "Float"+i); + failures += test(i, p, (i:Int)=>(Math.pow(-i,3) as Double), (i:Int)=>(0 as Double), "Double"+i); } } Console.ERR.println("Number of failures: "+failures); Modified: trunk/x10.tests/examples/Samples/HeatTransferTest_v0.x10 =================================================================== --- trunk/x10.tests/examples/Samples/HeatTransferTest_v0.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/examples/Samples/HeatTransferTest_v0.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -25,7 +25,7 @@ // Can't use epsilon as the check because the termination // condition is that the rate of change is less than epsilon. val pt = Point.make(2,2); - val tmp = HeatTransfer_v0.A(pt); + val tmp = s.A(pt); Console.OUT.println("The value of A(2,2) is "+tmp); chk(tmp > 0.249); chk(tmp < 0.251); Modified: trunk/x10.tests/tests/Constructs/Proto/CovariantCall.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Proto/CovariantCall.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/tests/Constructs/Proto/CovariantCall.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -27,7 +27,7 @@ } } - static def m(a: proto A) { + static def m(a: proto A!) { a.x = 5; } Modified: trunk/x10.tests/tests/Constructs/Proto/ProtoAssignField.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Proto/ProtoAssignField.x10 2010-07-21 20:27:18 UTC (rev 15070) +++ trunk/x10.tests/tests/Constructs/Proto/ProtoAssignField.x10 2010-07-21 20:52:51 UTC (rev 15071) @@ -25,7 +25,7 @@ /** * Cannot read a field of a proto value. */ - def m(a: proto A) { + def m(a: proto A!) { a.x = 5; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-07-23 23:06:48
|
Revision: 15126 http://x10.svn.sourceforge.net/x10/?rev=15126&view=rev Author: yzibin Date: 2010-07-23 23:06:42 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Added a test to see if "this" escapes from the ctor. Changed some proto methods into a static method (because I'm trying to remove the proto keyword) Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/util/RunTestSuite.java trunk/x10.runtime/src-x10/x10/array/DistArray.x10 Added Paths: ----------- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-07-23 23:04:28 UTC (rev 15125) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-07-23 23:06:42 UTC (rev 15126) @@ -73,6 +73,8 @@ import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; import x10.types.constraints.XConstrainedTerm; +import x10.visit.CheckEscapingThis; + /** * An X10ConstructorDecl differs from a ConstructorDecl in that it has a returnType. * @@ -502,8 +504,13 @@ } n = (X10ConstructorDecl_c) (super.typeCheck(tc)); - X10TypeMixin.protoTypeCheck(n.formals(), n.returnType().type(), + final Type returnT = n.returnType().type(); + X10TypeMixin.protoTypeCheck(n.formals(), returnT, n.position(), false); + + // for native ctors, we don't have a body + if (false && body!=null) + body.visit(new CheckEscapingThis(tc.job(),returnT,tc.typeSystem())); return n; } Modified: trunk/x10.compiler/src/x10/util/RunTestSuite.java =================================================================== --- trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-07-23 23:04:28 UTC (rev 15125) +++ trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-07-23 23:06:42 UTC (rev 15126) @@ -29,6 +29,7 @@ "_DYNAMIC_CALLS.x10","_MustFailCompile.x10", }; private static final String[] EXCLUDE_FILES = { + "NOT_WORKING","SSCA2","FT-alltoall","FT-global" }; private static final String[] EXCLUDE_FILES_WITH = { "TypedefOverloading","NQueens", @@ -191,12 +192,13 @@ private static void recurse(File dir, ArrayList<File> files) { if (files.size()>=MAX_FILES_NUM) return; for (File f : dir.listFiles()) { + String name = f.getName(); + if (shouldIgnoreFile(name)) continue; if (files.size()>=MAX_FILES_NUM) return; if (f.isDirectory()) recurse(f, files); else { - String name = f.getName(); - if (name.endsWith(".x10") && !shouldIgnoreFile(name)) { + if (name.endsWith(".x10")) { files.add(f); } } Added: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java =================================================================== --- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java (rev 0) +++ trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-07-23 23:06:42 UTC (rev 15126) @@ -0,0 +1,62 @@ +package x10.visit; + +import polyglot.ast.*; +import polyglot.util.Position; +import polyglot.util.ErrorInfo; +import polyglot.visit.NodeVisitor; +import polyglot.frontend.Job; +import polyglot.main.Report; +import polyglot.types.SemanticException; +import polyglot.types.QName; +import polyglot.types.Type; +import polyglot.types.TypeSystem; +import x10.ast.*; +import x10.types.X10TypeMixin; +import x10.types.X10Flags; + +public class CheckEscapingThis extends NodeVisitor +{ + private final Job job; + private final TypeSystem ts; + private final Type type; + + public CheckEscapingThis(Job job, Type type, TypeSystem ts) { + this.job = job; + this.ts = ts; + this.type = X10TypeMixin.baseType(type); + } + + @Override + public Node visitEdgeNoOverride(Node parent, Node n) { + // You can access "this" for field access and field assignment. + if (n instanceof FieldAssign) { + FieldAssign assign = (FieldAssign) n; + if (assign.target() instanceof Special) { + assign.right().visit(this); + return n; + } + } + if (n instanceof Field && ((Field)n).target() instanceof Special) { + return n; + } + // You can also access "this" as the receiver of property calls (because they are MACROS that are expanded to field access) + if (n instanceof X10Call) { + final X10Call call = (X10Call) n; + if (call.target() instanceof Special && + call.methodInstance().flags().contains(X10Flags.PROPERTY)) { + // it is enough to just recurse into the arguments + for (Expr e : call.arguments()) + e.visit(this); + return n; + } + } + if (n instanceof Special) { + final Special special = (Special) n; + if (special.kind()==Special.THIS && + ts.typeEquals(X10TypeMixin.baseType(special.type()),type,null)) + job.compiler().errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR,"'this' cannot escape from a constructor!",n.position()); + } + n.del().visitChildren(this); + return n; + } +} \ No newline at end of file Property changes on: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/x10.runtime/src-x10/x10/array/DistArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-07-23 23:04:28 UTC (rev 15125) +++ trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-07-23 23:06:42 UTC (rev 15126) @@ -400,7 +400,7 @@ */ // safe to call from witin a constructor, does not read fields. - protected proto global def layout(r: Region): RectLayout { + protected static def layout(r: Region): RectLayout { if (r.isEmpty()) { // XXX EmptyLayout class? val min = ValRail.make[int](r.rank, (Int)=>0); Added: trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 (rev 0) +++ trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 2010-07-23 23:06:42 UTC (rev 15126) @@ -0,0 +1,67 @@ +// check that "this" doesn't escape from any ctor +class Test(p:Test) { + var tt:Test; + val w:Int; + global val v1:Int = 1; + var x1:Int; + static def foo(t:Test)=2; + static def bar(t:Inner)=2; + def this() { + this(null); + } + def this(i:Int) { + this(i,null); + } + def this(q:Test!):Test{self.p==q} { + property(q); + w = 2; + q.tt = q; + this.tt = q; + foo(q); + q.m(); + q.z(q); + val inner = q.new Inner(); + } + def this(i:Int,q:Test!): + Test{self.p==self} { + property(this); // ERR + w = 4; + val alias = this; // ERR + q.tt = this; // ERR + this.tt = q; + q.tt = this.tt; + foo(this); // ERR + this.m(); // ERR + q.z(this); // ERR + val inner1 = new Inner(); // ERR + val inner2 = this.new Inner(); // ERR + } + def m() {} + global def g() {} + global def z(q:Test) {} + + // inner class - this of the inner class cannot escape, but the outer can escape (because you access it's fields via methods, e.g., Outer.this.getHeader()) + class Inner { + val f:Int; + global val v2:Int = 4; + var x2:Int; + def this() { + f = 3; + x2 = v2; + x2 = v1; + // Outer "this" can escape + g(); + Test.this.g(); + z(Test.this); + // Inner "this" can NOT escape + f(null); // ERR + this.f(null); // ERR + val z:Inner! = null; + z.f(z); + z.f(this); // ERR + bar(this); // ERR + bar(z); + } + def f(inner:Inner) {} + } +} \ No newline at end of file Property changes on: trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-07-26 20:23:59
|
Revision: 15157 http://x10.svn.sourceforge.net/x10/?rev=15157&view=rev Author: yzibin Date: 2010-07-26 20:23:49 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Fixed XTENLANG-1612 and XTENLANG-1577. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/FinishExpr_c.java trunk/x10.compiler/src/x10/types/ReinstantiatedMethodInstance.java trunk/x10.compiler/src/x10/types/checker/Checker.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 Modified: trunk/x10.compiler/src/x10/ast/FinishExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/FinishExpr_c.java 2010-07-26 20:20:16 UTC (rev 15156) +++ trunk/x10.compiler/src/x10/ast/FinishExpr_c.java 2010-07-26 20:23:49 UTC (rev 15157) @@ -83,9 +83,10 @@ if (r == null) { throw new Errors.IsNotReducible(e, e.position()); } - Context childScope = enterChildScope(body, tc.context()); + Node tmpNode = reconstruct(e,body).type(r); + Context childScope = tmpNode.enterChildScope(body, tc.context()); ContextVisitor childVisitor = tc.context(childScope); - Stmt b = (Stmt) visitChild(body, childVisitor); + Stmt b = (Stmt) tmpNode.visitChild(body, childVisitor); Node n = reconstruct(e,b).type(r); List<AnnotationNode> oldAnnotations = ((X10Ext) ext()).annotations(); if (oldAnnotations == null || oldAnnotations.isEmpty()) { Modified: trunk/x10.compiler/src/x10/types/ReinstantiatedMethodInstance.java =================================================================== --- trunk/x10.compiler/src/x10/types/ReinstantiatedMethodInstance.java 2010-07-26 20:20:16 UTC (rev 15156) +++ trunk/x10.compiler/src/x10/types/ReinstantiatedMethodInstance.java 2010-07-26 20:23:49 UTC (rev 15157) @@ -5,11 +5,7 @@ import java.util.List; -import polyglot.types.LocalInstance; -import polyglot.types.Ref; -import polyglot.types.StructType; -import polyglot.types.Type; -import polyglot.types.TypeSystem; +import polyglot.types.*; import polyglot.util.Position; import x10.types.constraints.CConstraint; @@ -62,7 +58,14 @@ return throwTypes; } - @Override + @Override + public Ref<? extends Type> offerType() { + final Ref<? extends Type> ref = fi.offerType(); + if (ref==null) return null; + return new Ref_c<Type>(this.typeParamSubst.reinstantiate(ref.get())); + } + + @Override public CConstraint guard() { if (guard == null) return this.typeParamSubst.reinstantiate(fi.guard()); Modified: trunk/x10.compiler/src/x10/types/checker/Checker.java =================================================================== --- trunk/x10.compiler/src/x10/types/checker/Checker.java 2010-07-26 20:20:16 UTC (rev 15156) +++ trunk/x10.compiler/src/x10/types/checker/Checker.java 2010-07-26 20:23:49 UTC (rev 15157) @@ -58,7 +58,8 @@ throw new Errors.CannotCallCodeThatOffers(pi, pos); if (! tc.typeSystem().isSubtype(offerType, type, cxt)) throw new Errors.OfferTypeMismatch(offerType, type, pos); - } + } else { + } } Modified: trunk/x10.compiler/src/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-07-26 20:20:16 UTC (rev 15156) +++ trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-07-26 20:23:49 UTC (rev 15157) @@ -605,14 +605,11 @@ ConstrainedType ct = (ConstrainedType) reducerType; reducerType = X10TypeMixin.baseType(Types.get(ct.baseType())); } - + + // reducerType is "Reducible[T]", and reducerTarget is "T" // Parse out T - Type reducerTarget = null; - for (Type t : xts.interfaces(reducerType)) { - for (Type tt : ((X10ParsedClassType)t).typeArguments()) { - reducerTarget = tt; - } - } + Type reducerTarget = X10TypeMixin.reducerType(reducerType); + assert reducerTarget!=null; Type coFinish = xts.load("x10.lang.Runtime.CollectingFinish"); Type coFinishT = (((X10ParsedClassType)coFinish).typeArguments(Collections.singletonList(reducerTarget))); Modified: trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 2010-07-26 20:20:16 UTC (rev 15156) +++ trunk/x10.tests/examples/Constructs/Constructor/EscapingThisTest.x10 2010-07-26 20:23:49 UTC (rev 15157) @@ -15,6 +15,9 @@ def this(q:Test!):Test{self.p==q} { property(q); w = 2; + val alias = q; + val callToString = ""+q; + val callOp1 = q+q; q.tt = q; this.tt = q; foo(q); @@ -27,6 +30,9 @@ property(this); // ERR w = 4; val alias = this; // ERR + val callToString = ""+this; // ERR + val callOp1 = q+this; // ERR + val callOp2 = this+q; // ERR q.tt = this; // ERR this.tt = q; q.tt = this.tt; @@ -36,6 +42,7 @@ val inner1 = new Inner(); // ERR val inner2 = this.new Inner(); // ERR } + operator this+(that:Test):Test = null; def m() {} global def g() {} global def z(q:Test) {} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2010-07-27 16:53:05
|
Revision: 15186 http://x10.svn.sourceforge.net/x10/?rev=15186&view=rev Author: bherta Date: 2010-07-27 16:52:56 +0000 (Tue, 27 Jul 2010) Log Message: ----------- Initial prototype version of the _X10_STATEMENT_HOOK() implementation Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java trunk/x10.runtime/src-cpp/x10aux/debug.cc trunk/x10.runtime/src-cpp/x10aux/debug.h Modified: trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-07-27 16:13:36 UTC (rev 15185) +++ trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-07-27 16:52:56 UTC (rev 15186) @@ -35,6 +35,7 @@ import polyglot.ast.Catch; import polyglot.ast.ClassDecl; import polyglot.ast.ClassMember; +import polyglot.ast.CompoundStmt; import polyglot.ast.ConstructorDecl; import polyglot.ast.Eval; import polyglot.ast.FieldDecl; @@ -162,7 +163,10 @@ w.write("//#line " + line + " \"" + file + "\": "+n.getClass().getName()); w.newline(); } - + + if (x10.Configuration.DEBUG && n instanceof Stmt && !(n instanceof CompoundStmt)) + w.write("_X10_STATEMENT_HOOK(), "); + final int startLine = w.currentStream().getStreamLineNumber(); // for debug info // FIXME: [IP] Some nodes have no del() -- warn in that case Modified: trunk/x10.runtime/src-cpp/x10aux/debug.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/debug.cc 2010-07-27 16:13:36 UTC (rev 15185) +++ trunk/x10.runtime/src-cpp/x10aux/debug.cc 2010-07-27 16:52:56 UTC (rev 15186) @@ -12,10 +12,10 @@ #include <x10aux/debug.h> // A hook at the start of every X10 method. -void _X10_Entry_Hook() { } +//void _X10_Entry_Hook() { } // A hook at the end of every X10 method. -void _X10_Exit_Hook() { } +//void _X10_Exit_Hook() { } // A hook at the start of every X10 executable statement. // Follows any method start hook, and precedes any method end hook. Modified: trunk/x10.runtime/src-cpp/x10aux/debug.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/debug.h 2010-07-27 16:13:36 UTC (rev 15185) +++ trunk/x10.runtime/src-cpp/x10aux/debug.h 2010-07-27 16:52:56 UTC (rev 15186) @@ -89,6 +89,13 @@ uint16_t _lineIndex; // Index into _CPPtoX10xrefList of the first line of the method }; +struct _X10VarMap +{ + const char* X10name; + const char* X10type; + const char* CPPname; +}; + enum _MetaLanguage { X10_META_LANG = 0 // Metalanguage 0 is X10 }; @@ -116,10 +123,10 @@ const struct _X10methodName* x10methodNameList; // The method name mapping list }; -extern void _X10_Entry_Hook(); // A hook at the start of every X10 method. -extern void _X10_Exit_Hook(); // A hook at the end of every X10 method. -extern void _X10_Statement_Hook(); // A hook at the start of every X10 executable statement. - // Follows any method start hook, and precedes any method end hook. +//extern void _X10_Entry_Hook(); // A hook at the start of every X10 method. +//extern void _X10_Exit_Hook(); // A hook at the end of every X10 method. +extern void _X10_Statement_Hook(); // A hook at the start of every X10 executable statement. + // Follows any method start hook, and precedes any method end hook. #endif //X10AUX_DEBUG_H // 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: <mt...@us...> - 2010-08-02 10:09:21
|
Revision: 15312 http://x10.svn.sourceforge.net/x10/?rev=15312&view=rev Author: mtake Date: 2010-08-02 10:09:14 +0000 (Mon, 02 Aug 2010) Log Message: ----------- Fix XTENLANG-1646 (again) Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_9.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_0.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_1.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_2.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_3.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_4.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_5.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_6.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_7.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_8.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_9.java trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -526,6 +526,12 @@ "x10.runtime.impl.java.PreLoader.preLoad(this.getClass().getEnclosingClass(), Boolean.getBoolean(\"x10.PRELOAD_STRINGS\"));\n" + "}\n" + "}\n" + + "public x10.rtt.RuntimeType<?> getRTT() {\n" + + "return _RTT;\n" + + "}\n" + + "public x10.rtt.Type<?> getParam(int i) {\n" + + "return null;\n" + + "}\n" + "},\n" + "// body of main activity\n" + "new x10.core.fun.VoidFun_0_0() {\n" + @@ -543,6 +549,12 @@ "throw new x10.lang.MultipleExceptions(t);\n" + "}\n" + "}\n" + + "public x10.rtt.RuntimeType<?> getRTT() {\n" + + "return _RTT;\n" + + "}\n" + + "public x10.rtt.Type<?> getParam(int i) {\n" + + "return null;\n" + + "}\n" + "});\n" + "} catch (java.lang.Throwable t) {\n" + "t.printStackTrace();\n" + @@ -2131,7 +2143,8 @@ types.addAll(ct2.typeArguments()); } } - if (types.size() > 0) { + // To extend Any, the type requires getRTT even if it has no type params (e.g. VoidFun_0_0). +// if (types.size() > 0) { w.write("public x10.rtt.RuntimeType<?> getRTT() { return _RTT;}"); w.write("public x10.rtt.Type<?> getParam(int i) {"); for (int i = 0; i < types.size(); i++) { @@ -2145,9 +2158,7 @@ w.newline(); w.write("}"); w.newline(); - } else { - - } +// } } } @@ -2445,6 +2456,12 @@ "public void apply() {\n" + "#4\n" + "}\n" + + "public x10.rtt.RuntimeType<?> getRTT() {\n" + + "return _RTT;\n" + + "}\n" + + "public x10.rtt.Type<?> getParam(int i) {\n" + + "return null;\n" + + "}\n" + "}, \"foreach-#8\");\n" + "}"; er.processClockedLoop("foreach", regex, f); @@ -2464,6 +2481,12 @@ "public void apply() {\n" + "#4\n" + "}\n" + + "public x10.rtt.RuntimeType<?> getRTT() {\n" + + "return _RTT;\n" + + "}\n" + + "public x10.rtt.Type<?> getParam(int i) {\n" + + "return null;\n" + + "}\n" + "}, \"ateach-#8\");\n" + "}\n" + "}"; @@ -2473,7 +2496,19 @@ public void visit(Now_c n) { Translator tr2 = ((X10Translator) tr).inInnerClass(true); // SYNOPSIS: now(#0) #1 - String regex = "x10.runtime.Runtime.runNow(#0, new x10.core.fun.VoidFun_0_0() { public void apply() { #2 } });"; + String regex = + "x10.runtime.Runtime.runNow(#0,\n" + + "new x10.core.fun.VoidFun_0_0() {\n" + + "public void apply() {\n" + + "#2\n" + + "}\n" + + "public x10.rtt.RuntimeType<?> getRTT() {\n" + + "return _RTT;\n" + + "}\n" + + "public x10.rtt.Type<?> getParam(int i) {\n" + + "return null;\n" + + "}\n" + + "});"; er.dumpRegex("Now", new Object[] { n.clock(), n.body() }, tr2, regex); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -20,10 +20,5 @@ public static final RuntimeType<Fun_0_0<?>> _RTT = new RuntimeType<Fun_0_0<?>>( Fun_0_0.class, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_0"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -21,10 +21,5 @@ Fun_0_1.class, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_1"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -22,10 +22,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_2"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -23,10 +23,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_3"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -24,10 +24,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_4"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -25,10 +25,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_5"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -26,10 +26,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_6"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -27,10 +27,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_7"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -28,10 +28,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_8"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_9.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_9.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_9.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -29,10 +29,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.COVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.Fun_0_9"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,5 +11,7 @@ package x10.core.fun; -public interface VoidFun { +import x10.core.Any; + +public interface VoidFun extends Any { } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_0.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_0.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_0.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -18,10 +18,5 @@ public static final RuntimeType<VoidFun_0_0> _RTT = new RuntimeType<VoidFun_0_0>( VoidFun_0_0.class - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_0"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_1.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_1.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_1.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,20 +11,14 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_1<T1> extends VoidFun, Any { +public interface VoidFun_0_1<T1> extends VoidFun { void apply(T1 o); public static final RuntimeType<VoidFun_0_1<?>> _RTT = new RuntimeType<VoidFun_0_1<?>>( VoidFun_0_1.class, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_1"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_2.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_2.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_2.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,21 +11,15 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_2<T1,T2> extends VoidFun, Any { +public interface VoidFun_0_2<T1,T2> extends VoidFun { void apply(T1 o1, T2 o2); public static final RuntimeType<VoidFun_0_2<?,?>> _RTT = new RuntimeType<VoidFun_0_2<?,?>>( VoidFun_0_2.class, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_2"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_3.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_3.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_3.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_3<T1,T2,T3> extends VoidFun, Any { +public interface VoidFun_0_3<T1,T2,T3> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3); public static final RuntimeType<VoidFun_0_3<?,?,?>> _RTT = new RuntimeType<VoidFun_0_3<?,?,?>>( @@ -23,10 +22,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_3"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_4.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_4.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_4.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_4<T1,T2,T3,T4> extends VoidFun, Any { +public interface VoidFun_0_4<T1,T2,T3,T4> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4); public static final RuntimeType<VoidFun_0_4<?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_4<?,?,?,?>>( @@ -24,10 +23,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_4"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_5.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_5.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_5.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_5<T1,T2,T3,T4,T5> extends VoidFun, Any { +public interface VoidFun_0_5<T1,T2,T3,T4,T5> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5); public static final RuntimeType<VoidFun_0_5<?,?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_5<?,?,?,?,?>>( @@ -25,10 +24,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_5"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_6.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_6.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_6.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_6<T1,T2,T3,T4,T5,T6> extends VoidFun, Any { +public interface VoidFun_0_6<T1,T2,T3,T4,T5,T6> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6); public static final RuntimeType<VoidFun_0_6<?,?,?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_6<?,?,?,?,?,?>>( @@ -26,10 +25,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_6"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_7.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_7.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_7.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_7<T1,T2,T3,T4,T5,T6,T7> extends VoidFun, Any { +public interface VoidFun_0_7<T1,T2,T3,T4,T5,T6,T7> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6, T7 o7); public static final RuntimeType<VoidFun_0_7<?,?,?,?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_7<?,?,?,?,?,?,?>>( @@ -27,10 +26,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_7"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_8.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_8.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_8.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_8<T1,T2,T3,T4,T5,T6,T7,T8> extends VoidFun, Any { +public interface VoidFun_0_8<T1,T2,T3,T4,T5,T6,T7,T8> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6, T7 o7, T8 o8); public static final RuntimeType<VoidFun_0_8<?,?,?,?,?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_8<?,?,?,?,?,?,?,?>>( @@ -28,10 +27,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_8"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_9.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_9.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_9.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -11,11 +11,10 @@ package x10.core.fun; -import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.RuntimeType.Variance; -public interface VoidFun_0_9<T1,T2,T3,T4,T5,T6,T7,T8,T9> extends VoidFun, Any { +public interface VoidFun_0_9<T1,T2,T3,T4,T5,T6,T7,T8,T9> extends VoidFun { void apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6, T7 o7, T8 o8, T9 o9); public static final RuntimeType<VoidFun_0_9<?,?,?,?,?,?,?,?,?>> _RTT = new RuntimeType<VoidFun_0_9<?,?,?,?,?,?,?,?,?>>( @@ -29,10 +28,5 @@ Variance.CONTRAVARIANT, Variance.CONTRAVARIANT, Variance.CONTRAVARIANT - ) { - @Override - public String typeName() { - return "x10.lang.VoidFun_0_9"; - } - }; + ); } Modified: trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-08-02 04:41:32 UTC (rev 15311) +++ trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-08-02 10:09:14 UTC (rev 15312) @@ -363,11 +363,9 @@ if (o instanceof VoidFun) { String str = "("; if (variances != null && variances.length > 0) { - if (o instanceof Any) { - for (int i = 0; i < variances.length; i++) { - if (i != 0) str += ","; - str += ((Any) o).getParam(i).typeName(); - } + for (int i = 0; i < variances.length; i++) { + if (i != 0) str += ","; + str += ((Any) o).getParam(i).typeName(); } } str += ")=>Void"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tos...@us...> - 2010-08-02 04:41:39
|
Revision: 15311 http://x10.svn.sourceforge.net/x10/?rev=15311&view=rev Author: toshio1suganuma Date: 2010-08-02 04:41:32 +0000 (Mon, 02 Aug 2010) Log Message: ----------- Fix of XTENLANG-1295 and 1413 Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/.classpath trunk/x10.runtime/build.xml trunk/x10.runtime/src-java/x10/rtt/Types.java trunk/x10.runtime/src-java/x10/rtt/UByteType.java trunk/x10.runtime/src-java/x10/rtt/UIntType.java trunk/x10.runtime/src-java/x10/rtt/ULongType.java trunk/x10.runtime/src-java/x10/rtt/UShortType.java trunk/x10.runtime/src-x10/x10/lang/Byte.x10 trunk/x10.runtime/src-x10/x10/lang/Int.x10 trunk/x10.runtime/src-x10/x10/lang/Long.x10 trunk/x10.runtime/src-x10/x10/lang/Short.x10 trunk/x10.runtime/src-x10/x10/lang/UByte.x10 trunk/x10.runtime/src-x10/x10/lang/UInt.x10 trunk/x10.runtime/src-x10/x10/lang/ULong.x10 trunk/x10.runtime/src-x10/x10/lang/UShort.x10 Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -964,7 +964,7 @@ && (t.isBoolean() || t.isNumeric() || t.isChar()) ) { w.write(X10_RTT_TYPES + ".as"); - new TypeExpander(er, t, 0).expand(tr); + new TypeExpander(er, t, NO_QUALIFIER).expand(tr); w.write("("); c.printSubExpr(expr, w, tr); w.write(")"); @@ -2562,6 +2562,7 @@ String val; if (n.kind() == X10IntLit_c.ULONG) { val = Long.toString(n.value()) + "L"; + val = "new x10.lang.ULong("+val+")"; } else if (n.kind() == IntLit_c.LONG) { val = Long.toString(n.value()) + "L"; @@ -2571,6 +2572,7 @@ val = "0x" + Long.toHexString(n.value() & 0xffffffffL); else val = Long.toString(n.value() & 0xffffffffL); + val = "new x10.lang.UInt("+val+")"; } else if (n.kind() == IntLit_c.INT) { if (n.value() >= 0x80000000L) Modified: trunk/x10.runtime/.classpath =================================================================== --- trunk/x10.runtime/.classpath 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/.classpath 2010-08-02 04:41:32 UTC (rev 15311) @@ -1,7 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src-java"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="classes"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src-java"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="lib" path="/x10.dist/lib/x10.jar"/> + <classpathentry kind="output" path="classes"/> +</classpath> Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/build.xml 2010-08-02 04:41:32 UTC (rev 15311) @@ -196,18 +196,19 @@ </target> <target name="dist" depends="dist-java,dist-cpp" description="generate part of the distribution"> </target> - <target name="jar" depends="build-xrx"> + <target name="jar" depends="build-java-xrx"> <jar jarfile="${build}/${jar}"> <fileset dir="${build}" includes="x10/**/*.class" excludes="${jar}"/> - <fileset dir="${build}/gen" includes="x10/**/*.class" excludes="${jar}"/> + <!--fileset dir="${build}/gen" includes="x10/**/*.class" excludes="${jar}"/--> <fileset dir="${basedir}/src-x10" includes="x10/**" excludes="${jar}"/> <fileset dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset dir="${x10.common.location}/classes" includes="x10/**"/> </jar> </target> - <target name="build-java" depends="init,gen-xrx"> + <target name="build-java-xrx" depends="init,gen-xrx"> <ejc destdir="${build}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${src}"/> + <src path="${gen}"/> <classpath> <path refid="project.classpath"/> </classpath> @@ -238,7 +239,7 @@ <arg value="'${x10.dist.location}/bin/x10c' ${x10c.optimize} ${x10c.inline_optimizations} ${x10c.no_checks} -d '${gen}' -J-ea -rtdev -sourcepath . -STATIC_CALLS -commandlineonly -c ${xrx.list}" /> </exec> </target> - <target name="build-xrx" depends="init,gen-xrx,build-java"> + <!--target name="build-xrx" depends="init,gen-xrx,build-java"--> <!-- <fileset id="generated.files" dir="${build}/gen" includes="**/*.java"/> <pathconvert property="generated.list" refid="generated.files" dirsep="/" pathsep=" "/> @@ -261,6 +262,7 @@ </classpath> </javac> --> + <!-- <ejc destdir="${gen}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${gen}"/> <size value="50" when="more"/> @@ -272,9 +274,9 @@ </path> </classpath> </ejc> - </target> + </target--> - <target name="jni-headers" depends="init,build-java"> + <target name="jni-headers" depends="init,build-java-xrx"> <javah destdir="x10rt/include"> <classpath> <path refid="project.classpath"/> @@ -309,7 +311,7 @@ </exec> </target> - <target name="build" depends="build-xrx,build-cpp"> + <target name="build" depends="build-java-xrx,build-cpp"> <echo message="${ant.project.name}: ${ant.file}"/> </target> Modified: trunk/x10.runtime/src-java/x10/rtt/Types.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -69,24 +69,44 @@ throw new ClassCastException(); } + public static x10.lang.UByte asUByte(Object typeParamOrAny){ + if (typeParamOrAny == null) {nullIsCastedToStruct();} + return (x10.lang.UByte)typeParamOrAny; + } + public static short asshort(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).shortValue();} throw new ClassCastException(); } + public static x10.lang.UShort asUShort(Object typeParamOrAny){ + if (typeParamOrAny == null) {nullIsCastedToStruct();} + return (x10.lang.UShort)typeParamOrAny; + } + public static int asint(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).intValue();} throw new ClassCastException(); } - + + public static x10.lang.UInt asUInt(Object typeParamOrAny){ + if (typeParamOrAny == null) {nullIsCastedToStruct();} + return (x10.lang.UInt)typeParamOrAny; + } + public static long aslong(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).longValue();} throw new ClassCastException(); } - + + public static x10.lang.ULong asULong(Object typeParamOrAny){ + if (typeParamOrAny == null) {nullIsCastedToStruct();} + return (x10.lang.ULong)typeParamOrAny; + } + public static float asfloat(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).floatValue();} Modified: trunk/x10.runtime/src-java/x10/rtt/UByteType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -17,7 +17,7 @@ public class UByteType extends RuntimeType<Byte> { public UByteType() { - super(byte.class); + super(x10.lang.UByte.class); } @Override @@ -27,7 +27,7 @@ @Override public boolean instanceof$(Object o) { - return o instanceof java.lang.Byte; + return o instanceof x10.lang.UByte; } @Override Modified: trunk/x10.runtime/src-java/x10/rtt/UIntType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -17,7 +17,7 @@ public class UIntType extends RuntimeType<Integer> { public UIntType() { - super(int.class); + super(x10.lang.UInt.class); } @Override @@ -27,7 +27,7 @@ @Override public boolean instanceof$(Object o) { - return o instanceof java.lang.Integer; + return o instanceof x10.lang.UInt; } @Override Modified: trunk/x10.runtime/src-java/x10/rtt/ULongType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -17,7 +17,7 @@ public class ULongType extends RuntimeType<Long> { public ULongType() { - super(long.class); + super(x10.lang.ULong.class); } @Override @@ -27,7 +27,7 @@ @Override public boolean instanceof$(Object o) { - return o instanceof java.lang.Long; + return o instanceof x10.lang.ULong; } @Override Modified: trunk/x10.runtime/src-java/x10/rtt/UShortType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-02 04:41:32 UTC (rev 15311) @@ -17,7 +17,7 @@ public class UShortType extends RuntimeType<Short> { public UShortType() { - super(short.class); + super(x10.lang.UShort.class); } @Override @@ -27,7 +27,7 @@ @Override public boolean instanceof$(Object o) { - return o instanceof java.lang.Short; + return o instanceof x10.lang.UShort; } @Override Modified: trunk/x10.runtime/src-x10/x10/lang/Byte.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Byte.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/Byte.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -288,7 +288,7 @@ * @param x the given UByte * @return the given UByte converted to a Byte. */ - @Native("java", "((byte)(#1))") + @Native("java", "((byte)(#1.byteVal))") @Native("c++", "((x10_byte) (#1))") public native static safe operator (x:UByte): Byte; Modified: trunk/x10.runtime/src-x10/x10/lang/Int.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Int.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/Int.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -290,7 +290,7 @@ * @param x the given UInt * @return the given UInt converted to an Int. */ - @Native("java", "((int) (#1))") + @Native("java", "((int) (#1.intVal))") @Native("c++", "((x10_int) (#1))") public native static safe operator (x:UInt): Int; Modified: trunk/x10.runtime/src-x10/x10/lang/Long.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Long.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/Long.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -288,7 +288,7 @@ * @param x the given ULong * @return the given ULong converted to a Long. */ - @Native("java", "((long)(#1))") + @Native("java", "((long)(#1.longVal))") @Native("c++", "((x10_long) (#1))") public native static safe operator (x:ULong): Long; Modified: trunk/x10.runtime/src-x10/x10/lang/Short.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Short.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/Short.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -288,7 +288,7 @@ * @param x the given UShort * @return the given UShort converted to a Short. */ - @Native("java", "((short)(#1))") + @Native("java", "((short)(#1.shortVal))") @Native("c++", "((x10_short) (#1))") public native static safe operator (x:UShort): Short; @@ -390,7 +390,7 @@ * two's complement binary representation of this Int. * @return the value obtained by reversing order of the bits in this Int. */ - @Native("java", "((short)(java.lang.Integer.reverse(#0)>>16))") + @Native("java", "((short)(java.lang.Integer.reverse(#0)>>>16))") @Native("c++", "((x10_short)(x10aux::int_utils::reverse(#0)>>16))") public native def reverse(): Short; Modified: trunk/x10.runtime/src-x10/x10/lang/UByte.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/UByte.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/UByte.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -23,9 +23,16 @@ * that define conversions from other data types, including String, * as well as some UByte constants. */ -@NativeRep("java", "byte", null, "x10.rtt.Types.UBYTE") +// @NativeRep("java", "byte", null, "x10.rtt.Types.UBYTE") @NativeRep("c++", "x10_ubyte", "x10_ubyte", null) public final struct UByte /*TODO implements Arithmetic[UByte], Bitwise[UByte], Ordered[UByte]*/ { + + /** The actual number with Byte representation */ + public val byteVal:Byte; + public def this(value:Byte) { + this.byteVal = value; + } + /** * A less-than operator. * Compares the given UByte with another UByte and returns true if the given UByte is @@ -34,9 +41,11 @@ * @param y the other UByte * @return true if the given UByte is strictly less than the other UByte. */ - @Native("java", "x10.core.Unsigned.lt(#1, #2)") + // @Native("java", "x10.core.Unsigned.lt(#1, #2)") @Native("c++", "((#1) < (#2))") - public native static safe operator (x:UByte) < (y:UByte): Boolean; + public static safe operator (x:UByte) < (y:UByte): Boolean { + return (x.byteVal + Byte.MIN_VALUE) < (y.byteVal + Byte.MIN_VALUE); + } /** * A greater-than operator. @@ -46,9 +55,11 @@ * @param y the other UByte * @return true if the given UByte is strictly greater than the other UByte. */ - @Native("java", "x10.core.Unsigned.gt(#1, #2)") + // @Native("java", "x10.core.Unsigned.gt(#1, #2)") @Native("c++", "((#1) > (#2))") - public native static safe operator (x:UByte) > (y:UByte): Boolean; + public static safe operator (x:UByte) > (y:UByte): Boolean { + return (x.byteVal + Byte.MIN_VALUE) > (y.byteVal + Byte.MIN_VALUE); + } /** * A less-than-or-equal-to operator. @@ -58,9 +69,11 @@ * @param y the other UByte * @return true if the given UByte is less than or equal to the other UByte. */ - @Native("java", "x10.core.Unsigned.le(#1, #2)") + // @Native("java", "x10.core.Unsigned.le(#1, #2)") @Native("c++", "((#1) <= (#2))") - public native static safe operator (x:UByte) <= (y:UByte): Boolean; + public static safe operator (x:UByte) <= (y:UByte): Boolean { + return (x.byteVal + Byte.MIN_VALUE) <= (y.byteVal + Byte.MIN_VALUE); + } /** * A greater-than-or-equal-to operator. @@ -70,9 +83,11 @@ * @param y the other UByte * @return true if the given UByte is greater than or equal to the other UByte. */ - @Native("java", "x10.core.Unsigned.ge(#1, #2)") + // @Native("java", "x10.core.Unsigned.ge(#1, #2)") @Native("c++", "((#1) >= (#2))") - public native static safe operator (x:UByte) >= (y:UByte): Boolean; + public static safe operator (x:UByte) >= (y:UByte): Boolean { + return (x.byteVal + Byte.MIN_VALUE) >= (y.byteVal + Byte.MIN_VALUE); + } /** @@ -83,24 +98,24 @@ * @param y the other UByte * @return the sum of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) + (#2)))") + // @Native("java", "((byte) ((#1) + (#2)))") @Native("c++", "((x10_ubyte) ((#1) + (#2)))") - public native static safe operator (x:UByte) + (y:UByte): UByte; + public static safe operator (x:UByte) + (y:UByte): UByte = UByte(x.byteVal + y.byteVal); /** * A binary plus operator (unsigned disambiguation). * @see #operator(UByte)+(UByte) */ - @Native("java", "((byte) ((#1) + (#2)))") + // @Native("java", "((byte) ((#1) + (#2)))") @Native("c++", "((x10_ubyte) ((#1) + (#2)))") - public native static safe operator (x:Byte) + (y:UByte): UByte; + public static safe operator (x:Byte) + (y:UByte): UByte = UByte(x + y.byteVal); /** * A binary plus operator (unsigned disambiguation). * @see #operator(UByte)+(UByte) */ - @Native("java", "((byte) ((#1) + (#2)))") + // @Native("java", "((byte) ((#1) + (#2)))") @Native("c++", "((x10_ubyte) ((#1) + (#2)))") - public native static safe operator (x:UByte) + (y:Byte): UByte; + public static safe operator (x:UByte) + (y:Byte): UByte = UByte(x.byteVal + y); /** * A binary minus operator. @@ -110,24 +125,24 @@ * @param y the other UByte * @return the difference of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) - (#2)))") + // @Native("java", "((byte) ((#1) - (#2)))") @Native("c++", "((x10_ubyte) ((#1) - (#2)))") - public native static safe operator (x:UByte) - (y:UByte): UByte; + public static safe operator (x:UByte) - (y:UByte): UByte = UByte(x.byteVal - y.byteVal); /** * A binary minus operator (unsigned disambiguation). * @see #operator(UByte)-(UByte) */ - @Native("java", "((byte) ((#1) - (#2)))") + // @Native("java", "((byte) ((#1) - (#2)))") @Native("c++", "((x10_ubyte) ((#1) - (#2)))") - public native static safe operator (x:Byte) - (y:UByte): UByte; + public static safe operator (x:Byte) - (y:UByte): UByte = UByte(x - y.byteVal); /** * A binary minus operator (unsigned disambiguation). * @see #operator(UByte)-(UByte) */ - @Native("java", "((byte) ((#1) - (#2)))") + // @Native("java", "((byte) ((#1) - (#2)))") @Native("c++", "((x10_ubyte) ((#1) - (#2)))") - public native static safe operator (x:UByte) - (y:Byte): UByte; + public static safe operator (x:UByte) - (y:Byte): UByte = UByte(x.byteVal - y); /** * A binary multiply operator. @@ -137,24 +152,24 @@ * @param y the other UByte * @return the product of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) * (#2)))") + // @Native("java", "((byte) ((#1) * (#2)))") @Native("c++", "((x10_ubyte) ((#1) * (#2)))") - public native static safe operator (x:UByte) * (y:UByte): UByte; + public static safe operator (x:UByte) * (y:UByte): UByte = UByte(x.byteVal * y.byteVal); /** * A binary multiply operator (unsigned disambiguation). * @see #operator(UByte)*(UByte) */ - @Native("java", "((byte) ((#1) * (#2)))") + // @Native("java", "((byte) ((#1) * (#2)))") @Native("c++", "((x10_ubyte) ((#1) * (#2)))") - public native static safe operator (x:Byte) * (y:UByte): UByte; + public static safe operator (x:Byte) * (y:UByte): UByte = UByte(x * y.byteVal); /** * A binary multiply operator (unsigned disambiguation). * @see #operator(UByte)*(UByte) */ - @Native("java", "((byte) ((#1) * (#2)))") + // @Native("java", "((byte) ((#1) * (#2)))") @Native("c++", "((x10_ubyte) ((#1) * (#2)))") - public native static safe operator (x:UByte) * (y:Byte): UByte; + public static safe operator (x:UByte) * (y:Byte): UByte = UByte(x.byteVal * y); /** * A binary divide operator. @@ -163,23 +178,29 @@ * @param y the other UByte * @return the quotient of the given UByte and the other UByte. */ - @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) / (#2)))") - public native static safe operator (x:UByte) / (y:UByte): UByte; + public static safe operator (x:UByte) / (y:UByte): UByte { + return UByte(((x.byteVal as Long) / (y.byteVal as Long)) as Byte); + } /** * A binary divide operator (unsigned disambiguation). * @see #operator(UByte)/(UByte) */ - @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) / (#2)))") - public native static safe operator (x:Byte) / (y:UByte): UByte; + public static safe operator (x:Byte) / (y:UByte): UByte { + return UByte(((x as Long) / (y.byteVal as Long)) as Byte); + } /** * A binary divide operator (unsigned disambiguation). * @see #operator(UByte)/(UByte) */ - @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.div(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) / (#2)))") - public native static safe operator (x:UByte) / (y:Byte): UByte; + public static safe operator (x:UByte) / (y:Byte): UByte { + return UByte(((x.byteVal as Long) / (y as Long)) as Byte); + } /** * A binary remainder operator. @@ -188,23 +209,29 @@ * @param y the other UByte * @return the remainder from dividing the given UByte by the other UByte. */ - @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) % (#2)))") - public native static safe operator (x:UByte) % (y:UByte): UByte; + public static safe operator (x:UByte) % (y:UByte): UByte { + return UByte(((x.byteVal as Long) % (y.byteVal as Long)) as Byte); + } /** * A binary remainder operator (unsigned disambiguation). * @see #operator(UByte)%(UByte) */ - @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) % (#2)))") - public native static safe operator (x:Byte) % (y:UByte): UByte; + public static safe operator (x:Byte) % (y:UByte): UByte { + return UByte(((x as Long) % (y.byteVal as Long)) as Byte); + } /** * A binary remainder operator (unsigned disambiguation). * @see #operator(UByte)%(UByte) */ - @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") + // @Native("java", "((byte) x10.core.Unsigned.rem(#1, #2))") @Native("c++", "((x10_ubyte) ((#1) % (#2)))") - public native static safe operator (x:UByte) % (y:Byte): UByte; + public static safe operator (x:UByte) % (y:Byte): UByte { + return UByte(((x.byteVal as Long) % (y as Long)) as Byte); + } /** * A unary plus operator. @@ -212,9 +239,9 @@ * @param x the given UByte * @return the value of the given UByte. */ - @Native("java", "((byte) +(#1))") + // @Native("java", "((byte) +(#1))") @Native("c++", "((x10_ubyte) +(#1))") - public native static safe operator + (x:UByte): UByte; + public static safe operator + (x:UByte): UByte = x; /** * A unary minus operator. @@ -223,9 +250,9 @@ * @param x the given UByte * @return the two's complement of the given UByte. */ - @Native("java", "((byte) -(#1))") + // @Native("java", "((byte) -(#1))") @Native("c++", "((x10_ubyte) -(#1))") - public native static safe operator - (x:UByte): UByte; + public static safe operator - (x:UByte): UByte = UByte(-(x.byteVal)); /** @@ -235,23 +262,23 @@ * @param y the other UByte * @return the bitwise AND of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) & (#2)))") + // @Native("java", "((byte) ((#1) & (#2)))") @Native("c++", "((x10_ubyte) ((#1) & (#2)))") - public native static safe operator (x:UByte) & (y:UByte): UByte; + public static safe operator (x:UByte) & (y:UByte): UByte = UByte(x.byteVal & y.byteVal); /** * A bitwise and operator (unsigned disambiguation). * @see #operator(UByte)&(UByte) */ - @Native("java", "((byte) ((#1) & (#2)))") + // @Native("java", "((byte) ((#1) & (#2)))") @Native("c++", "((x10_ubyte) ((#1) & (#2)))") - public native static safe operator (x:Byte) & (y:UByte): UByte; + public static safe operator (x:Byte) & (y:UByte): UByte = UByte(x & y.byteVal); /** * A bitwise and operator (unsigned disambiguation). * @see #operator(UByte)&(UByte) */ - @Native("java", "((byte) ((#1) & (#2)))") + // @Native("java", "((byte) ((#1) & (#2)))") @Native("c++", "((x10_ubyte) ((#1) & (#2)))") - public native static safe operator (x:UByte) & (y:Byte): UByte; + public static safe operator (x:UByte) & (y:Byte): UByte = UByte(x.byteVal & y); /** * A bitwise or operator. @@ -260,23 +287,23 @@ * @param y the other UByte * @return the bitwise OR of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) | (#2)))") + // @Native("java", "((byte) ((#1) | (#2)))") @Native("c++", "((x10_ubyte) ((#1) | (#2)))") - public native static safe operator (x:UByte) | (y:UByte): UByte; + public static safe operator (x:UByte) | (y:UByte): UByte = UByte(x.byteVal | y.byteVal); /** * A bitwise or operator (unsigned disambiguation). * @see #operator(UByte)|(UByte) */ - @Native("java", "((byte) ((#1) | (#2)))") + // @Native("java", "((byte) ((#1) | (#2)))") @Native("c++", "((x10_ubyte) ((#1) | (#2)))") - public native static safe operator (x:Byte) | (y:UByte): UByte; + public static safe operator (x:Byte) | (y:UByte): UByte = UByte(x | y.byteVal); /** * A bitwise or operator (unsigned disambiguation). * @see #operator(UByte)|(UByte) */ - @Native("java", "((byte) ((#1) | (#2)))") + // @Native("java", "((byte) ((#1) | (#2)))") @Native("c++", "((x10_ubyte) ((#1) | (#2)))") - public native static safe operator (x:UByte) | (y:Byte): UByte; + public static safe operator (x:UByte) | (y:Byte): UByte = UByte(x.byteVal | y); /** * A bitwise xor operator. @@ -285,23 +312,23 @@ * @param y the other UByte * @return the bitwise XOR of the given UByte and the other UByte. */ - @Native("java", "((byte) ((#1) ^ (#2)))") + // @Native("java", "((byte) ((#1) ^ (#2)))") @Native("c++", "((x10_ubyte) ((#1) ^ (#2)))") - public native static safe operator (x:UByte) ^ (y:UByte): UByte; + public static safe operator (x:UByte) ^ (y:UByte): UByte = UByte(x.byteVal ^ y.byteVal); /** * A bitwise xor operator (unsigned disambiguation). * @see #operator(UByte)^(UByte) */ - @Native("java", "((byte) ((#1) ^ (#2)))") + // @Native("java", "((byte) ((#1) ^ (#2)))") @Native("c++", "((x10_ubyte) ((#1) ^ (#2)))") - public native static safe operator (x:Byte) ^ (y:UByte): UByte; + public static safe operator (x:Byte) ^ (y:UByte): UByte = UByte(x ^ y.byteVal); /** * A bitwise xor operator (unsigned disambiguation). * @see #operator(UByte)^(UByte) */ - @Native("java", "((byte) ((#1) ^ (#2)))") + // @Native("java", "((byte) ((#1) ^ (#2)))") @Native("c++", "((x10_ubyte) ((#1) ^ (#2)))") - public native static safe operator (x:UByte) ^ (y:Byte): UByte; + public static safe operator (x:UByte) ^ (y:Byte): UByte = UByte(x.byteVal ^ y); /** * A bitwise left shift operator. @@ -311,9 +338,9 @@ * @param count the shift count * @return the given UByte shifted left by count. */ - @Native("java", "((byte) ((#1) << (#2)))") + // @Native("java", "((byte) ((#1) << (#2)))") @Native("c++", "((x10_ubyte) ((#1) << (#2)))") - public native static safe operator (x:UByte) << (count:Int): UByte; + public static safe operator (x:UByte) << (count:Int): UByte = UByte(x.byteVal << count); /** * A bitwise right shift operator. @@ -324,9 +351,9 @@ * @param count the shift count * @return the given UByte shifted right by count. */ - @Native("java", "((byte) ((#1) >>> (#2)))") + // @Native("java", "((byte) ((#1) >>> (#2)))") @Native("c++", "((x10_ubyte) ((#1) >> (#2)))") - public native static safe operator (x:UByte) >> (count:Int): UByte; + public static safe operator (x:UByte) >> (count:Int): UByte = UByte(x.byteVal >>> count); /** * A bitwise logical right shift operator (zero-fill). @@ -338,9 +365,9 @@ * @param count the shift count * @return the given UByte shifted right by count with high bits zero-filled. */ - @Native("java", "((byte) ((#1) >>> (#2)))") + // @Native("java", "((byte) ((#1) >>> (#2)))") @Native("c++", "((x10_ubyte) ((#1) >> (#2)))") - public native static safe operator (x:UByte) >>> (count:Int): UByte; + public static safe operator (x:UByte) >>> (count:Int): UByte = UByte(x.byteVal >>> count); /** * A bitwise complement operator. @@ -348,9 +375,9 @@ * @param x the given UByte * @return the bitwise complement of the given UByte. */ - @Native("java", "((byte) ~(#1))") + // @Native("java", "((byte) ~(#1))") @Native("c++", "((x10_ubyte) ~(#1))") - public native static safe operator ~ (x:UByte): UByte; + public static safe operator ~ (x:UByte): UByte = UByte(~(x.byteVal)); /** @@ -358,27 +385,27 @@ * @param x the given UShort * @return the given UShort converted to a UByte. */ - @Native("java", "((byte)(short)(#1))") + // @Native("java", "((byte)(short)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:UShort) as UByte; + public static safe operator (x:UShort) as UByte = UByte(x.shortVal as Byte); /** * Convert a given UInt to a UByte. * @param x the given UInt * @return the given UInt converted to a UByte. */ - @Native("java", "((byte)(int)(#1))") + // @Native("java", "((byte)(int)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:UInt) as UByte; + public static safe operator (x:UInt) as UByte = UByte(x.intVal as Byte); /** * Convert a given ULong to a UByte. * @param x the given ULong * @return the given ULong converted to a UByte. */ - @Native("java", "((byte)(long)(#1))") + // @Native("java", "((byte)(long)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:ULong) as UByte; + public static safe operator (x:ULong) as UByte = UByte(x.longVal as Byte); /** @@ -386,54 +413,54 @@ * @param x the given Short * @return the given Short converted to a UByte. */ - @Native("java", "((byte)(short)(#1))") + // @Native("java", "((byte)(short)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Short) as UByte; + public static safe operator (x:Short) as UByte = UByte(x as Byte); /** * Convert a given Int to a UByte. * @param x the given Int * @return the given Int converted to a UByte. */ - @Native("java", "((byte)(int)(#1))") + // @Native("java", "((byte)(int)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Int) as UByte; + public static safe operator (x:Int) as UByte = UByte(x as Byte); /** * Convert a given Long to a UByte. * @param x the given Long * @return the given Long converted to a UByte. */ - @Native("java", "((byte)(long)(#1))") + // @Native("java", "((byte)(long)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Long) as UByte; + public static safe operator (x:Long) as UByte = UByte(x as Byte); /** * Convert a given Float to a UByte. * @param x the given Float * @return the given Float converted to a UByte. */ - @Native("java", "x10.core.Floats.toUByte(#1)") + // @Native("java", "x10.core.Floats.toUByte(#1)") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Float) as UByte; + public static safe operator (x:Float) as UByte = UByte(x as Byte); /** * Convert a given Double to a UByte. * @param x the given Double * @return the given Double converted to a UByte. */ - @Native("java", "x10.core.Floats.toUByte(#1)") + // @Native("java", "x10.core.Floats.toUByte(#1)") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Double) as UByte; + public static safe operator (x:Double) as UByte = UByte(x as Byte); /** * Coerce a given Byte to a UByte. * @param x the given Byte * @return the given Byte converted to a UByte. */ - @Native("java", "((byte)(#1))") + // // @Native("java", "((byte)(#1))") @Native("c++", "((x10_ubyte) (#1))") - public native static safe operator (x:Byte): UByte; + public static safe operator (x:Byte): UByte = UByte(x); /** @@ -456,55 +483,59 @@ * @param radix the radix to use in the String representation * @return a String representation of this UByte in the specified radix. */ - @Native("java", "java.lang.Integer.toString((#0) & 0xff, #1)") + // @Native("java", "java.lang.Integer.toString((#0) & 0xff, #1)") @Native("c++", "x10aux::int_utils::toString((#0) & 0xff, #1)") - public global safe native def toString(radix:Int): String; + public global safe def toString(radix:Int): String = ((this.byteVal & 0xFF) as Int).toString(radix); /** * Returns a String representation of this UByte as a hexadecimal number. * @return a String representation of this UByte as a hexadecimal number. */ - @Native("java", "java.lang.Integer.toHexString((#0) & 0xff)") + // @Native("java", "java.lang.Integer.toHexString((#0) & 0xff)") @Native("c++", "x10aux::int_utils::toHexString((#0) & 0xff)") - public global safe native def toHexString(): String; + public global safe def toHexString(): String = this.byteVal.toHexString(); /** * Returns a String representation of this UByte as an octal number. * @return a String representation of this UByte as an octal number. */ - @Native("java", "java.lang.Integer.toOctalString((#0) & 0xff)") + // @Native("java", "java.lang.Integer.toOctalString((#0) & 0xff)") @Native("c++", "x10aux::int_utils::toOctalString((#0) & 0xff)") - public global safe native def toOctalString(): String; + public global safe def toOctalString(): String = this.byteVal.toOctalString(); /** * Returns a String representation of this UByte as a binary number. * @return a String representation of this UByte as a binary number. */ - @Native("java", "java.lang.Integer.toBinaryString((#0) & 0xff)") + // @Native("java", "java.lang.Integer.toBinaryString((#0) & 0xff)") @Native("c++", "x10aux::int_utils::toBinaryString((#0) & 0xff)") - public global safe native def toBinaryString(): String; + public global safe def toBinaryString(): String = this.byteVal.toBinaryString(); /** * Returns a String representation of this UByte as a decimal number. * @return a String representation of this UByte as a decimal number. */ - @Native("java", "java.lang.Integer.toString((#0) & 0xff)") + // @Native("java", "java.lang.Integer.toString((#0) & 0xff)") @Native("c++", "x10aux::to_string(#0)") - public global safe native def toString(): String; + public global safe def toString(): String = ((this.byteVal & 0xFF) as Int).toString(); /** * @deprecated use {@link #parse(String,Int)} instead */ - @Native("java", "((byte) (java.lang.Integer.parseInt(#1, #2) & 0xff))") + // @Native("java", "((byte) (java.lang.Integer.parseInt(#1, #2) & 0xff))") @Native("c++", "((x10_ubyte) x10aux::int_utils::parseInt(#1, #2))") - public native static def parseUByte(String, radix:Int): UByte throws NumberFormatException; + public static def parseUByte(s:String, radix:Int): UByte throws NumberFormatException { + return UByte(Byte.parse(s, radix)); + } /** * @deprecated use {@link #parse(String)} instead */ - @Native("java", "java.lang.Integer.parseInt(#1)") + // @Native("java", "java.lang.Integer.parseInt(#1)") @Native("c++", "x10aux::int_utils::parseInt(#1)") - public native static def parseUByte(String): UByte throws NumberFormatException; + public static def parseUByte(s:String): UByte throws NumberFormatException { + return UByte(Byte.parse(s)); + } /** * Parses the String argument as a UByte in the radix specified by the second argument. @@ -513,9 +544,11 @@ * @return the UByte represented by the String argument in the specified radix. * @throws NumberFormatException if the String does not contain a parsable UByte. */ - @Native("java", "((byte) (java.lang.Integer.parseInt(#1, #2) & 0xff))") + // @Native("java", "((byte) (java.lang.Integer.parseInt(#1, #2) & 0xff))") @Native("c++", "((x10_ubyte) x10aux::int_utils::parseInt(#1, #2))") - public native static def parse(s:String, radix:Int): UByte throws NumberFormatException; + public static def parse(s:String, radix:Int): UByte throws NumberFormatException { + return UByte(Byte.parse(s, radix)); + } /** * Parses the String argument as a decimal UByte. @@ -523,9 +556,11 @@ * @return the UByte represented by the String argument. * @throws NumberFormatException if the String does not contain a parsable UByte. */ - @Native("java", "java.lang.Integer.parseInt(#1)") + // @Native("java", "java.lang.Integer.parseInt(#1)") @Native("c++", "x10aux::int_utils::parseInt(#1)") - public native static def parse(s:String): UByte throws NumberFormatException; + public static def parse(s:String): UByte throws NumberFormatException { + return UByte(Byte.parse(s)); + } /** @@ -533,18 +568,18 @@ * binary representation of this UByte. * @return the value obtained by reversing order of the bits in this UByte. */ - @Native("java", "((byte)(java.lang.Integer.reverse(#0)>>>24))") + // @Native("java", "((byte)(java.lang.Integer.reverse(#0)>>>24))") @Native("c++", "((x10_ubyte)(x10aux::int_utils::reverse(#0)>>24))") - public native def reverse(): Byte; + public def reverse(): UByte = UByte(this.byteVal.reverse()); /** * Returns the signum function of this UByte. The return value is 0 if * this UByte is zero and 1 if this UByte is non-zero. * @return the signum function of this UByte. */ - @Native("java", "(((#0)==0) ? 0 : 1)") + // @Native("java", "(((#0)==0) ? 0 : 1)") @Native("c++", "(((#0)==0U) ? 0 : 1)") - public native def signum(): Int; + public def signum(): Int = (this.byteVal == 0) ? 0 : 1; /** @@ -553,16 +588,16 @@ * @param x the given entity * @return true if this UByte is equal to the given entity. */ - @Native("java", "x10.rtt.Equality.equalsequals(#0, #1)") + // @Native("java", "x10.rtt.Equality.equalsequals(#0, #1)") @Native("c++", "x10aux::equals(#0,#1)") - public global safe native def equals(x:Any):Boolean; + public global safe def equals(x:Any):Boolean = this.byteVal.equals(x); /** * Returns true if this UByte is equal to the given UByte. * @param x the given UByte * @return true if this UByte is equal to the given UByte. */ - @Native("java", "x10.rtt.Equality.equalsequals(#0, #1)") + // @Native("java", "x10.rtt.Equality.equalsequals(#0, #1)") @Native("c++", "x10aux::equals(#0,#1)") - public global safe native def equals(x:UByte):Boolean; + public global safe def equals(x:UByte):Boolean = this.byteVal.equals(x); } Modified: trunk/x10.runtime/src-x10/x10/lang/UInt.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/UInt.x10 2010-08-02 01:55:20 UTC (rev 15310) +++ trunk/x10.runtime/src-x10/x10/lang/UInt.x10 2010-08-02 04:41:32 UTC (rev 15311) @@ -23,11 +23,18 @@ * that define conversions from other data types, including String, * as well as some UInt constants. */ -@NativeRep("java", "int", null, "x10.rtt.Types.UINT") +// @NativeRep("java", "int", null, "x10.rtt.Types.UINT") // v-- when used @NativeRep("c++", "x10_uint", "x10_uint", null) // ^ when constructed public final struct UInt /*TODO implements Arithmetic[UInt], Bitwise[UInt], Ordered[UInt]*/ { + + /** The actual number with Int representation */ + public val intVal:Int; + public def this(value:Int) { + this.intVal = value; + } + /** * A less-than operator. * Compares the given UInt with another UInt and returns true if the given UInt is @@ -36,9 +43,11 @@ * @param y the other UInt * @return true if the given UInt is strictly less than the other UInt. */ - @Native("java", "x10.core.Unsigned.lt(#1, #2)") + // @Native("java", "x10.core.Unsigned.lt(#1, #2)") @Native("c++", "((#1) < (#2))") - public native static safe operator (x:UInt) < (y:UInt): Boolean; + public static safe operator (x:UInt) < (y:UInt): Boolean { + return (x.intVal + Int.MIN_VALUE) < (y.intVal + Int.MIN_VALUE); + } /** * A greater-than operator. @@ -48,9 +57,11 @@ * @param y the other UInt * @return true if the given UInt is strictly greater than the other UInt. */ - @Native("java", "x10.core.Unsigned.gt(#1, #2)") + // @Native("java", "x10.core.Unsigned.gt(#1, #2)") @Native("c++", "((#1) > (#2))") - public native static safe operator (x:UInt) > (y:UInt): Boolean; + public static safe operator (x:UInt) > (y:UInt): Boolean { + return (x.intVal + Int.MIN_VALUE) > (y.intVal + Int.MIN_VALUE); + } /** * A less-than-or-equal-to operator. @@ -60,9 +71,11 @@ * @param y the other UInt * @return true if the given UInt is less than or equal to the other UInt. */ - @Native("java", "x10.core.Unsigned.le(#1, #2)") + // @Native("java", "x10.core.Unsigned.le(#1, #2)") @Native("c++", "((#1) <= (#2))") - public native static safe operator (x:UInt) <= (y:UInt): Boolean; + public static safe operator (x:UInt) <= (y:UInt): Boolean { + return (x.intVal + Int.MIN_VALUE) <= (y.intVal + Int.MIN_VALUE); + } /** * A greater-than-or-equal-to operator. @@ -72,9 +85,11 @@ * @param y the other UInt * @return true if the given UInt is greater than or equal to the other UInt. */ - @Native("java", "x10.core.Unsigned.ge(#1, #2)") + // @Native("java", "x10.core.Unsigned.ge(#1, #2)") @Native("c++", "((#1) >= (#2))") - public native static safe operator (x:UInt) >= (y:UInt): Boolean; + public static safe operator (x:UInt) >= (y:UInt): Boolean { + return (x.intVal + Int.MIN_VALUE) >= (y.intVal + Int.MIN_VALUE); + } /** @@ -85,23 +100,23 @@ * @param y the other UInt * @return the sum of the given UInt and the other UInt. */ - @Native("java", "((#1) + (#2))") + // @Native("java", "((#1) + (#2))") @Native("c++", "((x10_uint) ((#1) + (#2)))") - public native static safe operator (x:UInt) + (y:UInt): UInt; + public static safe operator (x:UInt) + (y:UInt): UInt = UInt(x.intVal + y.intVal); /** * A binary plus operator (unsigned disambiguation). * @see #operator(UInt)+(UInt) */ - @Native("java", "((#1) + (#2))") + // @Native("java", "((#1) + (#2))") @Native("c++", "((x10_uint) ((#1) + (#2)))") - public native static safe operator (x:Int) + (y:UInt): UInt; + public static safe operator (x:Int) + (y:UInt): UInt = UInt(x + y.intVal); /** * A binary plus operator (unsigned disambiguation). * @see #operator(UInt)+(UInt) */ - @Native("java", "((#1) + (#2))") + // @Native("java", "((#1) + (#2))") @Native("c++", "((x10_uint) ((#1) + (#2)))") - public native static safe operator (x:UInt) + (y:Int): UInt; + public static safe operator (x:UInt) + (y:Int): UInt = UInt(x.intVal + y); /** * A binary minus operator. @@ -111,23 +126,23 @@ * @param y the other UInt * @return the difference of the given UInt and the other UInt. */ - @Native("java", "((#1) - (#2))") + // @Native("java", "((#1) - (#2))") @Native("c++", "((x10_uint) ((#1) - (#2)))") - public native static safe operator (x:UInt) - (y:UInt): UInt; + public static safe operator (x:UInt) - (y:UInt): UInt = UInt(x.intVal - y.intVal); /** * A binary minus operator (unsigned disambiguation). * @see #operator(UInt)-(UInt) */ - @Native("java", "((#1) - (#2))") + // @Native("java", "((#1) - (#2))") @Native("c++", "((x10_uint) ((#1) - (#2)))") - public native static safe operator (x:Int) - (y:UInt): UInt; + public static safe operator (x:Int) - (y:UInt): UInt = UInt(x - y.intVal); /** * A binary minus operator (unsigned disambiguation). * @see #operator(UInt)-(UInt) */ - @Native("java", "((#1) - (#2))") + // @Native("java", "((#1) - (#2))") @Native("c++", "((x10_uint) ((#1) - (#2)))") - public native static safe operator (x:UInt) - (y:Int): UInt; + public static safe operator (x:UInt) - (y:Int): UInt = UInt(x.intVal - y); /** * A binary multiply operator. @@ -137,23 +152,23 @@ * @param y the other UInt * @return the product of the given UInt and the other UInt. */ - @Native("java", "((#1) * (#2))") + // @Native("java", "((#1) * (#2))") @Native("c++", "((x10_uint) ((#1) * (#2)))") - public native static safe operator (x:UInt) * (y:UInt): UInt; + public static safe operator (x:UInt) * (y:UInt): UInt = UInt(x.intVal * y.intVal); /** * A binary multiply operator (unsigned disambiguation). * @see #operator(UInt)*(UInt) */ - @Native("java", "((#1) * (#2))") + // @Native("java", "((#1) * (#2))") @Native("c++", "((x10_uint) ((#1) * (#2)))") - public native static safe operator (x:Int) * (y:UInt): UInt; + public static safe operator (x:Int) * (y:UInt): UInt = UInt(x * y.intVal); /** * A binary multiply operator (unsigned disambiguation). * @see #operator(UInt)*(UInt) */ - @Native("java", "((#1) * (#2))") + // @Native("java", "((#1) * (#2))") @Native("c++", "((x10_uint) ((#1) * (#2)))") - public native static safe operator (x:UInt) * (y:Int): UInt; + public static safe operator (x:UInt) * (y:Int): UInt = UInt(x.intVal * y); /** * A binary divide operator. @@ -162,23 +177,29 @@ * @param y the other UInt * @return the quotient of the given UInt and the other UInt. */ - @Native("java", "x10.core.Unsigned.div(#1, #2)") + // @Native("java", "x10.core.Unsigned.div(#1, #2)") @Native("c++", "((x10_uint) ((#1) / (#2)))") - public native static safe operator (x:UInt) / (y:UInt): UInt; + public static safe operator (x:UInt) / (y:UInt): UInt { + return UInt(((x.intVal as Long) / (y.intVal as Long)) as Int); + } /** * A binary divide operator (unsigned disambiguation). * @see #operator(UInt)/(UInt) */ - @Native("java", "x10.core.Unsigned.div(#1, #2)") + // @Native("java", "x10.core.Unsigned.div(#1, #2)") @Native("c++", "((x10_uint) ((#1) / (#2)))") - public native static safe operator (x:Int) / (y:UInt): UInt; + public static safe operator (x:Int) / (y:UInt): UInt { + return UInt(((x as Long) / (y.intVal as Long)) as Int); + } /** * A binary divide operator (unsigned disambiguation). * @see #operator(UInt)/(UInt) */ - @Native("java", "x10.core.Unsigned.div(#1, #2)") + // @Native("java", "x10.core.Unsigned.div(#1, #2)") @Native("c++", "((x10_uint) ((#1) / (#2)))") - public native static safe operator (x:UInt) / (y:Int): UInt; + public static safe operator (x:UInt) / (y:Int): UInt { + return UInt(((x.intVal as Long) / (y as Long)) as Int); + } /** * A binary remainder operator. @@ -187,23 +208,29 @@ * @param y the other UInt * @return the remainder from dividing the given UInt by the other UInt. */ - @Native("java", "x10.core.Unsigned.rem(#1, #2)") + // @Native("java", "x10.core.Unsigned.rem(#1, #2)") @Native("c++", "((x10_uint) ((#1) % (#2)))") - public native static safe operator (x:UInt) % (y:UInt): UInt; + public static safe operator (x:UInt) % (y:UInt): UInt { + return UInt(((x.intVal as Long) % (y.intVal as Long)) as Int); + } /** * A binary remainder operator (unsigned disambiguation). * @see #operator(UInt)%(UInt) */ - @Native("java", "x10.core.Unsigned.rem(#1, #2)") + // @Native("java", "x10.core.Unsigned.rem(#1, #2)") @Native("c++", "((x10_uint) ((#1) % (#2)))") - public native static safe operator (x:Int) % (y:UInt): UInt; + public static safe operator (x:Int) % (y:UInt): UInt { + return UInt(((x as Long) % (y.intVal as Long)) as Int); + } /** * A binary remainder operator (unsigned disambiguation). * @see #operator(UInt)%(UInt) */ - @Native("java", "x10.core.Unsigned.rem(#1, #2)") + // @Native("java", "x10.core.Unsigned.rem(#1, #2)") @Native("c++", "((x10_uint) ((#1) % (#2)))") - public native static safe operator (x:UInt) % (y:Int): UInt; + public static safe operator (x:UInt) % (y:Int): UInt { + return UInt(((x.intVal as Long) % (y as Long)) as Int); + } /** * A unary plus operator. @@ -211,9 +238,9 @@ * @param x the given UInt * @return the value of the given UInt. */ - @Native("java", "((int) +(#1))") + // @Native("java", "((int) +(#1))") @Native("c++", "((x10_uint) +(#1))") - public native static safe operator + (x:UInt): UInt; + public static safe operator + (x:UInt): UInt = x; /** * A unary minus operator. @@ -222,9 +249,9 @@ * @param x the given UInt * @return the two's complement of the given UInt. */ - @Native("java", "((int) -(#1))") + // @Native("java", "((int) -(#1))") @Native("c++", "((x10_int) -(#1))") - public native static safe operator - (x:UInt): UInt; + public static safe operator - (x:UInt): UInt = UInt(-(x.intVal)); /** @@ -234,23 +261,23 @@ * @param y the other UInt * @return the bitwise AND of the given UInt and the other UInt. */ - @Native("java", "((#1) & (#2))") + // @Native("java", "((#1) & (#2))") @Native("c++", "((x10_uint) ((#1) & (#2)))") - public native static safe operator (x:UInt) & (y:UInt): UInt; + public static safe operator (x:UInt) & (y:UInt): UInt = UInt(x.intVal & y.intVal); /** * A bitwise and operator (unsigned disambiguation). * @see #operator(UInt)&(UInt) */ - @Native("java", "((#1) & (#2))") + // @Native("java", "((#1) & (#2))") @Native("c++", "((x10_uint) ((#1) & (#2)))") - public native static safe operator (x:Int) & (y:UInt): UInt; + public static safe operator (x:Int) & (y:UInt): UInt = UInt(x & y.intVal); /** * A bitwise and operator (unsigned disambiguation). * @see #operator(UInt)&(UInt) */ - @Native("java", "((#1) & (#2))") + // @Native("java", "((#1) & (#2))") @Native("c++", "((x10_uint) ((#1) & (#2)))") - public native static safe operator (x:UInt) & (y:Int): UInt; + public static safe operator (x:UInt) & (y:Int): UInt = UInt(x.intVal & y); /** * A bitwise or operator. @@ -259,23 +286,23 @@ * @param y the other UInt * @return the bitwise OR of the given UInt and the other UInt. */ - @Native("java", "((#1) | (#2))") + // @Native("java", "((#1) | (#2))") @Native("c++", "((x10_uint) ((#1) | (#2)))") - public native static safe operator (x:UInt) | (y:UInt): UInt; + public static safe operator (x:UInt) | (y:UInt): UInt = UInt(x.intVal | y.intVal); /** * A bitwise or operator (unsigned disambiguation). * @see #operator(UInt)|(UInt) */ - @Native("java", "((#1) | (#2))") + // @Native("java", "((#1) | (#2))") @Native("c++", "((x10_uint) ((#1) | (#2)))") - public native static safe operator (x:Int) | (y:UInt): UInt; + public static safe operator (x:Int) | (y:UInt): UInt = UInt(x | y.intVal); /** * A bitwise or operator (unsigned disambiguation). * @see #operator(UInt)|(UInt) */ - @Native("java", "((#1) | (#2))") + // @Native("java", "((#1) | (#2))") @Native("c++", "((x10_uint) ((#1) | (#2)))") - public native static safe operator (x:UInt) | (y:Int): UInt; + public static safe operator (x:UInt) | (y:Int): UInt = UInt(x.intVal | y); /** * A bitwise xor operator. @@ -284,23 +311,23 @@ * @param y the other UInt * @return the bitwise XOR of the given UInt and the other UInt. */ - @Native("java", "((#1) ^ (#2))") + // @Native("java", "((#1) ^ (#2))") @Native("c++", "((x10_uint) ((#1) ^ (#2)))") - public native static safe operator (x:UInt) ^ (y:UInt): UInt; + public static safe operator (x:UInt) ^ (y:UInt): UInt = UInt(x.intVal ^ y.intVal); /** * A bitwise xor operator (unsigned disambiguation). * @see #operator(UInt)^(UInt) */ - @Native("java", "((#1) ^ (#2))") + // @Native("java", "((#1) ^ (#2))") @Native("c++", "((x10_uint) ((#1) ^ (#2)))") - public native static safe operator (x:Int) ^ (y:UInt): UInt; + public static safe operator (x:Int) ^ (y:UInt): UInt = UInt(x ^ y.intVal); /** * A bitwise xor operator (unsigned disambiguation). * @see #operator(UInt)^(UInt) */ - @Native("java", "((#1) ^ (#2))") + // @Native("java", "((#1) ^ (#2))") @Native("c++", "((x10_uint) ((#1) ^ (#2)))") - public native static safe operator (x:UInt) ^ (y:Int): UInt; + public static safe operator (x:UInt) ^ (y:Int): UInt = UInt(x.intVal ^ y); /** * A bitwise left shift operator. @@ -310,9 +337,9 @@ * @param count the shift count * @return the given UInt shifted left by count. */ - @Native("java", "((#1) << (#2))") + // @Native("java", "((#1) << (#2))") @Native("c++", "((x10_uint) ((#1) << (#2)))") - public native static safe operator (x:UInt) << (count:Int): UInt; + public static safe operator (x:UInt) << (count:Int): UInt = UInt(x.intVal << count); /** * A bitwise right shift operator. @@ -323,9 +350,9 @@ * @param count the shift count * @return the given UInt shifted right by count. */ - @Native("java", "((#1) >>> (#2))") + // @Native("java", "((#1) >>> (#2))") @Native("c++", "((x10_uint) ((#1) >> (#2)))") - public native static safe operator (x:UInt) >> (count:Int): UInt; + public static safe operator (x:UInt) >> (count:Int): UInt = UInt(x.intVal >>> count); /** * A bitwise logical right shift operator (zero-fill). @@ -337,9 +364,9 @@ * @param count the shift count * @return the given UInt shifted right by count with high bits zero-filled. */ - @Native("java", "((#1) >>> (#2))") + // @Native("java", "((#1) >>> (#2))") @Native("c++", "((x10_uint) ((#1) >> (#2)))") - public native static safe operator (x:UInt) >>> (count:Int): UInt; + public static safe operator (x:UInt) >>> (count:Int): UInt = UInt(x.intVal >>> count); /** * A bitwise complement operator. @@ -347,9 +374,9 @@ * @param x the given UInt * @return the bitwise complement of the given UInt. */ - @Native("java", "((int) ~(#1))") + // @Native("java", "((int) ~(#1))") @Native("c++", "((x10_uint) ~(#1))") - public native static safe operator ~ (x:UInt): UInt; + public static safe operator ~ (x:UInt): UInt = UInt(~(x.intVal)); /** @@ -357,27 +384,27 @@ * @param x the given UByte * @return the given UByte converted to a UInt. */ - @Native("java", "((int) (((byte)(#1)) & 0xff))") + // @Native("java", "((int) (((byte)(#1)) & 0xff))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:UByte): UInt; + public static safe operator (x:UByte): UInt = UInt(x.byteVal & 0xff); /** * Coerce a given UShort to a UInt. * @param x the given UShort * @return the given UShort converted to a UInt. */ - @Native("java", "((int) (((short)(#1)) & 0xffff))") + // @Native("java", "((int) (((short)(#1)) & 0xffff))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:UShort): UInt; + public static safe operator (x:UShort): UInt = UInt(x.shortVal & 0xffff); /** * Convert a given ULong to a UInt. * @param x the given ULong * @return the given ULong converted to a UInt. */ - @Native("java", "((int)(long)(#1))") + // @Native("java", "((int)(long)(#1))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:ULong) as UInt; + public static safe operator (x:ULong) as UInt = UInt(x.longVal as Int); /** @@ -385,54 +412,54 @@ * @param x the given Byte * @return the given Byte converted to a UInt. */ - @Native("java", "((int)(byte)(#1))") + // @Native("java", "((int)(byte)(#1))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:Byte): UInt; + public static safe operator (x:Byte): UInt = UInt(x); /** * Coerce a given Short to a UInt. * @param x the given Short * @return the given Short converted to a UInt. */ - @Native("java", "((int)(short)(#1))") + // @Native("java", "((int)(short)(#1))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:Short): UInt; + public static safe operator (x:Short): UInt = UInt(x); /** * Convert a given Long to a UInt. * @param x the given Long * @return the given Long converted to a UInt. */ - @Native("java", "((int)(long)(#1))") + // @Native("java", "((int)(long)(#1))") @Native("c++", "((x10_uint) (#1))") - public native static safe operator (x:Long) as UInt; + public static safe operator (x:Long) as UInt = UInt(x as Int); /** * Convert a given Float to a UInt. * @param x the given Float * @return the given Float converted to a UInt. */ - @Native("java", "((int)(float)(#1))") + // @Native("java", "((int)(float)(#1))") @Native("c++", "((x10_uint) (#1))") - public native static safe oper... [truncated message content] |
From: <tos...@us...> - 2010-08-03 16:11:10
|
Revision: 15341 http://x10.svn.sourceforge.net/x10/?rev=15341&view=rev Author: toshio1suganuma Date: 2010-08-03 16:11:03 +0000 (Tue, 03 Aug 2010) Log Message: ----------- Fix regression from r15311 Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/.classpath trunk/x10.runtime/build.xml trunk/x10.runtime/src-java/x10/rtt/Types.java trunk/x10.runtime/src-java/x10/rtt/UByteType.java trunk/x10.runtime/src-java/x10/rtt/UIntType.java trunk/x10.runtime/src-java/x10/rtt/ULongType.java trunk/x10.runtime/src-java/x10/rtt/UShortType.java trunk/x10.runtime/src-x10/x10/lang/Double.x10 trunk/x10.runtime/src-x10/x10/lang/Float.x10 Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -974,7 +974,7 @@ // e.g. any as Int (any:Any), t as Int (t:T) else if ( (X10TypeMixin.baseType(type) instanceof ParameterType || ((X10TypeSystem) type.typeSystem()).isAny(X10TypeMixin.baseType(type))) - && (t.isBoolean() || t.isNumeric() || t.isChar()) + && (t.isBoolean() || t.isByte() || t.isShort() || t.isInt() || t.isLong() || t.isFloat() || t.isDouble() || t.isChar()) ) { w.write(X10_RTT_TYPES + ".as"); new TypeExpander(er, t, NO_QUALIFIER).expand(tr); @@ -982,6 +982,7 @@ c.printSubExpr(expr, w, tr); w.write(")"); } + // all unsigned types come here else if (t.isBoolean() || t.isNumeric() || t.isChar() /*|| type.isSubtype(t, tr.context())*/) { w.begin(0); w.write("("); // put "(Type) expr" in parentheses. Modified: trunk/x10.runtime/.classpath =================================================================== --- trunk/x10.runtime/.classpath 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/.classpath 2010-08-03 16:11:03 UTC (rev 15341) @@ -3,6 +3,5 @@ <classpathentry kind="src" path="src-java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="lib" path="/x10.dist/lib/x10.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/build.xml 2010-08-03 16:11:03 UTC (rev 15341) @@ -196,19 +196,18 @@ </target> <target name="dist" depends="dist-java,dist-cpp" description="generate part of the distribution"> </target> - <target name="jar" depends="build-java-xrx"> + <target name="jar" depends="build-xrx"> <jar jarfile="${build}/${jar}"> <fileset dir="${build}" includes="x10/**/*.class" excludes="${jar}"/> - <!--fileset dir="${build}/gen" includes="x10/**/*.class" excludes="${jar}"/--> + <fileset dir="${build}/gen" includes="x10/**/*.class" excludes="${jar}"/> <fileset dir="${basedir}/src-x10" includes="x10/**" excludes="${jar}"/> <fileset dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset dir="${x10.common.location}/classes" includes="x10/**"/> </jar> </target> - <target name="build-java-xrx" depends="init,gen-xrx"> + <target name="build-java" depends="init,gen-xrx"> <ejc destdir="${build}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${src}"/> - <src path="${gen}"/> <classpath> <path refid="project.classpath"/> </classpath> @@ -239,7 +238,7 @@ <arg value="'${x10.dist.location}/bin/x10c' ${x10c.optimize} ${x10c.inline_optimizations} ${x10c.no_checks} -d '${gen}' -J-ea -rtdev -sourcepath . -STATIC_CALLS -commandlineonly -c ${xrx.list}" /> </exec> </target> - <!--target name="build-xrx" depends="init,gen-xrx,build-java"--> + <target name="build-xrx" depends="init,gen-xrx,build-java"> <!-- <fileset id="generated.files" dir="${build}/gen" includes="**/*.java"/> <pathconvert property="generated.list" refid="generated.files" dirsep="/" pathsep=" "/> @@ -262,7 +261,6 @@ </classpath> </javac> --> - <!-- <ejc destdir="${gen}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${gen}"/> <size value="50" when="more"/> @@ -274,9 +272,9 @@ </path> </classpath> </ejc> - </target--> + </target> - <target name="jni-headers" depends="init,build-java-xrx"> + <target name="jni-headers" depends="init,build-java"> <javah destdir="x10rt/include"> <classpath> <path refid="project.classpath"/> @@ -311,7 +309,7 @@ </exec> </target> - <target name="build" depends="build-java-xrx,build-cpp"> + <target name="build" depends="build-xrx,build-cpp"> <echo message="${ant.project.name}: ${ant.file}"/> </target> Modified: trunk/x10.runtime/src-java/x10/rtt/Types.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -38,13 +38,23 @@ public static Type<Character> CHAR = new CharType(); public static Type<Integer> INT = new IntType(); public static Type<Long> LONG = new LongType(); - public static Type<Byte> UBYTE = new UByteType(); - public static Type<Short> USHORT = new UShortType(); - public static Type<Integer> UINT = new UIntType(); - public static Type<Long> ULONG = new ULongType(); + public static Type<Byte> UBYTE; + public static Type<Short> USHORT; + public static Type<Integer> UINT; + public static Type<Long> ULONG; public static Type<Float> FLOAT = new FloatType(); public static Type<Double> DOUBLE = new DoubleType(); - + + static { + try { + UBYTE = new UByteType(Class.forName("x10.lang.UByte")); + USHORT = new UShortType(Class.forName("x10.lang.UShort")); + UINT = new UIntType(Class.forName("x10.lang.UInt")); + ULONG = new ULongType(Class.forName("x10.lang.ULong")); + } catch (ClassNotFoundException e) { + throw new ClassCastException(); + } + } private static boolean isStruct(Type<?> rtt) { if ( rtt == BOOLEAN @@ -69,44 +79,24 @@ throw new ClassCastException(); } - public static x10.lang.UByte asUByte(Object typeParamOrAny){ - if (typeParamOrAny == null) {nullIsCastedToStruct();} - return (x10.lang.UByte)typeParamOrAny; - } - public static short asshort(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).shortValue();} throw new ClassCastException(); } - public static x10.lang.UShort asUShort(Object typeParamOrAny){ - if (typeParamOrAny == null) {nullIsCastedToStruct();} - return (x10.lang.UShort)typeParamOrAny; - } - public static int asint(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).intValue();} throw new ClassCastException(); } - public static x10.lang.UInt asUInt(Object typeParamOrAny){ - if (typeParamOrAny == null) {nullIsCastedToStruct();} - return (x10.lang.UInt)typeParamOrAny; - } - public static long aslong(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).longValue();} throw new ClassCastException(); } - public static x10.lang.ULong asULong(Object typeParamOrAny){ - if (typeParamOrAny == null) {nullIsCastedToStruct();} - return (x10.lang.ULong)typeParamOrAny; - } - public static float asfloat(Object typeParamOrAny){ if (typeParamOrAny == null) {nullIsCastedToStruct();} if (typeParamOrAny instanceof java.lang.Number) {return((java.lang.Number) typeParamOrAny).floatValue();} Modified: trunk/x10.runtime/src-java/x10/rtt/UByteType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -16,8 +16,8 @@ public class UByteType extends RuntimeType<Byte> { - public UByteType() { - super(x10.lang.UByte.class); + public UByteType(Class<?> c) { + super(c); } @Override @@ -25,10 +25,10 @@ return "x10.lang.UByte"; } - @Override - public boolean instanceof$(Object o) { - return o instanceof x10.lang.UByte; - } +// @Override +// public boolean instanceof$(Object o) { +// return o instanceof x10.lang.UByte; +// } @Override public Object makeArray(int length) { Modified: trunk/x10.runtime/src-java/x10/rtt/UIntType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -16,8 +16,8 @@ public class UIntType extends RuntimeType<Integer> { - public UIntType() { - super(x10.lang.UInt.class); + public UIntType(Class<?> c) { + super(c); } @Override @@ -25,10 +25,10 @@ return "x10.lang.UInt"; } - @Override - public boolean instanceof$(Object o) { - return o instanceof x10.lang.UInt; - } +// @Override +// public boolean instanceof$(Object o) { +// return o instanceof x10.lang.UInt; +// } @Override public Object makeArray(int length) { Modified: trunk/x10.runtime/src-java/x10/rtt/ULongType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -16,8 +16,8 @@ public class ULongType extends RuntimeType<Long> { - public ULongType() { - super(x10.lang.ULong.class); + public ULongType(Class<?> c) { + super(c); } @Override @@ -25,10 +25,10 @@ return "x10.lang.ULong"; } - @Override - public boolean instanceof$(Object o) { - return o instanceof x10.lang.ULong; - } +// @Override +// public boolean instanceof$(Object o) { +// return o instanceof x10.lang.ULong; +// } @Override public Object makeArray(int length) { Modified: trunk/x10.runtime/src-java/x10/rtt/UShortType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-03 16:11:03 UTC (rev 15341) @@ -16,19 +16,19 @@ public class UShortType extends RuntimeType<Short> { - public UShortType() { - super(x10.lang.UShort.class); + public UShortType(Class<?> c) { + super(c); } - + @Override public String typeName() { return "x10.lang.UShort"; } - @Override - public boolean instanceof$(Object o) { - return o instanceof x10.lang.UShort; - } +// @Override +// public boolean instanceof$(Object o) { +// return o instanceof x10.lang.UShort; +// } @Override public Object makeArray(int length) { Modified: trunk/x10.runtime/src-x10/x10/lang/Double.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Double.x10 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-x10/x10/lang/Double.x10 2010-08-03 16:11:03 UTC (rev 15341) @@ -198,7 +198,7 @@ * @param x the given UByte * @return the given UByte converted to a Double. */ - @Native("java", "((double)(byte)(#1))") + @Native("java", "((double)(byte)(#1.byteVal))") @Native("c++", "((x10_double) (#1))") public native static safe operator (x:UByte): Double; @@ -207,7 +207,7 @@ * @param x the given UShort * @return the given UShort converted to a Double. */ - @Native("java", "((double)(short)(#1))") + @Native("java", "((double)(short)(#1.shortVal))") @Native("c++", "((x10_double) (#1))") public native static safe operator (x:UShort): Double; @@ -216,7 +216,7 @@ * @param x the given UInt * @return the given UInt converted to a Double. */ - @Native("java", "((double)(int)(#1))") + @Native("java", "((double)(int)(#1.intVal))") @Native("c++", "((x10_double) (#1))") public native static safe operator (x:UInt): Double; @@ -225,7 +225,7 @@ * @param x the given ULong * @return the given ULong converted to a Double. */ - @Native("java", "((double)(long)(#1))") + @Native("java", "((double)(long)(#1.longVal))") @Native("c++", "((x10_double) (#1))") public native static safe operator (x:ULong): Double; Modified: trunk/x10.runtime/src-x10/x10/lang/Float.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Float.x10 2010-08-03 14:55:06 UTC (rev 15340) +++ trunk/x10.runtime/src-x10/x10/lang/Float.x10 2010-08-03 16:11:03 UTC (rev 15341) @@ -198,7 +198,7 @@ * @param x the given UByte * @return the given UByte converted to a Float. */ - @Native("java", "((float)(byte)(#1))") + @Native("java", "((float)(byte)(#1.byteVal))") @Native("c++", "((x10_float) (#1))") public native static safe operator (x:UByte): Float; @@ -207,7 +207,7 @@ * @param x the given UShort * @return the given UShort converted to a Float. */ - @Native("java", "((float)(short)(#1))") + @Native("java", "((float)(short)(#1.shortVal))") @Native("c++", "((x10_float) (#1))") public native static safe operator (x:UShort): Float; @@ -216,7 +216,7 @@ * @param x the given UInt * @return the given UInt converted to a Float. */ - @Native("java", "((float)(int)(#1))") + @Native("java", "((float)(int)(#1.intVal))") @Native("c++", "((x10_float) (#1))") public native static safe operator (x:UInt): Float; @@ -225,7 +225,7 @@ * @param x the given ULong * @return the given ULong converted to a Float. */ - @Native("java", "((float)(long)(#1))") + @Native("java", "((float)(long)(#1.longVal))") @Native("c++", "((x10_float) (#1))") public native static safe operator (x:ULong): Float; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-08-05 17:58:19
|
Revision: 15386 http://x10.svn.sourceforge.net/x10/?rev=15386&view=rev Author: yzibin Date: 2010-08-05 17:58:10 +0000 (Thu, 05 Aug 2010) Log Message: ----------- Fixed XTENLANG-1651. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/util/RunTestSuite.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-x10/x10/lang/Any.x10 Added Paths: ----------- trunk/x10.tests/examples/Issues/XTENLANG_1651.x10 Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -508,9 +508,6 @@ X10TypeMixin.protoTypeCheck(n.formals(), returnT, n.position(), false); - // for native ctors, we don't have a body - if (false && body!=null) - body.visit(new CheckEscapingThis(tc.job(),returnT,tc.typeSystem())); return n; } Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -468,7 +468,7 @@ if (xf.isProperty()) { boolean ok = false; - if (xf.isAbstract()) { + if (xf.isAbstract() || xf.isNative()) { ok = true; } if (n.body != null && n.body.statements().size() == 1) { Modified: trunk/x10.compiler/src/x10/util/RunTestSuite.java =================================================================== --- trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -129,7 +129,7 @@ List<String> allArgs = new ArrayList<String>(fileNames); allArgs.addAll(args); String[] newArgs = allArgs.toArray(new String[allArgs.size()]); - System.out.println("Running: "+ allArgs); + System.out.println("Running: "+ Arrays.toString(newArgs)); SilentErrorQueue errQueue = new SilentErrorQueue(10000,"TestSuiteErrQueue"); try { new polyglot.main.Main().start(newArgs,errQueue); Modified: trunk/x10.compiler/src/x10/util/Struct.java =================================================================== --- trunk/x10.compiler/src/x10/util/Struct.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10/util/Struct.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -16,21 +16,7 @@ import java.util.List; import java.util.HashSet; -import polyglot.ast.Expr; -import polyglot.ast.Block; -import polyglot.ast.Stmt; -import polyglot.ast.Binary; -import polyglot.ast.FieldDecl; -import polyglot.ast.ClassMember; -import polyglot.ast.FieldDecl_c; -import polyglot.ast.IntLit; -import polyglot.ast.Assign; -import polyglot.ast.Local; -import polyglot.ast.MethodDecl_c; -import polyglot.ast.Unary; -import polyglot.ast.TypeNode; -import polyglot.ast.Formal; -import polyglot.ast.Id; +import polyglot.ast.*; import polyglot.types.Flags; import polyglot.types.LazyRef; import polyglot.types.LocalDef; @@ -47,6 +33,7 @@ import x10.constraint.XVar; import x10.constraint.XTerms; import x10.types.*; +import x10.extension.X10Ext; import x10cpp.visit.SharedVarsMethods; public class Struct { @@ -117,141 +104,9 @@ } }); - X10MethodDef mi; - - // @Native("java", "x10.lang.Place.place(x10.core.Ref.home(#0))") - // property def home():Place - mi = xts.methodDef(pos, Types.ref(ct), - X10Flags.toX10Flags(Flags.PUBLIC.Native()).Property().Global().Safe(), - PLACE, - xts.homeName(), - Collections.EMPTY_LIST, - Collections.EMPTY_LIST, - thisVar, - Collections.EMPTY_LIST, - null, - null, - Collections.EMPTY_LIST, - null, //offerType - null); - final LazyRef<X10ParsedClassType> NATIVE_LOC = Types.lazyRef(null); - NATIVE_LOC.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "x10.lang.Place.place(x10.core.Ref.home(#0))")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_LOC.update(ann); - } - }); - mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_LOC)); - cd.addMethod(mi); - - // @Native("java", "x10.core.Ref.at(#0, #1)") - // property def at(p:Object):boolean; - List<LocalDef> parameters = xts.dummyLocalDefs(Collections.<Ref<? extends Type>> singletonList(OBJECT)); - mi = xts.methodDef(pos, Types.ref(ct), - X10Flags.toX10Flags(Flags.PUBLIC.Native()).Property().Safe(), - BOOLEAN, - Name.make("at"), - Collections.EMPTY_LIST, - Collections.<Ref<? extends Type>> singletonList(OBJECT), - thisVar, - parameters, - null, - null, - Collections.EMPTY_LIST, - null, //offerType - null); - final LazyRef<X10ParsedClassType> NATIVE_AT_1 = Types.lazyRef(null); - NATIVE_AT_1.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "x10.core.Ref.at(#0, #1)")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_AT_1.update(ann); - } - }); - mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_AT_1)); - cd.addMethod(mi); - /* - // @Native("java", "x10.core.Ref.typeName(#0)") - // @Native("c++", "x10aux::type_name(#0)") - // native final global safe def typeName():String; - mi = xts.methodDef(pos, - Types.ref(ct), - X10Flags.toX10Flags(Flags.PUBLIC.Native().Final()).Global().Safe(), - STRING, - Name.make("typeName"), - Collections.EMPTY_LIST, - Collections.EMPTY_LIST, - thisVar, - Collections.EMPTY_LIST, - null, - null, - Collections.EMPTY_LIST, - null, // offerType - null - ); - final LazyRef<X10ParsedClassType> NATIVE_TYPE_NAME = Types.lazyRef(null); - NATIVE_TYPE_NAME.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "x10.core.Ref.typeName(#0)")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_TYPE_NAME.update(ann); - } - }); - final LazyRef<X10ParsedClassType> NATIVE_CPP_TYPE_NAME = Types.lazyRef(null); - NATIVE_CPP_TYPE_NAME.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "c++")); - list.add(new X10StringLit_c(pos, "x10aux::type_name(#0)")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_CPP_TYPE_NAME.update(ann); - } - }); - List<Ref<? extends Type>> tn_ann = new ArrayList<Ref<? extends Type>>(); - tn_ann.add(NATIVE_TYPE_NAME); - tn_ann.add(NATIVE_CPP_TYPE_NAME); - mi.setDefAnnotations(tn_ann); - //mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_TYPE_NAME)); - cd.addMethod(mi); - */ - // @Native("java", "x10.core.Ref.at(#0, #1.id)") - // property def at(p:Place):boolean; - parameters = xts.dummyLocalDefs(Collections.<Ref<? extends Type>> singletonList(PLACE)); - mi = xts.methodDef(pos, Types.ref(ct), - X10Flags.toX10Flags(Flags.PUBLIC.Native()).Property().Safe(), - BOOLEAN, - Name.make("at"), - Collections.EMPTY_LIST, - Collections.<Ref<? extends Type>> singletonList(PLACE), - thisVar, - parameters, - null, - null, - Collections.EMPTY_LIST, - null, // offerType - null); - final LazyRef<X10ParsedClassType> NATIVE_AT_2 = Types.lazyRef(null); - NATIVE_AT_2.setResolver(new Runnable() { - public void run() { - List<Expr> list = new ArrayList<Expr>(2); - list.add(new X10StringLit_c(pos, "java")); - list.add(new X10StringLit_c(pos, "x10.core.Ref.at(#0, #1.id)")); - X10ParsedClassType ann= (X10ParsedClassType) ((X10ParsedClassType) xts.NativeType()).propertyInitializers(list); - NATIVE_AT_2.update(ann); - } - }); - mi.setDefAnnotations(Collections.<Ref<? extends Type>> singletonList(NATIVE_AT_2)); - cd.addMethod(mi); @@ -314,6 +169,8 @@ final X10NodeFactory nf = (X10NodeFactory)tb.nodeFactory(); final TypeNode intTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Int")); final TypeNode boolTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Boolean")); + final TypeNode placeTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Place")); + final TypeNode objectTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Object")); final TypeNode stringTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","String")); final TypeNode anyTypeNode = nf.TypeNodeFromQualifiedName(pos,QName.make("x10.lang","Any")); final List<TypeParamNode> typeParamNodeList = n.typeParameters(); @@ -330,6 +187,7 @@ X10MethodDecl md; + /* // final public global safe def typeName():String { return "FULL_NAME"; } bodyStmts = new ArrayList<Stmt>(); expr = nf.StringLit(pos, fullName.toString()); @@ -338,7 +196,56 @@ methodName = "typeName"; md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),stringTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,block); n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + */ + { + X10Flags nativeFlags = X10Flags.toX10Flags(Flags.PUBLIC.Native().Final()).Global().Safe(); + ArrayList<AnnotationNode> natives; + Formal formal; + // In the Java backend, some structs (like Int) are mapped to primitives (like int) + // So I must add a native annotation on this method. + + + //@Native("java", "x10.lang.Place.place(x10.core.Ref.home(#0))") + //@Native("c++", "x10::lang::Place_methods::place(x10aux::get_location(#0))") + //property def home():Place; + natives = createNative(nf, pos, "x10.lang.Place.place(x10.core.Ref.home(#0))", "x10::lang::Place_methods::place(x10aux::get_location(#0))"); + methodName = "home"; + md = nf.MethodDecl(pos,nf.FlagsNode(pos,nativeFlags.Property()),placeTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,null); + md = (X10MethodDecl) ((X10Ext) md.ext()).annotations(natives); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + + //@Native("java", "x10.core.Ref.typeName(#0)") + //@Native("c++", "x10aux::type_name(#0)") + //global safe def typeName():String; + natives = createNative(nf, pos, "x10.core.Ref.typeName(#0)", "x10aux::type_name(#0)"); + methodName = "typeName"; + md = nf.MethodDecl(pos,nf.FlagsNode(pos,nativeFlags),stringTypeNode,nf.Id(pos,Name.make(methodName)),Collections.EMPTY_LIST,Collections.EMPTY_LIST,null); + md = (X10MethodDecl) ((X10Ext) md.ext()).annotations(natives); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + + //@Native("java", "x10.core.Ref.at((java.lang.Object)(#0), #1.id)") + //@Native("c++", "(x10aux::get_location(#0) == (#1)->FMGL(id))") + // property def at(p:Place):boolean; + natives = createNative(nf, pos, "x10.core.Ref.at((java.lang.Object)(#0), #1.id)", "(x10aux::get_location(#0) == (#1)->FMGL(id))"); + methodName = "at"; + formal = nf.Formal(pos,nf.FlagsNode(pos,Flags.NONE),placeTypeNode,nf.Id(pos,"p")); + md = nf.MethodDecl(pos,nf.FlagsNode(pos,nativeFlags.Property()),boolTypeNode,nf.Id(pos,Name.make(methodName)),Collections.singletonList(formal),Collections.EMPTY_LIST,null); + md = (X10MethodDecl) ((X10Ext) md.ext()).annotations(natives); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + + + //@Native("java", "x10.core.Ref.at((java.lang.Object)(#0), #1)") + //@Native("c++", "(x10aux::get_location(#0) == (#1)->location)") + //property safe def at(r:Object):Boolean; + natives = createNative(nf, pos, "x10.core.Ref.at((java.lang.Object)(#0), #1)", "(x10aux::get_location(#0) == (#1)->location)"); + methodName = "at"; + formal = nf.Formal(pos,nf.FlagsNode(pos,Flags.NONE),objectTypeNode,nf.Id(pos,"r")); + md = nf.MethodDecl(pos,nf.FlagsNode(pos,nativeFlags.Property()),boolTypeNode,nf.Id(pos,Name.make(methodName)),Collections.singletonList(formal),Collections.EMPTY_LIST,null); + md = (X10MethodDecl) ((X10Ext) md.ext()).annotations(natives); + n = (X10ClassDecl_c) n.body(n.body().addMember(md)); + } + if (!seenToString) { // final public global safe def toString():String { // return "struct NAME:"+" FIELD1="+FIELD1+...; @@ -426,5 +333,14 @@ return n; } - + private static ArrayList<AnnotationNode> createNative(X10NodeFactory nf,Position pos, String java, String cpp) { + ArrayList<AnnotationNode> res = new ArrayList<AnnotationNode>(2); + for (int i=0; i<2; i++) { + List<Expr> list = new ArrayList<Expr>(2); + list.add(nf.StringLit(pos, i==0 ? "java" : "c++")); + list.add(nf.StringLit(pos, i==0 ? java : cpp)); + res.add( nf.AnnotationNode(pos, nf.AmbMacroTypeNode(pos, nf.PrefixFromQualifiedName(pos,QName.make("x10.compiler")), nf.Id(pos, "Native"), Collections.EMPTY_LIST, list)) ); + } + return res; + } } Modified: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java =================================================================== --- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -1,34 +1,48 @@ package x10.visit; import polyglot.ast.*; -import polyglot.util.Position; import polyglot.util.ErrorInfo; import polyglot.visit.NodeVisitor; import polyglot.frontend.Job; -import polyglot.main.Report; -import polyglot.types.SemanticException; -import polyglot.types.QName; import polyglot.types.Type; import polyglot.types.TypeSystem; import x10.ast.*; import x10.types.X10TypeMixin; import x10.types.X10Flags; +import java.util.HashMap; + public class CheckEscapingThis extends NodeVisitor { + // we gather info on every procedure + static class ProcedureInfo { + + } private final Job job; private final TypeSystem ts; - private final Type type; + private final X10ClassDecl_c xlass; + private final Type xlassType; + //private final HashMap<> - public CheckEscapingThis(Job job, Type type, TypeSystem ts) { + public CheckEscapingThis(X10ClassDecl_c xlass, Job job, TypeSystem ts) { this.job = job; this.ts = ts; - this.type = X10TypeMixin.baseType(type); + this.xlass = xlass; + this.xlassType = X10TypeMixin.baseType(xlass.classDef().asType()); } + public void typeCheck() { + // visit every ctor + final X10ClassBody_c body = (X10ClassBody_c)xlass.body(); + for (ClassMember classMember : body.members()) { + if (classMember instanceof ConstructorDecl) + classMember.visit(this); + } + } @Override public Node visitEdgeNoOverride(Node parent, Node n) { // You can access "this" for field access and field assignment. + // field assignment: if (n instanceof FieldAssign) { FieldAssign assign = (FieldAssign) n; if (assign.target() instanceof Special) { @@ -36,10 +50,12 @@ return n; } } + // field access: if (n instanceof Field && ((Field)n).target() instanceof Special) { return n; } // You can also access "this" as the receiver of property calls (because they are MACROS that are expanded to field access) + // and as the receiver of static/final calls if (n instanceof X10Call) { final X10Call call = (X10Call) n; if (call.target() instanceof Special && @@ -50,10 +66,11 @@ return n; } } + // You cannot use "this" for anything else! if (n instanceof Special) { final Special special = (Special) n; if (special.kind()==Special.THIS && - ts.typeEquals(X10TypeMixin.baseType(special.type()),type,null)) + ts.typeEquals(X10TypeMixin.baseType(special.type()), xlassType,null)) job.compiler().errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR,"'this' cannot escape from a constructor!",n.position()); } n.del().visitChildren(this); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-05 17:58:10 UTC (rev 15386) @@ -1345,9 +1345,9 @@ // We must define them all in the struct_methods class so they can be picked up by the ITables // FIXME: The home method should call Place_methods::make(here) instead of doing a C++ level construction. - h.writeln("static x10_boolean at("+StructCType+" this_, x10aux::ref<x10::lang::Object> obj) { return true; }"); - h.writeln("static x10_boolean at("+StructCType+" this_, x10::lang::Place place) { return true; }"); - h.writeln("static x10::lang::Place home("+StructCType+" this_) { /* FIXME: Should probably call Place_methods::make, but don't want to include Place.h */ x10::lang::Place tmp; tmp->FMGL(id)=x10aux::here; return tmp; }"); + //h.writeln("static x10_boolean at("+StructCType+" this_, x10aux::ref<x10::lang::Object> obj) { return true; }"); + //h.writeln("static x10_boolean at("+StructCType+" this_, x10::lang::Place place) { return true; }"); + //h.writeln("static x10::lang::Place home("+StructCType+" this_) { /* FIXME: Should probably call Place_methods::make, but don't want to include Place.h */ x10::lang::Place tmp; tmp->FMGL(id)=x10aux::here; return tmp; }"); //h.writeln("static x10aux::ref<x10::lang::String> typeName("+StructCType+" this_) { return this_->typeName(); }"); // We also have to define a redirection method from the struct itself to the implementation Modified: trunk/x10.runtime/src-x10/x10/lang/Any.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Any.x10 2010-08-05 17:32:33 UTC (rev 15385) +++ trunk/x10.runtime/src-x10/x10/lang/Any.x10 2010-08-05 17:58:10 UTC (rev 15386) @@ -51,7 +51,7 @@ * @param r The given object * @return true if the home location of this entity is the same as the home location of r. */ - @Native("java", "x10.core.Ref.at(#0, #1)") + @Native("java", "x10.core.Ref.at((java.lang.Object)(#0), #1)") @Native("c++", "(x10aux::get_location(#0) == (#1)->location)") property safe def at(r:Object):Boolean; @@ -61,7 +61,7 @@ * @param p The given place * @return true if the home location of this entity is p. */ - @Native("java", "x10.core.Ref.at(#0, #1.id)") + @Native("java", "x10.core.Ref.at((java.lang.Object)(#0), #1.id)") @Native("c++", "(x10aux::get_location(#0) == (#1)->FMGL(id))") property safe def at(p:Place):Boolean; @@ -76,7 +76,7 @@ * * @return a string representation of this entity. */ - @Native("java", "((Object)#0).toString()") + @Native("java", "((java.lang.Object)(#0)).toString()") @Native("c++", "x10aux::to_string(#0)") global safe def toString():String; @@ -107,7 +107,7 @@ * @param that the given entity * @return true if this entity is equal to the given entity. */ - @Native("java", "((Object)#0).equals(#1)") + @Native("java", "((java.lang.Object)(#0)).equals(#1)") @Native("c++", "x10aux::equals(#0,#1)") global safe def equals(that:Any):Boolean; @@ -125,7 +125,7 @@ * * @return the hash code of this entity. */ - @Native("java", "((Object)#0).hashCode()") + @Native("java", "((Object)(#0)).hashCode()") @Native("c++", "x10aux::hash_code(#0)") global safe def hashCode():Int; } Added: trunk/x10.tests/examples/Issues/XTENLANG_1651.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_1651.x10 (rev 0) +++ trunk/x10.tests/examples/Issues/XTENLANG_1651.x10 2010-08-05 17:58:10 UTC (rev 15386) @@ -0,0 +1,67 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import harness.x10Test; + +/** + * @author yoav + */ +import x10.compiler.Native; +interface MyTypeName { + global safe def myTypeName():String; +} +struct MyComplex(r:Int,i:Int) implements MyTypeName { + @Native("c++", "x10aux::type_name(#0)") + @Native("java", "x10.core.Ref.typeName(#0)") + public global native safe def myTypeName():String; +} + +public class XTENLANG_1651 extends x10Test { + public static def main(Rail[String]) { + new XTENLANG_1651().execute(); + } + + public def run(): boolean { + test1(); + test2(); + + val i = 3; + println(i.toString()); + println(i.typeName()); + println(i.home()); + println(i.at(here));// Ref.at(Object,int) Ref.at(Object,Object) at(int,int) + println(i.at(this)); + + return true; + } + + def test1() { + val i = true; + println(i.toString()); + println(i.typeName()); + println(i.home()); + println(i.at(here)); + println(i.at(this)); + } + def test2() { + val i = MyComplex(4,5); + println(i.toString()); + println(i.typeName()); + println(i.home()); + println(i.at(here)); + println(i.at(this)); + + + println(i.myTypeName()); + } + + def println(a:Any) {} +} \ No newline at end of file Property changes on: trunk/x10.tests/examples/Issues/XTENLANG_1651.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-08-13 02:49:03
|
Revision: 15520 http://x10.svn.sourceforge.net/x10/?rev=15520&view=rev Author: dgrove-oss Date: 2010-08-13 02:48:56 +0000 (Fri, 13 Aug 2010) Log Message: ----------- Restructure itable initialization sequence so that we no longer have to rely on ensuring that all of the RTTs needed for itable lookups are initialized outside of the itable dispatcher itself. As a result, can revert r15518 and restore class_cast_unchecked to being a noop. The key idea is that in an itable for I, we store also store the address of x10aux::getRTT<I>. We do not make any attempt to get the linker to initialize the actual RTT pointers in the itable_entry struct to valid values. Instead, in the off branch code we add logic to call the cached getRTT<I> function to fill in the RTT pointer. So, the slow case becomes a little slower, but the fast case (after the very first use of an itable) is unchanged. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10/lang/Rail.h trunk/x10.runtime/src-cpp/x10/lang/String.cc trunk/x10.runtime/src-cpp/x10/lang/ValRail.h trunk/x10.runtime/src-cpp/x10aux/bootstrap.cc trunk/x10.runtime/src-cpp/x10aux/class_cast.h trunk/x10.runtime/src-cpp/x10aux/init_dispatcher.cc trunk/x10.runtime/src-cpp/x10aux/itables.cc trunk/x10.runtime/src-cpp/x10aux/itables.h Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-13 02:48:56 UTC (rev 15520) @@ -1447,7 +1447,7 @@ sw.write("x10aux::itable_entry "+Emitter.translateType(currentClass)+"::_itables["+(numInterfaces+1)+"] = {"); itableNum = 0; for (Type interfaceType : allInterfaces) { - sw.write("x10aux::itable_entry(x10aux::getRTT"+chevrons(Emitter.translateType(interfaceType, false))+"(), &_itable_"+itableNum+"), "); + sw.write("x10aux::itable_entry(&x10aux::getRTT"+chevrons(Emitter.translateType(interfaceType, false))+", &_itable_"+itableNum+"), "); itableNum += 1; } sw.write("x10aux::itable_entry(NULL, (void*)x10aux::getRTT"+chevrons(Emitter.translateType(currentClass, false))+"())};"); sw.newline(); @@ -1496,7 +1496,7 @@ sw.write("x10aux::itable_entry "+clsCType+"::_"+ibox+"itables["+(numInterfaces+1)+"] = {"); itableNum = 0; for (Type interfaceType : allInterfaces) { - sw.write("x10aux::itable_entry(x10aux::getRTT"+chevrons(Emitter.translateType(interfaceType, false))+"(), &"+ + sw.write("x10aux::itable_entry(&x10aux::getRTT"+chevrons(Emitter.translateType(interfaceType, false))+", &"+ thunkBaseName+"_"+ibox+"ithunk"+itableNum+thunkParams+"::itable), "); itableNum += 1; } @@ -4145,7 +4145,7 @@ if (in_template_closure) emitter.printTemplateSignature(freeTypeParams, defn_s); defn_s.write("x10aux::itable_entry "+cnamet+"::_itables[2] = {"); - defn_s.write("x10aux::itable_entry(x10aux::getRTT"+chevrons(superType)+"(), &"+cnamet+"::_itable),"); + defn_s.write("x10aux::itable_entry(&x10aux::getRTT"+chevrons(superType)+", &"+cnamet+"::_itable),"); defn_s.write("x10aux::itable_entry(NULL, NULL)};"); defn_s.newline(); defn_s.forceNewline(); generateClosureDeserializationIdDef(defn_s, cnamet, freeTypeParams, hostClassName, n.body()); Modified: trunk/x10.runtime/src-cpp/x10/lang/Rail.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Rail.h 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10/lang/Rail.h 2010-08-13 02:48:56 UTC (rev 15520) @@ -269,8 +269,8 @@ &Rail<T>::typeName); template <class T> x10aux::itable_entry x10::lang::Rail<T>::_itables[3] = { - x10aux::itable_entry(&x10::lang::Iterable<T>::rtt, &x10::lang::Rail<T>::_itable_iterable), - x10aux::itable_entry(&x10::lang::Settable<x10_int, T>::rtt, &x10::lang::Rail<T>::_itable_iterable), + x10aux::itable_entry(&x10aux::getRTT<x10::lang::Iterable<T> >, &x10::lang::Rail<T>::_itable_iterable), + x10aux::itable_entry(&x10aux::getRTT<x10::lang::Settable<x10_int, T> >, &x10::lang::Rail<T>::_itable_iterable), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<Rail<T> >()) }; Modified: trunk/x10.runtime/src-cpp/x10/lang/String.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/String.cc 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10/lang/String.cc 2010-08-13 02:48:56 UTC (rev 15520) @@ -465,8 +465,8 @@ &String::home, &String::toString, &String::typeName); x10aux::itable_entry String::_itables[3] = { - x10aux::itable_entry(&Fun_0_1<x10_int, x10_char>::rtt, &String::_itable_Fun_0_1), - x10aux::itable_entry(&Comparable<ref<String> >::rtt, &String::_itable_Comparable), + x10aux::itable_entry(&x10aux::getRTT<Fun_0_1<x10_int, x10_char> >, &String::_itable_Fun_0_1), + x10aux::itable_entry(&x10aux::getRTT<Comparable<ref<String> > >, &String::_itable_Comparable), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<String>()) }; Modified: trunk/x10.runtime/src-cpp/x10/lang/ValRail.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/ValRail.h 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10/lang/ValRail.h 2010-08-13 02:48:56 UTC (rev 15520) @@ -176,8 +176,8 @@ &ValRail<T>::typeName); template<class T> x10aux::itable_entry ValRail<T>::_itables[3] = { - x10aux::itable_entry(&Iterable<T>::rtt, &ValRail<T>::_itable_iterable), - x10aux::itable_entry(&Fun_0_1<x10_int, T>::rtt, &ValRail<T>::_itable_fun), + x10aux::itable_entry(&x10aux::getRTT<Iterable<T> >, &ValRail<T>::_itable_iterable), + x10aux::itable_entry(&x10aux::getRTT<Fun_0_1<x10_int, T> >, &ValRail<T>::_itable_fun), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<ValRail<T> >()) }; Modified: trunk/x10.runtime/src-cpp/x10aux/bootstrap.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bootstrap.cc 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10aux/bootstrap.cc 2010-08-13 02:48:56 UTC (rev 15520) @@ -25,7 +25,7 @@ &StaticInitClosure::home, &StaticInitClosure::toString, &StaticInitClosure::typeName); x10aux::itable_entry StaticInitClosure::_itables[2] = { - x10aux::itable_entry(&x10::lang::VoidFun_0_0::rtt, &_itable), + x10aux::itable_entry(&x10aux::getRTT<x10::lang::VoidFun_0_0>, &_itable), x10aux::itable_entry(NULL, NULL) }; @@ -34,7 +34,7 @@ &BootStrapClosure::home, &BootStrapClosure::toString, &BootStrapClosure::typeName); x10aux::itable_entry BootStrapClosure::_itables[2] = { - x10aux::itable_entry(&x10::lang::VoidFun_0_0::rtt, &_itable), + x10aux::itable_entry(&x10aux::getRTT<x10::lang::VoidFun_0_0>, &_itable), x10aux::itable_entry(NULL, NULL) }; Modified: trunk/x10.runtime/src-cpp/x10aux/class_cast.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/class_cast.h 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10aux/class_cast.h 2010-08-13 02:48:56 UTC (rev 15520) @@ -41,12 +41,9 @@ _CAST_("Special case: null gets cast to "<<TYPENAME(ref<T>)); return obj; } - // Must call getRTT<ref<T>> here because this may be the only place - // where getRTT<ref<T>> is called before obj gets involed in an ITable lookup - // that is going to assume that getRTT<ref<T>> has been executed. - const RuntimeType *to = getRTT<ref<T> >(); 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)) { @@ -77,11 +74,9 @@ template<class T, class F> struct ClassCastNotPrimitive<ref<T>,F> { static GPUSAFE ref<T> _(F val, bool checked) { _CAST_("Struct to ref cast "<<TYPENAME(F)<<" to "<<TYPENAME(T)); - // Must make both RTT calls here even if unchecked to enforce the invariant - // that RTT's are initialized before an object gets into an itable lookup. - const RuntimeType *from = getRTT<F>(); - const RuntimeType *to = getRTT<ref<T> >(); if (checked) { + const RuntimeType *from = getRTT<F>(); + const RuntimeType *to = getRTT<ref<T> >(); #ifndef NO_EXCEPTIONS _CAST_(from->name()<<" to "<<to->name()); if (!from->subtypeOf(to)) { @@ -105,12 +100,10 @@ _CAST_("Special case: null cannot be cast to "<<TYPENAME(T)); throwClassCastException(); } - // Must make RTT call here even if unchecked to enforce the invariant - // that RTT's are initialized before an object gets into an itable lookup. - const RuntimeType *to = getRTT<T>(); if (checked) { x10aux::ref<x10::lang::Reference> asRef = val; const RuntimeType *from = asRef->_type(); + const RuntimeType *to = getRTT<T>(); #ifndef NO_EXCEPTIONS _CAST_(from->name()<<" to "<<to->name()); if (!from->subtypeOf(to)) { Modified: trunk/x10.runtime/src-cpp/x10aux/init_dispatcher.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/init_dispatcher.cc 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10aux/init_dispatcher.cc 2010-08-13 02:48:56 UTC (rev 15520) @@ -73,7 +73,7 @@ &InitClosure::home, &InitClosure::toString, &InitClosure::typeName); x10aux::itable_entry InitClosure::_itables[2] = { - x10aux::itable_entry(&x10::lang::VoidFun_0_0::rtt, &_itable), + x10aux::itable_entry(&x10aux::getRTT<x10::lang::VoidFun_0_0>, &_itable), x10aux::itable_entry(NULL, NULL) }; Modified: trunk/x10.runtime/src-cpp/x10aux/itables.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/itables.cc 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10aux/itables.cc 2010-08-13 02:48:56 UTC (rev 15520) @@ -16,7 +16,21 @@ using namespace x10aux; using namespace x10::lang; -void* x10aux::outlinedITableLookup(itable_entry* itables, RuntimeType* targetInterface) { +void* x10aux::outlinedITableLookup(itable_entry* itables, const RuntimeType* targetInterface) { + // First walk through itables and force RTT initialization + for (int i=0; true; i++) { + if (NULL == itables[i].initFunction) { + // Have hit the end of the itables; done forcing initialization + break; + } + if (NULL == itables[i].id) { + itables[i].id = (itables[i].initFunction)(); + if (itables[i].id == targetInterface) { + return itables[i].itable; + } + } + } + if (targetInterface->paramsc > 0) { // Have to look again considering type parameters. // Note: it would be wrong to just call subtypeOf(itables[i].id, targetInterface) Modified: trunk/x10.runtime/src-cpp/x10aux/itables.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/itables.h 2010-08-12 21:34:38 UTC (rev 15519) +++ trunk/x10.runtime/src-cpp/x10aux/itables.h 2010-08-13 02:48:56 UTC (rev 15520) @@ -58,19 +58,20 @@ namespace x10aux { class RuntimeType; - + /* * An itables array is an array of itable_entry. * Each interface declares a unique struct for its itable, * therfore in the itable entry it must be declared as a void*. */ struct itable_entry { - itable_entry(const RuntimeType* id_, void* itable_) : id(id_), itable(itable_) {} + itable_entry(const RuntimeType* (initFunction_)(), void* itable_) : id(NULL), itable(itable_), initFunction(initFunction_) {} const RuntimeType* id; void* itable; + const RuntimeType* (*initFunction)(); }; - void* outlinedITableLookup(itable_entry* itables, RuntimeType* targetInterface); + void* outlinedITableLookup(itable_entry* itables, const RuntimeType* targetInterface); /* * Search itables to find the itable that matches I and return it. @@ -81,14 +82,17 @@ * cases are handled in the out-of-line outlinedITableLookup routine. */ template<class I> inline typename I::template itable<x10::lang::Reference>* findITable(itable_entry* itables) { - RuntimeType *id = &I::rtt; + const RuntimeType *id = &I::rtt; // NOTE: I::rtt may be uninitialized, but that's ok here. Make common case as fast as possible. for (int i=0; true; i++) { if (itables[i].id == id) { return (typename I::template itable<x10::lang::Reference>*)(itables[i].itable); } if (NULL == itables[i].id) { - // Hit the end of itables, now deal with complex cases involving generic types. - return (typename I::template itable<x10::lang::Reference>*)outlinedITableLookup(itables, id); + // Either itables hasn't been initialized yet, or we've hit the end of itables and + // we need to deal with complex cases involving generic types. + // By calling getRTT<I>(), we ensure that I::rtt will now be initialized before we need to look at its content. + // in the body of outlineITableLookup. + return (typename I::template itable<x10::lang::Reference>*)outlinedITableLookup(itables, x10aux::getRTT<I>()); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-08-13 22:09:41
|
Revision: 15536 http://x10.svn.sourceforge.net/x10/?rev=15536&view=rev Author: tardieu Date: 2010-08-13 22:09:34 +0000 (Fri, 13 Aug 2010) Log Message: ----------- work in progress toward supporting ref capture in asyncs Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Ref.x10 Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-08-13 21:11:23 UTC (rev 15535) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-08-13 22:09:34 UTC (rev 15536) @@ -920,16 +920,16 @@ return; } - public void printDeclarationList(CodeWriter w, X10CPPContext_c c, ArrayList<VarInstance<?>> vars) { - printDeclarationList(w, c, vars, true, false); + public void printDeclarationList(CodeWriter w, X10CPPContext_c c, ArrayList<VarInstance<?>> vars, List<VarInstance> refs) { + printDeclarationList(w, c, vars, true, false, refs); } - void printDeclarationList(CodeWriter w, X10CPPContext_c c, ArrayList<VarInstance<?>> vars, boolean saved_this_mechanism, boolean writable) { + void printDeclarationList(CodeWriter w, X10CPPContext_c c, ArrayList<VarInstance<?>> vars, boolean saved_this_mechanism, boolean writable, List<VarInstance> refs) { for (int i = 0; i < vars.size(); i++) { VarInstance<?> var = vars.get(i); Type t = var.type(); String type = translateType(t, true); - if (writable && !var.name().toString().equals(THIS)) // this is a temporary ref + if ((writable && !var.name().toString().equals(THIS)) || refs.contains(var)) // this is a temporary ref type = type + "&"; // FIXME: Hack to get writable args in finally closures String name = var.name().toString(); if (saved_this_mechanism && name.equals(THIS)) { Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-13 21:11:23 UTC (rev 15535) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-08-13 22:09:34 UTC (rev 15536) @@ -212,6 +212,7 @@ import x10.types.X10Flags; import x10.types.X10MethodDef; import x10.types.X10MethodInstance; +import x10.types.X10ParsedClassType_c; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; @@ -4067,7 +4068,16 @@ inc.newline(); inc.forceNewline(); inc.write("// captured environment"); inc.newline(); - emitter.printDeclarationList(inc, c, c.variables); + List<Type> ats = closureDef.annotationsNamed(QName.make("x10.compiler.Ref")); + List<VarInstance> refs = new ArrayList<VarInstance>(); + for (Type at : ats) { + Expr exp = ((X10ParsedClassType_c) at).propertyInitializer(0); + if (exp instanceof X10Local_c) { + refs.add(((X10Local_c) exp).varInstance()); + } + } + + emitter.printDeclarationList(inc, c, c.variables, refs); inc.forceNewline(); inc.write("x10aux::serialization_id_t "+SERIALIZE_ID_METHOD+"() {"); Added: trunk/x10.runtime/src-x10/x10/compiler/Ref.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/Ref.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/Ref.x10 2010-08-13 22:09:34 UTC (rev 15536) @@ -0,0 +1,20 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.StatementAnnotation; + +/** + * @Ref(v) may be used to annotate an async to specify that variable v should be captured by reference. */ +public interface Ref[T](id:T) + extends StatementAnnotation { +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tos...@us...> - 2010-08-15 17:09:17
|
Revision: 15544 http://x10.svn.sourceforge.net/x10/?rev=15544&view=rev Author: toshio1suganuma Date: 2010-08-15 17:09:09 +0000 (Sun, 15 Aug 2010) Log Message: ----------- Fixed RTT problem shown in XTENLANG-1241 Modified Paths: -------------- trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.runtime/src-java/x10/core/Ref.java trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java trunk/x10.runtime/src-java/x10/rtt/Types.java trunk/x10.runtime/src-java/x10/rtt/UByteType.java trunk/x10.runtime/src-java/x10/rtt/UIntType.java trunk/x10.runtime/src-java/x10/rtt/ULongType.java trunk/x10.runtime/src-java/x10/rtt/UShortType.java trunk/x10.runtime/src-x10/x10/lang/String.x10 Added Paths: ----------- trunk/x10.runtime/src-java/x10/rtt/StringType.java Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -2295,13 +2295,29 @@ return s.toString(); } - public void generateRTTInstance(X10ClassDef def) { + private boolean isUnsignedClassType(Type type) { + return type.isNumeric() && !(type.isChar() || type.isByte() || type.isShort() || + type.isInt() || type.isLong() || type.isFloat() || type.isDouble()); + } - w.write("public static final x10.rtt.RuntimeType"); + public void generateRTTInstance(X10ClassDef def) { + + String unsignedClassName = null; + + if (isUnsignedClassType(def.asType())) { + unsignedClassName = def.asType().name().toString(); + w.write("public static final x10.rtt."+unsignedClassName+"Type"); + } else { + w.write("public static final x10.rtt.RuntimeType"); + } w.write("<"); printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES | X10PrettyPrinterVisitor.NO_QUALIFIER); w.write(">"); - w.write(" _RTT = new x10.rtt.RuntimeType"); + if (isUnsignedClassType(def.asType())) { + w.write(" _RTT = new x10.rtt."+unsignedClassName+"Type"); + } else { + w.write(" _RTT = new x10.rtt.RuntimeType"); + } w.write("<"); printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES | X10PrettyPrinterVisitor.NO_QUALIFIER); w.write(">"); @@ -2350,9 +2366,19 @@ w.write(");"); w.newline(); + if (isUnsignedClassType(def.asType())) { + w.write("static {"); + w.write("x10.rtt.Types."+unsignedClassName.toUpperCase()+" = _RTT;"); + w.write("}"); + w.newline(); + } if (!def.flags().isInterface()) { - w.write("public x10.rtt.RuntimeType<?> getRTT() {"); + if (isUnsignedClassType(def.asType())) { + w.write("public x10.rtt."+unsignedClassName+"Type<"+unsignedClassName+"> getRTT() {"); + } else { + w.write("public x10.rtt.RuntimeType<?> getRTT() {"); + } w.write("return _RTT;"); w.write("}"); w.newline(); @@ -2372,7 +2398,7 @@ } w.newline(); } - } + } private void printParents(X10ClassDef def, Type type) { if (type instanceof ConstrainedType_c) { Modified: trunk/x10.runtime/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Ref.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/core/Ref.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -13,6 +13,7 @@ import x10.rtt.RuntimeType; import x10.rtt.Type; +import x10.rtt.Types; import x10.runtime.impl.java.Thread; @@ -78,7 +79,14 @@ public static String typeName(Object obj) { String s; if (obj instanceof Any) { + // unsigned numbers come here s = ((Any) obj).getRTT().typeName(obj); + } else if (obj instanceof Number) { + // @NativeRep'ed numeric primitive type + s = Types.getNativeRepRTT(obj).typeName(); + } else if (obj instanceof String) { + // @NativeRep'ed String type + s = Types.STR.typeName(); } else { s = obj.getClass().toString().substring("class ".length()); // TODO: create mapping table of @NativeRep'ed type to X10 type and use it. Modified: trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -147,10 +147,35 @@ } return instantiateCheck(params, rtt, any); } + else if (o instanceof String) { + // @NativeRep'ed String type (the one with parents info) + RuntimeType<String> rtt = (RuntimeType<String>)Types.STR0; + return instantiateCheck(params, rtt, (String)o); + } + else if (o instanceof Number) { + // @NativeRep'ed numeric type + return false; + } return false; } // e.g. C[T1,T2]:Super[Int, T1] -> C[Int,Double]:Super[Int,Int] + private final boolean instantiateCheck(Type<?>[] params, RuntimeType<String> rtt, String o) { + for (Type<?> t : rtt.parents) { + if (base.isAssignableFrom(t.getJavaClass())) { + if (t instanceof ParameterizedType<?>) { + ParameterizedType<?> pt = (ParameterizedType<?>) t; + Type<?>[] paramsT = pt.getParams(); + if (subtypeof(params, pt.getRuntimeType(), paramsT)) { + return true; + } + } + } + } + return false; + } + + // e.g. C[T1,T2]:Super[Int, T1] -> C[Int,Double]:Super[Int,Int] private final boolean instantiateCheck(Type<?>[] params, RuntimeType<?> rtt, Any any) { for (Type<?> t : rtt.parents) { if (base.isAssignableFrom(t.getJavaClass())) { @@ -387,7 +412,7 @@ } // for shortcut - public final boolean instanceof$(Object o, Type<?> param0) { + public boolean instanceof$(Object o, Type<?> param0) { if (o == null) {return false;} Class<?> target = o.getClass(); if (target == base || checkAnonymous(target)) { @@ -406,6 +431,10 @@ else if (base.isInstance(o)) { return checkParents(o, param0); } + else if (o instanceof String || o instanceof Number) { + // @NativeRep'ed type + return checkParents(o, param0); + } else { return false; } @@ -441,6 +470,10 @@ else if (base.isInstance(o)) { return checkParents(o, param0, param1); } + else if (o instanceof String || o instanceof Number) { + // @NativeRep'ed type + return checkParents(o, param0, param1); + } else { return false; } Added: trunk/x10.runtime/src-java/x10/rtt/StringType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/StringType.java (rev 0) +++ trunk/x10.runtime/src-java/x10/rtt/StringType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -0,0 +1,65 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.rtt; + + +public class StringType extends RuntimeType<String> { + + // version with only base class + public StringType() { + super(String.class); + } + + // version with based class nad parents + public StringType(Type<?>... parents) { + super(String.class, parents); + } + + @Override + public String typeName() { + return "x10.lang.String"; + } + + @Override + public boolean instanceof$(Object o) { + return o instanceof java.lang.String; + } + + @Override + public Object makeArray(int length) { + return new String[length]; + } + + @Override + public Object makeArray(Object... elem) { + byte[] arr = new byte[elem.length]; + for (int i = 0; i < elem.length; i++) { + arr[i] = ((Number)elem[i]).byteValue(); + } + return arr; + } + + @Override + public String getArray(Object array, int i) { + return ((String[]) array)[i]; + } + + @Override + public String setArray(Object array, int i, String v) { + return ((String[]) array)[i] = v; + } + + @Override + public int arrayLength(Object array) { + return ((String[]) array).length; + } +} Modified: trunk/x10.runtime/src-java/x10/rtt/Types.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -11,7 +11,9 @@ package x10.rtt; +import x10.core.fun.Fun_0_1; + public class Types { public static boolean instanceof$(Type<?> t, Object o) { return t.instanceof$(o); @@ -38,28 +40,47 @@ public static Type<Character> CHAR = new CharType(); public static Type<Integer> INT = new IntType(); public static Type<Long> LONG = new LongType(); - public static Type<Byte> UBYTE; - public static Type<Short> USHORT; - public static Type<Integer> UINT; - public static Type<Long> ULONG; public static Type<Float> FLOAT = new FloatType(); public static Type<Double> DOUBLE = new DoubleType(); + public static RuntimeType<Comparable<?>> COMPARABLE; static { try { - UBYTE = new UByteType(Class.forName("x10.lang.UByte")); - USHORT = new UShortType(Class.forName("x10.lang.UShort")); - UINT = new UIntType(Class.forName("x10.lang.UInt")); - ULONG = new ULongType(Class.forName("x10.lang.ULong")); - } catch (ClassNotFoundException e) { - throw new ClassCastException(); - } + COMPARABLE = new RuntimeType<Comparable<?>>(Class.forName("x10.lang.Comparable")); + } catch (ClassNotFoundException e) {} } + + public static Type<String> STR = new StringType(); // only with base class (used by code gen) + protected static Type<String> STR0 = new StringType( // with based class and parents + new ParameterizedType(Types.COMPARABLE, Types.STR), + new ParameterizedType(Fun_0_1._RTT, Types.INT, Types.CHAR), + x10.rtt.Types.runtimeType(x10.core.Any.class) + ); + + public static Type<?> UBYTE; // instance created and set in UByte static initializer + public static Type<?> USHORT; // instance created and set in UShort static initializer + public static Type<?> UINT; // instance created and set in UInt static initializer + public static Type<?> ULONG; // instance created and set in ULong static initializer + + public static Type<?> getNativeRepRTT(Object o) { + assert(o instanceof Number); + + if (o instanceof Boolean) return BOOLEAN; + if (o instanceof Byte) return BYTE; + if (o instanceof Character) return CHAR; + if (o instanceof Short) return SHORT; + if (o instanceof Integer) return INT; + if (o instanceof Long) return LONG; + if (o instanceof Float) return FLOAT; + if (o instanceof Double) return DOUBLE; + throw new RuntimeException("RTT not found for "+o.getClass()); + } + private static boolean isStruct(Type<?> rtt) { if ( rtt == BOOLEAN || rtt == BYTE || rtt == SHORT || rtt == CHAR || rtt == INT || rtt == LONG - || rtt == UBYTE || rtt == USHORT || rtt == UINT || rtt == ULONG + || rtt == UBYTE || rtt == USHORT || rtt == UINT || rtt == ULONG || rtt == FLOAT || rtt == DOUBLE ) { return true; @@ -150,11 +171,6 @@ return primOrTypeParam; } - // unimplemented - if (rtt == UBYTE) {return primOrTypeParam;} - if (rtt == USHORT) {return primOrTypeParam;} - if (rtt == UINT) {return primOrTypeParam;} - if (rtt == ULONG) {return primOrTypeParam;} return primOrTypeParam; } Modified: trunk/x10.runtime/src-java/x10/rtt/UByteType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/UByteType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -11,230 +11,27 @@ package x10.rtt; -import x10.core.fun.Fun_0_1; -import x10.core.fun.Fun_0_2; +public class UByteType<T> extends RuntimeType<T> { -public class UByteType extends RuntimeType<Byte> { public UByteType(Class<?> c) { super(c); } - - @Override - public String typeName() { - return "x10.lang.UByte"; - } -// @Override -// public boolean instanceof$(Object o) { -// return o instanceof x10.lang.UByte; -// } - - @Override - public Object makeArray(int length) { - return new byte[length]; + public UByteType(Class<?> c, Variance... variances) { + super(c, variances); } - - @Override - public Object makeArray(Object... elem) { - byte[] arr = new byte[elem.length]; - for (int i = 0; i < elem.length; i++) { - arr[i] = ((Number)elem[i]).byteValue(); - } - return arr; - } - - @Override - public Byte getArray(Object array, int i) { - return ((byte[]) array)[i]; - } - - @Override - public Byte setArray(Object array, int i, Byte v) { - return ((byte[]) array)[i] = v; - } - - @Override - public int arrayLength(Object array) { - return ((byte[]) array).length; - } - @Override - public Fun_0_1<Byte, Byte> absOperator() { - return new Fun_0_1<Byte, Byte>() { - public Byte apply$G(Byte x) { - return (byte) (x > 0 ? x : -x); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UBYTE; return null;} - }; + public UByteType(Class<?>c, Type<?>[] parents) { + super(c, parents); } - @Override - public Fun_0_1<Byte, Byte> scaleOperator(final int k) { - return new Fun_0_1<Byte, Byte>() { - public Byte apply$G(Byte x) { - return (byte) (x * k); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UBYTE; return null;} - }; - } - - @Override - public Fun_0_2<Byte, Byte, Byte> addOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x + y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - @Override - public Fun_0_2<Byte, Byte, Byte> subOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x - y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; + public UByteType(Class<?> c, Variance[] variances, Type<?>[] parents) { + super(c, variances, parents); } - @Override - public Fun_0_2<Byte, Byte, Byte> mulOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x * y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - @Override - public Fun_0_2<Byte, Byte, Byte> divOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x / y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - @Override - public Fun_0_2<Byte, Byte, Byte> modOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x % y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - @Override - public Fun_0_2<Byte, Byte, Byte> maxOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (x > y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - @Override - public Fun_0_2<Byte, Byte, Byte> minOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (x < y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - - @Override - public Fun_0_2<Byte, Byte, Byte> andOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x & y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } @Override - public Fun_0_2<Byte, Byte, Byte> orOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x | y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; + public String typeName() { + return "x10.lang.UByte"; } - - @Override - public Fun_0_2<Byte, Byte, Byte> xorOperator() { - return new Fun_0_2<Byte, Byte, Byte>() { - public Byte apply$G(Byte x, Byte y) { - return (byte) (x ^ y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UBYTE; return null;} - }; - } - - @Override - public Fun_0_1<Byte, Byte> negOperator() { - return new Fun_0_1<Byte, Byte>() { - public Byte apply$G(Byte x) { - return (byte) -x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UBYTE; return null;} - }; - } - - @Override - public Fun_0_1<Byte, Byte> posOperator() { - return new Fun_0_1<Byte, Byte>() { - public Byte apply$G(Byte x) { - return (byte) +x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UBYTE; return null;} - }; - } - - @Override - public Fun_0_1<Byte, Byte> invOperator() { - return new Fun_0_1<Byte, Byte>() { - public Byte apply$G(Byte x) { - return (byte) ~x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UBYTE; return null;} - }; - } - - @Override - public Byte minValue() { - return (byte) 0; - } - - @Override - public Byte maxValue() { - return (byte) 0xff; - } - - @Override - public Byte zeroValue() { - return (byte) 0; - } - - @Override - public Byte unitValue() { - return (byte) 1; - } } Modified: trunk/x10.runtime/src-java/x10/rtt/UIntType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/UIntType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -11,230 +11,27 @@ package x10.rtt; -import x10.core.fun.Fun_0_1; -import x10.core.fun.Fun_0_2; +public class UIntType<T> extends RuntimeType<T> { -public class UIntType extends RuntimeType<Integer> { public UIntType(Class<?> c) { super(c); } - - @Override - public String typeName() { - return "x10.lang.UInt"; - } -// @Override -// public boolean instanceof$(Object o) { -// return o instanceof x10.lang.UInt; -// } - - @Override - public Object makeArray(int length) { - return new int[length]; + public UIntType(Class<?> c, Variance... variances) { + super(c, variances); } - - @Override - public Object makeArray(Object... elem) { - int[] arr = new int[elem.length]; - for (int i = 0; i < elem.length; i++) { - arr[i] = ((Number)elem[i]).intValue(); - } - return arr; - } - - @Override - public Integer getArray(Object array, int i) { - return ((int[]) array)[i]; - } - - @Override - public Integer setArray(Object array, int i, Integer v) { - ((int[]) array)[i] = v; - return v; - } - - @Override - public int arrayLength(Object array) { - return ((int[]) array).length; - } - - @Override - public Fun_0_1<Integer, Integer> absOperator() { - return new Fun_0_1<Integer, Integer>() { - public Integer apply$G(Integer x) { - return (x > 0 ? x : -x); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_1<Integer, Integer> scaleOperator(final int k) { - return new Fun_0_1<Integer, Integer>() { - public Integer apply$G(Integer x) { - return (x * k); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - - @Override - public Fun_0_2<Integer, Integer, Integer> addOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x + y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> subOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x - y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> mulOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x * y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> divOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x / y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> modOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x % y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> maxOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x > y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> minOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x < y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - - @Override - public Fun_0_2<Integer, Integer, Integer> andOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x & y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_2<Integer, Integer, Integer> orOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x | y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; + public UIntType(Class<?>c, Type<?>[] parents) { + super(c, parents); } - - @Override - public Fun_0_2<Integer, Integer, Integer> xorOperator() { - return new Fun_0_2<Integer, Integer, Integer>() { - public Integer apply$G(Integer x, Integer y) { - return (x ^ y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.UINT; return null;} - }; - } - @Override - public Fun_0_1<Integer, Integer> negOperator() { - return new Fun_0_1<Integer, Integer>() { - public Integer apply$G(Integer x) { - return -x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UINT; return null;} - }; + public UIntType(Class<?> c, Variance[] variances, Type<?>[] parents) { + super(c, variances, parents); } - - @Override - public Fun_0_1<Integer, Integer> posOperator() { - return new Fun_0_1<Integer, Integer>() { - public Integer apply$G(Integer x) { - return +x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UINT; return null;} - }; - } - - @Override - public Fun_0_1<Integer, Integer> invOperator() { - return new Fun_0_1<Integer, Integer>() { - public Integer apply$G(Integer x) { - return ~x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.UINT; return null;} - }; - } - - @Override - public Integer minValue() { - return 0; - } @Override - public Integer maxValue() { - return 0xffffffff; + public String typeName() { + return "x10.lang.UInt"; } - - @Override - public Integer zeroValue() { - return 0; - } - - @Override - public Integer unitValue() { - return 1; - } } Modified: trunk/x10.runtime/src-java/x10/rtt/ULongType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/ULongType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -11,230 +11,27 @@ package x10.rtt; -import x10.core.fun.Fun_0_1; -import x10.core.fun.Fun_0_2; +public class ULongType<T> extends RuntimeType<T> { -public class ULongType extends RuntimeType<Long> { public ULongType(Class<?> c) { super(c); } - - @Override - public String typeName() { - return "x10.lang.ULong"; - } -// @Override -// public boolean instanceof$(Object o) { -// return o instanceof x10.lang.ULong; -// } - - @Override - public Object makeArray(int length) { - return new long[length]; + public ULongType(Class<?> c, Variance... variances) { + super(c, variances); } - - @Override - public Object makeArray(Object... elem) { - long[] arr = new long[elem.length]; - for (int i = 0; i < elem.length; i++) { - arr[i] = ((Number)elem[i]).longValue(); - } - return arr; - } - - @Override - public Long getArray(Object array, int i) { - return ((long[]) array)[i]; - } - - @Override - public Long setArray(Object array, int i, Long v) { - ((long[]) array)[i] = v; - return v; - } - - @Override - public int arrayLength(Object array) { - return ((long[]) array).length; - } - - @Override - public Fun_0_1<Long, Long> absOperator() { - return new Fun_0_1<Long, Long>() { - public Long apply$G(Long x) { - return (x > 0 ? x : -x); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_1<Long, Long> scaleOperator(final int k) { - return new Fun_0_1<Long, Long>() { - public Long apply$G(Long x) { - return (x * k); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.ULONG; return null;} - }; - } - - @Override - public Fun_0_2<Long, Long, Long> addOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x + y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> subOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x - y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> mulOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x * y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> divOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x / y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> modOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x % y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> maxOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x > y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> minOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x < y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - - @Override - public Fun_0_2<Long, Long, Long> andOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x & y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_2<Long, Long, Long> orOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x | y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; + public ULongType(Class<?>c, Type<?>[] parents) { + super(c, parents); } - - @Override - public Fun_0_2<Long, Long, Long> xorOperator() { - return new Fun_0_2<Long, Long, Long>() { - public Long apply$G(Long x, Long y) { - return (x ^ y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.ULONG; return null;} - }; - } - @Override - public Fun_0_1<Long, Long> negOperator() { - return new Fun_0_1<Long, Long>() { - public Long apply$G(Long x) { - return -x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.ULONG; return null;} - }; + public ULongType(Class<?> c, Variance[] variances, Type<?>[] parents) { + super(c, variances, parents); } - - @Override - public Fun_0_1<Long, Long> posOperator() { - return new Fun_0_1<Long, Long>() { - public Long apply$G(Long x) { - return +x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.ULONG; return null;} - }; - } - - @Override - public Fun_0_1<Long, Long> invOperator() { - return new Fun_0_1<Long, Long>() { - public Long apply$G(Long x) { - return ~x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.ULONG; return null;} - }; - } - - @Override - public Long minValue() { - return 0L; - } @Override - public Long maxValue() { - return 0xffffffffffffffffL; + public String typeName() { + return "x10.lang.ULong"; } - - @Override - public Long zeroValue() { - return 0L; - } - - @Override - public Long unitValue() { - return 1L; - } } Modified: trunk/x10.runtime/src-java/x10/rtt/UShortType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-java/x10/rtt/UShortType.java 2010-08-15 17:09:09 UTC (rev 15544) @@ -11,230 +11,27 @@ package x10.rtt; -import x10.core.fun.Fun_0_1; -import x10.core.fun.Fun_0_2; +public class UShortType<T> extends RuntimeType<T> { -public class UShortType extends RuntimeType<Short> { public UShortType(Class<?> c) { super(c); } - @Override - public String typeName() { - return "x10.lang.UShort"; + public UShortType(Class<?> c, Variance... variances) { + super(c, variances); } -// @Override -// public boolean instanceof$(Object o) { -// return o instanceof x10.lang.UShort; -// } - - @Override - public Object makeArray(int length) { - return new short[length]; + public UShortType(Class<?>c, Type<?>[] parents) { + super(c, parents); } - - @Override - public Object makeArray(Object... elem) { - short[] arr = new short[elem.length]; - for (int i = 0; i < elem.length; i++) { - arr[i] = ((Number)elem[i]).shortValue(); - } - return arr; - } - - @Override - public Short getArray(Object array, int i) { - return ((short[]) array)[i]; - } - - @Override - public Short setArray(Object array, int i, Short v) { - ((short[]) array)[i] = v; - return v; - } - - @Override - public int arrayLength(Object array) { - return ((short[]) array).length; - } - - @Override - public Fun_0_1<Short, Short> absOperator() { - return new Fun_0_1<Short, Short>() { - public Short apply$G(Short x) { - return (short) (x > 0 ? x : -x); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_1<Short, Short> scaleOperator(final int k) { - return new Fun_0_1<Short, Short>() { - public Short apply$G(Short x) { - return (short) (x * k); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1) return Types.USHORT; return null;} - }; - } - - @Override - public Fun_0_2<Short, Short, Short> addOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x + y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> subOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x - y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> mulOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x * y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> divOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x / y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> modOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x % y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> maxOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (x > y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> minOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (x < y ? x : y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - - @Override - public Fun_0_2<Short, Short, Short> andOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x & y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - @Override - public Fun_0_2<Short, Short, Short> orOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x | y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; + public UShortType(Class<?> c, Variance[] variances, Type<?>[] parents) { + super(c, variances, parents); } - - @Override - public Fun_0_2<Short, Short, Short> xorOperator() { - return new Fun_0_2<Short, Short, Short>() { - public Short apply$G(Short x, Short y) { - return (short) (x ^ y); - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } @Override - public Fun_0_1<Short, Short> negOperator() { - return new Fun_0_1<Short, Short>() { - public Short apply$G(Short x) { - return (short) -x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; + public String typeName() { + return "x10.lang.UShort"; } - - @Override - public Fun_0_1<Short, Short> posOperator() { - return new Fun_0_1<Short, Short>() { - public Short apply$G(Short x) { - return (short) +x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - - @Override - public Fun_0_1<Short, Short> invOperator() { - return new Fun_0_1<Short, Short>() { - public Short apply$G(Short x) { - return (short) ~x; - } - public RuntimeType<?> getRTT() { return _RTT; } - public Type<?> getParam(int i) {if (i == 0 || i == 1 || i == 2) return Types.USHORT; return null;} - }; - } - - @Override - public Short minValue() { - return (short) 0; - } - - @Override - public Short maxValue() { - return (short) 0xffff; - } - - @Override - public Short zeroValue() { - return (short) 0; - } - - @Override - public Short unitValue() { - return (short) 1; - } } Modified: trunk/x10.runtime/src-x10/x10/lang/String.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/String.x10 2010-08-15 02:31:44 UTC (rev 15543) +++ trunk/x10.runtime/src-x10/x10/lang/String.x10 2010-08-15 17:09:09 UTC (rev 15544) @@ -28,7 +28,7 @@ * with all characters translated to uppercase or to lowercase. Case mapping * is defined in {@link x10.lang.Char}. */ -@NativeRep("java", "java.lang.String", null, null) +@NativeRep("java", "java.lang.String", null, "x10.rtt.Types.STR") @NativeRep("c++", "x10aux::ref<x10::lang::String>", "x10::lang::String", null) public final class String implements (Int) => Char/*TODO, (Range) => String*//*TODO, Ordered[String]*/, Comparable[String] { /** @@ -325,6 +325,7 @@ * @return the ValRail of Strings computed by splitting this String around matches of the given regular expression. */ @Native("java", "x10.core.RailFactory.<java.lang.String>makeValRailFromJavaArray(new x10.rtt.RuntimeType<java.lang.String>(java.lang.String.class), (#0).split(#1))") +// @Native("java", "x10.core.StringAux.split((#0), (#1))") @Native("c++", "(#0)->split(#1)") public native global def split(regex: String): ValRail[String]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-08-17 16:23:24
|
Revision: 15560 http://x10.svn.sourceforge.net/x10/?rev=15560&view=rev Author: yzibin Date: 2010-08-17 16:23:16 +0000 (Tue, 17 Aug 2010) Log Message: ----------- Fixed XTENLANG-1666 Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/ParExpr_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/util/RunTestSuite.java trunk/x10.compiler/src/x10/visit/X10InitChecker.java trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 trunk/x10.tests/examples/Misc/FinalInitializationTest.x10 Added Paths: ----------- trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10.aside trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField1.x10 trunk/x10.tests/examples/Issues/XTENLANG_1666.x10 Removed Paths: ------------- trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10 trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CF1.x10 Modified: trunk/x10.compiler/src/x10/ast/ParExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ParExpr_c.java 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.compiler/src/x10/ast/ParExpr_c.java 2010-08-17 16:23:16 UTC (rev 15560) @@ -17,6 +17,7 @@ import polyglot.ast.Node; import polyglot.ast.Term; import polyglot.ast.Expr_c; +import polyglot.ast.Unary; import polyglot.types.SemanticException; import polyglot.util.CodeWriter; import polyglot.util.Position; @@ -24,6 +25,7 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; +import polyglot.visit.FlowGraph; /** * @author vj Feb 4, 2005 @@ -92,11 +94,18 @@ /* (non-Javadoc) * @see polyglot.ast.Term#acceptCFG(polyglot.visit.CFGBuilder, java.util.List) + * todo Yoav: I just copied it from Unary_c. I think that ParExpr_c should inherit from Unary_c, and we should define Unary.Operator.IDEMPOTENT. */ - public List acceptCFG(CFGBuilder v, List succs) { - v.visitCFG( expr, this, EXIT); - return succs; - } + public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { + if (expr.type().isBoolean()) { + v.visitCFG(expr, FlowGraph.EDGE_KEY_TRUE, this, + EXIT, FlowGraph.EDGE_KEY_FALSE, this, EXIT); + } else { + v.visitCFG(expr, this, EXIT); + } + + return succs; + } public String toString() { return "(" + expr.toString() + ")"; } Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-08-17 16:23:16 UTC (rev 15560) @@ -88,6 +88,7 @@ import x10.types.constraints.TypeConstraint; import x10.util.Synthesizer; import x10.visit.ChangePositionVisitor; +import x10.visit.CheckEscapingThis; /** * The same as a Java class, except that it needs to handle properties. @@ -705,7 +706,9 @@ } n.checkStructMethods(parent, tc); } - + + if (false) + new CheckEscapingThis(this,tc.job(),tc.typeSystem()).typeCheck(); return n; } Modified: trunk/x10.compiler/src/x10/util/RunTestSuite.java =================================================================== --- trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.compiler/src/x10/util/RunTestSuite.java 2010-08-17 16:23:16 UTC (rev 15560) @@ -32,9 +32,9 @@ "NOT_WORKING","SSCA2","FT-alltoall","FT-global" }; private static final String[] EXCLUDE_FILES_WITH = { - "TypedefOverloading","NQueens", + "HeatTransfer_v0.x10", + "TypedefOverloading", "PlaceCheckArray.x10", - "XTENLANG_106.x10","XTENLANG_111.x10","XTENLANG_217.x10","XTENLANG_62.x10" }; private static final String[] INCLUDE_ONLY_FILES_WITH = { //"_MustFailCompile.x10", @@ -69,7 +69,7 @@ * E.g., * C:\cygwin\home\Yoav\intellij\sourceforge\x10.runtime\src-x10 * C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests - * @throws Throwable + * @throws Throwable Can be a failed assertion or missing file. */ public static void main(String[] args) throws Throwable { assert args.length>0 : "The first command line argument must be an x10 filename or a comma separated list of the directories.\n"+ @@ -178,14 +178,14 @@ int warningCount = 0; for (ErrorInfo err : errors) if (err.getErrorKind()==ErrorInfo.WARNING) { - System.err.println(err); + System.err.println("Got a warning in position: "+err.getPosition()+"\nMessage: "+err+"\n"); warningCount++; } if (errors.size()>warningCount) { System.err.println("\nThe following errors did not have a matching ERR marker:\n\n"); for (ErrorInfo err : errors) if (err.getErrorKind()!=ErrorInfo.WARNING) - System.err.println("Position: "+err.getPosition()+"\nMessage: "+err+"\n"); + System.err.println("Position:\n"+err.getPosition()+"\nMessage: "+err+"\n"); } // todo: check that for each file (without errors) we generated a *.class file, and load them and run their main method (except for the ones with _MustFailTimeout) } Modified: trunk/x10.compiler/src/x10/visit/X10InitChecker.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10InitChecker.java 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.compiler/src/x10/visit/X10InitChecker.java 2010-08-17 16:23:16 UTC (rev 15560) @@ -13,6 +13,8 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; import polyglot.ast.ClassBody; import polyglot.ast.ClassDecl; @@ -20,6 +22,8 @@ import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; +import polyglot.ast.Term; +import polyglot.ast.Expr; import polyglot.frontend.Job; import polyglot.types.ClassDef; import polyglot.types.SemanticException; @@ -27,7 +31,9 @@ import polyglot.util.InternalCompilerError; import polyglot.visit.InitChecker; import polyglot.visit.NodeVisitor; +import polyglot.visit.FlowGraph; import x10.ast.X10ClassDecl; +import x10.ast.ParExpr; public class X10InitChecker extends InitChecker { @@ -35,6 +41,26 @@ super(job, ts, nf); } + public Map flow(Item trueItem, Item falseItem, Item otherItem, + FlowGraph graph, Term n, boolean entry, Set succEdgeKeys) { + Item inItem = safeConfluence(trueItem, FlowGraph.EDGE_KEY_TRUE, + falseItem, FlowGraph.EDGE_KEY_FALSE, + otherItem, FlowGraph.EDGE_KEY_OTHER, + n, entry, graph); + if (entry) { + return itemToMap(inItem, succEdgeKeys); + } + if (inItem == BOTTOM) { + return itemToMap(BOTTOM, succEdgeKeys); + } + DataFlowItem inDFItem = ((DataFlowItem)inItem); + if (n instanceof ParExpr && ((ParExpr)n).type().isBoolean()) { + if (trueItem == null) trueItem = inDFItem; + if (falseItem == null) falseItem = inDFItem; + return itemsToMap(trueItem, falseItem, inDFItem, succEdgeKeys); + } + return super.flow(trueItem, falseItem, otherItem, graph,n, entry, succEdgeKeys); + } /** * Overridden superclass method. * Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v0.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -42,7 +42,7 @@ do { for (p in D) Temp(p) = stencil_1(p); - delta = A.map(Temp, (x:Real,y:Real)=>Math.abs(x-y)).reduce(Math.max.(Double,Double), 0.0); + delta = A.map[Real,Real](Temp, (x:Real,y:Real)=>Math.abs(x-y)).reduce(Math.max.(Double,Double), 0.0); for (p in D) A(p) = Temp(p); } while (delta > epsilon); Deleted: trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -1,31 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -import harness.x10Test; - -/** - * - * - * @author igor - */ -public class RailAlias extends x10Test { - public def this(): RailAlias = { } - public def run(): boolean = { - val r: Region{rail} = [0..10]; - val a <: Array[double]{rail} = new Array[double](r, (x:Point)=>0.0); - val d: double = a(1); - for (val (p) in a.region) a(p) = 1.0; - return true; - } - public static def main(var a: Rail[String]): void = { - new RailAlias().execute(); - } -} Copied: trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10.aside (from rev 15385, trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10) =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10.aside (rev 0) +++ trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10.aside 2010-08-17 16:23:16 UTC (rev 15560) @@ -0,0 +1,31 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import harness.x10Test; + +/** + * + * + * @author igor + */ +public class RailAlias extends x10Test { + public def this(): RailAlias = { } + public def run(): boolean = { + val r: Region{rail} = [0..10]; + val a <: Array[double]{rail} = new Array[double](r, (x:Point)=>0.0); + val d: double = a(1); + for (val (p) in a.region) a(p) = 1.0; + return true; + } + public static def main(var a: Rail[String]): void = { + new RailAlias().execute(); + } +} Deleted: trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CF1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CF1.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CF1.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -1,26 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.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 - * - * (C) Copyright IBM Corporation 2006-2010. - */ - - /** - Check that circular dependencies between classes are handled correctly - during TypeElaboration. - See CircularField.x10 - - *@author vj - * - */ - - public class CF1(i:int, j:int) { - public def this(i:int, j:int):CF1{self.i==i,self.j==j} { - property(i,j); - } - var f:CircularField{k==3} = null; - } Modified: trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -22,7 +22,7 @@ public class CircularField(k:int) extends x10Test { public def this(k:int):CircularField = { property(k);} - val h = new CF1(4,4) as CF1{i==j} ; + val h = new CircularField1(4,4) as CircularField1{i==j} ; public def run():boolean = true; public static def main(Rail[String]) = { Copied: trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField1.x10 (from rev 15385, trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CF1.x10) =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField1.x10 (rev 0) +++ trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField1.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -0,0 +1,26 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + + /** + Check that circular dependencies between classes are handled correctly + during TypeElaboration. + See CircularField.x10 + + *@author vj + * + */ + + public class CircularField1(i:int, j:int) { + public def this(i:int, j:int):CircularField1{self.i==i,self.j==j} { + property(i,j); + } + var f:CircularField{k==3} = null; + } Modified: trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -18,13 +18,21 @@ * * @author vj */ -class R(rank:Int) { + +public class B_CheckThisTypeInCallMacro extends x10Test { + public def run() = true; + public static def main(Rail[String]) { + new + B_CheckThisTypeInCallMacro().execute(); + } + +static class R(rank:Int) { static type R(r:int)=R{self.rank==r}; static type Test(r:int)=Test{self.rank==r}; def check( tt:Test(this.rank)) {} def this(r:Int){property(r);} } -class Test(rank:Int) { +static class Test(rank:Int) { static type Test(r:int)=Test{self.rank==r}; static type R(r:int)=R{self.rank==r}; def this(r:Int){property(r);} @@ -33,11 +41,5 @@ r.check(t); } } -public class B_CheckThisTypeInCallMacro extends x10Test { - public def run() = true; - public static def main(Rail[String]) { - new - B_CheckThisTypeInCallMacro().execute(); - } } Added: trunk/x10.tests/examples/Issues/XTENLANG_1666.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_1666.x10 (rev 0) +++ trunk/x10.tests/examples/Issues/XTENLANG_1666.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -0,0 +1,44 @@ +/* + * This file is part of the X10 project (http://x10-lang.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 + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import harness.x10Test; + +/** + * @author yoav + * Testing a bug in definite-assignment rules + */ +public class XTENLANG_1666 extends x10Test { + public static def main(Rail[String]) { + new XTENLANG_1666().execute(); + } + var flag:Boolean; + public def run(): boolean { + var z:Int; + z = flag || (z=3)>0 ? 3 : z++; + + var y:Int; + y = (flag || (y=3)>0) ? 3 : y++; // the bug was in ParExpr (parenthesis expressions) + + + var k:Int; + k = !(!(flag || (k=3)>0)) ? 3 : k++; + + z++; + y++; + k++; + + // I also had a bug with ParExpr in await: + await !false; + await (true); + + return true; + } +} \ No newline at end of file Property changes on: trunk/x10.tests/examples/Issues/XTENLANG_1666.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/x10.tests/examples/Misc/FinalInitializationTest.x10 =================================================================== --- trunk/x10.tests/examples/Misc/FinalInitializationTest.x10 2010-08-17 15:25:22 UTC (rev 15559) +++ trunk/x10.tests/examples/Misc/FinalInitializationTest.x10 2010-08-17 16:23:16 UTC (rev 15560) @@ -22,12 +22,12 @@ val intval: int; val cval: complex!; val refval: foo!; - def this(var intval: int, var cval: complex!, var refval: foo!): myval = { + def this(intval: int, cval: complex!, refval: foo!): myval = { this.intval = intval; this.cval = cval; this.refval = refval; } - def eq(var other: myval!): boolean = { + def eq(other: myval!): boolean = { return this.intval == other.intval && this.cval.eq(other.cval) && @@ -42,7 +42,7 @@ static class complex { val re: int; val im: int; - def this(var re: int, var im: int): complex = { + def this(re: int, im: int): complex = { this.re = re; this.im = im; } @@ -57,7 +57,7 @@ return (x.eq(y)); } - public static def main(var args: Rail[String]): void = { + public static def main(args: Rail[String]): void = { new FinalInitializationTest().execute(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-08-23 21:51:10
|
Revision: 15685 http://x10.svn.sourceforge.net/x10/?rev=15685&view=rev Author: dgrove-oss Date: 2010-08-23 21:50:54 +0000 (Mon, 23 Aug 2010) Log Message: ----------- Import of r2727 of polyglot compiler under EPL and minimal changes to build process to accomodate. More extensive build changes and cleanups to follow later tonight. Modified Paths: -------------- trunk/x10.compiler/build.xml trunk/x10.dist/build.xml trunk/x10.doc/build.xml Added Paths: ----------- trunk/x10.polyglot/ trunk/x10.polyglot/.classpath trunk/x10.polyglot/.project trunk/x10.polyglot/.settings/ trunk/x10.polyglot/.settings/org.eclipse.jdt.core.prefs trunk/x10.polyglot/.settings/org.eclipse.jdt.ui.prefs trunk/x10.polyglot/.swo trunk/x10.polyglot/.swp trunk/x10.polyglot/LICENSE.Eclipse trunk/x10.polyglot/META-INF/ trunk/x10.polyglot/META-INF/MANIFEST.MF trunk/x10.polyglot/META-INF/MANIFEST.MF.in trunk/x10.polyglot/README trunk/x10.polyglot/build.properties trunk/x10.polyglot/build.xml trunk/x10.polyglot/doc/ trunk/x10.polyglot/doc/ASTExtensions.html trunk/x10.polyglot/doc/ASTExtensions.txt trunk/x10.polyglot/doc/DATAFLOW_2_0.txt trunk/x10.polyglot/doc/Overview.html trunk/x10.polyglot/doc/Overview.txt trunk/x10.polyglot/doc/README-JLC.txt trunk/x10.polyglot/doc/README.txt trunk/x10.polyglot/doc/TypeSystemExtensions.html trunk/x10.polyglot/doc/TypeSystemExtensions.txt trunk/x10.polyglot/doc/Upgrade.txt trunk/x10.polyglot/doc/cup-evolution.ai trunk/x10.polyglot/doc/cup-evolution.eps trunk/x10.polyglot/doc/cvs_instructions.html trunk/x10.polyglot/doc/logo.eps trunk/x10.polyglot/doc/overview.css trunk/x10.polyglot/doc/polyglot-logo.eps trunk/x10.polyglot/doc/polyglot-projects.txt trunk/x10.polyglot/doc/polyglot-tree.jpg trunk/x10.polyglot/doc/polyglot.pdf trunk/x10.polyglot/doc/polyglot.ppt trunk/x10.polyglot/doc/ppg.html trunk/x10.polyglot/doc/quasi-quoting.txt trunk/x10.polyglot/doc/todo.txt trunk/x10.polyglot/src/ trunk/x10.polyglot/src/polyglot/ trunk/x10.polyglot/src/polyglot/ast/ trunk/x10.polyglot/src/polyglot/ast/AbstractBlock_c.java trunk/x10.polyglot/src/polyglot/ast/AbstractDelFactory_c.java trunk/x10.polyglot/src/polyglot/ast/AbstractExtFactory_c.java trunk/x10.polyglot/src/polyglot/ast/AbstractNodeFactory_c.java trunk/x10.polyglot/src/polyglot/ast/AmbAssign.java trunk/x10.polyglot/src/polyglot/ast/AmbAssign_c.java trunk/x10.polyglot/src/polyglot/ast/AmbExpr.java trunk/x10.polyglot/src/polyglot/ast/AmbExpr_c.java trunk/x10.polyglot/src/polyglot/ast/AmbPrefix.java trunk/x10.polyglot/src/polyglot/ast/AmbPrefix_c.java trunk/x10.polyglot/src/polyglot/ast/AmbQualifierNode.java trunk/x10.polyglot/src/polyglot/ast/AmbQualifierNode_c.java trunk/x10.polyglot/src/polyglot/ast/AmbReceiver.java trunk/x10.polyglot/src/polyglot/ast/AmbReceiver_c.java trunk/x10.polyglot/src/polyglot/ast/AmbTypeNode.java trunk/x10.polyglot/src/polyglot/ast/AmbTypeNode_c.java trunk/x10.polyglot/src/polyglot/ast/Ambiguous.java trunk/x10.polyglot/src/polyglot/ast/ArrayAccess.java trunk/x10.polyglot/src/polyglot/ast/ArrayAccessAssign.java trunk/x10.polyglot/src/polyglot/ast/ArrayAccessAssign_c.java trunk/x10.polyglot/src/polyglot/ast/ArrayAccess_c.java trunk/x10.polyglot/src/polyglot/ast/ArrayInit.java trunk/x10.polyglot/src/polyglot/ast/ArrayInit_c.java trunk/x10.polyglot/src/polyglot/ast/ArrayTypeNode.java trunk/x10.polyglot/src/polyglot/ast/ArrayTypeNode_c.java trunk/x10.polyglot/src/polyglot/ast/Assert.java trunk/x10.polyglot/src/polyglot/ast/Assert_c.java trunk/x10.polyglot/src/polyglot/ast/Assign.java trunk/x10.polyglot/src/polyglot/ast/Assign_c.java trunk/x10.polyglot/src/polyglot/ast/Binary.java trunk/x10.polyglot/src/polyglot/ast/Binary_c.java trunk/x10.polyglot/src/polyglot/ast/Block.java trunk/x10.polyglot/src/polyglot/ast/Block_c.java trunk/x10.polyglot/src/polyglot/ast/BooleanLit.java trunk/x10.polyglot/src/polyglot/ast/BooleanLit_c.java trunk/x10.polyglot/src/polyglot/ast/Branch.java trunk/x10.polyglot/src/polyglot/ast/Branch_c.java trunk/x10.polyglot/src/polyglot/ast/Call.java trunk/x10.polyglot/src/polyglot/ast/Call_c.java trunk/x10.polyglot/src/polyglot/ast/CanonicalTypeNode.java trunk/x10.polyglot/src/polyglot/ast/CanonicalTypeNode_c.java trunk/x10.polyglot/src/polyglot/ast/Case.java trunk/x10.polyglot/src/polyglot/ast/Case_c.java trunk/x10.polyglot/src/polyglot/ast/Cast.java trunk/x10.polyglot/src/polyglot/ast/Cast_c.java trunk/x10.polyglot/src/polyglot/ast/Catch.java trunk/x10.polyglot/src/polyglot/ast/Catch_c.java trunk/x10.polyglot/src/polyglot/ast/CharLit.java trunk/x10.polyglot/src/polyglot/ast/CharLit_c.java trunk/x10.polyglot/src/polyglot/ast/ClassBody.java trunk/x10.polyglot/src/polyglot/ast/ClassBody_c.java trunk/x10.polyglot/src/polyglot/ast/ClassDecl.java trunk/x10.polyglot/src/polyglot/ast/ClassDecl_c.java trunk/x10.polyglot/src/polyglot/ast/ClassLit.java trunk/x10.polyglot/src/polyglot/ast/ClassLit_c.java trunk/x10.polyglot/src/polyglot/ast/ClassMember.java trunk/x10.polyglot/src/polyglot/ast/CodeBlock.java trunk/x10.polyglot/src/polyglot/ast/CodeDecl.java trunk/x10.polyglot/src/polyglot/ast/CodeNode.java trunk/x10.polyglot/src/polyglot/ast/CompoundStmt.java trunk/x10.polyglot/src/polyglot/ast/Conditional.java trunk/x10.polyglot/src/polyglot/ast/Conditional_c.java trunk/x10.polyglot/src/polyglot/ast/ConstructorCall.java trunk/x10.polyglot/src/polyglot/ast/ConstructorCall_c.java trunk/x10.polyglot/src/polyglot/ast/ConstructorDecl.java trunk/x10.polyglot/src/polyglot/ast/ConstructorDecl_c.java trunk/x10.polyglot/src/polyglot/ast/DelFactory.java trunk/x10.polyglot/src/polyglot/ast/Disamb.java trunk/x10.polyglot/src/polyglot/ast/Disamb_c.java trunk/x10.polyglot/src/polyglot/ast/Do.java trunk/x10.polyglot/src/polyglot/ast/Do_c.java trunk/x10.polyglot/src/polyglot/ast/Empty.java trunk/x10.polyglot/src/polyglot/ast/Empty_c.java trunk/x10.polyglot/src/polyglot/ast/Eval.java trunk/x10.polyglot/src/polyglot/ast/Eval_c.java trunk/x10.polyglot/src/polyglot/ast/Expr.java trunk/x10.polyglot/src/polyglot/ast/Expr_c.java trunk/x10.polyglot/src/polyglot/ast/Ext.java trunk/x10.polyglot/src/polyglot/ast/ExtFactory.java trunk/x10.polyglot/src/polyglot/ast/Ext_c.java trunk/x10.polyglot/src/polyglot/ast/Field.java trunk/x10.polyglot/src/polyglot/ast/FieldAssign.java trunk/x10.polyglot/src/polyglot/ast/FieldAssign_c.java trunk/x10.polyglot/src/polyglot/ast/FieldDecl.java trunk/x10.polyglot/src/polyglot/ast/FieldDecl_c.java trunk/x10.polyglot/src/polyglot/ast/Field_c.java trunk/x10.polyglot/src/polyglot/ast/FlagsNode.java trunk/x10.polyglot/src/polyglot/ast/FlagsNode_c.java trunk/x10.polyglot/src/polyglot/ast/FloatLit.java trunk/x10.polyglot/src/polyglot/ast/FloatLit_c.java trunk/x10.polyglot/src/polyglot/ast/For.java trunk/x10.polyglot/src/polyglot/ast/ForInit.java trunk/x10.polyglot/src/polyglot/ast/ForUpdate.java trunk/x10.polyglot/src/polyglot/ast/For_c.java trunk/x10.polyglot/src/polyglot/ast/Formal.java trunk/x10.polyglot/src/polyglot/ast/Formal_c.java trunk/x10.polyglot/src/polyglot/ast/Id.java trunk/x10.polyglot/src/polyglot/ast/Id_c.java trunk/x10.polyglot/src/polyglot/ast/If.java trunk/x10.polyglot/src/polyglot/ast/If_c.java trunk/x10.polyglot/src/polyglot/ast/Import.java trunk/x10.polyglot/src/polyglot/ast/Import_c.java trunk/x10.polyglot/src/polyglot/ast/Initializer.java trunk/x10.polyglot/src/polyglot/ast/Initializer_c.java trunk/x10.polyglot/src/polyglot/ast/Instanceof.java trunk/x10.polyglot/src/polyglot/ast/Instanceof_c.java trunk/x10.polyglot/src/polyglot/ast/IntLit.java trunk/x10.polyglot/src/polyglot/ast/IntLit_c.java trunk/x10.polyglot/src/polyglot/ast/JL.java trunk/x10.polyglot/src/polyglot/ast/JL_c.java trunk/x10.polyglot/src/polyglot/ast/Labeled.java trunk/x10.polyglot/src/polyglot/ast/Labeled_c.java trunk/x10.polyglot/src/polyglot/ast/Lit.java trunk/x10.polyglot/src/polyglot/ast/Lit_c.java trunk/x10.polyglot/src/polyglot/ast/Local.java trunk/x10.polyglot/src/polyglot/ast/LocalAssign.java trunk/x10.polyglot/src/polyglot/ast/LocalAssign_c.java trunk/x10.polyglot/src/polyglot/ast/LocalClassDecl.java trunk/x10.polyglot/src/polyglot/ast/LocalClassDecl_c.java trunk/x10.polyglot/src/polyglot/ast/LocalDecl.java trunk/x10.polyglot/src/polyglot/ast/LocalDecl_c.java trunk/x10.polyglot/src/polyglot/ast/Local_c.java trunk/x10.polyglot/src/polyglot/ast/Loop.java trunk/x10.polyglot/src/polyglot/ast/Loop_c.java trunk/x10.polyglot/src/polyglot/ast/MethodDecl.java trunk/x10.polyglot/src/polyglot/ast/MethodDecl_c.java trunk/x10.polyglot/src/polyglot/ast/NamedVariable.java trunk/x10.polyglot/src/polyglot/ast/New.java trunk/x10.polyglot/src/polyglot/ast/NewArray.java trunk/x10.polyglot/src/polyglot/ast/NewArray_c.java trunk/x10.polyglot/src/polyglot/ast/New_c.java trunk/x10.polyglot/src/polyglot/ast/Node.java trunk/x10.polyglot/src/polyglot/ast/NodeFactory.java trunk/x10.polyglot/src/polyglot/ast/NodeFactory_c.java trunk/x10.polyglot/src/polyglot/ast/NodeList.java trunk/x10.polyglot/src/polyglot/ast/NodeList_c.java trunk/x10.polyglot/src/polyglot/ast/NodeOps.java trunk/x10.polyglot/src/polyglot/ast/Node_c.java trunk/x10.polyglot/src/polyglot/ast/NullLit.java trunk/x10.polyglot/src/polyglot/ast/NullLit_c.java trunk/x10.polyglot/src/polyglot/ast/NumLit.java trunk/x10.polyglot/src/polyglot/ast/NumLit_c.java trunk/x10.polyglot/src/polyglot/ast/PackageNode.java trunk/x10.polyglot/src/polyglot/ast/PackageNode_c.java trunk/x10.polyglot/src/polyglot/ast/Precedence.java trunk/x10.polyglot/src/polyglot/ast/Prefix.java trunk/x10.polyglot/src/polyglot/ast/ProcedureCall.java trunk/x10.polyglot/src/polyglot/ast/ProcedureDecl.java trunk/x10.polyglot/src/polyglot/ast/QualifierNode.java trunk/x10.polyglot/src/polyglot/ast/Receiver.java trunk/x10.polyglot/src/polyglot/ast/Return.java trunk/x10.polyglot/src/polyglot/ast/Return_c.java trunk/x10.polyglot/src/polyglot/ast/SourceCollection.java trunk/x10.polyglot/src/polyglot/ast/SourceCollection_c.java trunk/x10.polyglot/src/polyglot/ast/SourceFile.java trunk/x10.polyglot/src/polyglot/ast/SourceFile_c.java trunk/x10.polyglot/src/polyglot/ast/Special.java trunk/x10.polyglot/src/polyglot/ast/Special_c.java trunk/x10.polyglot/src/polyglot/ast/Stmt.java trunk/x10.polyglot/src/polyglot/ast/Stmt_c.java trunk/x10.polyglot/src/polyglot/ast/StringLit.java trunk/x10.polyglot/src/polyglot/ast/StringLit_c.java trunk/x10.polyglot/src/polyglot/ast/Switch.java trunk/x10.polyglot/src/polyglot/ast/SwitchBlock.java trunk/x10.polyglot/src/polyglot/ast/SwitchBlock_c.java trunk/x10.polyglot/src/polyglot/ast/SwitchElement.java trunk/x10.polyglot/src/polyglot/ast/Switch_c.java trunk/x10.polyglot/src/polyglot/ast/Synchronized.java trunk/x10.polyglot/src/polyglot/ast/Synchronized_c.java trunk/x10.polyglot/src/polyglot/ast/Term.java trunk/x10.polyglot/src/polyglot/ast/Term_c.java trunk/x10.polyglot/src/polyglot/ast/Throw.java trunk/x10.polyglot/src/polyglot/ast/Throw_c.java trunk/x10.polyglot/src/polyglot/ast/TopLevelDecl.java trunk/x10.polyglot/src/polyglot/ast/Try.java trunk/x10.polyglot/src/polyglot/ast/Try_c.java trunk/x10.polyglot/src/polyglot/ast/TypeCheckFragmentGoal.java trunk/x10.polyglot/src/polyglot/ast/TypeCheckTypeGoal.java trunk/x10.polyglot/src/polyglot/ast/TypeNode.java trunk/x10.polyglot/src/polyglot/ast/TypeNode_c.java trunk/x10.polyglot/src/polyglot/ast/Typed.java trunk/x10.polyglot/src/polyglot/ast/Unary.java trunk/x10.polyglot/src/polyglot/ast/Unary_c.java trunk/x10.polyglot/src/polyglot/ast/VarDecl.java trunk/x10.polyglot/src/polyglot/ast/VarInit.java trunk/x10.polyglot/src/polyglot/ast/Variable.java trunk/x10.polyglot/src/polyglot/ast/While.java trunk/x10.polyglot/src/polyglot/ast/While_c.java trunk/x10.polyglot/src/polyglot/ast/package.html trunk/x10.polyglot/src/polyglot/dispatch/ trunk/x10.polyglot/src/polyglot/dispatch/Dispatch.java trunk/x10.polyglot/src/polyglot/dispatch/PassthruError.java trunk/x10.polyglot/src/polyglot/frontend/ trunk/x10.polyglot/src/polyglot/frontend/AbstractExtensionInfo.java trunk/x10.polyglot/src/polyglot/frontend/AbstractGoal_c.java trunk/x10.polyglot/src/polyglot/frontend/AllBarrierGoal.java trunk/x10.polyglot/src/polyglot/frontend/BarrierGoal.java trunk/x10.polyglot/src/polyglot/frontend/ClassPathResourceLoader.java trunk/x10.polyglot/src/polyglot/frontend/Compiler.java trunk/x10.polyglot/src/polyglot/frontend/CyclicDependencyException.java trunk/x10.polyglot/src/polyglot/frontend/ExtensionInfo.java trunk/x10.polyglot/src/polyglot/frontend/FileResource.java trunk/x10.polyglot/src/polyglot/frontend/FileSource.java trunk/x10.polyglot/src/polyglot/frontend/ForgivingVisitorGoal.java trunk/x10.polyglot/src/polyglot/frontend/Globals.java trunk/x10.polyglot/src/polyglot/frontend/Goal.java trunk/x10.polyglot/src/polyglot/frontend/JLScheduler.java trunk/x10.polyglot/src/polyglot/frontend/JLVersion.java trunk/x10.polyglot/src/polyglot/frontend/Job.java trunk/x10.polyglot/src/polyglot/frontend/JobExt.java trunk/x10.polyglot/src/polyglot/frontend/OutputGoal.java trunk/x10.polyglot/src/polyglot/frontend/Parser.java trunk/x10.polyglot/src/polyglot/frontend/ParserGoal.java trunk/x10.polyglot/src/polyglot/frontend/ParserlessJLExtensionInfo.java trunk/x10.polyglot/src/polyglot/frontend/Resource.java trunk/x10.polyglot/src/polyglot/frontend/ResourceLoader.java trunk/x10.polyglot/src/polyglot/frontend/Scheduler.java trunk/x10.polyglot/src/polyglot/frontend/SchedulerException.java trunk/x10.polyglot/src/polyglot/frontend/SetResolverGoal.java trunk/x10.polyglot/src/polyglot/frontend/Source.java trunk/x10.polyglot/src/polyglot/frontend/SourceGoal.java trunk/x10.polyglot/src/polyglot/frontend/SourceGoal_c.java trunk/x10.polyglot/src/polyglot/frontend/SourceLoader.java trunk/x10.polyglot/src/polyglot/frontend/Stats.java trunk/x10.polyglot/src/polyglot/frontend/SymbolGoal.java trunk/x10.polyglot/src/polyglot/frontend/TargetFactory.java trunk/x10.polyglot/src/polyglot/frontend/Topics.java trunk/x10.polyglot/src/polyglot/frontend/TypeObjectGoal.java trunk/x10.polyglot/src/polyglot/frontend/TypeObjectGoal_c.java trunk/x10.polyglot/src/polyglot/frontend/VisitorGoal.java trunk/x10.polyglot/src/polyglot/frontend/ZipResource.java trunk/x10.polyglot/src/polyglot/frontend/package.html trunk/x10.polyglot/src/polyglot/lex/ trunk/x10.polyglot/src/polyglot/lex/BooleanLiteral.java trunk/x10.polyglot/src/polyglot/lex/CharacterLiteral.java trunk/x10.polyglot/src/polyglot/lex/DoubleLiteral.java trunk/x10.polyglot/src/polyglot/lex/EOF.java trunk/x10.polyglot/src/polyglot/lex/EscapedUnicodeReader.java trunk/x10.polyglot/src/polyglot/lex/FloatLiteral.java trunk/x10.polyglot/src/polyglot/lex/Identifier.java trunk/x10.polyglot/src/polyglot/lex/InputElement.java trunk/x10.polyglot/src/polyglot/lex/IntegerLiteral.java trunk/x10.polyglot/src/polyglot/lex/Keyword.java trunk/x10.polyglot/src/polyglot/lex/Lexer.java trunk/x10.polyglot/src/polyglot/lex/Literal.java trunk/x10.polyglot/src/polyglot/lex/LongLiteral.java trunk/x10.polyglot/src/polyglot/lex/NullLiteral.java trunk/x10.polyglot/src/polyglot/lex/NumericLiteral.java trunk/x10.polyglot/src/polyglot/lex/Operator.java trunk/x10.polyglot/src/polyglot/lex/StringLiteral.java trunk/x10.polyglot/src/polyglot/lex/Token.java trunk/x10.polyglot/src/polyglot/lex/package.html trunk/x10.polyglot/src/polyglot/main/ trunk/x10.polyglot/src/polyglot/main/Main.java trunk/x10.polyglot/src/polyglot/main/Options.java trunk/x10.polyglot/src/polyglot/main/Report.java trunk/x10.polyglot/src/polyglot/main/UsageError.java trunk/x10.polyglot/src/polyglot/main/Version.java trunk/x10.polyglot/src/polyglot/main/package.html trunk/x10.polyglot/src/polyglot/parse/ trunk/x10.polyglot/src/polyglot/parse/ParsedName.java trunk/x10.polyglot/src/polyglot/parse/VarDeclarator.java trunk/x10.polyglot/src/polyglot/parse/package.html trunk/x10.polyglot/src/polyglot/types/ trunk/x10.polyglot/src/polyglot/types/AbstractAccessControlResolver.java trunk/x10.polyglot/src/polyglot/types/AbstractRef_c.java trunk/x10.polyglot/src/polyglot/types/AccessControlResolver.java trunk/x10.polyglot/src/polyglot/types/AccessControlWrapperResolver.java trunk/x10.polyglot/src/polyglot/types/AnotherCachingResolver.java trunk/x10.polyglot/src/polyglot/types/ArrayType.java trunk/x10.polyglot/src/polyglot/types/ArrayType_c.java trunk/x10.polyglot/src/polyglot/types/BadSerializationException.java trunk/x10.polyglot/src/polyglot/types/CachingResolver.java trunk/x10.polyglot/src/polyglot/types/ClassAsTypeTransform.java trunk/x10.polyglot/src/polyglot/types/ClassContextResolver.java trunk/x10.polyglot/src/polyglot/types/ClassDef.java trunk/x10.polyglot/src/polyglot/types/ClassDef_c.java trunk/x10.polyglot/src/polyglot/types/ClassType.java trunk/x10.polyglot/src/polyglot/types/ClassType_c.java trunk/x10.polyglot/src/polyglot/types/CodeDef.java trunk/x10.polyglot/src/polyglot/types/CodeInstance.java trunk/x10.polyglot/src/polyglot/types/ConstructorAsTypeTransform.java trunk/x10.polyglot/src/polyglot/types/ConstructorDef.java trunk/x10.polyglot/src/polyglot/types/ConstructorDef_c.java trunk/x10.polyglot/src/polyglot/types/ConstructorInstance.java trunk/x10.polyglot/src/polyglot/types/ConstructorInstance_c.java trunk/x10.polyglot/src/polyglot/types/Context.java trunk/x10.polyglot/src/polyglot/types/Context_c.java trunk/x10.polyglot/src/polyglot/types/Def.java trunk/x10.polyglot/src/polyglot/types/Def_c.java trunk/x10.polyglot/src/polyglot/types/DerefTransform.java trunk/x10.polyglot/src/polyglot/types/EmptyResolver.java trunk/x10.polyglot/src/polyglot/types/ErrorRef_c.java trunk/x10.polyglot/src/polyglot/types/FieldAsTypeTransform.java trunk/x10.polyglot/src/polyglot/types/FieldDef.java trunk/x10.polyglot/src/polyglot/types/FieldDef_c.java trunk/x10.polyglot/src/polyglot/types/FieldInstance.java trunk/x10.polyglot/src/polyglot/types/FieldInstance_c.java trunk/x10.polyglot/src/polyglot/types/Flags.java trunk/x10.polyglot/src/polyglot/types/FunctionDef.java trunk/x10.polyglot/src/polyglot/types/FunctionInstance.java trunk/x10.polyglot/src/polyglot/types/FunctionInstance_c.java trunk/x10.polyglot/src/polyglot/types/Handler.java trunk/x10.polyglot/src/polyglot/types/ImportTable.java trunk/x10.polyglot/src/polyglot/types/Importable.java trunk/x10.polyglot/src/polyglot/types/InitializerDef.java trunk/x10.polyglot/src/polyglot/types/InitializerDef_c.java trunk/x10.polyglot/src/polyglot/types/InitializerInstance.java trunk/x10.polyglot/src/polyglot/types/InitializerInstance_c.java trunk/x10.polyglot/src/polyglot/types/LazyRef.java trunk/x10.polyglot/src/polyglot/types/LazyRef_c.java trunk/x10.polyglot/src/polyglot/types/LoadedClassResolver.java trunk/x10.polyglot/src/polyglot/types/LocalDef.java trunk/x10.polyglot/src/polyglot/types/LocalDef_c.java trunk/x10.polyglot/src/polyglot/types/LocalInstance.java trunk/x10.polyglot/src/polyglot/types/LocalInstance_c.java trunk/x10.polyglot/src/polyglot/types/Matcher.java trunk/x10.polyglot/src/polyglot/types/MemberClassResolver.java trunk/x10.polyglot/src/polyglot/types/MemberDef.java trunk/x10.polyglot/src/polyglot/types/MemberInstance.java trunk/x10.polyglot/src/polyglot/types/MethodAsTypeTransform.java trunk/x10.polyglot/src/polyglot/types/MethodDef.java trunk/x10.polyglot/src/polyglot/types/MethodDef_c.java trunk/x10.polyglot/src/polyglot/types/MethodInstance.java trunk/x10.polyglot/src/polyglot/types/MethodInstance_c.java trunk/x10.polyglot/src/polyglot/types/Name.java trunk/x10.polyglot/src/polyglot/types/Named.java trunk/x10.polyglot/src/polyglot/types/NoClassException.java trunk/x10.polyglot/src/polyglot/types/NoMemberException.java trunk/x10.polyglot/src/polyglot/types/NullType.java trunk/x10.polyglot/src/polyglot/types/NullType_c.java trunk/x10.polyglot/src/polyglot/types/ObjectType.java trunk/x10.polyglot/src/polyglot/types/Package.java trunk/x10.polyglot/src/polyglot/types/PackageContextResolver.java trunk/x10.polyglot/src/polyglot/types/Package_c.java trunk/x10.polyglot/src/polyglot/types/ParsedClassType.java trunk/x10.polyglot/src/polyglot/types/ParsedClassType_c.java trunk/x10.polyglot/src/polyglot/types/ParsedTypeObject.java trunk/x10.polyglot/src/polyglot/types/PrimitiveType.java trunk/x10.polyglot/src/polyglot/types/PrimitiveType_c.java trunk/x10.polyglot/src/polyglot/types/ProcedureDef.java trunk/x10.polyglot/src/polyglot/types/ProcedureDef_c.java trunk/x10.polyglot/src/polyglot/types/ProcedureInstance.java trunk/x10.polyglot/src/polyglot/types/ProcedureInstance_c.java trunk/x10.polyglot/src/polyglot/types/QName.java trunk/x10.polyglot/src/polyglot/types/Qualifier.java trunk/x10.polyglot/src/polyglot/types/Ref.java trunk/x10.polyglot/src/polyglot/types/Ref_c.java trunk/x10.polyglot/src/polyglot/types/ReferenceType.java trunk/x10.polyglot/src/polyglot/types/ReferenceType_c.java trunk/x10.polyglot/src/polyglot/types/Resolver.java trunk/x10.polyglot/src/polyglot/types/SemanticException.java trunk/x10.polyglot/src/polyglot/types/SourceClassResolver.java trunk/x10.polyglot/src/polyglot/types/SourceLoadException.java trunk/x10.polyglot/src/polyglot/types/StructType.java trunk/x10.polyglot/src/polyglot/types/SystemResolver.java trunk/x10.polyglot/src/polyglot/types/TopLevelResolver.java trunk/x10.polyglot/src/polyglot/types/Type.java trunk/x10.polyglot/src/polyglot/types/TypeEnv.java trunk/x10.polyglot/src/polyglot/types/TypeEnv_c.java trunk/x10.polyglot/src/polyglot/types/TypeObject.java trunk/x10.polyglot/src/polyglot/types/TypeObject_c.java trunk/x10.polyglot/src/polyglot/types/TypeSystem.java trunk/x10.polyglot/src/polyglot/types/TypeSystem_c.java trunk/x10.polyglot/src/polyglot/types/Type_c.java trunk/x10.polyglot/src/polyglot/types/Types.java trunk/x10.polyglot/src/polyglot/types/UnknownPackage.java trunk/x10.polyglot/src/polyglot/types/UnknownPackage_c.java trunk/x10.polyglot/src/polyglot/types/UnknownQualifier.java trunk/x10.polyglot/src/polyglot/types/UnknownQualifier_c.java trunk/x10.polyglot/src/polyglot/types/UnknownType.java trunk/x10.polyglot/src/polyglot/types/UnknownType_c.java trunk/x10.polyglot/src/polyglot/types/Use.java trunk/x10.polyglot/src/polyglot/types/Use_c.java trunk/x10.polyglot/src/polyglot/types/ValueType.java trunk/x10.polyglot/src/polyglot/types/VarDef.java trunk/x10.polyglot/src/polyglot/types/VarDef_c.java trunk/x10.polyglot/src/polyglot/types/VarInstance.java trunk/x10.polyglot/src/polyglot/types/VarInstance_c.java trunk/x10.polyglot/src/polyglot/types/package.html trunk/x10.polyglot/src/polyglot/types/reflect/ trunk/x10.polyglot/src/polyglot/types/reflect/Attribute.java trunk/x10.polyglot/src/polyglot/types/reflect/ClassFile.java trunk/x10.polyglot/src/polyglot/types/reflect/ClassFileLazyClassInitializer.java trunk/x10.polyglot/src/polyglot/types/reflect/ClassFileLoader.java trunk/x10.polyglot/src/polyglot/types/reflect/Constant.java trunk/x10.polyglot/src/polyglot/types/reflect/ConstantValue.java trunk/x10.polyglot/src/polyglot/types/reflect/Exceptions.java trunk/x10.polyglot/src/polyglot/types/reflect/Field.java trunk/x10.polyglot/src/polyglot/types/reflect/InnerClasses.java trunk/x10.polyglot/src/polyglot/types/reflect/JLCInfo.java trunk/x10.polyglot/src/polyglot/types/reflect/Method.java trunk/x10.polyglot/src/polyglot/util/ trunk/x10.polyglot/src/polyglot/util/AbstractErrorQueue.java trunk/x10.polyglot/src/polyglot/util/Base64.java trunk/x10.polyglot/src/polyglot/util/CachingTransformingList.java trunk/x10.polyglot/src/polyglot/util/CannotResolvePlaceHolderException.java trunk/x10.polyglot/src/polyglot/util/CodeWriter.java trunk/x10.polyglot/src/polyglot/util/CollectionUtil.java trunk/x10.polyglot/src/polyglot/util/ConcatenatedIterator.java trunk/x10.polyglot/src/polyglot/util/Copy.java trunk/x10.polyglot/src/polyglot/util/Enum.java trunk/x10.polyglot/src/polyglot/util/ErrorInfo.java trunk/x10.polyglot/src/polyglot/util/ErrorLimitError.java trunk/x10.polyglot/src/polyglot/util/ErrorQueue.java trunk/x10.polyglot/src/polyglot/util/FileUtil.java trunk/x10.polyglot/src/polyglot/util/FilteringIterator.java trunk/x10.polyglot/src/polyglot/util/FilteringList.java trunk/x10.polyglot/src/polyglot/util/IdentityKey.java trunk/x10.polyglot/src/polyglot/util/Internable.java trunk/x10.polyglot/src/polyglot/util/InternalCompilerError.java trunk/x10.polyglot/src/polyglot/util/NestedMap.java trunk/x10.polyglot/src/polyglot/util/ObjectDumper.java trunk/x10.polyglot/src/polyglot/util/OptimalCodeWriter.java trunk/x10.polyglot/src/polyglot/util/Option.java trunk/x10.polyglot/src/polyglot/util/Pair.java trunk/x10.polyglot/src/polyglot/util/Position.java trunk/x10.polyglot/src/polyglot/util/Predicate.java trunk/x10.polyglot/src/polyglot/util/Predicate2.java trunk/x10.polyglot/src/polyglot/util/QuotedStringTokenizer.java trunk/x10.polyglot/src/polyglot/util/SilentErrorQueue.java trunk/x10.polyglot/src/polyglot/util/SimpleCodeWriter.java trunk/x10.polyglot/src/polyglot/util/SimpleErrorQueue.java trunk/x10.polyglot/src/polyglot/util/StdErrorQueue.java trunk/x10.polyglot/src/polyglot/util/StringUtil.java trunk/x10.polyglot/src/polyglot/util/SubtypeSet.java trunk/x10.polyglot/src/polyglot/util/Transformation.java trunk/x10.polyglot/src/polyglot/util/TransformingIterator.java trunk/x10.polyglot/src/polyglot/util/TransformingList.java trunk/x10.polyglot/src/polyglot/util/TypeEncoder.java trunk/x10.polyglot/src/polyglot/util/TypeInputStream.java trunk/x10.polyglot/src/polyglot/util/TypeOutputStream.java trunk/x10.polyglot/src/polyglot/util/TypedList.java trunk/x10.polyglot/src/polyglot/util/TypedListIterator.java trunk/x10.polyglot/src/polyglot/util/UnicodeWriter.java trunk/x10.polyglot/src/polyglot/util/UniqueID.java trunk/x10.polyglot/src/polyglot/util/WorkList.java trunk/x10.polyglot/src/polyglot/util/package.html trunk/x10.polyglot/src/polyglot/util/typedump/ trunk/x10.polyglot/src/polyglot/util/typedump/Main.java trunk/x10.polyglot/src/polyglot/util/typedump/TypeDumper.java trunk/x10.polyglot/src/polyglot/visit/ trunk/x10.polyglot/src/polyglot/visit/AlphaRenamer.java trunk/x10.polyglot/src/polyglot/visit/AscriptionVisitor.java trunk/x10.polyglot/src/polyglot/visit/CFGBuildError.java trunk/x10.polyglot/src/polyglot/visit/CFGBuilder.java trunk/x10.polyglot/src/polyglot/visit/ClassSerializer.java trunk/x10.polyglot/src/polyglot/visit/CodeCleaner.java trunk/x10.polyglot/src/polyglot/visit/ConformanceChecker.java trunk/x10.polyglot/src/polyglot/visit/ConstantFolder.java trunk/x10.polyglot/src/polyglot/visit/ConstructorCallChecker.java trunk/x10.polyglot/src/polyglot/visit/ContextVisitor.java trunk/x10.polyglot/src/polyglot/visit/CopyPropagator.java trunk/x10.polyglot/src/polyglot/visit/DataFlow.java trunk/x10.polyglot/src/polyglot/visit/DeadCodeEliminator.java trunk/x10.polyglot/src/polyglot/visit/DumpAst.java trunk/x10.polyglot/src/polyglot/visit/ErrorHandlingVisitor.java trunk/x10.polyglot/src/polyglot/visit/ExceptionChecker.java trunk/x10.polyglot/src/polyglot/visit/ExitChecker.java trunk/x10.polyglot/src/polyglot/visit/ExtensionCleaner.java trunk/x10.polyglot/src/polyglot/visit/FinalLocalExtractor.java trunk/x10.polyglot/src/polyglot/visit/FlattenVisitor.java trunk/x10.polyglot/src/polyglot/visit/FlowGraph.java trunk/x10.polyglot/src/polyglot/visit/FwdReferenceChecker.java trunk/x10.polyglot/src/polyglot/visit/HandoffVisitor.java trunk/x10.polyglot/src/polyglot/visit/InitChecker.java trunk/x10.polyglot/src/polyglot/visit/InitImportsVisitor.java trunk/x10.polyglot/src/polyglot/visit/InnerClassRemover.java trunk/x10.polyglot/src/polyglot/visit/LocalClassRemover.java trunk/x10.polyglot/src/polyglot/visit/NodeScrambler.java trunk/x10.polyglot/src/polyglot/visit/NodeVisitor.java trunk/x10.polyglot/src/polyglot/visit/PostCompiled.java trunk/x10.polyglot/src/polyglot/visit/PrettyPrinter.java trunk/x10.polyglot/src/polyglot/visit/PruningVisitor.java trunk/x10.polyglot/src/polyglot/visit/ReachChecker.java trunk/x10.polyglot/src/polyglot/visit/RedundantCastRemover.java trunk/x10.polyglot/src/polyglot/visit/ReentrantVisitor.java trunk/x10.polyglot/src/polyglot/visit/Translator.java trunk/x10.polyglot/src/polyglot/visit/TypeBuilder.java trunk/x10.polyglot/src/polyglot/visit/TypeCheckPreparer.java trunk/x10.polyglot/src/polyglot/visit/TypeChecker.java trunk/x10.polyglot/src/polyglot/visit/TypeComputer.java trunk/x10.polyglot/src/polyglot/visit/TypedTranslator.java trunk/x10.polyglot/src/polyglot/visit/package.html Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2010-08-23 19:34:09 UTC (rev 15684) +++ trunk/x10.compiler/build.xml 2010-08-23 21:50:54 UTC (rev 15685) @@ -14,7 +14,7 @@ <property name="etc" location="${x10.dist.location}/etc"/> <property name="config" value="*.cfg"/> <property name="lpg.jar" value="lpg.jar"/> - <property name="polyglot.jar" value="polyglot3.jar"/> + <property name="polyglot.jar" value="polyglot.jar"/> <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="lpg.classpath"/> @@ -154,7 +154,7 @@ <arg value="-R"/> <arg value="--exclude=classes"/> <arg value="lpg.runtime.java"/> - <arg value="polyglot"/> + <arg value="x10.polyglot"/> <arg value="x10.compiler"/> <arg value="x10.runtime"/> <arg value="x10.common"/> Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2010-08-23 19:34:09 UTC (rev 15684) +++ trunk/x10.dist/build.xml 2010-08-23 21:50:54 UTC (rev 15685) @@ -12,9 +12,8 @@ <property name="lpg.jar.url" value="http://dist.codehaus.org/x10/dependencies/lpg.runtime.java_2.0.18.jar"/> <property name="ecj.jar" value="ecj.jar"/> <property name="ecj.jar.url" value="http://dist.codehaus.org/x10/dependencies/ecj-3.5.1.jar"/> - <property name="polyglot.jar" value="polyglot3.jar"/> - <property name="polyglot.url" value="http://polyglot-compiler.googlecode.com/svn/trunk/updates/plugins"/> - <property name="polyglot.jar.url" value="${polyglot.url}/polyglot3_3.2.0.jar"/> + <property name="x10.polyglot.location" location="${x10.home}/x10.polyglot"/> + <property name="polyglot.jar" value="polyglot.jar"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> <property name="constraints.jar" value="x10constraints.jar"/> <property name="x10.common.location" location="${x10.home}/x10.common"/> @@ -34,9 +33,6 @@ <mkdir dir="${etc}" /> <mkdir dir="${incdir}" /> <mkdir dir="${lib}" /> - <condition property="local.polyglot.jar" value="${env.LOCAL_POLYGLOT_JAR}"> - <isset property="env.LOCAL_POLYGLOT_JAR"/> - </condition> <condition property="local.lpg.jar" value="${env.LOCAL_LPG_JAR}"> <isset property="env.LOCAL_LPG_JAR"/> </condition> @@ -81,12 +77,14 @@ <ant antfile="${x10.constraints.location}/build.xml" target="clean" inheritAll="false" dir="${x10.constraints.location}"/> <ant antfile="${x10.common.location}/build.xml" target="clean" inheritAll="false" dir="${x10.common.location}"/> <ant antfile="${x10.runtime.location}/build.xml" target="clean" inheritAll="false" dir="${x10.runtime.location}"/> + <ant antfile="${x10.polyglot.location}/build.xml" target="clean" inheritAll="false" dir="${x10.polyglot.location}"/> <ant antfile="${x10.compiler.location}/build.xml" target="clean" inheritAll="false" dir="${x10.compiler.location}"/> </target> <target name="distclean" depends="squeakyclean"> <delete dir="${lib}" failonerror="false"/> <mkdir dir="${lib}" /> + <ant antfile="${x10.polyglot.location}/build.xml" target="clobber" inheritAll="false" dir="${x10.polyglot.location}"/> <ant antfile="${x10.runtime.location}/build.xml" target="distclean" inheritAll="false" dir="${x10.runtime.location}"/> </target> @@ -97,12 +95,10 @@ <target name="check-jar-cache" depends="init"> <available property="lpg.jar.present" file="${lib}/${lpg.jar}"/> <available property="ecj.jar.present" file="${lib}/${ecj.jar}"/> - <available property="polyglot.jar.present" file="${lib}/${polyglot.jar}"/> <condition property="cache.up-to-date"> <and> <isset property="lpg.jar.present"/> <isset property="ecj.jar.present"/> - <isset property="polyglot.jar.present"/> </and> </condition> </target> @@ -134,22 +130,17 @@ <fail message="Unable to find ${ecj.jar} at ${local.ecj.jar}" unless="ecj.jar.present"/> </target> - <target name="polyglot-jar" depends="init,polyglot-local-jar" unless="local.polyglot.jar"> + <target name="polyglot-jar" depends="init"> <mkdir dir="${lib}"/> - <get usetimestamp="true" src="${polyglot.jar.url}" dest="${lib}/${polyglot.jar}"/> + <ant antfile="${x10.polyglot.location}/build.xml" target="jar-epl-base" inheritAll="false" dir="${x10.polyglot.location}"/> + <copy file="${x10.polyglot.location}/lib/polyglot.jar" tofile="${lib}/${polyglot.jar}"/> <available property="polyglot.jar.present" file="${lib}/${polyglot.jar}"/> - <fail message="Unable to get ${polyglot.jar} from ${polyglot.jar.url}" unless="polyglot.jar.present"/> - </target> - <target name="polyglot-local-jar" depends="init" if="local.polyglot.jar"> - <mkdir dir="${lib}"/> - <copy file="${local.polyglot.jar}" tofile="${lib}/${polyglot.jar}"/> - <available property="polyglot.jar.present" file="${lib}/${polyglot.jar}"/> <fail message="Unable to find ${polyglot.jar} at ${local.polyglot.jar}" unless="polyglot.jar.present"/> </target> - <target name="update-jar-cache" depends="init,lpg-jar,ecj-jar,polyglot-jar"/> + <target name="update-jar-cache" depends="init,lpg-jar,ecj-jar"/> - <target name="prereq-jars" depends="init,check-jar-cache" unless="cache.up-to-date"> + <target name="prereq-jars" depends="init,check-jar-cache,polyglot-jar" unless="cache.up-to-date"> <antcall target="update-jar-cache"/> </target> Modified: trunk/x10.doc/build.xml =================================================================== --- trunk/x10.doc/build.xml 2010-08-23 19:34:09 UTC (rev 15684) +++ trunk/x10.doc/build.xml 2010-08-23 21:50:54 UTC (rev 15685) @@ -11,7 +11,7 @@ <property name="xrx.xdoc.output.dir" location="${x10.dist.location}/x10doc"/> <property name="jar" value="x10doc.jar"/> <property name="lpg.jar" value="lpg.jar"/> - <property name="polyglot.jar" value="polyglot3.jar"/> + <property name="polyglot.jar" value="polyglot.jar"/> <property name="compiler.jar" value="x10c.jar"/> <property name="runtime.jar" value="x10.jar"/> <property name="tools.jar" value="tools.jar"/> Added: trunk/x10.polyglot/.classpath =================================================================== --- trunk/x10.polyglot/.classpath (rev 0) +++ trunk/x10.polyglot/.classpath 2010-08-23 21:50:54 UTC (rev 15685) @@ -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="classes"/> +</classpath> Added: trunk/x10.polyglot/.project =================================================================== --- trunk/x10.polyglot/.project (rev 0) +++ trunk/x10.polyglot/.project 2010-08-23 21:50:54 UTC (rev 15685) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>polyglot</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/x10.polyglot/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/x10.polyglot/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/x10.polyglot/.settings/org.eclipse.jdt.core.prefs 2010-08-23 21:50:54 UTC (rev 15685) @@ -0,0 +1,312 @@ +#Sat Jul 12 23:08:38 EDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=18 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=18 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=80 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=80 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type... [truncated message content] |