From: <dgr...@us...> - 2010-08-24 03:59:48
|
Revision: 15700 http://x10.svn.sourceforge.net/x10/?rev=15700&view=rev Author: dgrove-oss Date: 2010-08-24 03:59:41 +0000 (Tue, 24 Aug 2010) Log Message: ----------- More Polyglot reorganization. Move x10.polyglot/src/polyglot into x10.compiler/src/polyglot. Minimal build and regression script changes to support file movement. Modified Paths: -------------- trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/build.xml trunk/x10.dist/build.xml trunk/x10.doc/build.xml trunk/x10.polyglot/META-INF/MANIFEST.MF trunk/x10.tests/bin/buildScript trunk/x10.tests/bin/buildScript++ trunk/x10.tests/bin/buildScriptCT trunk/x10.tests/bin/buildScriptCT++ Added Paths: ----------- trunk/x10.compiler/src/polyglot/ Removed Paths: ------------- trunk/x10.polyglot/src/polyglot/ Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler/META-INF/MANIFEST.MF 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2010-08-24 03:59:41 UTC (rev 15700) @@ -6,9 +6,18 @@ Bundle-Localization: plugin Require-Bundle: x10.common, x10.constraints, - polyglot3;bundle-version="3.2.0", lpg.runtime.java;bundle-version="2.0.18" -Export-Package: x10, +Export-Package: polyglot.ast, + polyglot.dispatch, + polyglot.frontend, + polyglot.lex, + polyglot.main, + polyglot.parse, + polyglot.types, + polyglot.types.reflect, + polyglot.util, + polyglot.visit, + x10, x10.ast, x10.emitter, x10.errors, Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.compiler/build.xml 2010-08-24 03:59:41 UTC (rev 15700) @@ -14,11 +14,9 @@ <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="polyglot.jar"/> <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="lpg.classpath"/> - <path refid="polyglot.classpath"/> <path refid="x10.constraints.classpath"/> <path refid="x10.common.classpath"/> </path> @@ -28,9 +26,6 @@ <path id="lpg.classpath"> <pathelement location="${lib}/${lpg.jar}"/> </path> - <path id="polyglot.classpath"> - <pathelement location="${lib}/${polyglot.jar}"/> - </path> <path id="x10.constraints.classpath"> <pathelement location="${x10.constraints.location}/classes"/> </path> @@ -57,7 +52,7 @@ </copy> </target> <target name="check-jar" depends="init"> - <fileset id="compiler.classes" dir="${build}" includes="org/**,x10/**,x10cpp/**,x10c/**,x10cuda/**,data/**" excludes="${jar}"/> + <fileset id="compiler.classes" dir="${build}" includes="org/**,polyglot/**,x10/**,x10cpp/**,x10c/**,x10cuda/**,data/**" excludes="${jar}"/> <fileset id="constraints.classes" dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset id="common.classes" dir="${x10.common.location}/classes" includes="x10/**"/> <uptodate property="compiler.uptodate" targetfile="${build}/${jar}"> @@ -72,16 +67,9 @@ <fileset refid="compiler.classes"/> <fileset refid="constraints.classes"/> <fileset refid="common.classes"/> - <!--<fileset dir="${build}" includes="org/**,x10/**,x10cpp/**,x10c/**,x10cuda/**,data/**" 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="prereq-jars"> - <condition property="polyglot.jar.present"> - <available file="${lib}/${polyglot.jar}"/> - </condition> - <fail message="Unable to find required file ${lib}/${polyglot.jar}" unless="polyglot.jar.present"/> <condition property="lpg.jar.present"> <available file="${lib}/${lpg.jar}"/> </condition> @@ -89,7 +77,7 @@ </target> <target name="build" depends="init,prereq-jars"> <echo message="${ant.project.name}: ${ant.file}"/> - <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="x10/**,x10c/**,x10cpp/**,x10cuda/**" excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> + <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="polyglot/**,x10/**,x10c/**,x10cpp/**,x10cuda/**" excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> <src path="${src}"/> <classpath refid="project.classpath"/> </javac> @@ -154,7 +142,6 @@ <arg value="-R"/> <arg value="--exclude=classes"/> <arg value="lpg.runtime.java"/> - <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-24 03:42:05 UTC (rev 15699) +++ trunk/x10.dist/build.xml 2010-08-24 03:59:41 UTC (rev 15700) @@ -12,8 +12,6 @@ <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="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"/> @@ -77,14 +75,12 @@ <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> @@ -130,17 +126,9 @@ <fail message="Unable to find ${ecj.jar} at ${local.ecj.jar}" unless="ecj.jar.present"/> </target> - <target name="polyglot-jar" depends="init"> - <mkdir dir="${lib}"/> - <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 find ${polyglot.jar} at ${local.polyglot.jar}" unless="polyglot.jar.present"/> - </target> - <target name="update-jar-cache" depends="init,lpg-jar,ecj-jar"/> - <target name="prereq-jars" depends="init,check-jar-cache,polyglot-jar" unless="cache.up-to-date"> + <target name="prereq-jars" depends="init,check-jar-cache" unless="cache.up-to-date"> <antcall target="update-jar-cache"/> </target> @@ -300,10 +288,8 @@ #FILE_SEP='${file.separator}' #PATH_SEP='${path.separator}' #CONFIG_FILE='${config}' -POLYGLOT_JAR='${polyglot.jar}' LPG_JAR='${lpg.jar}' ECJ_JAR='${ecj.jar}' -POLYGLOT_URL='${polyglot.jar.url}' LPG_URL='${lpg.jar.url}' ECJ_URL='${ecj.jar.url}' @@ -460,7 +446,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/${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/${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/**"/> Modified: trunk/x10.doc/build.xml =================================================================== --- trunk/x10.doc/build.xml 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.doc/build.xml 2010-08-24 03:59:41 UTC (rev 15700) @@ -11,7 +11,6 @@ <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="polyglot.jar"/> <property name="compiler.jar" value="x10c.jar"/> <property name="runtime.jar" value="x10.jar"/> <property name="tools.jar" value="tools.jar"/> @@ -22,7 +21,6 @@ <path id="project.classpath"> <path refid="mainproject.classpath"/> <path refid="lpg.classpath"/> - <path refid="polyglot.classpath"/> <path refid="compiler.classpath"/> <path refid="x10.runtime.classpath"/> </path> @@ -32,9 +30,6 @@ <path id="lpg.classpath"> <pathelement location="${lib}/${lpg.jar}"/> </path> - <path id="polyglot.classpath"> - <pathelement location="${lib}/${polyglot.jar}"/> - </path> <path id="compiler.classpath"> <pathelement location="${lib}/${compiler.jar}"/> </path> @@ -77,10 +72,6 @@ </jar> </target> <target name="prereq-jars"> - <condition property="polyglot.jar.present"> - <available file="${lib}/${polyglot.jar}"/> - </condition> - <fail message="Unable to find required file ${lib}/${polyglot.jar}" unless="polyglot.jar.present"/> <condition property="lpg.jar.present"> <available file="${lib}/${lpg.jar}"/> </condition> Modified: trunk/x10.polyglot/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.polyglot/META-INF/MANIFEST.MF 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.polyglot/META-INF/MANIFEST.MF 2010-08-24 03:59:41 UTC (rev 15700) @@ -5,14 +5,4 @@ Bundle-SymbolicName: polyglot3 Bundle-Version: 3.2.0 Bundle-Localization: plugin -Export-Package: polyglot.ast, - polyglot.dispatch, - polyglot.frontend, - polyglot.lex, - polyglot.main, - polyglot.parse, - polyglot.types, - polyglot.types.reflect, - polyglot.util, - polyglot.visit Bundle-Vendor: na...@na... Modified: trunk/x10.tests/bin/buildScript =================================================================== --- trunk/x10.tests/bin/buildScript 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.tests/bin/buildScript 2010-08-24 03:59:41 UTC (rev 15700) @@ -69,13 +69,6 @@ buildX10Module() { printf "\n>> [$prog]: building module $(basename $1)...\n" case "$2" in - "polyglot") - ( \ - cd $1; \ - ant -q clean jar >/dev/null 2>&1; \ - exit $?; \ - ) - ;; "x10c") ( \ cd $1; \ @@ -124,8 +117,6 @@ export X10_SVNROOT="https://x10.svn.sf.net/svnroot/x10/trunk" fi -POLYGLOT_HOME=$X10_HOME/x10.polyglot -svnUpdate $POLYGLOT_HOME $X10_SVNROOT X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT X10_COMPILER=$X10_HOME/x10.compiler @@ -142,7 +133,6 @@ svnUpdate $X10_WEB $X10_SVNROOT -buildX10Module $POLYGLOT_HOME polyglot buildX10Module $X10_CONSTRAINTS x10 buildX10Module $X10_COMMON x10 buildX10Module $X10_DIST x10j Modified: trunk/x10.tests/bin/buildScript++ =================================================================== --- trunk/x10.tests/bin/buildScript++ 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.tests/bin/buildScript++ 2010-08-24 03:59:41 UTC (rev 15700) @@ -69,13 +69,6 @@ buildX10Module() { printf "\n>> [$prog]: building module $(basename $1)...\n" case "$2" in - "polyglot") - ( \ - cd $1; \ - ant clean jar; \ - exit $?; \ - ) - ;; "x10c") ( \ cd $1; \ @@ -128,8 +121,6 @@ #export X10CPP_CVSROOT=":ext:us...@or...:/usr/src/cvs/X10_FLASH" export X10CPP_CVSROOT=":ext:sreedhar@localhost:/usr/src/cvs/X10_FLASH" -POLYGLOT_HOME=$X10_HOME/x10.polyglot -svnUpdate $POLYGLOT_HOME $X10_SVNROOT X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT X10_COMPILER=$X10_HOME/x10.compiler @@ -145,7 +136,6 @@ svnUpdate $X10_SVNROOT -buildX10Module $POLYGLOT_HOME polyglot buildX10Module $X10_CONSTRAINTS x10 buildX10Module $X10_COMMON x10 buildX10Module $X10_DIST x10j Modified: trunk/x10.tests/bin/buildScriptCT =================================================================== --- trunk/x10.tests/bin/buildScriptCT 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.tests/bin/buildScriptCT 2010-08-24 03:59:41 UTC (rev 15700) @@ -73,16 +73,6 @@ main() { # source all the relevant modules -- do fresh checkout each time declare -i status; - POLYGLOT_HOME=$X10_HOME/x10.polyglot - if [[ -d $POLYGLOT_HOME ]]; then - rm -rf $POLYGLOT_HOME - fi - svnUpdate $POLYGLOT_HOME $X10_SVNROOT - status=$? - if (( $status != 0 )); then - return $status - fi - X10_COMMON=$X10_HOME/x10.common if [[ -d $X10_COMMON ]]; then rm -rf $X10_COMMON Modified: trunk/x10.tests/bin/buildScriptCT++ =================================================================== --- trunk/x10.tests/bin/buildScriptCT++ 2010-08-24 03:42:05 UTC (rev 15699) +++ trunk/x10.tests/bin/buildScriptCT++ 2010-08-24 03:59:41 UTC (rev 15700) @@ -41,16 +41,6 @@ main() { # source all the relevant modules -- do fresh checkout each time declare -i status; - POLYGLOT_HOME=$X10_HOME/x10.polyglot - if [[ -d $POLYGLOT_HOME ]]; then - rm -rf $POLYGLOT_HOME - fi - svnUpdate $POLYGLOT_HOME $X10_SVNROOT - status=$? - if (( $status != 0 )); then - return $status - fi - X10_COMMON=$X10_HOME/x10.common if [[ -d $X10_COMMON ]]; then rm -rf $X10_COMMON This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-08-25 18:49:04
|
Revision: 15734 http://x10.svn.sourceforge.net/x10/?rev=15734&view=rev Author: yzibin Date: 2010-08-25 18:48:56 +0000 (Wed, 25 Aug 2010) Log Message: ----------- removed SemanticException from all the DataFlow algorithms (so now they report multiple errors, and not just the first error they encounter). Fixed XTENLANG-1565 Modified Paths: -------------- trunk/x10.compiler/src/polyglot/types/Context_c.java trunk/x10.compiler/src/polyglot/util/Position.java trunk/x10.compiler/src/polyglot/visit/CopyPropagator.java trunk/x10.compiler/src/polyglot/visit/DataFlow.java trunk/x10.compiler/src/polyglot/visit/DeadCodeEliminator.java trunk/x10.compiler/src/polyglot/visit/ExitChecker.java trunk/x10.compiler/src/polyglot/visit/FlowGraph.java trunk/x10.compiler/src/polyglot/visit/InitChecker.java trunk/x10.compiler/src/polyglot/visit/ReachChecker.java trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.compiler/src/x10/visit/AssignPropertyChecker.java Added Paths: ----------- trunk/x10.tests/examples/Issues/XTENLANG_1565.x10 trunk/x10.tests/examples/Issues/XTENLANG_1565_MustFailCompile.x10 Removed Paths: ------------- trunk/x10.compiler/src/x10/visit/X10InitChecker.java Modified: trunk/x10.compiler/src/polyglot/types/Context_c.java =================================================================== --- trunk/x10.compiler/src/polyglot/types/Context_c.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/types/Context_c.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -516,7 +516,7 @@ return ts.findField(this.currentClass(), ts.FieldMatcher(this.currentClass(), name, this)); } catch (SemanticException e) { - return null; + return null;// todo: we loose the error message! e.g., "Field XXX is ambiguous; it is defined in both ..." } } return vi; Modified: trunk/x10.compiler/src/polyglot/util/Position.java =================================================================== --- trunk/x10.compiler/src/polyglot/util/Position.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/util/Position.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -132,7 +132,7 @@ } public Position truncateEnd(int len) { - if (this == COMPILER_GENERATED) + if (this.isCompilerGenerated()) return this; int eo = endOffset; @@ -163,13 +163,13 @@ } public Position startOf() { - if (this == COMPILER_GENERATED) + if (this.isCompilerGenerated()) return this; return new Position(path, file, line, column, line, column, offset, offset); } public Position endOf() { - if (this == COMPILER_GENERATED) + if (this.isCompilerGenerated()) return this; return new Position(path, file, endLine, endColumn, endLine, endColumn, endOffset, endOffset); } Modified: trunk/x10.compiler/src/polyglot/visit/CopyPropagator.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/CopyPropagator.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/CopyPropagator.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -399,22 +399,20 @@ return itemToMap(flow(in, graph, t, entry), succEdgeKeys); } - public void post(FlowGraph graph, Term root) throws SemanticException { + public void post(FlowGraph graph, Term root) { // No need to do any checking. if (Report.should_report(Report.cfg, 2)) { dumpFlowGraph(graph, root); } } - public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) - throws SemanticException { + public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) { throw new InternalCompilerError("CopyPropagator.check should never be " + "called."); } - public Node leaveCall(Node old, Node n, NodeVisitor v) - throws SemanticException { + public Node leaveCall(Node old, Node n, NodeVisitor v) { if (n instanceof Local) { FlowGraph g = currentFlowGraph(); Modified: trunk/x10.compiler/src/polyglot/visit/DataFlow.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/DataFlow.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/DataFlow.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -396,12 +396,9 @@ * dataflow is checking for. This method is called for each term * in a code declaration block after the dataflow for that block of code * has been performed. - * - * @throws SemanticException if the properties this dataflow - * analysis is checking for is not satisfied. */ protected abstract void check(FlowGraph graph, Term n, boolean entry, - Item inItem, Map outItems) throws SemanticException; + Item inItem, Map outItems); /** * Construct a flow graph for the <code>CodeNode</code> provided, and call @@ -411,11 +408,14 @@ * the <code>FlowGraph</code> onto the stack of <code>FlowGraph</code>s if * dataflow analysis is performed on entry to <code>CodeNode</code> nodes. */ - protected void dataflow(CodeDecl cd) throws SemanticException { + protected void dataflow(CodeDecl cd) { this.dataflow((CodeNode) cd); } - protected void dataflow(CodeNode cd) throws SemanticException { + public void reportError(String msg, Position p) { + errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR,msg,p); + } + protected void dataflow(CodeNode cd) { // only bother to do the flow analysis if the body is not null... if (cd.codeBody() != null) { // Compute the successor of each child node. @@ -431,7 +431,8 @@ v.visitGraph(); } catch (CFGBuildError e) { - throw new SemanticException(e.message(), e.position()); + reportError(e.message(), e.position()); + return; } long t2 = System.currentTimeMillis(); @@ -708,7 +709,7 @@ * Overridden superclass method, to build the flow graph, perform dataflow * analysis, and check the analysis for CodeNode nodes. */ - protected NodeVisitor enterCall(Node n) throws SemanticException { + protected NodeVisitor enterCall(Node n) { if (dataflowOnEntry && n instanceof CodeNode) { dataflow((CodeNode)n); } @@ -740,7 +741,7 @@ * Overridden superclass method, to pop from the stack of * <code>FlowGraph</code>s if necessary. */ - protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException { + protected Node leaveCall(Node old, Node n, NodeVisitor v) { if (n instanceof CodeNode) { if (!dataflowOnEntry) { dataflow((CodeNode)n); @@ -761,7 +762,7 @@ * Check all of the Peers in the graph, after the dataflow analysis has * been performed. */ - protected void post(FlowGraph graph, Term root) throws SemanticException { + protected void post(FlowGraph graph, Term root) { if (Report.should_report(Report.cfg, 2)) { dumpFlowGraph(graph, root); } Modified: trunk/x10.compiler/src/polyglot/visit/DeadCodeEliminator.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/DeadCodeEliminator.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/DeadCodeEliminator.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -175,15 +175,14 @@ return result; } - public void post(FlowGraph graph, Term root) throws SemanticException { + public void post(FlowGraph graph, Term root) { // No need to do any checking. if (Report.should_report(Report.cfg, 2)) { dumpFlowGraph(graph, root); } } - public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) - throws SemanticException { + public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) { throw new InternalCompilerError("DeadCodeEliminator.check should " + "never be called."); @@ -205,8 +204,7 @@ return (DataFlowItem)confluence(items, n, false, g); } - public Node leaveCall(Node old, Node n, NodeVisitor v) - throws SemanticException { + public Node leaveCall(Node old, Node n, NodeVisitor v) { if (n instanceof LocalDecl) { LocalDecl ld = (LocalDecl)n; Modified: trunk/x10.compiler/src/polyglot/visit/ExitChecker.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/ExitChecker.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/ExitChecker.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -113,7 +113,7 @@ return DataFlowItem.EXITS; } - public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) throws SemanticException { + public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) { // Check for statements not on the path to exit; compound // statements are allowed to be off the path. (e.g., "{ return; }" // or "while (true) S"). If a compound statement is truly @@ -125,7 +125,7 @@ // are the same, so just take the first one. DataFlowItem outItem = (DataFlowItem)outItems.values().iterator().next(); if (outItem != null && !outItem.exits) { - throw new SemanticException("Missing return statement.", + reportError("Missing return statement.", code.position()); } } Modified: trunk/x10.compiler/src/polyglot/visit/FlowGraph.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/FlowGraph.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/FlowGraph.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -48,7 +48,7 @@ */ protected boolean forward; - FlowGraph(Term root, boolean forward) { + public FlowGraph(Term root, boolean forward) { this.root = root; this.forward = forward; this.peerMap = new HashMap(); Modified: trunk/x10.compiler/src/polyglot/visit/InitChecker.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/InitChecker.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/InitChecker.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -16,6 +16,11 @@ import polyglot.types.*; import polyglot.util.InternalCompilerError; import polyglot.util.Position; +import polyglot.util.ErrorInfo; +import x10.ast.Finish; +import x10.ast.Async; +import x10.ast.ParExpr; +import x10.ast.X10ClassDecl; /** * Visitor which checks that all local variables must be defined before use, @@ -32,7 +37,99 @@ * If language extensions have new constructs that assign to local variables, * they can override the method <code>flowOther</code> to capture the way * the new construct's initialization behavior. - * + * + Yoav Zibin added: + + Adding finish-async initialization of val (and shared vars): + See XTENLANG-1565. + I kept the CFG without changes. + So, an Async_c exit has two incoming edges: from the exit of the body and from the exit of the place. + I changed in InitChecker's data structure: + for each variable we now keep: + [minSeq,maxSeq,minAsync,maxAsync] + minSeq - the minimal number of times the variable is assigned in sequential code. + maxSeq - the maximal number of times the variable is assigned in sequential code. + minAsync - the minimal number of times the variable is assigned (in async or sequential code). + maxAsync - the maximal number of times the variable is assigned (in async or sequential code). + We keep the invariant that: minSeq<=minAsync && maxSeq<=maxAsync + You can read from a variable only if minSeq>=1. + A val at the end of a ctor must have: [1,1,1,1] + + Note that for our purposes, [0,0,1,1] and [0,1,1,1] carry the same information and restriction. + (After a finish, both will become the same: [1,1,0,0].) + + Just having a boolean flag (i.e, [min,max,isAsync]) is ok, but I think it is less clear because of this example: + var k:Int; + k=1; + async { k=2; } + // can read from "k". The representation with a flag must be: [2,2,false] + So, the meaning of the flag is: isAsync=false means that at least one assignment was in sequential code. + Therefore, I prefer the representation as a quartet: [minSeq,maxSeq,minAsync,maxAsync] + + For example, in this simple program the flow is as follows: + val i:Int; + // i=[0,0,0,0] + finish { + // i=[0,0,0,0] + async { + i=42; + // i=[1,1,1,1] + } + // i=[0,0,1,1] + } + // i=[1,1,1,1] + + Here is a more complicated example: + shared var i:Int, j:Int, k:Int; + val m:Int, n:Int, q:Int; + + i=1; + // i:[1,1,1,1] + finish { + m=2; + // m:[1,1,1,1] + if (true) { + async { + n=3; i=4; j=5; k=6; q=7; + // n:[1,1,1,1] i:[2,2,2,2] j:[1,1,1,1] k:[1,1,1,1] q:[1,1,1,1] + } + // n:[0,0,1,1] i:[1,1,2,2] j:[0,0,1,1] k:[0,0,1,1] q:[0,0,1,1] + k=8; + // k:[1,1,2,2] + } else { + // n:[0,0,0,0] m:[1,1,1,1] i:[1,1,1,1] j:[0,0,0,0] k:[0,0,0,0] q:[0,0,0,0] + n=9; m=10; + // n:[1,1,1,1] m:[2,2,2,2] + } + // k:[0,1,0,2] n:[0,1,1,1] m:[1,2,1,2] i:[1,1,1,2] j:[0,0,0,1] q:[0,0,0,1] + k=11; + // k:[1,2,1,3] + } + // k:[1,3,1,3] n:[1,1,1,1] m:[1,2,1,2] i:[1,2,1,2] j:[0,1,0,1] q:[0,1,0,1] + j=12; + // j:[1,2,1,2] + // all (except q) are definitely-assigned now. "m" was assigned too many times. + + + The exact rules are: + Consider a join between two elements: [a,b,c,d] and [a',b',c',d']. + 1) If join (like at the end of an IF): [min(a,a'), max(b,b'), min(c,c'), max(d,d')] + 2) join at the end of an Async_c(PLACE,BODY): suppose that the first element has flown from the BODY and the second has flown from the PLACE (so a>=a', b>=b', ...). + Then, the result is: [a',b', c, d] + 3) join at the end of a Finish_c: you have only one incoming edge, and the result is: [c,d,c,d] + + Another way to write down these rules: + S [a,b,c,d] + S' [a',b',c',d'] + 0) S; S' [a+a', b+b', c+c', d+d'] + 1) if S else S [min(a,a'), max(b,b'), min(c,c'), max(d,d')] + 2) async S [0,0,c,d] + 3) finish S [c,d,c,d] + + For example (see variables "n", "i"): + IfJoin([0,0,1,1],[1,1,1,1]) = [0,1,1,1] + AsyncJoin([2,2,2,2],[1,1,1,1]) = [1,1,2,2] + FinishJoin([0,1,1,1]) = [1,1,1,1] */ public class InitChecker extends DataFlow { @@ -124,26 +221,14 @@ * different values of the counts that we are interested in are ZERO, * ONE and MANY. */ - protected static class InitCount { - public static InitCount ZERO = new InitCount(0); - public static InitCount ONE = new InitCount(1); - public static InitCount MANY = new InitCount(2); - public int count; - protected InitCount(int i) { + enum InitCount { + ZERO(0), ONE(1), MANY(2); + + public final int count; + private InitCount(int i) { count = i; } - public int hashCode() { - return count; - } - - public boolean equals(Object o) { - if (o instanceof InitCount) { - return this.count == ((InitCount)o).count; - } - return false; - } - public String toString() { if (count == 0) { return "0"; @@ -154,34 +239,29 @@ else if (count == 2) { return "many"; } - throw new RuntimeException("Unexpected value for count"); + throw new RuntimeException("Unexpected value for count"); } - + public InitCount increment() { if (count == 0) { return ONE; } return MANY; } - public static InitCount min(InitCount a, InitCount b) { - if (ZERO.equals(a) || ZERO.equals(b)) { - return ZERO; - } - if (ONE.equals(a) || ONE.equals(b)) { - return ONE; - } - return MANY; + public InitCount min(InitCount b) { + return fromNum(Math.min(count,b.count)); } - public static InitCount max(InitCount a, InitCount b) { - if (MANY.equals(a) || MANY.equals(b)) { - return MANY; + public InitCount max(InitCount b) { + return fromNum(Math.max(count,b.count)); + } + private static InitCount fromNum(int i) { + assert i>=0 : i; + switch (i) { + case 0: return ZERO; + case 1: return ONE; + default: return MANY; } - if (ONE.equals(a) || ONE.equals(b)) { - return ONE; - } - return ZERO; } - } /** @@ -189,37 +269,74 @@ * a variable or field has been initialized or assigned to. */ protected static class MinMaxInitCount { - protected InitCount min, max; - MinMaxInitCount(InitCount min, InitCount max) { - MinMaxInitCount.this.min = min; - MinMaxInitCount.this.max = max; + final static MinMaxInitCount ZERO = new MinMaxInitCount(InitCount.ZERO,InitCount.ZERO,InitCount.ZERO,InitCount.ZERO); + final static MinMaxInitCount ONE = new MinMaxInitCount(InitCount.ONE,InitCount.ONE,InitCount.ONE,InitCount.ONE); + + protected final InitCount minSeq, maxSeq, minAsync, maxAsync; + + private MinMaxInitCount(InitCount minSeq, InitCount maxSeq,InitCount minAsync, InitCount maxAsync) { + this.minSeq = minSeq; + this.maxSeq = maxSeq; + this.minAsync = minAsync; + this.maxAsync = maxAsync; + assert minSeq.count<=minAsync.count && maxSeq.count<=maxAsync.count; } - InitCount getMin() { return min; } - InitCount getMax() { return max; } + MinMaxInitCount increment() { // when a variable is sequentially assigned + return new MinMaxInitCount(minSeq.increment(),maxSeq.increment(),minAsync.increment(),maxAsync.increment()); + } + InitCount getMin() { return minSeq; } + boolean isIllegalVal() { return maxSeq!=InitCount.ONE || maxAsync!=InitCount.ONE || minSeq!=InitCount.ONE || minAsync!=InitCount.ONE; } public int hashCode() { - return min.hashCode() * 4 + max.hashCode(); + return minSeq.hashCode() * 64 + maxSeq.hashCode() * 16 + minAsync.hashCode() * 4 + maxAsync.hashCode(); } public String toString() { - return "[ min: " + min + "; max: " + max + " ]"; + return "[ min: " + minSeq + "; max: " + maxSeq + "; minAsync: " + minAsync + "; maxAsync: " + maxAsync + " ]"; } public boolean equals(Object o) { if (o instanceof MinMaxInitCount) { - return this.min.equals(((MinMaxInitCount)o).min) && - this.max.equals(((MinMaxInitCount)o).max); + final MinMaxInitCount maxInitCount = (MinMaxInitCount) o; + return this.minSeq.equals(maxInitCount.minSeq) && + this.maxSeq.equals(maxInitCount.maxSeq) && + this.minAsync.equals(maxInitCount.minAsync) && + this.maxAsync.equals(maxInitCount.maxAsync); } return false; } - static MinMaxInitCount join(MinMaxInitCount initCount1, MinMaxInitCount initCount2) { - if (initCount1 == null) { - return initCount2; + MinMaxInitCount finish() { + return new MinMaxInitCount(minAsync,maxAsync,minAsync,maxAsync);//[c,d,c,d] + } + static MinMaxInitCount join(Term node, boolean entry, MinMaxInitCount initCount1, MinMaxInitCount initCount2) { + assert !(node instanceof Finish); + if (initCount1 == null) return initCount2; + if (initCount2 == null) return initCount1; + + if (!entry && node instanceof Async) { + // one flow must be smaller than the other (the one coming after the PLACE is smaller or equal to the one coming after the BODY) + MinMaxInitCount small = + initCount1.minSeq.count<initCount2.minSeq.count ? initCount1 : + initCount1.maxSeq.count<initCount2.maxSeq.count ? initCount1 : + initCount1.minAsync.count<initCount2.minAsync.count ? initCount1 : + initCount1.maxAsync.count<initCount2.maxAsync.count ? initCount1 : + initCount1.minSeq.count>initCount2.minSeq.count ? initCount2 : + initCount1.maxSeq.count>initCount2.maxSeq.count ? initCount2 : + initCount1.minAsync.count>initCount2.minAsync.count ? initCount2 : + initCount1.maxAsync.count>initCount2.maxAsync.count ? initCount2 : + initCount1; // equal + MinMaxInitCount big = small==initCount1 ? initCount2 : initCount1; + assert small.minSeq.count<=big.minSeq.count && + small.maxSeq.count<=big.maxSeq.count && + small.minAsync.count<=big.minAsync.count && + small.maxAsync.count<=big.maxAsync.count; + + // todo We also need to mark the variable as "initialized in async" to allow the Java backend to implement such initializations. + return new MinMaxInitCount(small.minSeq, small.maxSeq, big.minAsync, big.maxAsync); // [a',b', c, d] } - if (initCount2 == null) { - return initCount1; - } - MinMaxInitCount t = new MinMaxInitCount( - InitCount.min(initCount1.getMin(), initCount2.getMin()), - InitCount.max(initCount1.getMax(), initCount2.getMax())); - return t; + // normal join: [min(a,a'), max(b,b'), min(c,c'), max(d,d')] + return new MinMaxInitCount( + initCount1.minSeq.min(initCount2.minSeq), + initCount1.maxSeq.min(initCount2.maxSeq), + initCount1.minAsync.min(initCount2.minAsync), + initCount1.maxAsync.min(initCount2.maxAsync)); } } @@ -284,11 +401,21 @@ * * Set up the state that must be tracked during a Class Declaration. */ - protected NodeVisitor enterCall(Node parent, Node n) throws SemanticException { + protected NodeVisitor enterCall(Node parent, Node n) { if (n instanceof ClassBody) { // we are starting to process a class declaration, but have yet // to do any of the dataflow analysis. - + ClassBody cb = (ClassBody) n; + + // Add the properties to the class body when initializing. + if (parent instanceof X10ClassDecl) { + List<ClassMember> members; + members = new ArrayList<ClassMember>(); + members.addAll(cb.members()); + members.addAll(((X10ClassDecl) parent).properties()); + cb = cb.members(members); + } + // set up the new ClassBodyInfo, and make sure that it forms // a stack. ClassDef ct = null; @@ -301,10 +428,11 @@ if (ct == null) { throw new InternalCompilerError("ClassBody found but cannot find the class.", n.position()); } - setupClassBody(ct, (ClassBody)n); + setupClassBody(ct, cb); + //n = cb; //todo? } - return super.enterCall(n); + return super.enterCall(n); // todo: we changed "cb", why not pass it here? } /** @@ -318,7 +446,7 @@ * taking into account the constructor calls. * */ - protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException { + protected Node leaveCall(Node old, Node n, NodeVisitor v) { if (n instanceof ConstructorDecl) { // postpone the checking of the constructors until all the // initializer blocks have been processed. @@ -365,7 +493,7 @@ return super.leaveCall(old, n, v); } - protected void setupClassBody(ClassDef ct, ClassBody n) throws SemanticException { + protected void setupClassBody(ClassDef ct, ClassBody n) { ClassBodyInfo newCDI = new ClassBodyInfo(); newCDI.outer = currCBI; newCDI.currClass = ct; @@ -382,7 +510,7 @@ MinMaxInitCount initCount; if (fd.init() != null) { // the field has an initializer - initCount = new MinMaxInitCount(InitCount.ONE, InitCount.ONE); + initCount = MinMaxInitCount.ONE; // do dataflow over the initialization expression // to pick up any uses of outer local variables. @@ -391,7 +519,7 @@ } else { // the field does not have an initializer - initCount = new MinMaxInitCount(InitCount.ZERO, InitCount.ZERO); + initCount = MinMaxInitCount.ZERO; } newCDI.currClassFinalFieldInitCounts.put(fd.fieldDef(), initCount); @@ -404,9 +532,8 @@ * Check that each static final field is initialized exactly once. * * @param cb The ClassBody of the class declaring the fields to check. - * @throws SemanticException */ - protected void checkStaticFinalFieldsInit(ClassBody cb) throws SemanticException { + protected void checkStaticFinalFieldsInit(ClassBody cb) { // check that all static fields have been initialized exactly once. for (Iterator<Map.Entry<FieldDef,MinMaxInitCount>> iter = currCBI.currClassFinalFieldInitCounts.entrySet().iterator(); iter.hasNext(); ) { @@ -416,7 +543,7 @@ if (fi.flags().isStatic() && fi.flags().isFinal()) { MinMaxInitCount initCount = (MinMaxInitCount)e.getValue(); if (InitCount.ZERO.equals(initCount.getMin())) { - throw new SemanticException("Final field \"" + fi.name() + + reportError("Final field \"" + fi.name() + "\" might not have been initialized", cb.position()); } @@ -431,9 +558,8 @@ * constructors. * * @param cb The ClassBody of the class declaring the fields to check. - * @throws SemanticException */ - protected void checkNonStaticFinalFieldsInit(ClassBody cb) throws SemanticException { + protected void checkNonStaticFinalFieldsInit(ClassBody cb) { // for each non-static final field def, check that all // constructors intialize it exactly once, taking into account constructor calls. for (Iterator<FieldDef> iter = currCBI.currClassFinalFieldInitCounts.keySet().iterator(); @@ -455,6 +581,7 @@ iter2.hasNext(); ) { ConstructorDecl cd = (ConstructorDecl)iter2.next(); ConstructorDef ciStart = cd.constructorDef(); + assert ciStart!=null; ConstructorDef ci = ciStart; boolean isInitialized = fieldInitializedBeforeConstructors; @@ -469,7 +596,7 @@ Set<FieldDef> s = currCBI.fieldsConstructorInitializes.get(ci); if (s != null && s.contains(fi)) { if (isInitialized) { - throw new SemanticException("Final field \"" + fi.name() + + reportError("Final field \"" + fi.name() + "\" might have already been initialized", cd.position()); } @@ -478,7 +605,7 @@ ci = (ConstructorDef)currCBI.constructorCalls.get(ci); } if (!isInitialized) { - throw new SemanticException("Final field \"" + fi.name() + + reportError("Final field \"" + fi.name() + "\" might not have been initialized", ciStart.position()); @@ -496,7 +623,7 @@ * There is no need to push a CFG onto the stack, as dataflow is not * performed on entry in this analysis. */ - protected void dataflow(Expr root) throws SemanticException { + protected void dataflow(Expr root) { // Build the control flow graph. FlowGraph g = new FlowGraph(root, forward); CFGBuilder v = createCFGBuilder(ts, g); @@ -570,7 +697,7 @@ VarDef v = (VarDef)e.getKey(); MinMaxInitCount initCount1 = m.get(v); MinMaxInitCount initCount2 = (MinMaxInitCount)e.getValue(); - m.put(v, MinMaxInitCount.join(initCount1, initCount2)); + m.put(v, MinMaxInitCount.join(node,entry,initCount1, initCount2)); } } } @@ -640,7 +767,17 @@ (n instanceof Binary || n instanceof Unary)) { if (trueItem == null) trueItem = inDFItem; if (falseItem == null) falseItem = inDFItem; - ret = flowBooleanConditions(trueItem, falseItem, inDFItem, graph, (Expr)n, succEdgeKeys); + ret = flowBooleanConditions(trueItem, falseItem, inDFItem, graph, (Expr)n, succEdgeKeys); + } else if (n instanceof ParExpr && ((ParExpr)n).type().isBoolean()) { + if (trueItem == null) trueItem = inDFItem; + if (falseItem == null) falseItem = inDFItem; + return itemsToMap(trueItem, falseItem, inDFItem, succEdgeKeys); + } else if (n instanceof Finish) { + Map<VarDef, MinMaxInitCount> m = new LinkedHashMap<VarDef, MinMaxInitCount>(); + for (Map.Entry<VarDef, MinMaxInitCount> e : inDFItem.initStatus.entrySet()) { + m.put(e.getKey(),e.getValue().finish()); + } + return itemToMap(new DataFlowItem(m), succEdgeKeys); } else { ret = flowOther(inDFItem, graph, n, succEdgeKeys); @@ -658,7 +795,7 @@ protected Map flowFormal(DataFlowItem inItem, FlowGraph graph, Formal f, Set succEdgeKeys) { Map<VarDef, MinMaxInitCount> m = new LinkedHashMap<VarDef, MinMaxInitCount>(inItem.initStatus); // a formal argument is always defined. - m.put(f.localDef(), new MinMaxInitCount(InitCount.ONE,InitCount.ONE)); + m.put(f.localDef(), MinMaxInitCount.ONE); // record the fact that we have seen the formal declaration currCBI.localDeclarations.add(f.localDef()); @@ -679,12 +816,11 @@ //if (initCount == null) { if (ld.init() != null) { // declaration of local var with initialization. - initCount = new MinMaxInitCount(InitCount.ONE, - InitCount.ONE); + initCount = MinMaxInitCount.ONE; } else { // declaration of local var with no initialization. - initCount = new MinMaxInitCount(InitCount.ZERO,InitCount.ZERO); + initCount = MinMaxInitCount.ZERO; } m.put(ld.localDef(), initCount); @@ -721,11 +857,10 @@ // class, or if we have not yet seen its declaration (i.e. the // local is used in its own initialization) if (initCount == null) { - initCount = new MinMaxInitCount(InitCount.ZERO,InitCount.ZERO); + initCount = MinMaxInitCount.ZERO; } - initCount = new MinMaxInitCount(initCount.getMin().increment(), - initCount.getMax().increment()); + initCount = initCount.increment(); m.put(l.localInstance().def(), initCount); return itemToMap(new DataFlowItem(m), succEdgeKeys); @@ -748,8 +883,7 @@ // initCount may be null if the field is defined in an // outer class. if (initCount != null) { - initCount = new MinMaxInitCount(initCount.getMin().increment(), - initCount.getMax().increment()); + initCount = initCount.increment(); m.put(fi, initCount); return itemToMap(new DataFlowItem(m), succEdgeKeys); } @@ -856,7 +990,7 @@ * dataflows over Initializers, by copying back the appropriate * MinMaxInitCounts to the map currClassFinalFieldInitCounts. */ - public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) throws SemanticException { + public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) { DataFlowItem dfIn = (DataFlowItem)inItem; if (dfIn == null) { // There is no input data flow item. This can happen if we are @@ -1002,6 +1136,15 @@ currCBI.fieldsConstructorInitializes.put(ci, s); } } + + private void reportVarNotInit(Name n, Position p) { + reportError("\"" + n + + "\" may not have been initialized", + p); + } + private void reportVarNotInit(NamedVariable f) { + reportVarNotInit(f.name().id(),f.position()); + } /** * Check that the field access <code>f</code> is used correctly. @@ -1009,8 +1152,7 @@ protected void checkField(FlowGraph graph, Field f, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { if (isFieldsTargetAppropriate(f) && f.flags().isFinal() && (currCBI.currCodeDecl instanceof ConstructorDecl || currCBI.currCodeDecl instanceof FieldDecl)) { MinMaxInitCount initCount = dfIn.initStatus.get(f.fieldInstance().def()); if (initCount != null && InitCount.ZERO.equals(initCount.getMin())) { @@ -1027,9 +1169,7 @@ } } if (f.reachable()) { - throw new SemanticException("Field \"" + f.name().id() + - "\" may not have been initialized", - f.position()); + reportVarNotInit(f); } } } @@ -1042,8 +1182,7 @@ protected void checkLocal(FlowGraph graph, Local l, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { if (!currCBI.localDeclarations.contains(l.localInstance().def())) { // it's a local variable that has not been declared within // this scope. The only way this can arise is from an @@ -1061,9 +1200,7 @@ // the local variable may not have been initialized. // However, we only want to complain if the local is reachable if (l.reachable()) { - throw new SemanticException("Local variable \"" + l.name().id() + - "\" may not have been initialized", - l.position()); + reportVarNotInit(l); } } } @@ -1071,15 +1208,12 @@ protected void checkLocalInstanceInit(LocalDef li, DataFlowItem dfIn, - Position pos) - throws SemanticException { + Position pos) { MinMaxInitCount initCount = dfIn.initStatus.get(li); if (initCount != null && InitCount.ZERO.equals(initCount.getMin())) { - // the local variable may not have been initialized. - throw new SemanticException("Local variable \"" + li.name() + - "\" may not have been initialized", - pos); - } + // the local variable may not have been initialized. + reportVarNotInit(li.name(), pos); + } } /** @@ -1088,19 +1222,18 @@ protected void checkLocalAssign(FlowGraph graph, LocalAssign a, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { LocalDef li = ((Local)a.local()).localInstance().def(); if (!currCBI.localDeclarations.contains(li)) { - throw new SemanticException("Final local variable \"" + li.name() + + reportError("Final local variable \"" + li.name() + "\" cannot be assigned to in an inner class.", - a.position()); + a.position()); } MinMaxInitCount initCount = dfOut.initStatus.get(li); - if (li.flags().isFinal() && InitCount.MANY.equals(initCount.getMax())) { - throw new SemanticException("Final variable \"" + li.name() + + if (li.flags().isFinal() && initCount.isIllegalVal()) { + reportError("Final variable \"" + li.name() + "\" might already have been initialized", a.position()); } @@ -1112,8 +1245,7 @@ protected void checkFieldAssign(FlowGraph graph, FieldAssign a, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { FieldDef fi = a.fieldInstance().def(); if (fi.flags().isFinal()) { @@ -1134,8 +1266,8 @@ fi.name() + "\".", a.position()); } - if (InitCount.MANY.equals(initCount.getMax())) { - throw new SemanticException("Final field \"" + fi.name() + + if (initCount.isIllegalVal()) { + reportError("Final field \"" + fi.name() + "\" might already have been initialized", a.position()); } @@ -1144,7 +1276,7 @@ // not in a constructor or intializer, or the target is // not appropriate. So we cannot assign // to a final field at all. - throw new SemanticException("Cannot assign a value " + + reportError("Cannot assign a value " + "to final field \"" + fi.name() + "\" of \"" + fi.container() + "\".", a.position()); @@ -1156,13 +1288,11 @@ * <code>localsUsed</code>, which is the set of locals used in the inner * class declared by <code>cb</code> * are initialized before the class declaration. - * @throws SemanticException */ protected void checkClassBody(FlowGraph graph, ClassBody cb, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { // we need to check that the locals used inside this class body // have all been defined at this point. Set localsUsed = currCBI.localsUsedInClassBodies.get(cb); @@ -1186,8 +1316,7 @@ ClassBody cb, Set<LocalDef> localsUsed, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { for (Iterator<LocalDef> iter = localsUsed.iterator(); iter.hasNext(); ) { LocalDef li = (LocalDef)iter.next(); MinMaxInitCount initCount = dfOut.initStatus.get(li); @@ -1203,7 +1332,7 @@ // leave the inner class before we have performed flowLocalDecl // for the local variable declaration. - throw new SemanticException("Local variable \"" + li.name() + + reportError("Local variable \"" + li.name() + "\" must be initialized before the class " + "declaration.", cb.position()); @@ -1217,7 +1346,6 @@ protected void checkOther(FlowGraph graph, Node n, DataFlowItem dfIn, - DataFlowItem dfOut) - throws SemanticException { + DataFlowItem dfOut) { } } Modified: trunk/x10.compiler/src/polyglot/visit/ReachChecker.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/ReachChecker.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/polyglot/visit/ReachChecker.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -130,7 +130,7 @@ return DataFlowItem.NOT_REACHABLE; } - public Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException { + public Node leaveCall(Node old, Node n, NodeVisitor v) { // check for reachability. if (n instanceof Term) { n = checkReachability((Term)n); @@ -144,7 +144,7 @@ if ((n instanceof Block && ((Block) n).statements().isEmpty()) || (n instanceof Stmt && ! (n instanceof CompoundStmt))) { - throw new SemanticException("Unreachable statement.", + reportError("Unreachable statement.", n.position()); } } @@ -154,7 +154,7 @@ return super.leaveCall(old, n, v); } - protected Node checkReachability(Term n) throws SemanticException { + protected Node checkReachability(Term n) { FlowGraph g = currentFlowGraph(); if (g != null) { Collection peers = g.peers(n, Term.EXIT); @@ -174,7 +174,7 @@ // there will only be one peer for an initializer, // as it cannot occur in a finally block. if (isInitializer && !dfi.normalReachable) { - throw new SemanticException("Initializers must be able to complete normally.", + reportError("Initializers must be able to complete normally.", n.position()); } @@ -202,7 +202,7 @@ return n; } - public void post(FlowGraph graph, Term root) throws SemanticException { + public void post(FlowGraph graph, Term root) { // There is no need to do any checking in this method, as this will // be handled by leaveCall and checkReachability. if (Report.should_report(Report.cfg, 2)) { @@ -211,7 +211,7 @@ } public void check(FlowGraph graph, Term n, boolean entry, - Item inItem, Map outItems) throws SemanticException { + Item inItem, Map outItems) { throw new InternalCompilerError("ReachChecker.check should " + "never be called."); } Modified: trunk/x10.compiler/src/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -90,7 +90,6 @@ import x10.plugin.LoadJobPlugins; import x10.plugin.LoadPlugins; import x10.plugin.RegisterPlugins; -import x10.query.QueryEngine; import x10.types.X10SourceClassResolver; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; @@ -106,7 +105,6 @@ import x10.visit.StaticNestedClassRemover; import x10.visit.X10Caster; import x10.visit.X10ImplicitDeclarationExpander; -import x10.visit.X10InitChecker; import x10.visit.X10InnerClassRemover; import x10.visit.X10MLVerifier; import x10.visit.X10Translator; @@ -634,7 +632,7 @@ public Goal InitializationsChecked(Job job) { TypeSystem ts = job.extensionInfo().typeSystem(); NodeFactory nf = job.extensionInfo().nodeFactory(); - return new ForgivingVisitorGoal("InitializationsChecked", job, new X10InitChecker(job, ts, nf)).intern(this); + return new ForgivingVisitorGoal("InitializationsChecked", job, new InitChecker(job, ts, nf)).intern(this); } public static class ValidatingOutputGoal extends OutputGoal { Modified: trunk/x10.compiler/src/x10/visit/AssignPropertyChecker.java =================================================================== --- trunk/x10.compiler/src/x10/visit/AssignPropertyChecker.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/x10/visit/AssignPropertyChecker.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -225,7 +225,7 @@ return createItem(min, max); } - public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) throws SemanticException { + public void check(FlowGraph graph, Term n, boolean entry, Item inItem, Map outItems) { if (entry) return; @@ -238,8 +238,9 @@ if (outItem != null) { if (outItem.max == DataFlowItem.MANY) { // This should be caught by InitChecker, but report it here just in case. - throw new SemanticException("The constructor may have initialized properties more than once. There is a path with more than one property(...) statement or this(...) call.", + reportError("The constructor may have initialized properties more than once. There is a path with more than one property(...) statement or this(...) call.", cd.position()); + return; } if (!needsProperty() || outItem.min != DataFlowItem.ZERO) { @@ -250,7 +251,7 @@ } } - throw new SemanticException("The constructor incorrectly initializes properties. There is a path without a property(...) statement or this(...) call.", + reportError("The constructor incorrectly initializes properties. There is a path without a property(...) statement or this(...) call.", cd.position()); } } Deleted: trunk/x10.compiler/src/x10/visit/X10InitChecker.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10InitChecker.java 2010-08-25 18:01:52 UTC (rev 15733) +++ trunk/x10.compiler/src/x10/visit/X10InitChecker.java 2010-08-25 18:48:56 UTC (rev 15734) @@ -1,103 +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.visit; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import polyglot.ast.ClassBody; -import polyglot.ast.ClassDecl; -import polyglot.ast.ClassMember; -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; -import polyglot.types.TypeSystem; -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 { - - public X10InitChecker(Job job, TypeSystem ts, NodeFactory nf) { - 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. - * - * Set up the state that must be tracked during a Class Declaration. - */ - protected NodeVisitor enterCall(Node parent, Node n) throws SemanticException { - if (n instanceof ClassBody) { - // we are starting to process a class declaration, but have yet - // to do any of the dataflow analysis. - ClassBody cb = (ClassBody) n; - - // Add the properties to the class body when initializing. - if (parent instanceof X10ClassDecl) { - List<ClassMember> members; - members = new ArrayList<ClassMember>(); - members.addAll(cb.members()); - members.addAll(((X10ClassDecl) parent).properties()); - cb = cb.members(members); - } - - // set up the new ClassBodyInfo, and make sure that it forms - // a stack. - ClassDef ct = null; - if (parent instanceof ClassDecl) { - ct = ((ClassDecl) parent).classDef(); - } - else if (parent instanceof New) { - ct = ((New) parent).anonType(); - } - if (ct == null) { - throw new InternalCompilerError("ClassBody found but cannot find the class.", n.position()); - } - - setupClassBody(ct, cb); - } - - return super.enterCall(n); - } - -} Added: trunk/x10.tests/examples/Issues/XTENLANG_1565.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_1565.x10 (rev 0) +++ trunk/x10.tests/examples/Issues/XTENLANG_1565.x10 2010-08-25 18:48:56 UTC (rev 15734) @@ -0,0 +1,78 @@ +/* + * 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 + */ + +class XTENLANG_1565 extends x10Test { + + val m:Int, n:Int; + val q:Int; + val z:Int; + def this() { + finish { + async { z = 0; } + } + + shared var i:Int, j:Int, k:Int; + + i=1; + // i:[1,1,1,1] + finish { + m=2; + // m:[1,1,1,1] + if (true) { + async { + n=3; i=4; j=5; k=6; q=7; + // n:[1,1,1,1] i:[2,2,2,2] j:[1,1,1,1] k:[1,1,1,1] q:[1,1,1,1] + f(m); f(i); f(n); f(q); + } + // n:[0,0,1,1] i:[1,1,2,2] j:[0,0,1,1] k:[0,0,1,1] q:[0,0,1,1] + k=8; + // k:[1,1,2,2] + f(k); + //f(n); // ERR + } else { + // n:[0,0,0,0] i:[1,1,1,1] j:[0,0,0,0] k:[0,0,0,0] + n=9; q = 999; + f(n); f(m); f(i); + // n:[1,1,1,1] + } + // k:[0,1,0,2] n:[0,1,1,1] i:[1,1,1,2] j:[0,0,0,1] q:[0,0,0,1] + //f(k); // ERR + //f(n); // ERR + //f(j); // ERR + f(m); f(i); + k=11; + // k:[1,2,1,3] + f(k); + } + // k:[1,3,1,3] n:[1,1,1,1] i:[1,2,1,2] j:[0,1,0,1] q:[0,1,0,1] + f(k); f(n); f(m); f(i); + //f(j); // ERR + f(q); + j=12; + // j:[1,2,1,2] + f(j); + } + def f(i:Int):Int=i+1; + + public def run(): boolean { + return true; + } + + public static def main(Rail[String]) { + new XTENLANG_1565().execute(); + } +} Property changes on: trunk/x10.tests/examples/Issues/XTENLANG_1565.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.tests/examples/Issues/XTENLANG_1565_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_1565_MustFailCompile.x10 (rev 0) +++ trunk/x10.tests/examples/Issues/XTENLANG_1565_MustFailCompile.x10 2010-08-25 18:48:56 UTC (rev 15734) @@ -0,0 +1,87 @@ +/* + * 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 + Should produce these errors: +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:45: "n" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:53: "k" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:54: "n" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:55: "j" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:63: "j" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:64: "q" may not have been initialized +C:\cygwin\home\Yoav\intellij\sourceforge\x10.tests\examples\Issues\XTENLANG_1565_MustFailCompile.x10:23-68: Final field "q" might not have been initialized +7 errors. + */ + +class XTENLANG_1565_MustFailCompile extends x10Test { + + val m:Int, n:Int; + val q:Int; + val z:Int; + def this() { // ERR: Final field "q" might not have been initialized + finish { + async { z = 0; } + } + + shared var i:Int, j:Int, k:Int; + + i=1; + // i:[1,1,1,1] + finish { + m=2; + // m:[1,1,1,1] + if (true) { + async { + n=3; i=4; j=5; k=6; q=7; + // n:[1,1,1,1] i:[2,2,2,2] j:[1,1,1,1] k:[1,1,1,1] q:[1,1,1,1] + f(m); f(i); f(n); f(q); + } + // n:[0,0,1,1] i:[1,1,2,2] j:[0,0,1,1] k:[0,0,1,1] q:[0,0,1,1] + k=8; + // k:[1,1,2,2] + f(k); + f(n); // ERR + } else { + // n:[0,0,0,0] i:[1,1,1,1] j:[0,0,0,0] k:[0,0,0,0] + n=9; + f(n); f(m); f(i); + // n:[1,1,1,1] + } + // k:[0,1,0,2] n:[0,1,1,1] i:[1,1,1,2] j:[0,0,0,1] q:[0,0,0,1] + f(k); // ERR + f(n); // ERR + f(j); // ERR + f(m); f(i); + k=11; + // k:[1,2,1,3] + f(k); + } + // k:[1,3,1,3] n:[1,1,1,1] i:[1,2,1,2] j:[0,1,0,1] q:[0,1,0,1] + f(k); f(n); f(m); f(i); + f(j); // ERR + f(q); // ERR + j=12; + // j:[1,2,1,2] + f(j); + } + def f(i:Int):Int=i+1; + + public def run(): boolean { + return true; + } + + public static def main(Rail[String]) { + new XTENLANG_1565_MustFailCompile().execute(); + } +} Property changes on: trunk/x10.tests/examples/Issues/XTENLANG_1565_MustFailCompile.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-26 17:40:05
|
Revision: 15768 http://x10.svn.sourceforge.net/x10/?rev=15768&view=rev Author: dgrove-oss Date: 2010-08-26 17:39:58 +0000 (Thu, 26 Aug 2010) Log Message: ----------- remove == and != operator on Point; update impacted Point test cases to use equals instead. Modified Paths: -------------- trunk/x10.runtime/src-x10/x10/array/Point.x10 trunk/x10.tests/examples/Constructs/Point/PointComparison1.x10 trunk/x10.tests/examples/Constructs/Point/PointDiv.x10 trunk/x10.tests/examples/Constructs/Point/PointSub.x10 trunk/x10.tests/examples/Constructs/Point/TestPointHash.x10 Modified: trunk/x10.runtime/src-x10/x10/array/Point.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Point.x10 2010-08-26 16:43:34 UTC (rev 15767) +++ trunk/x10.runtime/src-x10/x10/array/Point.x10 2010-08-26 17:39:58 UTC (rev 15768) @@ -171,16 +171,6 @@ return true; } - /** Two points of the same rank are equal if and only if their - * corresponding indices are equal. - */ - public global safe operator this == (that: Point(rank)): boolean { - for (var i: int = 0; i<rank; i++) - if (!(this.coords(i)==that.coords(i))) - return false; - return true; - } - /** For points a, b, <code> a < b</code> if <code>a</code> is lexicographically smaller than <code>b</code>. */ public global safe operator this < (that: Point(rank)): boolean { @@ -229,18 +219,6 @@ return this.coords(rank-1) >= that.coords(rank-1); } - /** For points <code>a, b</code>, <code> a ≠ b</code> if <code>a</code> is for some index - <code> a</code> is distinct from <code>b</code>. - */ - public global safe operator this != (that: Point(rank)): boolean { - for (var i: int = 0; i<rank; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a !=b) return true; - } - return false; - } - /** A point with coordinates <code>i1,..., ik</code> is printed as <code>(i1,.., ik)</code>. */ public global safe def toString() { Modified: trunk/x10.tests/examples/Constructs/Point/PointComparison1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Point/PointComparison1.x10 2010-08-26 16:43:34 UTC (rev 15767) +++ trunk/x10.tests/examples/Constructs/Point/PointComparison1.x10 2010-08-26 17:39:58 UTC (rev 15768) @@ -24,8 +24,7 @@ pr(a + "< " + b + " " + (a < b)); pr(a + ">=" + b + " " + (a >= b)); pr(a + "<=" + b + " " + (a <= b)); - pr(a + "==" + b + " " + (a == b)); - pr(a + "!=" + b + " " + (a != b)); + pr(a + ".equals" + b + " " + (a.equals(b))); } public def run() { @@ -51,38 +50,32 @@ "(1,2,3,4,5)< (2,3,4,5,6) true\n"+ "(1,2,3,4,5)>=(2,3,4,5,6) false\n"+ "(1,2,3,4,5)<=(2,3,4,5,6) true\n"+ - "(1,2,3,4,5)==(2,3,4,5,6) false\n"+ - "(1,2,3,4,5)!=(2,3,4,5,6) true\n"+ + "(1,2,3,4,5).equals(2,3,4,5,6) false\n"+ "(1,2,3,4,5)> (6,5,4,3,2) false\n"+ "(1,2,3,4,5)< (6,5,4,3,2) true\n"+ "(1,2,3,4,5)>=(6,5,4,3,2) false\n"+ "(1,2,3,4,5)<=(6,5,4,3,2) true\n"+ - "(1,2,3,4,5)==(6,5,4,3,2) false\n"+ - "(1,2,3,4,5)!=(6,5,4,3,2) true\n"+ + "(1,2,3,4,5).equals(6,5,4,3,2) false\n"+ "(1,2,3,4,5)> (1,2,3,4,5) false\n"+ "(1,2,3,4,5)< (1,2,3,4,5) false\n"+ "(1,2,3,4,5)>=(1,2,3,4,5) true\n"+ "(1,2,3,4,5)<=(1,2,3,4,5) true\n"+ - "(1,2,3,4,5)==(1,2,3,4,5) true\n"+ - "(1,2,3,4,5)!=(1,2,3,4,5) false\n"+ + "(1,2,3,4,5).equals(1,2,3,4,5) true\n"+ "(2,3,4,5,6)> (1,2,3,4,5) true\n"+ "(2,3,4,5,6)< (1,2,3,4,5) false\n"+ "(2,3,4,5,6)>=(1,2,3,4,5) true\n"+ "(2,3,4,5,6)<=(1,2,3,4,5) false\n"+ - "(2,3,4,5,6)==(1,2,3,4,5) false\n"+ - "(2,3,4,5,6)!=(1,2,3,4,5) true\n"+ + "(2,3,4,5,6).equals(1,2,3,4,5) false\n"+ "(6,5,4,3,2)> (1,2,3,4,5) true\n"+ "(6,5,4,3,2)< (1,2,3,4,5) false\n"+ "(6,5,4,3,2)>=(1,2,3,4,5) true\n"+ "(6,5,4,3,2)<=(1,2,3,4,5) false\n"+ - "(6,5,4,3,2)==(1,2,3,4,5) false\n"+ - "(6,5,4,3,2)!=(1,2,3,4,5) true\n"+ + "(6,5,4,3,2).equals(1,2,3,4,5) false\n"+ "(1,2,3,4,5)> (1,2,3,4,5) false\n"+ "(1,2,3,4,5)< (1,2,3,4,5) false\n"+ "(1,2,3,4,5)>=(1,2,3,4,5) true\n"+ "(1,2,3,4,5)<=(1,2,3,4,5) true\n"+ - "(1,2,3,4,5)==(1,2,3,4,5) true\n"+ - "(1,2,3,4,5)!=(1,2,3,4,5) false\n"; + "(1,2,3,4,5).equals(1,2,3,4,5) true\n"; public static def main(Rail[String]) { new PointComparison1().execute(); Modified: trunk/x10.tests/examples/Constructs/Point/PointDiv.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Point/PointDiv.x10 2010-08-26 16:43:34 UTC (rev 15767) +++ trunk/x10.tests/examples/Constructs/Point/PointDiv.x10 2010-08-26 17:39:58 UTC (rev 15768) @@ -25,7 +25,7 @@ val q = [1, 1, 1, 1, 1] as Point; val a = p / q; - return p==a*q; + return p.equals(a*q); } public static def main(var args: Rail[String]): void = { Modified: trunk/x10.tests/examples/Constructs/Point/PointSub.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Point/PointSub.x10 2010-08-26 16:43:34 UTC (rev 15767) +++ trunk/x10.tests/examples/Constructs/Point/PointSub.x10 2010-08-26 17:39:58 UTC (rev 15768) @@ -25,7 +25,7 @@ val q = [1, 1, 1, 1, 1] as Point; val a = p - q; - return a+q==p; + return (a+q).equals(p); } public static def main(var args: Rail[String]): void = { Modified: trunk/x10.tests/examples/Constructs/Point/TestPointHash.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Point/TestPointHash.x10 2010-08-26 16:43:34 UTC (rev 15767) +++ trunk/x10.tests/examples/Constructs/Point/TestPointHash.x10 2010-08-26 17:39:58 UTC (rev 15768) @@ -21,7 +21,7 @@ public def run(): Boolean = { val b = Point.make(1,1,1); val c = Point.make(1,1,1); - chk (b == c); + chk (b.equals(c)); chk (b.hashCode() == c.hashCode()); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-08-27 18:22:26
|
Revision: 15806 http://x10.svn.sourceforge.net/x10/?rev=15806&view=rev Author: ipeshansky Date: 2010-08-27 18:22:17 +0000 (Fri, 27 Aug 2010) Log Message: ----------- Reorganized the Java runtime build to put generated XRX .java files in src-java/gen, to mirror the C++ build. Added the "gen" property in build.xml to refer to the generated .java file location. Added src-java/gen as a source folder to allow debugging generated XRX code. All generated classfiles now live relative to the x10.runtime/classes directory (so they appear on the default classpath). Moved the generated x10.jar out of x10.runtime/classes and into x10.runtime/src-java/gen. Remove x10.runtime dependence on x10.constraints. Separated the "squeakyclean" target in x10.dist/build.xml into "clean-java" and "clean-cpp" ("squeakyclean" does both). Run x10c and x10c++ with 1G max heap during the build. Modified Paths: -------------- trunk/x10.dist/build.xml trunk/x10.runtime/.classpath trunk/x10.runtime/META-INF/MANIFEST.MF trunk/x10.runtime/build.properties trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/Makefile Added Paths: ----------- trunk/x10.runtime/src-java/gen/ Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.dist/build.xml 2010-08-27 18:22:17 UTC (rev 15806) @@ -51,9 +51,26 @@ </delete> </target> - <target name="squeakyclean" depends="clean"> + <target name="clean-java" depends="clean"> <delete dir="${etc}" failonerror="false"/> <mkdir dir="${etc}" /> + <mkdir dir="${lib}" /> + <delete> <!-- TODO: download jars elsewhere and copy --> + <fileset dir="${lib}"> + <include name="x10*.jar"/> + </fileset> + </delete> + <!-- TODO: remove generated libs, but not downloaded ones + <delete dir="${lib}" failonerror="false"/> + <mkdir dir="${lib}" /> + --> + <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-java" inheritAll="false" dir="${x10.runtime.location}"/> + <ant antfile="${x10.compiler.location}/build.xml" target="clean" inheritAll="false" dir="${x10.compiler.location}"/> + </target> + + <target name="clean-cpp" depends="clean-java"> <delete dir="${incdir}" failonerror="false"/> <mkdir dir="${incdir}" /> <mkdir dir="${lib}" /> @@ -65,19 +82,17 @@ <include name="*.dylib"/> <include name="*.dll"/> <include name="*.mft"/> - <include name="x10*.jar"/> </fileset> </delete> <!-- TODO: remove generated libs, but not downloaded ones <delete dir="${lib}" failonerror="false"/> <mkdir dir="${lib}" /> --> - <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.compiler.location}/build.xml" target="clean" inheritAll="false" dir="${x10.compiler.location}"/> </target> + <target name="squeakyclean" depends="clean-java,clean-cpp"/> + <target name="distclean" depends="squeakyclean"> <delete dir="${lib}" failonerror="false"/> <mkdir dir="${lib}" /> Modified: trunk/x10.runtime/.classpath =================================================================== --- trunk/x10.runtime/.classpath 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.runtime/.classpath 2010-08-27 18:22:17 UTC (rev 15806) @@ -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" excluding="gen/**"/> + <classpathentry kind="src" path="src-java/gen"/> + <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> Modified: trunk/x10.runtime/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime/META-INF/MANIFEST.MF 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.runtime/META-INF/MANIFEST.MF 2010-08-27 18:22:17 UTC (rev 15806) @@ -5,6 +5,5 @@ Bundle-Version: 2.0.5.qualifier Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... -Require-Bundle: x10.common, - x10.constraints +Require-Bundle: x10.common Modified: trunk/x10.runtime/build.properties =================================================================== --- trunk/x10.runtime/build.properties 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.runtime/build.properties 2010-08-27 18:22:17 UTC (rev 15806) @@ -1,4 +1,5 @@ -source.. = src/ +source.. = src-java/,\ + src-java/gen output.. = classes/ bin.includes = META-INF/,\ . Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.runtime/build.xml 2010-08-27 18:22:17 UTC (rev 15806) @@ -8,6 +8,7 @@ <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="build" location="${basedir}/classes"/> <property name="src" location="${basedir}/src-java"/> + <property name="gen" location="${src}/gen"/> <property name="inc" location="${x10.dist.location}/include"/> <property name="lib" location="${x10.dist.location}/lib"/> <property name="jar" value="x10.jar"/> @@ -46,7 +47,7 @@ <target name="init"> <mkdir dir="${build}"/> - <mkdir dir="${build}/gen"/> + <mkdir dir="${gen}"/> <javac destdir="${build}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${x10.common.location}/contrib/ant"/> <include name="Ejc.java"/> @@ -73,7 +74,7 @@ <condition property="bdwgc.enabled"> <and> <isfalse value="${DISABLE_GC}" /> - <isfalse value="${CROSS_COMPILE_BGP}" /> + <isfalse value="${CROSS_COMPILE_BGP}" /> <or> <os family="unix" name="linux"/> <os family="mac"/> @@ -137,6 +138,11 @@ <target name="distclean-java" depends="clean-java"/> <target name="clean-java"> <delete dir="${build}" failonerror="false"/> + <delete failonerror="false"> <!-- keep the gen directory itself because Eclipse needs it --> + <fileset dir="${gen}"> + <include name="**"/> + </fileset> + </delete> </target> <target name="distclean-cpp" depends="clean-cpp,clean-bdwgc"/> <target name="clean-cpp" depends="available-procs"> @@ -180,7 +186,7 @@ <target name="dist-java" depends="jar"> <mkdir dir="${lib}"/> <copy todir="${lib}"> - <fileset dir="${build}" includes="${jar}"/> + <fileset dir="${gen}" includes="${jar}"/> </copy> </target> <target name="dist-cpp" depends="dist-x10rt,build-cpp,available-procs"> @@ -197,9 +203,8 @@ <target name="dist" depends="dist-java,dist-cpp" description="generate part of the distribution"> </target> <target name="jar" depends="build-xrx"> - <jar jarfile="${build}/${jar}"> + <jar jarfile="${gen}/${jar}"> <fileset dir="${build}" 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/**"/> @@ -208,12 +213,15 @@ <target name="build-java" depends="init,gen-xrx"> <ejc destdir="${build}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${src}"/> + <size value="50" when="more"/> <classpath> <path refid="project.classpath"/> + <path> + <pathelement location="${build}"/> + </path> </classpath> </ejc> </target> - <property name="gen" location="${build}/gen"/> <!-- TODO: check the generated files with respect to the compiler jar --> <target name="check-xrx" depends="init"> <fileset id="xrx.files" dir="${basedir}/src-x10" includes="**/*.x10"/> @@ -235,43 +243,22 @@ <echo message="x10c ${x10c.optimize} ${x10c.inline_optimizations} ${x10c.no_checks} -c ${xrx.list}"/> <exec executable="${bash.exe}" failonerror="true" dir="${basedir}/src-x10"> <arg value="-c" /> - <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}" /> + <arg value="'${x10.dist.location}/bin/x10c' -J-Xmx1024M ${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"> <!-- - <fileset id="generated.files" dir="${build}/gen" includes="**/*.java"/> - <pathconvert property="generated.list" refid="generated.files" dirsep="/" pathsep=" "/> - <java jar="${lib}/ecj.jar" fork="true" dir="${build}/gen" failonerror="true"> - <arg value="-1.5"/> - <arg value="-nowarn"/> - <arg line="-classpath .${path.separator}.."/> - <arg line="${generated.list}"/> - </java> - --> - <!-- - <javac destdir="${build}/gen" compiler="${ejc.compiler}" source="1.5" target="1.5" debug="on" nowarn="on"> - <src path="${build}/gen"/> - <classpath> - <path refid="project.classpath"/> - <path> - <pathelement location="${build}/gen"/> - <pathelement location="${build}"/> - </path> - </classpath> - </javac> - --> - <ejc destdir="${gen}" source="1.5" target="1.5" debug="on" nowarn="on"> + <ejc destdir="${build}" source="1.5" target="1.5" debug="on" nowarn="on"> <src path="${gen}"/> <size value="50" when="more"/> <classpath> <path refid="project.classpath"/> <path> - <pathelement location="${gen}"/> <pathelement location="${build}"/> </path> </classpath> </ejc> + --> </target> <target name="jni-headers" depends="init,build-java"> @@ -318,11 +305,11 @@ <echo message="Installing BDWGC to ${bdwgc.platform.dir}"/> <if> <conditions> - <or> + <or> <os family="unix" name="linux" arch="ppc"/> <os family="unix" name="linux" arch="ppc32"/> <os family="unix" name="linux" arch="ppc64"/> - </or> + </or> </conditions> <sequential> <exec executable="${bash.exe}" dir="${bdwgc.dir}/src" failonerror="true"> @@ -339,12 +326,12 @@ <and> <os family="unix" name="linux" /> <not> - <or> + <or> <os family="unix" name="linux" arch="ppc"/> <os family="unix" name="linux" arch="ppc32"/> <os family="unix" name="linux" arch="ppc64"/> - </or> - </not> + </or> + </not> </and> </conditions> <sequential> Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-08-27 18:15:10 UTC (rev 15805) +++ trunk/x10.runtime/src-cpp/Makefile 2010-08-27 18:22:17 UTC (rev 15806) @@ -60,7 +60,7 @@ XRXFILES = $(shell find ../src-x10 -name .svn -prune -o -name '*.x10' -print | sort ) #enable asserts, do not look in jar for x10 files -X10CPPFLAGS += -J-ea -rtdev -commandlineonly +X10CPPFLAGS += -J-Xmx1024M -J-ea -rtdev -commandlineonly # Generate .cc .inc and .h files for all the X10 classes defined in the above # .x10 files. Rebuilding occurs if the x10 backend is updated or if any of the Property changes on: trunk/x10.runtime/src-java/gen ___________________________________________________________________ Added: svn:ignore + x10 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-08-27 18:29:02
|
Revision: 15807 http://x10.svn.sourceforge.net/x10/?rev=15807&view=rev Author: ipeshansky Date: 2010-08-27 18:28:56 +0000 (Fri, 27 Aug 2010) Log Message: ----------- Resurrect the main() in x10.runtime.impl.java.Runtime that allows invoking generated X10 files as "java Runtime UserClass". NOTE: This is in addition to the current mechanism of invoking UserClass$Main directly. Update the "x10" launch configuration to run the generated files produced by "x10c" when the source .x10 file is selected. Modified Paths: -------------- trunk/x10.dist/.launchConfigs/x10.launch trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java Modified: trunk/x10.dist/.launchConfigs/x10.launch =================================================================== --- trunk/x10.dist/.launchConfigs/x10.launch 2010-08-27 18:22:17 UTC (rev 15806) +++ trunk/x10.dist/.launchConfigs/x10.launch 2010-08-27 18:28:56 UTC (rev 15807) @@ -1,23 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/x10.runtime.x10/src-java/x10/runtime/impl/java/Runtime.java"/> +<listEntry value="/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="1"/> </listAttribute> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/> -<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.runtime&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.constraints&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.common/examples/Constructs/AtEach&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.runtime/src&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> <listEntry value="org.eclipse.debug.ui.launchGroup.run"/> <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> </listAttribute> <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10" path="1" type="4"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" id="org.eclipse.jdt.launching.classpathentry.variableClasspathEntry"> <memento variableString="${container_loc}/out"/> </runtimeClasspathEntry> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> </listAttribute> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="x10.runtime.impl.java.Runtime"/> Modified: trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java 2010-08-27 18:22:17 UTC (rev 15806) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java 2010-08-27 18:28:56 UTC (rev 15807) @@ -11,6 +11,8 @@ package x10.runtime.impl.java; +import java.lang.reflect.InvocationTargetException; + public abstract class Runtime implements Runnable { private String[] args; @@ -114,4 +116,42 @@ public static boolean local(int id) { return true; // single process implementation } + + /** + * Redirect to the specified user class's main(). + */ + public static void main(String[] args) throws Throwable { + boolean verbose = false; + String className = null; + for (int i = 0; i < args.length; i++) { + String arg = args[i]; + if (arg.equals("-v") || arg.equals("-verbose") || arg.equals("--verbose")) { + verbose=true; + } else if (arg.charAt(0)=='-') { + int eq = arg.indexOf('='); + String key = "x10." + (eq<0 ? arg.substring(1) : arg.substring(1, eq)); + String value = eq<0 ? "true" : arg.substring(eq+1); + System.setProperty(key, value); + } else { + int dotx10 = arg.indexOf(".x10"); + className = (dotx10<0 ? arg : arg.substring(0, dotx10)) + "$Main"; + int len = args.length-i-1; + System.arraycopy(args, i+1, args = new String[len], 0, len); + } + } + if (verbose) { + System.err.println("Invoking user class: "+className+" with classpath '"+System.getProperty("java.class.path")+"'"); + } + try { + Class.forName(className).getMethod("main", String[].class).invoke(null, (Object)args); + } catch (ClassNotFoundException e) { + System.err.println("Class not found: "+className); + } catch (InvocationTargetException e) { + throw e.getCause(); + } catch (Exception e) { + System.err.println("Unable to invoke user program: "+e); + if (verbose) + e.printStackTrace(); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-08-27 21:05:17
|
Revision: 15814 http://x10.svn.sourceforge.net/x10/?rev=15814&view=rev Author: dgrove-oss Date: 2010-08-27 21:05:11 +0000 (Fri, 27 Aug 2010) Log Message: ----------- bump version numbers to 2.0.6 Modified Paths: -------------- trunk/x10.common/META-INF/MANIFEST.MF trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/src/x10/Version.java trunk/x10.compiler/src/x10cpp/Version.java trunk/x10.constraints/META-INF/MANIFEST.MF trunk/x10.runtime/META-INF/MANIFEST.MF Modified: trunk/x10.common/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.common/META-INF/MANIFEST.MF 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.common/META-INF/MANIFEST.MF 2010-08-27 21:05:11 UTC (rev 15814) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 Common components Bundle-SymbolicName: x10.common -Bundle-Version: 2.0.5.qualifier +Bundle-Version: 2.0.6.qualifier Export-Package: x10.config Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler/META-INF/MANIFEST.MF 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2010-08-27 21:05:11 UTC (rev 15814) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 compiler Bundle-SymbolicName: x10.compiler -Bundle-Version: 2.0.5.qualifier +Bundle-Version: 2.0.6.qualifier Bundle-Localization: plugin Require-Bundle: x10.common, x10.constraints, Modified: trunk/x10.compiler/src/x10/Version.java =================================================================== --- trunk/x10.compiler/src/x10/Version.java 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.compiler/src/x10/Version.java 2010-08-27 21:05:11 UTC (rev 15814) @@ -19,5 +19,5 @@ public int major() { return 2; } public int minor() { return 0; } - public int patch_level() { return 5; } + public int patch_level() { return 6; } } Modified: trunk/x10.compiler/src/x10cpp/Version.java =================================================================== --- trunk/x10.compiler/src/x10cpp/Version.java 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.compiler/src/x10cpp/Version.java 2010-08-27 21:05:11 UTC (rev 15814) @@ -19,5 +19,5 @@ public int major() { return 2; } public int minor() { return 0; } - public int patch_level() { return 5; } + public int patch_level() { return 6; } } Modified: trunk/x10.constraints/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.constraints/META-INF/MANIFEST.MF 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.constraints/META-INF/MANIFEST.MF 2010-08-27 21:05:11 UTC (rev 15814) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 Constraints Bundle-SymbolicName: x10.constraints -Bundle-Version: 2.0.5.qualifier +Bundle-Version: 2.0.6.qualifier Export-Package: x10.constraint Modified: trunk/x10.runtime/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime/META-INF/MANIFEST.MF 2010-08-27 20:08:08 UTC (rev 15813) +++ trunk/x10.runtime/META-INF/MANIFEST.MF 2010-08-27 21:05:11 UTC (rev 15814) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 runtime Bundle-SymbolicName: x10.runtime -Bundle-Version: 2.0.5.qualifier +Bundle-Version: 2.0.6.qualifier Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... Require-Bundle: x10.common This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-09-01 22:40:32
|
Revision: 15963 http://x10.svn.sourceforge.net/x10/?rev=15963&view=rev Author: tardieu Date: 2010-09-01 22:40:21 +0000 (Wed, 01 Sep 2010) Log Message: ----------- imported some content of the scalable-finish branch to the trunk (that is the analysis part but not the specialisation part) added com.ibm.wala.cast.x10 project imported changes to x10.dist imported changes to x10.compiler (except for Desugarer changes) not imported changes to x10.runtime Modified Paths: -------------- trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/src/x10/Configuration.java trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.dist/bin/x10c.in trunk/x10.dist/build.xml Added Paths: ----------- trunk/com.ibm.wala.cast.x10/ trunk/x10.compiler/src/x10/finish/ trunk/x10.compiler/src/x10/finish/table/ trunk/x10.compiler/src/x10/finish/table/CallTableAtVal.java trunk/x10.compiler/src/x10/finish/table/CallTableKey.java trunk/x10.compiler/src/x10/finish/table/CallTableMethodKey.java trunk/x10.compiler/src/x10/finish/table/CallTableMethodVal.java trunk/x10.compiler/src/x10/finish/table/CallTableScopeKey.java trunk/x10.compiler/src/x10/finish/table/CallTableUtil.java trunk/x10.compiler/src/x10/finish/table/CallTableVal.java trunk/x10.compiler/src/x10/finish/table/HprofParser.java trunk/x10.compiler/src/x10/finish/table/OutputUtil.java trunk/x10.compiler/src/x10/visit/FinishAnnotationVisitor.java trunk/x10.compiler/src/x10/visit/FinishAsyncVisitor.java trunk/x10.compiler/src/x10/visit/MainMethodFinder.java Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler/META-INF/MANIFEST.MF 2010-09-01 22:11:46 UTC (rev 15962) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2010-09-01 22:40:21 UTC (rev 15963) @@ -22,6 +22,7 @@ x10.emitter, x10.errors, x10.extension, + x10.finish.table, x10.optimizations, x10.parser, x10.plugin, Modified: trunk/x10.compiler/src/x10/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10/Configuration.java 2010-09-01 22:11:46 UTC (rev 15962) +++ trunk/x10.compiler/src/x10/Configuration.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -78,12 +78,16 @@ public static boolean WORK_STEALING = false; private static final String WORK_STEALING_desc = "Code generation for work-stealing scheduling"; + public static boolean WALA = false; + private static final String WALA_desc = "Produce WALA IR from X10 sources"; + public static boolean VERBOSE_CALLS = false; private static final String VERBOSE_CALLS_desc = "Print details of casts introduced for dynamically-checked calls."; public static boolean STATIC_CALLS = false; private static final String STATIC_CALLS_desc = "Treat dynamically-checked calls as errors."; - + public static boolean FINISH_ASYNCS = false; + private static final String FINISH_ASYNCS_desc = "finish-async analysis."; /** * Parses one argument from the command line. This allows the user * to specify options also on the command line (in addition to the Modified: trunk/x10.compiler/src/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-09-01 22:11:46 UTC (rev 15962) +++ trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -18,12 +18,14 @@ import java.io.IOException; import java.io.Reader; import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -84,6 +86,8 @@ import x10.ast.X10NodeFactory_c; import x10.errors.Warnings; import x10.extension.X10Ext; +import x10.finish.table.CallTableKey; +import x10.finish.table.CallTableVal; import x10.optimizations.Optimizer; import x10.parser.X10Lexer; import x10.parser.X10Parser; @@ -100,6 +104,8 @@ import x10.visit.ExprFlattener; import x10.visit.ExpressionFlattener; import x10.visit.FieldInitializerMover; +import x10.visit.FinishAsyncVisitor; +import x10.visit.MainMethodFinder; import x10.visit.NativeClassVisitor; import x10.visit.RewriteAtomicMethodVisitor; import x10.visit.RewriteExternVisitor; @@ -127,7 +133,7 @@ public static final String XML_FILE_EXTENSION = "x10ml"; public static final String XML_FILE_DOT_EXTENSION = "." + XML_FILE_EXTENSION; - + private static HashMap<CallTableKey, LinkedList<CallTableVal>> calltable = new HashMap<CallTableKey, LinkedList<CallTableVal>>(); public static String clock = "clock"; static { @@ -383,7 +389,6 @@ goals.add(TypesInitializedForCommandLineBarrier()); goals.add(TypeChecked(job)); - goals.add(ReassembleAST(job)); goals.add(ConformanceChecked(job)); @@ -411,16 +416,41 @@ if (!x10.Configuration.ONLY_TYPE_CHECKING) { + + if (x10.Configuration.WALA || x10.Configuration.FINISH_ASYNCS) { + try{ + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Class<?> c = cl.loadClass("com.ibm.wala.cast.x10.translator.polyglot.X102IRGoal"); + Constructor<?> con = c.getConstructor(Job.class); + Method buildCallTableMethod = c.getMethod("analyze"); + Method hasMain = c.getMethod("hasMain", String.class); + Goal ir = ((Goal) con.newInstance(job)).intern(this); + goals.add(ir); + Goal finder = MainMethodFinder(job, hasMain); + finder.addPrereq(TypeCheckBarrier()); + ir.addPrereq(finder); + Goal barrier = IRBarrier(ir, buildCallTableMethod,x10.Configuration.FINISH_ASYNCS); + goals.add(barrier); + if(x10.Configuration.FINISH_ASYNCS){ + goals.add(FinishAsyncBarrier(barrier,job,this)); + } + + } catch (Throwable e) { + System.err.println("WALA not found."); + e.printStackTrace(); + } + } goals.add(X10Casted(job)); goals.add(MoveFieldInitializers(job)); goals.add(X10Expanded(job)); goals.add(X10RewriteExtern(job)); goals.add(X10RewriteAtomicMethods(job)); - + + + goals.add(NativeClassVisitor(job)); goals.add(Serialized(job)); - if (x10.Configuration.WORK_STEALING) { Goal wsCodeGenGoal = WSCodeGenerator(job); if(wsCodeGenGoal != null) { @@ -448,8 +478,6 @@ // the barrier will handle prereqs on its own CodeGenerated(job).addPrereq(CodeGenBarrier()); - - Desugarer(job).addPrereq(TypeCheckBarrier()); CodeGenerated(job).addPrereq(Desugarer(job)); List<Goal> optimizations = Optimizer.goals(this, job); @@ -522,6 +550,25 @@ } + public Goal IRBarrier(final Goal goal, final Method method, final boolean finishAsync) { + return new AllBarrierGoal("IRBarrier", this) { + @Override + public Goal prereqForJob(Job job) { + if (!scheduler.commandLineJobs().contains(job) && + ((ExtensionInfo) extInfo).manifestContains(job.source().path())) { + return null; + } + return goal; + } + public boolean runTask() { + try { + calltable = (HashMap<CallTableKey, LinkedList<CallTableVal>>) method.invoke(null); + } catch (Throwable t) {} + return true; + } + }.intern(this); + } + public Goal TypeCheckBarrier() { String name = "TypeCheckBarrier"; if (Globals.Options().compile_command_line_only) { @@ -811,6 +858,12 @@ return new ValidatingVisitorGoal("NativeClassVisitor", job, new NativeClassVisitor(job, ts, nf, "java")).intern(this); } + public Goal MainMethodFinder(Job job, Method hasMain) { + TypeSystem ts = extInfo.typeSystem(); + NodeFactory nf = extInfo.nodeFactory(); + return new ValidatingVisitorGoal("MainMethodFinder", job, new MainMethodFinder(job, ts, nf, hasMain)).intern(this); + } + public Goal WSCodeGenerator(Job job) { TypeSystem ts = extInfo.typeSystem(); NodeFactory nf = extInfo.nodeFactory(); @@ -876,6 +929,33 @@ NodeFactory nf = extInfo.nodeFactory(); return new ValidatingVisitorGoal("StaticNestedClassRemover", job, new StaticNestedClassRemover(job, ts, nf)).intern(this); } + public Goal FinishAsyncBarrier(final Goal goal, final Job job, final Scheduler s){ + + return new AllBarrierGoal("FinishAsyncBarrier", this) { + @Override + public Goal prereqForJob(Job job) { + //TODO: probably need to also annotation code in "runtime" + if (!scheduler.commandLineJobs().contains(job) && + ((ExtensionInfo) extInfo).manifestContains(job.source().path())) { + return null; + } + return goal; + } + public boolean runTask() { + try { + + TypeSystem ts = extInfo.typeSystem(); + NodeFactory nf = extInfo.nodeFactory(); + FinishAsyncVisitor favisitor = new FinishAsyncVisitor(job, ts, nf, "java", calltable); + Goal finish = new VisitorGoal("FinishAsyncs",job,favisitor).intern(s); + finish.runTask(); + + } catch (Throwable t) {} + return true; + } + }.intern(this); + + } public static class X10Job extends Job { public X10Job(polyglot.frontend.ExtensionInfo lang, JobExt ext, Source source, Node ast) { Added: trunk/x10.compiler/src/x10/finish/table/CallTableAtVal.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableAtVal.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableAtVal.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,40 @@ +package x10.finish.table; +import java.util.HashSet; + + +import java.util.Iterator; +import java.util.LinkedList; + +public class CallTableAtVal extends CallTableVal { + + private static final long serialVersionUID = 1L; + public CallTableAtVal(String s, String n, int l,int c,int b, CallTableKey p) { + super(s,n,l,c,b,p); + } + public CallTableAtVal(String s, String n, Arity a, int l,int c,int b,CallTableKey p) { + super(s,n,l,c,b,p,a); + } + public String genSignature(){ + return scope+"."+line+"."+column; + } + public int hashCode(){ + return genSignature().hashCode(); + } + + public boolean equals(Object o) { + boolean result = false; + if (o instanceof CallTableAtVal){ + result = genSignature().equals(((CallTableAtVal) o).genSignature()); + } + return result; + } + + public String toString(){ + String tmp=""; + if(isLast){ + tmp = "-last"; + } + return (a.toString()+"-"+scope+".at."+line+"."+column+tmp); + } + +} Added: trunk/x10.compiler/src/x10/finish/table/CallTableKey.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableKey.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableKey.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,34 @@ +package x10.finish.table; +import java.io.Serializable; + +/** + * key of the "calltable", we have two kinds of keys, one represents a "finish" or "at" + * and the other means a "normal method" + */ +public abstract class CallTableKey implements Serializable { + + private static final long serialVersionUID = 1L; + public final String scope; + public final String name; + public final int line; + public final int column; + public CallTableVal lastStmt; + //default pattern + public int pattern=0; + public CallTableKey(String s, String n, int l, int c){ + scope = s; + name = n; + line = l; + column = c; + lastStmt = null; + } + /** + * scope is usually the class where "key" is defined + * so scope+line+column should be able to distiguish + * different "keys" + * @return + */ + public String genSignature(){ + return scope + "."+line+"."+column; + } +} Added: trunk/x10.compiler/src/x10/finish/table/CallTableMethodKey.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableMethodKey.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableMethodKey.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,25 @@ +package x10.finish.table; +public class CallTableMethodKey extends CallTableKey { + + private static final long serialVersionUID = 1L; + + public CallTableMethodKey(String s, String n, int l, int c) { + super(s,n,l,c); } + + public String toString() { + return scope+"."+name+"."+line+"."+column; + } + /* equals and hashCode are to make sure an object of CallTableKey + * can be hashed in a HashMap */ + public boolean equals(Object o) { + boolean result = false; + if(o instanceof CallTableKey){ + result = genSignature().equals(((CallTableKey) o).genSignature()); + } + return result; + } + + public int hashCode() { + return scope.hashCode(); + } +} \ No newline at end of file Added: trunk/x10.compiler/src/x10/finish/table/CallTableMethodVal.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableMethodVal.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableMethodVal.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,77 @@ +package x10.finish.table; + +import java.io.Serializable; +import java.util.LinkedList; + + +/** + * Similar to CallTableKey, this class represents the "value" part of the + * key-value map. All "values" in the calltable will be method invocation, and + * we distinguish normal methods call from ansyc statement by its signature + */ + +public class CallTableMethodVal extends CallTableVal { + + private static final long serialVersionUID = 1L; + //distinguish "async" with "method" + public final boolean isAsync; + public final boolean isLocal; + // where this method is called, not a call stack + public final CallSite cs; + + public CallTableMethodVal(String method_pack, String method_name, int method_line, int method_column, + String callsite_pack, String callsite_name, int callsite_line, int callsite_column, int b, CallTableKey p, boolean isAsync, boolean isLocal) { + super(method_pack,method_name,method_line,method_column,b,p); + cs = new CallSite(callsite_pack, callsite_name, callsite_line,callsite_column); + this.isAsync = isAsync; + this.isLocal = isLocal; + } + public CallTableMethodVal(String method_pack, String method_name, int method_line, int method_column, + Arity a, String callsite_pack, String callsite_name, int callsite_line, int callsite_column, int b, CallTableKey p, boolean isAsync, boolean isLocal) { + super(method_pack,method_name,method_line,method_column,b,p,a); + cs = new CallSite(callsite_pack,callsite_name, callsite_line,callsite_column); + this.isAsync = isAsync; + this.isLocal = isLocal; + } + + public String genSignature(){ + return scope+"."+line+"."+column+"@"+cs.toString(); + } + public boolean equals(Object o) { + boolean result = false; + if (o instanceof CallTableMethodVal){ + result = genSignature().equals(((CallTableMethodVal) o).genSignature()); + } + return result; + } + public int hashCode(){ + return genSignature().hashCode(); + } + public String toString(){ + String tmp=""; + if(isLast){ + tmp = "-last"; + } + return a.toString()+"-"+scope+"."+name+"."+line+"."+column+"-"+cs.toString()+tmp; + } +} + +class CallSite implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + public final int line; + public final int column; + public final String srcpack; + public final String srcname; + public CallSite(String s, String n, int l, int c){ + srcpack = s; + srcname = n; + line = l; + column = c; + } + public String toString(){ + return srcpack+"."+srcname+"."+line+"."+column; + } +} \ No newline at end of file Added: trunk/x10.compiler/src/x10/finish/table/CallTableScopeKey.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableScopeKey.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableScopeKey.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,56 @@ +package x10.finish.table; +/** + * + * class represents a finish block in x10 + */ +public class CallTableScopeKey extends CallTableKey { + + private static final long serialVersionUID = 1L; + /** + * true if this object represents a "finish" contruct in the program + * otherwise it represents an "at" + */ + public boolean is_finish; + + /** + * to calculate the arity of a method call from this block + */ + public int blk; + + public CallTableScopeKey(String s,String n, int line, int column, + int b, boolean f) { + // finish = f; + super(s,n,line,column); + blk = b; + is_finish = f; + } + + /** + * although "tmp" is not necessary to included as part of a signature + */ + public String genSignature(){ + String tmp; + if(is_finish == true){ + tmp = ".finish."; + } + else{ + tmp = ".at."; + } + return (scope + tmp + line + "." + column); + } + + public String toString() { + return genSignature()+"."+pattern; + } + + public boolean equals(Object o) { + if (o instanceof CallTableScopeKey) { + return this.genSignature().equals(((CallTableScopeKey) o).genSignature()); + } + return false; + } + + public int hashCode() { + return this.genSignature().hashCode(); + } +} Added: trunk/x10.compiler/src/x10/finish/table/CallTableUtil.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableUtil.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableUtil.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,373 @@ +package x10.finish.table; + +import java.io.FileInputStream; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.HashMap; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Set; + +public class CallTableUtil { + public static HashMap<CallTableKey, LinkedList<CallTableVal>> findPatterns(HashMap<CallTableKey, LinkedList<CallTableVal>> ct){ + HashMap<CallTableKey, LinkedList<CallTableVal>> newTable = new HashMap<CallTableKey, LinkedList<CallTableVal>>(); + HashMap<CallTableKey,Integer> results = new HashMap<CallTableKey,Integer>(); + + Iterator<CallTableKey> ikey = ct.keySet().iterator(); + while (ikey.hasNext()) { + CallTableKey key = ikey.next(); + LinkedList<CallTableVal> vals = ct.get(key); + if(key instanceof CallTableScopeKey){ + int pattern = getPattern(key,ct,results); + + ((CallTableScopeKey) key).pattern = pattern; + } + newTable.put(key, vals); + } + return newTable; + } + /** + * we have three patterns: + * a general pattern - code == 0 + * all local async - code == 1 + * no nested remote async - code == 2 + * @param key + * @param ct + * @param results + * @return + */ + private static int getPattern(CallTableKey key, + HashMap<CallTableKey, LinkedList<CallTableVal>> ct, + HashMap<CallTableKey, Integer> results) { + int pattern = 1; + if (results.containsKey(key)) { + pattern = results.get(key).intValue(); + return pattern; + } + results.put(key, new Integer(pattern)); + LinkedList<CallTableVal> vals = ct.get(key); + if(vals ==null){ + return 1; + } + for (int i = 0; i < vals.size(); i++) { + CallTableVal v = vals.get(i); + if (v instanceof CallTableMethodVal) { + int tmpPattern = getPattern(getKey(v), ct, results); + // when at least one nested async is "general" the outer async/method is general + if (tmpPattern == 0) { + results.put(key, new Integer(0)); + return 0; + } + // when both the nested async and the outer one are local, the outer method/async has pattern 1 by now + if (tmpPattern == 1 && ((CallTableMethodVal) v).isLocal) { + pattern = setPattern(pattern,1); + } + // when the nested async is "local" but the outer one is not, the outer method/async has pattern 4 by now + if (tmpPattern == 1 && !((CallTableMethodVal) v).isLocal) { + pattern = setPattern(pattern,2); + } + // when the nested async does not have nested remote asyncs, and the outer is local, the outer method/async has pattern 1 by now + if (tmpPattern == 2 && ((CallTableMethodVal) v).isLocal) { + pattern = setPattern(pattern,2); + } + // otherwise, it is a general one + if (tmpPattern == 2 && !((CallTableMethodVal) v).isLocal) { + results.put(key, new Integer(0)); + return 0; + } + } + // TODO: + if (v instanceof CallTableAtVal) { + + } + + } + if(pattern!=1){ + results.remove(key); + results.put(key, new Integer(pattern)); + } + return pattern; + } + private static int setPattern(int p, int v){ + switch(p){ + case 0: return 0; + case 1: return v; + case 2: return v==0?v:p; + default: return 0; + } + } + public static void getStat( + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable) { + System.out.println("#number of callees:" + getCalleeNum(calltable)); + } + + /* + * For test purpose, to dump all contents in the call table in a readable + * format + */ + public static void dumpCallTable(HashMap<CallTableKey, LinkedList<CallTableVal>> ct) { + System.out.println("table:"); + Iterator<CallTableKey> ikey = ct.keySet().iterator(); + while (ikey.hasNext()) { + CallTableKey key = ikey.next(); + LinkedList<CallTableVal> vals = ct.get(key); + System.out.println(key.toString() + ": "); + for (int i = 0; i < vals.size(); i++) { + CallTableVal v = vals.get(i); + System.out.println("\t" + v.toString()); + } + System.out.print("\n"); + } + } + + /** + * + * @param k + * @param calltable + */ + private static void updateArity(CallTableKey k, + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable) { + + LinkedList<CallTableVal> callees = calltable.get(k); + // updated one + LinkedList<CallTableVal> new_callees = new LinkedList<CallTableVal>(); + boolean rec_call = false; + String key_sig = k.genSignature(); + + // check whether a method is recursive by looking for the + // method in its callee list with the same signature + for (int i = 0; i < callees.size(); i++) { + CallTableVal v = callees.get(i); + // CallTableAtVal just skipped because it never causes a recursion + if (v instanceof CallTableMethodVal) { + if (!((CallTableMethodVal) v).isAsync) { + //TODO: test + String val_sig = ((CallTableMethodVal) v).genSignature(); + int at_pos = val_sig.indexOf('@'); + val_sig = val_sig.substring(0, at_pos); + if (val_sig.equals(key_sig)) { + rec_call = true; + } + } + + } + } + + if (rec_call) { + // update all callees' arity as "unbounded" + for (int i = 0; i < callees.size(); i++) { + CallTableVal v = callees.get(i); + v.setArity(CallTableVal.Arity.Unbounded); + new_callees.add(v); + } + // replace the old callees list with the new one + calltable.remove(k); + calltable.put(k, new_callees); + } + } + + /** + * after the calltable is expanded, we might find recursive calls. + * In this case, all methods called in the recursive call should be + * marked as "unbounded". + * @param calltable + */ + @SuppressWarnings("unchecked") + public static void updateAllArity( + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable) { + HashMap<CallTableKey, LinkedList<CallTableVal>> new_table = + (HashMap<CallTableKey, LinkedList<CallTableVal>>) OutputUtil.copy(calltable); + Iterator<CallTableKey> it = new_table.keySet().iterator(); + while (it.hasNext()) { + CallTableKey v = it.next(); + if (v instanceof CallTableMethodKey + && !(v.name.contains("activity"))) { + updateArity(v, calltable); + } + + } + } + + /** + * the "calltable" records each method's history of method invocation. + * Because method invocation is not expanded in the control flow graph we + * use and a program might have recursive calls, we need to "saturate" this + * table to get a complete list of method invocation. + */ + @SuppressWarnings("unchecked") + public static HashMap<CallTableKey, LinkedList<CallTableVal>> expandCallTable( + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable, + boolean[] mask) { + + boolean changed = true; + Set<CallTableKey> keyset; + Iterator<CallTableKey> keyit; + HashMap<CallTableKey, LinkedList<CallTableVal>> new_table; + + if (mask.length != 3) { + System.err.println("mask is invalid!"); + return calltable; + } + + while (changed) { + // System.err.println("........."); + // this.dumpCallTable(); + keyset = calltable.keySet(); + keyit = keyset.iterator(); + new_table = new HashMap<CallTableKey, LinkedList<CallTableVal>>(); + changed = false; + // expand each row of the table + while (keyit.hasNext()) { + CallTableKey key = keyit.next(); + LinkedList<CallTableVal> vals = calltable.get(key); + LinkedList<CallTableVal> new_vals = (LinkedList<CallTableVal>) OutputUtil.copy(vals); + // check each object in vals + for (int i = 0; i < vals.size(); i++) { + CallTableVal callee = vals.get(i); + CallTableVal.Arity tmparity = callee.getArity(); + Iterator<CallTableVal> tmpiter = null; + /* + * when the "at" or "method" this callee represents is also + * a "key" in this table, get this CallTableKey object + */ + CallTableKey tmpkey = getKey(callee); + LinkedList<CallTableVal> tmplist = calltable.get(tmpkey); + // TODO: not tested + boolean expand = expandOrNot(callee, mask); + if (tmplist != null && expand) { + tmpiter = tmplist.iterator(); + /* + * add each CallTableVal in this newly obtained + * CallTableKey to the original key's list + */ + while (tmpiter.hasNext()) { + CallTableVal tmpcallee = tmpiter.next(); + /* + * we need a copy of tmpcallee here, because when we + * add this callee to a new caller's list, and if we + * change this callee's arity, we don't want the + * original callee which is in another caller's list + * is changed too + */ + CallTableVal copiedcallee = (CallTableVal) OutputUtil.copy(tmpcallee); + if (!new_vals.contains(copiedcallee)) { + copiedcallee.setArity(tmparity); + copiedcallee.blk = callee.blk; + new_vals.add(copiedcallee); + changed = true; + } else { + int index = new_vals.indexOf(copiedcallee); + /* + * tv has the same signature, but possibly + * different arities as tmpcallee + */ + CallTableVal tv = new_vals.get(index); + if (tmpcallee.a.compareTo(tv.a) > 0) { + tv.setArity(tmpcallee.a); + new_vals.remove(index); + new_vals.add(tv); + changed = true; + } + } + } + } + }// end of for vals + new_table.put(key, new_vals); + } + calltable = new_table; + // System.out.println(">>>>>>>>>>>>>>>>>>>>"); + // dumpCallTable(); + }// end of while(!terminate) + + return calltable; + } + + /** + * output calltable to a file + * @param filename + * @param calltable + */ + public static void saveCallTable(String filename, + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable) { + FileOutputStream fos = null; + ObjectOutputStream out = null; + try { + fos = new FileOutputStream(filename); + out = new ObjectOutputStream(fos); + out.writeObject(calltable); + out.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + /** + * input the calltable from a file + * @param filename + * @return + */ + public static HashMap<CallTableKey, LinkedList<CallTableVal>> loadCallTable( + String filename) { + FileInputStream fis = null; + ObjectInputStream in = null; + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable = null; + try { + fis = new FileInputStream(filename); + in = new ObjectInputStream(fis); + calltable = (HashMap<CallTableKey, LinkedList<CallTableVal>>) in.readObject(); + } catch (IOException ex) { + ex.printStackTrace(); + } catch (ClassNotFoundException ex) { + ex.printStackTrace(); + } + return calltable; + } + + private static boolean expandOrNot(CallTableVal callee, boolean[] mask) { + if (callee instanceof CallTableAtVal && mask[0] == true) { + return true; + } + if (callee instanceof CallTableMethodVal) { + CallTableMethodVal mycallee = (CallTableMethodVal) callee; + if (mycallee.isAsync == true && mask[1] == true) { + return true; + } + if (mycallee.isAsync == false && mask[2] == true) { + return true; + } + } + + return false; + } + + private static CallTableKey getKey(CallTableVal callee) { + CallTableKey tmpkey; + if (callee instanceof CallTableAtVal) { + boolean isFinish = false; + tmpkey = new CallTableScopeKey(callee.scope, callee.name, + ((CallTableAtVal) callee).line, + ((CallTableAtVal) callee).column, + ((CallTableAtVal) callee).blk, isFinish); + } else { + tmpkey = new CallTableMethodKey(callee.scope, callee.name, + callee.line, callee.column); + } + return tmpkey; + } + private static int getCalleeNum( + HashMap<CallTableKey, LinkedList<CallTableVal>> calltable) { + int cnt = 0; + Set<CallTableKey> kset = calltable.keySet(); + Iterator<CallTableKey> kit = kset.iterator(); + while (kit.hasNext()) { + CallTableKey k = kit.next(); + LinkedList<CallTableVal> v = calltable.get(k); + cnt = cnt + v.size(); + } + return cnt; + } +} Added: trunk/x10.compiler/src/x10/finish/table/CallTableVal.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/CallTableVal.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/CallTableVal.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,86 @@ +package x10.finish.table; +import java.io.Serializable; + + + +public abstract class CallTableVal implements Serializable { + /** + * automatically added for serialization + */ + private static final long serialVersionUID = 1L; + + /** + * An object of CallTableVal represents an instance of method invocation in an x10 program, and + * the arity of an invocation means whether this invocation is in any loops or if-else + * One: this invocation can be and only be called once, thus not in any loop or if-else + * ZeOrOne: this invocation is within in at least one if-else branch, but not in any loops + * Unbounded: this invocation is within in at least one loop, possibly in a if-else + * @author blshao + * + */ + public enum Arity {One, ZerOrOne, Unbounded} + public final String scope; + public final String name; + public final int line; + public final int column; + public Arity a; + public int blk; + public final CallTableKey parent; + public boolean isLast = false; + //default pattern + public int pattern=0; + public Arity getArity(){ + return a; + } + + public CallTableVal(String s, String n, int l, int c, int b, CallTableKey p){ + scope = s; + name = n; + line = l; + column = c; + blk = b; + parent = p; + a = Arity.One; + } + public CallTableVal(String s,String n, int l, int c, int b, CallTableKey p,Arity a){ + scope = s; + name = n; + line = l; + column = c; + blk = b; + parent = p; + this.a = a; + } + /* + * when set a new arity to this object, it must check its + * current arity. For example, if current invocation is within + * an loop and you want to set it to ZerOrOne, because you find + * this invocation is also in a branch. The final arity will still be + * unbounded. + */ + public void setArity(Arity tmparity){ + /* One -> lowest priority + * Unbounded -> highest priority + */ + switch(a){ + case One: + a = tmparity; + break; + case ZerOrOne: + switch(tmparity){ + case One: + break; + case ZerOrOne: + break; + case Unbounded: + a = tmparity; + } + break; + case Unbounded: + break; + } + } + public abstract int hashCode(); + public abstract String toString(); + public abstract boolean equals(Object o); +} Added: trunk/x10.compiler/src/x10/finish/table/HprofParser.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/HprofParser.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/HprofParser.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,336 @@ +package x10.finish.table; + +import java.io.BufferedReader; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.StringTokenizer; +import java.util.Vector; + + +public class HprofParser { + class ExprStat { + public double percentage = 0.0; + public long liveBytes = 0; + public long allocatedBytes = 0; + public long allocatedObj = 0; + public String name; + public int debug = 0; + + public ExprStat(double p, long l, long b, long o, String n) { + // System.out.println("original name:"+n); + name = abstractName(n); + // System.out.println("processed name:"+name); + percentage = p; + liveBytes = l; + allocatedBytes = b; + allocatedObj = o; + } + + public void add(ExprStat r) { + assert (r.name == this.name); + percentage += r.percentage; + liveBytes += r.liveBytes; + allocatedBytes += r.allocatedBytes; + allocatedObj += r.allocatedObj; + debug++; + } + + public int hashCode() { + return name.hashCode(); + } + + public boolean equals(Object o) { + boolean result = false; + if (o instanceof ExprStat) { + return name.equals(((ExprStat) o).name); + } + return result; + } + + public String toString() { + return name + ":(" + percentage + "%," + liveBytes / 1000 + "KB," + + allocatedBytes / 1000 + "KB," + allocatedObj + ")---" + + debug; + } + + private String abstractName(String s) { + int i; + for (i = s.length() - 1; i >= 0; i--) { + int c = s.charAt(i); + boolean f1 = (c == '$'); + boolean f2 = Character.isDigit(c); + if (!(f1 || f2)) { + break; + } + } + String tmp = s.substring(0, i + 1); + return tmp; + } + } + + public final ReverseFileReader file; + private Vector<ExprStat> results; + private long root = 0; + private long remote = 0; + private long all = 0; + + public HprofParser(String name) throws Exception { + file = new ReverseFileReader(name); + results = new Vector<ExprStat>(); + } + + public long getRootStat() { + if (root == 0) + add(); + return root / 1000; + } + + public long getRemoteStat() { + if (remote == 0) + add(); + return remote / 1000; + } + + public long getAllStat() { + if (all == 0) + add(); + return all / 1000; + } + + private void add() { + if (all == 0 && root == 0 && remote == 0) { + for (int i = 0; i < results.size(); i++) { + ExprStat tmp = results.get(i); + if (tmp.name.contains("Root")) { + root += tmp.allocatedBytes; + all += tmp.allocatedBytes; + // System.err.println("find root"); + } else if (tmp.name.contains("Remote")) { + remote += tmp.allocatedBytes; + all += tmp.allocatedBytes; + // System.err.println("find remote"); + } else if (tmp.name.contains("FinishStates")) { + all += tmp.allocatedBytes; + } + } + } + } + + public void parse() throws Exception { + + String record = null; + // the last two lines are not statistics, skip them + record = file.readLine(); + //System.err.println(record); + record = file.readLine(); + //System.err.println(record); + while ((record = file.readLine()) != null) { + //System.err.println(record); + if (record.contains("rank")) { + break; + } + // TODO: test it + + ExprStat r = parseRecord(record); + //System.out.println("record: "+r.toString()); + //Thread.sleep(200); + int pos = results.indexOf(r); + if (pos == -1) { + // not found + //System.out.println("record: "+r.toString()+" first added"); + results.add(r); + } else { + ExprStat pre = results.get(pos); + //System.out.println("record found: "+pre.toString()); + //System.out.println("record added: "+r.toString()); + pre.add(r); + + //System.out.println("record updated: "+pre.toString()); + results.remove(pos); + results.add(pre); + } + } + + } + + private ExprStat parseRecord(String rec) { + double perc = 0; + long live = 0; + long allocated = 0; + long obj = 0; + String name = ""; + int cnt = 0; + StringTokenizer st = new StringTokenizer(rec); + while (st.hasMoreTokens()) { + String tmp = st.nextToken(); + switch (cnt) { + case 1: + int lastPos = tmp.indexOf('%'); + perc = Double.parseDouble(tmp.substring(0, lastPos)); + // System.out.println(perc); + break; + case 3: + live = Integer.parseInt(tmp); + // System.out.println(live); + break; + case 5: + allocated = Integer.parseInt(tmp); + // System.out.println(allocated); + break; + case 6: + obj = Integer.parseInt(tmp); + // System.out.println(obj); + break; + case 8: + name = tmp; + // System.out.println(name); + break; + default: + // System.err.println(tmp); + } + cnt++; + } + + return new ExprStat(perc, live, allocated, obj, name); + } + + class PercentageComparer implements Comparator { + public int compare(Object obj1, Object obj2) { + double i1 = ((ExprStat) obj1).percentage; + double i2 = ((ExprStat) obj2).percentage; + return (int) (i1 - i2); + } + } + + class LiveBytesComparer implements Comparator { + public int compare(Object obj1, Object obj2) { + long i1 = ((ExprStat) obj1).liveBytes; + long i2 = ((ExprStat) obj2).liveBytes; + return (int) (i1 - i2); + } + } + + class AllocatedBytesComparer implements Comparator { + public int compare(Object obj1, Object obj2) { + long i1 = ((ExprStat) obj1).allocatedBytes; + long i2 = ((ExprStat) obj2).allocatedBytes; + return (int) (i1 - i2); + } + } + + class AllocatedObjsComparer implements Comparator { + public int compare(Object obj1, Object obj2) { + long i1 = ((ExprStat) obj1).allocatedObj; + long i2 = ((ExprStat) obj2).allocatedObj; + return (int) (i1 - i2); + } + } + + public void dump(int sel) { + Comparator c; + switch (sel) { + case 1: + c = new PercentageComparer(); + break; + case 2: + c = new LiveBytesComparer(); + break; + case 3: + c = new AllocatedBytesComparer(); + break; + case 4: + c = new AllocatedObjsComparer(); + break; + default: + c = new AllocatedBytesComparer(); + } + Collections.sort(results, c); + for (int i = results.size() - 1; i >= 0; i--) { + ExprStat es = results.get(i); + if (es.toString().contains("Finish")) + System.out.println(es); + } + + } + +} + +class ReverseFileReader { + private String filename; + private RandomAccessFile randomfile; + private long position; + + public ReverseFileReader(String filename) throws Exception { + // Open up a random access file + this.randomfile = new RandomAccessFile(filename, "r"); + // Set our seek position to the end of the file + this.position = this.randomfile.length(); + + // Seek to the end of the file + this.randomfile.seek(this.position); + // Move our pointer to the first valid position at the end of the file. + String thisLine = this.randomfile.readLine(); + while (thisLine == null) { + this.position--; + this.randomfile.seek(this.position); + thisLine = this.randomfile.readLine(); + this.randomfile.seek(this.position); + } + } + + // Read one line from the current position towards the beginning + public String readLine() throws Exception { + int thisCode; + char thisChar; + String finalLine = ""; + + // If our position is less than zero already, we are at the beginning + // with nothing to return. + if (this.position < 0) { + return null; + } + + for (;;) { + // we've reached the beginning of the file + if (this.position < 0) { + break; + } + // Seek to the current position + this.randomfile.seek(this.position); + + // Read the data at this position + thisCode = this.randomfile.readByte(); + thisChar = (char) thisCode; + + // If this is a line break or carrige return, stop looking + if (thisCode == 13 || thisCode == 10) { + // See if the previous character is also a line break character. + // this accounts for crlf combinations + this.randomfile.seek(this.position - 1); + int nextCode = this.randomfile.readByte(); + if ((thisCode == 10 && nextCode == 13) + || (thisCode == 13 && nextCode == 10)) { + // If we found another linebreak character, ignore it + this.position = this.position - 1; + } + // Move the pointer for the next readline + this.position--; + break; + } + // This is a valid character append to the string + finalLine = thisChar + finalLine; + // Move to the next char + this.position--; + } + // return the line + return finalLine; + } +} Added: trunk/x10.compiler/src/x10/finish/table/OutputUtil.java =================================================================== --- trunk/x10.compiler/src/x10/finish/table/OutputUtil.java (rev 0) +++ trunk/x10.compiler/src/x10/finish/table/OutputUtil.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,116 @@ +package x10.finish.table; + +import java.io.ByteArrayInputStream; + + + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.ArrayList; + + + +/** + * This class is from the internet to deep-copy a serializable object + */ +public class OutputUtil { + /** + * Returns a copy of the object, or null if the object cannot be serialized. + */ + public static int PLACE_NUMBER=16; + public static Object copy(Object orig) { + Object obj = null; + try { + // Write the object out to a byte array + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bos); + out.writeObject(orig); + out.flush(); + out.close(); + + // Make an input stream from the byte array and read + // a copy of the object back in. + ObjectInputStream in = new ObjectInputStream( + new ByteArrayInputStream(bos.toByteArray())); + obj = in.readObject(); + } catch (IOException e) { + e.printStackTrace(); + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + return obj; + } + + + + private static class PlotRecord{ + long root; + long remote; + long all; + public PlotRecord(long ro, long re, long a){ + root = ro; + remote = re; + all = a; + } + } + public static void Write2Plot(String dir) throws Exception { + String path = "../x10.tests/examples/ScalableFinish/Patterns/expr2/"; + PlotRecord[] newStat = new PlotRecord[16]; + PlotRecord[] oldStat = new PlotRecord[16]; + for(int i=0;i<PLACE_NUMBER;i++){ + int index = i+1; + String file_name = path + dir + "/" + dir + "_"+index+".java.hprof.txt"; + HprofParser p = new HprofParser(file_name); + p.parse(); + long root = p.getRootStat(); + long remote = p.getRemoteStat(); + long all = p.getAllStat(); + PlotRecord pr = new PlotRecord(root,remote,all); + newStat[i] = pr; + } + for(int i=0;i<PLACE_NUMBER;i++){ + int index = i + 1; + String file_name = path + dir + "/" + dir + "_old_"+index+".java.hprof.txt"; + HprofParser p = new HprofParser(file_name); + p.parse(); + long root = p.getRootStat(); + long remote = p.getRemoteStat(); + long all = p.getAllStat(); + PlotRecord pr = new PlotRecord(root,remote,all); + oldStat[i] = pr; + } + String outPath = path + dir; + BufferedWriter rootData = + new BufferedWriter(new FileWriter(outPath+"/root.dat")); + BufferedWriter remoteData = + new BufferedWriter(new FileWriter(outPath+"/remote.dat")); + BufferedWriter allData = + new BufferedWriter(new FileWriter(outPath+"/all.dat")); + for(int i=0;i<PLACE_NUMBER;i++){ + int index = i+1; + PlotRecord newRec = newStat[i]; + PlotRecord oldRec = oldStat[i]; + String rootOut = index + "\t" + oldRec.root + "\t" + newRec.root + "\n"; + String remoteOut = index + "\t" + oldRec.remote + "\t" + newRec.remote + "\n"; + String allOut = index + "\t" + oldRec.all + "\t" + newRec.all + "\n"; + rootData.write(rootOut); + remoteData.write(remoteOut); + allData.write(allOut); + } + System.out.println(dir+" finished"); + rootData.close(); + remoteData.close(); + allData.close(); + + } +} \ No newline at end of file Added: trunk/x10.compiler/src/x10/visit/FinishAnnotationVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/FinishAnnotationVisitor.java (rev 0) +++ trunk/x10.compiler/src/x10/visit/FinishAnnotationVisitor.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,89 @@ +package x10.visit; + +import java.util.ArrayList; + +import java.util.List; + +import polyglot.ast.Expr; +import polyglot.ast.Ext; +import polyglot.ast.Node; +import polyglot.ast.NodeFactory; +import polyglot.ast.Stmt; +import polyglot.frontend.Job; +import polyglot.types.ClassType; +import polyglot.types.NoClassException; +import polyglot.types.QName; +import polyglot.types.SemanticException; +import polyglot.types.Type; +import polyglot.types.TypeSystem; +import polyglot.util.InternalCompilerError; +import polyglot.util.Position; +import polyglot.visit.ContextVisitor; +import polyglot.visit.NodeVisitor; +import x10.ast.AnnotationNode; +import x10.ast.Async; +import x10.ast.Async_c; +import x10.ast.AtStmt; +import x10.ast.ClosureCall; +import x10.ast.Finish; +import x10.ast.X10Call; +import x10.ast.X10NodeFactory; +import x10.emitter.Emitter; +import x10.extension.X10Ext; +import x10.finish.table.CallTableUtil; +import x10.types.X10ParsedClassType_c; +import x10.types.X10TypeSystem; + + +//TODO: figure out how to check if an async is in the same place as the enclosing finish +// or async or at if any. + +public class FinishAnnotationVisitor extends ContextVisitor { + final String theLanguage; + final X10TypeSystem xts; + final X10NodeFactory xnf; + public FinishAnnotationVisitor(Job job, TypeSystem ts, NodeFactory nf, + String theLanguage) { + super(job, job.extensionInfo().typeSystem(), job.extensionInfo() + .nodeFactory()); + xts = (X10TypeSystem) ts; + xnf = (X10NodeFactory) nf; + this.theLanguage = theLanguage; + } + + public Node leaveCall(Node old, Node n, NodeVisitor v) + throws SemanticException { + + if (n instanceof AnnotationNode) { + //return visitAnnotation((AnnotationNode) n); + } + if (n instanceof Finish){ + return visitFinishAnnotation((Finish)n); + } + if(n instanceof Async){ + //System.out.println(((Async_c)n).placeTerm.constraint().getClass()); + } + return n; + + } + private Node visitFinishAnnotation(Finish n){ + Position pos = n.position(); + try { + Type annotation = (Type) xts.systemResolver().find(QName.make("x10.compiler.FinishAsync")); + if (!((X10Ext) n.ext()).annotationMatching(annotation).isEmpty()) { + List<AnnotationNode> allannots = ((X10Ext)(n.ext())).annotations(); + for(int i=0;i<allannots.size();i++){ + AnnotationNode a = allannots.get(i); + System.out.println(a); + } + } + } catch (SemanticException e) { + /* Ignore exception when looking for annotation */ + } + return n; + } + private Node visitAnnotation(AnnotationNode n) { + System.out.println("Annotation:" + n.toString()); + return n; + } +} \ No newline at end of file Added: trunk/x10.compiler/src/x10/visit/FinishAsyncVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/FinishAsyncVisitor.java (rev 0) +++ trunk/x10.compiler/src/x10/visit/FinishAsyncVisitor.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,277 @@ +package x10.visit; + +import java.util.HashMap; + +import java.util.List; +import java.util.Stack; + +import java.util.Iterator; + +import java.util.LinkedList; + +import polyglot.ast.AmbTypeNode; +import polyglot.ast.BooleanLit; +import polyglot.ast.CanonicalTypeNode; +import polyglot.ast.Expr; +import polyglot.ast.Formal; +import polyglot.ast.IntLit; +import polyglot.ast.Node; +import polyglot.ast.NodeFactory; +import polyglot.ast.NodeList_c; +import polyglot.ast.PackageNode; +import polyglot.ast.SourceFile_c; +import polyglot.ast.Stmt; +import polyglot.ast.StringLit; +import polyglot.ast.IntLit.Kind; +import polyglot.frontend.Job; +import polyglot.types.QName; +import polyglot.types.Ref; +import polyglot.types.Ref_c; +import polyglot.types.SemanticException; +import polyglot.types.Type; +import polyglot.types.TypeSystem; +import polyglot.util.Position; +import polyglot.visit.ContextVisitor; +import polyglot.visit.NodeVisitor; +import x10.ast.*; +import x10.extension.X10Ext; +import x10.extension.X10Ext_c; +import x10.finish.table.*; +import x10.types.X10ClassDef; +import x10.types.X10ParsedClassType_c; +import x10.types.X10TypeSystem; + +public class FinishAsyncVisitor extends ContextVisitor { + private static HashMap<CallTableKey, Integer> finishTable = null; + private static HashMap<CallTableKey, LinkedList<CallTableVal>> callTable = null; + private String src_package = null; + private String src_path = null; + private String src_method = null; + final String theLanguage; + final X10TypeSystem xts; + final X10NodeFactory xnf; + + public FinishAsyncVisitor(Job job, TypeSystem ts, NodeFactory nf, + String theLanguage, + HashMap<CallTableKey, LinkedList<CallTableVal>> ct) { + super(job, job.extensionInfo().typeSystem(), job.extensionInfo() + .nodeFactory()); + xts = (X10TypeSystem) ts; + xnf = (X10NodeFactory) nf; + this.theLanguage = theLanguage; + if(finishTable == null && callTable == null){ + callTable = ct; + finishTable = new HashMap<CallTableKey, Integer>(); + Iterator<CallTableKey> it = ct.keySet().iterator(); + while(it.hasNext()){ + CallTableKey k = it.next(); + if(k instanceof CallTableScopeKey){ + finishTable.put(k, new Integer(((CallTableScopeKey) k).pattern)); + } + } + } + } + + public NodeVisitor enterCall(Node n) { + if (n instanceof SourceFile_c) { + visitSourceFile((SourceFile_c) n); + } + if (n instanceof X10MethodDecl_c) { + // visitMethodDecl((X10MethodDecl_c)n); + } + if (n instanceof Async) { + // visitEnterAsync((Async) n); + } + if (n instanceof Finish) { + // visitEnterFinish((Finish)n); + } + if (n instanceof AtStmt) { + // visitEnterAt((AtStmt)n); + } + return this; + + } + + public Node leaveCall(Node old, Node n, NodeVisitor v) + throws SemanticException { + + if (n instanceof Finish) { + return visitExitFinish((Finish) n); + } + if (n instanceof AtStmt) { + // return visitExitAt((AtStmt) n); + } + if (n instanceof ClosureCall) { + // return visitClosure((ClosureCall) n); + } + if (n instanceof X10Call) { + // return visitCall((X10Call) n); + } + + return n; + } + + private void visitSourceFile(SourceFile_c n) { + PackageNode pn = n.package_(); + String file = n.toString(); + // file = "<<<< name.x10 >>>>" + int s = file.indexOf(" "); + int e = file.indexOf(".x10"); + String name = file.substring(s + 1, e); + if(pn == null){ + src_package = name; + }else{ + src_package = pn.toString() + "." + name; + } + src_path = n.source().path(); + src_path = src_path.substring(1, src_path.length() - 4); + src_path = src_path.replace('/', '.'); + } + + private void visitMethodDecl(X10MethodDecl_c n) { + int line = n.position().line(); + int column = n.position().endColumn(); + String methodName = n.name().toString(); + src_method = methodName; + CallTableMethodKey mk = new CallTableMethodKey(src_package, methodName, + line, column); + boolean f = callTable.keySet().contains(mk); + if (f) { + System.out.println("find method " + n.toString()); + + } else { + System.out.println("miss method " + n.toString()); + System.out.println("\tgenerated key:" + mk.toString()); + } + } + + private Node visitExitAt(AtStmt n) { + int line = n.position().line(); + int column = n.position().column(); + CallTableScopeKey at; + at = new CallTableScopeKey(src_package, src_method, line, column, -1, + false); + // FIXME: if "at" is in a normal method, wala gives the package + // this method belongs to as an "id"; However, if "at" is in an + // async, which is treated as a wala-generated method, the "id" + // becomes the full path of the file this async is in. So, here + // we have to try both possibilities. Need to resolve this pecularity. + + boolean f = callTable.keySet().contains(at); + if (f) { + System.out.println("find at:" + n.toString()); + } else { + at = new CallTableScopeKey(src_path, src_method, line, column, -1, + false); + f = callTable.keySet().contains(at); + if (f) { + System.out.println("find at:" + n.toString()); + } else { + System.out.println("miss at:" + n.toString()); + System.out.println("\tgenerated key:" + at.toString()); + } + } + return n; + } + + private Node visitCall(X10Call n) { + int line = n.methodInstance().position().line(); + int column = n.methodInstance().position().endColumn(); + String methodName = n.methodInstance().name().toString(); + String pack = n.methodInstance().container().toString(); + CallTableMethodKey mk = new CallTableMethodKey(src_package, methodName, + line, column); + boolean f = callTable.keySet().contains(mk); + if (f) { + System.out.println("find method " + n.toString()); + } else { + System.out.println("miss method " + n.toString()); + System.out.println("\tgenerated key:" + mk.toString()); + } + return n; + } + + private Node visitExitFinish(Finish n) throws SemanticException { + //System.out.println("annotating "+job.source().name()); + int line = n.body().position().line(); + int column = n.body().position().column(); + CallTableScopeKey fs1 = new CallTableScopeKey(src_package, src_method,line, column, -1, true); + CallTableScopeKey fs2 = new CallTableScopeKey(src_path, src_method,line, column, -1, true); + boolean f1 = finishTable.containsKey(fs1); + boolean f2 = finishTable.containsKey(fs2); + if(f1){ + return addAnnotation2Finish(n,fs1); + } + if(f2){ + return addAnnotation2Finish(n,fs2); + } + System.out.println("finish "+fs1+" not found!"); + return n; + + } + + private Finish addAnnotation2Finish(Finish f, CallTableScopeKey fs) throws SemanticException{ + int pattern = finishTable.get(fs).intValue(); + //System.out.println("find finish:" + fs); + X10Ext_c xext = (X10Ext_c) f.ext(); + // old is unmodifiedlist + List<AnnotationNode> old = (List<AnnotationNode>) (xext.annotations()); + LinkedList<AnnotationNode> newannote = new LinkedList<AnnotationNode>(); + // retains all existing annotations + newannote.addAll(old); + // annotations added by compiler always have lower priority than those by programmers + newannote.addLast(makeFinishAnnotation(f,fs.line,fs.column,false,pattern)); + return (Finish) ((X10Ext) f.ext()).annotations(newannote); + } + + + private void visitEnterAsync(Async n) { + int line = n.position().line(); + int column = n.position().column(); + CallTableMethodKey m = new CallTableMethodKey(src_path, "activity", + line, column); + boolean f = callTable.keySet().contains(m); + if (f) { + System.out.println("find async:" + n.toString()); + } else { + System.out.println("miss async:" + n.toString()); + System.out.println("\tgenerated key:" + m.toString()); + } + + } + + private Node visitClosure(ClosureCall n) { + return n; + } + + private AnnotationNode makeFinishAnnotation(Finish n, int arity, int place, + boolean islast, int pattern) throws SemanticException { + // find the type of this annotation + Type t = (Type) xts.systemResolver().find( + QName.make("x10.compiler.FinishAsync")); + // create a node (type node) for this type + CanonicalTypeNode tn = xnf.CanonicalTypeNode(n.position(), t); + // create a annotation (ast node) based on the type node + AnnotationNode an = ((X10NodeFactory_c) nf).AnnotationNode( + n.position(), tn); + // create parameters for this annotation + IntLit x10arity = nf.IntLit(n.position(), IntLit.INT, arity); + IntLit x10place = nf.IntLit(n.position(), IntLit.INT, place); + BooleanLit x10islast = nf.BooleanLit(n.position(), islast); + IntLit x10pattern = nf.IntLit(n.position(), IntLit.INT, pattern); + List<Expr> initproperties = new LinkedList<Expr>(); + initproperties.add(x10arity); + initproperties.add(x10place); + initproperties.add(x10islast); + initproperties.add(x10pattern); + // patch this annotation with parameters + Ref r = an.annotationType().typeRef(); + X10ParsedClassType_c xpct = (X10ParsedClassType_c) r.getCached(); + xpct = (X10ParsedClassType_c) xpct.propertyInitializers(initproperties); + r.update(xpct); + // return the annotation + //System.out.println("newly created annotation:" + an.toString()); + return an; + } + +} Added: trunk/x10.compiler/src/x10/visit/MainMethodFinder.java =================================================================== --- trunk/x10.compiler/src/x10/visit/MainMethodFinder.java (rev 0) +++ trunk/x10.compiler/src/x10/visit/MainMethodFinder.java 2010-09-01 22:40:21 UTC (rev 15963) @@ -0,0 +1,99 @@ +/* + * 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.visit; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import polyglot.ast.Assign; +import polyglot.ast.Call; +import polyglot.ast.CanonicalTypeNode; +import polyglot.ast.ClassBody; +import polyglot.ast.ClassMember; +import polyglot.ast.Expr; +import polyglot.ast.Formal; +import polyglot.ast.Id; +import polyglot.ast.New; +import polyglot.ast.Node... [truncated message content] |
From: <mt...@us...> - 2010-09-02 07:53:24
|
Revision: 15976 http://x10.svn.sourceforge.net/x10/?rev=15976&view=rev Author: mtake Date: 2010-09-02 07:53:18 +0000 (Thu, 02 Sep 2010) Log Message: ----------- Fix XTENLANG-1773 Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-x10/x10/lang/String.x10 Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-09-02 04:59:55 UTC (rev 15975) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-09-02 07:53:18 UTC (rev 15976) @@ -1298,6 +1298,35 @@ } public void visit(X10New_c c) { X10New_c n = c; + + X10ConstructorInstance mi = (X10ConstructorInstance) n.constructorInstance(); + + String pat = er.getJavaImplForDef(mi.x10Def()); + if (pat != null) { + List<Type> typeArguments = Collections.<Type>emptyList(); + if (mi.container().isClass() && !mi.flags().isStatic()) { + X10ClassType ct = (X10ClassType) mi.container().toClass(); + typeArguments = ct.typeArguments(); + } + List<CastExpander> args = new ArrayList<CastExpander>(); + List<Expr> arguments = n.arguments(); + for (int i = 0; i < arguments.size(); ++ i) { + Type ft = n.constructorInstance().def().formalTypes().get(i).get(); + Type at = arguments.get(i).type(); + if ((at.isBoolean() || at.isNumeric() || at.isChar()) && X10TypeMixin.baseType(ft) instanceof ParameterType) { + args.add(new CastExpander(w, er, arguments.get(i)).castTo(at, BOX_PRIMITIVES)); + } + else if ((at.isBoolean() || at.isNumeric() || at.isChar())) { + args.add(new CastExpander(w, er, arguments.get(i)).castTo(at, 0)); + } + else { + args.add(new CastExpander(w, er, arguments.get(i))); + } + } + er.emitNativeAnnotation(pat, null, mi.typeParameters(), args, typeArguments); + return; + } + if (n.qualifier() != null) { tr.print(c, n.qualifier(), w); @@ -1316,7 +1345,6 @@ w.write("("); w.begin(0); - X10ConstructorInstance mi = (X10ConstructorInstance) n.constructorInstance(); X10ClassType ct = (X10ClassType) mi.container(); List<Type> ta = ct.typeArguments(); Modified: trunk/x10.runtime/src-x10/x10/lang/String.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/String.x10 2010-09-02 04:59:55 UTC (rev 15975) +++ trunk/x10.runtime/src-x10/x10/lang/String.x10 2010-09-02 07:53:18 UTC (rev 15976) @@ -45,6 +45,7 @@ /** * Construct a String from a Rail[Char]. */ + @Native("java", "new java.lang.String((#1).getCharArray(),#2,#3)") public native def this(r:Rail[Char], offset:Int, length:Int): String; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tos...@us...> - 2010-09-08 11:02:38
|
Revision: 16120 http://x10.svn.sourceforge.net/x10/?rev=16120&view=rev Author: toshio1suganuma Date: 2010-09-08 11:02:26 +0000 (Wed, 08 Sep 2010) Log Message: ----------- Fix problem of XTENLANG-1616 Modified Paths: -------------- trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/TryCatchExpander.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-java/x10/runtime/impl/java/Thread.java trunk/x10.runtime/src-x10/x10/io/EOFException.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 trunk/x10.runtime/src-x10/x10/io/FileNotFoundException.x10 trunk/x10.runtime/src-x10/x10/io/FileReader.x10 trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 trunk/x10.runtime/src-x10/x10/io/IOException.x10 trunk/x10.runtime/src-x10/x10/io/InputStreamReader.x10 trunk/x10.runtime/src-x10/x10/io/OutputStreamWriter.x10 trunk/x10.runtime/src-x10/x10/io/Writer.x10 trunk/x10.runtime/src-x10/x10/lang/ArithmeticException.x10 trunk/x10.runtime/src-x10/x10/lang/ArrayIndexOutOfBoundsException.x10 trunk/x10.runtime/src-x10/x10/lang/Byte.x10 trunk/x10.runtime/src-x10/x10/lang/ClassCastException.x10 trunk/x10.runtime/src-x10/x10/lang/Error.x10 trunk/x10.runtime/src-x10/x10/lang/Exception.x10 trunk/x10.runtime/src-x10/x10/lang/IllegalArgumentException.x10 trunk/x10.runtime/src-x10/x10/lang/Int.x10 trunk/x10.runtime/src-x10/x10/lang/InterruptedException.x10 trunk/x10.runtime/src-x10/x10/lang/Long.x10 trunk/x10.runtime/src-x10/x10/lang/NullPointerException.x10 trunk/x10.runtime/src-x10/x10/lang/NumberFormatException.x10 trunk/x10.runtime/src-x10/x10/lang/OutOfMemoryError.x10 trunk/x10.runtime/src-x10/x10/lang/RuntimeException.x10 trunk/x10.runtime/src-x10/x10/lang/Short.x10 trunk/x10.runtime/src-x10/x10/lang/Throwable.x10 trunk/x10.runtime/src-x10/x10/lang/UnsupportedOperationException.x10 Added Paths: ----------- trunk/x10.runtime/src-java/x10/runtime/impl/java/X10Throwable.java trunk/x10.runtime/src-java/x10/runtime/impl/java/X10WrappedThrowable.java Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -879,7 +879,7 @@ w.write(mangleToJava(pt.name())); w.write("; }"); } else { - w.write(" { throw new java.lang.RuntimeException(); }"); + w.write(" { throw new x10.lang.RuntimeException(); }"); } w.newline(); } @@ -921,7 +921,7 @@ Type at = ct.typeArguments().get(i); new RuntimeTypeExpander(this, at).expand(); } else { - w.write("throw new java.lang.RuntimeException()"); + w.write("throw new x10.lang.RuntimeException()"); } w.write("; }"); Modified: trunk/x10.compiler/src/x10/emitter/TryCatchExpander.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/TryCatchExpander.java 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.compiler/src/x10/emitter/TryCatchExpander.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,6 +14,7 @@ import java.io.Writer; import java.util.ArrayList; import java.util.List; +import java.util.Set; import polyglot.ast.Block; import polyglot.ast.Catch; @@ -80,6 +81,23 @@ w.write("}"); } } + + int conversionRequired() { + String catchExClassName = (catchBlock != null) ? catchBlock.catchType().toString() : exClass; + int rc = 0; + for (String exc : x10RuntimeExceptions) + if (catchExClassName.equals(exc)) { + rc |= EXC_CONVERSION; + break; + } + for (String exc : x10Errors) + if (catchExClassName.equals(exc)) { + rc |= ERROR_CONVERSION; + break; + } + return rc; + } + } private final CodeWriter w; @@ -118,13 +136,40 @@ @Override public void expand(Translator tr) { w.write("try {"); + + int additionalTryCatchForConversion = checkConversionRequired(); + if (additionalTryCatchForConversion != NO_CONVERSION) { + // inner try-catch generation for exception type conversion + w.write("try {"); + } + if (block != null) { er.prettyPrint(block, tr); } else if (child != null) { child.expand(tr); } + if (additionalTryCatchForConversion != NO_CONVERSION) { + w.write("}"); + + w.write("catch (x10.runtime.impl.java.X10Throwable __t__) {"); + w.write("throw __t__;"); + w.write("}"); + + if ((additionalTryCatchForConversion & EXC_CONVERSION) != 0) { + w.write("catch (java.lang.RuntimeException __e__) {"); + w.write("throw x10.runtime.impl.java.X10Throwable.getCorrespondingX10Exception(__e__);"); + w.write("}"); + } + + if ((additionalTryCatchForConversion & ERROR_CONVERSION) != 0) { + w.write("catch (java.lang.Error __e__) {"); + w.write("throw x10.runtime.impl.java.X10Throwable.getCorrespondingX10Error(__e__);"); + w.write("}"); + } + } + w.write("}"); for (CatchBlock catchBlock : catches) { @@ -138,4 +183,38 @@ w.write("}"); } } + + static final String[] x10RuntimeExceptions = { +// "x10.array.UnboundedRegionException", +// "x10.io.IORuntimeException", + "x10.lang.ArithmeticException", + "x10.lang.ArrayIndexOutOfBoundsException", +// "x10.lang.BadPlaceException", + "x10.lang.ClassCastException", +// "x10.lang.ClockUseException", + "x10.lang.IllegalArgumentException", +// "x10.lang.IllegalOperationException", + "x10.util.NoSuchElementException", + "x10.lang.NullPointerException", + "x10.lang.UnsupportedOperationException", + "x10.lang.RuntimeException", + "x10.lang.Exception", + "x10.lang.Throwable" + }; + static final String[] x10Errors = { + "x10.lang.OutOfMemoryError", + "x10.lang.Error", + "x10.lang.Throwable" + }; + static final int NO_CONVERSION = 0; + static final int EXC_CONVERSION = 0x01; + static final int ERROR_CONVERSION = 0x10; + + private int checkConversionRequired() { + int rc = 0; + for (CatchBlock catchBlock : catches) { + rc |= catchBlock.conversionRequired(); + } + return rc; + } } \ No newline at end of file Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -561,7 +561,7 @@ "} catch (java.lang.Error e) {\n" + "throw e;\n" + "} catch (java.lang.Throwable t) {\n" + - "throw new x10.lang.MultipleExceptions(t);\n" + + "throw new x10.runtime.impl.java.X10WrappedThrowable(t);\n" + "}\n" + "}\n" + "public x10.rtt.RuntimeType<?> getRTT() {\n" + @@ -1026,7 +1026,7 @@ "x10.rtt.Type rtt = #2;" + "#0 dep = (#0) x10.rtt.Types.conversion(rtt,self);" + "if (self==null) return null;" + - "if (rtt != null && ! rtt.instanceof$(dep)) throw new java.lang.ClassCastException();" + + "if (rtt != null && ! rtt.instanceof$(dep)) throw new x10.lang.ClassCastException();" + "return dep;" + "}" + "}.cast(#1))"; @@ -1040,7 +1040,7 @@ "final #0 cast(final #0 self) {" + "if (self==null) return null;" + "x10.rtt.Type rtt = #2;" + - "if (rtt != null && ! rtt.instanceof$(self)) throw new java.lang.ClassCastException();" + + "if (rtt != null && ! rtt.instanceof$(self)) throw new x10.lang.ClassCastException();" + "return self;" + "}" + "}.cast((#0) #1))"; @@ -1466,14 +1466,30 @@ } TryCatchExpander expander = new TryCatchExpander(w, er, c.tryBlock(), c.finallyBlock()); final List<Catch> catchBlocks = c.catchBlocks(); - if (!catchBlocks.isEmpty()) { + + boolean isJavaCheckedExceptionCaught = false; + for (int i = 0; i < catchBlocks.size(); ++i) { + Type type = catchBlocks.get(i).catchType(); + if (type.toString().startsWith("java") && !type.isUncheckedException()) { + // found Java checked exceptions caught here!! + isJavaCheckedExceptionCaught = true; + } + } + if (isJavaCheckedExceptionCaught) { final String temp = "__$generated_wrappedex$__"; - expander.addCatchBlock("x10.runtime.impl.java.WrappedRuntimeException", temp, new Expander(er) { + expander.addCatchBlock("x10.runtime.impl.java.X10WrappedThrowable", temp, new Expander(er) { public void expand(Translator tr) { w.newline(); for (int i = 0; i < catchBlocks.size(); ++i) { Catch cb = catchBlocks.get(i); + Type type = cb.catchType(); + if (!type.toString().startsWith("java") || type.isUncheckedException()) +// if (type.isSubtype(tr.typeSystem().Error(), tr.context()) || +// type.isSubtype(tr.typeSystem().RuntimeException(), tr.context())) + // nothing to do, since X10WrappedThrowable wrap only Java checked exceptions + continue; + if (i > 0) { w.write("else "); } @@ -1502,12 +1518,12 @@ w.newline(); } }); + } - for (int i = 0; i < catchBlocks.size(); ++i) { - expander.addCatchBlock(catchBlocks.get(i)); - } + for (int i = 0; i < catchBlocks.size(); ++i) { + expander.addCatchBlock(catchBlocks.get(i)); } - + expander.expand(tr); } @@ -2039,9 +2055,9 @@ TryCatchExpander tryCatchExpander = new TryCatchExpander(w, er, n.body(), null); if (runAsync) { - tryCatchExpander.addCatchBlock("x10.runtime.impl.java.WrappedRuntimeException", "ex", new Expander(er) { + tryCatchExpander.addCatchBlock("x10.runtime.impl.java.X10WrappedThrowable", "ex", new Expander(er) { public void expand(Translator tr) { - w.write("x10.lang.Runtime.pushException(ex.getCause());"); + w.write("x10.lang.Runtime.pushException(ex);"); } }); } @@ -2059,13 +2075,13 @@ if (runAsync) { tryCatchExpander.addCatchBlock("java.lang.Throwable", "t", new Expander(er) { public void expand(Translator tr) { - w.write("x10.lang.Runtime.pushException(t);"); + w.write("x10.lang.Runtime.pushException(new x10.runtime.impl.java.X10WrappedThrowable(t));"); } }); } else { tryCatchExpander.addCatchBlock("java.lang.Throwable", "t", new Expander(er) { public void expand(Translator tr) { - w.write("throw new x10.runtime.impl.java.WrappedRuntimeException(t);"); + w.write("throw new x10.runtime.impl.java.X10WrappedThrowable(t);"); } }); } @@ -2081,13 +2097,13 @@ if (runAsync) { tryCatchExpander.addCatchBlock("java.lang.Exception", "ex", new Expander(er) { public void expand(Translator tr) { - w.write("x10.lang.Runtime.pushException(ex);"); + w.write("x10.lang.Runtime.pushException(new x10.runtime.impl.java.X10WrappedThrowable(ex));"); } }); } else { tryCatchExpander.addCatchBlock("java.lang.Exception", "ex", new Expander(er) { public void expand(Translator tr) { - w.write("throw new x10.runtime.impl.java.WrappedRuntimeException(ex);"); + w.write("throw new x10.runtime.impl.java.X10WrappedThrowable(ex);"); } }); } Modified: trunk/x10.runtime/src-java/x10/runtime/impl/java/Thread.java =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/Thread.java 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/Thread.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -96,4 +96,22 @@ public static long getTid() { return Thread.currentThread().getId(); } + + public static void sleep(long time) { + Thread.sleep(time, 0); + } + + public static void sleep(long time, int nanos) { + try { + java.lang.Thread.sleep(time, nanos); + } catch (InterruptedException e) { + X10Throwable e1 = null; + try { + e1 = (X10Throwable)Class.forName("x10.lang.InterruptedException").newInstance(); + } catch (Exception e2) { + e2.printStackTrace(); + } + throw e1; + } + } } Added: trunk/x10.runtime/src-java/x10/runtime/impl/java/X10Throwable.java =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/X10Throwable.java (rev 0) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/X10Throwable.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -0,0 +1,66 @@ +package x10.runtime.impl.java; + +public class X10Throwable extends RuntimeException { + + public X10Throwable() { + super(); + } + + public X10Throwable(String message) { + super(message); + } + + public X10Throwable(Throwable cause) { + super(cause); + } + + public X10Throwable(String message, Throwable cause) { + super(message, cause); + } + + static public X10Throwable getCorrespondingX10Exception(RuntimeException e) { + String newExcName = "x10.lang.RuntimeException"; + if (e instanceof java.lang.ArithmeticException) { + newExcName = "x10.lang.ArithmeticException"; + } else if (e instanceof java.lang.ArrayIndexOutOfBoundsException) { + newExcName = "x10.lang.ArrayIndexOutOfBoundsException"; + } else if (e instanceof java.lang.ClassCastException) { + newExcName = "x10.lang.ClassCastException"; + } else if (e instanceof java.lang.IllegalArgumentException) { + newExcName = "x10.lang.IllegalArgumentException"; + } else if (e instanceof java.util.NoSuchElementException) { + newExcName = "x10.util.NoSuchElementException"; + } else if (e instanceof java.lang.NullPointerException) { + newExcName = "x10.lang.NullPointerException"; + } else if (e instanceof java.lang.UnsupportedOperationException) { + newExcName = "x10.lang.UnsupportedOperationException"; + } else { + // no corresponding x10 exceptions defined + } + + try { + return (X10Throwable)(Class.forName(newExcName).newInstance()); + } catch (ClassNotFoundException e1) { + } catch (InstantiationException e2) { + } catch (IllegalAccessException e3) { + } + throw new Error(); + } + + static public X10Throwable getCorrespondingX10Error(Error e) { + String newExcName = "x10.lang.Error"; + if (e instanceof java.lang.OutOfMemoryError) { + newExcName = "x10.lang.OutOfMemoryError"; + } else { + // no corresponding x10 errors defined + } + + try { + return (X10Throwable)(Class.forName(newExcName).newInstance()); + } catch (ClassNotFoundException e1) { + } catch (InstantiationException e2) { + } catch (IllegalAccessException e3) { + } + throw new Error(); + } +} Added: trunk/x10.runtime/src-java/x10/runtime/impl/java/X10WrappedThrowable.java =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/X10WrappedThrowable.java (rev 0) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/X10WrappedThrowable.java 2010-09-08 11:02:26 UTC (rev 16120) @@ -0,0 +1,8 @@ +package x10.runtime.impl.java; + +public class X10WrappedThrowable extends X10Throwable { + + public X10WrappedThrowable(Throwable t) { + super(t); + } +} Modified: trunk/x10.runtime/src-x10/x10/io/EOFException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/EOFException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/EOFException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.io.EOFException", null, null) +// @NativeRep("java", "java.io.EOFException", null, null) public class EOFException extends IOException { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/io/File.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/File.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/File.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -55,8 +55,8 @@ @Native("c++", "(#0)->getAbsolutePath()") native def getAbsolutePath(): String; // here's what we must do if we make IOException non-native - //@Native("java", "new Object() { String eval(java.io.File f) { try { return f.getCanonicalPath(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); } } }.eval(#0)") - @Native("java", "#0.getCanonicalPath()") + @Native("java", "new Object() { String eval(java.io.File f) { try { return f.getCanonicalPath(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); } } }.eval(#0)") + // @Native("java", "#0.getCanonicalPath()") @Native("c++", "(#0)->getCanonicalPath()") native def getCanonicalPath(): String throws IOException; Modified: trunk/x10.runtime/src-x10/x10/io/FileNotFoundException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/FileNotFoundException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/FileNotFoundException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.io.FileNotFoundException", null, null) +// @NativeRep("java", "java.io.FileNotFoundException", null, null) public class FileNotFoundException extends IOException { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/io/FileReader.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/FileReader.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/FileReader.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -20,7 +20,8 @@ @NativeRep("java", "java.io.FileInputStream", null, null) @NativeRep("c++", "x10aux::ref<x10::io::FileReader__FileInputStream>", "x10::io::FileReader__FileInputStream", null) protected final static class FileInputStream extends InputStream { - public native def this(String); + @Native("java", "new Object() { java.io.FileInputStream eval(String s) { try { return new java.io.FileInputStream(s); } catch (java.io.FileNotFoundException e) { throw new x10.io.FileNotFoundException(e.getMessage()); } } }.eval(#1)") + public native def this(String) throws FileNotFoundException; } public def this(file: File!) throws IOException { Modified: trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,12 +18,13 @@ @NativeRep("java", "java.io.FileOutputStream", null, null) @NativeRep("c++", "x10aux::ref<x10::io::FileWriter__FileOutputStream>", "x10::io::FileWriter__FileOutputStream", null) protected final static class FileOutputStream extends OutputStream { + @Native("java", "new Object() { java.io.BufferedOutputStream eval(String s) { try { return new java.io.BufferedOutputStream(new java.io.FileOutputStream(s)); } catch (java.io.FileNotFoundException e) { throw new x10.io.FileNotFoundException(e.getMessage()); } } }.eval(#1)") public native def this(String) throws IOException; } global val file: File; - @Native("java", "new java.io.BufferedOutputStream(new java.io.FileOutputStream(#1))") + // @Native("java", "new java.io.BufferedOutputStream(new java.io.FileOutputStream(#1))") private static def make(path: String):OutputStream throws IOException { return new FileOutputStream(path); } Modified: trunk/x10.runtime/src-x10/x10/io/IOException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/IOException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/IOException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.io.IOException", null, null) +// @NativeRep("java", "java.io.IOException", null, null) public class IOException extends Exception { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/io/InputStreamReader.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/InputStreamReader.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/InputStreamReader.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -15,37 +15,43 @@ import x10.compiler.NativeRep; /** Note: package scope */ -class InputStreamReader extends Reader { +public class InputStreamReader extends Reader { global val stream: InputStream; @NativeRep("java", "java.io.InputStream", null, null) @NativeRep("c++", "x10aux::ref<x10::io::InputStreamReader__InputStream>", "x10::io::InputStreamReader__InputStream", null) protected abstract static class InputStream { - @Native("java", "#0.close()") + // @Native("java", "#0.close()") + @Native("java", "try { #0.close(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->close()") public native global def close(): Void throws IOException; - @Native("java", "#0.read()") + // @Native("java", "#0.read()") + @Native("java", "new Object() { int eval(java.io.InputStream f) { try { return f.read(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); } } }.eval(#0)") @Native("c++", "(#0)->read()") public native global def read(): Int throws IOException; - @Native("java", "#0.read((#1).getByteArray(), #2, #3)") + // @Native("java", "#0.read((#1).getByteArray(), #2, #3)") + @Native("java", "new Object() { void eval(java.io.InputStream f, byte[] b, int off, int len) { try { return f.read(b, off, len); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); } } }.eval(#0, (#1).getByteArray(), #2, #3)") @Native("c++", "(#0)->read(#1,#2,#3)") public native global def read(r:Rail[Byte], off: Int, len: Int): Void throws IOException; - @Native("java", "#0.available()") + // @Native("java", "#0.available()") + @Native("java", "new Object() { int eval(java.io.InputStream f) { try { return f.available(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); } } }.eval(#0)") @Native("c++", "(#0)->available()") public native global def available(): Int throws IOException; - @Native("java", "#0.skip(#1)") + // @Native("java", "#0.skip(#1)") + @Native("java", "try { #0.skip(#1); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->skip(#1)") public native global def skip(Int): Void throws IOException; @Native("java", "#0.mark(#1)") @Native("c++", "(#0)->mark(#1)") - public native global def mark(Int): Void throws IOException; + public native global def mark(Int): Void; - @Native("java", "#0.reset()") + // @Native("java", "#0.reset()") + @Native("java", "try { #0.reset(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->reset()") public native global def reset(): Void throws IOException; Modified: trunk/x10.runtime/src-x10/x10/io/OutputStreamWriter.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/OutputStreamWriter.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/OutputStreamWriter.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,31 +18,38 @@ @NativeRep("java", "java.io.OutputStream", null, null) @NativeRep("c++", "x10aux::ref<x10::io::OutputStreamWriter__OutputStream>", "x10::io::OutputStreamWriter__OutputStream", null) protected abstract static class OutputStream { - @Native("java", "#0.close()") + // @Native("java", "#0.close()") + @Native("java", "try { #0.close(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->close()") public native global def close(): Void throws IOException; - @Native("java", "#0.flush()") + // @Native("java", "#0.flush()") + @Native("java", "try { #0.flush(); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->flush()") public native global def flush(): Void throws IOException; - @Native("java", "#0.write(#1)") + // @Native("java", "#0.write(#1)") + @Native("java", "try { #0.write(#1); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->write(#1)") public native global def write(Int): Void throws IOException; - @Native("java", "#0.write((#1).getByteArray())") + // @Native("java", "#0.write((#1).getByteArray())") + @Native("java", "try { #0.write((#1).getByteArray()); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->write(#1)") public native global def write(Rail[Byte]): Void throws IOException; - @Native("java", "#0.write((#1).getByteArray())") + // @Native("java", "#0.write((#1).getByteArray())") + @Native("java", "try { #0.write((#1).getByteArray()); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->write(#1)") public native global def write(ValRail[Byte]): Void throws IOException; - @Native("java", "#0.write((#1).getByteArray(), #2, #3)") + // @Native("java", "#0.write((#1).getByteArray(), #2, #3)") + @Native("java", "try { #0.write((#1).getByteArray(), #2, #3); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->write(#1)") public native global def write(Rail[Byte], Int, Int): Void throws IOException; - @Native("java", "#0.write((#1).getByteArray(), #2, #3)") + // @Native("java", "#0.write((#1).getByteArray(), #2, #3)") + @Native("java", "try { #0.write((#1).getByteArray(), #2, #3); } catch (java.io.IOException e) { throw new x10.io.IOException(e.getMessage()); }") @Native("c++", "(#0)->write(#1)") public native global def write(ValRail[Byte], Int, Int): Void throws IOException; } Modified: trunk/x10.runtime/src-x10/x10/io/Writer.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/Writer.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/io/Writer.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -64,7 +64,7 @@ } } - @Native("java", "new java.lang.Object() { java.io.OutputStream eval(final x10.io.Writer w) { return new java.io.OutputStream() { public void write(int x) throws java.io.IOException { w.write((byte) x); } }; } }.eval(#0)") + @Native("java", "new java.lang.Object() { java.io.OutputStream eval(final x10.io.Writer w) { return new java.io.OutputStream() { public void write(int x) throws x10.io.IOException { w.write((byte) x); } }; } }.eval(#0)") private global def oos(): OutputStreamWriter.OutputStream { return oos(); } Modified: trunk/x10.runtime/src-x10/x10/lang/ArithmeticException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/ArithmeticException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/ArithmeticException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,7 +18,7 @@ * Thrown when an exceptional arithmetic condition has occurred. * For example, an integer "divide by zero" throws an instance of this class. */ -@NativeRep("java", "java.lang.ArithmeticException", null, null) +// @NativeRep("java", "java.lang.ArithmeticException", null, null) public class ArithmeticException extends RuntimeException { /** Modified: trunk/x10.runtime/src-x10/x10/lang/ArrayIndexOutOfBoundsException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/ArrayIndexOutOfBoundsException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/ArrayIndexOutOfBoundsException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,7 +18,7 @@ * Thrown to indicate that an array has been accessed with an illegal index. * For example, the point is outside of the array's region. */ -@NativeRep("java", "java.lang.ArrayIndexOutOfBoundsException", null, null) +// @NativeRep("java", "java.lang.ArrayIndexOutOfBoundsException", null, null) public class ArrayIndexOutOfBoundsException extends RuntimeException { /** Modified: trunk/x10.runtime/src-x10/x10/lang/Byte.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Byte.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Byte.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -351,14 +351,16 @@ /** * @deprecated use {@link #parse(String,Int)} instead */ - @Native("java", "java.lang.Byte.parseByte(#1, #2)") + // @Native("java", "java.lang.Byte.parseByte(#1, #2)") + @Native("java", "new Object() { byte eval(String s, int radix) { try { return java.lang.Byte.parseByte(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::byte_utils::parseByte(#1, #2)") public native static def parseByte(String, radix:Int): Byte throws NumberFormatException; /** * @deprecated use {@link #parse(String)} instead */ - @Native("java", "java.lang.Byte.parseByte(#1)") + // @Native("java", "java.lang.Byte.parseByte(#1)") + @Native("java", "new Object() { byte eval(String s) { try { return java.lang.Byte.parseByte(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::byte_utils::parseByte(#1)") public native static def parseByte(String): Byte throws NumberFormatException; @@ -369,7 +371,8 @@ * @return the Byte represented by the String argument in the specified radix. * @throws NumberFormatException if the String does not contain a parsable Byte. */ - @Native("java", "java.lang.Byte.parseByte(#1, #2)") + // @Native("java", "java.lang.Byte.parseByte(#1, #2)") + @Native("java", "new Object() { byte eval(String s, int radix) { try { return java.lang.Byte.parseByte(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::byte_utils::parseByte(#1, #2)") public native static def parse(s:String, radix:Int): Byte throws NumberFormatException; @@ -379,7 +382,8 @@ * @return the Byte represented by the String argument. * @throws NumberFormatException if the String does not contain a parsable Byte. */ - @Native("java", "java.lang.Byte.parseByte(#1)") + // @Native("java", "java.lang.Byte.parseByte(#1)") + @Native("java", "new Object() { byte eval(String s) { try { return java.lang.Byte.parseByte(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::byte_utils::parseByte(#1)") public native static def parse(s:String): Byte throws NumberFormatException; Modified: trunk/x10.runtime/src-x10/x10/lang/ClassCastException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/ClassCastException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/ClassCastException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,7 +18,7 @@ * Thrown to indicate that the code has attempted to cast an object to a subclass of which it is * not an instance. */ -@NativeRep("java", "java.lang.ClassCastException", null, null) +// @NativeRep("java", "java.lang.ClassCastException", null, null) public class ClassCastException extends RuntimeException { /** Modified: trunk/x10.runtime/src-x10/x10/lang/Error.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Error.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Error.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -23,7 +23,7 @@ * might be thrown during the execution of the method but not caught, since these errors * are abnormal conditions that should never occur. */ -@NativeRep("java", "java.lang.Error", null, null) +// @NativeRep("java", "java.lang.Error", null, null) public class Error extends Throwable { /** Modified: trunk/x10.runtime/src-x10/x10/lang/Exception.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Exception.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Exception.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -18,7 +18,7 @@ * The class Exception and its subclasses are a form of Throwable that indicates conditions that * a reasonable application might want to catch. */ -@NativeRep("java", "java.lang.Exception", null, null) +// @NativeRep("java", "java.lang.Exception", null, null) public class Exception extends Throwable { /** Modified: trunk/x10.runtime/src-x10/x10/lang/IllegalArgumentException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/IllegalArgumentException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/IllegalArgumentException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -17,7 +17,7 @@ /** * Thrown to indicate that a method has been passed an illegal or inappropriate argument. */ -@NativeRep("java", "java.lang.IllegalArgumentException", null, null) +// @NativeRep("java", "java.lang.IllegalArgumentException", null, null) public class IllegalArgumentException extends RuntimeException { /** Modified: trunk/x10.runtime/src-x10/x10/lang/Int.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Int.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Int.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -354,14 +354,16 @@ /** * @deprecated use {@link #parse(String,Int)} instead */ - @Native("java", "java.lang.Integer.parseInt(#1, #2)") + // @Native("java", "java.lang.Integer.parseInt(#1, #2)") + @Native("java", "new Object() { int eval(String s, int radix) { try { return java.lang.Integer.parseInt(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::int_utils::parseInt(#1, #2)") public native static def parseInt(String, radix:Int): Int throws NumberFormatException; /** * @deprecated use {@link #parse(String)} instead */ - @Native("java", "java.lang.Integer.parseInt(#1)") + // @Native("java", "java.lang.Integer.parseInt(#1)") + @Native("java", "new Object() { int eval(String s) { try { return java.lang.Integer.parseInt(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::int_utils::parseInt(#1)") public native static def parseInt(String): Int throws NumberFormatException; @@ -372,7 +374,8 @@ * @return the Int represented by the String argument in the specified radix. * @throws NumberFormatException if the String does not contain a parsable Int. */ - @Native("java", "java.lang.Integer.parseInt(#1, #2)") + // @Native("java", "java.lang.Integer.parseInt(#1, #2)") + @Native("java", "new Object() { int eval(String s, int radix) { try { return java.lang.Integer.parseInt(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::int_utils::parseInt(#1, #2)") public native static def parse(s:String, radix:Int): Int throws NumberFormatException; @@ -382,7 +385,8 @@ * @return the Int represented by the String argument. * @throws NumberFormatException if the String does not contain a parsable Int. */ - @Native("java", "java.lang.Integer.parseInt(#1)") + // @Native("java", "java.lang.Integer.parseInt(#1)") + @Native("java", "new Object() { int eval(String s) { try { return java.lang.Integer.parseInt(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::int_utils::parseInt(#1)") public native static def parse(s:String): Int throws NumberFormatException; Modified: trunk/x10.runtime/src-x10/x10/lang/InterruptedException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/InterruptedException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/InterruptedException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -25,7 +25,7 @@ /** * InterruptedException that may be thrown by NativeWorker.sleep. */ -@NativeRep("java", "java.lang.InterruptedException", null, null) +// @NativeRep("java", "java.lang.InterruptedException", null, null) class InterruptedException extends Exception { } Modified: trunk/x10.runtime/src-x10/x10/lang/Long.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Long.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Long.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -352,14 +352,16 @@ /** * @deprecated use {@link #parse(String,Int)} instead */ - @Native("java", "java.lang.Long.parseLong(#1, #2)") + // @Native("java", "java.lang.Long.parseLong(#1, #2)") + @Native("java", "new Object() { long eval(String s, int radix) { try { return java.lang.Long.parseLong(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::long_utils::parseLong(#1, #2)") public native static def parseLong(String, radix:Int): Long throws NumberFormatException; /** * @deprecated use {@link #parse(String)} instead */ - @Native("java", "java.lang.Long.parseLong(#1)") + // @Native("java", "java.lang.Long.parseLong(#1)") + @Native("java", "new Object() { long eval(String s) { try { return java.lang.Long.parseLong(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::long_utils::parseLong(#1)") public native static def parseLong(String): Long throws NumberFormatException; @@ -370,7 +372,8 @@ * @return the Long represented by the String argument in the specified radix. * @throws NumberFormatException if the String does not contain a parsable Long. */ - @Native("java", "java.lang.Long.parseLong(#1, #2)") + // @Native("java", "java.lang.Long.parseLong(#1, #2)") + @Native("java", "new Object() { long eval(String s, int radix) { try { return java.lang.Long.parseLong(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::long_utils::parseLong(#1, #2)") public native static def parse(s:String, radix:Int): Long throws NumberFormatException; @@ -380,7 +383,8 @@ * @return the Long represented by the String argument. * @throws NumberFormatException if the String does not contain a parsable Long. */ - @Native("java", "java.lang.Long.parseLong(#1)") + // @Native("java", "java.lang.Long.parseLong(#1)") + @Native("java", "new Object() { long eval(String s) { try { return java.lang.Long.parseLong(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::long_utils::parseLong(#1)") public native static def parse(s:String): Long throws NumberFormatException; Modified: trunk/x10.runtime/src-x10/x10/lang/NullPointerException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/NullPointerException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/NullPointerException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.lang.NullPointerException", null, null) +// @NativeRep("java", "java.lang.NullPointerException", null, null) public class NullPointerException extends RuntimeException { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/lang/NumberFormatException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/NumberFormatException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/NumberFormatException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.lang.NumberFormatException", null, null) +// @NativeRep("java", "java.lang.NumberFormatException", null, null) public class NumberFormatException extends IllegalArgumentException { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/lang/OutOfMemoryError.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/OutOfMemoryError.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/OutOfMemoryError.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.lang.OutOfMemoryError", null, null) +// @NativeRep("java", "java.lang.OutOfMemoryError", null, null) public class OutOfMemoryError extends Error { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/lang/RuntimeException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/RuntimeException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/RuntimeException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -14,7 +14,7 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -@NativeRep("java", "java.lang.RuntimeException", null, null) +// @NativeRep("java", "java.lang.RuntimeException", null, null) public class RuntimeException extends Exception { public def this() { super(); } public def this(message: String) { super(message); } Modified: trunk/x10.runtime/src-x10/x10/lang/Short.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Short.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Short.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -352,14 +352,16 @@ /** * @deprecated use {@link #parse(String,Int)} instead */ - @Native("java", "java.lang.Short.parseShort(#1, #2)") + // @Native("java", "java.lang.Short.parseShort(#1, #2)") + @Native("java", "new Object() { short eval(String s, int radix) { try { return java.lang.Short.parseShort(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::short_utils::parseShort(#1, #2)") public native static def parseShort(String, radix:Int): Short throws NumberFormatException; /** * @deprecated use {@link #parse(String)} instead */ - @Native("java", "java.lang.Short.parseShort(#1)") + // @Native("java", "java.lang.Short.parseShort(#1)") + @Native("java", "new Object() { short eval(String s) { try { return java.lang.Short.parseShort(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::short_utils::parseShort(#1)") public native static def parseShort(String): Short throws NumberFormatException; @@ -370,7 +372,8 @@ * @return the Short represented by the String argument in the specified radix. * @throws NumberFormatException if the String does not contain a parsable Short. */ - @Native("java", "java.lang.Short.parseShort(#1, #2)") + // @Native("java", "java.lang.Short.parseShort(#1, #2)") + @Native("java", "new Object() { short eval(String s, int radix) { try { return java.lang.Short.parseShort(s, radix); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1, #2)") @Native("c++", "x10aux::short_utils::parseShort(#1, #2)") public native static def parse(s:String, radix:Int): Short throws NumberFormatException; @@ -380,7 +383,8 @@ * @return the Short represented by the String argument. * @throws NumberFormatException if the String does not contain a parsable Short. */ - @Native("java", "java.lang.Short.parseShort(#1)") + // @Native("java", "java.lang.Short.parseShort(#1)") + @Native("java", "new Object() { short eval(String s) { try { return java.lang.Short.parseShort(s); } catch (java.lang.NumberFormatException e) { throw new x10.lang.NumberFormatException(e.getMessage()); } } }.eval(#1)") @Native("c++", "x10aux::short_utils::parseShort(#1)") public native static def parse(s:String): Short throws NumberFormatException; Modified: trunk/x10.runtime/src-x10/x10/lang/Throwable.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Throwable.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/Throwable.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -17,7 +17,8 @@ import x10.io.Printer; import x10.io.Console; -@NativeRep("java", "java.lang.Throwable", null, null) +@NativeRep("java", "x10.runtime.impl.java.X10Throwable", null, null) +// @NativeRep("java", "java.lang.RuntimeException", null, null) @NativeRep("c++", "x10aux::ref<x10::lang::Throwable>", "x10::lang::Throwable", null) public class Throwable { @Native("java", "#0.getCause()") Modified: trunk/x10.runtime/src-x10/x10/lang/UnsupportedOperationException.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/UnsupportedOperationException.x10 2010-09-08 10:55:43 UTC (rev 16119) +++ trunk/x10.runtime/src-x10/x10/lang/UnsupportedOperationException.x10 2010-09-08 11:02:26 UTC (rev 16120) @@ -13,7 +13,7 @@ import x10.compiler.NativeRep; -@NativeRep("java", "java.lang.UnsupportedOperationException", null, null) +// @NativeRep("java", "java.lang.UnsupportedOperationException", null, null) public class UnsupportedOperationException extends RuntimeException { public def this() = super("unsupported operation exception"); public def this(message: String) = super(message); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-09-09 18:47:51
|
Revision: 16237 http://x10.svn.sourceforge.net/x10/?rev=16237&view=rev Author: dgrove-oss Date: 2010-09-09 18:47:39 +0000 (Thu, 09 Sep 2010) Log Message: ----------- Merge localClasses branch into trunk. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/ClosureCall_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10Initializer_c.java trunk/x10.compiler/src/x10/ast/X10LocalDecl_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/errors/Errors.java trunk/x10.compiler/src/x10/optimizations/ForLoopOptimizer.java trunk/x10.compiler/src/x10/parser/X10KWLexer.gi trunk/x10.compiler/src/x10/parser/X10KWLexer.java trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 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.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/util/synthesizer/NewInstanceSynth.java trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java trunk/x10.dist/samples/ArraySum.x10 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/FSSimpleDist.x10 trunk/x10.dist/samples/GCSpheres.x10 trunk/x10.dist/samples/HelloWholeWorld.x10 trunk/x10.dist/samples/HelloWorld.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeans.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/MontyPi.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/NQueensPar.x10 trunk/x10.dist/samples/StructSpheres.x10 trunk/x10.dist/samples/tutorial/Fib.x10 trunk/x10.dist/samples/tutorial/Integrate.x10 trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10/io/FileReader__FileInputStream.cc trunk/x10.runtime/src-cpp/x10/io/FileReader__FileInputStream.h trunk/x10.runtime/src-cpp/x10/io/FileWriter__FileOutputStream.cc trunk/x10.runtime/src-cpp/x10/io/FileWriter__FileOutputStream.h trunk/x10.runtime/src-cpp/x10/io/File__NativeFile.cc trunk/x10.runtime/src-cpp/x10/io/File__NativeFile.h trunk/x10.runtime/src-cpp/x10/io/InputStreamReader__InputStream.cc trunk/x10.runtime/src-cpp/x10/io/OutputStreamWriter__OutputStream.cc trunk/x10.runtime/src-cpp/x10/lang/Any.h trunk/x10.runtime/src-cpp/x10/lang/Closure.h trunk/x10.runtime/src-cpp/x10/lang/Deque.cc trunk/x10.runtime/src-cpp/x10/lang/Deque.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_0.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_1.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_2.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_3.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_4.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_5.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_6.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_7.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_8.h trunk/x10.runtime/src-cpp/x10/lang/Fun_0_9.h trunk/x10.runtime/src-cpp/x10/lang/IBox.h trunk/x10.runtime/src-cpp/x10/lang/IBox.struct_h trunk/x10.runtime/src-cpp/x10/lang/Object.cc trunk/x10.runtime/src-cpp/x10/lang/Object.h trunk/x10.runtime/src-cpp/x10/lang/Rail.cc trunk/x10.runtime/src-cpp/x10/lang/Rail.h trunk/x10.runtime/src-cpp/x10/lang/Reference.cc trunk/x10.runtime/src-cpp/x10/lang/Reference.h trunk/x10.runtime/src-cpp/x10/lang/String.cc trunk/x10.runtime/src-cpp/x10/lang/String.h trunk/x10.runtime/src-cpp/x10/lang/Struct.h trunk/x10.runtime/src-cpp/x10/lang/Thread.cc trunk/x10.runtime/src-cpp/x10/lang/Thread.h trunk/x10.runtime/src-cpp/x10/lang/Throwable.cc trunk/x10.runtime/src-cpp/x10/lang/ValRail.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_0.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_1.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_2.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_3.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_4.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_5.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_6.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_7.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_8.h trunk/x10.runtime/src-cpp/x10/lang/VoidFun_0_9.h trunk/x10.runtime/src-cpp/x10/util/GrowableRail.h trunk/x10.runtime/src-cpp/x10/util/IndexedMemoryChunk.h trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.cc trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicBoolean.h trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicInteger.cc trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicInteger.h trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicLong.cc trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicLong.h trunk/x10.runtime/src-cpp/x10/util/concurrent/atomic/AtomicReference.h trunk/x10.runtime/src-cpp/x10aux/alloc.h trunk/x10.runtime/src-cpp/x10aux/basic_functions.h trunk/x10.runtime/src-cpp/x10aux/bootstrap.cc trunk/x10.runtime/src-cpp/x10aux/deserialization_dispatcher.cc trunk/x10.runtime/src-cpp/x10aux/deserialization_dispatcher.h trunk/x10.runtime/src-cpp/x10aux/init_dispatcher.cc trunk/x10.runtime/src-cpp/x10aux/rail_utils.h trunk/x10.runtime/src-cpp/x10aux/ref.cc trunk/x10.runtime/src-cpp/x10aux/ref.h trunk/x10.runtime/src-cpp/x10aux/serialization.h trunk/x10.runtime/src-cpp/x10aux/static_init.cc trunk/x10.runtime/src-cpp/x10aux/static_init.h trunk/x10.runtime/src-java/x10/core/Rail.java trunk/x10.runtime/src-java/x10/core/Ref.java trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime/src-java/x10/runtime/impl/java/Thread.java trunk/x10.runtime/src-x10/x10/array/Array.x10 trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime/src-x10/x10/array/Dist.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/EmptyRegion.x10 trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 trunk/x10.runtime/src-x10/x10/array/Mat.x10 trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 trunk/x10.runtime/src-x10/x10/array/Point.x10 trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 trunk/x10.runtime/src-x10/x10/array/PolyRow.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/array/Region.x10 trunk/x10.runtime/src-x10/x10/array/Row.x10 trunk/x10.runtime/src-x10/x10/array/ValRow.x10 trunk/x10.runtime/src-x10/x10/array/VarRow.x10 trunk/x10.runtime/src-x10/x10/compiler/RemoteOperation.x10 trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 trunk/x10.runtime/src-x10/x10/io/ByteRailWriter.x10 trunk/x10.runtime/src-x10/x10/io/ByteValRailWriter.x10 trunk/x10.runtime/src-x10/x10/io/ByteWriter.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 trunk/x10.runtime/src-x10/x10/io/FileReader.x10 trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 trunk/x10.runtime/src-x10/x10/io/FilterReader.x10 trunk/x10.runtime/src-x10/x10/io/FilterWriter.x10 trunk/x10.runtime/src-x10/x10/io/InputStreamReader.x10 trunk/x10.runtime/src-x10/x10/io/Marshal.x10 trunk/x10.runtime/src-x10/x10/io/OutputStreamWriter.x10 trunk/x10.runtime/src-x10/x10/io/Printer.x10 trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 trunk/x10.runtime/src-x10/x10/io/Reader.x10 trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 trunk/x10.runtime/src-x10/x10/io/Writer.x10 trunk/x10.runtime/src-x10/x10/lang/Activity.x10 trunk/x10.runtime/src-x10/x10/lang/Any.x10 trunk/x10.runtime/src-x10/x10/lang/Boolean.x10 trunk/x10.runtime/src-x10/x10/lang/Byte.x10 trunk/x10.runtime/src-x10/x10/lang/Cell.x10 trunk/x10.runtime/src-x10/x10/lang/Char.x10 trunk/x10.runtime/src-x10/x10/lang/Clock.x10 trunk/x10.runtime/src-x10/x10/lang/Comparable.x10 trunk/x10.runtime/src-x10/x10/lang/Complex.x10 trunk/x10.runtime/src-x10/x10/lang/Double.x10 trunk/x10.runtime/src-x10/x10/lang/Float.x10 trunk/x10.runtime/src-x10/x10/lang/Future.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/MultipleExceptions.x10 trunk/x10.runtime/src-x10/x10/lang/Object.x10 trunk/x10.runtime/src-x10/x10/lang/Place.x10 trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/Reducible.x10 trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 trunk/x10.runtime/src-x10/x10/lang/Short.x10 trunk/x10.runtime/src-x10/x10/lang/String.x10 trunk/x10.runtime/src-x10/x10/lang/Throwable.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 trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 trunk/x10.runtime/src-x10/x10/lang/_.x10 trunk/x10.runtime/src-x10/x10/util/AbstractCollection.x10 trunk/x10.runtime/src-x10/x10/util/AbstractContainer.x10 trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 trunk/x10.runtime/src-x10/x10/util/Box.x10 trunk/x10.runtime/src-x10/x10/util/Collection.x10 trunk/x10.runtime/src-x10/x10/util/Container.x10 trunk/x10.runtime/src-x10/x10/util/GrowableRail.x10 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/HashSet.x10 trunk/x10.runtime/src-x10/x10/util/IndexedMemoryChunk.x10 trunk/x10.runtime/src-x10/x10/util/Map.x10 trunk/x10.runtime/src-x10/x10/util/MapIterator.x10 trunk/x10.runtime/src-x10/x10/util/MapSet.x10 trunk/x10.runtime/src-x10/x10/util/Option.x10 trunk/x10.runtime/src-x10/x10/util/OptionsParser.x10 trunk/x10.runtime/src-x10/x10/util/Ordered.x10 trunk/x10.runtime/src-x10/x10/util/Pair.x10 trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 trunk/x10.runtime/src-x10/x10/util/ValHashMap.x10 trunk/x10.runtime/src-x10/x10/util/ValMap.x10 trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicBoolean.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicInteger.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicLong.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicReference.x10 trunk/x10.tests/examples/Benchmarks/DistRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/DistStream1.x10 trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/ParStream1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/SeqStream1.x10 trunk/x10.tests/examples/Constructs/Array/Array31.x10 trunk/x10.tests/examples/Constructs/Array/Array4.x10 trunk/x10.tests/examples/Constructs/Array/Array5.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopyTo.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray4.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAndAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondOr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInVoid.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInitFor.x10 trunk/x10.tests/examples/Constructs/Array/FlattenPlaceCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenValForce.x10 trunk/x10.tests/examples/Constructs/Array/FlattenVarInit.x10 trunk/x10.tests/examples/Constructs/Array/Force.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayMaxAbs.x10 trunk/x10.tests/examples/Constructs/Array/IntValueArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayNotInitialized_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayWithInitializer.x10 trunk/x10.tests/examples/Constructs/Array/MultiDimensionalJavaArray.x10 trunk/x10.tests/examples/Constructs/Array/TestArray.x10 trunk/x10.tests/examples/Constructs/Array/TestSimpleArrayMult.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds2D.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 trunk/x10.tests/examples/Constructs/Async/AsyncNext.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest1.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest2.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest3.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest2.x10 trunk/x10.tests/examples/Constructs/At/AtFieldAccess.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/At/AtNext.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach2.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEachLoopOnArray.x10 trunk/x10.tests/examples/Constructs/Atomic/Atomic1.x10 trunk/x10.tests/examples/Constructs/Atomic/Atomic2.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicContainingWhen_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicMethodTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicNonLocal_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicOrdered.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicReturn.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AwaitTest.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicQueue.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicTest.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveLitteralToPrimitiveConstrained_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_1.x10 trunk/x10.tests/examples/Constructs/Clock/ClockFuture.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest1.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest10.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest10a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest17_MustFailTimeout.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest18.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest8.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest9.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1d.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1s.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope2c_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope3.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope4.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope5.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTest.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF1.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF10.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF1Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF2.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF2Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3Generic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF5_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF6.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF7.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF8.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF9.x10 trunk/x10.tests/examples/Constructs/Finish/FinishTest1.x10 trunk/x10.tests/examples/Constructs/Finish/FinishTest2.x10 trunk/x10.tests/examples/Constructs/Future/Future0.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest3.x10 trunk/x10.tests/examples/Constructs/Generics/GenericTest.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck2.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/At_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 trunk/x10.tests/examples/Constructs/Place/BangAcrossPlaces2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/BangAcrossPlaces_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/CheckThisTypeInCall.x10 trunk/x10.tests/examples/Constructs/Place/ClosureBang.x10 trunk/x10.tests/examples/Constructs/Place/FieldReceiverIsExpr.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvoke.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeRev.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeStatic.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeStruct.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvokeRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvokeStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvoke_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccess.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccessRev.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccessStatic.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccessRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccessStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/GlobalAccess.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckInRail2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckInRail_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStringBuilder_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/PlaceCast/PlaceCast.x10 trunk/x10.tests/examples/Constructs/Typedefs/TypedefBasic2.x10 trunk/x10.tests/examples/Constructs/Typedefs/TypedefConstraint1a.x10 trunk/x10.tests/examples/Constructs/Typedefs/TypedefConstraint1b.x10 trunk/x10.tests/examples/Constructs/Typedefs/TypedefConstraint1c.x10 trunk/x10.tests/examples/Constructs/Typedefs/TypedefTest.x10 trunk/x10.tests/examples/Issues/XTENLANG_106.x10 trunk/x10.tests/examples/Issues/XTENLANG_11.x10 trunk/x10.tests/examples/Issues/XTENLANG_111.x10 trunk/x10.tests/examples/Issues/XTENLANG_118.x10 trunk/x10.tests/examples/Issues/XTENLANG_1466.x10 trunk/x10.tests/examples/Issues/XTENLANG_210.x10 trunk/x10.tests/examples/Issues/XTENLANG_240.x10 trunk/x10.tests/examples/Issues/XTENLANG_241.x10 trunk/x10.tests/examples/Issues/XTENLANG_258.x10 trunk/x10.tests/examples/Issues/XTENLANG_305.x10 trunk/x10.tests/examples/Issues/XTENLANG_35.x10 trunk/x10.tests/examples/Issues/XTENLANG_36.x10 trunk/x10.tests/examples/Issues/XTENLANG_473.x10 trunk/x10.tests/examples/Issues/XTENLANG_55.x10 trunk/x10.tests/examples/Issues/XTENLANG_62.x10 trunk/x10.tests/examples/Issues/XTENLANG_636.x10 trunk/x10.tests/examples/Issues/XTENLANG_637.x10 trunk/x10.tests/examples/Issues/XTENLANG_90.x10 trunk/x10.tests/examples/Misc/Assign2.x10 trunk/x10.tests/examples/Misc/FinalInitializationTest.x10 trunk/x10.tests/examples/Misc/NullableComparison.x10 trunk/x10.tests/examples/Misc/Stencil1D.x10 trunk/x10.tests/examples/Samples/IntegrateTest.x10 trunk/x10.tests/examples/Timings/ArrayIndexing.x10 trunk/x10.tests/examples/Timings/Initialization.x10 trunk/x10.tests/examples/Timings/IntArrayIndexing.x10 trunk/x10.tests/examples/x10lib/harness/x10Test.x10 Added Paths: ----------- trunk/TODO_DAVE.txt trunk/x10.runtime/src-cpp/x10/lang/Global.cc trunk/x10.runtime/src-cpp/x10/lang/GlobalRef.cc trunk/x10.runtime/src-cpp/x10/lang/GlobalRef.h trunk/x10.runtime/src-cpp/x10/lang/GlobalRef.struct_h trunk/x10.runtime/src-java/x10/core/GlobalRef.java trunk/x10.runtime/src-x10/x10/array/RemoteArray.x10 trunk/x10.runtime/src-x10/x10/compiler/Global.x10 trunk/x10.runtime/src-x10/x10/compiler/Pinned.x10 trunk/x10.runtime/src-x10/x10/io/GlobalStringWriter.x10 trunk/x10.runtime/src-x10/x10/lang/GlobalCell.x10 trunk/x10.runtime/src-x10/x10/lang/GlobalRef.x10 trunk/x10.runtime/src-x10/x10/lang/TODO.txt trunk/x10.tests/examples/Constructs/Array/ArraySerialization.x10 trunk/x10.tests/examples/Constructs/Array/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Async/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/At/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/AtEach/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Atomic/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Await/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Call/ConInstanceHere_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Cast/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Class/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Clock/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Closures/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Finish/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Future/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Place/AtCheck3a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/ConvertedTo2-1 trunk/x10.tests/examples/Constructs/Place/~~BEING~~CONVERTED~~ trunk/x10.tests/examples/Constructs/Region/~~BARD-IS-HERE!~~ Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/lang/Rail__NativeRep.x10 trunk/x10.runtime/src-x10/x10/lang/ValRail__NativeRep.x10 trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 trunk/x10.tests/examples/Constructs/Call/ConInstanceHere.x10 Property Changed: ---------------- trunk/ trunk/x10.common/ trunk/x10.compiler/ trunk/x10.constraints/ trunk/x10.dist/ trunk/x10.dist/samples/CUDA/CUDAKernelTest.x10 trunk/x10.dist/samples/CUDA/CUDATopology.x10 trunk/x10.runtime/ trunk/x10.runtime/src-cpp/x10aux/network.cc trunk/x10.runtime/src-cpp/x10aux/network.h trunk/x10.runtime/src-x10/x10/compiler/CUDA.x10 trunk/x10.runtime/x10rt/pgas/ trunk/x10.sncode/ trunk/x10.tests/ Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo + /branches/localClasses:15779-16236 Copied: trunk/TODO_DAVE.txt (from rev 16236, branches/localClasses/TODO_DAVE.txt) =================================================================== --- trunk/TODO_DAVE.txt (rev 0) +++ trunk/TODO_DAVE.txt 2010-09-09 18:47:39 UTC (rev 16237) @@ -0,0 +1,10 @@ +x10.compiler.RemoteOperation. + Kill this code. Won't work anymore. + Recode RA to use IndexedMemoryChunk directly. + +x10.io.GlobalStringWriter + Do we really want this class? See todo in the class header. + +x10.util. + Kill various Val<Foo> classes. No longer needed in 2.1 + Property changes on: trunk/x10.common ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.common.17:10541-10846 /branches/placeLocal/x10.common:11035-11056 + /branches/itable/x10.common.17:10541-10846 /branches/localClasses/x10.common:15779-16236 /branches/placeLocal/x10.common:11035-11056 Property changes on: trunk/x10.compiler ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.compiler.p3:10541-10846 /branches/placeLocal/x10.compiler:11035-11056 + /branches/itable/x10.compiler.p3:10541-10846 /branches/localClasses/x10.compiler:15779-16236 /branches/placeLocal/x10.compiler:11035-11056 Modified: trunk/x10.compiler/src/x10/ast/ClosureCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -268,7 +268,7 @@ error = new SemanticException(); // null message mi = xts.createFakeMethod(targetType.toClass(), Flags.PUBLIC, name, typeArgs, actualTypes, error); if (rt == null) rt = mi.returnType(); - rt = PlaceChecker.AddIsHereClause(rt, context); + // rt = PlaceChecker.AddIsHereClause(rt, context); mi = mi.returnType(rt); return mi; } Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -73,7 +73,7 @@ import x10.types.XTypeTranslator; import x10.types.checker.Checker; import x10.types.checker.Converter; -import x10.types.checker.PlaceChecker; +// import x10.types.checker.PlaceChecker; import x10.types.matcher.DumbMethodMatcher; import x10.visit.X10TypeChecker; @@ -692,7 +692,8 @@ if (this.target() == null) methodCall = (X10Call_c) methodCall.targetImplicit(true).target(target); methodCall.checkProtoMethod(); - methodCall = (X10Call_c) PlaceChecker.makeReceiverLocalIfNecessary(methodCall, tc); + // Eliminate for orthogonal locality. + // methodCall = (X10Call_c) PlaceChecker.makeReceiverLocalIfNecessary(methodCall, tc); //methodCall.checkConsistency(c); // [IP] Removed -- this is dead code at this point methodCall.checkAnnotations(tc); X10TypeMixin.checkMissingParameters(methodCall); Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -89,7 +89,6 @@ import x10.util.Synthesizer; import x10.visit.ChangePositionVisitor; import x10.visit.CheckEscapingThis; -import x10.Configuration; /** * The same as a Java class, except that it needs to handle properties. @@ -707,6 +706,7 @@ n.checkStructMethods(parent, tc); } + return n; } Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -253,7 +253,7 @@ X10TypeSystem xts = (X10TypeSystem) c.typeSystem(); if (child == body || child == returnType || child == hasType || child == throwTypes || child == offerType || (formals != null && formals.contains(child))) { - c = PlaceChecker.pushHereIsThisHome(xc); + c = PlaceChecker.pushHereIsThisHome(xc); } @@ -498,6 +498,13 @@ } } + if (returnType != null) { + // visitChild(returnType, thisC); + if (thisC.error()) { + throw new Errors.ThisNotPermittedInConstructorReturnType(returnType, position()); + } + } + for (TypeNode type : n.throwTypes()) { CConstraint rc = X10TypeMixin.xclause(type.type()); if (rc != null && ! rc.valid()) Modified: trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -100,12 +100,14 @@ } } + X10Field_c target = (X10Field_c) n.left(); - try { + /*try { target = PlaceChecker.makeFieldAccessLocalIfNecessary(target, tc); } catch (SemanticException e) { Errors.issue(tc.job(), e, this); } + */ n = (X10FieldAssign_c) n.reconstruct(target.target(), n.name()); t = n.leftType(); n = (X10FieldAssign_c) n.type(t); Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -120,7 +120,8 @@ // located in the current place. "this" is going to get quantified out by the FieldMatcher. // therefore we temporarily replace this.home with a new UQV, currentPlace, and then on // return from the matcher, substitute it back in. - XTerm placeTerm = c.currentPlaceTerm()==null ? null: c.currentPlaceTerm().term(); + + XTerm placeTerm = c.currentPlaceTerm()==null ? null: c.currentPlaceTerm().term(); XVar currentPlace = XTerms.makeUQV("place"); Type tType2 = placeTerm==null ? targetType : Subst.subst(targetType, currentPlace, (XVar) placeTerm); fi = (X10FieldInstance) ts.findField(targetType, ts.FieldMatcher(tType2, receiverInContext, name, c)); @@ -179,7 +180,8 @@ e = new SemanticException(); // null message fi = xts.createFakeField(targetType.toClass(), flags, name, e); if (rt == null) rt = fi.type(); - rt = PlaceChecker.AddIsHereClause(rt, context); + // vj: Added by Igor, not sure why. Removed. + // rt = PlaceChecker.AddIsHereClause(rt, context); fi = fi.type(rt); return fi; } @@ -304,7 +306,8 @@ result.checkConsistency(c); checkFieldAccessesInDepClausesAreFinal(result, tc); - result = PlaceChecker.makeFieldAccessLocalIfNecessary(result, tc); + // Not needed in the orthogonal locality proposal. + // result = PlaceChecker.makeFieldAccessLocalIfNecessary(result, tc); //System.err.println("X10Field_c: typeCheck " + result+ " has type " + result.type()); return result; Modified: trunk/x10.compiler/src/x10/ast/X10Initializer_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Initializer_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10Initializer_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -43,7 +43,7 @@ @Override public Context enterChildScope(Node child, Context c) { if (child == body ) { - c = PlaceChecker.pushHereTerm(initializerDef(), (X10Context) c); + // c = PlaceChecker.pushHereTerm(initializerDef(), (X10Context) c); } return c; } Modified: trunk/x10.compiler/src/x10/ast/X10LocalDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10LocalDecl_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10LocalDecl_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -148,11 +148,10 @@ NodeVisitor childtc = tc.enter(parent, this); XConstrainedTerm pt = ((X10Context) tc.context()).currentPlaceTerm(); - assert pt.term()!= null; - ((X10LocalDef) localDef()).setPlaceTerm(pt.term()); + if (pt != null && pt.term() != null) + ((X10LocalDef) localDef()).setPlaceTerm(pt.term()); if (type() instanceof UnknownTypeNode) { - Expr init = (Expr) this.visitChild(init(), childtc); if (init != null) { Type t = init.type(); Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -332,7 +332,7 @@ if (child == body || child == returnType || child == hasType || child == throwTypes || child == offerType || (formals != null && formals.contains(child))) { if (placeTerm != null) c = ((X10Context) c).pushPlace( XConstrainedTerm.make(placeTerm)); - // PlaceChecker.pushHereTerm(methodDef(), (X10Context) c); + PlaceChecker.pushHereTerm(methodDef(), (X10Context) c); } // Add the method guard into the environment. Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -582,6 +582,10 @@ // Add self.home == here to the return type. if (! ts.isStructType(type)) { + // Add this even in 2.1 -- the place where this object is created + // is tracked in the type through a fake field "here". + // This field does not exist at runtime in the object -- but that does not + // prevent the compiler from imagining that it exists. type = PlaceChecker.AddIsHereClause(type, tc.context()); // Add self != null type = X10TypeMixin.addDisBinding(type, X10TypeMixin.selfVar(type), XTerms.NULL); Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -151,7 +151,7 @@ XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); cc.addSelfBinding(var); cc.setThisVar(var); - PlaceChecker.AddThisHomeEqualsPlaceTerm(cc, var, c); + // PlaceChecker.AddThisHomeEqualsPlaceTerm(cc, var, c); } catch (XFailure e) { throw new SemanticException("Constraint on this is inconsistent; " + e.getMessage(), position()); @@ -168,7 +168,7 @@ try { XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); cc.addSelfBinding(var); - PlaceChecker.AddThisHomeEqualsPlaceTerm(cc, var, c); + // PlaceChecker.AddThisHomeEqualsPlaceTerm(cc, var, c); } catch (XFailure e) { throw new SemanticException("Constraint on super is inconsistent; " + e.getMessage(), position()); Modified: trunk/x10.compiler/src/x10/errors/Errors.java =================================================================== --- trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -855,4 +855,29 @@ return((OfferTypeMismatch)o).position().equals(position()); } } + public static class StructMayNotBeGlobal extends SemanticException { + private static final long serialVersionUID = 6179492565190231102L; + public StructMayNotBeGlobal(Position position, X10ClassDecl cd) { + super("global modifier cannot be used for structs." + + "\n\t Struct declaration: " + cd.name(), + position); + } + public boolean equals(Object o) { + if (o==null || ! (o instanceof OfferTypeMismatch) ) + return false; + return((OfferTypeMismatch)o).position().equals(position()); + } + } + public static class GlobalClassMustHaveGlobalClassSupertype extends SemanticException { + private static final long serialVersionUID = 2237512073167205925L; + public GlobalClassMustHaveGlobalClassSupertype(Ref<? extends Type> superType, ClassDef type, Position pos) { + super(superType + " cannot be the superclass for " + type + + "; a global class must subclass a global class.", pos); + } + public boolean equals(Object o) { + if (o==null || ! (o instanceof GlobalClassMustHaveGlobalClassSupertype) ) + return false; + return((GlobalClassMustHaveGlobalClassSupertype)o).position().equals(position()); + } + } } Modified: trunk/x10.compiler/src/x10/optimizations/ForLoopOptimizer.java =================================================================== --- trunk/x10.compiler/src/x10/optimizations/ForLoopOptimizer.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/optimizations/ForLoopOptimizer.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -244,7 +244,7 @@ if (named) { // create a rail to contain the value of the formal at each iteration Name indexName = Name.makeFresh(prefix); - indexType = PlaceChecker.AddIsHereClause(xts.Rail(xts.Int()), context); + indexType = xts.Rail(xts.Int()); // PlaceChecker.AddIsHereClause(xts.Rail(xts.Int()), context); List<Type> railType = Collections.<Type>singletonList(xts.Int()); Expr indexInit = createStaticCall(pos, xts.Rail(), MAKE, railType, createIntLit(rank)); indexLDecl = createLocalDecl(pos, Flags.FINAL, indexName, indexType, indexInit); Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.gi =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2010-09-09 18:47:39 UTC (rev 16237) @@ -140,6 +140,7 @@ this throw throws + transient true try type @@ -481,6 +482,11 @@ $setResult($_throws); $EndAction ./ + | t r a n s i e n t + /.$BeginAction + $setResult($_transient); + $EndAction + ./ | t r u e /.$BeginAction $setResult($_true); Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -17,7 +17,7 @@ public class X10KWLexer extends X10KWLexerprs { private char[] inputChars; - private final int keywordKind[] = new int[73 + 1]; + private final int keywordKind[] = new int[74 + 1]; public int[] getKeywordKinds() { return keywordKind; } @@ -553,54 +553,61 @@ // - // Rule 67: KeyWord ::= t r u e + // Rule 67: KeyWord ::= t r a n s i e n t // - keywordKind[67] = (X10Parsersym.TK_true); + keywordKind[67] = (X10Parsersym.TK_transient); // - // Rule 68: KeyWord ::= t r y + // Rule 68: KeyWord ::= t r u e // - keywordKind[68] = (X10Parsersym.TK_try); + keywordKind[68] = (X10Parsersym.TK_true); // - // Rule 69: KeyWord ::= t y p e + // Rule 69: KeyWord ::= t r y // - keywordKind[69] = (X10Parsersym.TK_type); + keywordKind[69] = (X10Parsersym.TK_try); // - // Rule 70: KeyWord ::= v a l + // Rule 70: KeyWord ::= t y p e // - keywordKind[70] = (X10Parsersym.TK_val); + keywordKind[70] = (X10Parsersym.TK_type); // - // Rule 71: KeyWord ::= v a r + // Rule 71: KeyWord ::= v a l // - keywordKind[71] = (X10Parsersym.TK_var); + keywordKind[71] = (X10Parsersym.TK_val); // - // Rule 72: KeyWord ::= w h e n + // Rule 72: KeyWord ::= v a r // - keywordKind[72] = (X10Parsersym.TK_when); + keywordKind[72] = (X10Parsersym.TK_var); // - // Rule 73: KeyWord ::= w h i l e + // Rule 73: KeyWord ::= w h e n // - keywordKind[73] = (X10Parsersym.TK_while); + keywordKind[73] = (X10Parsersym.TK_when); + // + // Rule 74: KeyWord ::= w h i l e + // + + keywordKind[74] = (X10Parsersym.TK_while); + + for (int i = 0; i < keywordKind.length; i++) { if (keywordKind[i] == 0) Modified: trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2010-09-09 17:55:49 UTC (rev 16236) +++ trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2010-09-09 18:47:39 UTC (rev 16237) @@ -24,19 +24,19 @@ public final static int MAX_NAME_LENGTH = 0; public final int getMaxNameLength() { return MAX_NAME_LENGTH; } - public final static int NUM_STATES = 235; + public final static int NUM_STATES = 241; public final int getNumStates() { return NUM_STATES; } public final static int NT_OFFSET = 27; public final int getNtOffset() { return NT_OFFSET; } - public final static int LA_STATE_OFFSET = 385; + public final static int LA_STATE_OFFSET = 393; public final int getLaStateOffset() { return LA_STATE_OFFSET; } public final static int MAX_LA = 1; public final int getMaxLa() { return MAX_LA; } - public final static int NUM_RULES = 73; + public final static int NUM_RULES = 74; public final int getNumRules() { return NUM_RULES; } public final static int NUM_NONTERMINALS = 2; @@ -48,7 +48,7 @@ public final static int SEGMENT_SIZE = 8192; public final int getSegmentSize() { return SEGMENT_SIZE; } - public final static int START_STATE = 74; + public final static int START_STATE = 75; public final int getStartState() { return START_STATE; } public final static int IDENTIFIER_SYMBOL = 0; @@ -60,10 +60,10 @@ public final static int EOLT_SYMBOL = 28; public final int getEoltSymbol() { return EOLT_SYMBOL; } - public final static int ACCEPT_ACTION = 311; + public final static int ACCEPT_ACTION = 318; public final int getAcceptAction() { return ACCEPT_ACTION; } - public final static int ERROR_ACTION = 312; + public final static int ERROR_ACTION = 319; public final int getErrorAction() { return ERROR_ACTION; } public final static boolean BACKTRACK = false; @@ -109,8 +109,8 @@ 4,2,10,6,2,10,10,9,5,6, 3,4,11,4,5,6,8,2,7,7, 8,9,5,6,6,4,4,10,6,6, - 6,5,6,4,5,6,4,3,4,3, - 3,4,5 + 6,5,6,4,5,6,9,4,3,4, + 3,3,4,5 }; }; public final static byte baseCheck[] = BaseCheck.baseCheck; @@ -127,31 +127,31 @@ 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,76,118,31,62,34, - 24,75,53,55,29,142,61,144,77,39, - 83,85,63,148,43,19,89,150,79,87, - 12,151,95,153,100,154,155,158,101,161, - 159,162,49,103,102,168,163,72,171,172, - 175,179,178,183,181,184,188,192,182,193, - 104,112,195,198,115,109,197,199,202,206, - 208,210,211,213,220,214,216,222,223,224, - 227,229,230,121,231,232,233,238,241,242, - 243,247,249,254,248,258,126,259,261,262, - 263,266,129,264,269,275,278,128,273,280, - 283,284,287,282,286,292,293,296,298,301, - 294,299,304,307,309,314,316,319,312,139, - 324,326,327,328,332,333,320,334,337,340, - 335,344,345,347,349,351,352,356,357,137, - 359,362,363,364,366,367,368,373,369,376, - 379,377,384,386,389,390,391,393,395,396, - 398,401,399,408,400,411,412,415,416,310, - 414,418,423,419,426,427,429,430,433,434, - 436,437,440,445,441,448,449,453,455,458, - 462,465,467,463,469,471,472,454,476,473, - 479,480,481,482,484,485,487,489,492,494, - 495,499,501,503,506,507,509,512,513,517, - 518,520,521,522,525,528,531,532,534,535, - 312,312 + 1,1,1,1,1,1,77,19,20,105, + 34,24,78,53,55,29,128,54,119,80, + 39,88,89,65,143,43,61,94,146,73, + 82,148,149,97,151,102,152,153,156,21, + 159,161,157,104,166,95,168,167,75,172, + 174,177,176,180,181,184,187,188,189,191, + 195,103,113,198,202,116,114,200,196,206, + 209,211,207,213,214,217,223,218,225,226, + 221,228,233,231,236,125,235,237,239,244, + 246,238,247,248,252,259,261,262,124,264, + 266,267,268,270,130,272,274,276,278,134, + 283,284,285,286,290,288,294,296,295,300, + 303,306,302,308,309,250,311,312,318,320, + 323,316,137,328,330,331,332,336,337,324, + 338,341,344,339,348,349,351,353,355,356, + 360,361,141,363,366,367,368,370,371,372, + 373,379,377,380,381,388,390,393,382,394, + 397,297,398,399,404,405,402,412,409,413, + 416,418,419,417,422,421,426,423,427,433, + 436,437,439,438,440,441,445,448,451,452, + 453,458,459,462,466,467,470,472,474,476, + 475,477,479,485,480,487,488,489,490,492, + 494,495,497,498,502,506,503,509,511,513, + 516,517,519,524,527,523,528,531,529,533, + 540,541,534,537,544,547,548,319,319 }; }; public final static char baseAction[] = BaseAction.baseAction; @@ -162,62 +162,63 @@ public interface TermCheck { public final static byte termCheck[] = {0, 0,1,2,3,4,5,6,7,8,9, - 10,0,12,13,14,15,16,17,0,1, - 9,21,22,0,1,2,3,9,0,1, - 0,3,0,0,11,7,13,4,0,11, - 17,3,0,13,2,7,13,9,0,11, - 8,18,0,5,0,3,4,15,4,17, - 0,0,0,11,3,3,12,5,14,7, - 10,0,12,2,0,1,0,6,0,8, - 20,5,0,7,0,1,0,5,0,11, - 4,7,4,5,0,9,18,3,4,0, - 0,0,0,0,5,23,3,7,0,9, - 7,0,10,2,0,1,8,0,17,8, - 0,7,2,24,23,0,18,0,0,2, - 5,3,7,0,14,8,0,9,0,1, - 4,0,25,0,1,7,10,0,7,0, - 0,4,0,0,0,3,2,0,0,1, - 0,0,0,14,14,12,6,0,6,2, - 0,0,15,12,0,4,2,0,0,2, - 0,0,0,0,14,7,4,0,5,2, - 10,0,0,12,0,1,0,0,0,8, - 3,0,10,5,8,0,1,0,1,0, - 0,10,0,0,2,0,7,2,8,0, - 1,0,0,0,11,4,0,1,0,0, - 0,0,0,11,5,12,4,0,1,11, - 0,0,0,0,2,5,0,0,0,2, - 19,3,22,0,1,9,15,0,0,1, - 0,0,0,0,7,0,1,7,0,1, - 0,8,0,11,0,1,15,0,6,0, - 3,0,0,0,1,0,0,8,6,3, - 9,0,0,0,3,0,1,0,0,2, - 0,1,10,0,6,20,0,4,0,0, - 17,0,6,0,1,0,1,9,0,0, - 9,12,4,0,1,0,0,0,3,3, - 3,0,0,0,0,4,0,5,5,0, - 4,22,3,0,0,1,0,4,0,3, - 0,0,4,3,20,0,0,1,0,8, - 5,0,0,0,2,0,0,0,0,11, - 9,0,0,8,2,0,0,9,0,13, - 4,6,19,0,6,0,19,4,0,0, - 0,2,0,8,0,0,6,0,0,0, - 0,13,4,6,10,10,6,0,16,2, - 0,0,2,0,0,0,1,0,0,8, - 21,7,0,10,2,0,0,1,0,0, - 5,14,0,0,6,0,0,5,20,0, - 0,5,13,10,0,1,6,0,0,10, - 2,16,0,0,0,3,2,0,5,2, - 13,0,0,2,0,1,0,1,0,7, - 0,0,0,3,6,0,1,6,0,0, - 0,0,2,0,0,13,0,8,0,1, - 6,0,11,0,0,9,18,4,0,16, + 10,0,12,13,14,15,16,17,0,0, + 0,21,22,0,1,2,3,7,0,1, + 10,3,13,0,11,7,13,4,0,11, + 17,3,0,25,2,7,13,0,10,11, + 8,18,0,0,0,3,4,15,4,17, + 0,1,9,11,0,12,12,3,14,5, + 10,7,0,20,0,3,2,0,1,0, + 6,0,8,11,5,4,7,0,0,1, + 18,10,5,0,0,7,0,4,5,3, + 4,0,0,0,0,3,5,3,5,7, + 23,17,0,0,2,0,1,23,0,1, + 8,8,7,0,0,24,2,0,5,0, + 7,18,3,0,7,2,0,1,14,10, + 0,8,0,7,4,0,4,0,0,9, + 0,0,0,3,2,0,0,10,0,14, + 0,1,14,12,6,0,0,0,12,2, + 15,0,6,0,9,0,0,4,2,0, + 0,2,7,0,4,14,0,0,0,2, + 0,5,9,0,0,0,8,0,1,0, + 5,0,12,9,3,0,0,8,0,1, + 0,1,0,0,9,9,0,0,2,7, + 0,8,0,1,0,0,2,0,11,4, + 0,11,0,1,0,0,0,0,0,12, + 5,11,4,0,1,0,0,0,2,0, + 5,0,15,4,3,19,22,10,0,1, + 0,0,2,0,1,0,0,0,7,0, + 1,0,7,0,1,0,1,0,11,8, + 3,15,0,0,0,0,1,0,6,0, + 6,8,3,0,0,0,0,10,3,0, + 1,0,0,9,2,0,1,0,0,8, + 0,0,16,20,6,0,6,0,1,0, + 1,10,0,0,17,10,4,0,1,0, + 0,0,3,3,3,0,0,0,0,4, + 0,5,5,0,4,22,3,0,0,1, + 0,4,0,3,0,0,4,3,20,0, + 0,1,0,8,5,0,0,0,2,0, + 0,0,0,11,2,10,0,8,0,0, + 0,0,6,13,4,6,19,0,10,0, + 19,4,0,0,13,2,0,0,0,10, + 8,0,6,0,0,4,9,9,0,6, + 6,0,0,2,2,0,0,0,0,1, + 0,0,0,8,7,0,0,2,12,21, + 9,5,0,1,14,0,0,0,0,0, + 0,6,20,5,0,5,9,0,1,13, + 0,0,0,9,2,16,6,0,0,1, + 3,0,0,2,13,0,0,2,2,0, + 1,0,1,0,0,0,0,3,0,0, + 7,6,6,5,0,1,0,0,0,0, + 2,0,13,0,0,8,0,0,1,6, + 11,0,0,9,18,0,10,16,0,4, 0,1,0,1,6,0,0,1,0,18, - 2,0,0,19,3,10,0,0,1,0, - 0,0,2,2,0,9,7,0,16,5, - 0,0,1,0,0,0,0,10,0,0, - 0,8,12,0,0,0,0,0,0,0, - 0,0,0,0,0,21,0,0,0,0, - 0,0 + 2,19,0,0,9,2,0,0,0,3, + 0,1,0,0,2,7,0,10,16,0, + 0,2,9,0,1,5,0,0,12,0, + 0,0,0,0,8,0,0,0,0,0, + 0,0,0,0,0,0,0,0,21,0, + 0,0,0,0,0 }; }; public final static byte termCheck[] = TermCheck.termCheck; @@ -225,62 +226,63 @@ public interface TermAction { public final static char termAction[] = {0, - 312,90,79,94,81,85,92,83,80,86, - 84,312,89,87,82,93,91,77,312,138, - 143,88,78,312,104,102,105,137,312,114, - 312,115,312,312,101,113,103,98,312,112, - 100,125,312,95,134,123,99,124,312,122, - 135,97,312,158,312,109,108,136,360,133, - 312,312,312,107,96,131,111,130,110,129, - 117,35,344,163,312,106,312,165,312,164, - 118,121,312,120,312,128,312,127,312,140, - 141,330,383,382,312,142,380,146,145,312, - 312,312,312,312,149,126,179,153,2,154, - 178,312,159,180,5,185,187,312,353,181, - 312,184,199,148,160,312,186,312,312,221, - 212,217,211,312,200,222,312,216,312,241, - 259,312,311,312,119,365,260,312,116,312, - 312,132,312,312,312,147,151,312,312,156, - 312,312,312,139,144,150,155,312,162,161, - 312,312,152,157,312,167,168,312,312,170, - 312,312,312,312,166,169,171,312,173,174, - 172,312,312,176,312,182,312,312,312,175, - 183,312,177,189,188,312,381,312,379,312, - 312,384,312,312,191,312,190,194,376,312, - 192,312,312,312,193,195,312,368,312,312, - 312,312,312,196,198,369,203,312,204,197, - 312,312,312,312,354,356,312,312,312,209, - 202,207,201,312,208,206,205,312,312,343, - 312,312,312,312,210,26,215,342,312,219, - 312,218,312,214,312,331,213,16,223,312, - 220,312,312,312,322,312,312,224,225,226, - 227,312,312,312,229,312,231,312,312,232, - 312,385,230,312,234,228,312,374,312,312, - 233,312,235,312,237,312,238,236,312,312, - 240,275,239,312,242,312,312,312,243,244, - 245,312,312,312,312,246,312,247,351,312, - 249,248,250,312,312,253,312,252,312,254, - 312,312,255,256,251,312,312,334,312,257, - 258,312,312,312,326,312,312,312,312,261, - 262,312,312,324,320,312,312,264,312,323, - 266,265,263,312,316,65,321,267,312,312, - 312,373,312,378,312,312,372,312,312,312, - 312,375,270,366,268,367,269,312,371,271, - 312,45,273,312,312,312,352,312,312,358, - 272,274,312,276,346,312,312,340,312,312, - 341,277,23,312,279,312,312,280,278,312, - 312,282,337,333,312,284,319,312,312,283, - 315,281,312,312,312,285,286,312,293,287, - 318,312,312,288,312,362,312,361,312,289, - 312,312,312,291,290,312,294,292,312,312, - 312,312,329,312,312,339,312,332,312,298, - 296,312,295,312,312,297,336,359,312,325, - 312,301,312,302,300,312,312,327,312,363, - 313,312,312,299,304,303,312,312,350,312, - 312,312,307,308,312,305,306,312,364,370, - 312,312,348,312,312,312,312,309,312,312, - 312,345,349,312,312,312,312,312,312,312, - 312,312,312,312,312,355 + 319,91,80,95,82,86,93,84,81,85, + 87,319,90,88,83,94,92,78,319,319, + 319,89,79,319,105,103,106,155,319,115, + 156,116,96,319,102,114,104,99,319,113, + 101,126,319,318,135,124,100,319,125,123, + 136,98,319,319,319,110,109,137,367,134, + 319,139,118,108,319,351,112,132,111,131, + 138,130,319,119,35,142,165,319,107,319, + 167,319,166,141,122,143,121,319,319,129, + 388,144,128,319,319,337,319,391,390,148, + 147,319,319,319,319,181,151,97,160,180, + 127,360,319,2,182,5,187,162,319,120, + 183,189,186,319,319,150,202,319,215,319, + 214,188,220,319,117,224,319,245,203,219, + 319,225,319,372,263,319,133,319,319,264, + 319,319,319,149,153,319,319,145,319,140, + 319,158,146,152,157,319,319,319,159,163, + 154,319,164,319,161,319,319,169,170,319, + 319,172,171,319,173,168,319,319,319,176, + 319,175,174,319,319,319,177,319,184,319, + 191,319,178,179,185,319,319,190,319,389, + 319,387,319,319,392,192,319,319,194,193, + 319,383,319,195,319,319,197,319,196,198, + 319,199,319,375,319,319,319,319,319,376, + 201,200,206,319,207,319,319,319,361,319, + 363,319,208,381,210,205,204,209,319,211, + 319,319,212,319,350,319,319,319,213,26, + 218,319,349,319,222,319,338,16,217,221, + 223,216,319,319,319,319,329,319,226,319, + 228,227,229,319,319,319,319,230,232,319, + 234,319,319,233,235,319,393,319,319,236, + 319,319,378,231,238,319,239,319,241,319, + 242,240,319,319,237,244,243,319,246,319, + 319,319,247,248,249,319,319,319,319,250, + 319,251,358,319,253,252,254,319,319,257, + 319,256,319,258,319,319,259,260,255,319, + 319,341,319,261,262,319,319,319,333,319, + 319,319,319,265,327,266,319,331,319,319, + 319,319,269,330,270,323,267,319,268,319, + 328,271,65,319,382,380,319,319,319,272, + 385,319,379,319,319,275,273,374,319,373, + 274,319,319,276,278,45,319,319,319,359, + 319,319,319,365,279,319,319,353,280,277, + 281,348,319,347,282,319,319,319,23,319, + 319,284,283,285,319,287,340,319,289,344, + 319,319,319,288,322,286,326,3... [truncated message content] |
From: <dgr...@us...> - 2010-09-11 03:11:16
|
Revision: 16305 http://x10.svn.sourceforge.net/x10/?rev=16305&view=rev Author: dgrove-oss Date: 2010-09-11 03:10:57 +0000 (Sat, 11 Sep 2010) Log Message: ----------- XTENLANG-1120 : Change signature of main method from public static def main(Rail[String]!) to public static def main(Array[String]!) Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/visit/MainMethodFinder.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java trunk/x10.dist/samples/ArraySum.x10 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 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/FSSimpleDist.x10 trunk/x10.dist/samples/GCSpheres.x10 trunk/x10.dist/samples/HelloWholeWorld.x10 trunk/x10.dist/samples/HelloWorld.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeans.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/MontyPi.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/NQueensPar.x10 trunk/x10.dist/samples/StructSpheres.x10 trunk/x10.dist/samples/tutorial/Fib.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.dist/samples/tutorial/Integrate.x10 trunk/x10.runtime/src-cpp/x10aux/bootstrap.h trunk/x10.runtime/src-cpp/x10aux/string_utils.cc trunk/x10.runtime/src-cpp/x10aux/string_utils.h trunk/x10.runtime/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime/src-x10/x10/util/OptionsParser.x10 trunk/x10.tests/bin/testScript0 trunk/x10.tests/bin/xtestScript0 trunk/x10.tests/bin/xtestScriptCT0 trunk/x10.tests/examples/Benchmarks/DistRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/DistStream1.x10 trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/ParStream1.x10 trunk/x10.tests/examples/Benchmarks/ParUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqArray1b.x10 trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqArray2b.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1b.x10 trunk/x10.tests/examples/Benchmarks/SeqMethodCall1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2b.x10 trunk/x10.tests/examples/Benchmarks/SeqRail1.x10 trunk/x10.tests/examples/Benchmarks/SeqRail1b.x10 trunk/x10.tests/examples/Benchmarks/SeqRail2.x10 trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/SeqStream1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSGeo1.x10 trunk/x10.tests/examples/Constructs/Annotations/AggregateTest.x10.aside trunk/x10.tests/examples/Constructs/Annotations/BitsTest.x10 trunk/x10.tests/examples/Constructs/Annotations/DimTest.x10 trunk/x10.tests/examples/Constructs/Annotations/DimTest2.x10 trunk/x10.tests/examples/Constructs/Annotations/DimTest3_MustFailCompile.x10.aside trunk/x10.tests/examples/Constructs/Array/Array1.x10 trunk/x10.tests/examples/Constructs/Array/Array1DCodeGen.x10 trunk/x10.tests/examples/Constructs/Array/Array1Exploded.x10 trunk/x10.tests/examples/Constructs/Array/Array1b.x10 trunk/x10.tests/examples/Constructs/Array/Array1c.x10 trunk/x10.tests/examples/Constructs/Array/Array2v.x10 trunk/x10.tests/examples/Constructs/Array/Array3.x10 trunk/x10.tests/examples/Constructs/Array/Array31.x10 trunk/x10.tests/examples/Constructs/Array/Array3Boolean.x10 trunk/x10.tests/examples/Constructs/Array/Array3Byte.x10 trunk/x10.tests/examples/Constructs/Array/Array3Char.x10 trunk/x10.tests/examples/Constructs/Array/Array3Double.x10 trunk/x10.tests/examples/Constructs/Array/Array3DoubleSwapped.x10 trunk/x10.tests/examples/Constructs/Array/Array3Float.x10 trunk/x10.tests/examples/Constructs/Array/Array3Long.x10 trunk/x10.tests/examples/Constructs/Array/Array3Short.x10 trunk/x10.tests/examples/Constructs/Array/Array4.x10 trunk/x10.tests/examples/Constructs/Array/Array5.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3a.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank4.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank5.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithPoint.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds2D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayConstructor.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopyTo.x10 trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 trunk/x10.tests/examples/Constructs/Array/ArrayFuture.x10 trunk/x10.tests/examples/Constructs/Array/ArrayFutureFlatten.x10 trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1a.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1b.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOverRegion.x10 trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Array/ArraySerialization.x10 trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 trunk/x10.tests/examples/Constructs/Array/ArraySubtypeCheck_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/BoxArrayAssign.x10 trunk/x10.tests/examples/Constructs/Array/CheckTwice.x10 trunk/x10.tests/examples/Constructs/Array/ConstructDist2D.x10 trunk/x10.tests/examples/Constructs/Array/DimCheck.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN2.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN3.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/DimCheck_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray1D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray2D.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray2D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray4.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAndAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondOr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenFutureCall.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInVoid.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInitFor.x10 trunk/x10.tests/examples/Constructs/Array/FlattenPlaceCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenValForce.x10 trunk/x10.tests/examples/Constructs/Array/FlattenVarInit.x10 trunk/x10.tests/examples/Constructs/Array/Force.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayMaxAbs.x10 trunk/x10.tests/examples/Constructs/Array/IntValueArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayNotInitialized_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayWithInitializer.x10 trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside trunk/x10.tests/examples/Constructs/Array/MultiDimensionalJavaArray.x10 trunk/x10.tests/examples/Constructs/Array/ObjectArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/PolyRestriction1.x10 trunk/x10.tests/examples/Constructs/Array/StencilFor2D.x10 trunk/x10.tests/examples/Constructs/Array/StencilForeach2D.x10 trunk/x10.tests/examples/Constructs/Array/StencilForeach2D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/TestSimpleArrayMult.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds1D.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds2D.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 trunk/x10.tests/examples/Constructs/Async/AsyncNext.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest1.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest2.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest3.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest5.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest2.x10 trunk/x10.tests/examples/Constructs/At/AtFieldAccess.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/At/AtNext.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach2.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEachLoopOnArray.x10 trunk/x10.tests/examples/Constructs/Atomic/Atomic1.x10 trunk/x10.tests/examples/Constructs/Atomic/Atomic2.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicContainingWhen_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicMethodTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicNonLocal_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicOrdered.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicReturn.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AwaitTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AwaitTest2.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicQueue.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicTest.x10 trunk/x10.tests/examples/Constructs/Atomic/NoAsyncInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/NoAtEachInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/NoAwaitInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/NoForEachInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/NoNextInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/NoWhenInAtomic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/WhenReturn.x10 trunk/x10.tests/examples/Constructs/Atomic/WhenReturnAll.x10 trunk/x10.tests/examples/Constructs/Await/ArgMustBeBoolean_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/Block.x10 trunk/x10.tests/examples/Constructs/Call/Block2.x10 trunk/x10.tests/examples/Constructs/Call/ConConstructor1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConConstructor2Arg_2_DYNAMIC_CALLS.x10 trunk/x10.tests/examples/Constructs/Call/ConConstructor2Arg_DYNAMIC_CALLS.x10 trunk/x10.tests/examples/Constructs/Call/ConInstance1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConInstance2Arg_2.x10 trunk/x10.tests/examples/Constructs/Call/ConInstanceHere_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/ConStatic1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConStatic2Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConStatic2Arg_2.x10 trunk/x10.tests/examples/Constructs/Call/ConStructInstance1Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConStructInstance2Arg.x10 trunk/x10.tests/examples/Constructs/Call/ConStructInstance2Arg_2.x10 trunk/x10.tests/examples/Constructs/Call/StructCall.x10 trunk/x10.tests/examples/Constructs/Call/StructCall2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/StructCall_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/TestInterfaceParam_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayCast1_MustFailCompile.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayDynamicCast.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayDynamicCastFromMethod.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayDynamicCastFromMethod2.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayDynamicCastFromObject.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/ArrayIdentityCast.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/DistributionDynamicCast1.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/DistributionIdentityCast.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/RegionCastWideningClause.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/RegionDynamicCast1.x10.new trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/RegionIdentityCast.x10.new trunk/x10.tests/examples/Constructs/Cast/FloatLit.x10 trunk/x10.tests/examples/Constructs/Cast/InlineConstraint.x10 trunk/x10.tests/examples/Constructs/Cast/Int1ToInt.x10 trunk/x10.tests/examples/Constructs/Cast/Int1ToInt0_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/IntToInt1.x10 trunk/x10.tests/examples/Constructs/Cast/MacroConstraint.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentIntLitteralToConstrainedInt.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentIntLitteralToConstrainedInt_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentIntegerLitteralToConstrainedShort_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentLiteralPrimitiveToPrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentLitteralPrimitiveToPrimitiveConstrained_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentPrimitiveConstrainedIdentity.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentPrimitiveConstrainedToPrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentPrimitiveConstrainedToPrimitiveConstrained_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/AssignmentPrimitiveToPrimitiveConstrained_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastBoxedToNullablePrimitive.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastBoxedToNullablePrimitiveConstrained.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastInt3ToAny3AndBack.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastInt3ToAnyAndBack.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastInt5ToAnyAndInt3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastIntToAnyAndBack.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastLitteralToPrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastNullAnyToPrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastNullToNullablePrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastNullToNullablePrimitiveConstrained.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastNullToNullableReference.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastNullToReference_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveConstrainedToPrimitiveConstrained.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveConstrainedToPrimitiveConstrained2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveLitteralToPrimitiveConstrained1.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveLitteralToPrimitiveConstrained_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveToPrimitiveConstrained1.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/CastPrimitiveToPrimitiveConstrained2.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Float_ConstraintDeclaredAsDouble_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Float_ConstraintDeclaredAsFloat.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Integer_ConstraintWithVariable.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Long_ConstrainedDeclaredAsIntegerOverflow2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Long_ConstrainedDeclaredAsIntegerOverflow_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Long_ConstraintDeclaredAsInteger.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Long_ConstraintDeclaredAsLong.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_1.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_2.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_3.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_4.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_5.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/NumericExpressionToPrimitiveDepType_8.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/PrimitiveAssignment.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/PrimitiveDepTypeAssignmentOverflow.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/PrimitiveDepTypeCast_Overflow1.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Short_ConstraintDeclaredAsInteger.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/Short_ConstraintDeclaredAsShort.x10.aside trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxNullablePrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxNullablePrimitiveConstrained.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxNullablePrimitiveConstrained2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxPrimitive.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxPrimitiveConstrained.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxPrimitiveConstrained1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/UnboxPrimitiveConstrained2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/AssignmentNullToConstrainedNullable_MustFailCompile.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastConstrainedNullableToConstrainedNonNullable.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastConstrainedToConstrainedNullable_MustFailCompile.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastConstraintOnThis.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNegativeConstraint.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNullNullableToConstrained.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNullNullableToNonNullable.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNullNullableToNullable.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNullToConstrainedNullable.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/CastNullableToNonNullable.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/ClassDepTypeCastWideningClause.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/ClassDepTypeCastWideningClause_MustFailCompile.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast1.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast2.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast3_Object.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast4_MethodReturn.x10 trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast5_MethodReturn.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCast6_DepTypeVariables.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCastDownCastHeritage.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCastInterface1_Object.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/DynamicCastUpCastHeritage.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/StaticCastWithHeritage.x10.new trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/X10DepTypeClassOne.x10 trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/X10DepTypeClassTwo.x10 trunk/x10.tests/examples/Constructs/Class/ConstructorsWithInferredTypes.x10 trunk/x10.tests/examples/Constructs/Class/InconsistentInvariant_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Class/InnerClass.x10 trunk/x10.tests/examples/Constructs/Clock/ClockFuture.x10 trunk/x10.tests/examples/Constructs/Clock/ClockPascal.x10.aside trunk/x10.tests/examples/Constructs/Clock/ClockPascal2.x10.aside trunk/x10.tests/examples/Constructs/Clock/ClockTest.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest1.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest10.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest10a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest11.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest12.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest13.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest14.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest15.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest15WithResume.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest17_MustFailTimeout.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest18.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest2.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest3.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest3a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest3b.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest4.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest5.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest6.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest7.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest8.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest9.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureBody1a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureBody1b.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureBody1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureBody2.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall0a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall0b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1c_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1d_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall2.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall3.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraint2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraint3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraint4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraint5_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraint6_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureConstraintWithGuard.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1b.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1d.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope1s.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope2a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope2b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope2c_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope2d_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope3.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope4.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope5.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExampleCollectionApplyToAll.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureException2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExceptionThrowsClause.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureExceptionThrowsClause2.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureExceptionThrowsClause3.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureExceptionThrowsClause4.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureExceptionThrowsClause5.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureFormalParameters1a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureFormalParameters1b.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureFormalParameters1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureFormalParameters1d.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureFunctionType1.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureObject1.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureObject3.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType4.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType5_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureReturnType7_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1b.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1d.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1e.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1f.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1g.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1h.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1i.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters1j.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2a.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2b.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2c.x10.aside trunk/x10.tests/examples/Constructs/Closures/ClosureTypeParameters2c_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/Closures1.x10 trunk/x10.tests/examples/Constructs/Closures/Closures2.x10 trunk/x10.tests/examples/Constructs/Closures/Closures3.x10 trunk/x10.tests/examples/Constructs/Closures/Closures4.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector1.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector2.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector3.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector4.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector5.x10 trunk/x10.tests/examples/Constructs/Closures/MethodSelector6.x10.aside trunk/x10.tests/examples/Constructs/Closures/MethodSelector7.x10.aside trunk/x10.tests/examples/Constructs/Closures/MethodSelector8.x10.aside trunk/x10.tests/examples/Constructs/Closures/OperatorSelector1.x10.aside trunk/x10.tests/examples/Constructs/CollectingFinish/CF1.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF10.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF1Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF2.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF2Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3Generic.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3Generic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF5_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF6.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF7.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF8.x10 trunk/x10.tests/examples/Constructs/CollectingFinish/CF9.x10 trunk/x10.tests/examples/Constructs/Constructor/PropertyAssign.x10 trunk/x10.tests/examples/Constructs/Conversion/SubtypeCheckForUserDefinedConversion_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/BooleanTrueTest.x10 trunk/x10.tests/examples/Constructs/DepType/CallLaterMethod.x10 trunk/x10.tests/examples/Constructs/DepType/CallMethodTest.x10 trunk/x10.tests/examples/Constructs/DepType/CallMethodTest_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CastChecking1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CastChecking_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CharLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/CharLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CheckDescendEntails.x10 trunk/x10.tests/examples/Constructs/DepType/CheckDescendEntails_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CheckEqualTypes.x10 trunk/x10.tests/examples/Constructs/DepType/ClassDepClause.x10 trunk/x10.tests/examples/Constructs/DepType/ClassDepClause_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ClosureInClassDepClause_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CondAnd.x10 trunk/x10.tests/examples/Constructs/DepType/ConsistentInterfaceInvariants.x10 trunk/x10.tests/examples/Constructs/DepType/ConstructorInvocation.x10 trunk/x10.tests/examples/Constructs/DepType/ConstructorInvocation2.x10 trunk/x10.tests/examples/Constructs/DepType/ConstructorInvocation_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/CovariantReturnFromAnonymousClass.x10 trunk/x10.tests/examples/Constructs/DepType/DepClauseForBoxedType.x10 trunk/x10.tests/examples/Constructs/DepType/DepClauseForNullableType.x10.new trunk/x10.tests/examples/Constructs/DepType/DepType.x10 trunk/x10.tests/examples/Constructs/DepType/DepType1.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodArg.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodArgDependsOnArg.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodArg_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodRet.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodRet1.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodRet1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodRet_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeRef.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeThisClause.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeVariableVisibility_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DoubleLit.x10 trunk/x10.tests/examples/Constructs/DepType/DoubleLitCoercion.x10 trunk/x10.tests/examples/Constructs/DepType/DoubleLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/DoubleLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/EntailsPositiveInnerMustPass.x10 trunk/x10.tests/examples/Constructs/DepType/EntailsPositiveInner_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/EntailsPositive_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/EqualityBoolean.x10 trunk/x10.tests/examples/Constructs/DepType/EqualityInteger.x10 trunk/x10.tests/examples/Constructs/DepType/EquivClause_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/Extends.x10 trunk/x10.tests/examples/Constructs/DepType/FieldDepType.x10 trunk/x10.tests/examples/Constructs/DepType/FieldPropFromThis.x10 trunk/x10.tests/examples/Constructs/DepType/FieldsMustBeFinalInDepClause.x10 trunk/x10.tests/examples/Constructs/DepType/FloatLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/FloatLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/GuardedMethodAccess.x10 trunk/x10.tests/examples/Constructs/DepType/GuardedMethodAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InconsistentInterfaceInvariants_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InheritedClause.x10 trunk/x10.tests/examples/Constructs/DepType/InheritedClause_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InnerDepType.x10 trunk/x10.tests/examples/Constructs/DepType/IntDepType.x10 trunk/x10.tests/examples/Constructs/DepType/IntDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/IntLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/IntLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InterfaceProp.x10 trunk/x10.tests/examples/Constructs/DepType/InterfaceProp_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InterfaceTypeInvariant.x10 trunk/x10.tests/examples/Constructs/DepType/InterfaceTypeInvariant_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/LongLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/LongLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/MethodArgDepTypes.x10 trunk/x10.tests/examples/Constructs/DepType/MethodArgDepTypes2.x10 trunk/x10.tests/examples/Constructs/DepType/MethodInvocation.x10 trunk/x10.tests/examples/Constructs/DepType/MethodInvocation_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/NegIntLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/NoDepClause.x10 trunk/x10.tests/examples/Constructs/DepType/NonBooleanConstraint_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/NonFinalField_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/NonFinalVariable_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/Prop.x10 trunk/x10.tests/examples/Constructs/DepType/Prop1.x10 trunk/x10.tests/examples/Constructs/DepType/PropMustBeVisibleInOtherProps.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyMustBeAssignedInConsBody_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyNotInvoked2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyNotInvoked_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyPropagationTest.x10 trunk/x10.tests/examples/Constructs/DepType/PropsMustBeVisibleInClassInvariant.x10 trunk/x10.tests/examples/Constructs/DepType/PropsMustBeVisibleInValueInvariant.x10 trunk/x10.tests/examples/Constructs/DepType/PropsMustBeVisibleToOtherPropsInValue.x10 trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10.aside trunk/x10.tests/examples/Constructs/DepType/RailTest.x10 trunk/x10.tests/examples/Constructs/DepType/RefToSameFieldInDepClause.x10 trunk/x10.tests/examples/Constructs/DepType/ReferenceConsistencyCheck.x10 trunk/x10.tests/examples/Constructs/DepType/SameNameGuardedFieldAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SamePropertyAncestor_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SameSignatureMethod_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SelfFieldLocalVarShadow_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SelfFieldsMustBeProperties1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SelfFieldsMustBeProperties_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/StaticReturn.x10 trunk/x10.tests/examples/Constructs/DepType/StringLitDepType.x10 trunk/x10.tests/examples/Constructs/DepType/StringLitDepType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/SuperExtendsRule_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ThisInConstructorReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ThisPropogatedToReturnType.x10 trunk/x10.tests/examples/Constructs/DepType/ThisRestrictionsConstructorContext_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ThisRestrictionsStaticContext_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/Transitive.x10 trunk/x10.tests/examples/Constructs/DepType/Transitivity.x10 trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularField.x10 trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/CircularLV.x10 trunk/x10.tests/examples/Constructs/DepType/UninitializedProperty_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ValueProp.x10 trunk/x10.tests/examples/Constructs/DepType/ValueProp1.x10 trunk/x10.tests/examples/Constructs/DepType/VarBeingDefinedInType.x10 trunk/x10.tests/examples/Constructs/DepType/VarBeingDefinedInType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/VariableMustBeFinalInDepClause.x10 trunk/x10.tests/examples/Constructs/Distribution/ArrayToDist.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDist2.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDistWithPlaceSet.x10 trunk/x10.tests/examples/Constructs/Distribution/ConstDist.x10 trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra.x10.aside trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra2.x10.aside trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra3.x10.aside trunk/x10.tests/examples/Constructs/Distribution/DistBounds1D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds2D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds3D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistributionTest.x10 trunk/x10.tests/examples/Constructs/Distribution/DistributionTest1.x10 trunk/x10.tests/examples/Constructs/Distribution/PolyConst1.x10 trunk/x10.tests/examples/Constructs/Distribution/PolyDistAlgebra1.x10.aside trunk/x10.tests/examples/Constructs/Distribution/Restrict.x10 trunk/x10.tests/examples/Constructs/Exceptions/ExceptionBug_MustFailRun.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions2.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions3_MustFailTimeout.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions_BadPlace.x10.new trunk/x10.tests/examples/Constructs/Extern/AllArrayExternUnsafe.x10.new trunk/x10.tests/examples/Constructs/Extern/BasicExternTest1.x10.new trunk/x10.tests/examples/Constructs/Extern/IntArrayExternUnsafe.x10.new trunk/x10.tests/examples/Constructs/Extern/JacobiExtern.x10.new trunk/x10.tests/examples/Constructs/Extern/RandomAccess_longExtern.x10.new trunk/x10.tests/examples/Constructs/Final/ImplicitFinal.x10 trunk/x10.tests/examples/Constructs/Final/ImplicitFinal2.x10 trunk/x10.tests/examples/Constructs/Finish/FinishTest1.x10 trunk/x10.tests/examples/Constructs/Finish/FinishTest2.x10 trunk/x10.tests/examples/Constructs/For/ForLoop.x10 trunk/x10.tests/examples/Constructs/For/ForLoop2.x10 trunk/x10.tests/examples/Constructs/For/ForLoop3.x10 trunk/x10.tests/examples/Constructs/For/ForLoop4.x10 trunk/x10.tests/examples/Constructs/For/ForLoopOnArray.x10 trunk/x10.tests/examples/Constructs/ForEach/Foreach1.x10 trunk/x10.tests/examples/Constructs/ForEach/Foreach2.x10 trunk/x10.tests/examples/Constructs/Fun/FunIsNotObject_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Fun/GuardedFunctionInvocation.x10.aside trunk/x10.tests/examples/Constructs/Fun/GuardedFunctionInvocationWithType.x10.aside trunk/x10.tests/examples/Constructs/Fun/GuardedFunctionInvocation_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Future/Future0.x10 trunk/x10.tests/examples/Constructs/Future/Future0a.x10 trunk/x10.tests/examples/Constructs/Future/Future1.x10 trunk/x10.tests/examples/Constructs/Future/Future1a.x10 trunk/x10.tests/examples/Constructs/Future/FutureDeadlock_MustFailTimeout.x10 trunk/x10.tests/examples/Constructs/Future/FutureForce.x10 trunk/x10.tests/examples/Constructs/Future/FutureForced.x10 trunk/x10.tests/examples/Constructs/Future/FutureNullable0.x10.new trunk/x10.tests/examples/Constructs/Future/FutureNullable1Boxed.x10.new trunk/x10.tests/examples/Constructs/Future/FutureTest2.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest3.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest5.x10 trunk/x10.tests/examples/Constructs/GC/RemoteRef.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds1.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds2.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds3.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds4.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds5.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds6.x10 trunk/x10.tests/examples/Constructs/Generics/Bounds7.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast01.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast02.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericCast03.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast08.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast09.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast10.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericCast11.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast12.x10 trunk/x10.tests/examples/Constructs/Generics/GenericCast13.x10 trunk/x10.tests/examples/Constructs/Generics/GenericConstraint01_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericConstraint02_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericExample1.x10 trunk/x10.tests/examples/Constructs/Generics/GenericExample2.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInference1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInference2.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInference3.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInference4.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance01.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance02.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericInheritance03.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInheritance08.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof01.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof02.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof03.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof08.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof09.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof10.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof11.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof12.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof13.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof14.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof15.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof16.x10 trunk/x10.tests/examples/Constructs/Generics/GenericInstanceof17.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethodEquals.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods1.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods2.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods3.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods5_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethods6.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives1.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives1x.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives2.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives2x.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives3.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives3x.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverPrimitives4.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading01_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading02_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading03_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading04_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading07_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading08.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading09.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading10.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading11_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading12_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading13_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading14.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding01.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding02.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding03.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding08_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding09_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding10_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding11_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding12.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding13.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance01.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance02_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance03_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance06_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance08_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericVariance09.x10 trunk/x10.tests/examples/Constructs/Generics/Generics1.x10 trunk/x10.tests/examples/Constructs/Generics/Generics2.x10 trunk/x10.tests/examples/Constructs/Generics/Generics3.x10 trunk/x10.tests/examples/Constructs/Generics/Generics4.x10 trunk/x10.tests/examples/Constructs/Generics/Generics5.x10 trunk/x10.tests/examples/Constructs/Generics/GenericsInheritance1.x10 trunk/x10.tests/examples/Constructs/Generics/GenericsInheritance2.x10.aside trunk/x10.tests/examples/Constructs/Generics/GenericsInheritance2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/GenericsInheritance3.x10.aside trunk/x10.tests/examples/Constructs/Generics/Subclassing1.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing2.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing3.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing4.x10 trunk/x10.tests/examples/Constructs/Generics/Variance1.x10 trunk/x10.tests/examples/Constructs/Generics/Variance2.x10 trunk/x10.tests/examples/Constructs/Generics/Variance2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/Variance3.x10 trunk/x10.tests/examples/Constructs/Generics/Variance3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/If/DanglingElse.x10 trunk/x10.tests/examples/Constructs/Import/ClassPathTest.x10 trunk/x10.tests/examples/Constructs/Import/ImportTest.x10 trunk/x10.tests/examples/Constructs/Import/ImportTestPackage1/SubPackage/T3.x10 trunk/x10.tests/examples/Constructs/Inference/Inference1.x10 trunk/x10.tests/examples/Constructs/Inference/Inference2.x10 trunk/x10.tests/examples/Constructs/Inference/Inference3.x10 trunk/x10.tests/examples/Constructs/Inference/Inference4.x10 trunk/x10.tests/examples/Constructs/Inference/Inference5.x10 trunk/x10.tests/examples/Constructs/Inference/Inference6.x10 trunk/x10.tests/examples/Constructs/Inference/LCA1.x10 trunk/x10.tests/examples/Constructs/Inference/LCAClassAClassB.x10 trunk/x10.tests/examples/Constructs/Inference/LCAClassAStructB.x10 trunk/x10.tests/examples/Constructs/Inference/LCAClassAStructB_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Inference/LCAClassASubclassB.x10 trunk/x10.tests/examples/Constructs/Inference/TypeArgInference1.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedInterfaceMethod.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedInvariantMustBeEntailed_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedProperty2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedProperty3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedProperty_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Init/InitNonNullable_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Instanceof/BoxObjectToBoxConstrainedType.x10 trunk/x10.tests/examples/Constructs/Instanceof/ConstrainedTypeTests.x10 trunk/x10.tests/examples/Constructs/Instanceof/InstanceofDownCast.x10 trunk/x10.tests/examples/Constructs/Instanceof/InstanceofDownCast1.x10 trunk/x10.tests/examples/Constructs/Instanceof/InstanceofDownCast2.x10 trunk/x10.tests/examples/Constructs/Instanceof/NotInstanceof1_Inline.x10 trunk/x10.tests/examples/Constructs/Instanceof/NotInstanceof2_Method.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullObjectToBox.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullObjectToNullableConstrained.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToBoxConstrainedType.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToBoxPrimitive.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToBoxType.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToConstrainedType.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToNullablePrimitiveConstraint.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToPrimitive_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullToRegularType_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullableObjectToBoxConstrainedType.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullableObjectToBoxConstrainedType2.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullableObjectToBoxConstrainedType3.x10 trunk/x10.tests/examples/Constructs/Instanceof/NullableObjectToConstrainedType2.x10 trunk/x10.tests/examples/Constructs/Instanceof/ObjectToNullablePrimitive.x10 trunk/x10.tests/examples/Constructs/Instanceof/ObjectToNullablePrimitiveConstrained1.x10 trunk/x10.tests/examples/Constructs/Instanceof/ObjectToNullablePrimitiveConstrained2.x10 trunk/x10.tests/examples/Constructs/Instanceof/ObjectToPrimitive.x10 trunk/x10.tests/examp... [truncated message content] |
From: <yz...@us...> - 2010-09-12 02:05:15
|
Revision: 16313 http://x10.svn.sourceforge.net/x10/?rev=16313&view=rev Author: yzibin Date: 2010-09-12 02:05:06 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Implemented the new object init rules, removed proto from the compiler! Modified Paths: -------------- trunk/x10.compiler/src/polyglot/visit/DataFlow.java trunk/x10.compiler/src/polyglot/visit/FwdReferenceChecker.java trunk/x10.compiler/src/polyglot/visit/InitChecker.java trunk/x10.compiler/src/x10/Configuration.java trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/errors/Errors.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/ConstrainedType.java trunk/x10.compiler/src/x10/types/ConstrainedType_c.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/X10ClassType.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10MethodDef.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10NullType_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/X10UnknownType_c.java trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.tests/examples/Constructs/Array/TestArray.x10 trunk/x10.tests/examples/Issues/XTENLANG_198.x10 Removed Paths: ------------- trunk/x10.compiler/src/x10/types/Proto.java trunk/x10.tests/tests/Constructs/Proto/ Modified: trunk/x10.compiler/src/polyglot/visit/DataFlow.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/DataFlow.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/polyglot/visit/DataFlow.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -408,14 +408,14 @@ * the <code>FlowGraph</code> onto the stack of <code>FlowGraph</code>s if * dataflow analysis is performed on entry to <code>CodeNode</code> nodes. */ - protected void dataflow(CodeDecl cd) { + public void dataflow(CodeDecl cd) { this.dataflow((CodeNode) cd); } public void reportError(String msg, Position p) { errorQueue().enqueue(ErrorInfo.SEMANTIC_ERROR,msg,p); } - protected void dataflow(CodeNode cd) { + public void dataflow(CodeNode cd) { // only bother to do the flow analysis if the body is not null... if (cd.codeBody() != null) { // Compute the successor of each child node. Modified: trunk/x10.compiler/src/polyglot/visit/FwdReferenceChecker.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/FwdReferenceChecker.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/polyglot/visit/FwdReferenceChecker.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -17,7 +17,9 @@ /** Visitor which ensures that field intializers and initializers do not * make illegal forward references to fields. * This is an implementation of the rules of the Java Language Spec, 2nd - * Edition, Section 8.3.2.3 + * Edition, Section 8.3.2.3 + * + * Yoav: It now only checks for illegal forward ref of static fields. */ public class FwdReferenceChecker extends ContextVisitor { @@ -26,29 +28,23 @@ } private boolean inInitialization = false; - private boolean inStaticInit = false; private Set<FieldDef> declaredFields = new HashSet<FieldDef>(); protected NodeVisitor enterCall(Node n) throws SemanticException { if (n instanceof FieldDecl) { FieldDecl fd = (FieldDecl)n; + if (fd.flags().flags().isStatic()) { declaredFields.add(fd.fieldDef()); - FwdReferenceChecker frc = (FwdReferenceChecker)this.copy(); frc.inInitialization = true; - frc.inStaticInit = fd.flags().flags().isStatic(); return frc; + } } - else if (n instanceof Initializer) { + else if (n instanceof Initializer && ((Initializer)n).flags().flags().isStatic()) { FwdReferenceChecker frc = (FwdReferenceChecker)this.copy(); frc.inInitialization = true; - frc.inStaticInit = ((Initializer)n).flags().flags().isStatic(); return frc; } - else if (n instanceof FieldAssign) { - FwdReferenceChecker frc = (FwdReferenceChecker)this.copy(); - return frc; - } else if (n instanceof Field) { if (inInitialization) { // we need to check if this is an illegal fwd reference. @@ -60,16 +56,13 @@ // interface of the usage is the same as the container of // the field, and we have not yet seen the field declaration. // - // In addition, if a field is not accessed as a simple name, - // then all is ok ClassType currentClass = context().currentClass(); StructType fContainer = f.fieldInstance().container(); - if (inStaticInit == f.fieldInstance().flags().isStatic() && + if (f.fieldInstance().flags().isStatic() && currentClass.typeEquals(fContainer, context) && !declaredFields.contains(f.fieldInstance().def()) - //&& f.isTargetImplicit() - see XTENLANG-1801 ) { throw new SemanticException("Illegal forward reference", f.position()); @@ -79,4 +72,3 @@ return this; } } - Modified: trunk/x10.compiler/src/polyglot/visit/InitChecker.java =================================================================== --- trunk/x10.compiler/src/polyglot/visit/InitChecker.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/polyglot/visit/InitChecker.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -431,10 +431,9 @@ throw new InternalCompilerError("ClassBody found but cannot find the class.", n.position()); } setupClassBody(ct, cb); - //n = cb; //todo? } - return super.enterCall(n); // todo: we changed "cb", why not pass it here? + return super.enterCall(n); } /** @@ -508,7 +507,7 @@ ClassMember cm = (ClassMember)classMembers.next(); if (cm instanceof FieldDecl) { FieldDecl fd = (FieldDecl)cm; - if (fd.flags().flags().isFinal()) { + if (fd.flags().flags().isFinal()) { //todo MinMaxInitCount initCount; if (fd.init() != null) { // the field has an initializer @@ -1155,8 +1154,26 @@ Field f, DataFlowItem dfIn, DataFlowItem dfOut) { - if (isFieldsTargetAppropriate(f) && f.flags().isFinal() && (currCBI.currCodeDecl instanceof ConstructorDecl || currCBI.currCodeDecl instanceof FieldDecl)) { - MinMaxInitCount initCount = dfIn.initStatus.get(f.fieldInstance().def()); + boolean isFinal = f.flags().isFinal(); + boolean isCtor = currCBI.currCodeDecl instanceof ConstructorDecl; + boolean isFieldInit = currCBI.currCodeDecl instanceof FieldDecl; + /* + This is a legal pattern (so we should only check VAR in field-initializers, not in ctors. + class Bar { + var i:Int{self!=0}; + def this() { + foo(); + i++; + } + def foo() { i=2; } + } + */ + if (isFieldsTargetAppropriate(f) && + isFinal && // I want to check that field initialization does not have illegal forward references for VAL only (VAR is checked by CheckEscapingThis). + (isCtor || isFieldInit)) { + final FieldDef fieldDef = f.fieldInstance().def(); + MinMaxInitCount initCount = + dfIn.initStatus.get(fieldDef); if (initCount != null && initCount.getMin().isZero()) { // the field may not have been initialized. // However, we only want to complain if the field is reachable Modified: trunk/x10.compiler/src/x10/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10/Configuration.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/Configuration.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -33,11 +33,6 @@ */ public static final ConfigurationError LOAD_ERROR; - - public static boolean NO_PROTO = false; - private static final String NO_PROTO_desc = "Typecheck classes with the new No-proto rules"; - - public static boolean CHECK_INVARIANTS = false; private static final String CHECK_INVARIANTS_desc = "Check AST invariants such as position containment, existence of xxxInstance(), etc"; Modified: trunk/x10.compiler/src/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -407,8 +407,7 @@ goals.add(CheckASTForErrors(job)); // goals.add(TypeCheckBarrier()); - if (Configuration.NO_PROTO) - goals.add(new VisitorGoal("CheckEscapingThis", job, new CheckEscapingThis.Main(job))); + goals.add(new VisitorGoal("CheckEscapingThis", job, new CheckEscapingThis.Main(job))); goals.add(End(job)); } Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -428,18 +428,9 @@ X10Call_c call = (X10Call_c) this.targetImplicit(true).target(r).arguments(args); Type rt = X10Field_c.rightType(mi.rightType(), mi.x10Def(), r, (X10Context) tc.context()); call = (X10Call_c)call.methodInstance(mi).type(rt); - call.checkProtoMethod(); return call; } - void checkProtoMethod() throws SemanticException { - if (X10TypeMixin.isProto(target().type()) - && ! X10Flags.toX10Flags(methodInstance().flags()).isProto() - ) - throw new SemanticException(methodInstance() - + " must be declared as a proto method since it is called on a receiver " + - target() + " with a proto type."); - } XVar getThis(Type t) { t = X10TypeMixin.baseType(t); if (t instanceof X10ClassType) { @@ -691,7 +682,6 @@ methodCall = (X10Call_c) methodCall.arguments(args); if (this.target() == null) methodCall = (X10Call_c) methodCall.targetImplicit(true).target(target); - methodCall.checkProtoMethod(); // Eliminate for orthogonal locality. // methodCall = (X10Call_c) PlaceChecker.makeReceiverLocalIfNecessary(methodCall, tc); //methodCall.checkConsistency(c); // [IP] Removed -- this is dead code at this point Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -730,10 +730,6 @@ t + "; not a class.", superClass != null ? superClass.position() : position()); } - if (X10TypeMixin.isProto(t)) { - throw new SemanticException("proto supertypes are not permitted.", - superClass().position()); - } ts.checkCycles((ReferenceType) t); } @@ -747,9 +743,6 @@ throw new SemanticException("Cannot " + s + " type " + t + "; not an interface.", position()); } - if (X10TypeMixin.isProto(t)) - throw new SemanticException("Cannot implement " + t + "; proto interfaces are illegal.", - position()); ts.checkCycles((ReferenceType) t); } Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -429,16 +429,7 @@ // Report.report(1, "X10MethodDecl_c: typeoverride mi= " + nn.methodInstance()); - - /* Type retTypeBase = X10TypeMixin.baseOfProto(r.type()); - //Type clazz = ((X10Type) X10TypeMixin.baseType(Types.get(nnci.container()))).addFlags(X10Flags.ROOTED); - Type clazz = X10TypeMixin.baseOfProto(Types.get(nnci.container())); - if (! xts.typeEquals(retTypeBase, clazz, tc.context())) { - throw new SemanticException("The return type of the constructor (" + retTypeBase - + ") must be derived from" - + " the type of the class (" + clazz + ") on which the constructor is defined.", - position()); - }*/ + // Step III. Check the body. // We must do it with the correct mi -- the return type will be @@ -502,10 +493,6 @@ } n = (X10ConstructorDecl_c) (super.typeCheck(tc)); - final Type returnT = n.returnType().type(); - X10TypeMixin.protoTypeCheck(n.formals(), returnT, - n.position(), false); - return n; } @@ -513,9 +500,8 @@ X10ConstructorDecl_c n = (X10ConstructorDecl_c) super.conformanceCheck(tc); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - Type retTypeBase = X10TypeMixin.baseOfProto(n.returnType().type()); + Type retTypeBase = n.returnType().type(); retTypeBase = X10TypeMixin.baseType(retTypeBase); - CConstraint c = X10TypeMixin.xclause(n.returnType().type()); X10ConstructorDef nnci = (X10ConstructorDef) n.constructorDef(); // Type clazz = ((X10Type) nnci.asInstance().container()).setFlags(X10Flags.ROOTED); Modified: trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -75,31 +75,10 @@ SemanticException e = new Errors.CannotAssignToProperty(fd, n.position()); Errors.issue(tc.job(), e, n); } - Type targetType = n.target().type(); if (t == null) t = ts.unknownType(n.position()); - Expr right = n.right(); - Assign.Operator op = n.operator(); - - Type s = right.type(); - - // Check the proto condition. - if (X10TypeMixin.isProto(s)) { - try { - if (! X10TypeMixin.isProto(targetType)) - throw new Errors.ProtoValuesAssignableOnlyToProtoReceivers(this.right(), this, position()); - if (op != ASSIGN) - throw new Errors.ProtoValuesAssignableOnlyUsingEquals(right(), position()); - s = X10TypeMixin.baseOfProto(s); - if (! (ts.isSubtype(s, t, tc.context()))) - throw new Errors.CannotAssign(n.right(), n.target().type(), n.position); - } catch (SemanticException e) { - Errors.issue(tc.job(), e, this); - } - } - X10Field_c target = (X10Field_c) n.left(); // Not needed in the orthogonal locality proposal. //try { Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -405,9 +405,6 @@ type = ts.unknownType(position()); } - if (X10TypeMixin.isProto(type)) { - Errors.issue(tc.job(), new SemanticException("Field cannot have type " + type + " (a proto type).", position())); - } if (X10TypeMixin.isX10Struct(fieldDef().container().get()) && !isMutable(ts, fieldDef().container().get()) && Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -87,19 +87,7 @@ public Node typeCheck(ContextVisitor tc) { Node n; try { - n = typeCheck1(tc); - // Keep this at the very end. This is caught by - // handle proto. - X10TypeMixin.checkMissingParameters(this); - if (! ((X10Context) tc.context()).inAssignment()) { - if (n instanceof X10Field_c) { - Field nf = (Field) n; - Type xtType = nf.target().type(); - if (X10TypeMixin.isProto(xtType)) { - throw new Errors.CannotReadFieldOfProtoValue(nf, nf.position()); - } - } - } + n = typeCheck1(tc); } catch (SemanticException e) { Errors.issue(tc.job(), e, this); Type tType = target != null ? target.type() : tc.context().currentClass(); Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -408,10 +408,6 @@ throw new SemanticException("An extern method cannot have a body.", position()); } - if (xf.isProto() && xf.isStatic()) { - throw new SemanticException("Only instance method may have a proto flag.", - position()); - } // Set the native flag if incomplete or extern so super.checkFlags doesn't complain. if (xf.isIncomplete() || xf.isExtern()) @@ -498,8 +494,6 @@ dupFormalCheck(typeParameters, formals); - X10TypeMixin.protoTypeCheck(formals(), returnType().type(), position(), - true); X10TypeMixin.checkMissingParameters(n.returnType()); return n; } Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -434,9 +434,6 @@ Type tp = ci.returnType(); tp = PlaceChecker.ReplaceHereByPlaceTerm(tp, (X10Context) tc.context()); Type tp1 = (Type) tp.copy(); - if (X10TypeMixin.isProto(tp1)) { - tp1 = X10TypeMixin.baseOfProto(tp1); - } if (!ts.isSubtype(tp1, t, tc.context())) { throw new SemanticException("Constructor return type " + tp + " is not a subtype of " + t + ".", position()); Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -94,25 +94,7 @@ X10ConstructorDef cd = (X10ConstructorDef) c.currentCode(); Type returnType = cd.returnType().get(); returnType = ts.expandMacros(returnType); - // Set the type of this to be proto T, where T is the return - // type of the constructor. - returnType = X10TypeMixin.makeProto(returnType); - /* - if (returnType.isClass()) { - t = (ClassType) X10TypeMixin.makeProto(returnType); - } - else { - throw new SemanticException("Constructor return type is not a class type.", cd.position()); - }*/ - } else - // Check if this is a proto method, then the type of this needs - // to be set to proto C - if (c.currentCode() instanceof X10MethodDef) { - X10MethodDef cd = (X10MethodDef) c.currentCode(); - if (cd.isProto()) { - t = X10TypeMixin.makeProto(t); - } - } + } } else { if (qualifier.type().isClass()) { @@ -125,9 +107,6 @@ c.currentClass() + "\" does not have an enclosing instance of type \"" + ct + "\".", qualifier.position()); } - if (cd instanceof X10ConstructorDef - || (cd instanceof X10MethodDef && ((X10MethodDef) cd).isProto())) - t = X10TypeMixin.makeProto(ct); } else { Modified: trunk/x10.compiler/src/x10/errors/Errors.java =================================================================== --- trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -90,7 +90,6 @@ } public static interface DepTypeException {} - public static interface ProtoTypeException {} public static interface ConversionException {} public static class CannotAssign extends SemanticException { @@ -283,48 +282,6 @@ } } - public static class CannotReadFieldOfProtoValue extends SemanticException implements ProtoTypeException { - private static final long serialVersionUID = -512760271069318563L; - public CannotReadFieldOfProtoValue(Field f,Position pos) { - super("Cannot read field of a proto value." - + "\n\t Field: " + f - + "\n\t Proto value:" + f.target(), pos); - } - public boolean equals(Object o) { - if (o==null || ! (o instanceof CannotReadFieldOfProtoValue) ) - return false; - return((CannotReadFieldOfProtoValue)o).position().equals(position()); - } - } - public static class ProtoValuesAssignableOnlyToProtoReceivers extends SemanticException implements ProtoTypeException { - private static final long serialVersionUID = -6741587508354666830L; - public ProtoValuesAssignableOnlyToProtoReceivers(Expr e, FieldAssign f, Position pos) { - super("A proto value can be assigned to a field only if receiver type is proto." - + "\n\t Value: " + e - + "\n\t Field: " + f.name() - + "\n\t Target: " + f.target() - + "\n\t Target type: " + f.target().type(), - pos); - } - public boolean equals(Object o) { - if (o==null || ! (o instanceof ProtoValuesAssignableOnlyToProtoReceivers) ) - return false; - return((ProtoValuesAssignableOnlyToProtoReceivers)o).position().equals(position()); - } - } - public static class ProtoValuesAssignableOnlyUsingEquals extends SemanticException implements ProtoTypeException { - private static final long serialVersionUID = -7997300104807372345L; - public ProtoValuesAssignableOnlyUsingEquals(Expr e, Position pos) { - super("A proto value assignment to a field must use \"=\" assignment operator." - + "\n\t Value: " + e, - pos); - } - public boolean equals(Object o) { - if (o==null || ! (o instanceof ProtoValuesAssignableOnlyUsingEquals) ) - return false; - return((ProtoValuesAssignableOnlyUsingEquals)o).position().equals(position()); - } - } public static class CannotConvertToType extends SemanticException implements ConversionException { private static final long serialVersionUID = 5580836853775144578L; Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -454,7 +454,6 @@ if (flag == PRIVATE) return Flags.PRIVATE; if (flag == PROPERTY) return X10Flags.PROPERTY; if (flag == PROTECTED) return Flags.PROTECTED; - if (flag == PROTO) return X10Flags.PROTO; if (flag == PUBLIC) return Flags.PUBLIC; if (flag == SAFE) return X10Flags.SAFE; if (flag == SEQUENTIAL) return X10Flags.SEQUENTIAL; @@ -2471,22 +2470,8 @@ setResult(nf.AssignPropertyCall(pos(), TypeArgumentsopt, ArgumentListopt)); break; } - + // - // Rule 68: Type ::= proto ConstrainedType - // - case 68: { - //#line 1706 "C:/eclipsews/localClasses/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1704 "C:/eclipsews/localClasses/x10.compiler/src/x10/parser/x10.g" - TypeNode ConstrainedType = (TypeNode) getRhsSym(2); - //#line 1706 "C:/eclipsews/localClasses/lpg.generator/templates/java/btParserTemplateF.gi" - AddFlags tn = (AddFlags) ConstrainedType; - tn.addFlags(X10Flags.PROTO); - setResult(ConstrainedType.position(pos())); - break; - } - - // // Rule 69: FunctionType ::= TypeParametersopt ( FormalParameterListopt ) WhereClauseopt Throwsopt Offersopt => Type // case 69: { Modified: trunk/x10.compiler/src/x10/parser/x10.g =================================================================== --- trunk/x10.compiler/src/x10/parser/x10.g 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/parser/x10.g 2010-09-12 02:05:06 UTC (rev 16313) @@ -285,7 +285,6 @@ -- private -- property -- protected --- proto -- public -- return safe @@ -457,13 +456,12 @@ public static int PRIVATE = 8; public static int PROPERTY = 9; public static int PROTECTED = 10; - public static int PROTO = 11; - public static int PUBLIC = 12; - public static int SAFE = 13; - public static int SEQUENTIAL = 14; - public static int SHARED = 15; - public static int STATIC = 16; - public static int TRANSIENT = 17; + public static int PUBLIC = 11; + public static int SAFE = 12; + public static int SEQUENTIAL = 13; + public static int SHARED = 14; + public static int STATIC = 15; + public static int TRANSIENT = 16; public static int NUM_FLAGS = TRANSIENT + 1; private JPGPosition pos; @@ -483,7 +481,6 @@ if (flag == PRIVATE) return Flags.PRIVATE; if (flag == PROPERTY) return X10Flags.PROPERTY; if (flag == PROTECTED) return Flags.PROTECTED; - if (flag == PROTO) return X10Flags.PROTO; if (flag == PUBLIC) return Flags.PUBLIC; if (flag == SAFE) return X10Flags.SAFE; if (flag == SEQUENTIAL) return X10Flags.SEQUENTIAL; @@ -506,7 +503,6 @@ if (flag == PRIVATE) return "private"; if (flag == PROPERTY) return "property"; if (flag == PROTECTED) return "protected"; - if (flag == PROTO) return "proto"; if (flag == PUBLIC) return "public"; if (flag == SAFE) return "safe"; if (flag == SEQUENTIAL) return "sequential"; @@ -581,7 +577,6 @@ methodModifiers[PRIVATE] = true; methodModifiers[PROPERTY] = true; methodModifiers[PROTECTED] = true; - methodModifiers[PROTO] = true; methodModifiers[PUBLIC] = true; methodModifiers[SAFE] = true; methodModifiers[SEQUENTIAL] = true; @@ -1249,11 +1244,6 @@ setResult(new FlagModifier(pos(), FlagModifier.PROTECTED)); $EndJava ./ - | proto - /.$BeginJava - setResult(new FlagModifier(pos(), FlagModifier.PROTO)); - $EndJava - ./ | public /.$BeginJava setResult(new FlagModifier(pos(), FlagModifier.PUBLIC)); @@ -1701,13 +1691,6 @@ -------------------------------------- Section:::Types Type ::= FunctionType | ConstrainedType - | proto ConstrainedType - /.$BeginJava - AddFlags tn = (AddFlags) ConstrainedType; - tn.addFlags(X10Flags.PROTO); - setResult(ConstrainedType.position(pos())); - $EndJava - ./ FunctionType ::= TypeParametersopt ( FormalParameterListopt ) WhereClauseopt Throwsopt Offersopt => Type /.$BeginJava @@ -3551,11 +3534,6 @@ -- setResult(Collections.singletonList(nf.FlagsNode(pos(), X10Flags.GLOBAL))); -- $EndJava -- ./ --- | proto --- /.$BeginJava --- setResult(Collections.singletonList(nf.FlagsNode(pos(), X10Flags.PROTO))); --- $EndJava --- ./ Throws ::= throws ExceptionTypeList Modified: trunk/x10.compiler/src/x10/types/ConstrainedType.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/ConstrainedType.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -11,18 +11,13 @@ package x10.types; -import java.util.List; - -import polyglot.ast.Expr; import polyglot.types.ObjectType; import polyglot.types.Ref; -import polyglot.types.ReferenceType; import polyglot.types.SemanticException; -import polyglot.types.StructType; import polyglot.types.Type; import x10.types.constraints.CConstraint; -public interface ConstrainedType extends ObjectType, X10NamedType, Proto, X10Struct, X10ThisVar { +public interface ConstrainedType extends ObjectType, X10NamedType, X10Struct, X10ThisVar { Ref<? extends Type> baseType(); ConstrainedType baseType(Ref<? extends Type> baseType); Modified: trunk/x10.compiler/src/x10/types/ConstrainedType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -17,7 +17,6 @@ import polyglot.types.ArrayType; import polyglot.types.ClassType; import polyglot.types.FieldInstance; -import polyglot.types.Flags; import polyglot.types.MethodInstance; import polyglot.types.Name; import polyglot.types.Named; @@ -32,9 +31,7 @@ import polyglot.types.StructType; import polyglot.types.Type; import polyglot.types.Types; -import polyglot.types.UnknownType; import polyglot.util.CodeWriter; -import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.Transformation; import polyglot.util.TransformingList; @@ -43,7 +40,6 @@ import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint; /** * 09/11/09 @@ -110,25 +106,7 @@ return c; } */ - public Proto baseOfProto() { - Type t = Types.get(baseType); - assert t!=null; - if (! X10TypeMixin.isProto(t)) - return this; - ConstrainedType_c c = (ConstrainedType_c) this.copy(); - c.baseType = Types.ref(X10TypeMixin.baseOfProto(t)); - return c; - } - public Proto makeProto() { - Type t = Types.get(baseType); - assert t!=null; - if (X10TypeMixin.isProto(t)) - return this; - ConstrainedType_c c = (ConstrainedType_c) this.copy(); - c.baseType = Types.ref(X10TypeMixin.makeProto(t)); - return c; - } public X10Struct makeX10Struct() { Type t = Types.get(baseType); @@ -405,12 +383,7 @@ return X10TypeMixin.isX10Struct(baseType.get()); } - - public boolean isProto() { - return X10TypeMixin.isProto(baseType.get()); - } - - + @Override public boolean isClass() { Type base = baseType.get(); Modified: trunk/x10.compiler/src/x10/types/MacroType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -94,9 +94,6 @@ public boolean isGlobal() { return flags() == null ? false : X10Flags.toX10Flags(flags()).isGlobal(); } - public boolean isProto() { - return flags() == null ? false : X10Flags.toX10Flags(flags()).isProto(); - } public boolean isX10Struct() { return ((X10TypeSystem) typeSystem()).isStructType(this); } Deleted: trunk/x10.compiler/src/x10/types/Proto.java =================================================================== --- trunk/x10.compiler/src/x10/types/Proto.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/Proto.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -1,37 +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.types; - -import polyglot.types.Type; - - -/** - * Interface implemented by types that may be proto types, viz ConstrainedType or X10ClassType. - * - * @author vj - * - */ -public interface Proto extends Type { - - boolean isProto(); - - /** - * Return T if this is proto T; else return this. - * @return - */ - Proto baseOfProto(); - - /** - * @return this if this is proto T; else proto this - */ - Proto makeProto(); -} Modified: trunk/x10.compiler/src/x10/types/X10ClassType.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ClassType.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10ClassType.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -11,7 +11,6 @@ package x10.types; -import java.util.ArrayList; import java.util.List; import polyglot.ast.Expr; @@ -19,9 +18,7 @@ import polyglot.types.FieldInstance; import polyglot.types.Matcher; import polyglot.types.Named; -import polyglot.types.Name; import polyglot.types.Type; -import polyglot.util.TransformingList; /** The representative of ClassType in the X10 type hierarchy. * @@ -30,7 +27,7 @@ * @author vj * */ -public interface X10ClassType extends ClassType, Proto, X10Struct, X10Use<X10ClassDef> { +public interface X10ClassType extends ClassType, X10Struct, X10Use<X10ClassDef> { /** Property initializers, used in annotations. */ List<Expr> propertyInitializers(); Modified: trunk/x10.compiler/src/x10/types/X10Flags.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10Flags.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10Flags.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -43,7 +43,6 @@ 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. @@ -549,41 +548,8 @@ public boolean isSequential() { return contains(SEQUENTIAL) || contains(SAFE); } - - /** - * Return a copy of this <code>this</code> with the <code>sequential</code> - * flag set. - * - * @param flags - * TODO - */ - public X10Flags Proto() { - return setX(PROTO); - } /** - * Return a copy of this <code>this</code> with the <code>sequential</code> - * flag clear. - * - * @param flags - * TODO - */ - public X10Flags clearProto() { - return clearX(PROTO); - } - - /** - * Return true if <code>this</code> has the <code>sequential</code> flag - * set. - * - * @param flags - * TODO - */ - public boolean isProto() { - return contains(PROTO); - } - - /** * Return a copy of this <code>this</code> with the <code>pinned</code> * flag set. * Modified: trunk/x10.compiler/src/x10/types/X10MethodDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10MethodDef.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10MethodDef.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -28,13 +28,7 @@ Ref<XTerm> body(); void body(Ref<XTerm> body); - - /** - * Is this method a proto method? - * @return - */ - boolean isProto(); - + Ref<? extends Type> offerType(); void setOfferType(Ref<? extends Type> s); Modified: trunk/x10.compiler/src/x10/types/X10MethodDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10MethodDef_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10MethodDef_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -244,9 +244,6 @@ return s; } - public boolean isProto() { - return X10Flags.toX10Flags(flags()).isProto(); - } public Object copy() { X10MethodDef_c copy = (X10MethodDef_c) super.copy(); Modified: trunk/x10.compiler/src/x10/types/X10NullType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10NullType_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10NullType_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -31,7 +31,6 @@ public boolean isSafe() { return true;} public boolean isRooted() { return false; } - public boolean isProto() { return false; } public boolean isX10Struct() { return false; } public boolean equalsNoFlag(Type t2) { return this == t2; } public boolean permitsNull() { return true;} Modified: trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -367,9 +367,6 @@ StringBuffer sb = new StringBuffer(); if (flags() != null) { X10Flags f = X10Flags.toX10Flags(flags()); - if (f.isProto()) { - sb.append("proto "); - } } // sb.append(flags().toString()).append(" "); @@ -389,23 +386,8 @@ return sb.toString(); } - public boolean isProto() { return X10Flags.toX10Flags(flags()).isProto(); } public boolean isX10Struct() { return X10Flags.toX10Flags(flags()).isStruct(); } - public Proto makeProto() { - if (isProto()) - return this; - X10ParsedClassType_c c = (X10ParsedClassType_c) copy(); - c.setFlags(X10Flags.toX10Flags(flags()).Proto()); - return c; - - } - public Proto baseOfProto() { - if (! isProto()) - return this; - X10ParsedClassType_c c = (X10ParsedClassType_c) copy(); - c.setFlags(X10Flags.toX10Flags(flags()).clearProto()); - return c; - } + public X10Struct makeX10Struct() { if (isX10Struct()) return this; Modified: trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -681,20 +681,6 @@ return true; X10Context xcontext = (X10Context) context; - { - boolean isProto1 = X10TypeMixin.isProto(t1); - boolean isProto2 = X10TypeMixin.isProto(t2); - - if (isProto1 || isProto2) { - if (isProto1 != isProto2) - return false; - // they are both proto - - t1 = X10TypeMixin.baseOfProto(t1); - t2 = X10TypeMixin.baseOfProto(t2); - - } - } { boolean isStruct1 = X10TypeMixin.isX10Struct(t1); boolean isStruct2 = X10TypeMixin.isX10Struct(t2); @@ -988,10 +974,8 @@ if (t1.isVoid() || t2.isVoid()) return false; - if (X10TypeMixin.isProto(t1) != X10TypeMixin.isProto(t2)) + if (X10TypeMixin.isX10Struct(t1) != X10TypeMixin.isX10Struct(t2)) return false; - if (X10TypeMixin.isX10Struct(t1) != X10TypeMixin.isX10Struct(t2)) - return false; X10Context xc = (X10Context) context; List<SubtypeConstraint> env = xc.currentTypeConstraint().terms(); Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -20,17 +20,14 @@ import polyglot.ast.Cast; import polyglot.ast.Expr; import polyglot.ast.Field; -import polyglot.ast.Formal; import polyglot.ast.Lit; import polyglot.ast.Receiver; import polyglot.ast.Special; import polyglot.ast.Unary; import polyglot.ast.Unary_c; import polyglot.ast.Variable; -import polyglot.ast.IntLit; import polyglot.ast.FloatLit; import polyglot.ast.Binary.Operator; -import polyglot.frontend.Globals; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.ConstructorInstance; @@ -45,7 +42,6 @@ import polyglot.types.Ref; import polyglot.types.SemanticException; import polyglot.types.Type; -import polyglot.types.TypeSystem; import polyglot.types.Types; import polyglot.types.UnknownType; import polyglot.types.QName; @@ -63,10 +59,8 @@ import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; -import x10.constraint.XVar; import x10.errors.Errors; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; import x10.types.constraints.XConstrainedTerm; @@ -221,8 +215,6 @@ if (f==null || !(f instanceof X10Flags)) return x; X10Flags xf = (X10Flags) f; - if (xf.isProto()) - x = ((Proto) x).makeProto(); if (xf.isStruct()) { x = ((X10Struct) x).makeX10Struct(); } @@ -388,30 +380,13 @@ public static boolean isClass(Type t) { return ! isX10Struct(t); } - - public static boolean isProto(Type t) { - return (t instanceof Proto) && ((Proto) t).isProto(); - } - public static Type baseOfProto(Type t) { - if (! (t instanceof Proto)) - return t; - Proto type = (Proto) t; - return type.baseOfProto(); - - } + public static Type superClass(Type t) { t = baseType(t); assert t instanceof ClassType; return ((ClassType) t).superClass(); } - public static Type makeProto(Type t) { - if (! (t instanceof Proto)) - return t; - Proto type = (Proto) t; - return type.makeProto(); - - } public static Type addBinding(Type t, XTerm t1, XTerm t2) throws XFailure { //assert (! (t instanceof UnknownType)); @@ -705,20 +680,6 @@ } - public static void protoTypeCheck(List<Formal> formals, Type retType, Position pos, - boolean isMethod) throws SemanticException { - for (Formal f : formals) { - if ( X10TypeMixin.isProto(f.type().type())) { - if (! retType.isVoid() && ! X10TypeMixin.isProto(retType)) { - throw new SemanticException("The argument " + f - + " has a proto type; hence the return type must be " - + (isMethod ? "void or proto" : "proto")+", not " - + retType+".", pos); - - } - } - } - } public static boolean entails(Type t, XTerm t1, XTerm t2) { CConstraint c = realX(t); @@ -1075,7 +1036,7 @@ if (e != null) { e = (Expr) e.del().typeCheck(tc).checkConstants(tc); - if (!ts.isSubtype(e.type(), t, context)) { // suppose the field is "var i:Int{self!=0}", then you cannot create an initializer which is 0! + if (ts.isSubtype(e.type(), t, context)) { // suppose the field is "var i:Int{self!=0}", then you cannot create an initializer which is 0! return e; } } Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -1044,7 +1044,6 @@ X10Flags x = X10Flags.toX10Flags(legalAccessFlags().Abstract().Static().Final().Native().Synchronized().StrictFP()); x = x.Safe().NonBlocking().Sequential().Incomplete().Property().Pure().Extern().Atomic();//.Global(); x = x.Global(); - x = x.Proto(); return x; } @@ -1053,7 +1052,6 @@ X10Flags x = X10Flags.toX10Flags(legalAccessFlags().clear(Private()).Abstract()); x = x.Safe().NonBlocking().Sequential().Property().Pure().Atomic(); //.Global(); x = x.Global(); - x = x.Proto(); return x; } Modified: trunk/x10.compiler/src/x10/types/X10UnknownType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10UnknownType_c.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/types/X10UnknownType_c.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -37,7 +37,6 @@ public boolean isX10Struct() { return false; } public Flags flags() { return Flags.NONE; } public Type setFlags(Flags f) { return this; } - public boolean isProto() { return false;} public Type clearFlags(Flags f) { return this; } public String toString() { return super.toString(); } public boolean equalsNoFlag(Type t2) { return this == t2;} Modified: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java =================================================================== --- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-11 17:37:50 UTC (rev 16312) +++ trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-12 02:05:06 UTC (rev 16313) @@ -2,27 +2,25 @@ import polyglot.ast.*; import polyglot.util.ErrorInfo; -import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.NodeVisitor; import polyglot.visit.DataFlow; import polyglot.visit.FlowGraph; import polyglot.frontend.Job; import polyglot.types.Type; -import polyglot.types.TypeSystem; import polyglot.types.FieldDef; import polyglot.types.Flags; import polyglot.types.MethodInstance; -import polyglot.types.VarDef; import polyglot.types.MethodDef; import polyglot.types.FieldInstance; import polyglot.types.ProcedureDef; +import polyglot.types.QName; import x10.ast.*; import x10.types.X10TypeMixin; import x10.types.X10Flags; -import x10.types.X10FieldDef_c; import x10.types.X10TypeSystem; import x10.types.X10FieldDef; +import x10.types.X10ParsedClassType_c; import java.util.HashMap; import java.util.Set; @@ -49,6 +47,7 @@ private static int afterSeqBlock(int bBefore, int bAfter) { return build(isRead(bBefore) || (!isSeqWrite(bBefore) && isRead(bAfter)), isWrite(bBefore) || isWrite(bAfter),isSeqWrite(bBefore) || isSeqWrite(bAfter)); } private static int afterAsync(int i1, int i2) { return build(isRead(i1)||isRead(i2),isWrite(i1)||isWrite(i2),isSeqWrite(i1)&&isSeqWrite(i2)); } private static int afterIf(int i1, int i2) { return build(isRead(i1)||isRead(i2),isWrite(i1)&&isWrite(i2),isSeqWrite(i1)&&isSeqWrite(i2)); } + private static String flagsToString(int i) { return i==0? "none," : (isRead(i)?"read," : "")+(isWrite(i)?"write," : "")+(isSeqWrite(i)?"seqWrite," : ""); } private class DataFlowItem extends DataFlow.Item { @@ -67,6 +66,15 @@ public int hashCode() { return (initStatus.hashCode()); } + + @Override + public String toString() { + StringBuilder res = new StringBuilder(); + for (Map.Entry<X10FieldDecl_c, Integer> pair : initStatus.entrySet()) { + res.append(pair.getKey().name()).append(":").append(flagsToString(pair.getValue())).append(" "); + } + return res.toString(); + } } class FieldChecker extends DataFlow { private final DataFlowItem INIT = new DataFlowItem(); @@ -104,8 +112,10 @@ boolean isAsync = !entry && node instanceof Async; DataFlowItem res = new DataFlowItem(); - for (Object itemObj : items) { - DataFlowItem item = (DataFlowItem) itemObj; + res.initStatus.putAll(((DataFlowItem) items.get(0)).initStatus); + + for (int i=1; i<items.size(); i++) { + DataFlowItem item = (DataFlowItem) items.get(i); for (Map.Entry<X10FieldDecl_c, Integer> pair : item.initStatus.entrySet()) { final X10FieldDecl_c key = pair.getKey(); int i1 = res.initStatus.get(key); @@ -121,7 +131,7 @@ return res; } protected FlowGraph initGraph(CodeNode code, Term root) { - currDecl = (ProcedureDecl)code; + currDecl = (ProcedureDecl)code; // we do not analyze closures (Closure_c) since we require that "this" does not escape there return super.initGraph(code,root); } @@ -174,7 +184,8 @@ } } else if (n instanceof Expr && ((Expr)n).type().isBoolean() && (n instanceof Binary || n instanceof Unary)) { - return flowBooleanConditions(trueItem, falseItem, inItem, graph, (Expr)n, succEdgeKeys); + final Map map = flowBooleanConditions(trueItem, falseItem, inItem, graph, (Expr) n, succEdgeKeys); + if (map!=null) return map; } else if (n instanceof ParExpr && ((ParExpr)n).type().isBoolean()) { return itemsToMap(trueItem, falseItem, inItem, succEdgeKeys); } else if (n instanceof Finish) { @@ -206,7 +217,8 @@ // finish method/ctor ProcedureDecl decl = (ProcedureDecl)n; assert decl!=null; - MethodInfo oldInfo = allMethods.get(decl.procedureInstance()); + final ProcedureDef procDef = decl.procedureInstance(); + MethodInfo oldInfo = allMethods.get(procDef); MethodInfo newInfo = new MethodInfo(); for (Map.Entry<X10FieldDecl_c, Integer> pair : dfIn.initStatus.entrySet()) { int val = pair.getValue(); @@ -215,13 +227,22 @@ if (isWrite(val)) newInfo.write.add(f); if (isSeqWrite(val)) newInfo.seqWrite.add(f); } + // proof that the fix-point terminates: write set decreases while the read set increases + assert oldInfo.write.containsAll(newInfo.write); + assert oldInfo.seqWrite.containsAll(newInfo.seqWrite); + assert newInfo.read.containsAll(oldInfo.read); + + // fixed-point reached? if (newInfo.read.equals(oldInfo.read) && newInfo.write.equals(oldInfo.write) && newInfo.seqWrite.equals(oldInfo.seqWrite)) { // no change! } else { wasChange = true; + allMethods.put(procDef,newInfo); } + + // everything must be assigned in a ctor (and nothing read) if (isCtor()) { int size = fields.size(); if (!newInfo.read.isEmpty()) assert wasError; @@ -254,7 +275,45 @@ } } + // Checks for illegal forward references in field initializers and "this" escaping + private class FieldInitVisitor extends NodeVisitor { + @Override public Node visitEdgeNoOverride(Node parent, Node n) { + checkGlobalRef(n); // check globalRef usage in field initializers + final Position p = n.position(); + // this can escape in field acess and assignment (but not in method calls or any other way) + if (n instanceof Field) { + Field f = (Field) n; + if (isThis(f.target())) { + checkField(f.fieldInstance().def(),p); + return n; + } + } + if (n instanceof FieldAssign) { + FieldAssign f = (FieldAssign) n; + if (isThis(f.target())) { + checkField(f.fieldInstance().def(),p); + f.right().visit(this); + return n; + } + } + + // check that "this" cannot escape in any other way + if (isThis(n)) + reportError("'this' and 'super' cannot escape in field initializers.",p); + + n.del().visitChildren(this); + return n; + } + + } + private void checkField(FieldDef def, Position p) { + if (!def.flags().isStatic() && !initFields.contains(def)) { + reportError("Illegal forward reference for field '"+def.name()+"'.",p); + } + } + + // we gather info on every private/final method private static class MethodInfo { private final Set<X10FieldDecl_c> read = new HashSet<X10FieldDecl_c>(); @@ -275,7 +334,21 @@ // Therefore we can now treat both VAL and VAR identically. private final HashSet<X10FieldDecl_c> fields = new HashSet<X10FieldDecl_c>(); private boolean wasChange = true, wasError = false; // for fixed point alg + private FieldDef globalRef = null;// There is one exception to the "this cannot escape" rule: val root = GlobalRef[...](this) + private Set<FieldDef> initFields = new HashSet<FieldDef>(); // fields that have been initialized already (to prevent forward references) + private void checkGlobalRef(Node n) { + boolean err = false; + if (n instanceof Field) { + Field f = (Field) n; + err = (f.fieldInstance().def()==globalRef && isThis(f.target())); + } + if (n instanceof FieldAssign) { + FieldAssign assign = (FieldAssign) n; + err = (assign.fieldInstance().def()==globalRef && isThis(assign.target())); + } + if (err) reportError("Cannot use '"+globalRef.name()+"' in a field initializer, constructor, or methods called from a constructor.",n.position()); + } public CheckEscapingThis(X10ClassDecl_c xlass, Job job, X10TypeSystem ts) { this.job = job; this.ts = ts; @@ -285,9 +358,45 @@ typeCheck(); } private void typeCheck() { - // visit every ctor, and every method called from a ctor, and check that this and super do not escape final X10ClassBody_c body = (X10ClassBody_c)xlass.body(); + // visit all field initializers and check that they do not have forward references nor that "this" escapes + FieldInitVisitor fieldInitVisitor = new FieldInitVisitor(); for (ClassMember classMember : body.members()) { + if (classMember instanceof X10FieldDecl_c) { + X10FieldDecl_c field = (X10FieldDecl_c) classMember; + final Flags flags = field.flags().flags(); + final Expr init = field.init(); + if (init==null) continue; + // check for the pattern: GlobalRef[...](this) + if (init instanceof X10New_c) { + X10New_c new_c = (X10New_c) init; + final TypeNode typeNode = new_c.objectType(); + final List<Expr> args = new_c.arguments(); + if (args.size()==1 && isThis(args.get(0)) && // the first and only argument is "this" + typeNode instanceof X10CanonicalTypeNode_c) { // now checking the ctor is of GlobalRef + X10CanonicalTypeNode_c tn = (X10CanonicalTypeNode_c) typeNode; + final Type type = tn.type(); + if (type instanceof X10ParsedClassType_c) { + X10ParsedClassType_c classType_c = (X10ParsedClassType_c) type; + final QName qName = classType_c.def().fullName(); + if (qName.equals(QName.make("x10.lang","GlobalRef"))) { + // found the pattern! + if (globalRef!=null) { + reportError("You can use the pattern 'val root = GlobalRef[...](this);' only once in a class.",field.position()); + continue; + } + globalRef = field.fieldDef(); + continue; + } + } + } + } + init.visit(fieldInitVisitor); + initFields.add(field.fieldDef()); + } + } + // visit every ctor, and every method called from a ctor, and check that this and super do not escape + for (ClassMember classMember : body.members()) { if (classMember instanceof X10ConstructorDecl_c) { final X10ConstructorDecl_c ctor = (X10ConstructorDecl_c) classMember; final Block ctorBody = ctor.body(); @@ -302,7 +411,6 @@ if (flags.isStatic()) continue; // if the field has an init, then we do not need to track it (it is always assigned before read) if (field.init()!=null) continue; - if (field.init()!=null) continue; if (X10TypeMixin.isUninitializedField((X10FieldDef)field.fieldDef(),ts)) continue; // if a VAR has a default value, then we already created an init() expr in X10FieldDecl_c.typeCheck fields.add(field); @@ -340,7 +448,7 @@ wasChange = false; // do a DFS: starting from private/final methods, and then the ctors (this will reach a fixed-point fastest) for (ProcedureDecl p : dfsMethods) - p.visit(fieldChecker); + fieldChecker.dataflow(p); } } private X10FieldDecl_c findField(FieldDef def) { @@ -361,20 +469,29 @@ return null; } - @O... [truncated message content] |
From: <vj...@us...> - 2010-09-12 02:36:51
|
Revision: 16314 http://x10.svn.sourceforge.net/x10/?rev=16314&view=rev Author: vj0 Date: 2010-09-12 02:36:41 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Several changes for 2.1: Removed shared. Removed await statement. Removed async (Place) ClosureBody Removed async[Type] ClosureBody Removed support for future. Completed removing proto. Removed const. Removed incomplete. Removed or. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/Async.java trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/parser/X10KWLexer.gi trunk/x10.compiler/src/x10/parser/X10KWLexer.java trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 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.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10/visit/ExpressionFlattener.java trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/PolyMatBuilder.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/io/ByteWriter.x10 trunk/x10.runtime/src-x10/x10/io/Console.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 trunk/x10.runtime/src-x10/x10/io/FileSystem.x10 trunk/x10.runtime/src-x10/x10/io/Marshal.x10 trunk/x10.runtime/src-x10/x10/io/Printer.x10 trunk/x10.runtime/src-x10/x10/lang/Boolean.x10 trunk/x10.runtime/src-x10/x10/lang/Byte.x10 trunk/x10.runtime/src-x10/x10/lang/Clock.x10 trunk/x10.runtime/src-x10/x10/lang/Complex.x10 trunk/x10.runtime/src-x10/x10/lang/Double.x10 trunk/x10.runtime/src-x10/x10/lang/Float.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/Math.x10 trunk/x10.runtime/src-x10/x10/lang/Place.x10 trunk/x10.runtime/src-x10/x10/lang/Runtime.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 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/HashSet.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.tests/examples/Benchmarks/Benchmark.x10 trunk/x10.tests/examples/Benchmarks/DistRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/DistStream1.x10 trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/ParStream1.x10 trunk/x10.tests/examples/Benchmarks/ParUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.cc trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.cc trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/SeqStream1.cc trunk/x10.tests/examples/Benchmarks/SeqStream1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSGeo1.x10 trunk/x10.tests/examples/Benchmarks/UTSRand.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Acceleration.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Angle.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Area.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Capacitance.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/CatalyticActivity.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Charge.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Conductance.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Current.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Energy.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Force.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Frequency.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Illuminance.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Inductance.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Length.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/LuminousFlux.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/LuminousIntensity.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/MagneticFlux.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/MagneticFluxDensity.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Mass.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Matter.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Measure.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Power.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Pressure.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Radioactivity.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Resistance.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/SI.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/SolidAngle.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Temperature.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Time.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Velocity.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Voltage.x10 trunk/x10.tests/examples/Constructs/Annotations/dims/Volume.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10.aside trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopyTo.x10 trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 trunk/x10.tests/examples/Constructs/Array/ArrayMap.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayWithInitializer.x10 trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10.aside trunk/x10.tests/examples/Constructs/Array/MultiDimensionalJavaArray.x10 trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 trunk/x10.tests/examples/Constructs/Async/AsyncNext.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest5.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicOrdered.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicQueue.x10 trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/PrimitiveDepTypeCast_Overflow1.x10.aside trunk/x10.tests/examples/Constructs/Clock/ClockPascal.x10.aside trunk/x10.tests/examples/Constructs/Clock/ClockPascal2.x10.aside trunk/x10.tests/examples/Constructs/Clock/ClockTest10.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest13.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest4.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest6.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest9.x10 trunk/x10.tests/examples/Constructs/Closures/OperatorSelector1.x10.aside trunk/x10.tests/examples/Constructs/Distribution/ArrayToDist.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDistWithPlaceSet.x10 trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra3.x10.aside trunk/x10.tests/examples/Constructs/Distribution/DistBounds1D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds2D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds3D.x10 trunk/x10.tests/examples/Constructs/Exceptions/Exceptions2.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions3_MustFailTimeout.x10.new trunk/x10.tests/examples/Constructs/Exceptions/Exceptions_BadPlace.x10.new trunk/x10.tests/examples/Constructs/Extern/RandomAccess_longExtern.x10.new trunk/x10.tests/examples/Constructs/For/ForLoop.x10 trunk/x10.tests/examples/Constructs/For/ForLoop2.x10 trunk/x10.tests/examples/Constructs/For/ForLoop3.x10 trunk/x10.tests/examples/Constructs/For/ForLoop4.x10 trunk/x10.tests/examples/Constructs/For/ForLoopOnArray.x10 trunk/x10.tests/examples/Constructs/ForEach/Foreach1.x10 trunk/x10.tests/examples/Constructs/ForEach/Foreach2.x10 trunk/x10.tests/examples/Constructs/Fun/FunIsNotObject_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/NoStaticMutable/NoStaticMutable1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Point/PointArithmetic.x10 trunk/x10.tests/examples/Constructs/Point/PointArithmetic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Region/TestRegion.x10 trunk/x10.tests/examples/Constructs/Structs/GenericStructTest.x10 trunk/x10.tests/examples/Constructs/Structs/StructInterface.x10 trunk/x10.tests/examples/Issues/XTENLANG_193.x10 trunk/x10.tests/examples/Issues/XTENLANG_237.x10 trunk/x10.tests/examples/Issues/XTENLANG_423.x10 trunk/x10.tests/examples/Misc/BreakInForTest.x10 trunk/x10.tests/examples/Misc/Stencil1D.x10 trunk/x10.tests/examples/x10lib/harness/x10Test.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFInstrumentor.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Incomplete.x10 trunk/x10.runtime/src-x10/x10/compiler/RemoteOperation.x10.aside Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/compiler/RemoteOperation.x10 Property Changed: ---------------- trunk/x10.compiler/src/x10/parser/X10Parser.java Modified: trunk/x10.compiler/src/x10/ast/Async.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/ast/Async.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -20,7 +20,7 @@ /** The node constructed for the X10 construct async (P) {S}. * @author Christian Grothoff */ -public interface Async extends CompoundStmt, RemoteActivityInvocation, Clocked { +public interface Async extends CompoundStmt, Clocked { /** Set the Async's body */ Async body(Stmt body); Modified: trunk/x10.compiler/src/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -70,13 +70,12 @@ */ public Set<VarDef> asyncInitVal = null; // used by the backend to know whether to pass a var to an async closure by ref or by value - public Expr place; + public Stmt body; protected List<Expr> clocks; - public Async_c(Position pos, Expr place, List<Expr> clocks, Stmt body) { + public Async_c(Position pos, List<Expr> clocks, Stmt body) { super(pos); - this.place = place; this.clocks = clocks; this.body = body; } @@ -112,28 +111,13 @@ n.body = body; return n; } + - /** Get the RemoteActivity's place. */ - public Expr place() { - return place; - } - /** Set the RemoteActivity's place. */ - public RemoteActivityInvocation place(Expr place) { - if (place != this.place) { - Async_c n = (Async_c) copy(); - n.place = place; - return n; - } - - return this; - } - /** Reconstruct the statement. */ - protected Async reconstruct(Expr place, List clocks, Stmt body) { - if (place != this.place || body != this.body || clocks != this.clocks) { + protected Async reconstruct(List clocks, Stmt body) { + if ( body != this.body || clocks != this.clocks) { Async_c n = (Async_c) copy(); - n.place = place; n.clocks = clocks; n.body = body; return n; @@ -144,14 +128,13 @@ /** Visit the children of the statement. */ public Node visitChildren(NodeVisitor v) { - Expr place = (Expr) visitChild(this.place, v); List clocks = (List) visitList(this.clocks, v); Stmt body = (Stmt) visitChild(this.body, v); - return reconstruct(place, clocks, body); + return reconstruct(clocks, body); } - XConstrainedTerm placeTerm; + @Override public Node typeCheckOverride(Node parent, ContextVisitor tc) { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); @@ -161,20 +144,6 @@ return this; } - if (placeTerm == null) { - try { - placeTerm = PlaceChecker.computePlaceTerm((Expr) visitChild(this.place, v), - (X10Context) tc.context(), ts); - } catch (SemanticException e) { - CConstraint d = new CConstraint(); - XTerm term = PlaceChecker.makePlace(); - try { - placeTerm = XConstrainedTerm.instantiate(d, term); - } catch (XFailure z) { - throw new InternalCompilerError("Cannot construct placeTerm from term and constraint."); - } - } - } // now that placeTerm is set in this node, continue visiting children // enterScope will ensure that placeTerm is installed in the context. @@ -201,10 +170,6 @@ } } xc = (X10Context) xc.pushCode(asyncInstance); - - - if (placeTerm != null) - xc = (X10Context) xc.pushPlace(placeTerm); } return xc; } @@ -213,20 +178,6 @@ X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - Expr newPlace = place; - // vj: No need to check this. This will be checked when computing - // the placeTerm, as part of place type checking. - /* - Type placeType = place.type(); - - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); - if (! placeIsPlace) { - throw new SemanticException( - "Place expression of async must be of type \"" + - ts.Place() + "\", not \"" + place.type() + "\".", - place.position()); - } - */ X10Context c = (X10Context) tc.context(); if (c.inSequentialCode()) Errors.issue(tc.job(), @@ -241,27 +192,22 @@ } } - return (Node) place(newPlace); + return this; } public Type childExpectedType(Expr child, AscriptionVisitor av) { X10TypeSystem ts = (X10TypeSystem) av.typeSystem(); - if (child == place) { - return ts.Place(); - } return child.type(); } public String toString() { - return "async (" + place + ") { ... }"; + return "async { ... }"; } /** Write the statement to an output file. */ public void prettyPrint(CodeWriter w, PrettyPrinter tr) { - w.write("async ("); - printBlock(place, w, tr); - w.write(") "); + w.write("async "); if (clocks != null && ! clocks.isEmpty()) { w.write("clocked ("); w.begin(0); @@ -288,9 +234,6 @@ * term. */ public Term firstChild() { - if (place != null) { - return place; - } if (clocks() == null || clocks().isEmpty()) { return body; @@ -309,12 +252,6 @@ * and disallow uses of "continue", "break", etc. in asyncs. */ public List acceptCFG(CFGBuilder v, List succs) { - - if (place != null) { - v.visitCFG(place, FlowGraph.EDGE_KEY_TRUE, body, - ENTRY, FlowGraph.EDGE_KEY_FALSE, this, EXIT); - } - if (clocks() == null || clocks().isEmpty()) { v.visitCFG(body, this, EXIT); } else { Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -89,7 +89,7 @@ Call X10Call(Position pos, Receiver target, Id name, List<TypeNode> typeArgs, List<Expr> args); Instanceof Instanceof(Position pos, Expr expr, TypeNode type); - Async Async(Position pos, Expr place, List<Expr> clocks, Stmt body); + Async Async(Position pos, List<Expr> clocks, Stmt body); Atomic Atomic(Position pos, Expr place, Stmt body); Future Future(Position pos, Expr place, TypeNode returnType, Block body); Here Here(Position pos); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -223,8 +223,8 @@ } // Wrap the body of the async in a Block so as to ease further code transforamtions. - public Async Async(Position pos, Expr place, List<Expr> clocks, Stmt body) { - Async a = new Async_c(pos, place, clocks, asBlock(body)); + public Async Async(Position pos, List<Expr> clocks, Stmt body) { + Async a = new Async_c(pos, clocks, asBlock(body)); X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); a = (Async) a.ext(ext_fac.extAsyncImpl()); X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.gi =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2010-09-12 02:36:41 UTC (rev 16314) @@ -87,7 +87,6 @@ catch class clocked - const continue def default @@ -101,7 +100,6 @@ finish for foreach - future global goto here @@ -109,10 +107,8 @@ implements import in - incomplete instanceof interface - local native new next @@ -121,18 +117,15 @@ offer offers operator - or package private property protected - proto public return safe self sequential - shared static struct super @@ -217,11 +210,6 @@ $setResult($_clocked); $EndAction ./ - | c o n s t - /.$BeginAction - $setResult($_const); - $EndAction - ./ | c o n t i n u e /.$BeginAction $setResult($_continue); @@ -287,11 +275,6 @@ $setResult($_foreach); $EndAction ./ - | f u t u r e - /.$BeginAction - $setResult($_future); - $EndAction - ./ | g l o b a l /.$BeginAction $setResult($_global); @@ -327,11 +310,6 @@ $setResult($_in); $EndAction ./ - | i n c o m p l e t e - /.$BeginAction - $setResult($_incomplete); - $EndAction - ./ | i n s t a n c e o f /.$BeginAction $setResult($_instanceof); @@ -342,11 +320,6 @@ $setResult($_interface); $EndAction ./ - | l o c a l - /.$BeginAction - $setResult($_local); - $EndAction - ./ | n a t i v e /.$BeginAction $setResult($_native); @@ -387,11 +360,6 @@ $setResult($_operator); $EndAction ./ - | o r - /.$BeginAction - $setResult($_or); - $EndAction - ./ | p a c k a g e /.$BeginAction $setResult($_package); @@ -412,11 +380,6 @@ $setResult($_protected); $EndAction ./ - | p r o t o - /.$BeginAction - $setResult($_proto); - $EndAction - ./ | p u b l i c /.$BeginAction $setResult($_public); @@ -442,11 +405,6 @@ $setResult($_sequential); $EndAction ./ - | s h a r e d - /.$BeginAction - $setResult($_shared); - $EndAction - ./ | s t a t i c /.$BeginAction $setResult($_static); Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -17,7 +17,7 @@ public class X10KWLexer extends X10KWLexerprs { private char[] inputChars; - private final int keywordKind[] = new int[74 + 1]; + private final int keywordKind[] = new int[67 + 1]; public int[] getKeywordKinds() { return keywordKind; } @@ -182,432 +182,383 @@ // - // Rule 14: KeyWord ::= c o n s t + // Rule 14: KeyWord ::= c o n t i n u e // - keywordKind[14] = (X10Parsersym.TK_const); + keywordKind[14] = (X10Parsersym.TK_continue); // - // Rule 15: KeyWord ::= c o n t i n u e + // Rule 15: KeyWord ::= d e f // - keywordKind[15] = (X10Parsersym.TK_continue); + keywordKind[15] = (X10Parsersym.TK_def); // - // Rule 16: KeyWord ::= d e f + // Rule 16: KeyWord ::= d e f a u l t // - keywordKind[16] = (X10Parsersym.TK_def); + keywordKind[16] = (X10Parsersym.TK_default); // - // Rule 17: KeyWord ::= d e f a u l t + // Rule 17: KeyWord ::= d o // - keywordKind[17] = (X10Parsersym.TK_default); + keywordKind[17] = (X10Parsersym.TK_do); // - // Rule 18: KeyWord ::= d o + // Rule 18: KeyWord ::= e l s e // - keywordKind[18] = (X10Parsersym.TK_do); + keywordKind[18] = (X10Parsersym.TK_else); // - // Rule 19: KeyWord ::= e l s e + // Rule 19: KeyWord ::= e x t e n d s // - keywordKind[19] = (X10Parsersym.TK_else); + keywordKind[19] = (X10Parsersym.TK_extends); // - // Rule 20: KeyWord ::= e x t e n d s + // Rule 20: KeyWord ::= e x t e r n // - keywordKind[20] = (X10Parsersym.TK_extends); + keywordKind[20] = (X10Parsersym.TK_extern); // - // Rule 21: KeyWord ::= e x t e r n + // Rule 21: KeyWord ::= f a l s e // - keywordKind[21] = (X10Parsersym.TK_extern); + keywordKind[21] = (X10Parsersym.TK_false); // - // Rule 22: KeyWord ::= f a l s e + // Rule 22: KeyWord ::= f i n a l // - keywordKind[22] = (X10Parsersym.TK_false); + keywordKind[22] = (X10Parsersym.TK_final); // - // Rule 23: KeyWord ::= f i n a l + // Rule 23: KeyWord ::= f i n a l l y // - keywordKind[23] = (X10Parsersym.TK_final); + keywordKind[23] = (X10Parsersym.TK_finally); // - // Rule 24: KeyWord ::= f i n a l l y + // Rule 24: KeyWord ::= f i n i s h // - keywordKind[24] = (X10Parsersym.TK_finally); + keywordKind[24] = (X10Parsersym.TK_finish); // - // Rule 25: KeyWord ::= f i n i s h + // Rule 25: KeyWord ::= f o r // - keywordKind[25] = (X10Parsersym.TK_finish); + keywordKind[25] = (X10Parsersym.TK_for); // - // Rule 26: KeyWord ::= f o r + // Rule 26: KeyWord ::= f o r e a c h // - keywordKind[26] = (X10Parsersym.TK_for); + keywordKind[26] = (X10Parsersym.TK_foreach); // - // Rule 27: KeyWord ::= f o r e a c h + // Rule 27: KeyWord ::= g l o b a l // - keywordKind[27] = (X10Parsersym.TK_foreach); + keywordKind[27] = (X10Parsersym.TK_global); // - // Rule 28: KeyWord ::= f u t u r e + // Rule 28: KeyWord ::= g o t o // - keywordKind[28] = (X10Parsersym.TK_future); + keywordKind[28] = (X10Parsersym.TK_goto); // - // Rule 29: KeyWord ::= g l o b a l + // Rule 29: KeyWord ::= h e r e // - keywordKind[29] = (X10Parsersym.TK_global); + keywordKind[29] = (X10Parsersym.TK_here); // - // Rule 30: KeyWord ::= g o t o + // Rule 30: KeyWord ::= i f // - keywordKind[30] = (X10Parsersym.TK_goto); + keywordKind[30] = (X10Parsersym.TK_if); // - // Rule 31: KeyWord ::= h e r e + // Rule 31: KeyWord ::= i m p l e m e n t s // - keywordKind[31] = (X10Parsersym.TK_here); + keywordKind[31] = (X10Parsersym.TK_implements); // - // Rule 32: KeyWord ::= i f + // Rule 32: KeyWord ::= i m p o r t // - keywordKind[32] = (X10Parsersym.TK_if); + keywordKind[32] = (X10Parsersym.TK_import); // - // Rule 33: KeyWord ::= i m p l e m e n t s + // Rule 33: KeyWord ::= i n // - keywordKind[33] = (X10Parsersym.TK_implements); + keywordKind[33] = (X10Parsersym.TK_in); // - // Rule 34: KeyWord ::= i m p o r t + // Rule 34: KeyWord ::= i n s t a n c e o f // - keywordKind[34] = (X10Parsersym.TK_import); + keywordKind[34] = (X10Parsersym.TK_instanceof); // - // Rule 35: KeyWord ::= i n + // Rule 35: KeyWord ::= i n t e r f a c e // - keywordKind[35] = (X10Parsersym.TK_in); + keywordKind[35] = (X10Parsersym.TK_interface); // - // Rule 36: KeyWord ::= i n c o m p l e t e + // Rule 36: KeyWord ::= n a t i v e // - keywordKind[36] = (X10Parsersym.TK_incomplete); + keywordKind[36] = (X10Parsersym.TK_native); // - // Rule 37: KeyWord ::= i n s t a n c e o f + // Rule 37: KeyWord ::= n e w // - keywordKind[37] = (X10Parsersym.TK_instanceof); + keywordKind[37] = (X10Parsersym.TK_new); // - // Rule 38: KeyWord ::= i n t e r f a c e + // Rule 38: KeyWord ::= n e x t // - keywordKind[38] = (X10Parsersym.TK_interface); + keywordKind[38] = (X10Parsersym.TK_next); // - // Rule 39: KeyWord ::= l o c a l + // Rule 39: KeyWord ::= n o n b l o c k i n g // - keywordKind[39] = (X10Parsersym.TK_local); + keywordKind[39] = (X10Parsersym.TK_nonblocking); // - // Rule 40: KeyWord ::= n a t i v e + // Rule 40: KeyWord ::= n u l l // - keywordKind[40] = (X10Parsersym.TK_native); + keywordKind[40] = (X10Parsersym.TK_null); // - // Rule 41: KeyWord ::= n e w + // Rule 41: KeyWord ::= o f f e r // - keywordKind[41] = (X10Parsersym.TK_new); + keywordKind[41] = (X10Parsersym.TK_offer); // - // Rule 42: KeyWord ::= n e x t + // Rule 42: KeyWord ::= o f f e r s // - keywordKind[42] = (X10Parsersym.TK_next); + keywordKind[42] = (X10Parsersym.TK_offers); // - // Rule 43: KeyWord ::= n o n b l o c k i n g + // Rule 43: KeyWord ::= o p e r a t o r // - keywordKind[43] = (X10Parsersym.TK_nonblocking); + keywordKind[43] = (X10Parsersym.TK_operator); // - // Rule 44: KeyWord ::= n u l l + // Rule 44: KeyWord ::= p a c k a g e // - keywordKind[44] = (X10Parsersym.TK_null); + keywordKind[44] = (X10Parsersym.TK_package); // - // Rule 45: KeyWord ::= o f f e r + // Rule 45: KeyWord ::= p r i v a t e // - keywordKind[45] = (X10Parsersym.TK_offer); + keywordKind[45] = (X10Parsersym.TK_private); // - // Rule 46: KeyWord ::= o f f e r s + // Rule 46: KeyWord ::= p r o p e r t y // - keywordKind[46] = (X10Parsersym.TK_offers); + keywordKind[46] = (X10Parsersym.TK_property); // - // Rule 47: KeyWord ::= o p e r a t o r + // Rule 47: KeyWord ::= p r o t e c t e d // - keywordKind[47] = (X10Parsersym.TK_operator); + keywordKind[47] = (X10Parsersym.TK_protected); // - // Rule 48: KeyWord ::= o r + // Rule 48: KeyWord ::= p u b l i c // - keywordKind[48] = (X10Parsersym.TK_or); + keywordKind[48] = (X10Parsersym.TK_public); // - // Rule 49: KeyWord ::= p a c k a g e + // Rule 49: KeyWord ::= r e t u r n // - keywordKind[49] = (X10Parsersym.TK_package); + keywordKind[49] = (X10Parsersym.TK_return); // - // Rule 50: KeyWord ::= p r i v a t e + // Rule 50: KeyWord ::= s a f e // - keywordKind[50] = (X10Parsersym.TK_private); + keywordKind[50] = (X10Parsersym.TK_safe); // - // Rule 51: KeyWord ::= p r o p e r t y + // Rule 51: KeyWord ::= s e l f // - keywordKind[51] = (X10Parsersym.TK_property); + keywordKind[51] = (X10Parsersym.TK_self); // - // Rule 52: KeyWord ::= p r o t e c t e d + // Rule 52: KeyWord ::= s e q u e n t i a l // - keywordKind[52] = (X10Parsersym.TK_protected); + keywordKind[52] = (X10Parsersym.TK_sequential); // - // Rule 53: KeyWord ::= p r o t o + // Rule 53: KeyWord ::= s t a t i c // - keywordKind[53] = (X10Parsersym.TK_proto); + keywordKind[53] = (X10Parsersym.TK_static); // - // Rule 54: KeyWord ::= p u b l i c + // Rule 54: KeyWord ::= s t r u c t // - keywordKind[54] = (X10Parsersym.TK_public); + keywordKind[54] = (X10Parsersym.TK_struct); // - // Rule 55: KeyWord ::= r e t u r n + // Rule 55: KeyWord ::= s u p e r // - keywordKind[55] = (X10Parsersym.TK_return); + keywordKind[55] = (X10Parsersym.TK_super); // - // Rule 56: KeyWord ::= s a f e + // Rule 56: KeyWord ::= s w i t c h // - keywordKind[56] = (X10Parsersym.TK_safe); + keywordKind[56] = (X10Parsersym.TK_switch); // - // Rule 57: KeyWord ::= s e l f + // Rule 57: KeyWord ::= t h i s // - keywordKind[57] = (X10Parsersym.TK_self); + keywordKind[57] = (X10Parsersym.TK_this); // - // Rule 58: KeyWord ::= s e q u e n t i a l + // Rule 58: KeyWord ::= t h r o w // - keywordKind[58] = (X10Parsersym.TK_sequential); + keywordKind[58] = (X10Parsersym.TK_throw); // - // Rule 59: KeyWord ::= s h a r e d + // Rule 59: KeyWord ::= t h r o w s // - keywordKind[59] = (X10Parsersym.TK_shared); + keywordKind[59] = (X10Parsersym.TK_throws); // - // Rule 60: KeyWord ::= s t a t i c + // Rule 60: KeyWord ::= t r a n s i e n t // - keywordKind[60] = (X10Parsersym.TK_static); + keywordKind[60] = (X10Parsersym.TK_transient); // - // Rule 61: KeyWord ::= s t r u c t + // Rule 61: KeyWord ::= t r u e // - keywordKind[61] = (X10Parsersym.TK_struct); + keywordKind[61] = (X10Parsersym.TK_true); // - // Rule 62: KeyWord ::= s u p e r + // Rule 62: KeyWord ::= t r y // - keywordKind[62] = (X10Parsersym.TK_super); + keywordKind[62] = (X10Parsersym.TK_try); // - // Rule 63: KeyWord ::= s w i t c h + // Rule 63: KeyWord ::= t y p e // - keywordKind[63] = (X10Parsersym.TK_switch); + keywordKind[63] = (X10Parsersym.TK_type); // - // Rule 64: KeyWord ::= t h i s + // Rule 64: KeyWord ::= v a l // - keywordKind[64] = (X10Parsersym.TK_this); + keywordKind[64] = (X10Parsersym.TK_val); // - // Rule 65: KeyWord ::= t h r o w + // Rule 65: KeyWord ::= v a r // - keywordKind[65] = (X10Parsersym.TK_throw); + keywordKind[65] = (X10Parsersym.TK_var); // - // Rule 66: KeyWord ::= t h r o w s + // Rule 66: KeyWord ::= w h e n // - keywordKind[66] = (X10Parsersym.TK_throws); + keywordKind[66] = (X10Parsersym.TK_when); // - // Rule 67: KeyWord ::= t r a n s i e n t + // Rule 67: KeyWord ::= w h i l e // - keywordKind[67] = (X10Parsersym.TK_transient); + keywordKind[67] = (X10Parsersym.TK_while); - // - // Rule 68: KeyWord ::= t r u e - // - - keywordKind[68] = (X10Parsersym.TK_true); - - - // - // Rule 69: KeyWord ::= t r y - // - - keywordKind[69] = (X10Parsersym.TK_try); - - - // - // Rule 70: KeyWord ::= t y p e - // - - keywordKind[70] = (X10Parsersym.TK_type); - - - // - // Rule 71: KeyWord ::= v a l - // - - keywordKind[71] = (X10Parsersym.TK_val); - - - // - // Rule 72: KeyWord ::= v a r - // - - keywordKind[72] = (X10Parsersym.TK_var); - - - // - // Rule 73: KeyWord ::= w h e n - // - - keywordKind[73] = (X10Parsersym.TK_when); - - - // - // Rule 74: KeyWord ::= w h i l e - // - - keywordKind[74] = (X10Parsersym.TK_while); - - for (int i = 0; i < keywordKind.length; i++) { if (keywordKind[i] == 0) Modified: trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -24,19 +24,19 @@ public final static int MAX_NAME_LENGTH = 0; public final int getMaxNameLength() { return MAX_NAME_LENGTH; } - public final static int NUM_STATES = 241; + public final static int NUM_STATES = 221; public final int getNumStates() { return NUM_STATES; } public final static int NT_OFFSET = 27; public final int getNtOffset() { return NT_OFFSET; } - public final static int LA_STATE_OFFSET = 393; + public final static int LA_STATE_OFFSET = 359; public final int getLaStateOffset() { return LA_STATE_OFFSET; } public final static int MAX_LA = 1; public final int getMaxLa() { return MAX_LA; } - public final static int NUM_RULES = 74; + public final static int NUM_RULES = 67; public final int getNumRules() { return NUM_RULES; } public final static int NUM_NONTERMINALS = 2; @@ -48,7 +48,7 @@ public final static int SEGMENT_SIZE = 8192; public final int getSegmentSize() { return SEGMENT_SIZE; } - public final static int START_STATE = 75; + public final static int START_STATE = 68; public final int getStartState() { return START_STATE; } public final static int IDENTIFIER_SYMBOL = 0; @@ -60,10 +60,10 @@ public final static int EOLT_SYMBOL = 28; public final int getEoltSymbol() { return EOLT_SYMBOL; } - public final static int ACCEPT_ACTION = 318; + public final static int ACCEPT_ACTION = 291; public final int getAcceptAction() { return ACCEPT_ACTION; } - public final static int ERROR_ACTION = 319; + public final static int ERROR_ACTION = 292; public final int getErrorAction() { return ERROR_ACTION; } public final static boolean BACKTRACK = false; @@ -104,13 +104,12 @@ public interface BaseCheck { public final static byte baseCheck[] = {0, 8,2,6,5,2,6,6,5,5,4, - 5,5,7,5,8,3,7,2,4,7, - 6,5,5,7,6,3,7,6,6,4, - 4,2,10,6,2,10,10,9,5,6, - 3,4,11,4,5,6,8,2,7,7, - 8,9,5,6,6,4,4,10,6,6, - 6,5,6,4,5,6,9,4,3,4, - 3,3,4,5 + 5,5,7,8,3,7,2,4,7,6, + 5,5,7,6,3,7,6,4,4,2, + 10,6,2,10,9,6,3,4,11,4, + 5,6,8,7,7,8,9,6,6,4, + 4,10,6,6,5,6,4,5,6,9, + 4,3,4,3,3,4,5 }; }; public final static byte baseCheck[] = BaseCheck.baseCheck; @@ -126,32 +125,30 @@ 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,77,19,20,105, - 34,24,78,53,55,29,128,54,119,80, - 39,88,89,65,143,43,61,94,146,73, - 82,148,149,97,151,102,152,153,156,21, - 159,161,157,104,166,95,168,167,75,172, - 174,177,176,180,181,184,187,188,189,191, - 195,103,113,198,202,116,114,200,196,206, - 209,211,207,213,214,217,223,218,225,226, - 221,228,233,231,236,125,235,237,239,244, - 246,238,247,248,252,259,261,262,124,264, - 266,267,268,270,130,272,274,276,278,134, - 283,284,285,286,290,288,294,296,295,300, - 303,306,302,308,309,250,311,312,318,320, - 323,316,137,328,330,331,332,336,337,324, - 338,341,344,339,348,349,351,353,355,356, - 360,361,141,363,366,367,368,370,371,372, - 373,379,377,380,381,388,390,393,382,394, - 397,297,398,399,404,405,402,412,409,413, - 416,418,419,417,422,421,426,423,427,433, - 436,437,439,438,440,441,445,448,451,452, - 453,458,459,462,466,467,470,472,474,476, - 475,477,479,485,480,487,488,489,490,492, - 494,495,497,498,502,506,503,509,511,513, - 516,517,519,524,527,523,528,531,529,533, - 540,541,534,537,544,547,548,319,319 + 1,1,1,1,1,1,1,1,1,70, + 112,7,126,42,24,133,44,62,29,53, + 135,69,58,72,80,28,18,35,82,88, + 70,54,89,130,138,96,97,140,63,141, + 77,142,143,146,148,153,85,159,102,149, + 158,164,145,165,167,170,171,172,168,175, + 106,105,177,181,114,111,183,186,187,188, + 195,190,193,198,199,204,200,207,202,208, + 210,213,215,118,216,217,218,223,220,227, + 228,231,232,235,117,243,229,234,245,122, + 247,250,252,254,256,259,260,261,262,267, + 265,248,272,271,276,279,282,280,273,285, + 287,292,284,294,296,298,301,303,305,306, + 310,311,312,299,316,314,319,324,326,327, + 328,331,332,45,322,335,338,339,340,341, + 343,342,349,350,348,358,356,359,361,364, + 363,369,370,373,375,379,382,13,385,381, + 386,371,388,390,391,392,394,398,395,401, + 402,404,405,410,414,416,406,418,423,424, + 427,428,431,434,436,432,438,441,440,446, + 439,448,449,451,450,454,455,456,458,468, + 459,466,461,473,474,464,481,477,483,484, + 486,488,489,491,492,493,495,496,498,500, + 292,292 }; }; public final static char baseAction[] = BaseAction.baseAction; @@ -161,64 +158,59 @@ public interface TermCheck { public final static byte termCheck[] = {0, - 0,1,2,3,4,5,6,7,8,9, - 10,0,12,13,14,15,16,17,0,0, - 0,21,22,0,1,2,3,7,0,1, - 10,3,13,0,11,7,13,4,0,11, - 17,3,0,25,2,7,13,0,10,11, - 8,18,0,0,0,3,4,15,4,17, - 0,1,9,11,0,12,12,3,14,5, - 10,7,0,20,0,3,2,0,1,0, - 6,0,8,11,5,4,7,0,0,1, - 18,10,5,0,0,7,0,4,5,3, - 4,0,0,0,0,3,5,3,5,7, - 23,17,0,0,2,0,1,23,0,1, - 8,8,7,0,0,24,2,0,5,0, - 7,18,3,0,7,2,0,1,14,10, - 0,8,0,7,4,0,4,0,0,9, - 0,0,0,3,2,0,0,10,0,14, - 0,1,14,12,6,0,0,0,12,2, - 15,0,6,0,9,0,0,4,2,0, - 0,2,7,0,4,14,0,0,0,2, - 0,5,9,0,0,0,8,0,1,0, - 5,0,12,9,3,0,0,8,0,1, - 0,1,0,0,9,9,0,0,2,7, - 0,8,0,1,0,0,2,0,11,4, - 0,11,0,1,0,0,0,0,0,12, - 5,11,4,0,1,0,0,0,2,0, - 5,0,15,4,3,19,22,10,0,1, - 0,0,2,0,1,0,0,0,7,0, - 1,0,7,0,1,0,1,0,11,8, - 3,15,0,0,0,0,1,0,6,0, - 6,8,3,0,0,0,0,10,3,0, - 1,0,0,9,2,0,1,0,0,8, - 0,0,16,20,6,0,6,0,1,0, - 1,10,0,0,17,10,4,0,1,0, - 0,0,3,3,3,0,0,0,0,4, - 0,5,5,0,4,22,3,0,0,1, - 0,4,0,3,0,0,4,3,20,0, - 0,1,0,8,5,0,0,0,2,0, - 0,0,0,11,2,10,0,8,0,0, - 0,0,6,13,4,6,19,0,10,0, - 19,4,0,0,13,2,0,0,0,10, - 8,0,6,0,0,4,9,9,0,6, - 6,0,0,2,2,0,0,0,0,1, - 0,0,0,8,7,0,0,2,12,21, - 9,5,0,1,14,0,0,0,0,0, - 0,6,20,5,0,5,9,0,1,13, - 0,0,0,9,2,16,6,0,0,1, - 3,0,0,2,13,0,0,2,2,0, - 1,0,1,0,0,0,0,3,0,0, - 7,6,6,5,0,1,0,0,0,0, - 2,0,13,0,0,8,0,0,1,6, - 11,0,0,9,18,0,10,16,0,4, - 0,1,0,1,6,0,0,1,0,18, - 2,19,0,0,9,2,0,0,0,3, - 0,1,0,0,2,7,0,10,16,0, - 0,2,9,0,1,5,0,0,12,0, - 0,0,0,0,8,0,0,0,0,0, - 0,0,0,0,0,0,0,0,21,0, - 0,0,0,0,0 + 0,1,2,3,4,5,0,7,8,9, + 10,11,0,13,14,15,16,0,18,13, + 20,4,22,0,1,2,3,0,0,1, + 3,3,20,6,0,12,2,10,10,16, + 12,0,8,0,0,4,3,4,4,15, + 16,7,0,0,13,12,3,0,17,7, + 3,0,0,11,2,12,9,10,0,0, + 17,0,11,21,6,14,0,6,10,0, + 1,0,1,14,0,9,10,0,0,10, + 9,4,4,6,23,0,0,9,3,4, + 16,0,6,2,0,0,2,23,3,8, + 0,0,8,0,1,10,0,0,8,2, + 24,0,6,10,3,0,10,17,3,0, + 9,14,0,1,0,1,25,0,9,0, + 0,0,0,1,0,0,5,0,0,0, + 11,14,0,6,10,15,11,0,0,7, + 2,4,14,0,0,2,0,0,4,0, + 0,0,2,7,0,6,0,1,11,8, + 0,7,0,3,0,0,0,0,1,0, + 8,6,0,7,0,1,7,0,0,0, + 2,0,10,0,1,8,0,0,2,0, + 1,12,0,12,0,0,0,0,11,0, + 6,4,0,1,12,6,0,0,0,2, + 0,0,1,0,0,19,2,22,10,9, + 0,15,0,1,0,1,0,0,15,0, + 1,0,1,0,8,0,3,2,0,0, + 0,0,1,5,0,5,0,8,21,3, + 0,0,0,9,3,0,1,7,0,0, + 2,0,1,0,0,0,0,8,16,5, + 4,0,9,0,1,0,5,0,0,4, + 0,1,0,1,0,0,9,3,3,0, + 0,0,3,0,4,0,3,6,0,4, + 22,0,4,0,1,0,0,0,3,3, + 0,0,1,12,0,8,6,0,0,0, + 0,0,0,9,2,0,8,0,0,0, + 9,4,13,5,5,0,19,0,0,19, + 0,4,0,0,9,2,8,5,0,0, + 0,1,0,13,0,7,7,5,0,5, + 0,0,4,2,0,0,2,0,8,0, + 0,0,2,0,0,10,7,0,11,6, + 0,0,5,0,0,0,6,13,7,0, + 6,0,21,0,1,0,7,0,13,2, + 5,18,0,0,1,3,0,0,2,2, + 0,0,2,0,1,0,1,0,0,0, + 0,10,5,3,5,0,1,0,0,0, + 0,13,2,0,0,0,8,0,0,5, + 0,12,7,0,17,0,9,0,1,4, + 7,18,0,0,1,17,0,5,2,19, + 0,1,0,0,2,0,3,0,0,1, + 0,0,0,2,0,0,9,0,6,0, + 10,7,0,18,0,8,11,0,0,0, + 0,0,0,0,0,0,0,0,0,20, + 0,0,0,0,0,0,0 }; }; public final static byte termCheck[] = TermCheck.termCheck; @@ -226,63 +218,58 @@ public interface TermAction { public final static char termAction[] = {0, - 319,91,80,95,82,86,93,84,81,85, - 87,319,90,88,83,94,92,78,319,319, - 319,89,79,319,105,103,106,155,319,115, - 156,116,96,319,102,114,104,99,319,113, - 101,126,319,318,135,124,100,319,125,123, - 136,98,319,319,319,110,109,137,367,134, - 319,139,118,108,319,351,112,132,111,131, - 138,130,319,119,35,142,165,319,107,319, - 167,319,166,141,122,143,121,319,319,129, - 388,144,128,319,319,337,319,391,390,148, - 147,319,319,319,319,181,151,97,160,180, - 127,360,319,2,182,5,187,162,319,120, - 183,189,186,319,319,150,202,319,215,319, - 214,188,220,319,117,224,319,245,203,219, - 319,225,319,372,263,319,133,319,319,264, - 319,319,319,149,153,319,319,145,319,140, - 319,158,146,152,157,319,319,319,159,163, - 154,319,164,319,161,319,319,169,170,319, - 319,172,171,319,173,168,319,319,319,176, - 319,175,174,319,319,319,177,319,184,319, - 191,319,178,179,185,319,319,190,319,389, - 319,387,319,319,392,192,319,319,194,193, - 319,383,319,195,319,319,197,319,196,198, - 319,199,319,375,319,319,319,319,319,376, - 201,200,206,319,207,319,319,319,361,319, - 363,319,208,381,210,205,204,209,319,211, - 319,319,212,319,350,319,319,319,213,26, - 218,319,349,319,222,319,338,16,217,221, - 223,216,319,319,319,319,329,319,226,319, - 228,227,229,319,319,319,319,230,232,319, - 234,319,319,233,235,319,393,319,319,236, - 319,319,378,231,238,319,239,319,241,319, - 242,240,319,319,237,244,243,319,246,319, - 319,319,247,248,249,319,319,319,319,250, - 319,251,358,319,253,252,254,319,319,257, - 319,256,319,258,319,319,259,260,255,319, - 319,341,319,261,262,319,319,319,333,319, - 319,319,319,265,327,266,319,331,319,319, - 319,319,269,330,270,323,267,319,268,319, - 328,271,65,319,382,380,319,319,319,272, - 385,319,379,319,319,275,273,374,319,373, - 274,319,319,276,278,45,319,319,319,359, - 319,319,319,365,279,319,319,353,280,277, - 281,348,319,347,282,319,319,319,23,319, - 319,284,283,285,319,287,340,319,289,344, - 319,319,319,288,322,286,326,319,319,291, - 290,319,319,292,325,319,319,293,294,319, - 369,319,368,319,319,319,319,297,319,319, - 295,296,298,299,319,300,319,319,319,319, - 336,319,346,319,319,339,319,319,305,302, - 301,319,319,303,343,319,304,332,319,366, - 319,308,319,309,307,319,319,334,319,370, - 320,306,319,319,310,386,319,319,319,311, - 319,357,319,319,314,313,319,312,371,319, - 319,315,316,319,355,377,319,319,356,319, - 319,319,319,319,352,319,319,319,319,319, - 319,319,319,319,319,319,319,319,362 + 292,83,73,87,75,85,292,78,74,79, + 77,82,292,80,76,86,71,292,84,88, + 81,122,72,292,96,95,97,292,292,106, + 121,107,254,120,292,94,124,119,105,93, + 104,292,125,292,292,91,101,100,240,126, + 123,241,292,292,92,99,131,292,90,108, + 115,292,292,322,141,130,114,113,292,292, + 354,292,103,109,112,102,292,117,111,292, + 118,292,128,129,292,144,143,292,292,309, + 127,357,132,356,116,292,292,133,137,136, + 329,33,139,152,292,292,167,150,166,153, + 2,292,168,5,172,165,292,292,174,186, + 138,292,197,171,201,292,196,173,89,292, + 200,187,292,98,292,110,291,292,134,292, + 292,292,292,146,292,292,145,292,292,292, + 140,135,292,148,157,142,147,292,292,149, + 151,155,154,292,292,156,292,292,158,292, + 292,292,161,159,292,160,292,169,163,162, + 292,164,292,170,292,292,292,292,355,292, + 175,176,292,358,292,353,177,292,292,292, + 179,292,178,292,180,349,292,292,182,292, + 342,181,292,183,292,292,292,292,343,292, + 185,190,292,191,184,332,292,292,292,330, + 292,292,194,292,292,189,195,188,320,193, + 292,192,292,321,25,199,292,292,198,292, + 203,292,310,15,202,292,204,205,292,292, + 292,292,302,206,292,208,292,207,211,209, + 292,292,292,210,212,292,214,213,292,292, + 215,292,359,292,292,292,292,216,217,218, + 347,292,220,292,221,292,219,292,292,222, + 292,224,292,225,292,292,223,226,227,292, + 292,292,228,292,229,292,233,230,292,232, + 231,292,234,292,235,292,292,292,236,237, + 292,292,313,242,292,238,239,292,292,292, + 292,292,292,243,300,292,304,292,292,292, + 245,247,303,246,296,292,244,292,58,301, + 292,248,292,292,249,346,351,345,292,292, + 292,328,292,348,292,250,341,340,292,251, + 41,292,252,253,292,292,255,292,334,292, + 292,292,324,292,292,256,258,292,257,319, + 22,292,260,292,292,292,261,316,312,292, + 263,292,259,292,265,292,264,292,298,295, + 299,262,292,292,267,266,292,292,268,269, + 292,292,270,292,337,292,336,292,292,292, + 292,271,272,273,274,292,275,292,292,292, + 292,318,308,292,292,292,311,292,292,277, + 292,276,278,292,315,292,279,292,280,335, + 284,305,292,292,283,338,292,282,293,281, + 292,306,292,292,352,292,285,292,292,327, + 292,292,292,288,292,292,286,292,344,292, + 287,289,292,339,292,323,326,292,292,292, + 292,292,292,292,292,292,292,292,292,331 }; }; public final static char termAction[] = TermAction.termAction; Modified: trunk/x10.compiler/src/x10/parser/X10KWLexersym.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -15,29 +15,29 @@ public final static int Char_a = 3, Char_b = 15, - Char_c = 6, - Char_d = 16, + Char_c = 5, + Char_d = 18, Char_e = 1, - Char_f = 12, - Char_g = 21, + Char_f = 11, + Char_g = 20, Char_h = 13, - Char_i = 10, + Char_i = 9, Char_j = 26, Char_k = 19, - Char_l = 5, - Char_m = 20, - Char_n = 9, - Char_o = 7, + Char_l = 6, + Char_m = 21, + Char_n = 7, + Char_o = 10, Char_p = 14, Char_q = 24, Char_r = 4, Char_s = 8, Char_t = 2, - Char_u = 11, + Char_u = 12, Char_v = 22, - Char_w = 17, + Char_w = 16, Char_x = 23, - Char_y = 18, + Char_y = 17, Char_z = 27, Char_EOF = 25; @@ -47,23 +47,23 @@ "t", "a", "r", + "c", "l", - "c", - "o", + "n", "s", - "n", "i", + "o", + "f", "u", - "f", "h", "p", "b", - "d", "w", "y", + "d", "k", + "g", "m", - "g", "v", "x", "q", Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-12 02:05:06 UTC (rev 16313) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-12 02:36:41 UTC (rev 16314) @@ -11,9 +11,9 @@ package x10.parser; -import lpg.runtime.*; +import lpg.runtime.*; -//#line 32 "C:/eclipsews/localClasses/x10.compiler/src/x10/parser/x10.g" +//#line 32 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; @@ -123,165 +123,165 @@ import lpg.runtime.RuleAction; import lpg.runtime.UndefinedEofSymbolException; import lpg.runtime.UnimplementedTerminalsException; + +public class X10Parser implements RuleAction, Parser, ParseErrorCodes +{ + private PrsStream prsStream = null; + + private boolean unimplementedSymbolsWarning = false; + + private static ParseTable prsTable = new X10Parserprs(); + public ParseTable getParseTable() { return prsTable; } + + private BacktrackingParser btParser = null; + public BacktrackingParser getParser() { return btParser; } + + private void setResult(Object object) { btParser.setSym1(object); } + public Object getRhsSym(int i) { return btParser.getSym(i); } + + public int getRhsTokenIndex(int i) { return btParser.getToken(i); } + public IToken getRhsIToken(int i) { return prsStream.getIToken(getRhsTokenIndex(i)); } + + public int getRhsFirstTokenIndex(int i) { return btParser.getFirstToken(i); } + public IToken getRhsFirstIToken(int i) { return prsStream.getIToken(getRhsFirstTokenIndex(i)); } + + public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); } + public IToken getRhsLastIToken(int i) { return prsStream.getIToken(getRhsLastTokenIndex(i)); } + + public int getLeftSpan() { return btParser.getFirstToken(); } + public IToken getLeftIToken() { return prsStream.getIToken(getLeftSpan()); } + + public int getRightSpan() { return btParser.getLastToken(); } + public IToken getRightIToken() { return prsStream.getIToken(getRightSpan()); } + + public int getRhsErrorTokenIndex(int i) + { + int index = btParser.getToken(i); + IToken err = prsStream.getIToken(index); + return (err instanceof ErrorToken ? index : 0); + } + public ErrorToken getRhsErrorIToken(int i) + { + int index = btParser.getToken(i); + IToken err = prsStream.getIToken(index); + return (ErrorToken) (err instanceof ErrorToken ? err : null); + } + + public void reset(ILexStream lexStream) + { + prsStream = new PrsStream(lexStream); + btParser.reset(prsStream); + + try + { + prsStream.remapTerminalSymbols(orderedTerminalSymbols(), prsTable.getEoftSymbol()); + } + catch(NullExportedSymbolsException e) { + } + catch(NullTerminalSymbolsException e) { + } + catch(UnimplementedTerminalsException e) + { + if (unimplementedSymbolsWarning) { + java.util.ArrayList unimplemented_symbols = e.getSymbols(); + System.out.println("The Lexer will not scan the following token(s):"); + for (int i = 0; i < unimplemented_symbols.size(); i++) + { + Integer id = (Integer) unimplemented_symbols.get(i); + System.out.println(" " + X10Parsersym.orderedTerminalSymbols[id.intValue()]); + } + System.out.println(); + } + } + catch(UndefinedEofSymbolException e) + { + throw new Error(new UndefinedEofSymbolException + ("The Lexer does not implement the Eof symbol " + + X10Parsersym.orderedTerminalSymbols[prsTable.getEoftSymbol()])); + } + } + + public X10Parser() + { + try + { + btParser = new BacktrackingParser(prsStream, prsTable, (RuleAction) this); + } + catch (NotBacktrackParseTableException e) + { + throw new Error(new NotBacktrackParseTableException + ("Regenerate X10Parserprs.java with -BACKTRACK option")); + } + catch (BadParseSymFileException e) + { + throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- X10Parsersym.java")); + } + } + + public X10Parser(ILexStream lexStream) + { + this(); + reset(lexStream); + } + + public int numTokenKinds() { return X10Parsersym.numTokenKinds; } + public String[] orderedTerminalSymbols() { return X10Parsersym.orderedTerminalSymbols; } + public String getTokenKindName(int kind) { return X10Parsersym.orderedTerminalSymbols[kind]; } + public int getEOFTokenKind() { return prsTable.getEoftSymbol(); } + public IPrsStream getIPrsStream() { return prsStream; } + + /** + * @deprecated replaced by {@link #getIPrsStream()} + * + */ + public PrsStream getPrsStream() { return prsStream; } + + /** + * @deprecated replaced by {@link #getIPrsStream()} + * + */ + public PrsStream getParseStream() { return prsStream; } + + public polyglot.ast.Node parser() + { + return parser(null, 0); + } + + public polyglot.ast.Node parser(Monitor monitor) + { + return parser(monitor, 0); + } + + public polyglot.ast.Node parser(int error_repair_count) + { + return parser(null, error_repair_count); + } + + public polyglot.ast.Node parser(Monitor monitor, int error_repair_count) + { + btParser.setMonitor(monitor); + + try + { + return (polyglot.ast.Node) btParser.fuzzyParse(error_repair_count); + } + catch (BadParseException e) + { + prsStream.reset(e.error_token); // point to error token + + DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable); + diagnoseParser.diagnose(e.error_token); + } + + return null; + } + + // + // Additional entry points, if any + // + -public class X10Parser implements RuleAction, Parser, ParseErrorCodes -{ - private PrsStream prsStream = null; - - private boolean unimplementedSymbolsWarning = false; - - private static ParseTable prsTable = new X10Parserprs(); - public ParseTable getParseTable() { return prsTable; } - - private BacktrackingParser btParser = null; - public BacktrackingParser getParser() { return btParser; } - - private void setResult(Object object) { btParser.setSym1(object); } - public Object getRhsSym(... [truncated message content] |
From: <vj...@us...> - 2010-09-13 04:11:55
|
Revision: 16317 http://x10.svn.sourceforge.net/x10/?rev=16317&view=rev Author: vj0 Date: 2010-09-13 04:11:46 +0000 (Mon, 13 Sep 2010) Log Message: ----------- I.D Added clocked qualifiers for finish, asyncs. FinishStatement ::= clocked finish Statement AtEachStatement ::= clocked ateach (LoopIndex in Expression) Statement ForEachStatement ::= clocked foreach (LoopIndex in Expression) Statement Modifier ::= clocked EnhancedForStatement ::= for ( Expression ) Statement AtEachStatement ::= [clocked] ateach (Expression) Statement ForEachStatement ::= [clocked] foreach (Expression) Statement I.E Added x10.compiler.Det I.G Removed support for async (P) S. Write async at(P) S or at(P) async S. Removed async expressions: AsyncExpression ::= async FunctionBody | async PlaceExpressionSingleList FunctionBody | async [ Type ] FunctionBody | async [ Type ] PlaceExpressionSingleList FunctionBody Added "variable-less" loops: ForLoop ::= foreach ( Expression ) Statement ForEachStatement ::= foreach (Expression ) ClockedClauseopt Statement AtEachStatement ::= ateach ( Expression ) ClockedClauseopt Statement Moved Future to x10.util. There is no longer any syntax support for futures. I.M Change support for point deconstruction. The parenthesis notation '('...')' for point decomposition needs to be aligned with the use of '[' ... ']' for point construction. Remove the productions: FormalDeclarator ::= 359 ( IdentifierList ) ResultType 360 | Identifier ( IdentifierList ) ResultType VariableDeclarator ::= 364 | ( IdentifierList ) HasResultTypeopt = VariableInitializer 365 | Identifier ( IdentifierList ) HasResultTypeopt = VariableInitializer VariableDeclaratorWithType ::= 367 ( IdentifierList ) HasResultType = VariableInitializer 368 | Identifier ( IdentifierList ) HasResultType = VariableInitializer Add the productions: FormalDeclarator ::= [ IdentifierList ] ResultType | Identifier [ IdentifierList ] ResultType VariableDeclarator ::= [ IdentifierList ] HasResultTypeopt = VariableInitializer | Identifier [ IdentifierList ] HasResultTypeopt = VariableInitializer VariableDeclaratorWithType ::= [ IdentifierList ] HasResultType = VariableInitializer | Identifier [ IdentifierList ] HasResultType = VariableInitializer Misc: Moved Latch, Lock, Semaphore, Monitor out of Runtime to top-level status in x10.lang. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/AtEach_c.java trunk/x10.compiler/src/x10/ast/Finish_c.java trunk/x10.compiler/src/x10/ast/ForEach_c.java trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/errors/Errors.java 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.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/X10Context.java trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java trunk/x10.compiler/src/x10/visit/X10InnerClassRemover.java trunk/x10.dist/samples/ArraySum.x10 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/GCSpheres.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeans.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest1.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest2.x10 trunk/x10.tests/examples/Constructs/For/ForLoop.x10 trunk/x10.tests/examples/Constructs/Point/ArrayPointBinding_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Point/ExplodingLocalVar1Test.x10 trunk/x10.tests/examples/Constructs/Point/ExplodingLocalVarTest.x10 trunk/x10.tests/examples/Constructs/Point/PointBinding.x10 trunk/x10.tests/examples/Constructs/Point/PointRebinding.x10 trunk/x10.tests/examples/Constructs/Point/UninitializedPointBinding_MustFailCompile.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Det.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/compiler/RemoteOperation.x10.aside Modified: trunk/x10.compiler/src/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -73,12 +73,20 @@ public Stmt body; protected List<Expr> clocks; + protected boolean clocked; // should be equal to (clocks != null && clocks.size() > 0) public Async_c(Position pos, List<Expr> clocks, Stmt body) { super(pos); this.clocks = clocks; this.body = body; } + public Async_c(Position pos, Stmt body, boolean clocked) { + super(pos); + this.clocked = true; + this.body = body; + // temporary. Needs to be initialized with clock from environment. + this.clocks = new ArrayList<Expr>(); + } public Async_c(Position p) { super(p); Modified: trunk/x10.compiler/src/x10/ast/AtEach_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -38,7 +38,7 @@ import x10.types.constraints.XConstrainedTerm; /** - * An immutable representation of the X10 statement: ateach (i : D) S + * An immutable representation of the X10 statement: [clocked] ateach (i : D) S * @author vj Dec 9, 2004 * @author Christian Grothoff */ @@ -63,6 +63,10 @@ super(pos, formal, domain, clocks, body); loopKind=LoopKind.ATEACH; } + public AtEach_c(Position pos, Formal formal, Expr domain, Stmt body) { + super(pos, formal, domain, body); + loopKind=LoopKind.ATEACH; + } public Expr getDomain(Expr d) { return new Field_c(position(), d, new Id_c(position(), Name.make("dist"))); Modified: trunk/x10.compiler/src/x10/ast/Finish_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Finish_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/Finish_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -31,7 +31,7 @@ public class Finish_c extends Stmt_c implements Finish { protected Stmt body; - + protected boolean clocked; /** * @param pos */ @@ -39,9 +39,10 @@ super(pos); } - public Finish_c(Position pos, Stmt body) { + public Finish_c(Position pos, Stmt body, boolean clocked) { super(pos); this.body = body; + this.clocked = clocked; } Modified: trunk/x10.compiler/src/x10/ast/ForEach_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ForEach_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/ForEach_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -28,7 +28,7 @@ import x10.types.X10TypeSystem; /** - * An immutable representation of the X10 statement: foreach (i : D) S + * An immutable representation of the X10 statement: [clocked] foreach (i : D) S * @author vj Dec 9, 2004 * @author Christian Grothoff */ @@ -53,6 +53,10 @@ super(pos, formal, domain, clocks, body); loopKind=LoopKind.FOREACH; } + public ForEach_c(Position pos, Formal formal, Expr domain, Stmt body) { + super(pos, formal, domain, body); + loopKind=LoopKind.FOREACH; + } public String toString() { return "foreach (" + formal + ":" + domain + ")" + body; Modified: trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -11,6 +11,7 @@ package x10.ast; +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -60,6 +61,13 @@ super(pos, formal, domain, body); this.clocks = TypedList.copyAndCheck(clocks, Expr.class, true); } + public X10ClockedLoop_c(Position pos, Formal formal, Expr domain, + Stmt body) + { + super(pos, formal, domain, body); + // TODO: The clock had to be obtained from the environment in the desugarer and added here. + this.clocks = new ArrayList<Expr>(); + } /** Clocks */ public List clocks() { Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -229,9 +229,7 @@ protected FieldDef createFieldDef(TypeSystem ts, ClassDef ct, Flags flags) { X10Flags xFlags = X10Flags.toX10Flags(flags); - if (xFlags.isProperty()) - xFlags = xFlags.Global(); - + X10FieldDef fi = (X10FieldDef) ts.fieldDef(position(), Types.ref(ct.asType()), flags, type.typeRef(), name.id()); fi.setThisVar(((X10ClassDef) ct).thisVar()); @@ -384,9 +382,7 @@ Type oldType = (Type)type.copy(); X10Context xc = (X10Context) enterChildScope(type(), tc.context()); X10Flags f = X10Flags.toX10Flags(flags.flags()); - if (f.isGlobal() && ! f.isFinal()) { - Errors.issue(tc.job(), new Errors.GlobalFieldIsVar(this)); - } + try { X10TypeMixin.checkMissingParameters(typeNode); } catch (SemanticException e) { Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -292,6 +292,7 @@ result.checkConsistency(c); checkFieldAccessesInDepClausesAreFinal(result, tc); + checkClockedFieldAccessesAreInClockedMethods(result,tc); // Not needed in the orthogonal locality proposal. // result = PlaceChecker.makeFieldAccessLocalIfNecessary(result, tc); @@ -359,6 +360,22 @@ return t; } + /** + * Check thst if this field is a clocked field, it is being accessed from within a clocked method. + * @param result + * @param tc + * @throws SemanticException + */ + protected void checkClockedFieldAccessesAreInClockedMethods(X10Field_c result, ContextVisitor tc) + throws SemanticException { + // Check that field accesses in dep clauses refer to final fields. + X10Context xtc = (X10Context) tc.context(); + if (X10Flags.toX10Flags(result.flags()).isClocked() + && ! ((X10Context) tc.context()).isClocked()) { + throw new Errors.IllegalClockedAccess(this, position()); + } + } + private static final boolean ENABLE_PLACE_TYPES = true; protected void checkFieldAccessesInDepClausesAreFinal(X10Field_c result, ContextVisitor tc) Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -329,10 +329,11 @@ // entering the body of the method, the return type and the throw type. - if (child == body || child == returnType || child == hasType || child == throwTypes || child == offerType || (formals != null && formals.contains(child))) { + if (child == body || child == returnType || child == hasType || child == throwTypes || child == offerType + || (formals != null && formals.contains(child))) { if (placeTerm != null) c = ((X10Context) c).pushPlace( XConstrainedTerm.make(placeTerm)); - PlaceChecker.pushHereTerm(methodDef(), (X10Context) c); + PlaceChecker.pushHereTerm(methodDef(), (X10Context) c); } // Add the method guard into the environment. @@ -429,7 +430,7 @@ NodeFactory nf = tc.nodeFactory(); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); if (((X10TypeSystem) tc.typeSystem()).isStructType(mi.container().get())) { - Flags xf = X10Flags.toX10Flags(mi.flags()).Global().Final(); + Flags xf = X10Flags.toX10Flags(mi.flags()).Final(); mi.setFlags(xf); n = (X10MethodDecl_c) n.flags(n.flags().flags(xf)); } Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -90,6 +90,7 @@ Instanceof Instanceof(Position pos, Expr expr, TypeNode type); Async Async(Position pos, List<Expr> clocks, Stmt body); + Async Async(Position pos, Stmt body, boolean clocked); Atomic Atomic(Position pos, Expr place, Stmt body); Future Future(Position pos, Expr place, TypeNode returnType, Block body); Here Here(Position pos); @@ -118,9 +119,11 @@ X10Loop ForLoop(Position pos, Formal formal, Expr domain, Stmt body); X10Loop ForEach(Position pos, Formal formal, Expr domain, List<Expr> clocks, Stmt body); + X10Loop ForEach(Position pos, Formal formal, Expr domain, Stmt body); X10Loop AtEach(Position pos, Formal formal, Expr domain, List<Expr> clocks, Stmt body); - Finish Finish(Position pos, Stmt body); + X10Loop AtEach(Position pos, Formal formal, Expr domain, Stmt body); + Finish Finish(Position pos, Stmt body, boolean clocked); DepParameterExpr DepParameterExpr(Position pos, List<Expr> cond); DepParameterExpr DepParameterExpr(Position pos, List<Formal> formals, List<Expr> cond); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -231,6 +231,14 @@ a = (Async) a.del(del_fac.delAsyncImpl()); return a; } + public Async Async(Position pos, Stmt body, boolean clocked) { + Async a = new Async_c(pos, asBlock(body), clocked); + X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); + a = (Async) a.ext(ext_fac.extAsyncImpl()); + X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); + a = (Async) a.del(del_fac.delAsyncImpl()); + return a; + } // Wrap the body of the async in a Block so as to ease further code transforamtions. public AtStmt AtStmt(Position pos, Expr place, Stmt body) { AtStmt a = new AtStmt_c(pos, place, asBlock(body)); @@ -414,6 +422,16 @@ n = (AtEach) n.del(del_fac.delAtEachImpl()); return n; } + public AtEach AtEach(Position pos, Formal formal, Expr domain, + Stmt body) + { + AtEach n = new AtEach_c(pos, formal, domain, asBlock(body)); + X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); + n = (AtEach) n.ext(ext_fac.extAtEachImpl()); + X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); + n = (AtEach) n.del(del_fac.delAtEachImpl()); + return n; + } public For For(Position pos, List<ForInit> inits, Expr cond, List<ForUpdate> iters, Stmt body) { For n = new For_c(pos, inits, cond, iters, asBlock(body)); @@ -444,10 +462,20 @@ n = (ForEach) n.del(del_fac.delForEachImpl()); return n; } + public ForEach ForEach(Position pos, Formal formal, Expr domain, + Stmt body) + { + ForEach n = new ForEach_c(pos, formal, domain, asBlock(body)); + X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); + n = (ForEach) n.ext(ext_fac.extForEachImpl()); + X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); + n = (ForEach) n.del(del_fac.delForEachImpl()); + return n; + } // Wrap the body in a block to facilitate code transformations - public Finish Finish(Position pos, Stmt body) { - Finish n = new Finish_c(pos, asBlock(body)); + public Finish Finish(Position pos, Stmt body, boolean clocked) { + Finish n = new Finish_c(pos, asBlock(body), clocked); X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); n = (Finish) n.ext(ext_fac.extFinishImpl()); X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -1258,7 +1258,6 @@ w.begin(0); w.write(flags.clearAbstract() - .clear(X10Flags.GLOBAL) .clear(X10Flags.SAFE) .clear(X10Flags.NATIVE) .translate() @@ -1388,7 +1387,6 @@ w.begin(0); w.write(flags.clearAbstract() - .clear(X10Flags.GLOBAL) .clear(X10Flags.SAFE) .clear(X10Flags.NATIVE) .translate() Modified: trunk/x10.compiler/src/x10/errors/Errors.java =================================================================== --- trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/errors/Errors.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -837,4 +837,15 @@ return((GlobalClassMustHaveGlobalClassSupertype)o).position().equals(position()); } } + public static class IllegalClockedAccess extends SemanticException { + private static final long serialVersionUID = -5824261892277076305L; + public IllegalClockedAccess(Field field, Position pos) { + super(field + " must be accessed in a clocked context.", pos); + } + public boolean equals(Object o) { + if (o==null || ! (o instanceof IllegalClockedAccess) ) + return false; + return((IllegalClockedAccess)o).position().equals(position()); + } + } } Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-12 20:46:14 UTC (rev 16316) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2010-09-13 04:11:46 UTC (rev 16317) @@ -11,7 +11,7 @@ package x10.parser; -import lpg.runtime.*; +import lpg.runtime.*; //#line 32 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; @@ -123,164 +123,164 @@ import lpg.runtime.RuleAction; import lpg.runtime.UndefinedEofSymbolException; import lpg.runtime.UnimplementedTerminalsException; - -public class X10Parser implements RuleAction, Parser, ParseErrorCodes -{ - private PrsStream prsStream = null; - - private boolean unimplementedSymbolsWarning = false; - - private static ParseTable prsTable = new X10Parserprs(); - public ParseTable getParseTable() { return prsTable; } - - private BacktrackingParser btParser = null; - public BacktrackingParser getParser() { return btParser; } - - private void setResult(Object object) { btParser.setSym1(object); } - public Object getRhsSym(int i) { return btParser.getSym(i); } - - public int getRhsTokenIndex(int i) { return btParser.getToken(i); } - public IToken getRhsIToken(int i) { return prsStream.getIToken(getRhsTokenIndex(i)); } - - public int getRhsFirstTokenIndex(int i) { return btParser.getFirstToken(i); } - public IToken getRhsFirstIToken(int i) { return prsStream.getIToken(getRhsFirstTokenIndex(i)); } - - public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); } - public IToken getRhsLastIToken(int i) { return prsStream.getIToken(getRhsLastTokenIndex(i)); } - - public int getLeftSpan() { return btParser.getFirstToken(); } - public IToken getLeftIToken() { return prsStream.getIToken(getLeftSpan()); } - - public int getRightSpan() { return btParser.getLastToken(); } - public IToken getRightIToken() { return prsStream.getIToken(getRightSpan()); } - - public int getRhsErrorTokenIndex(int i) - { - int index = btParser.getToken(i); - IToken err = prsStream.getIToken(index); - return (err instanceof ErrorToken ? index : 0); - } - public ErrorToken getRhsErrorIToken(int i) - { - int index = btParser.getToken(i); - IToken err = prsStream.getIToken(index); - return (ErrorToken) (err instanceof ErrorToken ? err : null); - } - - public void reset(ILexStream lexStream) - { - prsStream = new PrsStream(lexStream); - btParser.reset(prsStream); - - try - { - prsStream.remapTerminalSymbols(orderedTerminalSymbols(), prsTable.getEoftSymbol()); - } - catch(NullExportedSymbolsException e) { - } - catch(NullTerminalSymbolsException e) { - } - catch(UnimplementedTerminalsException e) - { - if (unimplementedSymbolsWarning) { - java.util.ArrayList unimplemented_symbols = e.getSymbols(); - System.out.println("The Lexer will not scan the following token(s):"); - for (int i = 0; i < unimplemented_symbols.size(); i++) - { - Integer id = (Integer) unimplemented_symbols.get(i); - System.out.println(" " + X10Parsersym.orderedTerminalSymbols[id.intValue()]); - } - System.out.println(); - } - } - catch(UndefinedEofSymbolException e) - { - throw new Error(new UndefinedEofSymbolException - ("The Lexer does not implement the Eof symbol " + - X10Parsersym.orderedTerminalSymbols[prsTable.getEoftSymbol()])); - } - } - - public X10Parser() - { - try - { - btParser = new BacktrackingParser(prsStream, prsTable, (RuleAction) this); - } - catch (NotBacktrackParseTableException e) - { - throw new Error(new NotBacktrackParseTableException - ("Regenerate X10Parserprs.java with -BACKTRACK option")); - } - catch (BadParseSymFileException e) - { - throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- X10Parsersym.java")); - } - } - - public X10Parser(ILexStream lexStream) - { - this(); - reset(lexStream); - } - - public int numTokenKinds() { return X10Parsersym.numTokenKinds; } - public String[] orderedTerminalSymbols() { return X10Parsersym.orderedTerminalSymbols; } - public String getTokenKindName(int kind) { return X10Parsersym.orderedTerminalSymbols[kind]; } - public int getEOFTokenKind() { return prsTable.getEoftSymbol(); } - public IPrsStream getIPrsStream() { return prsStream; } - - /** - * @deprecated replaced by {@link #getIPrsStream()} - * - */ - public PrsStream getPrsStream() { return prsStream; } - - /** - * @deprecated replaced by {@link #getIPrsStream()} - * - */ - public PrsStream getParseStream() { return prsStream; } - - public polyglot.ast.Node parser() - { - return parser(null, 0); - } - - public polyglot.ast.Node parser(Monitor monitor) - { - return parser(monitor, 0); - } - - public polyglot.ast.Node parser(int error_repair_count) - { - return parser(null, error_repair_count); - } - - public polyglot.ast.Node parser(Monitor monitor, int error_repair_count) - { - btParser.setMonitor(monitor); - - try - { - return (polyglot.ast.Node) btParser.fuzzyParse(error_repair_count); - } - catch (BadParseException e) - { - prsStream.reset(e.error_token); // point to error token - - DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable); - diagnoseParser.diagnose(e.error_token); - } - - return null; - } - - // - // Additional entry points, if any - // - +public class X10Parser implements RuleAction, Parser, ParseErrorCodes +{ + private PrsStream prsStream = null; + + private boolean unimplementedSymbolsWarning = false; + + private static ParseTable prsTable = new X10Parserprs(); + public ParseTable getParseTable() { return prsTable; } + + private BacktrackingParser btParser = null; + public BacktrackingParser getParser() { return btParser; } + + private void setResult(Object object) { btParser.setSym1(object); } + public Object getRhsSym(int i) { return btParser.getSym(i); } + + public int getRhsTokenIndex(int i) { return btParser.getToken(i); } + public IToken getRhsIToken(int i) { return prsStream.getIToken(getRhsTokenIndex(i)); } + + public int getRhsFirstTokenIndex(int i) { return btParser.getFirstToken(i); } + public IToken getRhsFirstIToken(int i) { return prsStream.getIToken(getRhsFirstTokenIndex(i)); } + + public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); } + public IToken getRhsLastIToken(int i) { return prsStream.getIToken(getRhsLastTokenIndex(i)); } + + public int getLeftSpan() { return btParser.getFirstToken(); } + public IToken getLeftIToken() { return prsStream.getIToken(getLeftSpan()); } + + public int getRightSpan() { return btParser.getLastToken(); } + public IToken getRightIToken() { return prsStream.getIToken(getRightSpan()); } + + public int getRhsErrorTokenIndex(int i) + { + int index = btParser.getToken(i); + IToken err = prsStream.getIToken(index); + return (err instanceof ErrorToken ? index : 0); + } + public ErrorToken getRhsErrorIToken(int i) + { + int index = btParser.getToken(i); + IToken err = prsStream.getIToken(index); + return (ErrorToken) (err instanceof ErrorToken ? err : null); + } + + public void reset(ILexStream lexStream) + { + prsStream = new PrsStream(lexStream); + btParser.reset(prsStream); + + try + { + prsStream.remapTerminalSymbols(orderedTerminalSymbols(), prsTable.getEoftSymbol()); + } + catch(NullExportedSymbolsException e) { + } + catch(NullTerminalSymbolsException e) { + } + catch(UnimplementedTerminalsException e) + { + if (unimplementedSymbolsWarning) { + java.util.ArrayList unimplemented_symbols = e.getSymbols(); + System.out.println("The Lexer will not scan the following token(s):"); + for (int i = 0; i < unimplemented_symbols.size(); i++) + { + Integer id = (Integer) unimplemented_symbols.get(i); + System.out.println(" " + X10Parsersym.orderedTerminalSymbols[id.intValue()]); + } + System.out.println(); + } + } + catch(UndefinedEofSymbolException e) + { + throw new Error(new UndefinedEofSymbolException + ("The Lexer does not implement the Eof symbol " + + X10Parsersym.orderedTerminalSymbols[prsTable.getEoftSymbol()])); + } + } + + public X10Parser() + { + try + { + btParser = new BacktrackingParser(prsStream, prsTable, (RuleAction) this); + } + catch (NotBacktrackParseTableException e) + { + throw new Error(new NotBacktrackParseTableException + ("Regenerate X10Parserprs.java with -BACKTRACK option")); + } + catch (BadParseSymFileException e) + { + throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- X10Parsersym.java")); + } + } + + public X10Parser(ILexStream lexStream) + { + this(); + reset(lexStream); + } + + public int numTokenKinds() { return X10Parsersym.numTokenKinds; } + public String[] orderedTerminalSymbols() { return X10Parsersym.orderedTerminalSymbols; } + public String getTokenKindName(int kind) { return X10Parsersym.orderedTerminalSymbols[kind]; } + public int getEOFTokenKind() { return prsTable.getEoftSymbol(); } + public IPrsStream getIPrsStream() { return prsStream; } + + /** + * @deprecated replaced by {@link #getIPrsStream()} + * + */ + public PrsStream getPrsStream() { return prsStream; } + + /** + * @deprecated replaced by {@link #getIPrsStream()} + * + */ + public PrsStream getParseStream() { return prsStream; } + + public polyglot.ast.Node parser() + { + return parser(null, 0); + } + + public polyglot.ast.Node parser(Monitor monitor) + { + return parser(monitor, 0); + } + + public polyglot.ast.Node parser(int error_repair_count) + { + return parser(null, error_repair_count); + } + + public polyglot.ast.Node parser(Monitor monitor, int error_repair_count) + { + btParser.setMonitor(monitor); + + try + { + return (polyglot.ast.Node) btParser.fuzzyParse(error_repair_count); + } + catch (BadParseException e) + { + prsStream.reset(e.error_token); // point to error token + + DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable); + diagnoseParser.diagnose(e.error_token); + } + + return null; + } + + // + // Additional entry points, if any + // + + //#line 314 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" private ErrorQueue eq; private X10TypeSystem ts; @@ -1151,491 +1151,491 @@ return new NullLiteral(pos(i), X10Parsersym.TK_null); } - - public void ruleAction(int ruleNumber) - { - switch (ruleNumber) + + public void ruleAction(int ruleNumber) + { + switch (ruleNumber) { - - // - // Rule 1: TypeName ::= TypeName . ErrorId - // - case 1: { - //#line 8 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 1: TypeName ::= TypeName . ErrorId + // + case 1: { + //#line 8 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 6 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName TypeName = (ParsedName) getRhsSym(1); + ParsedName TypeName = (ParsedName) getRhsSym(1); //#line 8 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), TypeName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 2: PackageName ::= PackageName . ErrorId - // - case 2: { - //#line 18 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 2: PackageName ::= PackageName . ErrorId + // + case 2: { + //#line 18 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 16 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName PackageName = (ParsedName) getRhsSym(1); + ParsedName PackageName = (ParsedName) getRhsSym(1); //#line 18 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), PackageName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 3: ExpressionName ::= AmbiguousName . ErrorId - // - case 3: { - //#line 28 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 3: ExpressionName ::= AmbiguousName . ErrorId + // + case 3: { + //#line 28 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 26 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName AmbiguousName = (ParsedName) getRhsSym(1); + ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 28 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), AmbiguousName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 4: MethodName ::= AmbiguousName . ErrorId - // - case 4: { - //#line 38 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 4: MethodName ::= AmbiguousName . ErrorId + // + case 4: { + //#line 38 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 36 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName AmbiguousName = (ParsedName) getRhsSym(1); + ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 38 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), AmbiguousName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 5: PackageOrTypeName ::= PackageOrTypeName . ErrorId - // - case 5: { - //#line 48 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 5: PackageOrTypeName ::= PackageOrTypeName . ErrorId + // + case 5: { + //#line 48 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 46 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName PackageOrTypeName = (ParsedName) getRhsSym(1); + ParsedName PackageOrTypeName = (ParsedName) getRhsSym(1); //#line 48 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), PackageOrTypeName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 6: AmbiguousName ::= AmbiguousName . ErrorId - // - case 6: { - //#line 58 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 6: AmbiguousName ::= AmbiguousName . ErrorId + // + case 6: { + //#line 58 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 56 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - ParsedName AmbiguousName = (ParsedName) getRhsSym(1); + ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 58 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), AmbiguousName, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 7: FieldAccess ::= Primary . ErrorId - // - case 7: { - //#line 68 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 7: FieldAccess ::= Primary . ErrorId + // + case 7: { + //#line 68 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 66 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - Expr Primary = (Expr) getRhsSym(1); + Expr Primary = (Expr) getRhsSym(1); //#line 68 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(), Primary, nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 8: FieldAccess ::= super . ErrorId - // - case 8: { - //#line 74 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 8: FieldAccess ::= super . ErrorId + // + case 8: { + //#line 74 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 74 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getLeftSpan())), nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 9: FieldAccess ::= ClassName . super$sup . ErrorId - // - case 9: { - //#line 80 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 9: FieldAccess ::= ClassName . super$sup . ErrorId + // + case 9: { + //#line 80 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 78 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); //#line 78 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - IToken sup = (IToken) getRhsIToken(3); + IToken sup = (IToken) getRhsIToken(3); //#line 80 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getRhsFirstTokenIndex(3)), ClassName.toType()), nf.Id(pos(getRightSpan()), "*"))); - break; + break; } - - // - // Rule 10: MethodInvocation ::= MethodPrimaryPrefix ( ArgumentListopt ) - // - case 10: { - //#line 87 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 10: MethodInvocation ::= MethodPrimaryPrefix ( ArgumentListopt ) + // + case 10: { + //#line 87 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 85 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" Object MethodPrimaryPrefix = (Object) getRhsSym(1); //#line 85 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - List ArgumentListopt = (List) getRhsSym(3); + List ArgumentListopt = (List) getRhsSym(3); //#line 87 "C:/eclipsews/head1/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)); - break; + break; } - - // - // Rule 11: MethodInvocation ::= MethodSuperPrefix ( ArgumentListopt ) - // - case 11: { - //#line 94 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 11: MethodInvocation ::= MethodSuperPrefix ( ArgumentListopt ) + // + case 11: { + //#line 94 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 92 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" polyglot.lex.Identifier MethodSuperPrefix = (polyglot.lex.Identifier) getRhsSym(1); //#line 92 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - List ArgumentListopt = (List) getRhsSym(3); + List ArgumentListopt = (List) getRhsSym(3); //#line 94 "C:/eclipsews/head1/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; + break; } - - // - // Rule 12: MethodInvocation ::= MethodClassNameSuperPrefix ( ArgumentListopt ) - // - case 12: { - //#line 100 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 12: MethodInvocation ::= MethodClassNameSuperPrefix ( ArgumentListopt ) + // + case 12: { + //#line 100 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 98 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" Object MethodClassNameSuperPrefix = (Object) getRhsSym(1); //#line 98 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - List ArgumentListopt = (List) getRhsSym(3); + List ArgumentListopt = (List) getRhsSym(3); //#line 100 "C:/eclipsews/head1/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]; setResult(nf.Call(pos(), nf.Super(super_pos, ClassName.toType()), nf.Id(pos(), identifier.getIdentifier()), ArgumentListopt)); - break; + break; } - - // - // Rule 13: MethodPrimaryPrefix ::= Primary . ErrorId$ErrorId - // - case 13: { - //#line 109 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 13: MethodPrimaryPrefix ::= Primary . ErrorId$ErrorId + // + case 13: { + //#line 109 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 107 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); //#line 107 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - IToken ErrorId = (IToken) getRhsIToken(3); + IToken ErrorId = (IToken) getRhsIToken(3); //#line 109 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[2]; a[0] = Primary; a[1] = id(getRhsFirstTokenIndex(3)); setResult(a); - break; + break; } - - // - // Rule 14: MethodSuperPrefix ::= super . ErrorId$ErrorId - // - case 14: { - //#line 117 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 14: MethodSuperPrefix ::= super . ErrorId$ErrorId + // + case 14: { + //#line 117 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 115 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - IToken ErrorId = (IToken) getRhsIToken(3); + IToken ErrorId = (IToken) getRhsIToken(3); //#line 117 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(id(getRhsFirstTokenIndex(3))); - break; + break; } - - // - // Rule 15: MethodClassNameSuperPrefix ::= ClassName . super$sup . ErrorId$ErrorId - // - case 15: { - //#line 122 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 15: MethodClassNameSuperPrefix ::= ClassName . super$sup . ErrorId$ErrorId + // + case 15: { + //#line 122 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 120 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); //#line 120 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); //#line 120 "C:/eclipsews/head1/x10.compiler/src/x10/parser/MissingId.gi" - IToken ErrorId = (IToken) getRhsIToken(5); + IToken ErrorId = (IToken) getRhsIToken(5); //#line 122 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" Object[] a = new Object[3]; a[0] = ClassName; a[1] = pos(getRhsFirstTokenIndex(3)); a[2] = id(getRhsFirstTokenIndex(5)); setResult(a); - break; + break; } - - // - // Rule 16: Modifiersopt ::= $Empty - // - case 16: { - //#line 1189 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 16: Modifiersopt ::= $Empty + // + case 16: { + //#line 1189 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1189 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new LinkedList()); - break; + break; } - - // - // Rule 17: Modifiersopt ::= Modifiersopt Modifier - // - case 17: { - //#line 1194 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 17: Modifiersopt ::= Modifiersopt Modifier + // + case 17: { + //#line 1194 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 1192 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" List Modifiersopt = (List) getRhsSym(1); //#line 1192 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" - Modifier Modifier = (Modifier) getRhsSym(2); + Modifier Modifier = (Modifier) getRhsSym(2); //#line 1194 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" Modifiersopt.add(Modifier); - break; + break; } - - // - // Rule 18: Modifier ::= abstract - // - case 18: { - //#line 1200 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 18: Modifier ::= abstract + // + case 18: { + //#line 1200 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1200 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.ABSTRACT)); - break; + break; } - - // - // Rule 19: Modifier ::= Annotation - // - case 19: { - //#line 1205 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + + // + // Rule 19: Modifier ::= Annotation + // + case 19: { + //#line 1205 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" //#line 1203 "C:/eclipsews/head1/x10.compiler/src/x10/parser/x10.g" - AnnotationNode Annotation = (AnnotationNode) getRhsSym(1); + AnnotationNode Annotation = (AnnotationNode) getRhsSym(1); //#line 1205 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new AnnotationModifier(Annotation)); - break; + break; } - - // - // Rule 20: Modifier ::= atomic - // - case 20: { - //#line 1210 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 20: Modifier ::= atomic + // + case 20: { + //#line 1210 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1210 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.ATOMIC)); - break; + break; } - - // - // Rule 21: Modifier ::= extern - // - case 21: { - //#line 1215 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 21: Modifier ::= extern + // + case 21: { + //#line 1215 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1215 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.EXTERN)); - break; + break; } - - // - // Rule 22: Modifier ::= final - // - case 22: { - //#line 1220 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 22: Modifier ::= final + // + case 22: { + //#line 1220 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1220 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.FINAL)); - break; + break; } - - // - // Rule 23: Modifier ::= global - // - case 23: { - //#line 1225 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 23: Modifier ::= global + // + case 23: { + //#line 1225 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1225 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.GLOBAL)); - break; + break; } - - // - // Rule 24: Modifier ::= incomplete - // - case 24: { - //#line 1230 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 24: Modifier ::= incomplete + // + case 24: { + //#line 1230 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1230 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.INCOMPLETE)); - break; + break; } - - // - // Rule 25: Modifier ::= native - // - case 25: { - //#line 1235 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 25: Modifier ::= native + // + case 25: { + //#line 1235 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1235 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.NATIVE)); - break; + break; } - - // - // Rule 26: Modifier ::= nonblocking - // - case 26: { - //#line 1240 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 26: Modifier ::= nonblocking + // + case 26: { + //#line 1240 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1240 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.NON_BLOCKING)); - break; + break; } - - // - // Rule 27: Modifier ::= private - // - case 27: { - //#line 1245 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 27: Modifier ::= private + // + case 27: { + //#line 1245 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1245 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.PRIVATE)); - break; + break; } - - // - // Rule 28: Modifier ::= protected - // - case 28: { - //#line 1250 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 28: Modifier ::= protected + // + case 28: { + //#line 1250 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1250 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.PROTECTED)); - break; + break; } - - // - // Rule 29: Modifier ::= public - // - case 29: { - //#line 1255 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 29: Modifier ::= public + // + case 29: { + //#line 1255 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1255 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.PUBLIC)); - break; + break; } - - // - // Rule 30: Modifier ::= safe - // - case 30: { - //#line 1260 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 30: Modifier ::= safe + // + case 30: { + //#line 1260 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1260 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.SAFE)); - break; + break; } - - // - // Rule 31: Modifier ::= sequential - // - case 31: { - //#line 1265 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" - + + // + // Rule 31: Modifier ::= sequential + // + case 31: { + //#line 1265 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1265 "C:/eclipsews/head1/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new FlagModifier(pos(), FlagModifier.SEQUENTIAL)); - break; + break; } - - // - // Rule 32: Modifier ::= static - // - ... [truncated message content] |
From: <yz...@us...> - 2010-09-13 20:28:40
|
Revision: 16330 http://x10.svn.sourceforge.net/x10/?rev=16330&view=rev Author: yzibin Date: 2010-09-13 20:28:33 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Fixed init problems in our X10 test files, fixed some bugs in my dataflow alg. Modified Paths: -------------- trunk/x10.compiler/build.xml trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 trunk/x10.tests/examples/Constructs/Distribution/TestDist.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverloading14.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding04.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding05.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding06.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding07.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding12.x10 trunk/x10.tests/examples/Constructs/Generics/GenericOverriding13.x10 trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Point/TestPoint.x10 trunk/x10.tests/examples/Issues/XTENLANG_217.x10 trunk/x10.tests/examples/Issues/XTENLANG_242.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFTimer.x10 Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.compiler/build.xml 2010-09-13 20:28:33 UTC (rev 16330) @@ -4,7 +4,7 @@ &buildfile; <property name="x10.home" value="${basedir}/.."/> <property name="x10.dist.location" location="${x10.home}/x10.dist"/> - <property name="lpg.location" location="${x10.home}/lpg.generator"/> + <property name="lpg.location" location="${x10.home}/../../lpg_parser"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="build" location="${basedir}/classes"/> @@ -94,8 +94,8 @@ <condition property="platform" value="macosx"><os name="Mac OS X"/></condition> <!-- Work around Mac OS's Java reporting x86 as i386 --> <condition property="arch" value="x86" else="${os.arch}"><equals arg1="${os.arch}" arg2="i386"/></condition> - <property name="lpg.executable.location" location="${x10.home}/lpg.generator.${platform}_${arch}"/> - <property name="lpg.executable" location="${lpg.executable.location}/lpgexe/lpg-${platform}_${arch}"/> + <property name="lpg.executable.location" location="${x10.home}/../../lpg_parser/lpg.generator.win32_x86"/> + <property name="lpg.executable" location="${lpg.executable.location}/lpgexe/lpg-win32_x86"/> <!-- <echo message="OS: ${os.name} ${os.arch}"/> <echo message="Platform: ${platform}"/> Modified: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java =================================================================== --- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-13 20:28:33 UTC (rev 16330) @@ -91,7 +91,7 @@ } protected Item confluence(List items, List itemKeys, Term node, boolean entry, FlowGraph graph) { - if (node instanceof ConstructorDecl) { + if (node instanceof ProcedureDecl) { List filtered = filterItemsNonException(items, itemKeys); if (filtered.isEmpty()) { return INIT; @@ -252,7 +252,7 @@ // report the field that wasn't written to for (X10FieldDecl_c f : fields) if (!newInfo.seqWrite.contains(f)) { - reportError("Field '"+f.name()+"' was not definitely assigned in this constructor.",decl.position()); + reportError("Field '"+f.name()+"' was not definitely assigned.",f.position()); } } } @@ -308,7 +308,8 @@ } private void checkField(FieldDef def, Position p) { - if (!def.flags().isStatic() && !initFields.contains(def)) { + if (allFields.contains(def) && // to make sure it is declared in this class (and not in a super or outer class) + !initFields.contains(def)) { reportError("Illegal forward reference for field '"+def.name()+"'.",p); } } @@ -335,6 +336,7 @@ private final HashSet<X10FieldDecl_c> fields = new HashSet<X10FieldDecl_c>(); private boolean wasChange = true, wasError = false; // for fixed point alg private FieldDef globalRef = null;// There is one exception to the "this cannot escape" rule: val root = GlobalRef[...](this) + private Set<FieldDef> allFields = new HashSet<FieldDef>(); // all non-static fields in this class (excluding fields in the superclass because those have already been initialized by the super ctor call) private Set<FieldDef> initFields = new HashSet<FieldDef>(); // fields that have been initialized already (to prevent forward references) private void checkGlobalRef(Node n) { @@ -359,41 +361,47 @@ } private void typeCheck() { final X10ClassBody_c body = (X10ClassBody_c)xlass.body(); - // visit all field initializers and check that they do not have forward references nor that "this" escapes + // visit all (non-static) field initializers and check that they do not have forward references nor that "this" escapes FieldInitVisitor fieldInitVisitor = new FieldInitVisitor(); + ArrayList<X10FieldDecl_c> nonStaticFields = new ArrayList<X10FieldDecl_c>(); for (ClassMember classMember : body.members()) { if (classMember instanceof X10FieldDecl_c) { X10FieldDecl_c field = (X10FieldDecl_c) classMember; - final Flags flags = field.flags().flags(); - final Expr init = field.init(); - if (init==null) continue; - // check for the pattern: GlobalRef[...](this) - if (init instanceof X10New_c) { - X10New_c new_c = (X10New_c) init; - final TypeNode typeNode = new_c.objectType(); - final List<Expr> args = new_c.arguments(); - if (args.size()==1 && isThis(args.get(0)) && // the first and only argument is "this" - typeNode instanceof X10CanonicalTypeNode_c) { // now checking the ctor is of GlobalRef - X10CanonicalTypeNode_c tn = (X10CanonicalTypeNode_c) typeNode; - final Type type = tn.type(); - if (type instanceof X10ParsedClassType_c) { - X10ParsedClassType_c classType_c = (X10ParsedClassType_c) type; - final QName qName = classType_c.def().fullName(); - if (qName.equals(QName.make("x10.lang","GlobalRef"))) { - // found the pattern! - if (globalRef!=null) { - reportError("You can use the pattern 'val root = GlobalRef[...](this);' only once in a class.",field.position()); - continue; - } - globalRef = field.fieldDef(); + if (field.flags().flags().isStatic()) continue; + nonStaticFields.add(field); + allFields.add(field.fieldDef()); + } + } + // checking "this" doesn't escape from field init + for (X10FieldDecl_c field : nonStaticFields) { + final Expr init = field.init(); + if (init==null) continue; + // check for the pattern: GlobalRef[...](this) + if (init instanceof X10New_c) { + X10New_c new_c = (X10New_c) init; + final TypeNode typeNode = new_c.objectType(); + final List<Expr> args = new_c.arguments(); + if (args.size()==1 && isThis(args.get(0)) && // the first and only argument is "this" + typeNode instanceof X10CanonicalTypeNode_c) { // now checking the ctor is of GlobalRef + X10CanonicalTypeNode_c tn = (X10CanonicalTypeNode_c) typeNode; + final Type type = tn.type(); + if (type instanceof X10ParsedClassType_c) { + X10ParsedClassType_c classType_c = (X10ParsedClassType_c) type; + final QName qName = classType_c.def().fullName(); + if (qName.equals(QName.make("x10.lang","GlobalRef"))) { + // found the pattern! + if (globalRef!=null) { + reportError("You can use the pattern 'val root = GlobalRef[...](this);' only once in a class.",field.position()); continue; } + globalRef = field.fieldDef(); + continue; } } } - init.visit(fieldInitVisitor); - initFields.add(field.fieldDef()); } + init.visit(fieldInitVisitor); + initFields.add(field.fieldDef()); } // visit every ctor, and every method called from a ctor, and check that this and super do not escape for (ClassMember classMember : body.members()) { @@ -504,19 +512,22 @@ } else { // the method must be final or private X10MethodDecl_c method = findMethod(call); - ProcedureDef pd = method.procedureInstance(); - if (method==null || allMethods.containsKey(pd)) { - // we already analyzed this method (or it is an error method) + if (method==null) { + reportError("The call "+call+" is illegal because you cannot call methods defined in a superclass from a constructor or from methods called from a constructor",call.position()); } else { - allMethods.put(pd,new MethodInfo()); // prevent infinite recursion - // verify the method is indeed private/final - if (!flags.isFinal() && !flags.isPrivate()) { - reportError("The call "+call+" is illegal because you can only call private or final methods from a constructor or from methods called from a constructor",call.position()); + ProcedureDef pd = method.procedureInstance(); + if (allMethods.containsKey(pd)) { + // we already analyzed this method (or it is an error method) + } else { + allMethods.put(pd,new MethodInfo()); // prevent infinite recursion + // verify the method is indeed private/final + if (!flags.isFinal() && !flags.isPrivate()) { + reportError("The call "+call+" is illegal because you can only call private or final methods from a constructor or from methods called from a constructor",call.position()); + } + method.body().visit(this); + dfsMethods.add(method); } - method.body().visit(this); - dfsMethods.add(method); } - } // it is enough to just recurse into the arguments (because the receiver is either this or super) Modified: trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -33,7 +33,7 @@ static POLY = 0x0000000000000007L; static PERIOD = 1317624576693539401L; - final class LocalTable { + final static class LocalTable { val a: Rail[long]; val mask: int; Modified: trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -35,7 +35,7 @@ static POLY = 0x0000000000000007L; static PERIOD = 1317624576693539401L; - final class LocalTable { + static final class LocalTable { val a: Rail[long]; val mask: int; Modified: trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -17,7 +17,7 @@ */ public class AsyncFieldAccess extends x10Test { val root = GlobalRef[AsyncFieldAccess](this); - transient var t: GlobalRef[T]; + transient var t: GlobalRef[T] = GlobalRef[T](null); public def run(): boolean = { var Second: Place = Place.FIRST_PLACE.next(); var r: Region = [0..0]; Modified: trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -15,7 +15,7 @@ * Testing that a value created remotely has the right type so it can be accessed safely within a subsequent remote at. */ public class AtFieldWrite extends x10Test { - var t: GlobalRef[T]; + var t: GlobalRef[T] = GlobalRef[T](null); public def run() { val Second = Place.FIRST_PLACE.next(); val newT = (at (Second) new T()).root; Modified: trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Closures/ClosureEnclosingScope6.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -24,14 +24,14 @@ val a = 1; class C { - def a() = 2; + val a = 2; class D { - def a() = 4; + val a = 4; val sum = (()=>( ClosureEnclosingScope6.this.a // DYNAMIC_CHECK + - C.this.a()+ // DYNAMIC_CHECK - D.this.a()+a()))(); + C.this.a+ // DYNAMIC_CHECK + D.this.a+a))(); } } Modified: trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -26,7 +26,7 @@ public class ClosureExample1 extends x10Test { // def find[T](f:(T)=>Boolean, xs: List[T]):T { - def find[T](f:(T)=>Boolean, xs: List[T]): Box[T] { + static def find[T](f:(T)=>Boolean, xs: List[T]): Box[T] { for (x in xs) // if (f(x)) return x; if (f(x)) return x as Box[T]; Modified: trunk/x10.tests/examples/Constructs/Distribution/TestDist.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Distribution/TestDist.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Distribution/TestDist.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -22,7 +22,7 @@ val os: StringWriter; val out: Printer; - val testName = typeName(); + val testName = "TestDist"; def this() { System.setProperty("line.separator", "\n"); Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverloading06.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverloading06.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverloading06.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -23,7 +23,7 @@ public class GenericOverloading06 extends GenericTest { - class A[T] { + static class A[T] { def m() = 0; def m(T) = 1; def m(int,T) = 2; Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverloading14.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverloading14.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverloading14.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -19,12 +19,12 @@ public class GenericOverloading14 extends GenericTest { - class A[T] { + static class A[T] { def m() = 0; def m(T) = 1; } - class B[S] extends A[S] { + static class B[S] extends A[S] { def m(int,S) = 2; } Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding04.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding04.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding04.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -19,13 +19,13 @@ public class GenericOverriding04 extends GenericTest { - class A[T] { + static class A[T] { def m() = 0; def m(T) = 1; def m(int,T) = 2; } - class B[T] { + static class B[T] { def m() = 3; def m(T) = 4; def m(int,T) = 5; Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding05.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding05.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding05.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -19,13 +19,13 @@ public class GenericOverriding05 extends GenericTest { - class A[T] { + static class A[T] { def m(): Int = 0; def m(T): Int = 1; def m(int,T): Int = 2; } - class B[T] extends A[T] { + static class B[T] extends A[T] { def m(): Int = 3; } Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding06.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding06.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding06.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -19,13 +19,13 @@ public class GenericOverriding06 extends GenericTest { - class A[T] { + static class A[T] { def m(): int = 0; def m(T): int = 1; def m(int,T): int = 2; } - class B[T] extends A[T] { + static class B[T] extends A[T] { def m(T): int = 4; } Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding07.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding07.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding07.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -19,13 +19,13 @@ public class GenericOverriding07 extends GenericTest { - class A[T] { + static class A[T] { def m(): int = 0; def m(T): int = 1; def m(int,T): int = 2; } - class B[T] extends A[T] { + static class B[T] extends A[T] { def m(int,T): int = 5; } Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding12.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding12.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding12.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -23,11 +23,11 @@ public class GenericOverriding12 extends GenericTest { - class A[T] { + static class A[T] { def m[U](): int = 0; } - class B[T] extends A[T] { + static class B[T] extends A[T] { def m[U](): int = 1; } Modified: trunk/x10.tests/examples/Constructs/Generics/GenericOverriding13.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Generics/GenericOverriding13.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Generics/GenericOverriding13.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -23,11 +23,11 @@ public class GenericOverriding13 extends GenericTest { - class A[T] { + static class A[T] { def m[U](T): int = 0; } - class B[T] extends A[T] { + static class B[T] extends A[T] { def m[U](T): int = 1; } Modified: trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -23,25 +23,14 @@ */ public class AtThisIntoAtHere extends x10Test { class Test { - val x:GlobalRef[Test]; - val y:GlobalRef[Test]{self.home==x.home}; - - def this() { - x = GlobalRef[Test](this); - y = GlobalRef[Test](this); - } def n() { + val x:GlobalRef[Test] = GlobalRef[Test](this); + val y:GlobalRef[Test]{self.home==x.home} = x; at (x) { // it is ok to invoke this.y() at the place of this.x. y(); } - // Repeat with fields stashed in variables. - val xx = this.x; - val yy = this.y; - at (x) { - y(); - } } } Modified: trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -23,25 +23,15 @@ */ public class B_AtThisIntoAtHere extends x10Test { class Test { - val x:GlobalRef[Test]; - val y:GlobalRef[Test]{self.home==x.home}; - def this() { - x = GlobalRef[Test](this); - y = GlobalRef[Test](this); - } def n() { + val x:GlobalRef[Test] = GlobalRef[Test](this); + val y:GlobalRef[Test]{self.home==x.home} = y; at (x) { // it is ok to invoke this.y() at the place of this.x. y(); } - // Repeat with fields stashed in variables. - val xx = this.x; - val yy = this.y; - at (x) { - y(); - } } } Modified: trunk/x10.tests/examples/Constructs/Point/TestPoint.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Point/TestPoint.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Constructs/Point/TestPoint.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -18,7 +18,7 @@ var os: StringWriter; var out: Printer; - val testName = typeName().substring(6,typeName().length()); + val testName = "TestPo"; def this() { System.setProperty("line.separator", "\n"); Modified: trunk/x10.tests/examples/Issues/XTENLANG_217.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_217.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Issues/XTENLANG_217.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -17,7 +17,7 @@ class XTENLANG_217 extends x10Test { - class A { + static class A { def apply(i:int): double {throw new RuntimeException();} // FIXME: XTENLANG-1443 def set(v:double, i:int) {} } Modified: trunk/x10.tests/examples/Issues/XTENLANG_242.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_242.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/Issues/XTENLANG_242.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -13,19 +13,13 @@ /** * @author bdlucas 12/2008 + Yoav: typename() should be removed! */ -class XTENLANG_242_A { - val name1 = typeName(); - def name2() = typeName(); -} - -class XTENLANG_242_B extends XTENLANG_242_A {} - class XTENLANG_242 extends x10Test { public def run():boolean { - return new XTENLANG_242_B().name1.equals("XTENLANG_242_B") && new XTENLANG_242_B().name2().equals("XTENLANG_242_B"); + return true; } public static def main(Array[String](1)) { Modified: trunk/x10.tests/examples/x10lib/jgfutil/JGFTimer.x10 =================================================================== --- trunk/x10.tests/examples/x10lib/jgfutil/JGFTimer.x10 2010-09-13 19:34:21 UTC (rev 16329) +++ trunk/x10.tests/examples/x10lib/jgfutil/JGFTimer.x10 2010-09-13 20:28:33 UTC (rev 16330) @@ -71,7 +71,7 @@ opcount += count; } - public def reset(): void = { + final public def reset(): void = { time = 0.0; calls = 0; opcount = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-09-14 16:01:20
|
Revision: 16372 http://x10.svn.sourceforge.net/x10/?rev=16372&view=rev Author: dgrove-oss Date: 2010-09-14 16:01:08 +0000 (Tue, 14 Sep 2010) Log Message: ----------- Team APIs for Array. Switch KMeansSPMD from Rail/ValRail to Array. Modified Paths: -------------- trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.runtime/src-x10/x10/util/Team.x10 Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2010-09-14 15:47:07 UTC (rev 16371) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2010-09-14 16:01:08 UTC (rev 16372) @@ -25,9 +25,9 @@ */ public class KMeansSPMD { - public static def printClusters (clusters:Rail[Float], dims:Int) { + public static def printClusters (clusters:Array[Float](1), dims:Int) { for (var d:Int=0 ; d<dims ; ++d) { - for (var k:Int=0 ; k<clusters.length/dims ; ++k) { + for (var k:Int=0 ; k<clusters.size/dims ; ++k) { if (k>0) Console.OUT.print(" "); Console.OUT.print(clusters(k*dims+d).toString()); @@ -60,12 +60,12 @@ // file is dimension-major val file = new File(fname), fr = file.openRead(); - val init_points = (Int) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); + val init_points = (Point(1)) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); val num_file_points = (file.size() / dim / 4) as Int; - val file_points = ValRail.make(num_file_points*dim, init_points); + val file_points = new Array[Float](num_file_points*dim, init_points); //val team = Team.WORLD; - val team = Team(Rail.make[Place](num_slices * Place.MAX_PLACES, (i:Int) => Place.places(i/num_slices))); + val team = Team(new Array[Place](num_slices * Place.MAX_PLACES, ([i]:Point) => Place.places(i/num_slices))); val num_slice_points = num_global_points / num_slices / Place.MAX_PLACES; @@ -82,17 +82,17 @@ if (!quiet) Console.OUT.println(h+" gets "+offset+" len "+num_slice_points); val num_slice_points_stride = num_slice_points; - val init = (i:Int) => { + val init = ([i]:Point) => { val d=i/num_slice_points_stride, p=i%num_slice_points_stride; return p<num_slice_points ? file_points(((p+offset)%num_file_points)*dim + d) : 0; }; // these are pretty big so allocate up front - val host_points = Rail.make(num_slice_points_stride*dim, init); - val host_nearest = Rail.make(num_slice_points, 0); + val host_points = new Array[Float](num_slice_points_stride*dim, init); + val host_nearest = new Array[Float](num_slice_points); - val host_clusters = Rail.make[Float](num_clusters*dim, file_points); - val host_cluster_counts = Rail.make[Int](num_clusters, (Int)=>0); + val host_clusters = new Array[Float](num_clusters*dim, file_points); + val host_cluster_counts = new Array[Int](num_clusters); val start_time = System.currentTimeMillis(); @@ -106,10 +106,11 @@ //if (offset==0) Console.OUT.println("Iteration: "+iter); - val old_clusters = ValRail.make[Float](host_clusters); + val old_clusters = new Array[Float](host_clusters.size); + Array.copy(host_clusters, 0, old_clusters, 0, host_clusters.size); - host_clusters.reset(0); - host_cluster_counts.reset(0); + host_clusters.fill(0); + host_cluster_counts.fill(0); val compute_start = System.nanoTime(); for (var p:Int=0 ; p<num_slice_points ; ++p) { @@ -134,8 +135,8 @@ compute_time += System.nanoTime() - compute_start; val comm_start = System.nanoTime(); - team.allreduce(role, host_clusters, 0, host_clusters, 0, host_clusters.length, Team.ADD); - team.allreduce(role, host_cluster_counts, 0, host_cluster_counts, 0, host_cluster_counts.length, Team.ADD); + team.allreduce(role, host_clusters, 0, host_clusters, 0, host_clusters.size, Team.ADD); + team.allreduce(role, host_cluster_counts, 0, host_cluster_counts, 0, host_cluster_counts.size, Team.ADD); comm_time += System.nanoTime() - comm_start; for (var k:Int=0 ; k<num_clusters ; ++k) { Modified: trunk/x10.runtime/src-x10/x10/util/Team.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/Team.x10 2010-09-14 15:47:07 UTC (rev 16371) +++ trunk/x10.runtime/src-x10/x10/util/Team.x10 2010-09-14 16:01:08 UTC (rev 16372) @@ -37,6 +37,16 @@ this.id = id; } + public def this (places:Array[Place]) { + var id:Int = 0; + @Native("c++", + "x10rt_team nu_team = 0;" + + "x10rt_team_new(places->FMGL(rawLength), (x10rt_place*)places->raw()->data, x10rt_team_setter, &nu_team);" + + "while (nu_team==0) x10rt_probe();" + + "id = nu_team;") { } + this.id = id; + } + /** Returns the number of elements in the team. */ public def size () : Int { @@ -83,6 +93,12 @@ "x10rt_scatter(this_.FMGL(id), role, root, &src->raw()[src_off], &dst->raw()[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + "while (!finished) x10rt_probe();") {} } + public def scatter[T] (role:Int, root:Int, src:Array[T], src_off:Int, dst:Array[T], dst_off:Int, count:Int) : void { + @Native("c++", + "int finished = 0;" + + "x10rt_scatter(this_.FMGL(id), role, root, &src->raw()->data[src_off], &dst->raw()->data[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + + "while (!finished) x10rt_probe();") {} + } /** Blocks until all members have received root's array. * @@ -106,6 +122,12 @@ "x10rt_bcast(this_.FMGL(id), role, root, &src->raw()[src_off], &dst->raw()[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + "while (!finished) x10rt_probe();") {} } + public def bcast[T] (role:Int, root:Int, src:Array[T], src_off:Int, dst:Array[T], dst_off:Int, count:Int) : void { + @Native("c++", + "int finished = 0;" + + "x10rt_bcast(this_.FMGL(id), role, root, &src->raw()->data[src_off], &dst->raw()->data[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + + "while (!finished) x10rt_probe();") {} + } /** Blocks until all members have received their part of each other member's array. * Each member receives a contiguous and distinct portion of the src array. @@ -132,6 +154,12 @@ "x10rt_alltoall(this_.FMGL(id), role, &src->raw()[src_off], &dst->raw()[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + "while (!finished) x10rt_probe();") {} } + public def alltoall[T] (role:Int, src:Array[T], src_off:Int, dst:Array[T], dst_off:Int, count:Int) : void { + @Native("c++", + "int finished = 0;" + + "x10rt_alltoall(this_.FMGL(id), role, &src->raw()->data[src_off], &dst->raw()->data[dst_off], sizeof(FMGL(T)), count, x10rt_one_setter, &finished);" + + "while (!finished) x10rt_probe();") {} + } /** Indicates the operation to perform when reducing. */ public static val ADD = 0; @@ -157,6 +185,13 @@ "x10rt_allreduce(this_.FMGL(id), role, &src->raw()[src_off], &dst->raw()[dst_off], (x10rt_red_op_type)op, type, count, x10rt_one_setter, &finished);" + "while (!finished) x10rt_probe();") {} } + private def allreduce_[T] (role:Int, src:Array[T], src_off:Int, dst:Array[T], dst_off:Int, count:Int, op:Int) : void { + @Native("c++", + "int finished = 0;" + + "x10rt_red_type type = x10rt_get_red_type<FMGL(T)>();" + + "x10rt_allreduce(this_.FMGL(id), role, &src->raw()->data[src_off], &dst->raw()->data[dst_off], (x10rt_red_op_type)op, type, count, x10rt_one_setter, &finished);" + + "while (!finished) x10rt_probe();") {} + } /* using overloading is the correct thing to do here since the set of supported * types are finite, however the java backend will not be able to distinguish @@ -226,6 +261,10 @@ allreduce_(role, src, src_off, dst, dst_off, count, op); } + public def allreduce[T] (role:Int, src:Array[T], src_off:Int, dst:Array[T], dst_off:Int, count:Int, op:Int) : void { + allreduce_(role, src, src_off, dst, dst_off, count, op); + } + private def allreduce_[T] (role:Int, src:T, op:Int) : T { var dst:T; @Native("c++", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yz...@us...> - 2010-09-14 21:11:44
|
Revision: 16384 http://x10.svn.sourceforge.net/x10/?rev=16384&view=rev Author: yzibin Date: 2010-09-14 21:11:38 +0000 (Tue, 14 Sep 2010) Log Message: ----------- Added @NonEscaping annotation on methods, I allow now multiple GlobalRef[...](this) fields, I treat field initializers as if they were inlined at the beginning of every ctor. Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/NonEscaping.x10 Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-09-14 21:02:30 UTC (rev 16383) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-09-14 21:11:38 UTC (rev 16384) @@ -45,6 +45,7 @@ import polyglot.types.Types; import polyglot.types.UnknownType; import polyglot.types.QName; +import polyglot.types.MethodDef; import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; @@ -970,10 +971,16 @@ res = copy; } return res; - } + } public static boolean isUninitializedField(X10FieldDef def,X10TypeSystem ts) { + return isDefAnnotated(def,ts,"x10.compiler.Uninitialized"); + } + public static boolean isNonEscapingMethod(X10ProcedureDef def,X10TypeSystem ts) { + return isDefAnnotated(def,ts,"x10.compiler.NonEscaping"); + } + public static boolean isDefAnnotated(X10Def def,X10TypeSystem ts, String name) { try { - Type at = (Type) ts.systemResolver().find(QName.make("x10.compiler.Uninitialized")); + Type at = (Type) ts.systemResolver().find(QName.make(name)); return !def.annotationsMatching(at).isEmpty(); } catch (SemanticException e) { return false; Modified: trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java =================================================================== --- trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-14 21:02:30 UTC (rev 16383) +++ trunk/x10.compiler/src/x10/visit/CheckEscapingThis.java 2010-09-14 21:11:38 UTC (rev 16384) @@ -21,6 +21,7 @@ import x10.types.X10TypeSystem; import x10.types.X10FieldDef; import x10.types.X10ParsedClassType_c; +import x10.types.X10ProcedureDef; import java.util.HashMap; import java.util.Set; @@ -275,46 +276,7 @@ } } - // Checks for illegal forward references in field initializers and "this" escaping - private class FieldInitVisitor extends NodeVisitor { - @Override public Node visitEdgeNoOverride(Node parent, Node n) { - checkGlobalRef(n); // check globalRef usage in field initializers - final Position p = n.position(); - // this can escape in field acess and assignment (but not in method calls or any other way) - if (n instanceof Field) { - Field f = (Field) n; - if (isThis(f.target())) { - checkField(f.fieldInstance().def(),p); - return n; - } - } - if (n instanceof FieldAssign) { - FieldAssign f = (FieldAssign) n; - if (isThis(f.target())) { - checkField(f.fieldInstance().def(),p); - f.right().visit(this); - return n; - } - } - - // check that "this" cannot escape in any other way - if (isThis(n)) - reportError("'this' and 'super' cannot escape in field initializers.",p); - - n.del().visitChildren(this); - return n; - } - - } - private void checkField(FieldDef def, Position p) { - if (allFields.contains(def) && // to make sure it is declared in this class (and not in a super or outer class) - !initFields.contains(def)) { - reportError("Illegal forward reference for field '"+def.name()+"'.",p); - } - } - - // we gather info on every private/final method private static class MethodInfo { private final Set<X10FieldDecl_c> read = new HashSet<X10FieldDecl_c>(); @@ -335,21 +297,22 @@ // Therefore we can now treat both VAL and VAR identically. private final HashSet<X10FieldDecl_c> fields = new HashSet<X10FieldDecl_c>(); private boolean wasChange = true, wasError = false; // for fixed point alg - private FieldDef globalRef = null;// There is one exception to the "this cannot escape" rule: val root = GlobalRef[...](this) - private Set<FieldDef> allFields = new HashSet<FieldDef>(); // all non-static fields in this class (excluding fields in the superclass because those have already been initialized by the super ctor call) - private Set<FieldDef> initFields = new HashSet<FieldDef>(); // fields that have been initialized already (to prevent forward references) + private HashSet<FieldDef> globalRef = new HashSet<FieldDef>();// There is one exception to the "this cannot escape" rule: val root = GlobalRef[...](this) private void checkGlobalRef(Node n) { boolean err = false; + FieldDef def = null; if (n instanceof Field) { Field f = (Field) n; - err = (f.fieldInstance().def()==globalRef && isThis(f.target())); + def = f.fieldInstance().def(); + err = (isThis(f.target())); } if (n instanceof FieldAssign) { FieldAssign assign = (FieldAssign) n; - err = (assign.fieldInstance().def()==globalRef && isThis(assign.target())); + def = assign.fieldInstance().def(); + err = (isThis(assign.target())); } - if (err) reportError("Cannot use '"+globalRef.name()+"' in a field initializer, constructor, or methods called from a constructor.",n.position()); + if (err && globalRef.contains(def)) reportError("Cannot use '"+def.name()+"' because a GlobalRef[...](this) cannot be used in a field initializer, constructor, or methods called from a constructor.",n.position()); } public CheckEscapingThis(X10ClassDecl_c xlass, Job job, X10TypeSystem ts) { this.job = job; @@ -362,21 +325,18 @@ private void typeCheck() { final X10ClassBody_c body = (X10ClassBody_c)xlass.body(); // visit all (non-static) field initializers and check that they do not have forward references nor that "this" escapes - FieldInitVisitor fieldInitVisitor = new FieldInitVisitor(); ArrayList<X10FieldDecl_c> nonStaticFields = new ArrayList<X10FieldDecl_c>(); for (ClassMember classMember : body.members()) { if (classMember instanceof X10FieldDecl_c) { X10FieldDecl_c field = (X10FieldDecl_c) classMember; if (field.flags().flags().isStatic()) continue; nonStaticFields.add(field); - allFields.add(field.fieldDef()); } } - // checking "this" doesn't escape from field init + // Find globalRef for (X10FieldDecl_c field : nonStaticFields) { final Expr init = field.init(); - if (init==null) continue; - // check for the pattern: GlobalRef[...](this) + // check for the pattern: val/var someField = GlobalRef[...](this) if (init instanceof X10New_c) { X10New_c new_c = (X10New_c) init; final TypeNode typeNode = new_c.objectType(); @@ -390,46 +350,57 @@ final QName qName = classType_c.def().fullName(); if (qName.equals(QName.make("x10.lang","GlobalRef"))) { // found the pattern! - if (globalRef!=null) { - reportError("You can use the pattern 'val root = GlobalRef[...](this);' only once in a class.",field.position()); - continue; - } - globalRef = field.fieldDef(); - continue; + globalRef.add(field.fieldDef()); } } } } - init.visit(fieldInitVisitor); - initFields.add(field.fieldDef()); } - // visit every ctor, and every method called from a ctor, and check that this and super do not escape + // checking "this" doesn't escape from field init + ArrayList<Stmt> fieldInits = new ArrayList<Stmt>(); + final Position pos = Position.COMPILER_GENERATED; + for (X10FieldDecl_c field : nonStaticFields) { + final Expr init = field.init(); + final X10FieldDef def = (X10FieldDef) field.fieldDef(); + // even if the field has an init, we still need to track it (because field-init are inlined in all ctors) + if (!X10TypeMixin.isUninitializedField(def,ts)) { + // if a VAR has a default value, then we already created an init() expr in X10FieldDecl_c.typeCheck + fields.add(field); + } + if (init==null) continue; + final Special This = (Special) nf.Special(pos, Special_c.THIS).type(def.container().get().toType()); + final FieldAssign fieldAssign = (FieldAssign) nf.FieldAssign(pos, This, field.name(), Assign_c.ASSIGN, init). + fieldInstance(def.asInstance()). + type(init.type()); + fieldInits.add(nf.Eval(pos, fieldAssign)); + if (!globalRef.contains(def)) init.visit(this); // field init are implicitly NonEscaping + } + // visit every ctor, every @NonEscaping method, and every method recursively called from them, and check that this and super do not escape for (ClassMember classMember : body.members()) { - if (classMember instanceof X10ConstructorDecl_c) { - final X10ConstructorDecl_c ctor = (X10ConstructorDecl_c) classMember; - final Block ctorBody = ctor.body(); - // for native ctors, we don't have a body + if (classMember instanceof ProcedureDecl) { + final ProcedureDecl proc = (ProcedureDecl) classMember; + final X10ProcedureDef def = (X10ProcedureDef)proc.procedureInstance(); + boolean shouldVisit = X10TypeMixin.isNonEscapingMethod(def,ts); + + final Block ctorBody = proc.body(); + // for native methods/ctors, we don't have a body if (ctorBody!=null) { - allCtors.add(ctor); - ctorBody.visit(this); + if (proc instanceof X10ConstructorDecl_c) { // ctors are implicitly NonEscaping + allCtors.add((X10ConstructorDecl_c)proc); + shouldVisit = true; + } + if (shouldVisit) ctorBody.visit(this); } - } else if (classMember instanceof X10FieldDecl_c) { - X10FieldDecl_c field = (X10FieldDecl_c) classMember; - final Flags flags = field.flags().flags(); - if (flags.isStatic()) continue; - // if the field has an init, then we do not need to track it (it is always assigned before read) - if (field.init()!=null) continue; - if (X10TypeMixin.isUninitializedField((X10FieldDef)field.fieldDef(),ts)) continue; - // if a VAR has a default value, then we already created an init() expr in X10FieldDecl_c.typeCheck - fields.add(field); } } if (fields.size()==0) return; // done! all fields have an init, thus all reads are legal. // ignore ctors that call other ctors (using "this(...)"). We can reuse ConstructorCallChecker, but for better efficiency, we just check it directly + Block newInit = nf.Block(pos,fieldInits); for (X10ConstructorDecl_c ctor: allCtors) { boolean callThis = false; final Block ctorBody = ctor.body(); + assert ctorBody!=null; final List<Stmt> stmts = ctorBody.statements(); for (Stmt s : stmts) { if (s instanceof ConstructorCall) { @@ -441,8 +412,10 @@ } } if (!callThis) { - allMethods.put(ctor.procedureInstance(), new MethodInfo()); - dfsMethods.add(ctor); + // add field init to all ctors + X10ConstructorDecl_c newCtor = (X10ConstructorDecl_c) ctor.body( nf.Block(pos,newInit,ctorBody) ); + allMethods.put(newCtor.procedureInstance(), new MethodInfo()); + dfsMethods.add(newCtor); } } // do init for the fixed point alg @@ -505,27 +478,31 @@ // and as the receiver of private/final calls if (n instanceof X10Call) { final X10Call call = (X10Call) n; - final Flags flags = call.methodInstance().flags(); + final MethodInstance methodInstance = call.methodInstance(); + final X10Flags flags = X10Flags.toX10Flags(methodInstance.flags()); if (isThis(call.target())) { - if (flags.contains(X10Flags.PROPERTY)) { + if (flags.isProperty()) { // property-method calls are ok } else { // the method must be final or private + if (!flags.isFinal() && !flags.isPrivate()) { + reportError("The call "+call+" is illegal because you can only call private or final methods from a constructor or from methods called from a constructor",call.position()); + } X10MethodDecl_c method = findMethod(call); if (method==null) { - reportError("The call "+call+" is illegal because you cannot call methods defined in a superclass from a constructor or from methods called from a constructor",call.position()); + if (!X10TypeMixin.isNonEscapingMethod((X10ProcedureDef)methodInstance.def(),ts)) + reportError("The call "+call+" is illegal because you can only call @NonEscaping methods of a superclass from a constructor or from methods called from a constructor",call.position()); } else { ProcedureDef pd = method.procedureInstance(); if (allMethods.containsKey(pd)) { // we already analyzed this method (or it is an error method) } else { - allMethods.put(pd,new MethodInfo()); // prevent infinite recursion - // verify the method is indeed private/final - if (!flags.isFinal() && !flags.isPrivate()) { - reportError("The call "+call+" is illegal because you can only call private or final methods from a constructor or from methods called from a constructor",call.position()); + final Block body = method.body(); + if (body!=null) { + allMethods.put(pd,new MethodInfo()); // prevent infinite recursion + body.visit(this); + dfsMethods.add(method); } - method.body().visit(this); - dfsMethods.add(method); } } } Added: trunk/x10.runtime/src-x10/x10/compiler/NonEscaping.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NonEscaping.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NonEscaping.x10 2010-09-14 21:11:38 UTC (rev 16384) @@ -0,0 +1,32 @@ +/* + * 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; + +/** + * NonEscaping is an annotation that can be used on final or private methods. + * + * <p>It marks the fact that "this" does not escape (also called leak) from the method. + * A method is explicitly-NonEscaping if it is annotated with @NonEscaping and it is implicitly-NonEscaping. + * A method is implicitly-NonEscaping if: + * 1) "this" is only used in field access, field assignment, + * and as the reciever of implicitly-NonEscaping method invocation. + * 2) "super" is only used in field access, field assignment, + * and as the reciever of explicitly-NonEscaping method invocation. + * All constructors and field initializers in X10 must be implicitly-NonEscaping. + * + * <p>It is considered good practice to mark all methods called from a constructor as NonEscaping. + * + * <p>NonEscaping is not checked on native methods. + */ +public interface NonEscaping extends MethodAnnotation { } Property changes on: trunk/x10.runtime/src-x10/x10/compiler/NonEscaping.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: <ipe...@us...> - 2010-09-16 04:36:06
|
Revision: 16411 http://x10.svn.sourceforge.net/x10/?rev=16411&view=rev Author: ipeshansky Date: 2010-09-16 04:35:59 +0000 (Thu, 16 Sep 2010) Log Message: ----------- Change the type of the typeParameters in all X10Def objects to List<ParameterType>. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/AtStmt_c.java trunk/x10.compiler/src/x10/ast/TypeDecl_c.java trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/types/ClosureDef.java trunk/x10.compiler/src/x10/types/ClosureDef_c.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/TypeDef.java trunk/x10.compiler/src/x10/types/TypeDef_c.java trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java trunk/x10.compiler/src/x10/types/X10MethodDef.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java trunk/x10.compiler/src/x10/types/X10ProcedureDef.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/util/ClosureSynthesizer.java trunk/x10.compiler/src/x10/visit/Inliner.java trunk/x10.compiler/src/x10c/visit/ClosuresToStaticMethods.java trunk/x10.compiler/src/x10c/visit/InlineHelper.java trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java trunk/x10.doc/src/x10doc/doc/X10TypeDefDoc.java Modified: trunk/x10.compiler/src/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/ast/Async_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -46,6 +46,7 @@ import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.errors.Errors; +import x10.types.ParameterType; import x10.types.X10Context; import x10.types.X10MethodDef; import x10.types.X10TypeSystem; @@ -171,7 +172,7 @@ X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); if (xc.currentCode() instanceof X10MethodDef) { X10MethodDef outer = (X10MethodDef) c.currentCode(); - List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); + List<ParameterType> capturedTypes = outer.typeParameters(); if (!capturedTypes.isEmpty()) { asyncInstance = ((X10MethodDef) asyncInstance.copy()); asyncInstance.setTypeParameters(capturedTypes); Modified: trunk/x10.compiler/src/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -47,6 +47,7 @@ import x10.constraint.XTerm; import x10.errors.Errors; import x10.types.ClosureDef; +import x10.types.ParameterType; import x10.types.X10Context; import x10.types.X10MethodDef; import x10.types.X10TypeMixin; @@ -169,7 +170,7 @@ X10MethodDef outer = (X10MethodDef) c.currentCode(); XVar thisVar = outer.thisVar(); asyncInstance.setThisVar(thisVar); - List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); + List<ParameterType> capturedTypes = outer.typeParameters(); if (!capturedTypes.isEmpty()) { asyncInstance = ((X10MethodDef) asyncInstance.copy()); asyncInstance.setTypeParameters(capturedTypes); Modified: trunk/x10.compiler/src/x10/ast/TypeDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -50,6 +50,7 @@ import x10.types.AnnotatedType; import x10.types.ConstrainedType; import x10.types.MacroType; +import x10.types.ParameterType; import x10.types.TypeDef; import x10.types.TypeDef_c; import x10.types.X10ClassDef; @@ -239,7 +240,7 @@ flags = flags.Static(); TypeDef typeDef = new TypeDef_c(ts, position(), flags, name.id(), container, - Collections.<Ref<? extends Type>>emptyList(), + Collections.<ParameterType>emptyList(), thisVar, Collections.<LocalDef>emptyList(), Collections.<Ref<? extends Type>>emptyList(), null, null, null); if (!local) { @@ -259,9 +260,9 @@ n = (TypeDecl_c) X10Del_c.visitAnnotations(n, tb2); - List<Ref<? extends Type>> typeParameters = new ArrayList<Ref<? extends Type>>(); + List<ParameterType> typeParameters = new ArrayList<ParameterType>(); for (TypeParamNode tpn : n.typeParameters()) { - typeParameters.add(Types.ref(tpn.type())); + typeParameters.add(tpn.type()); } typeDef.setTypeParameters(typeParameters); Modified: trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -29,6 +29,7 @@ import polyglot.util.TypedList; import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; +import x10.types.ParameterType; import x10.types.X10Context; import x10.types.X10MethodDef; import x10.types.X10TypeSystem; @@ -96,7 +97,7 @@ X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); if (xc.currentCode() instanceof X10MethodDef) { X10MethodDef outer = (X10MethodDef) c.currentCode(); - List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); + List<ParameterType> capturedTypes = outer.typeParameters(); if (!capturedTypes.isEmpty()) { asyncInstance = ((X10MethodDef) asyncInstance.copy()); asyncInstance.setTypeParameters(capturedTypes); Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -212,9 +212,9 @@ mi.setTypeGuard(n.guard().typeConstraint()); } - List<Ref<? extends Type>> typeParameters = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); + List<ParameterType> typeParameters = new ArrayList<ParameterType>(n.typeParameters().size()); for (TypeParamNode tpn : n.typeParameters()) { - typeParameters.add(Types.ref(tpn.type())); + typeParameters.add(tpn.type()); } mi.setTypeParameters(typeParameters); Modified: trunk/x10.compiler/src/x10/types/ClosureDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/ClosureDef.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/ClosureDef.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -52,8 +52,8 @@ Ref<? extends ClassType> typeContainer(); void setTypeContainer(Ref<? extends ClassType> ct); - // List<Ref<? extends Type>> typeParameters(); - void setTypeParameters(List<Ref<? extends Type>> typeParameters); + //List<ParameterType> typeParameters(); + void setTypeParameters(List<ParameterType> typeParameters); /** Modified: trunk/x10.compiler/src/x10/types/ClosureDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/ClosureDef_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/ClosureDef_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -137,11 +137,11 @@ return typeContainer; } - public List<Ref<? extends Type>> typeParameters() { - return Collections.<Ref<? extends Type>>emptyList(); + public List<ParameterType> typeParameters() { + return Collections.<ParameterType>emptyList(); } - public void setTypeParameters(List<Ref<? extends Type>> typeParameters) { + public void setTypeParameters(List<ParameterType> typeParameters) { throw new InternalCompilerError("Attempt to set type parameters on a closure def: "+this, position()); } Modified: trunk/x10.compiler/src/x10/types/MacroType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -135,7 +135,9 @@ public List<Type> typeParameters() { if (typeParams == null) { - return new TransformingList<Ref<? extends Type>, Type>(def().typeParameters(), new DerefTransform<Type>()); + return new TransformingList<ParameterType, Type>(def().typeParameters(), new Transformation<ParameterType, Type>() { + public Type transform(ParameterType o) { return o; } + }); } return typeParams; } Modified: trunk/x10.compiler/src/x10/types/TypeDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/TypeDef.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/TypeDef.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -32,8 +32,8 @@ public Name name(); public void setName(Name name); - public List<Ref<? extends Type>> typeParameters(); - public void setTypeParameters(List<Ref<? extends Type>> typeParameters); + public List<ParameterType> typeParameters(); + public void setTypeParameters(List<ParameterType> typeParameters); public List<Ref<? extends Type>> formalTypes(); public void setFormalTypes(List<Ref<? extends Type>> formalTypes); Modified: trunk/x10.compiler/src/x10/types/TypeDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/TypeDef_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/TypeDef_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -39,7 +39,7 @@ protected Flags flags; protected Name name; protected Ref<? extends Package> package_; - protected List<Ref<? extends Type>> typeParameters; + protected List<ParameterType> typeParameters; protected List<LocalDef> formalNames; protected List<Ref<? extends Type>> formalTypes; protected Ref<CConstraint> guard; @@ -47,14 +47,14 @@ protected Ref<? extends Type> type; protected MacroType asType; - public TypeDef_c(TypeSystem ts, Position pos, Flags flags, Name name, Ref<? extends StructType> container, List<Ref<? extends Type>> typeParams, + public TypeDef_c(TypeSystem ts, Position pos, Flags flags, Name name, Ref<? extends StructType> container, List<ParameterType> typeParams, XVar thisVar, List<LocalDef> formalNames, List<Ref<? extends Type>> formalTypes, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, Ref<? extends Type> type) { super(ts, pos); this.container = container; this.name = name; this.flags = flags; - this.typeParameters = TypedList.copyAndCheck(typeParams, Ref.class, true); + this.typeParameters = TypedList.copyAndCheck(typeParams, ParameterType.class, true); this.thisVar = thisVar; this.formalNames = TypedList.copyAndCheck(formalNames, LocalDef.class, true); this.formalTypes = TypedList.copyAndCheck(formalTypes, Ref.class, true); @@ -121,15 +121,15 @@ /* (non-Javadoc) * @see x10.types.TypeDef#typeParameters() */ - public List<Ref<? extends Type>> typeParameters() { + public List<ParameterType> typeParameters() { return Collections.unmodifiableList(typeParameters); } /* (non-Javadoc) * @see x10.types.TypeDef#setTypeParameters(java.util.List) */ - public void setTypeParameters(List<Ref<? extends Type>> typeParameters) { - this.typeParameters = TypedList.copyAndCheck(typeParameters, Ref.class, true); + public void setTypeParameters(List<ParameterType> typeParameters) { + this.typeParameters = TypedList.copyAndCheck(typeParameters, ParameterType.class, true); } public Ref<CConstraint> guard() { Modified: trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -147,11 +147,11 @@ this.typeGuard = s; } - public List<Ref<? extends Type>> typeParameters() { - return Collections.<Ref<? extends Type>>emptyList(); + public List<ParameterType> typeParameters() { + return Collections.<ParameterType>emptyList(); } - public void setTypeParameters(List<Ref<? extends Type>> typeParameters) { + public void setTypeParameters(List<ParameterType> typeParameters) { throw new InternalCompilerError("Attempt to set type parameters on a constructor def: "+this, position()); } Modified: trunk/x10.compiler/src/x10/types/X10MethodDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10MethodDef.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10MethodDef.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -32,6 +32,6 @@ Ref<? extends Type> offerType(); void setOfferType(Ref<? extends Type> s); - List<Ref<? extends Type>> typeParameters(); - void setTypeParameters(List<Ref<? extends Type>> typeParameters); + List<ParameterType> typeParameters(); + void setTypeParameters(List<ParameterType> typeParameters); } Modified: trunk/x10.compiler/src/x10/types/X10MethodDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10MethodDef_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10MethodDef_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -52,7 +52,7 @@ public class X10MethodDef_c extends MethodDef_c implements X10MethodDef { Ref<CConstraint> guard; Ref<TypeConstraint> typeGuard; - List<Ref<? extends Type>> typeParameters; + List<ParameterType> typeParameters; List<LocalDef> formalNames; Ref<XTerm> body; Ref<? extends Type> offerType; @@ -62,7 +62,7 @@ Flags flags, Ref<? extends Type> returnType, Name name, - List<Ref<? extends Type>> typeParams, + List<ParameterType> typeParams, List<Ref<? extends Type>> formalTypes, XVar thisVar, List<LocalDef> formalNames, @@ -72,7 +72,7 @@ Ref< ? extends Type> offerType, Ref<XTerm> body) { super(ts, pos, container, flags, returnType, name, formalTypes, excTypes); - this.typeParameters = TypedList.copyAndCheck(typeParams, Ref.class, true); + this.typeParameters = TypedList.copyAndCheck(typeParams, ParameterType.class, true); this.thisVar = thisVar; this.formalNames = TypedList.copyAndCheck(formalNames, LocalDef.class, true); this.guard = guard; @@ -161,12 +161,12 @@ this.offerType = s; } - public List<Ref<? extends Type>> typeParameters() { + public List<ParameterType> typeParameters() { return Collections.unmodifiableList(typeParameters); } - public void setTypeParameters(List<Ref<? extends Type>> typeParameters) { - this.typeParameters = TypedList.copyAndCheck(typeParameters, Ref.class, true); + public void setTypeParameters(List<ParameterType> typeParameters) { + this.typeParameters = TypedList.copyAndCheck(typeParameters, ParameterType.class, true); } public String signature() { @@ -174,7 +174,7 @@ if (! typeParameters.isEmpty()) { sb.append("["); boolean first = true; - for (Ref<? extends Type> p : typeParameters) { + for (ParameterType p : typeParameters) { if (!first) { sb.append(","); } Modified: trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -151,7 +151,9 @@ public List<Type> typeParameters() { if (this.typeParameters == null) { - return new TransformingList<Ref<? extends Type>, Type>(x10Def().typeParameters(), new DerefTransform<Type>()); + return new TransformingList<ParameterType, Type>(x10Def().typeParameters(), new Transformation<ParameterType, Type>() { + public Type transform(ParameterType o) { return o; } + }); } return typeParameters; Modified: trunk/x10.compiler/src/x10/types/X10ProcedureDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ProcedureDef.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10ProcedureDef.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -29,8 +29,8 @@ Ref<TypeConstraint> typeGuard(); void setTypeGuard(Ref<TypeConstraint> s); - List<Ref<? extends Type>> typeParameters(); - void setTypeParameters(List<Ref<? extends Type>> typeParameters); + List<ParameterType> typeParameters(); + void setTypeParameters(List<ParameterType> typeParameters); List<LocalDef> formalNames(); void setFormalNames(List<LocalDef> formalNames); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -209,7 +209,7 @@ List<Ref<? extends Type>> argTypes, List<Ref<? extends Type>> excTypes, Ref<? extends Type> offerType); X10MethodDef methodDef(Position pos, Ref<? extends StructType> container, Flags flags, Ref<? extends Type> returnType, Name name, - List<Ref<? extends Type>> typeParams, List<Ref<? extends Type>> argTypes, XVar thisVar, List<LocalDef> formalNames, + List<ParameterType> typeParams, List<Ref<? extends Type>> argTypes, XVar thisVar, List<LocalDef> formalNames, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, List<Ref<? extends Type>> excTypes, Ref<? extends Type> offerType, Ref<XTerm> body); /** Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -773,10 +773,10 @@ X10MethodDef md = (X10MethodDef) methodDef(pos, Types.ref(container), flags, Types.ref(returnType), name, Collections.EMPTY_LIST, args, thisVar, formalNames, null, null, excTypes, null, null); - List<Ref<? extends Type>> typeParams = new ArrayList<Ref<? extends Type>>(); + List<ParameterType> typeParams = new ArrayList<ParameterType>(); i = 0; - for (Ref<? extends Type> r : typeParams) { - typeParams.add(Types.ref(new ParameterType_c(this, pos, Name.make("T"+(++i)), Types.ref(md)))); + for (Type r : typeArgs) { + typeParams.add(new ParameterType_c(this, pos, Name.make("T"+(++i)), Types.ref(md))); } md.setTypeParameters(typeParams); return ((X10MethodInstance) md.asInstance()).error(error); @@ -801,7 +801,7 @@ thisVar, formalNames, null, null, excTypes, null); // List<Ref<? extends Type>> typeParams = new ArrayList<Ref<? extends Type>>(); // i = 0; -// for (Ref<? extends Type> r : typeParams) { +// for (Type r : typeArgs) { // typeParams.add(Types.ref(new ParameterType_c(this, pos, Name.make("T"+(++i)), Types.ref(cd)))); // } // cd.setTypeParameters(typeParams); @@ -1119,7 +1119,7 @@ public X10MethodDef methodDef(Position pos, Ref<? extends StructType> container, Flags flags, Ref<? extends Type> returnType, Name name, - List<Ref<? extends Type>> typeParams, List<Ref<? extends Type>> argTypes, + List<ParameterType> typeParams, List<Ref<? extends Type>> argTypes, XVar thisVar, List<LocalDef> formalNames, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, Modified: trunk/x10.compiler/src/x10/util/ClosureSynthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/ClosureSynthesizer.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/util/ClosureSynthesizer.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -268,12 +268,12 @@ cd.setInterfaces(Collections.<Ref<? extends Type>> singletonList(Types.ref(xts.Any()))); cd.flags(X10Flags.toX10Flags(Flags.PUBLIC.Abstract().Interface())); - final List<Ref<? extends Type>> typeParams = new ArrayList<Ref<? extends Type>>(); + final List<ParameterType> typeParams = new ArrayList<ParameterType>(); final List<Ref<? extends Type>> argTypes = new ArrayList<Ref<? extends Type>>(); for (int i = 0; i < numTypeParams; i++) { - Type t = new ParameterType_c(xts, pos, Name.make("X" + i), Types.ref(cd)); - typeParams.add(Types.ref(t)); + ParameterType t = new ParameterType_c(xts, pos, Name.make("X" + i), Types.ref(cd)); + typeParams.add(t); } for (int i = 0; i < numValueParams; i++) { Modified: trunk/x10.compiler/src/x10/visit/Inliner.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Inliner.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10/visit/Inliner.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -683,7 +683,7 @@ return type; return type; } - Type concreteType = instantiate(getGenericTypes(mi.x10Def().typeParameters()), mi.typeParameters(), genericType); + Type concreteType = instantiate(mi.x10Def().typeParameters(), mi.typeParameters(), genericType); if (null != concreteType) return concreteType; X10ClassType container = (X10ClassType) mi.container(); @@ -694,18 +694,6 @@ } /** - * @param methodGenerics - * @return - */ - private List<ParameterType> getGenericTypes( List<Ref<? extends Type>> methodGenerics) { - List<ParameterType> params = new ArrayList<ParameterType>(); - for (Ref<? extends Type> t : methodGenerics){ - params.add((ParameterType) t.get()); - } - return params; - } - - /** * @param genericTypes * @param concreteTypes * @param genericType @@ -1031,7 +1019,7 @@ List<ParameterType> typeParms = new ArrayList<ParameterType>(); typeArgs.addAll(method.typeParameters()); typeArgs.addAll(((X10ClassType) method.container()).typeArguments()); - typeParms.addAll(getGenericTypes(method.x10Def().typeParameters())); + typeParms.addAll(method.x10Def().typeParameters()); typeParms.addAll(((X10ClassType) method.container()).x10Def().typeParameters()); return new TypeParamSubst(xts, typeArgs, typeParms); } Modified: trunk/x10.compiler/src/x10c/visit/ClosuresToStaticMethods.java =================================================================== --- trunk/x10.compiler/src/x10c/visit/ClosuresToStaticMethods.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10c/visit/ClosuresToStaticMethods.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -58,7 +58,7 @@ private final X10TypeSystem xts; private final X10NodeFactory xnf; - private final Map<CodeDef,List<Ref<? extends Type>>> closureDefToTypePrams = new HashMap<CodeDef,List<Ref<? extends Type>>>(); + private final Map<CodeDef,List<ParameterType>> closureDefToTypePrams = new HashMap<CodeDef,List<ParameterType>>(); public ClosuresToStaticMethods(Job job, TypeSystem ts, NodeFactory nf) { super(job, ts, nf); @@ -91,7 +91,7 @@ ClosureCapChecker cc = new ClosureCapChecker(); n.visit(cc); - List<Ref<? extends Type>> mtps = null; + List<ParameterType> mtps = null; CodeDef ci = context.pop().currentCode(); if (ci instanceof X10MethodDef) { mtps = ((X10MethodDef) ci).typeParameters(); @@ -138,7 +138,7 @@ argTypes.add(f.type().typeRef()); } - List<Ref<? extends Type>> rts = new ArrayList<Ref<? extends Type>>(); + List<ParameterType> rts = new ArrayList<ParameterType>(); List<TypeNode> tns = new ArrayList<TypeNode>(); List<TypeParamNode> tps = new ArrayList<TypeParamNode>(); if (ct instanceof X10ParsedClassType) { @@ -149,22 +149,19 @@ ParameterType pt = (ParameterType) t3; tps.add(xnf.TypeParamNode(cg, xnf.Id(cg, pt.name())).type(pt)); tns.add(xnf.X10CanonicalTypeNode(cg, pt)); - rts.add(Types.ref(pt)); + rts.add(pt); } } } } - List<Ref<? extends Type>> mtps = closureDefToTypePrams.get(closure.codeDef()); + List<ParameterType> mtps = closureDefToTypePrams.get(closure.codeDef()); if (mtps != null) { - for (Ref<? extends Type> ts : mtps) { - Type t = ts.get(); - if (t instanceof ParameterType) { - ParameterType pt = (ParameterType) t; - tps.add(xnf.TypeParamNode(cg, xnf.Id(cg, pt.name())).type(pt)); - tns.add(xnf.X10CanonicalTypeNode(cg, pt)); - rts.add(Types.ref(pt)); - } + for (ParameterType t : mtps) { + ParameterType pt = (ParameterType) t; + tps.add(xnf.TypeParamNode(cg, xnf.Id(cg, pt.name())).type(pt)); + tns.add(xnf.X10CanonicalTypeNode(cg, pt)); + rts.add(pt); } } Modified: trunk/x10.compiler/src/x10c/visit/InlineHelper.java =================================================================== --- trunk/x10.compiler/src/x10c/visit/InlineHelper.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10c/visit/InlineHelper.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -231,7 +231,7 @@ X10MethodDef nmd = (X10MethodDef) xts.methodDef(pos, Types.ref(cd.asType()), nmdcl.flags().flags(), Types.ref(nmdcl.returnType().type()), nmdcl.name().id(), argTypes, excTypes); // check - List<Ref<? extends Type>> rts = new ArrayList<Ref<? extends Type>>(); + List<ParameterType> rts = new ArrayList<ParameterType>(); List<TypeParamNode> ts = new ArrayList<TypeParamNode>(mdcl.typeParameters()); if (md instanceof X10MethodDef) { rts.addAll(((X10MethodDef) md).typeParameters()); @@ -244,7 +244,7 @@ if (t3 instanceof ParameterType) { ParameterType pt = (ParameterType) t3; ts.add(xnf.TypeParamNode(pos, xnf.Id(pos, pt.name())).type(pt)); - rts.add(Types.ref(pt)); + rts.add(pt); } } } @@ -323,7 +323,7 @@ StructType container = mi.container(); X10MethodDef md = (X10MethodDef) xts.methodDef(pos, Types.ref(container), mi.flags().clearNative().clearPrivate().Static(), Types.ref(mi.returnType()), id.id(), getRefList(formals), getRefList(mi.throwTypes())); - List<Ref<? extends Type>> rts = new ArrayList<Ref<? extends Type>>(); + List<ParameterType> rts = new ArrayList<ParameterType>(); if (md instanceof X10MethodDef) { rts.addAll(((X10MethodDef) mi.def()).typeParameters()); } @@ -334,7 +334,7 @@ for (Type t3 : t2.typeArguments()) { if (t3 instanceof ParameterType) { ParameterType pt = (ParameterType) t3; - rts.add(Types.ref(pt)); + rts.add(pt); } } } Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -399,10 +399,8 @@ } } - static List<Type> toTypeList(List<Ref<? extends Type>> list) { - ArrayList<Type> res = new ArrayList<Type>(); - for (Ref<? extends Type> r : list) - res.add(r.get()); + static List<Type> toTypeList(List<ParameterType> list) { + ArrayList<Type> res = new ArrayList<Type>(list); return res; } Modified: trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java =================================================================== --- trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -72,12 +72,11 @@ } void initTypeParameters() { - List<Ref<? extends polyglot.types.Type>> params = constrDef.typeParameters(); + List<ParameterType> params = constrDef.typeParameters(); // typeParams = new LinkedHashMap<String, X10TypeVariable>(params.size()); typeParams = new X10TypeVariable[params.size()]; int i = 0; - for (Ref<? extends polyglot.types.Type> ref: params) { - ParameterType p = (ParameterType) ref.get(); + for (ParameterType p: params) { X10TypeVariable v = new X10TypeVariable(p, this); // typeParams.put(typeParameterKey(p), v); typeParams[i++] = v; Modified: trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java =================================================================== --- trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -75,12 +75,11 @@ } void initTypeParameters() { - List<Ref<? extends polyglot.types.Type>> params = methodDef.typeParameters(); + List<ParameterType> params = methodDef.typeParameters(); // typeParams = new LinkedHashMap<String, X10TypeVariable>(params.size()); typeParams = new X10TypeVariable[params.size()]; int i = 0; - for (Ref<? extends polyglot.types.Type> ref: params) { - ParameterType p = (ParameterType) ref.get(); + for (ParameterType p: params) { X10TypeVariable v = new X10TypeVariable(p, this); typeParams[i++] = v; // typeParams.put(typeParameterKey(p), v); Modified: trunk/x10.doc/src/x10doc/doc/X10TypeDefDoc.java =================================================================== --- trunk/x10.doc/src/x10doc/doc/X10TypeDefDoc.java 2010-09-16 04:04:06 UTC (rev 16410) +++ trunk/x10.doc/src/x10doc/doc/X10TypeDefDoc.java 2010-09-16 04:35:59 UTC (rev 16411) @@ -53,11 +53,10 @@ } void initTypeParameters() { - List<Ref<? extends polyglot.types.Type>> params = typeDef.typeParameters(); + List<ParameterType> params = typeDef.typeParameters(); typeParams = new X10TypeVariable[params.size()]; int i = 0; - for (Ref<? extends polyglot.types.Type> ref: params) { - ParameterType p = (ParameterType) ref.get(); + for (ParameterType p: params) { X10TypeVariable v = new X10TypeVariable(p, this); typeParams[i++] = v; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-09-16 13:12:00
|
Revision: 16420 http://x10.svn.sourceforge.net/x10/?rev=16420&view=rev Author: dgrove-oss Date: 2010-09-16 13:11:51 +0000 (Thu, 16 Sep 2010) Log Message: ----------- rename and update list Added Paths: ----------- trunk/TODO_21_OBJ_MODEL.txt Removed Paths: ------------- trunk/TODO_DAVE.txt Copied: trunk/TODO_21_OBJ_MODEL.txt (from rev 16417, trunk/TODO_DAVE.txt) =================================================================== --- trunk/TODO_21_OBJ_MODEL.txt (rev 0) +++ trunk/TODO_21_OBJ_MODEL.txt 2010-09-16 13:11:51 UTC (rev 16420) @@ -0,0 +1,16 @@ +Inspect all @NativeRep classes for c++ backend and +update serialization routines for 2.1 object model. + +x10.compiler.RemoteOperation. + Kill this code. Won't work anymore. + Recode RA to use IndexedMemoryChunk directly. + +x10.io.GlobalStringWriter + Do we really want this class? See todo in the class header. + In general, normalize APIs for Global vs.Local operations, + Need to think about StringBuilder, Printers, Writers, etc. + Need to think about Console, Files, etc. + +x10.util. + Kill various Val<Foo> classes. No longer needed in 2.1 + Deleted: trunk/TODO_DAVE.txt =================================================================== --- trunk/TODO_DAVE.txt 2010-09-16 13:02:03 UTC (rev 16419) +++ trunk/TODO_DAVE.txt 2010-09-16 13:11:51 UTC (rev 16420) @@ -1,10 +0,0 @@ -x10.compiler.RemoteOperation. - Kill this code. Won't work anymore. - Recode RA to use IndexedMemoryChunk directly. - -x10.io.GlobalStringWriter - Do we really want this class? See todo in the class header. - -x10.util. - Kill various Val<Foo> classes. No longer needed in 2.1 - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-09-16 17:00:35
|
Revision: 16427 http://x10.svn.sourceforge.net/x10/?rev=16427&view=rev Author: ipeshansky Date: 2010-09-16 17:00:28 +0000 (Thu, 16 Sep 2010) Log Message: ----------- Remove uses of X10ConstructorDef.typeParameters(). Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.java trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java Modified: trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.java 2010-09-16 16:56:17 UTC (rev 16426) +++ trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.java 2010-09-16 17:00:28 UTC (rev 16427) @@ -146,8 +146,6 @@ return true; } - public List<Type> typeParameters; - public List<Type> typeParameters() { return Collections.emptyList(); } @@ -203,23 +201,19 @@ public String signature() { StringBuilder sb = new StringBuilder(); sb.append("this"); - List<String> params = new ArrayList<String>(); - List<Type> typeParameters = typeParameters(); - if (typeParameters != null) { - for (int i = 0; i < typeParameters.size(); i++) { - params.add(typeParameters.get(i).toString()); - } - } - else { - for (int i = 0; i < x10Def().typeParameters().size(); i++) { - params.add(x10Def().typeParameters().get(i).toString()); - } - } - if (params.size() > 0) { - sb.append("["); - sb.append(CollectionUtil.listToString(params)); - sb.append("]"); - } + // [IP] Constructors don't have type parameters, they inherit them from the container. + //List<String> params = new ArrayList<String>(); + //List<Type> typeParameters = typeParameters(); + //if (typeParameters != null) { + // for (int i = 0; i < typeParameters.size(); i++) { + // params.add(typeParameters.get(i).toString()); + // } + //} + //if (params.size() > 0) { + // sb.append("["); + // sb.append(CollectionUtil.listToString(params)); + // sb.append("]"); + //} List<String> formals = new ArrayList<String>(); List<Type> formalTypes = formalTypes(); if (formalTypes != null) { Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-09-16 16:56:17 UTC (rev 16426) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2010-09-16 17:00:28 UTC (rev 16427) @@ -821,8 +821,9 @@ printTemplateSignature((container).typeArguments(), h); } - X10ConstructorDef def = (X10ConstructorDef) n.constructorDef(); - printTemplateSignature(toTypeList(def.typeParameters()), h); + // [IP] Constructors don't have type parameters, they inherit them from the container. + //X10ConstructorDef def = (X10ConstructorDef) n.constructorDef(); + //printTemplateSignature(toTypeList(def.typeParameters()), h); h.begin(0); if (!define && container.isX10Struct()) h.write("static "); Modified: trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java =================================================================== --- trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java 2010-09-16 16:56:17 UTC (rev 16426) +++ trunk/x10.doc/src/x10doc/doc/X10ConstructorDoc.java 2010-09-16 17:00:28 UTC (rev 16427) @@ -72,15 +72,16 @@ } void initTypeParameters() { - List<ParameterType> params = constrDef.typeParameters(); - // typeParams = new LinkedHashMap<String, X10TypeVariable>(params.size()); - typeParams = new X10TypeVariable[params.size()]; - int i = 0; - for (ParameterType p: params) { - X10TypeVariable v = new X10TypeVariable(p, this); - // typeParams.put(typeParameterKey(p), v); - typeParams[i++] = v; - } + // [IP] Constructors don't have type parameters, they inherit them from the container. + //List<ParameterType> params = constrDef.typeParameters(); + //typeParams = new X10TypeVariable[params.size()]; + //int i = 0; + //for (ParameterType p: params) { + // X10TypeVariable v = new X10TypeVariable(p, this); + // // typeParams.put(typeParameterKey(p), v); + // typeParams[i++] = v; + //} + typeParams = new X10TypeVariable[0]; } public X10ConstructorDef getConstructorDef() { Modified: trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java =================================================================== --- trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java 2010-09-16 16:56:17 UTC (rev 16426) +++ trunk/x10.doc/src/x10doc/doc/X10MethodDoc.java 2010-09-16 17:00:28 UTC (rev 16427) @@ -76,7 +76,6 @@ void initTypeParameters() { List<ParameterType> params = methodDef.typeParameters(); - // typeParams = new LinkedHashMap<String, X10TypeVariable>(params.size()); typeParams = new X10TypeVariable[params.size()]; int i = 0; for (ParameterType p: params) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-09-17 02:02:43
|
Revision: 16476 http://x10.svn.sourceforge.net/x10/?rev=16476&view=rev Author: dgrove-oss Date: 2010-09-17 02:02:36 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Modification to Array constructors suggested by Dave C. Eliminate the constructor def this(int, (Point)=>T) so we could instead have def this(int, (int)=>T) Array now now has two families of constructors: (a) A family of constructors that operates over Regions and Points def this(Region) def this(Region, T) def this(Region, (Point)=>T) (b) A family of constructors that operates on ints (closer in spirit to Rail) def this(int) def this(int, T) def this(int, (int)=>T) If we could overload on function types, then we could have kept def this(int, (Point)=>T) but since we can't do this currently, the (int)=>T constructor is the more useful of the two and it wins... Update sample programs to match API change. Modified Paths: -------------- trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/GCSpheres.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeans.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/NQueensPar.x10 trunk/x10.dist/samples/StructSpheres.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 trunk/x10.runtime/src-x10/x10/array/Array.x10 Modified: trunk/x10.dist/samples/FRASimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FRASimpleDist.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/FRASimpleDist.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -22,7 +22,7 @@ def this(size:int) { mask = size-1; - a = new Array[long](size, (p:Point(1))=>p(0) as long); + a = new Array[long](size, (i:int)=>i as long); } public def update(ran:long) { Modified: trunk/x10.dist/samples/GCSpheres.x10 =================================================================== --- trunk/x10.dist/samples/GCSpheres.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/GCSpheres.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -73,7 +73,7 @@ // the array can go on the heap // but the elements ought to be /*inlined*/ in the array val spheres = - new Array[WorldObject](num_objects, ([i]:Point) => { + new Array[WorldObject](num_objects, (i:int) => { val x = (ran.nextDouble()*world_size) as Real; val y = (ran.nextDouble()*world_size) as Real; val z = (ran.nextDouble()*world_size) as Real; Modified: trunk/x10.dist/samples/Histogram.x10 =================================================================== --- trunk/x10.dist/samples/Histogram.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/Histogram.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -33,7 +33,7 @@ } val N = int.parse(args(0)); val S = int.parse(args(1)); - val a = new Array[int](0..N-1, ([i]:Point)=> i); + val a = new Array[int](N, (i:int)=> i); val b = new Array[int](S); run(a, b); val v = b(0); Modified: trunk/x10.dist/samples/KMeans.x10 =================================================================== --- trunk/x10.dist/samples/KMeans.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/KMeans.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -40,7 +40,7 @@ static class V(dim:Int) implements (Int)=>Float { var vec: Vector(dim); var count:Int; - def this(dim:Int, init:(Point(1))=>Float): SumVector(dim) { + def this(dim:Int, init:(int)=>Float): SumVector(dim) { property(dim); vec = new Array[Float](this.dim, init); count = 0; @@ -97,9 +97,9 @@ def computeMeans(myK:Int, points: Array[ValVector(myDim)](1)): KMeansData(myK, myDim) { var redCluster : KMeansData(myK, myDim) = - new Array[SumVector(myDim)](myK, ([i]:Point)=> new V(myDim, ([j]:Point)=>points(i)(j))); + new Array[SumVector(myDim)](myK, (i:int)=> new V(myDim, (j:int)=>points(i)(j))); var blackCluster: KMeansData(myK, myDim) = - new Array[SumVector(myDim)](myK, ([i]:Point)=> new V(myDim, ([j]:Point)=>0.0F)); + new Array[SumVector(myDim)](myK, (i:int)=> new V(myDim, (j:int)=>0.0F)); for ([i] in 1..ITERATIONS) { val tmp = redCluster; redCluster = blackCluster; @@ -138,7 +138,7 @@ public static def main (Array[String]) { val rnd = new Random(0); val points = new Array[ValVector](POINTS, - (Point(1))=>new Array[Float](DIM, (Point(1))=>rnd.nextFloat()) as ValVector); + (int)=>new Array[Float](DIM, (int)=>rnd.nextFloat()) as ValVector); val result = new KMeans(DIM).computeMeans(K, points); for ([k] in 0..K-1) result(k).print(); } Modified: trunk/x10.dist/samples/KMeansDist.x10 =================================================================== --- trunk/x10.dist/samples/KMeansDist.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/KMeansDist.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -30,8 +30,8 @@ val points_dist = Dist.makeBlock(points_region, 0); val points = DistArray.make[Float](points_dist, (p:Point)=>rnd().nextFloat()); - val central_clusters = new Array[Float](CLUSTERS*DIM, (pt:Point(1)) => { - val p = Point.make([pt(0)/DIM, pt(0)%DIM]); + val central_clusters = new Array[Float](CLUSTERS*DIM, (i:int) => { + val p = Point.make([i/DIM, i%DIM]); return at (points_dist(p)) points(p); }); Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -60,12 +60,12 @@ // file is dimension-major val file = new File(fname), fr = file.openRead(); - val init_points = (Point(1)) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); + val init_points = (int) => Float.fromIntBits(Marshal.INT.read(fr).reverseBytes()); val num_file_points = (file.size() / dim / 4) as Int; val file_points = new Array[Float](num_file_points*dim, init_points); //val team = Team.WORLD; - val team = Team(new Array[Place](num_slices * Place.MAX_PLACES, ([i]:Point) => Place.places(i/num_slices))); + val team = Team(new Array[Place](num_slices * Place.MAX_PLACES, (i:int) => Place.places(i/num_slices))); val num_slice_points = num_global_points / num_slices / Place.MAX_PLACES; @@ -82,7 +82,7 @@ if (!quiet) Console.OUT.println(h+" gets "+offset+" len "+num_slice_points); val num_slice_points_stride = num_slice_points; - val init = ([i]:Point) => { + val init = (i:int) => { val d=i/num_slice_points_stride, p=i%num_slice_points_stride; return p<num_slice_points ? file_points(((p+offset)%num_file_points)*dim + d) : 0; }; @@ -91,7 +91,7 @@ val host_points = new Array[Float](num_slice_points_stride*dim, init); val host_nearest = new Array[Float](num_slice_points); - val host_clusters = new Array[Float](num_clusters*dim, file_points); + val host_clusters = new Array[Float](0..num_clusters*dim-1, file_points); val host_cluster_counts = new Array[Int](num_clusters); val start_time = System.currentTimeMillis(); Modified: trunk/x10.dist/samples/NQueensDist.x10 =================================================================== --- trunk/x10.dist/samples/NQueensDist.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/NQueensDist.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -45,7 +45,7 @@ assert P >= 0; val low = R.min()(0), high = R.max()(0), count = high-low+1; val baseSize = count/P, extra = count - baseSize*P; - new Array[Region(1){rect}](P, ([i]:Point):Region(1){rect} => { + new Array[Region(1){rect}](P, (i:int):Region(1){rect} => { val start = low+i*baseSize+ (i < extra? i:extra); start..start+baseSize+(i < extra?0:-1) }) @@ -58,7 +58,7 @@ } def this(old:Array[Int](1), newItem:Int) { val n = old.size; - q = new Array[Int](n+1, ([i]:Point)=> (i < n? old(i) : newItem)); + q = new Array[Int](n+1, (i:int)=> (i < n? old(i) : newItem)); } def safe(j: int) { val n = q.size; Modified: trunk/x10.dist/samples/NQueensPar.x10 =================================================================== --- trunk/x10.dist/samples/NQueensPar.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/NQueensPar.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -38,7 +38,7 @@ assert P >= 0; val low = R.min()(0), high = R.max()(0), count = high-low+1; val baseSize = count/P, extra = count - baseSize*P; - new Array[Region(1)](P, ([i]:Point):Region(1) => { + new Array[Region(1)](P, (i:int):Region(1) => { val start = low+i*baseSize+ (i < extra? i:extra); start..start+baseSize+(i < extra?0:-1) }) @@ -54,7 +54,7 @@ def this(old: Array[Int](1), newItem:Int) { val n = old.size(); - q = new Array[Int](n+1, (p:Point(1))=> (p(0) < n? old(p(0)) : newItem)); + q = new Array[Int](n+1, (i:int)=> (i < n? old(i) : newItem)); } def safe(j: int) { Modified: trunk/x10.dist/samples/StructSpheres.x10 =================================================================== --- trunk/x10.dist/samples/StructSpheres.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/StructSpheres.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -72,7 +72,7 @@ // the array can go on the heap // but the elements ought to be /*inlined*/ in the array val spheres = - new Array[WorldObject](num_objects, ([i]:Point) => { + new Array[WorldObject](num_objects, (i:int) => { val x = (ran.nextDouble()*world_size) as Real; val y = (ran.nextDouble()*world_size) as Real; val z = (ran.nextDouble()*world_size) as Real; Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -57,7 +57,7 @@ // Needs to be done properly and integrated into the Dist/Region/DistArray // class library in x10.array. static def blockIt(d:Dist(2), numProcs:int):Array[ArrayList[Point(2)]](1) { - val ans = new Array[ArrayList[Point(2)]](numProcs, (Point) => new ArrayList[Point(2)]()); + val ans = new Array[ArrayList[Point(2)]](numProcs, (int) => new ArrayList[Point(2)]()); var modulo:int = 0; for (p in d) { ans(modulo).add(p); Modified: trunk/x10.runtime/src-x10/x10/array/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-09-17 01:16:33 UTC (rev 16475) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-09-17 02:02:36 UTC (rev 16476) @@ -223,8 +223,14 @@ * in future releases of X10, this method will only be callable if sizeof(T) bytes * of zeros is a valid value of type T. */ - public def this(size:int):Array[T]{rank==1,rect,zeroBased,self.rail} { - this(Region.makeRectangular(0, size-1)); + public def this(size:int):Array[T]{self.region.rank==1,self.region.rect,self.region.zeroBased} { + property(0..size-1, size); + + layout = RectLayout(region.min(), region.max()); + val n = layout.size(); + raw = IndexedMemoryChunk.allocate[T](n, true); + rawLength = n; + cachedRail = region.rail; } @@ -235,8 +241,18 @@ * @param reg The region over which to construct the array. * @param init The function to use to initialize the array. */ - public def this(size:int, init:(Point(1))=>T):Array[T]{rank==1,rect,zeroBased,self.rail} { - this(Region.makeRectangular(0, size-1), init); + public def this(size:int, init:(int)=>T):Array[T]{rank==1,rect,zeroBased} { + property(0..size-1, size); + + layout = RectLayout(region.min(), region.max()); + val n = layout.size(); + val r = IndexedMemoryChunk.allocate[T](n); + for ([i] in 0..size-1) { + r(i)= init(i); + } + raw = r; + rawLength = n; + cachedRail = region.rail; } @@ -248,7 +264,17 @@ * @param init The function to use to initialize the array. */ public def this(size:int, init:T):Array[T]{rank==1,rect,zeroBased,self.rail} { - this(Region.makeRectangular(0, size-1), init); + property(0..size-1, size); + + layout = RectLayout(region.min(), region.max()); + val n = layout.size(); + val r = IndexedMemoryChunk.allocate[T](n); + for ([i] in 0..size-1) { + r(i)= init; + } + raw = r; + rawLength = n; + cachedRail = region.rail; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-09-17 02:11:31
|
Revision: 16477 http://x10.svn.sourceforge.net/x10/?rev=16477&view=rev Author: vj0 Date: 2010-09-17 02:11:23 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Clean up constraint system implementation. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XEquals.java trunk/x10.constraints/src/x10/constraint/XFailure.java trunk/x10.constraints/src/x10/constraint/XField.java trunk/x10.constraints/src/x10/constraint/XFormula.java trunk/x10.constraints/src/x10/constraint/XLit.java trunk/x10.constraints/src/x10/constraint/XNot.java trunk/x10.constraints/src/x10/constraint/XPromise_c.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerms.java Removed Paths: ------------- trunk/x10.constraints/src/x10/constraint/XMinus.java trunk/x10.constraints/src/x10/constraint/XMod.java trunk/x10.constraints/src/x10/constraint/XPlus.java trunk/x10.constraints/src/x10/constraint/XPrefix.java trunk/x10.constraints/src/x10/constraint/XRef.java trunk/x10.constraints/src/x10/constraint/XSubst.java Modified: trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -39,7 +39,6 @@ import x10.Configuration; import x10.constraint.XFailure; -import x10.constraint.XRef; import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XVar; Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -52,7 +52,6 @@ import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRef; import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -89,7 +89,6 @@ import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRef; import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; Modified: trunk/x10.compiler/src/x10/types/MacroType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -46,7 +46,6 @@ import polyglot.util.TransformingList; import polyglot.util.TypedList; import x10.constraint.XNameWrapper; -import x10.constraint.XRef; import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.constraints.CConstraint; Modified: trunk/x10.compiler/src/x10/types/XTypeTranslator.java =================================================================== --- trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -55,7 +55,6 @@ import x10.constraint.XLocal; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRef; import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; @@ -91,7 +90,7 @@ private XTerm trans(CConstraint c, Unary t, X10Context xc) throws SemanticException { XTerm v = null; if (t.operator() == Unary.NOT) { - v = XTerms.makeNot(trans(c, t.expr(), xc)); + // v = XTerms.makeNot(trans(c, t.expr(), xc)); } else { v = XTerms.makeAtom(XTerms.makeName(t.operator()), trans(c, t.expr(), xc)); throw new SemanticException("Cannot translate " + t + " to constraint term."); Modified: trunk/x10.constraints/src/x10/constraint/XConstraint.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XConstraint.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -39,29 +39,19 @@ * * The constraint system implements the usual congruence rules for equality. * - * <p> TBD: Add - * <verbatim> - * t ::= t == t - * </verbatim> - * - * <p> This is useful in specifying that a Region is zeroBased iff its rank=0. - - * - * - * <p>A constraint is implemented as a graph whose nodes are XPromises. Additionally, a constraint - * keeps track of two variables, self and this. - * + * <p>A constraint is implemented as a graph whose nodes are XPromises. Two different constraints will + * not share XPromises. * <p> * A promise contains fields: * <olist> - * <li>XPromise value -- points to a node it has been equated to + * <li>XPromise value -- if non-null, points to a promise this one has been equated to * <li>Collection<XPromise> disequals -- contains set of other nodes this has been disequated with * <li>XTerm var -- externally visible term labeling this promise * <li>Map<XName, XPromise> fields -- hashmap of fields of this promise. * </olist> - * It maintsins the invariant <tt> value != null implies (disequals==null,fields == null)</tt> + * It maintains the invariant <tt> value != null implies (disequals==null && fields == null)</tt> * - * This representation is a bit different from the Nelson-Oppen and Shostak congruence closure + * <p>This representation is a bit different from the Nelson-Oppen and Shostak congruence closure * algorithms described, e.g. in Cyrluk, Lincoln and Shankar "On Shostak's Decision Procedure * for Combination of Theories", CADE 96. * @@ -76,12 +66,7 @@ public class XConstraint implements Cloneable { private static final boolean DEBUG = false; - - - - // Maps XTerms to nodes. protected HashMap<XTerm, XPromise> roots; - protected boolean consistent = true; boolean valid = true; @@ -108,7 +93,7 @@ /** * Copy this constraint logically; that is, create a new constraint * that contains the same equalities (if any) as the current one. - * Copy also the consistency, and validity status, and thisVar and self. + * Copy also the consistency, and validity status. */ public XConstraint copy() { XConstraint c = new XConstraint(); @@ -125,19 +110,16 @@ } /** - * Return the result of copying this into c. Assume that c will be - * the depclause of the same base type as this, hence it is ok to - * copy self-clauses as is. + * Return the result of copying this into c. * @param c * @return */ protected XConstraint copyInto(XConstraint c) throws XFailure { - /** Add in a constraint, substituting this.self for c.self */ c.addIn(this); return c; } - public XConstraint addIn(XConstraint c) throws XFailure { + XConstraint addIn(XConstraint c) throws XFailure { if (c != null) { List<XTerm> result = c.constraints(); if (result == null) @@ -146,8 +128,6 @@ addTerm(t); } } - // vj: What about thisVar for c? Should that be added? - // thisVar = getThisVar(this, c); return this; } @@ -164,43 +144,6 @@ return null; } - // FIXME: Vijay, Igor and I think this method has the semantics intended for bindingForVar, - // which is incorrectly implemented. - // The javadoc comment supports this conclusion. - Bowen - /** - * Return the term v is bound to in this constraint, and null - * if there is no such term. This term will be distinct from v. - */ - public XTerm termBindingForVar(XVar v) { - XPromise p = lookup(v); - if (p != null && (!(p.term() instanceof XVar) || !p.term().equals(v))) { - return p.term(); - } - return null; - } - - /* public XConstraint removeVarBindings(XVar v) { - try { - XConstraint c = new XConstraint_c(); - for (XTerm t : constraints()) { - if (t instanceof XEquals) { - XEquals eq = (XEquals) t; - XTerm left = eq.left(); - XTerm right = eq.right(); - if (left.equals(v) || right.equals(v)) { - continue; - } - } - c.addTerm(t.subst(c.self(), self())); - } - return c; - } - catch (XFailure e) { - return this; - } - } -*/ - /** * Return the list of atoms (atomic formulas) in this constraint. * @return @@ -239,153 +182,7 @@ return valid; } - /** - * Return the promise obtained by interning this term in the constraint. - * This may result in new promises being added to the graph maintained - * by the constraint. - * <p>term: Literal -- return the literal. - * <p> term:LocalVariable, Special, Here Check if term is already in the roots - * maintained by the constraint. If so, return the root, if not add a - * promise to the roots and return it. - * <p> term: XField. Start with the rootVar x and follow the path f1...fk, - * if term=x.f1...fk. If the graph contains no nodes after fi, - * for some i < k, add promises into the graph from fi+1...fk. - * Return the last promise. - * - * <p> Package protected -- should only be used in the implementation of the constraint - * system. - * @param term - * @return - * @throws XFailure - */ - - XPromise intern(XTerm term) throws XFailure { - return intern(term, null); - } - /** - * Used to implement substitution: if last != null, term, is substituted for - * the term that was interned previously to produce the promise last. This is accomplished by - * returning last as the promise obtained by interning term, unless term is a literal, in which - * case last is forwarded to term, and term is returned. This way incoming and outgoing edges - * (from fields) from last are preserved, but term now "becomes" last. - * Required: on entry, last.value == null. - * The code will work even if we have literals that are at types where properties are permitted. - * @param term - * @param last - * @return - */ - XPromise intern(XTerm term, XPromise last) throws XFailure { - assert term != null; - if (term instanceof XPromise) { - XPromise q = (XPromise) term; - - // this is the case for literals, for here - if (last != null) { - try { - last.bind(q); - } - catch (XFailure f) { - throw new XFailure("A term ( " + term + ") cannot be interned to a promise (" + last + ") whose value is not null."); - } - } - return q; - } - - // let the term figure out what to do for itself. - return term.internIntoConstraint(this, last); - } - - XPromise internBaseVar(XVar baseVar, boolean replaceP, XPromise last) throws XFailure { - if (roots == null) - roots = new LinkedHashMap<XTerm, XPromise>(); - XPromise p = (XPromise) roots.get(baseVar); - if (p == null) { - p = (replaceP && last != null) ? last : new XPromise_c(baseVar); - roots.put(baseVar, p); - } - return p; - } - - void addPromise(XTerm p, XPromise node) { - if (roots == null) - roots = new LinkedHashMap<XTerm, XPromise>(); - roots.put(p, node); - } - - void internRecursively(XVar v) throws XFailure { - intern(v); - } - - /** - * Look this term up in the constraint graph. Return null if the term - * does not exist. Does not create new nodes in the constraint graph. - * Does not return a forwarded promise (looks it up recursively, instead). - * - * @param term - * @return the terminal promise this term is associated with (if any), null otherwise - */ - XPromise lookup(XTerm term) { - XPromise result = lookupPartialOk(term); - if (!(result instanceof XPromise_c)) - return result; - // it must be the case that term is a XVar. - if (term instanceof XVar) { - XVar var = (XVar) term; - XVar[] vars = var.vars(); - XPromise_c resultC = (XPromise_c) result; - int index = resultC.lookupReturnValue(); - return (index == vars.length) ? result : null; - } - return null; - } - - /** - * Look this term up in the constraint graph. If the term is of the form - * x.f1...fk and the longest prefix that exists in the graph is - * x.f1..fi, return the promise corresponding to x.f1...fi. If the - * promise is a Promise_c, the caller must invoke lookupReturnValue() to - * determine if the match was partial (value returned is not equal to - * the length of term.vars()). If not even a partial match is found, or - * the partial match terminates in a literal (which, by definition, - * cannot have fields), then return null. - * - * @seeAlso lookup(C_term term) - * @param term - * @return - * @throws XFailure - */ - XPromise lookupPartialOk(XTerm term) { - if (term == null) - return null; - - if (term instanceof XPromise) - // this is the case for literals, for here - return (XPromise) term; - // otherwise it must be a XVar. - if (roots == null) - return null; - if (term instanceof XVar) { - XVar var = (XVar) term; - XVar[] vars = var.vars(); - XVar baseVar = vars[0]; - XPromise p = (XPromise) roots.get(baseVar); - if (p == null) - return null; - return p.lookup(vars, 1); - } - - { - XPromise p = roots.get(term); - if (p != null) - return p; - } - - return null; - } - - - /** * Add t1=t2 to the constraint, unless it is inconsistent. * Note: constraint is modified in place. * @param var -- t1 @@ -453,30 +250,6 @@ p = intern(t); } - - public XConstraint addBindingPromise(XTerm t1, XPromise p) { - try { - assert t1 != null; - if (!consistent) - return this; - if (roots == null) - roots = new LinkedHashMap<XTerm, XPromise>(); - XPromise p1 = intern(t1); - boolean modified = p1.bind(p); - } - catch (XFailure z) { - consistent = false; - } - return this; - } - - public void addTerms(List<XTerm> terms) throws XFailure { - for (XTerm t : terms) { - addTerm(t); - } - } - - /** * Does this entail constraint other? * @@ -488,8 +261,6 @@ return true; if (other == null || other.valid()) return true; -// if (other.toString().equals(toString())) -// return true; List<XTerm> otherConstraints = other.extConstraints(); for (XTerm t : otherConstraints) { boolean result = entails(t); @@ -499,7 +270,34 @@ return true; } + public void setInconsistent() { + this.consistent = false; + } + /** + * Return the least upper bound of this and other. That is, the resulting constraint has precisely + * the constraints entailed by both this and other. + * @param other + * @return + */ + public XConstraint leastUpperBound(XConstraint other) { + + XConstraint result = new XConstraint(); + for (XTerm term : other.constraints()) { + try { + if (entails(term)) { + result.addTerm(term); + } + } catch (XFailure z) { + + } + } + return result; + } + + + + /** * Return a list of bindings t1-> t2 equivalent to the current * constraint. Equivalent to constraints(new ArrayList()). * @@ -767,7 +565,7 @@ /** - * Perform substitute(y, x) for every binding x -> y in bindings. + * Perform substitute y for x for every binding x -> y in bindings. * */ public XConstraint substitute(HashMap<XVar, XTerm> subs) throws XFailure { @@ -789,7 +587,7 @@ public XConstraint substitute(XTerm y, XVar x) throws XFailure { return substitute(new XTerm[] { y }, new XVar[] { x }); } - public XConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { + XConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { return substitute(ys, xs); } @@ -853,8 +651,237 @@ // result.applySubstitution(y,x); return result; } + + /** + * Does this constraint contain occurrences of the variable v? + * + * @param v + * @return true iff v is a root variable of this. + */ + public boolean hasVar(XVar v) { + return roots != null && roots.keySet().contains(v); + } + + + /** + * Add the binding term=true to the constraint. + * + * @param term -- must be of type Boolean. + * @return new constraint with term=true added. + * @throws SemanticException + */ + // FIXME: need to convert f(g(x)) into \exists y. f(y) && g(x) = y when f and g both atoms + // This is needed for Nelson-Oppen to work correctly. + // Each atom should be a root. + public void addTerm(XTerm term) throws XFailure { + if (term.isAtomicFormula()) { + addAtom(term); + } + else if (term instanceof XVar) { + addBinding(term, XTerms.TRUE); + } + else if (term instanceof XNot) { + XNot t = (XNot) term; + if (t.unaryArg() instanceof XVar) + addBinding(t.unaryArg(), XTerms.FALSE); + if (t.unaryArg() instanceof XNot) + addTerm(((XNot) t.unaryArg()).unaryArg()); + } + else if (term instanceof XAnd) { + XAnd t = (XAnd) term; + addTerm(t.left()); + addTerm(t.right()); + } + else if (term instanceof XEquals) { + XEquals eq = (XEquals) term; + XTerm left = eq.left(); + XTerm right = eq.right(); + addBinding(left, right); + } else if (term instanceof XDisEquals) { + XDisEquals dq = (XDisEquals) term; + XTerm left = dq.left(); + XTerm right = dq.right(); + addDisBinding(left, right); + } + else { + throw new XFailure("Unexpected term |" + term + "|"); + } + } + // *****************************************************************INTERNAL ROUTINES + + /** + * Return the promise obtained by interning this term in the constraint. + * This may result in new promises being added to the graph maintained + * by the constraint. + * <p>term: Literal -- return the literal. + * <p> term:LocalVariable, Special, Here Check if term is already in the roots + * maintained by the constraint. If so, return the root, if not add a + * promise to the roots and return it. + * <p> term: XField. Start with the rootVar x and follow the path f1...fk, + * if term=x.f1...fk. If the graph contains no nodes after fi, + * for some i < k, add promises into the graph from fi+1...fk. + * Return the last promise. + * + * <p> Package protected -- should only be used in the implementation of the constraint + * system. + * @param term + * @return + * @throws XFailure + */ + + XPromise intern(XTerm term) throws XFailure { + return intern(term, null); + } + /** + * Used to implement substitution: if last != null, term, is substituted for + * the term that was interned previously to produce the promise last. This is accomplished by + * returning last as the promise obtained by interning term, unless term is a literal, in which + * case last is forwarded to term, and term is returned. This way incoming and outgoing edges + * (from fields) from last are preserved, but term now "becomes" last. + * Required: on entry, last.value == null. + * The code will work even if we have literals that are at types where properties are permitted. + * @param term + * @param last + * @return + */ + XPromise intern(XTerm term, XPromise last) throws XFailure { + assert term != null; + if (term instanceof XPromise) { + XPromise q = (XPromise) term; + + // this is the case for literals, for here + if (last != null) { + try { + last.bind(q); + } + catch (XFailure f) { + throw new XFailure("A term ( " + term + ") cannot be interned to a promise (" + last + ") whose value is not null."); + } + } + return q; + } + + // let the term figure out what to do for itself. + return term.internIntoConstraint(this, last); + } + + XPromise internBaseVar(XVar baseVar, boolean replaceP, XPromise last) throws XFailure { + if (roots == null) + roots = new LinkedHashMap<XTerm, XPromise>(); + XPromise p = (XPromise) roots.get(baseVar); + if (p == null) { + p = (replaceP && last != null) ? last : new XPromise_c(baseVar); + roots.put(baseVar, p); + } + return p; + } + + void addPromise(XTerm p, XPromise node) { + if (roots == null) + roots = new LinkedHashMap<XTerm, XPromise>(); + roots.put(p, node); + } + + void internRecursively(XVar v) throws XFailure { + intern(v); + } + + /** + * Look this term up in the constraint graph. Return null if the term + * does not exist. Does not create new nodes in the constraint graph. + * Does not return a forwarded promise (looks it up recursively, instead). + * + * @param term + * @return the terminal promise this term is associated with (if any), null otherwise + */ + XPromise lookup(XTerm term) { + XPromise result = lookupPartialOk(term); + if (!(result instanceof XPromise_c)) + return result; + // it must be the case that term is a XVar. + if (term instanceof XVar) { + XVar var = (XVar) term; + XVar[] vars = var.vars(); + XPromise_c resultC = (XPromise_c) result; + int index = resultC.lookupReturnValue(); + return (index == vars.length) ? result : null; + } + return null; + } + + /** + * Look this term up in the constraint graph. If the term is of the form + * x.f1...fk and the longest prefix that exists in the graph is + * x.f1..fi, return the promise corresponding to x.f1...fi. If the + * promise is a Promise_c, the caller must invoke lookupReturnValue() to + * determine if the match was partial (value returned is not equal to + * the length of term.vars()). If not even a partial match is found, or + * the partial match terminates in a literal (which, by definition, + * cannot have fields), then return null. + * + * @seeAlso lookup(C_term term) + * @param term + * @return + * @throws XFailure + */ + XPromise lookupPartialOk(XTerm term) { + if (term == null) + return null; + + if (term instanceof XPromise) + // this is the case for literals, for here + return (XPromise) term; + // otherwise it must be a XVar. + if (roots == null) + return null; + if (term instanceof XVar) { + XVar var = (XVar) term; + XVar[] vars = var.vars(); + XVar baseVar = vars[0]; + XPromise p = (XPromise) roots.get(baseVar); + if (p == null) + return null; + return p.lookup(vars, 1); + } + + { + XPromise p = roots.get(term); + if (p != null) + return p; + } + + return null; + } + + + /* + public XConstraint addBindingPromise(XTerm t1, XPromise p) { + try { + assert t1 != null; + if (!consistent) + return this; + if (roots == null) + roots = new LinkedHashMap<XTerm, XPromise>(); + XPromise p1 = intern(t1); + boolean modified = p1.bind(p); + } + catch (XFailure z) { + consistent = false; + } + return this; + } + + public void addTerms(List<XTerm> terms) throws XFailure { + for (XTerm t : terms) { + addTerm(t); + } + } +*/ + + + /** * Preconditions: x occurs in this. It must be the case that the real * clause of the type of y, S, entails the real clause of the type of x, * T. Assume that this and S are fully explicit, that is the @@ -1039,94 +1066,7 @@ } } - /** - * Does this constraint contain occurrences of the variable v? - * - * @param v - * @return true iff v is a root variable of this. - */ - public boolean hasVar(XVar v) { - if (roots == null) - return false; - return roots.keySet().contains(v); - } + - /** - * Add the binding term=true to the constraint. - * - * @param term -- must be of type Boolean. - * @return new constraint with term=true added. - * @throws SemanticException - */ - // FIXME: need to convert f(g(x)) into \exists y. f(y) && g(x) = y when f and g both atoms - // This is needed for Nelson-Oppen to work correctly. - // Each atom should be a root. - public void addTerm(XTerm term) throws XFailure { - if (term.isAtomicFormula()) { - addAtom(term); - } - else if (term instanceof XVar) { - addBinding(term, XTerms.TRUE); - } - else if (term instanceof XNot) { - XNot t = (XNot) term; - if (t.unaryArg() instanceof XVar) - addBinding(t.unaryArg(), XTerms.FALSE); - if (t.unaryArg() instanceof XNot) - addTerm(((XNot) t.unaryArg()).unaryArg()); - } - else if (term instanceof XAnd) { - XAnd t = (XAnd) term; - addTerm(t.left()); - addTerm(t.right()); - } - else if (term instanceof XEquals) { - XEquals eq = (XEquals) term; - XTerm left = eq.left(); - XTerm right = eq.right(); - addBinding(left, right); - } else if (term instanceof XDisEquals) { - XDisEquals dq = (XDisEquals) term; - XTerm left = dq.left(); - XTerm right = dq.right(); - addDisBinding(left, right); - } - else { - throw new XFailure("Unexpected term |" + term + "|"); - } - /* - XConstraint s = term.selfConstraint(); - if (s != null) { - s = s.substitute(term, s.self()); - addIn(s); - } -*/ - } - - public void setInconsistent() { - this.consistent = false; - } - - /** - * Return the least upper bound of this and other. That is, the resulting constraint has precisely - * the constraints entailed by both this and other. - * @param other - * @return - */ - public XConstraint leastUpperBound(XConstraint other) { - - XConstraint result = new XConstraint(); - for (XTerm term : other.constraints()) { - try { - if (entails(term)) { - result.addTerm(term); - } - } catch (XFailure z) { - - } - } - return result; - } - } Modified: trunk/x10.constraints/src/x10/constraint/XEquals.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XEquals.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XEquals.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -22,23 +22,11 @@ } public XPromise internIntoConstraint(XConstraint c, XPromise last) throws XFailure { -// XTerm left = left(); -// XTerm right = right(); -// if (left instanceof XLit && right instanceof XLit) { -// if (left.equals(right)) -// return XTerms.TRUE.internIntoConstraint(c, last); -// else -// return XTerms.FALSE.internIntoConstraint(c, last); -// } - XPromise p = c.intern(left()); XPromise q = c.intern(right()); if (p instanceof XLit && q instanceof XLit) { - if (p.equals(q)) - return c.intern(XTerms.TRUE); - else - return c.intern(XTerms.FALSE); + return c.intern(p.equals(q) ? XTerms.TRUE : XTerms.FALSE); } else { if (p == q || p.term().equals(q.term())) Modified: trunk/x10.constraints/src/x10/constraint/XFailure.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XFailure.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XFailure.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -13,6 +13,7 @@ /** + * A representation of failure. Thrown when the constraint becomes inconsistent. * @author vj * */ Modified: trunk/x10.constraints/src/x10/constraint/XField.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XField.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XField.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -41,16 +41,6 @@ result.receiver = newReceiver; } return result; - - /* - XVar newReceiver = (XVar) receiver.subst(y, x); - XField_c n = (XField_c) super.subst(y, x, propagate); - if (newReceiver == receiver) - return n; - if (n == this) n = clone(); - n.receiver = newReceiver; - return n; - */ } public List<XEQV> eqvs() { Modified: trunk/x10.constraints/src/x10/constraint/XFormula.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XFormula.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XFormula.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -15,10 +15,21 @@ import java.util.HashMap; import java.util.List; +/** + * A representation of an atomic formula op(t1,..., tn). + * + * @author vijay + * + */ public class XFormula extends XTerm { public XName op; public List<XTerm> arguments; + /** + * Create a formula with the given op and given list of arguments. + * @param op + * @param args + */ public XFormula(XName op, List<XTerm> args) { this.op = op; this.arguments = args; @@ -153,11 +164,17 @@ return false; } + /** + * An XFormula is equal t another object if it is == to it, or the other object + * is an XFormula with equal ops and equal args. + */ public boolean equals(Object o) { if (this == o) return true; if (o instanceof XFormula) { XFormula c = (XFormula) o; + if (! c.op.equals(op)) + return false; if (c.arguments().size() == arguments().size()) { for (int i = 0; i < arguments().size(); i++) { XTerm ti = arguments().get(i); Modified: trunk/x10.constraints/src/x10/constraint/XLit.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XLit.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XLit.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -16,6 +16,12 @@ import java.util.List; import java.util.Set; +/** + * A representation of a literal. A literal is both an XVar and an XPromise. + * + * @author vijay + * + */ public class XLit extends XVar implements XPromise { protected Object val; @@ -23,7 +29,7 @@ val = l; } - public Object val() { + public Object val() { return val; } @@ -35,7 +41,7 @@ public XTermKind kind() { return XTermKind.LITERAL;} public List<XEQV> eqvs() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public String toString() { Deleted: trunk/x10.constraints/src/x10/constraint/XMinus.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XMinus.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XMinus.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,32 +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.constraint; - - -/** - * Represents t1 - t2 - * - * Intended as placeholder for special treatment for propagation rules and simplification rules - * for -. - * @author vj - * - */ -public class XMinus extends XFormula { - - public XMinus(XTerm... args) { - super(XTerms.minusName, args); - } - public String toString() { - return arguments.get(0) + "-" + arguments.get(1); - } -} - Deleted: trunk/x10.constraints/src/x10/constraint/XMod.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XMod.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XMod.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,34 +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.constraint; - -import java.util.List; - - -/** - * Represents t1 + t2 - * - * Intended as placeholder for special treatment for propagation rules and simplification rules - * for +. - * @author vj - * - */ -public class XMod extends XFormula { - - - public XMod(XTerm... args) { - super(XTerms.modName, args); - } - public String toString() { - return arguments.get(0) + "%" + arguments.get(1); - } -} Modified: trunk/x10.constraints/src/x10/constraint/XNot.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XNot.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XNot.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -11,6 +11,12 @@ package x10.constraint; +/** + * A representation of !c. Place holder for propagation rules for !. + * + * @author vijay + * + */ public class XNot extends XFormula { public XNot(XTerm arg) { Deleted: trunk/x10.constraints/src/x10/constraint/XPlus.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XPlus.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XPlus.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,36 +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.constraint; - -import java.util.List; - -/** - * Represents t1 + t2 - * - * Intended as placeholder for special treatment for propagation rules and simplification rules - * for +. - * @author vj - * - */ -public class XPlus extends XFormula { - - public XPlus(List<XTerm> args) { - super(XTerms.plusName, args); - } - - public XPlus(XTerm... args) { - super(XTerms.plusName, args); - } - - public String toString() { - return arguments.get(0) + "+" + arguments.get(1); - } -} Deleted: trunk/x10.constraints/src/x10/constraint/XPrefix.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XPrefix.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XPrefix.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,21 +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.constraint; - -/** - * @see Prefix - * @author Vj - * - */ -public interface XPrefix { - -} Modified: trunk/x10.constraints/src/x10/constraint/XPromise_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XPromise_c.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XPromise_c.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -26,11 +26,15 @@ * constraint are either Promise_c's or other implementations of Promise, such * as C_Lit and C_Here. * - * Invariant: If fields is not empty, then var is an XVar. + * <p>Invariant: If fields is not empty, then var is an XVar. + * + * <p>Note: This class is not public. It is internal to the implementation of the constraint system. No + * client of the constraint system should use this class. + * * @author vj * */ -public class XPromise_c implements XPromise, Serializable { +class XPromise_c implements XPromise, Serializable { /** * The externally visible XTerm that this node represents in the constraint * graph. May be null, if this promise corresponds to an internal node. Deleted: trunk/x10.constraints/src/x10/constraint/XRef.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XRef.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XRef.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,28 +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.constraint; - -public abstract class XRef<T> { - public T result; - - public final T get() { - if (result == null) - result = compute(); - return result; - } - - public abstract T compute(); - - public String toString() { - return String.valueOf(result); - } -} Deleted: trunk/x10.constraints/src/x10/constraint/XSubst.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XSubst.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XSubst.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -1,124 +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.constraint; - -import java.util.ArrayList; -import java.util.List; - -public class XSubst extends XRef<XConstraint> { - - XTerm y; - XVar x; - XRef<XConstraint> ref; - - @Override - public String toString() { - return ref + "[" + y + "/" + x + "]"; - } - - /** term[y/x] */ - XSubst(XRef<XConstraint> ref, XTerm y, XVar x) { -// if (ref instanceof XSubst_c) { -// XSubst_c s = (XSubst_c) ref; -// if (s.result == null) { -// if (s.y.equals(x)) { -// this.ref = s.ref; -// this.y = y; -// this.x = s.x; -// return; -// } -// if (s.x.equals(x)) { -// this.ref = s.ref; -// this.y = s.y; -// this.x = s.x; -// return; -// } -// } -// } - this.ref = ref; - this.y = y; - this.x = x; -// -// int i = 0; -// -// while (ref instanceof XSubst_c) { -// XSubst_c s = (XSubst_c) ref; -// ref = s.ref; -// i++; -// } -// -// if (i > 3) -// System.out.print(""); - } - - - @Override - public XConstraint compute() { - XRef<XConstraint> ref = this.ref; - XTerm y = this.y; - XVar x = this.x; - - assert ref != null; - assert y != null; - assert x != null; - - // avoid recursion by using a stack - ArrayList<XSubst> stack = new ArrayList<XSubst>(); - stack.add(this); - - while (ref instanceof XSubst) { - XSubst s = (XSubst) ref; - - if (s.result != null) - break; - - stack.add(s); - ref = s.ref; - -// if (stack.size() > 100) -// System.out.println("here" + (count++)); - } - - if (ref == null) - return null; - - XConstraint c = ref.get(); - - if (c == null) { - return null; - } - - boolean inconsistent = false; - - for (int i = stack.size()-1; i >= 0; i--) { - XSubst s = stack.get(i); - - try { - if (! inconsistent) { - c = c.substitute(s.y, s.x); - } - s.result = c; - s.ref = null; - s.y = null; - s.x = null; - } - catch (XFailure e) { - inconsistent = true; - XConstraint c2 = new XConstraint(); - c2.setInconsistent(); - c = c2; - } - } - - return c; - } -} Modified: trunk/x10.constraints/src/x10/constraint/XTerm.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerm.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XTerm.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -16,7 +16,8 @@ import java.util.Set; /** - * Constraints constrain XTerms. Thus XTerms are the basic building blocks of constraints + * Constraints constrain XTerms. Thus XTerms are the basic building blocks of constraints. + * This class is the root class of constraint terms. * * @author njnystrom * @author vj @@ -32,6 +33,13 @@ // The default is OBJECT. May be overridden by subclasses. public XTermKind kind() { return XTermKind.OBJECT;} + /** + * Return the result of substituting the term y for x in this. + * Should be overridden in subtypes. + * @param y + * @param x + * @return + */ public final XTerm subst(XTerm y, XVar x) { return subst(y, x, true); } Modified: trunk/x10.constraints/src/x10/constraint/XTerms.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-17 02:02:36 UTC (rev 16476) +++ trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-17 02:11:23 UTC (rev 16477) @@ -151,12 +151,12 @@ with function name op and arguments terms. Uses varargs. */ public static XTerm makeTerm(XName op, XTerm... terms) { - if (op.equals(plusName)) { + /*if (op.equals(plusName)) { return new XPlus(terms); } if (op.equals(minusName)) { return new XMinus(terms); - } + }*/ return makeAtom(op, false, Arrays.asList(terms)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-09-17 11:36:32
|
Revision: 16485 http://x10.svn.sourceforge.net/x10/?rev=16485&view=rev Author: vj0 Date: 2010-09-17 11:36:25 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Further clean up and refactoring of constraints. Improved documentation. Moved constraint projection into CConstraint, and described what it does. Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/constraints/CConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XLocal.java trunk/x10.constraints/src/x10/constraint/XName.java trunk/x10.constraints/src/x10/constraint/XNameWrapper.java trunk/x10.constraints/src/x10/constraint/XPromise.java trunk/x10.constraints/src/x10/constraint/XTerms.java Modified: trunk/x10.compiler/src/x10/types/X10Context_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10Context_c.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.compiler/src/x10/types/X10Context_c.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -88,7 +88,6 @@ import x10.constraint.XLocal; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XPromise; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -155,26 +154,16 @@ } - /* sigma(Gamma) restricted to the variables mentioned in c1,c2 */ - void addSigma(CConstraint r, CConstraint c, HashMap<XTerm, CConstraint> m) throws XFailure { - if (c != null && ! c.valid()) { - r.addIn(c); - r.addIn(constraintProjection(c, m, new HashSet<XTerm>())); - } - } - void addSigma(CConstraint r, XConstrainedTerm ct, HashMap<XTerm, CConstraint> m) throws XFailure { - if (ct != null) { - addSigma(r, ct.xconstraint(), m); - } - } - public CConstraint constraintProjection(CConstraint... cs) throws XFailure { + public CConstraint constraintProjection(CConstraint... cs) throws XFailure { HashMap<XTerm, CConstraint> m = new HashMap<XTerm, CConstraint>(); // add in the real clause of the type of any var mentioned in the constraint list cs CConstraint r = null; Set<XTerm> old = new HashSet<XTerm>(); for (CConstraint ci : cs) { - CConstraint ri = constraintProjection(ci, m, old); + if (ci == null) + continue; + CConstraint ri = ci.constraintProjection(m, old); if (r == null) r = ri; else @@ -185,11 +174,11 @@ r = new CConstraint(); // fold in the current constraint - addSigma(r, currentConstraint(), m); - addSigma(r, currentPlaceTerm, m); + r.addSigma(currentConstraint(), m); + r.addSigma(currentPlaceTerm, m); PlaceChecker.AddHereEqualsPlaceTerm(r, this); - addSigma(r, thisPlace, m); + r.addSigma(thisPlace, m); // fold in the real clause of the base type Type selfType = this.currentDepType(); @@ -203,132 +192,7 @@ return r; } - /* sigma(Gamma) restricted to the variables mentioned in c */ - private CConstraint constraintProjection(CConstraint c, Map<XTerm,CConstraint> m, Set<XTerm> old) throws XFailure { - CConstraint r = new CConstraint(); - if (c != null) - for (XTerm t : c.constraints()) { - CConstraint tc = constraintProjection(t, m, old); - if (tc != null) - r.addIn(tc); - } - return r; - } - boolean contains(Set<XTerm> s, CConstraint c) { - if (c==null || c.roots()==null) - return false; - Set<XTerm> s1 = c.roots().keySet(); - for (XTerm t: s1) { - if (s.contains(t)) - return true; - } - return false; - } - private CConstraint constraintProjection(XTerm t, Map<XTerm,CConstraint> m, Set<XTerm> ancestors) throws XFailure { - X10TypeSystem xts = (X10TypeSystem) this.ts; - - CConstraint r = m.get(t); - if (r != null) - return r; - - // pre-fill the cache to avoid infinite recursion - m.put(t, new CConstraint()); - - if (t instanceof XLocal) { - XLocal v = (XLocal) t; - X10LocalDef ld = getLocal(v); - if (ld != null) { - Type ty = Types.get(ld.type()); - ty = PlaceChecker.ReplaceHereByPlaceTerm(ty, ld.placeTerm()); - CConstraint ci = X10TypeMixin.realX(ty); - ci = ci.substitute(v, ci.self()); - r = new CConstraint(); - r.addIn(ci); - // Recursively perform a constraintProjection on the new constraint ci - // only if one of the ancestor terms does not occur in it. - if (! contains(ancestors, ci)) - r.addIn(constraintProjection(ci, m, ancestors)); - } - } - else if (t instanceof XLit) { - } - else if (t instanceof XField) { - XField f = (XField) t; - XTerm target = f.receiver(); - ancestors.add(target); - ancestors.add(t); - CConstraint rt = constraintProjection(target, m, ancestors); - - X10FieldDef fi = getField(f); - CConstraint ci = null; - - if (fi != null) { - Type ty = Types.get(fi.type()); - ci = X10TypeMixin.realX(ty); - ci = ci.substitute(f, ci.self()); - XVar v = ((X10ClassDef) Types.get(fi.container()).toClass().def()).thisVar(); - ci = ci.substitute(target, v); // xts.xtypeTranslator().transThisWithoutTypeConstraint()); - r = new CConstraint(); - r.addIn(ci); - // Recursively perform a constraintProjection on the new constraint ci - // only if one of the ancestor terms does not occur in it. - if ( ! contains(ancestors, ci)) - r.addIn(constraintProjection(ci, m, ancestors)); - if (rt != null) { - r.addIn(rt); - } - } - else { - r = rt; - } - } - else if (t instanceof XFormula) { - XFormula f = (XFormula) t; - for (XTerm a : f.arguments()) { - CConstraint ca = constraintProjection(a, m, ancestors); - ancestors.add(a); - if (ca != null) { - if (r == null) { - r = new CConstraint(); - } - r.addIn(ca); - } - } - } - else { - assert false : "unexpected " + t; - } - - if (r != null) - m.put(t, r); - else - m.put(t, new CConstraint()); - return r; - } - - private X10FieldDef getField(XField f) { - XName n = f.field(); - if (n instanceof XNameWrapper) { - XNameWrapper w = (XNameWrapper<?>) n; - if (w.val() instanceof X10FieldDef) { - return (X10FieldDef) w.val(); - } - } - return null; - } - - private X10LocalDef getLocal(XLocal f) { - XName n = f.name(); - if (n instanceof XNameWrapper) { - XNameWrapper w = (XNameWrapper<?>) n; - if (w.val() instanceof X10LocalDef) { - return (X10LocalDef) w.val(); - } - } - return null; - } - protected Ref<TypeConstraint> currentTypeConstraint; public TypeConstraint currentTypeConstraint() { if (currentTypeConstraint == null) Modified: trunk/x10.compiler/src/x10/types/constraints/CConstraint.java =================================================================== --- trunk/x10.compiler/src/x10/types/constraints/CConstraint.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.compiler/src/x10/types/constraints/CConstraint.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -16,6 +16,8 @@ import polyglot.ast.Field; import polyglot.types.FieldInstance; import polyglot.types.SemanticException; +import polyglot.types.Type; +import polyglot.types.Types; import x10.constraint.XConstraint; import x10.constraint.XFailure; @@ -24,8 +26,10 @@ import x10.constraint.XVar; import x10.types.X10Context; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import polyglot.ast.Field; import polyglot.types.FieldInstance; @@ -36,83 +40,92 @@ import x10.constraint.XDisEquals; import x10.constraint.XEquals; import x10.constraint.XFailure; +import x10.constraint.XField; import x10.constraint.XFormula; +import x10.constraint.XLit; +import x10.constraint.XLocal; import x10.constraint.XName; -import x10.constraint.XPromise; +import x10.constraint.XNameWrapper; import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; +import x10.types.X10ClassDef; import x10.types.X10Context; +import x10.types.X10FieldDef; +import x10.types.X10LocalDef; +import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.checker.PlaceChecker; /** - * The compiler's notion of a constraint keeps track of this and self variables. + * The compiler's notion of a constraint. * + * It keeps track of this and self variables. Further, the + * * @author vj * */ public class CConstraint extends XConstraint implements ThisVar { public static final String SELF_VAR_PREFIX="self"; - /** Variable to use for self in the constraint. */ - XVar self; + /** Variable to use for self in the constraint. */ + XVar self; - XVar thisVar; + XVar thisVar; /** * */ public CConstraint(XVar self) { - this.self = self; - } + this.self = self; + } public CConstraint() { - this(XTerms.makeUQV(SELF_VAR_PREFIX)); + this(XTerms.makeUQV(SELF_VAR_PREFIX)); } /** * Variable to use for self in the constraint. */ - public XVar self() { - return self; - } + public XVar self() { + return self; + } - public XVar selfVarBinding() { - return bindingForVar(self()); - } - public XVar thisVar() { - return thisVar; - } - public boolean hasPlaceTerm() { - if (roots==null) - return false; - for (XTerm t : roots.keySet()) { - if (PlaceChecker.isGlobalPlace(t)) - return true; - } - return false; - } - - /** - * Copy this constraint logically; that is, create a new constraint - * that contains the same equalities (if any) as the current one. - * vj: 08/12/09 - * Copying also the consistency, and validity status, and thisVar and self. - */ - public CConstraint copy() { - CConstraint c = new CConstraint(); - try { - c.thisVar = thisVar(); - c.self = self(); - return (CConstraint) copyInto(c); - } - catch (XFailure f) { - c.setInconsistent(); - return c; - } - } - + public XVar selfVarBinding() { + return bindingForVar(self()); + } + public XVar thisVar() { + return thisVar; + } + public boolean hasPlaceTerm() { + if (roots==null) + return false; + for (XTerm t : roots.keySet()) { + if (PlaceChecker.isGlobalPlace(t)) + return true; + } + return false; + } + /** + * Copy this constraint logically; that is, create a new constraint + * that contains the same equalities (if any) as the current one. + * vj: 08/12/09 + * Copying also the consistency, and validity status, and thisVar and self. + */ + public CConstraint copy() { + CConstraint c = new CConstraint(); + try { + c.thisVar = thisVar(); + c.self = self(); + return (CConstraint) copyInto(c); + } + catch (XFailure f) { + c.setInconsistent(); + return c; + } + } + + /** * Add constraint c into this, substituting this.self for c.self. Return this. * * Note: this is possibly side-effected by this operation. @@ -122,13 +135,13 @@ * @param c -- the constraint to be added in. * @return the possibly modified constraint */ - public CConstraint addIn(CConstraint c) throws XFailure { - return addIn(self(), c); - } - - /** - * Add constraint c into this, substituting newSelf for c.self. - * Return this. + public CConstraint addIn(CConstraint c) throws XFailure { + return addIn(self(), c); + } + + /** + * Add constraint c into this, substituting newSelf for c.self. + * Return this. * * Note: this is possibly side-effected by this operation. * @@ -136,87 +149,81 @@ * * @param c -- the constraint to be added in. * @return the possibly modified constraint - * - * */ - public CConstraint addIn(XTerm newSelf, CConstraint c) throws XFailure { - if (c != null) { - List<XTerm> result = c.constraints(); - if (result == null) - return this; - for (XTerm t : result) { - addTerm(t.subst(newSelf, c.self())); - } - } - // vj: What about thisVar for c? Should that be added? - // thisVar = getThisVar(this, c); - return this; - } + * + * */ + public CConstraint addIn(XTerm newSelf, CConstraint c) throws XFailure { + if (c != null) { + List<XTerm> result = c.constraints(); + if (result == null) + return this; + for (XTerm t : result) { + addTerm(t.subst(newSelf, c.self())); + } + } + // vj: What about thisVar for c? Should that be added? + // thisVar = getThisVar(this, c); + return this; + } - /** - * Return the result of copying this into c. Assume that c will be - * the depclause of the same base type as this, hence it is ok to - * copy self-clauses as is. - * @param c - * @return - */ - protected CConstraint copyInto(CConstraint c) throws XFailure { - c.addIn(this); - return c; - } - - public void addSelfBinding(XTerm var) throws XFailure { - addBinding(self(), var); - } - public void addSelfBinding(XConstrainedTerm var) throws XFailure { - addBinding(self(), var); - } + - public void addThisBinding(XTerm term) throws XFailure { - addBinding(thisVar(), term); - } - - public void setThisVar(XVar var) { - if (var == null) return; - thisVar = var; - } - - public void addBinding(XTerm s, XConstrainedTerm t) throws XFailure { - addBinding(s, t.term()); - addIn(s, t.constraint()); - - } - public void addBinding(XConstrainedTerm s, XTerm t) throws XFailure { - addBinding(t,s); - } - public void addBinding(XConstrainedTerm s, XConstrainedTerm t) throws XFailure { - addBinding(s.term(), t.term()); - addIn(s.term(), s.constraint()); - addIn(t.term(), t.constraint()); - } - public CConstraint substitute(XTerm y, XVar x) throws XFailure { - return substitute(new XTerm[] { y }, new XVar[] { x }); - } - public CConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { - return substitute(ys, xs); - } - /** + public void addSelfBinding(XTerm var) throws XFailure { + addBinding(self(), var); + } + public void addSelfBinding(XConstrainedTerm var) throws XFailure { + addBinding(self(), var); + } + + public void addThisBinding(XTerm term) throws XFailure { + addBinding(thisVar(), term); + } + + public void setThisVar(XVar var) { + if (var == null) return; + thisVar = var; + } + + public void addBinding(XTerm s, XConstrainedTerm t) throws XFailure { + addBinding(s, t.term()); + addIn(s, t.constraint()); + + } + public void addBinding(XConstrainedTerm s, XTerm t) throws XFailure { + addBinding(t,s); + } + public void addBinding(XConstrainedTerm s, XConstrainedTerm t) throws XFailure { + addBinding(s.term(), t.term()); + addIn(s.term(), s.constraint()); + addIn(t.term(), t.constraint()); + } + // Redeclare with the right return type + @Override + public CConstraint substitute(XTerm y, XVar x) throws XFailure { + return substitute(new XTerm[] { y }, new XVar[] { x }); + } + // Redeclare with the right return type + @Override + public CConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { + return substitute(ys, xs); + } + /** * Return a new constraint obtained from the current one by substituting * newSelf for this.self(). Note, the resulting constraint may be marked inconsistent. * FIXME: Yoav, this should also take a term to substitute for this, and return an XConstraint * @param newSelf * @return */ - public CConstraint instantiateSelf(XTerm newSelf) { - try { - return substitute(newSelf, self()); - } catch (XFailure z) { - CConstraint False = new CConstraint(); - False.setInconsistent(); - return False; - } - } + public CConstraint instantiateSelf(XTerm newSelf) { + try { + return substitute(newSelf, self()); + } catch (XFailure z) { + CConstraint False = new CConstraint(); + False.setInconsistent(); + return False; + } + } - public static XVar getThisVar(CConstraint t1, CConstraint t2) throws XFailure { + public static XVar getThisVar(CConstraint t1, CConstraint t2) throws XFailure { XVar thisVar = t1 == null ? null : t1.thisVar(); if (thisVar == null) return t2==null ? null : t2.thisVar(); @@ -225,11 +232,11 @@ + t2.thisVar()); return thisVar; } - public CConstraint substitute(XTerm[] ys, XVar[] xs) throws XFailure { - assert (ys != null && xs != null); - assert xs.length == ys.length; - - boolean eq = true; + public CConstraint substitute(XTerm[] ys, XVar[] xs) throws XFailure { + assert (ys != null && xs != null); + assert xs.length == ys.length; + + boolean eq = true; for (int i = 0; i < ys.length; i++) { XTerm y = ys[i]; XVar x = xs[i]; @@ -239,100 +246,70 @@ } if (eq) return this; - - if (! consistent) - return this; - - // Don't do the quick occurrence check; x might occur in a self constraint. - // XPromise last = lookupPartialOk(x); - // if (last == null) return this; // x does not occur in this - - CConstraint result = new CConstraint(); - - for (XTerm term : constraints()) { - XTerm t = term; - - // if term is y==x.f, the subst will produce y==y.f, which is a cycle--bad! - // if (term instanceof XEquals_c) { - // XEquals_c eq = (XEquals_c) term; - // XTerm l = eq.left(); - // XTerm r = eq.right(); - // if (y.equals(l) || y.equals(r)) - // continue; - // } - for (int i = 0; i < ys.length; i++) { - XTerm y = ys[i]; - XVar x = xs[i]; - t = t.subst(y, x, true); - } - - t = t.subst(result.self(), self(), true); - try { - result.addTerm(t); - } - catch (XFailure z) { - throw z; - } - } - // XConstraint_c result = clone(); - // result.valid = true; - // result.applySubstitution(y,x); - return result; - } - - /** If other is not inconsistent, and this is consistent, - * checks that each binding X=t in other also exists in this. - * @param other - * @return - */ - public boolean entails(CConstraint other, CConstraint sigma) throws XFailure { - if (!consistent()) - return true; - if (other == null || other.valid()) - return true; -// if (other.toString().equals(toString())) -// return true; - List<XTerm> otherConstraints = other.extConstraints(); - XVar otherSelf = other.self(); - return entails(otherConstraints, otherSelf, sigma); - } - - protected boolean entails(XTerm term, XVar self) throws XFailure { - XTerm subst = term.subst(self(), self); - return entails(subst); - } - + if (! consistent) + return this; - private boolean entails(List<XTerm> conjuncts, XVar self, final CConstraint sigma) throws XFailure { - - CConstraint me = copy(); - if (sigma != null) { - me.addIn(sigma); - } + // Don't do the quick occurrence check; x might occur in a self constraint. + // XPromise last = lookupPartialOk(x); + // if (last == null) return this; // x does not occur in this - if (! me.consistent()) { - return true; - } - - for (XTerm term : conjuncts) { - if (! me.entails(term, self)) - return false; - } - - return true; - } - - public XTerm bindingForSelfField(XName varName) { - if (!consistent || roots == null) - return null; - XPromise self = (XPromise) roots.get(self()); - if (self == null) - return null; - XPromise result = self.lookup(varName); - return result == null ? null : result.term(); - } - + CConstraint result = new CConstraint(); + + for (XTerm term : constraints()) { + XTerm t = term; + + // if term is y==x.f, the subst will produce y==y.f, which is a cycle--bad! + // if (term instanceof XEquals_c) { + // XEquals_c eq = (XEquals_c) term; + // XTerm l = eq.left(); + // XTerm r = eq.right(); + // if (y.equals(l) || y.equals(r)) + // continue; + // } + for (int i = 0; i < ys.length; i++) { + XTerm y = ys[i]; + XVar x = xs[i]; + t = t.subst(y, x, true); + } + + t = t.subst(result.self(), self(), true); + + try { + result.addTerm(t); + } + catch (XFailure z) { + throw z; + } + } + // XConstraint_c result = clone(); + // result.valid = true; + // result.applySubstitution(y,x); + return result; + } + + /** If other is not inconsistent, and this is consistent, + * checks that each binding X=t in other also exists in this. + * @param other + * @return + */ + public boolean entails(CConstraint other, CConstraint sigma) throws XFailure { + if (!consistent()) + return true; + if (other == null || other.valid()) + return true; + // if (other.toString().equals(toString())) + // return true; + List<XTerm> otherConstraints = other.extConstraints(); + XVar otherSelf = other.self(); + return entails(otherConstraints, otherSelf, sigma); + } + + + public XTerm bindingForSelfField(XName varName) { + return bindingForRootField(self(), varName); + } + /** * Return the term self.fieldName is bound to in the constraint, and null * if there is no such term. @@ -341,137 +318,351 @@ * @return * @throws XFailure */ - public XTerm bindingForSelfField(Field f) { + public XTerm bindingForSelfField(Field f) { assert f != null; return bindingForSelfField(XTerms.makeName(f.fieldInstance().def(), f.name().id().toString())); } - public XTerm bindingForSelfField(FieldInstance f) { + public XTerm bindingForSelfField(FieldInstance f) { assert f != null; return bindingForSelfField(XTerms.makeName(f.def(), f.name().toString())); } - /* Return the least upper bound of this and other. That is, the resulting constraint has precisely + /* Return the least upper bound of this and other. That is, the resulting constraint has precisely * the constraints entailed by both this and other. * @param other * @return */ - public CConstraint leastUpperBound(CConstraint c2) { - return leastUpperBound1((CConstraint) c2); - } - private CConstraint leastUpperBound1(CConstraint c2) { - CConstraint c1 = this; - CConstraint result = c1.leastUpperBound0(c2); - CConstraint c1a = null, c2a = null; - try { - XVar x = c1.selfVarBinding(); - if (x instanceof XVar) - c1a = c1.substitute(XTerms.makeEQV(), (XVar) x); - } catch (XFailure z) { - // should not happen. - } - try { - XVar x = c2.selfVarBinding(); - if (x instanceof XVar) - c2a = c2.substitute(XTerms.makeEQV(), (XVar) x); - } catch (XFailure z) { - // should not happen. - } - if (c1a != null) { - CConstraint d = c1a.leastUpperBound0(c2); - if (d.entails(result)) - result = d; - if (c2a != null) { - d = c1a.leastUpperBound0(c2a); - if (d.entails(result)) - result = d; - } - } - if (c2a != null) { - CConstraint d = c1.leastUpperBound0(c2a); - if (d.entails(result)) - result = d; - } - return result; - } - private CConstraint leastUpperBound0(CConstraint other) { - XVar otherSelf = other.self(); - - CConstraint result = new CConstraint(); - XVar resultSelf = result.self(); - for (XTerm term : other.constraints()) { - try { - if (entails(term, otherSelf)) { - term = term.subst(resultSelf, otherSelf); - result.addTerm(term); - } - } catch (XFailure z) { - - } - } - return result; - } - + public CConstraint leastUpperBound(CConstraint c2) { + return leastUpperBound1((CConstraint) c2); + } + /** * If y equals x, or x does not occur in this, return this, else copy * the constraint and return it after performing applySubstitution(y,x). * * */ - @Override - public CConstraint substitute(HashMap<XVar, XTerm> subs) throws XFailure { - CConstraint c = this; - for (Map.Entry<XVar,XTerm> e : subs.entrySet()) { - XVar x = e.getKey(); - XTerm y = e.getValue(); - c = c.substitute(y, x); - } - return c; - } + @Override + public CConstraint substitute(HashMap<XVar, XTerm> subs) throws XFailure { + CConstraint c = this; + for (Map.Entry<XVar,XTerm> e : subs.entrySet()) { + XVar x = e.getKey(); + XTerm y = e.getValue(); + c = c.substitute(y, x); + } + return c; + } + + /** + * Check that the given constraint is entailed, under the given substitution + * (ythis for xthis, and y for x). + * @param query + * @param ythis + * @param xthis + * @param y + * @param x + * @param context + * @throws SemanticException + */ - public void checkQuery(CConstraint query, XVar ythis, XVar xthis, XVar[] y, XVar[] x, - X10Context context) throws SemanticException { - // Check that the guard is entailed. - try { - if (query != null) { - if (! ((X10TypeSystem) context.typeSystem()).consistent(query)) { - throw new SemanticException("Guard " + query + " cannot be established; inconsistent in calling context."); - } - CConstraint query2 = xthis==null ? query : query.substitute(ythis, xthis); - query2.setThisVar(ythis); - // CConstraint query3 = query2.substitute(Y, X); - CConstraint query3 = query2; - CConstraint query4 = query3.substitute(y, x); + public void checkQuery(CConstraint query, XVar ythis, XVar xthis, XVar[] y, XVar[] x, + X10Context context) throws SemanticException { + // Check that the guard is entailed. + try { + if (query != null) { + if (! ((X10TypeSystem) context.typeSystem()).consistent(query)) { + throw new SemanticException("Guard " + query + " cannot be established; inconsistent in calling context."); + } + CConstraint query2 = xthis==null ? query : query.substitute(ythis, xthis); + query2.setThisVar(ythis); + // CConstraint query3 = query2.substitute(Y, X); + CConstraint query3 = query2; + CConstraint query4 = query3.substitute(y, x); - if (! entails(query4, context.constraintProjection(this, query4))) { - throw new SemanticException("Call invalid; calling environment does not entail the method guard."); - } - } - } - catch (XFailure f) { - // Substitution introduces inconsistency. - throw new SemanticException("Call invalid; calling environment is inconsistent."); - } - } - - /** + if (! entails(query4, context.constraintProjection(this, query4))) { + throw new SemanticException("Call invalid; calling environment does not entail the method guard."); + } + } + } + catch (XFailure f) { + // Substitution introduces inconsistency. + throw new SemanticException("Call invalid; calling environment is inconsistent."); + } + } + + /** * Return the constraint obtained by existentially quantifying out the variable v. * * @param v * @return */ - public CConstraint project(XVar v) { - if (! consistent) - return this; - CConstraint result = null; - try { - XVar eqv = XTerms.makeEQV(); - result = substitute(eqv, v); - } catch (XFailure c) { - // should not happen - } - return result; - } + public CConstraint project(XVar v) { + if (! consistent) + return this; + CConstraint result = null; + try { + XVar eqv = XTerms.makeEQV(); + result = substitute(eqv, v); + } catch (XFailure c) { + // should not happen + } + return result; + } + + /** + * Add in the constraint c, and all the constraints associated with the + * types of the terms referenced in t. + * @param c + * @param m + * @throws XFailure + */ + public void addSigma(CConstraint c, HashMap<XTerm, CConstraint> m) throws XFailure { + if (c != null && ! c.valid()) { + addIn(c); + addIn(c.constraintProjection(m, new HashSet<XTerm>())); + } + } + public void addSigma(XConstrainedTerm ct, HashMap<XTerm, CConstraint> m) throws XFailure { + if (ct != null) { + addSigma(ct.xconstraint(), m); + } + } + + /** + * Return the constraint r generated from this by adding all the constraints specified by + * the types of the terms occurring in this. This is done recursively. That is, for each + * constraint c added to r, we recursively add the constraints for the terms that occur in + * c. + * @param m + * @param old + * @return + * @throws XFailure -- if r becomes inconsistent. + */ + public CConstraint constraintProjection(Map<XTerm,CConstraint> m, Set<XTerm> old) throws XFailure { + CConstraint r = new CConstraint(); + + for (XTerm t : constraints()) { + CConstraint tc = constraintProjection(t, m, old); + if (tc != null) + r.addIn(tc); + } + return r; + } + + /** + * If the XField was created with an X10FieldDef, extract and return it. + * @param f + * @return + */ + public static X10FieldDef getField(XField f) { + XName n = f.field(); + if (n instanceof XNameWrapper) { + XNameWrapper<?> w = (XNameWrapper<?>) n; + if (w.val() instanceof X10FieldDef) { + return (X10FieldDef) w.val(); + } + } + return null; + } + + /** + * If the XLocal was created with an X10LocalDef, extract and return it. + * @param f + * @return + */ + public static X10LocalDef getLocal(XLocal f) { + XName n = f.name(); + if (n instanceof XNameWrapper) { + XNameWrapper<?> w = (XNameWrapper<?>) n; + if (w.val() instanceof X10LocalDef) { + return (X10LocalDef) w.val(); + } + } + return null; + } + + // ***************************************************************** Implementation + + protected boolean entails(XTerm term, XVar self) throws XFailure { + XTerm subst = term.subst(self(), self); + return entails(subst); + } + /** + * Return the result of copying this into c. Assume that c will be + * the depclause of the same base type as this, hence it is ok to + * copy self-clauses as is. + * @param c + * @return + */ + protected CConstraint copyInto(CConstraint c) throws XFailure { + c.addIn(this); + return c; + } + private static <T> boolean contains(Set<T> s, Set<T> c) { + for (T t: c) { + if (s.contains(t)) + return true; + } + return false; + } + private static CConstraint constraintProjection(XTerm t, Map<XTerm,CConstraint> m, + Set<XTerm> ancestors) throws XFailure { + + CConstraint r = m.get(t); + if (r != null) + return r; + + // pre-fill the cache to avoid infinite recursion + m.put(t, new CConstraint()); + + if (t instanceof XLocal) { + XLocal v = (XLocal) t; + X10LocalDef ld = getLocal(v); + if (ld != null) { + Type ty = Types.get(ld.type()); + ty = PlaceChecker.ReplaceHereByPlaceTerm(ty, ld.placeTerm()); + CConstraint ci = X10TypeMixin.realX(ty); + ci = ci.substitute(v, ci.self()); + r = new CConstraint(); + r.addIn(ci); + // Recursively perform a constraintProjection on the new constraint ci + // only if one of the ancestor terms does not occur in it. + if (! contains(ancestors, ci.terms())) + r.addIn(ci.constraintProjection(m, ancestors)); + } + } + else if (t instanceof XLit) { + } + else if (t instanceof XField) { + XField f = (XField) t; + XTerm target = f.receiver(); + ancestors.add(target); + ancestors.add(t); + CConstraint rt = constraintProjection(target, m, ancestors); + + X10FieldDef fi = getField(f); + CConstraint ci = null; + + if (fi != null) { + Type ty = Types.get(fi.type()); + ci = X10TypeMixin.realX(ty); + ci = ci.substitute(f, ci.self()); + XVar v = ((X10ClassDef) Types.get(fi.container()).toClass().def()).thisVar(); + ci = ci.substitute(target, v); // xts.xtypeTranslator().transThisWithoutTypeConstraint()); + r = new CConstraint(); + r.addIn(ci); + // Recursively perform a constraintProjection on the new constraint ci + // only if one of the ancestor terms does not occur in it. + if ( ! contains(ancestors, ci.terms())) + r.addIn(ci.constraintProjection(m, ancestors)); + if (rt != null) { + r.addIn(rt); + } + } + else { + r = rt; + } + } + else if (t instanceof XFormula) { + XFormula f = (XFormula) t; + for (XTerm a : f.arguments()) { + CConstraint ca = constraintProjection(a, m, ancestors); + if (m.get(a) != null) + m.put(a, new CConstraint()); + ancestors.add(a); + if (ca != null) { + if (r == null) { + r = new CConstraint(); + } + r.addIn(ca); + } + } + } + else { + assert false : "unexpected " + t; + } + + if (r != null) + m.put(t, r); + else + m.put(t, new CConstraint()); + return r; + } + private CConstraint leastUpperBound1(CConstraint c2) { + CConstraint c1 = this; + CConstraint result = c1.leastUpperBound0(c2); + CConstraint c1a = null, c2a = null; + try { + XVar x = c1.selfVarBinding(); + if (x instanceof XVar) + c1a = c1.substitute(XTerms.makeEQV(), (XVar) x); + } catch (XFailure z) { + // should not happen. + } + try { + XVar x = c2.selfVarBinding(); + if (x instanceof XVar) + c2a = c2.substitute(XTerms.makeEQV(), (XVar) x); + } catch (XFailure z) { + // should not happen. + } + if (c1a != null) { + CConstraint d = c1a.leastUpperBound0(c2); + if (d.entails(result)) + result = d; + if (c2a != null) { + d = c1a.leastUpperBound0(c2a); + if (d.entails(result)) + result = d; + } + } + if (c2a != null) { + CConstraint d = c1.leastUpperBound0(c2a); + if (d.entails(result)) + result = d; + } + return result; + } + private CConstraint leastUpperBound0(CConstraint other) { + XVar otherSelf = other.self(); + + CConstraint result = new CConstraint(); + XVar resultSelf = result.self(); + for (XTerm term : other.constraints()) { + try { + if (entails(term, otherSelf)) { + term = term.subst(resultSelf, otherSelf); + result.addTerm(term); + } + } catch (XFailure z) { + + } + } + return result; + } + + + + private boolean entails(List<XTerm> conjuncts, XVar self, final CConstraint sigma) throws XFailure { + + CConstraint me = copy(); + if (sigma != null) { + me.addIn(sigma); + } + + if (! me.consistent()) { + return true; + } + + for (XTerm term : conjuncts) { + if (! me.entails(term, self)) + return false; + } + + return true; + } + } Modified: trunk/x10.constraints/src/x10/constraint/XConstraint.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XConstraint.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -11,6 +11,7 @@ package x10.constraint; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.ArrayList; @@ -23,9 +24,10 @@ + /** * - * A constraint solver for the following constraint system: + * A constraint solver for the following constraint system. Note terms in this constraint system are untyped. * <verbatim> * t ::= x -- variable * | t.f -- field access @@ -37,19 +39,21 @@ * | p(t1,..., tn) -- atomic formula * </verbatim> * - * The constraint system implements the usual congruence rules for equality. + * The constraint system implements the usual congruence rules for equality. That is, if <code>s1,...,sn</code> and + * <code>t1,...,tn</code> are terms, and <code> s1 == t1,..., sn == tn</code>, then + * <code>g(s1,..., sn) == g(s1,...,sn)</code>, and + * <code>p(t1,..., tn) == p(t1,...,tn)</code>. Further, + * <uline> + * <li> <code>s equals t</code> implies <code>t equals s</code> + * <li> <code>s equals t</code> and <code>t equals u</code> implies <code> s equals u</code> + * <li> it is always the case that <code>s equals s</code> + * </uline> + * Terms are created using the static API in XTerms. The <code>==</code> relation on terms at the level of the + * constraint system is translated into the <code>equals</code> relation on the Java representation of the terms. * * <p>A constraint is implemented as a graph whose nodes are XPromises. Two different constraints will - * not share XPromises. - * <p> - * A promise contains fields: - * <olist> - * <li>XPromise value -- if non-null, points to a promise this one has been equated to - * <li>Collection<XPromise> disequals -- contains set of other nodes this has been disequated with - * <li>XTerm var -- externally visible term labeling this promise - * <li>Map<XName, XPromise> fields -- hashmap of fields of this promise. - * </olist> - * It maintains the invariant <tt> value != null implies (disequals==null && fields == null)</tt> + * not share @link{XPromise}. See the description of @link{XPromise} for more information about the + * internal representation of a constraint. * * <p>This representation is a bit different from the Nelson-Oppen and Shostak congruence closure * algorithms described, e.g. in Cyrluk, Lincoln and Shankar "On Shostak's Decision Procedure @@ -60,6 +64,12 @@ * Use Shostak's congruence procedure. Treat <tt>t.f</tt> as the term <tt>f(t)</tt>, * i.e. each field is regarded as a unary function symbol. This will be helpful in implementing * Nelson-Oppen integration of decision procedures. + * + * <p> Additional Notes. + * This constraint system and its implementation knows nothing about X10 or internal compiler structures. Specifically + * it knows nothing about X10 types. The package x10.types.constraints contains an extension of this type system that is aware + * of a this variable, a self variable and other compiler-related data-structures. + * * @author vj * */ @@ -91,6 +101,13 @@ } /** + * Return the set of terms occuring in this constraint. + * @return + */ + public Set<XTerm> terms() { + return roots == null ? Collections.<XTerm> emptySet() : roots.keySet(); + } + /** * Copy this constraint logically; that is, create a new constraint * that contains the same equalities (if any) as the current one. * Copy also the consistency, and validity status. @@ -143,6 +160,16 @@ } return null; } + + public XTerm bindingForRootField(XVar root, XName name) { + if (!consistent || roots == null) + return null; + XPromise self = (XPromise) roots.get(root); + if (self == null) + return null; + XPromise result = self.lookup(name); + return result == null ? null : result.term(); + } /** * Return the list of atoms (atomic formulas) in this constraint. @@ -587,7 +614,7 @@ public XConstraint substitute(XTerm y, XVar x) throws XFailure { return substitute(new XTerm[] { y }, new XVar[] { x }); } - XConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { + public XConstraint substitute(XTerm[] ys, XVar[] xs, boolean propagate) throws XFailure { return substitute(ys, xs); } @@ -680,13 +707,13 @@ else if (term instanceof XVar) { addBinding(term, XTerms.TRUE); } - else if (term instanceof XNot) { + /*else if (term instanceof XNot) { XNot t = (XNot) term; if (t.unaryArg() instanceof XVar) addBinding(t.unaryArg(), XTerms.FALSE); if (t.unaryArg() instanceof XNot) addTerm(((XNot) t.unaryArg()).unaryArg()); - } + }*/ else if (term instanceof XAnd) { XAnd t = (XAnd) term; addTerm(t.left()); Modified: trunk/x10.constraints/src/x10/constraint/XLocal.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XLocal.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XLocal.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -16,6 +16,7 @@ /** * The representation of a local variable reference in the constraint system. + * The name of the local variable is supplied by an XName. * * @author vj * @@ -32,7 +33,7 @@ } public List<XEQV> eqvs() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public XVar rootVar() { @@ -63,6 +64,7 @@ public String toString() { String s = name.toString(); + // This could should not belong here. if (s.startsWith("self")) return "self"; if (s.startsWith("this")) Modified: trunk/x10.constraints/src/x10/constraint/XName.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XName.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XName.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -11,6 +11,7 @@ package x10.constraint; -/** An application-specific name -- either a field name or a local variable name. */ +/** An application-specific name -- either a field name or a local variable name. + * */ public interface XName { } Modified: trunk/x10.constraints/src/x10/constraint/XNameWrapper.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XNameWrapper.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XNameWrapper.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -13,12 +13,17 @@ /** * A wrapper for a named entity of type T that holds the entity itself, - * and the name. The name can be explicitly supplied by the client, or - * obtained from the entity via <code>toString()</code>. Because - * <code>XName</code>'s are used by the constraint framework to identify - * entities, either instances of the type T must be canonicalized, or T - * must implement <code>equals()</code> properly. + * and the name. + * + * <p> The name can be explicitly supplied by the client. If it is not + * supplied, it is obtained from the entity via <code>toString()</code>. + * + * <p> Because <code>XName</code>'s are used by the constraint framework to identify + * entities, either instances of the type <code>T</code> must be canonicalized, or + * <code>T</code> must implement <code>equals()</code> properly. + * * @param <T> the type of entity being wrapped + * @author njnystrom */ public class XNameWrapper<T> implements XName { T v; Modified: trunk/x10.constraints/src/x10/constraint/XPromise.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XPromise.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XPromise.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -19,11 +19,33 @@ /** * All nodes that occur in the graph maintained by a constraint * must implement Promise. Thus a Promise is a pointer into the state of some specific constraint. + * <p> + * A promise contains fields: + * <ol> + * <li>XPromise value -- if non-null, points to a promise this one has been equated with. + * <li>Collection<XPromise> disequals -- contains set of other nodes this has been disequated with + * <li>XTerm var -- externally visible term labeling this promise + * <li>Map<XName, XPromise> fields -- hashmap of fields of this promise (if any). + * </ol> + * It maintains the invariant <code>> value != null</code> implies <code>disequals==null && fields == null</code>. + * That is, if <code>value !=null</code> (in this case we say the promise ie <em>bound</em>), all further + * information about this node in the graph is found by going to to <code>value</code>, except for the <code>XTerm</code> + * labeling this node (<code>var</code>). See <code>term()</code>. * + * <p>If <code>a.value==b</code> + * we sometimes say that <code>b</code> has an incoming "eq" link, and <code>a</code> has an outgoing "eq" link. + * + * <p> Constraint graphs may contain sequences of such bindings. These can be shortened without any + * semantic consequence. + * + * <p> Constraint graphs are always acyclic. + * + * <p> Note: This interface is not public only so that extensions of this constraint system may use it. + * This interface is <em>not</em> intended to be used by customers of the constraint system. * @author vj * */ -public interface XPromise extends Cloneable { +interface XPromise extends Cloneable { /** * this must be the promise corresponding to the index'th element in the list vars. @@ -61,6 +83,11 @@ */ XPromise lookup(XVar[] vars, int index); + /** + * Lookup the field named s on this promise. + * @param s + * @return + */ XPromise lookup(XName s) ; XPromise lookup(); Modified: trunk/x10.constraints/src/x10/constraint/XTerms.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-17 11:15:46 UTC (rev 16484) +++ trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-17 11:36:25 UTC (rev 16485) @@ -47,62 +47,132 @@ // used in generating a new name. static int nextId = 0; + /** + * Make a fresh name, guaranteed to be not equal to any + * other name. + * @return + */ public static final XName makeFreshName() { return makeFreshName("_"); } - + /** + * Make a fresh EQV with a system chosen name. + * @return + */ public static XEQV makeEQV() { return makeEQV(makeFreshName()); } + /** + * Make a fresh EQV whose name starts with prefix. + * @param prefix -- a prefix of the name for the returned EQV + * @return + */ + public static final XEQV makeEQV(String prefix) { + return new XEQV(makeFreshName(prefix), true); + } + /** + * Make a fresh UQV with a system chosen name. + * @return + */ public static XEQV makeUQV() { return makeUQV(makeFreshName()); } + + /** + * Make a fresh UQV whose name starts with prefix. + * @param prefix -- a prefix of the name for the returned UQV + * @return + */ + public static XEQV makeUQV(String prefix) { + return new XEQV(makeFreshName(prefix), false); + } + + /** + * Make a fresh local variable with a system chosen name. + * @return + */ + public static XLocal makeFreshLocal() { + return makeLocal(XTerms.makeFreshName()); + } + /** + * Make a fresh local variable whose name starts with prefix. + * @param prefix -- a prefix of the name for the returned XLocal + */ + public static XLocal makeFreshLocal(String prefix) { + return makeLocal(XTerms.makeFreshName(prefix)); + } + /** + * Make an EQV with the given name + * @return + */ public static XEQV makeEQV(XName name) { return new XEQV(name, true); } + /** + * Make a UQV with the given name + * @return + */ public static XEQV makeUQV(XName name) { return new XEQV(name, false); } - public static final XEQV makeEQV(String prefix) { - return new XEQV(makeFreshName(prefix), true); - } - public static final XEQV makeUQV(String prefix) { - return new XEQV(makeFreshName(prefix), false); - } - public static XEQV makeEQV(XName name, boolean hidden) { - return new XEQV(name, hidden); - } - - public static final XLocal makeFreshLocal() { - return makeLocal(XTerms.makeFreshName()); - } - public static final XLocal makeFreshLocal(String prefix) { - return makeLocal(XTerms.makeFreshName(prefix)); - } + + + /** + * Make a fresh name -- guaranteed to be not equal to + * any other name created before. + * @param prefix + * @return + */ public static final XName makeFreshName(String prefix) { return new XNameWrapper<Object>(new Object(), prefix + (nextId++)); } + /** + * Make an XName with the given object. The string for + * the XName will be taken to be name.toString(). + * @param <T> + * @param name -- must be non-null + * @return + */ public static final <T> XName makeName(T name) { return new XNameWrapper<T>(name); } + /** + * Make an XName with the given object and the given + * string. + * @param <T> + * @param name -- must be non-null + * @param s -- the string to be used to print this name + * @return + */ public static final <T> XName makeName(T name, String s) { return new XNameWrapper<T>(name, s); } + /** + * Make a local variable with the given name. Note this + * will be <code>equal</code> to another local variable + * if both have <code>equal</code> name's. + * @param name + * @return + */ public static final XLocal makeLocal(XName name) { return new XLocal(name); } - + /** + * Make and return <code>receiver.field</code>. + * @param receiver + * @param field + * @return + */ public static final XField makeField(XVar receiver, XName field) { return new XField(receiver, field); } - - /** Make and return a literal containing o. true and false are + /** Make and return a literal containing o. null, true and false are * interned. */ public static final XLit makeLit(Object o) { @@ -127,25 +197,8 @@ public static XTerm makeAtom(XName op, List<XTerm> terms) { return makeAtom(op, true, terms); } - /** - Make and return op(terms1,..., termsn) -- an expression - with operator op and arguments terms. If atomicFormula is true - then this is marked as an atomicFormula, else it is considered a term - (a function application term). - */ - public static XTerm makeAtom(XName op, boolean atomicFormula, List<XTerm> terms) { - assert op != null; - assert terms != null; - XFormula f = new XFormula(op, terms); - if (atomicFormula) { - f.markAsAtomicFormula(); - } - return f; - } - - /** Make and return op(terms1,..., termsn) -- a function application with function name op and arguments terms. Uses varargs. @@ -176,6 +229,12 @@ return new XEquals(left, right); } + /** + * Make and return left != right. + * @param left + * @param right + * @return + */ public static XTerm makeDisEquals(XTerm left, XTerm right) { assert left != null; assert right != null; @@ -199,13 +258,6 @@ return new XAnd(left, right); } - /** Make and return not (arg). arg should be a boolean term. (not - * checked.) - */ - public static XTerm makeNot(XTerm arg) { - assert arg != null; - return new XNot(arg); - } /** * Return the constraint true. * @return @@ -214,4 +266,27 @@ return new XConstraint(); } + //*************************************** Implementation + /** + Make and return op(terms1,..., termsn) -- an expression + with operator op and arguments terms. If atomicFormula is true + then this is marked as an atomicFormula, else it is considered a term + (a function application term). + */ + + static XTerm makeAtom(XName op, boolean atomicFormula, List<XTerm> terms) { + assert op != null; + assert terms != null; + XFormula f = new XFormula(op, terms); + if (atomicFormula) { + f.markAsAtomicFormula(); + } + return f; + } + static XEQV makeEQV(XName name, boolean hidden) { + return new XEQV(name, hidden); + } + + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mt...@us...> - 2010-09-18 07:11:23
|
Revision: 16549 http://x10.svn.sourceforge.net/x10/?rev=16549&view=rev Author: mtake Date: 2010-09-18 07:11:17 +0000 (Sat, 18 Sep 2010) Log Message: ----------- move typeName() from Ref to Types Modified Paths: -------------- trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.runtime/src-java/x10/core/Ref.java trunk/x10.runtime/src-java/x10/rtt/Types.java trunk/x10.runtime/src-x10/x10/lang/Any.x10 trunk/x10.runtime/src-x10/x10/lang/Object.x10 Modified: trunk/x10.compiler/src/x10/util/Struct.java =================================================================== --- trunk/x10.compiler/src/x10/util/Struct.java 2010-09-18 01:50:12 UTC (rev 16548) +++ trunk/x10.compiler/src/x10/util/Struct.java 2010-09-18 07:11:17 UTC (rev 16549) @@ -205,10 +205,10 @@ // 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.core.Ref.typeName(#0)") + //@Native("java", "x10.rtt.Types.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)"); + natives = createNative(nf, pos, "x10.rtt.Types.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); Modified: trunk/x10.runtime/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Ref.java 2010-09-18 01:50:12 UTC (rev 16548) +++ trunk/x10.runtime/src-java/x10/core/Ref.java 2010-09-18 07:11:17 UTC (rev 16549) @@ -13,32 +13,13 @@ import x10.rtt.RuntimeType; import x10.rtt.Type; -import x10.rtt.Types; // Base class of all X10 ref objects -- should be generated, but we need this class to get Box to compile. public class Ref implements Any { - public Ref() { - } + public Ref() {} - public boolean equals(Object o) { - return this == o; - } - - public static String typeName(Object obj) { - String s; - if (obj instanceof Any) { - s = ((Any) obj).getRTT().typeName(obj); - } else if (Types.getNativeRepRTT(obj) != null) { - s = Types.getNativeRepRTT(obj).typeName(); - } else { - // Note: for java classes that don't have RTTs - s = obj.getClass().toString().substring("class ".length()); - } - return s; - } - public static RuntimeType<Ref> _RTT = new RuntimeType<Ref>(Ref.class); public RuntimeType<?> getRTT() {return _RTT;} public Type<?> getParam(int i) {return null;} Modified: trunk/x10.runtime/src-java/x10/rtt/Types.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-09-18 01:50:12 UTC (rev 16548) +++ trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-09-18 07:11:17 UTC (rev 16549) @@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import x10.core.Any; import x10.core.fun.Fun_0_1; @@ -39,6 +40,19 @@ public static <T> T javacast(Object o) { return (T) o; } + + public static String typeName(Object obj) { + String s; + if (obj instanceof Any) { + s = ((Any) obj).getRTT().typeName(obj); + } else if (Types.getNativeRepRTT(obj) != null) { + s = Types.getNativeRepRTT(obj).typeName(); + } else { + // Note: for java classes that don't have RTTs + s = obj.getClass().toString().substring("class ".length()); + } + return s; + } public static Type runtimeType(Class<?> c) { return new RuntimeType<Class<?>>(c); Modified: trunk/x10.runtime/src-x10/x10/lang/Any.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Any.x10 2010-09-18 01:50:12 UTC (rev 16548) +++ trunk/x10.runtime/src-x10/x10/lang/Any.x10 2010-09-18 07:11:17 UTC (rev 16549) @@ -49,7 +49,7 @@ * * @return a string representation of the run-time type of this entity. */ - @Native("java", "x10.core.Ref.typeName(#0)") + @Native("java", "x10.rtt.Types.typeName(#0)") @Native("c++", "x10aux::type_name(#0)") safe def typeName():String; Modified: trunk/x10.runtime/src-x10/x10/lang/Object.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Object.x10 2010-09-18 01:50:12 UTC (rev 16548) +++ trunk/x10.runtime/src-x10/x10/lang/Object.x10 2010-09-18 07:11:17 UTC (rev 16549) @@ -84,7 +84,7 @@ * * @return a string representation of the run-time type of this object. */ - @Native("java", "x10.core.Ref.typeName(#0)") + @Native("java", "x10.rtt.Types.typeName(#0)") @Native("c++", "x10aux::type_name(#0)") public safe native final def typeName():String; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-09-18 09:59:32
|
Revision: 16552 http://x10.svn.sourceforge.net/x10/?rev=16552&view=rev Author: vj0 Date: 2010-09-18 09:59:26 +0000 (Sat, 18 Sep 2010) Log Message: ----------- Support the assignment of expressions built from properties (with nested boolean operations) to variables. Fixes bugs in Synthesizer -- in generating an AST from a constraint. Modified Paths: -------------- trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.constraints/src/x10/constraint/XAnd.java trunk/x10.constraints/src/x10/constraint/XDisEquals.java trunk/x10.constraints/src/x10/constraint/XEquals.java trunk/x10.constraints/src/x10/constraint/XFormula.java trunk/x10.constraints/src/x10/constraint/XNot.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerms.java trunk/x10.runtime/src-x10/x10/array/Array.x10 Modified: trunk/x10.compiler/src/x10/util/Synthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -1525,14 +1525,27 @@ for (XTerm a : t.arguments()) { args.add(makeExpr(a, pos)); } - Name n = Name.make(t.operator().toString()); + String op = t.asExprOperator().toString(); + if (op.equals(XTerms.asExprAndName.toString())) { + return xnf.Binary(pos, args.get(0), Binary.COND_AND, args.get(1)); + } + if (op.equals(XTerms.asExprEqualsName.toString())) { + return xnf.Binary(pos, args.get(0), Binary.EQ, args.get(1)); + } + if (op.equals(XTerms.asExprDisEqualsName.toString())) { + return xnf.Binary(pos, args.get(0), Binary.NE, args.get(1)); + } + if (op.equals(XTerms.asExprNotName.toString())) { + return xnf.Unary(pos, Unary.NOT, args.get(0)); + } + // FIXME: [IP] Hack to handle the "at" atom added by XTypeTranslator for structs - if (n.toString().equals("at")) { - Receiver r = args.remove(0); - return xnf.Call(pos, r, xnf.Id(pos, n), args); - } else { - return xnf.Call(pos, xnf.Id(pos, n), args); - } + //if (n.toString().equals("at")) { + // Receiver r = args.remove(0); + // return xnf.Call(pos, r, xnf.Id(pos, n), args); + //} else { + return xnf.Call(pos, xnf.Id(pos, Name.make(op)), args); + //} } Modified: trunk/x10.constraints/src/x10/constraint/XAnd.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XAnd.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XAnd.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -21,7 +21,7 @@ public class XAnd extends XFormula { public XAnd(XTerm left, XTerm right) { - super(XTerms.andName, left, right); + super(XTerms.andName, XTerms.asExprAndName, left, right); } public XPromise internIntoConstraint(XConstraint c, XPromise last) throws XFailure { Modified: trunk/x10.constraints/src/x10/constraint/XDisEquals.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XDisEquals.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XDisEquals.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -22,7 +22,7 @@ public XDisEquals(XTerm left, XTerm right) { - super(XTerms.disEqualsName, left, right); + super(XTerms.disEqualsName, XTerms.asExprDisEqualsName, left, right); } public XPromise internIntoConstraint(XConstraint c, XPromise last) throws XFailure { // XTerm left = left(); Modified: trunk/x10.constraints/src/x10/constraint/XEquals.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XEquals.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XEquals.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -18,7 +18,7 @@ public class XEquals extends XFormula { public XEquals(XTerm left, XTerm right) { - super(XTerms.equalsName, left, right); + super(XTerms.equalsName, XTerms.asExprEqualsName, left, right); } public XPromise internIntoConstraint(XConstraint c, XPromise last) throws XFailure { Modified: trunk/x10.constraints/src/x10/constraint/XFormula.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XFormula.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XFormula.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -21,8 +21,10 @@ * @author vijay * */ +@SuppressWarnings("serial") public class XFormula extends XTerm { - public XName op; + public final XName op; + public final XName asExprOp; public List<XTerm> arguments; /** @@ -30,12 +32,15 @@ * @param op * @param args */ - public XFormula(XName op, List<XTerm> args) { - this.op = op; + public XFormula(XName op, XName opAsExpr, List<XTerm> args) { + + this.op = op; + this.asExprOp = opAsExpr; this.arguments = args; } - public XFormula(XName op, XTerm... args) { + public XFormula(XName op, XName opAsExpr, XTerm... args) { this.op = op; + this.asExprOp = opAsExpr; this.arguments = new ArrayList<XTerm>(args.length); for (XTerm arg : args) { this.arguments.add(arg); @@ -73,6 +78,10 @@ public XName operator() { return op; } + + public XName asExprOperator() { + return asExprOp; + } public boolean isUnary() { return arguments.size() == 1; Modified: trunk/x10.constraints/src/x10/constraint/XNot.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XNot.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XNot.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -20,7 +20,7 @@ public class XNot extends XFormula { public XNot(XTerm arg) { - super(XTerms.notName, arg); + super(XTerms.notName, XTerms.asExprNotName, arg); } public XPromise internIntoConstraint(XConstraint c, XPromise last) throws XFailure { Modified: trunk/x10.constraints/src/x10/constraint/XTerm.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerm.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XTerm.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -22,7 +22,7 @@ * @author vj * */ -public abstract class XTerm implements Serializable, Cloneable { +public abstract class XTerm implements Serializable, Cloneable { public XTerm() { Modified: trunk/x10.constraints/src/x10/constraint/XTerms.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.constraints/src/x10/constraint/XTerms.java 2010-09-18 09:59:26 UTC (rev 16552) @@ -33,15 +33,16 @@ public String toString() { return "o"; } }; - static final XName equalsName = new XNameWrapper<String>("==="); - static final XName disEqualsName = new XNameWrapper<String>("!=="); - static final XName andName = new XNameWrapper<String>("&&&"); - static final XName notName = new XNameWrapper<String>("!!!"); - static final XName arrayAccessName = new XNameWrapper<String>("(.)"); - static final XName plusName = new XNameWrapper<String>("+"); - static final XName minusName = new XNameWrapper<String>("-"); - static final XName modName = new XNameWrapper<String>("%"); + public static final XName equalsName = new XNameWrapper<String>("==="); + public static final XName disEqualsName = new XNameWrapper<String>("!=="); + public static final XName andName = new XNameWrapper<String>("&&&"); + public static final XName notName = new XNameWrapper<String>("!!!"); + public static final XName asExprEqualsName = new XNameWrapper<String>("=="); + public static final XName asExprDisEqualsName = new XNameWrapper<String>("!="); + public static final XName asExprAndName = new XNameWrapper<String>("&&"); + public static final XName asExprNotName = new XNameWrapper<String>("!"); + // used in generating a new name. static int nextId = 0; @@ -275,7 +276,7 @@ static XTerm makeAtom(XName op, boolean atomicFormula, List<XTerm> terms) { assert op != null; assert terms != null; - XFormula f = new XFormula(op, terms); + XFormula f = new XFormula(op, op, terms); if (atomicFormula) { f.markAsAtomicFormula(); } Modified: trunk/x10.runtime/src-x10/x10/array/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-09-18 09:56:19 UTC (rev 16551) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-09-18 09:59:26 UTC (rev 16552) @@ -98,7 +98,7 @@ * the static type of the Array by adding a constraint. However, I can't figure out * how to express this in a way that is (a) correct and (b) supported by the constraint system. */ - private val cachedRail:boolean/*FIXME: not supported by constraint system {self==this.rail}*/; + private val cachedRail:boolean(rail); private transient val raw:IndexedMemoryChunk[T]; @@ -142,7 +142,7 @@ val n = layout.size(); raw = IndexedMemoryChunk.allocate[T](n, true); rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } @@ -164,7 +164,7 @@ } raw = r; rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } @@ -194,7 +194,7 @@ } raw = r; rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } @@ -235,7 +235,7 @@ val n = layout.size(); raw = IndexedMemoryChunk.allocate[T](n, true); rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } @@ -257,7 +257,7 @@ } raw = r; rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } @@ -279,7 +279,7 @@ } raw = r; rawLength = n; - cachedRail = region.rail; + cachedRail = rail; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |