From: <dgr...@us...> - 2008-10-30 19:56:41
|
Revision: 6585 http://x10.svn.sourceforge.net/x10/?rev=6585&view=rev Author: dgrove-oss Date: 2008-10-30 19:56:29 +0000 (Thu, 30 Oct 2008) Log Message: ----------- delete .cvsignore files; not used by svn Removed Paths: ------------- trunk/x10.common.17/.cvsignore trunk/x10.compiler.p3/.cvsignore trunk/x10.compiler.p3/data/.cvsignore trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/.cvsignore trunk/x10.compiler.p3/src/polyglot/ext/x10/types/.cvsignore trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/.cvsignore trunk/x10.compiler.p3/src/x10/parser/.cvsignore trunk/x10.constraints/.cvsignore trunk/x10.dist/.cvsignore trunk/x10.dist/bin/.cvsignore trunk/x10.dist/doc/.cvsignore trunk/x10.dist/etc/.cvsignore trunk/x10.dist/lib/.cvsignore trunk/x10.man/.cvsignore trunk/x10.man/popl09/.cvsignore trunk/x10.man/psu/.cvsignore trunk/x10.man/r4rs/.cvsignore trunk/x10.man/v0.4/.cvsignore trunk/x10.runtime.17/.cvsignore trunk/x10.runtime.17/new/.cvsignore trunk/x10.runtime.17/new/x10/.cvsignore trunk/x10.runtime.17/new/x10/array/.cvsignore trunk/x10.runtime.17/new/x10/lang/.cvsignore trunk/x10.tests/.cvsignore trunk/x10.tests/bin/.cvsignore trunk/x10.tests/examples/.cvsignore trunk/x10.tests/examples/Applications/.cvsignore trunk/x10.tests/examples/Applications/NPB3_0/.cvsignore trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/.cvsignore trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/BMInOut/.cvsignore trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/CGThreads/.cvsignore trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/MGThreads/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/crypt/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/crypt/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/lufact/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/lufact/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/lufact/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/moldyn/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/moldyn/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/moldyn/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/Data/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/montecarlo/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/Data/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/montecarlo/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/Data/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/montecarlo/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/raytracer/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/raytracer/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/raytracer/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/series/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/series/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/series/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/jgfutil/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/sor/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/sparsematmult/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/sparsematmult/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/.cvsignore trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/sparsematmult/.cvsignore trunk/x10.tests/examples/Applications/OtherApps/.cvsignore trunk/x10.tests/examples/Applications/sparsematmult/.cvsignore trunk/x10.tests/examples/Constructs/.cvsignore trunk/x10.tests/examples/Constructs/Annotations/.cvsignore trunk/x10.tests/examples/Constructs/Annotations/bits/.cvsignore trunk/x10.tests/examples/Constructs/Annotations/dims/.cvsignore trunk/x10.tests/examples/Constructs/Array/.cvsignore trunk/x10.tests/examples/Constructs/Async/.cvsignore trunk/x10.tests/examples/Constructs/AtEach/.cvsignore trunk/x10.tests/examples/Constructs/Atomic/.cvsignore trunk/x10.tests/examples/Constructs/Await/.cvsignore trunk/x10.tests/examples/Constructs/Boxing/.cvsignore trunk/x10.tests/examples/Constructs/Call/.cvsignore trunk/x10.tests/examples/Constructs/Cast/.cvsignore trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/.cvsignore trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/.cvsignore trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/.cvsignore trunk/x10.tests/examples/Constructs/Clock/.cvsignore trunk/x10.tests/examples/Constructs/Closures/.cvsignore trunk/x10.tests/examples/Constructs/Constructor/.cvsignore trunk/x10.tests/examples/Constructs/DepType/.cvsignore trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/.cvsignore trunk/x10.tests/examples/Constructs/Distribution/.cvsignore trunk/x10.tests/examples/Constructs/Exceptions/.cvsignore trunk/x10.tests/examples/Constructs/Extern/.cvsignore trunk/x10.tests/examples/Constructs/Final/.cvsignore trunk/x10.tests/examples/Constructs/Finish/.cvsignore trunk/x10.tests/examples/Constructs/For/.cvsignore trunk/x10.tests/examples/Constructs/ForEach/.cvsignore trunk/x10.tests/examples/Constructs/Future/.cvsignore trunk/x10.tests/examples/Constructs/Generics/.cvsignore trunk/x10.tests/examples/Constructs/Import/.cvsignore trunk/x10.tests/examples/Constructs/Import/ImportTestPackage1/.cvsignore trunk/x10.tests/examples/Constructs/Import/ImportTestPackage1/SubPackage/.cvsignore trunk/x10.tests/examples/Constructs/Import/ImportTestPackage2/.cvsignore trunk/x10.tests/examples/Constructs/Import/testPackage/.cvsignore trunk/x10.tests/examples/Constructs/Inference/.cvsignore trunk/x10.tests/examples/Constructs/Init/.cvsignore trunk/x10.tests/examples/Constructs/Instanceof/.cvsignore trunk/x10.tests/examples/Constructs/Lit/.cvsignore trunk/x10.tests/examples/Constructs/MethodDecl/.cvsignore trunk/x10.tests/examples/Constructs/Modifiers/.cvsignore trunk/x10.tests/examples/Constructs/NoStaticMutable/.cvsignore trunk/x10.tests/examples/Constructs/Nullable/.cvsignore trunk/x10.tests/examples/Constructs/PlaceCast/.cvsignore trunk/x10.tests/examples/Constructs/Point/.cvsignore trunk/x10.tests/examples/Constructs/Region/.cvsignore trunk/x10.tests/examples/Constructs/StorageClass/.cvsignore trunk/x10.tests/examples/Constructs/Typedefs/.cvsignore trunk/x10.tests/examples/Constructs/Types/.cvsignore trunk/x10.tests/examples/Constructs/Unsafe/.cvsignore trunk/x10.tests/examples/Constructs/Value/.cvsignore trunk/x10.tests/examples/Data/.cvsignore trunk/x10.tests/examples/Issues/.cvsignore trunk/x10.tests/examples/Misc/.cvsignore trunk/x10.tests/examples/Timings/.cvsignore trunk/x10.tests/examples/harness/.cvsignore trunk/x10.tests/examples/x10lib/.cvsignore trunk/x10.tests/examples/x10lib/harness/.cvsignore trunk/x10.tests/examples/x10lib/jgfutil/.cvsignore trunk/x10.tests/examples/x10lib/jgfutil/jgfutil/.cvsignore trunk/x10.tests/examples/x10lib/testPackage/.cvsignore trunk/x10.tests/lib/.cvsignore Deleted: trunk/x10.common.17/.cvsignore =================================================================== --- trunk/x10.common.17/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.common.17/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -classes Deleted: trunk/x10.compiler.p3/.cvsignore =================================================================== --- trunk/x10.compiler.p3/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -classes Deleted: trunk/x10.compiler.p3/data/.cvsignore =================================================================== --- trunk/x10.compiler.p3/data/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/data/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -double_array3d_dist_op.xcd -double_array3d_initializer.xcd -double_array3d_local.xcd Deleted: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/.cvsignore =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -*.local Deleted: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/.cvsignore =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -*.aside Deleted: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/.cvsignore =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,2 +0,0 @@ -*.vj -*.tar Deleted: trunk/x10.compiler.p3/src/x10/parser/.cvsignore =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.compiler.p3/src/x10/parser/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -*.l Deleted: trunk/x10.constraints/.cvsignore =================================================================== --- trunk/x10.constraints/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.constraints/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -classes Deleted: trunk/x10.dist/bin/.cvsignore =================================================================== --- trunk/x10.dist/bin/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.dist/bin/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -x10 -x10c -setupX10 Deleted: trunk/x10.dist/etc/.cvsignore =================================================================== --- trunk/x10.dist/etc/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.dist/etc/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -standard.cfg Deleted: trunk/x10.dist/lib/.cvsignore =================================================================== --- trunk/x10.dist/lib/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.dist/lib/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,5 +0,0 @@ -lpg.jar -polyglot3.jar -x10.jar -x10c.jar -x10constraints.jar Deleted: trunk/x10.man/.cvsignore =================================================================== --- trunk/x10.man/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.man/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,10 +0,0 @@ -*.aux -*.bbl -*.blg -*.dvi -*.idx -*.ilg -*.log -*.pdf -*.ps -*.toc Deleted: trunk/x10.man/popl09/.cvsignore =================================================================== --- trunk/x10.man/popl09/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.man/popl09/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -*.aux -*.bbl -*.blg Deleted: trunk/x10.man/psu/.cvsignore =================================================================== --- trunk/x10.man/psu/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.man/psu/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,10 +0,0 @@ -*.aux -*.bbl -*.blg -*.dvi -*.idx -*.ilg -*.log -*.pdf -*.ps -*.toc Deleted: trunk/x10.man/r4rs/.cvsignore =================================================================== --- trunk/x10.man/r4rs/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.man/r4rs/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,10 +0,0 @@ -*.aux -*.bbl -*.blg -*.dvi -*.idx -*.ilg -*.log -*.pdf -*.ps -*.toc Deleted: trunk/x10.man/v0.4/.cvsignore =================================================================== --- trunk/x10.man/v0.4/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.man/v0.4/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,10 +0,0 @@ -*.aux -*.bbl -*.blg -*.dvi -*.idx -*.ilg -*.log -*.pdf -*.ps -*.toc Deleted: trunk/x10.runtime.17/.cvsignore =================================================================== --- trunk/x10.runtime.17/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.runtime.17/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -classes -makefile - Deleted: trunk/x10.runtime.17/new/.cvsignore =================================================================== --- trunk/x10.runtime.17/new/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.runtime.17/new/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -makefile Deleted: trunk/x10.runtime.17/new/x10/.cvsignore =================================================================== --- trunk/x10.runtime.17/new/x10/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.runtime.17/new/x10/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,2 +0,0 @@ -makefile -g Deleted: trunk/x10.runtime.17/new/x10/array/.cvsignore =================================================================== --- trunk/x10.runtime.17/new/x10/array/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.runtime.17/new/x10/array/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1 +0,0 @@ -makefile Deleted: trunk/x10.runtime.17/new/x10/lang/.cvsignore =================================================================== --- trunk/x10.runtime.17/new/x10/lang/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.runtime.17/new/x10/lang/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -*.swp -x10 -makefile Deleted: trunk/x10.tests/.cvsignore =================================================================== --- trunk/x10.tests/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,3 +0,0 @@ -classes -makefile - Deleted: trunk/x10.tests/examples/.cvsignore =================================================================== --- trunk/x10.tests/examples/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,12 +0,0 @@ -log* -ErrorsLog -*_x10stub.c -*.class -*.java -TMP_XXX_* -*.swp -.*.swp -*.swo -.*.swo -x10 -makefile Deleted: trunk/x10.tests/examples/Applications/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NPB3_0/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NPB3_0/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NPB3_0/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/BMInOut/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/BMInOut/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/BMInOut/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/CGThreads/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/CGThreads/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/CGThreads/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/MGThreads/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/MGThreads/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NPB3_0/NPB3_0_X10/MGThreads/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/crypt/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/crypt/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/distributed/crypt/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/crypt/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/crypt/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/serial/crypt/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/lufact/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/lufact/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/distributed/lufact/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/lufact/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/lufact/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/parallel/lufact/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/lufact/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/lufact/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/lufact/serial/lufact/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/moldyn/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/moldyn/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/distributed/moldyn/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/moldyn/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/moldyn/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/parallel/moldyn/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/moldyn/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/moldyn/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/moldyn/serial/moldyn/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/Data/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/Data/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/Data/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/montecarlo/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/montecarlo/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/distributed/montecarlo/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/Data/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/Data/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/Data/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/montecarlo/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/montecarlo/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/parallel/montecarlo/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/Data/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/Data/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/Data/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/montecarlo/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/montecarlo/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/montecarlo/serial/montecarlo/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/raytracer/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/raytracer/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/distributed/raytracer/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/raytracer/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/raytracer/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/parallel/raytracer/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/raytracer/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/raytracer/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/raytracer/serial/raytracer/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/series/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/series/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/distributed/series/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/series/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/series/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/parallel/series/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/series/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/series/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/series/serial/series/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/jgfutil/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/jgfutil/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/jgfutil/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/sor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/sor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/sor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/sparsematmult/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/sparsematmult/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/distributed/sparsematmult/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/sparsematmult/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/sparsematmult/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/parallel/sparsematmult/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/sparsematmult/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/sparsematmult/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/NewJavaGrande/sparsematmult/serial/sparsematmult/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/OtherApps/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/OtherApps/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/OtherApps/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Applications/sparsematmult/.cvsignore =================================================================== --- trunk/x10.tests/examples/Applications/sparsematmult/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Applications/sparsematmult/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,9 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo -makefile Deleted: trunk/x10.tests/examples/Constructs/Annotations/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Annotations/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Annotations/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Annotations/bits/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Annotations/bits/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Annotations/bits/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Annotations/dims/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Annotations/dims/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Annotations/dims/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Array/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Array/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Array/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,9 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo -makefile Deleted: trunk/x10.tests/examples/Constructs/Async/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Async/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Async/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/AtEach/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/AtEach/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/AtEach/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Atomic/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Atomic/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Atomic/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Await/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Await/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Await/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Boxing/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Boxing/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Boxing/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Call/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Call/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Call/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Cast/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Cast/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Cast/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Cast/ArrayDependentTypeCast/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Cast/PrimitiveDependentTypeCast/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Clock/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Clock/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Clock/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Closures/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Closures/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Closures/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,14 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -*.swp -.*.swp -*.swo -.*.swo -makefile -junk -*.txt -classes - Deleted: trunk/x10.tests/examples/Constructs/Constructor/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Constructor/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Constructor/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/DepType/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/DepType/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/DepType/TypeElaboration/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Distribution/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Distribution/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Distribution/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,9 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo -makefile Deleted: trunk/x10.tests/examples/Constructs/Exceptions/.cvsignore =================================================================== --- trunk/x10.tests/examples/Constructs/Exceptions/.cvsignore 2008-10-30 19:48:04 UTC (rev 6584) +++ trunk/x10.tests/examples/Constructs/Exceptions/.cvsignore 2008-10-30 19:56:29 UTC (rev 6585) @@ -1,8 +0,0 @@ -*.java -*.class -harness -x10 -*.swp -.*.swp -*.swo -.*.swo Deleted: trunk/x10.tests/examples/Constructs/Extern/.cvsignore ============================================================... [truncated message content] |
From: <dgr...@us...> - 2008-10-31 20:54:55
|
Revision: 6590 http://x10.svn.sourceforge.net/x10/?rev=6590&view=rev Author: dgrove-oss Date: 2008-10-31 20:54:49 +0000 (Fri, 31 Oct 2008) Log Message: ----------- Rename the java package x10.runtime to x10.runtime.impl.java This clears the x10.runtime package for use by x10 classes in XRX. Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.compiler.p3/data/await.xcd trunk/x10.compiler.p3/data/when.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.dist/.launchConfigs/x10.launch trunk/x10.dist/bin/x10.in trunk/x10.runtime.17/META-INF/MANIFEST.MF trunk/x10.runtime.17/src-java/x10/core/Ref.java trunk/x10.runtime.17/src-java/x10/runtime/abstractmetrics/AbstractMetricsFactory.java trunk/x10.runtime.17/src-java/x10/types/RuntimeType.java trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 trunk/x10.runtime.17/src-x10/x10/lang/HashMap.x10 trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 trunk/x10.runtime.17/src-x10/x10/lang/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/lang/Stack.x10 Added Paths: ----------- trunk/x10.runtime.17/src-java/x10/runtime/impl/ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Configuration.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/JavaRuntime.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeHashMap.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeStack.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/PreLoader.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Report.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Usage.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/VMInterface.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadFactory.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadPoolExecutor.java Removed Paths: ------------- trunk/x10.runtime.17/src-java/x10/runtime/Configuration.java trunk/x10.runtime.17/src-java/x10/runtime/JavaRuntime.java trunk/x10.runtime.17/src-java/x10/runtime/NativeHashMap.java trunk/x10.runtime.17/src-java/x10/runtime/NativeStack.java trunk/x10.runtime.17/src-java/x10/runtime/PreLoader.java trunk/x10.runtime.17/src-java/x10/runtime/Report.java trunk/x10.runtime.17/src-java/x10/runtime/Runtime.java trunk/x10.runtime.17/src-java/x10/runtime/Usage.java trunk/x10.runtime.17/src-java/x10/runtime/VMInterface.java trunk/x10.runtime.17/src-java/x10/runtime/X10Thread.java trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadFactory.java trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadPoolExecutor.java Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-10-31 20:54:49 UTC (rev 6590) @@ -33,5 +33,5 @@ } // How to invoke? Use the following general command: -// java $(javaArgs) x10.runtime.Runtime $(x10Args) ClassName $(x10AppArgs) +// java $(javaArgs) x10.runtime.impl.java.Runtime $(x10Args) ClassName $(x10AppArgs) Modified: trunk/x10.compiler.p3/data/await.xcd =================================================================== --- trunk/x10.compiler.p3/data/await.xcd 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.compiler.p3/data/await.xcd 2008-10-31 20:54:49 UTC (rev 6590) @@ -10,7 +10,7 @@ } } catch (java.lang.Throwable tmp#1) { tmp#1.printStackTrace(); - x10.runtime.Runtime.java.log(java.util.logging.Level.SEVERE, + x10.runtime.impl.java.Runtime.java.log(java.util.logging.Level.SEVERE, "Unexpected exception during conditional atomic.", tmp#1); throw new java.lang.RuntimeException(tmp#1); } finally { Modified: trunk/x10.compiler.p3/data/when.xcd =================================================================== --- trunk/x10.compiler.p3/data/when.xcd 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.compiler.p3/data/when.xcd 2008-10-31 20:54:49 UTC (rev 6590) @@ -14,7 +14,7 @@ } } catch (java.lang.Throwable tmp#4) { tmp#4.printStackTrace(); - x10.runtime.Runtime.java.log(java.util.logging.Level.SEVERE, + x10.runtime.impl.java.Runtime.java.log(java.util.logging.Level.SEVERE, "Unexpected exception during conditional atomic.", tmp#4); throw new java.lang.RuntimeException(tmp#4); } finally { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -174,7 +174,7 @@ public class X10PrettyPrinterVisitor extends X10DelegatingVisitor { public static final String X10_RUNTIME_TYPE_CLASS = "x10.types.Type"; public static final String X10_FUN_CLASS_PREFIX = "x10.core.fun.Fun"; - public static final String X10_RUNTIME_CLASS = "x10.runtime.Runtime"; + public static final String X10_RUNTIME_CLASS = "x10.runtime.impl.java.Runtime"; public static final boolean USE_JAVA_GENERICS = true; Modified: trunk/x10.dist/.launchConfigs/x10.launch =================================================================== --- trunk/x10.dist/.launchConfigs/x10.launch 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.dist/.launchConfigs/x10.launch 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,7 +1,7 @@ <?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/x10/runtime/Runtime.java"/> +<listEntry value="/x10.runtime.x10/src-java/x10/runtime/impl/java/Runtime.java"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="1"/> @@ -20,7 +20,7 @@ <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.Runtime"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="x10.runtime.impl.java.Runtime"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${resource_name}"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.runtime.17"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> Modified: trunk/x10.dist/bin/x10.in =================================================================== --- trunk/x10.dist/bin/x10.in 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.dist/bin/x10.in 2008-10-31 20:54:49 UTC (rev 6590) @@ -85,7 +85,7 @@ fi java_args="${java_args} ${defs}" -command="\"$JAVA\" $java_args $config x10.runtime.Runtime $args" +command="\"$JAVA\" $java_args $config x10.runtime.impl.java.Runtime $args" [ -n "$verbose" ] && echo "$command" Modified: trunk/x10.runtime.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime.17/META-INF/MANIFEST.MF 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/META-INF/MANIFEST.MF 2008-10-31 20:54:49 UTC (rev 6590) @@ -10,7 +10,7 @@ x10.base, x10.compilergenerated, x10.lang, - x10.runtime, + x10.runtime.impl.java x10.runtime.util Bundle-Vendor: rf...@wa... Modified: trunk/x10.runtime.17/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -8,7 +8,7 @@ package x10.core; -import x10.runtime.X10Thread; +import x10.runtime.impl.java.X10Thread; // Base class of all X10 ref objects -- should be generated, but we need this class to get Box to compile. public class Ref { Deleted: trunk/x10.runtime.17/src-java/x10/runtime/Configuration.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/Configuration.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/Configuration.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,216 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -/* - * Created on Sep 28, 2004 - */ -package x10.runtime; - -import x10.config.ConfigurationError; -import x10.config.OptionError; -import x10.runtime.util.ShowUsageNotification; - -import java.util.StringTokenizer; - -/** - * This class provides the configuration for the X10 runtime. - * The configuration is a set of values that can be used to - * configure the runtime, for example in order to tune performance. - * - * @see x10.config.Configuration - * - * @author Christian Grothoff - * - * Extensions for JUC implementation - * @author Raj Barik, Vivek Sarkar - */ -public final class Configuration extends x10.config.Configuration { - - /** - * The error received when attempting to load the configuration from - * the specified resource, or null if successful. - */ - public static final ConfigurationError LOAD_ERROR; - - public static int NUMBER_OF_LOCAL_PLACES = 4; - private static final String NUMBER_OF_LOCAL_PLACES_desc = "The number of places"; - - public static boolean NULL_DEFAULT_VALUE = true; - private static final String NULL_DEFAULT_VALUE_desc = "Value types have a null default value"; - - public static int INIT_THREADS_PER_PLACE = 3; - private static final String INIT_THREADS_PER_PLACE_desc = "Initial number of Java threads allocated to thread pool for a single place"; - - /** - * Perform additional instrumentation in the X10 runtime to dump out - * abstract parallel execution statistics for the X10 program. - * Default is false. - */ - public static boolean ABSTRACT_EXECUTION_STATS = false; - private static final String ABSTRACT_EXECUTION_STATS_desc = "Dump out parallel execution statistics"; - - /** - * Dump out unblocked execution times in each place. The time that an - * activity spent blocked in the X10 runtime is not counted. However, - * this is still an approximate estimate because it does account for time - * that an activity is not executing because its Java thread in the thread - * pool does not have an available processor. - * - * NOTE: this option is only enabled when ABSTRACT_EXECUTION_STATS==true; - */ - public static boolean ABSTRACT_EXECUTION_TIMES = false; - private static final String ABSTRACT_EXECUTION_TIMES_desc = "If dumping out statistics, also dump out unblocked execution times"; - - public static boolean BIND_THREADS = false; - private static final String BIND_THREADS_desc = "Use platform-specific calls to bind Java threads to CPUs"; - - public static boolean BIND_THREADS_DIAGNOSTICS = false; - private static final String BIND_THREADS_DIAGNOSTICS_desc = "Print diagnostics related to platform-specific calls to bind Java threads to CPUs"; - - // Set Bad_PLACE_RUNTIME_CHECK = false as the default value in support of implicit-place syntax - public static boolean BAD_PLACE_RUNTIME_CHECK = false; - private static final String BAD_PLACE_RUNTIME_CHECK_desc = "Perform runtime place checks"; - - /** - * The name of the main class of the application. - * TODO: Move this to Runtime.main(). - */ - public static String MAIN_CLASS_NAME = null; - private static final String MAIN_CLASS_NAME_desc = "The name of the main class"; - - /** - * Enables new (experimental) ateach and foreach optimization (code by - * Christian Grothoff and Raj Barik). Default to off until that code is - * sufficiently tested... - */ - public static boolean OPTIMIZE_FOREACH = false; - private static final String OPTIMIZE_FOREACH_desc = "Experimental: Enable runtime loop optimizations"; - - /** - * Pre-load all classes recursively on startup. This is needed for JIT - * optimizations. Default to off until the initialization sequence is - * sufficiently tested... - */ - public static boolean PRELOAD_CLASSES = false; - private static final String PRELOAD_CLASSES_desc = "Pre-load all classes on recursively startup"; - - /** - * Pre-load all strings in all classes on startup. This is needed for - * JIT optimizations. This option only takes effect if PRELOAD_CLASSES - * is also on. Default to off until the JIT can actually take advantage - * of it. - */ - public static boolean PRELOAD_STRINGS = false; - private static final String PRELOAD_STRINGS_desc = "If pre-loading classes, also pre-load all strings"; - - /** - * Which shared libraries should be loaded? The format - * is libraryname[:libraryname]*. Null or "" are valid - * entries (for not loading any libraries). - */ - public static String LOAD = null; - private static final String LOAD_desc = "Load specified shared library"; - - /** - * Parses the command line. This allows the user to specify - * options also on the command line (in addition to the - * configuration file and the defaults). The name of the - * main class is the first argument that does not start with - * a "-". All arguments after the main class are returned - * and should be passed to the application. - * - * @param args arguments. Example: -BAD_PLACE_RUNTIME_CHECK=true - * @return the arguments for the application - */ - public static String[] parseCommandLine(String[] args) throws ConfigurationError { - if (args == null) - return new String[0]; - - int pos = 0; - while (pos < args.length && args[pos].length() > 0 && args[pos].charAt(0) == '-') { - if (args[pos].equals("-h") || - args[pos].equals("-help") || - args[pos].equals("--help")) - throw new ShowUsageNotification(); - // vj: added to allow the runtime to use Polyglot's report mechanism - if (args[pos].equals("-report")) { - pos++; - StringTokenizer st = new StringTokenizer(args[pos], "="); - String topic = ""; int level = 0; - if (st.hasMoreTokens()) topic = st.nextToken(); - if (st.hasMoreTokens()) { - try { - level = Integer.parseInt(st.nextToken()); - } - catch (NumberFormatException e) {} - } - - Report.addTopic(topic, level); - pos++; - continue; - } - - try { - parseArgument(Configuration.class, args[pos]); - } catch (OptionError e) { - throw new ConfigurationError("Invalid argument: '"+args[pos]+"'"); - } - pos++; - } - // TODO: Move MAIN_CLASS_NAME processing to Runtime.main() - MAIN_CLASS_NAME = args[pos++]; - // vj hack to let Eclipse x10 command run with ${resource_loc} - // get rid of prefix pathname. - MAIN_CLASS_NAME = MAIN_CLASS_NAME.substring(MAIN_CLASS_NAME.lastIndexOf("\\")+1); - if (MAIN_CLASS_NAME.endsWith(".java")) - MAIN_CLASS_NAME = MAIN_CLASS_NAME.substring(0, MAIN_CLASS_NAME.length()-5); - else if (MAIN_CLASS_NAME.endsWith(".x10")) - MAIN_CLASS_NAME = MAIN_CLASS_NAME.substring(0, MAIN_CLASS_NAME.length()-4); - - // Sanity checks for values. - if (NUMBER_OF_LOCAL_PLACES < 0) { - System.err.println("Negative value |" + NUMBER_OF_LOCAL_PLACES - + "| for NUMBER_OF_LOCAL_PLACES rejected. Set to 4." ); - NUMBER_OF_LOCAL_PLACES = 4; - } - if (INIT_THREADS_PER_PLACE < 0) { - System.err.println("Negative value |" + INIT_THREADS_PER_PLACE - + "| for INIT_THREADS_PER_PLACE rejected. Set to 3." ); - INIT_THREADS_PER_PLACE = 3; - } - - int aa = args.length-pos; - String[] appArgs = new String[aa]; - System.arraycopy(args, pos, appArgs, 0, aa); - if (Report.should_report(Report.ACTIVITY, 3)) { - Report.report(3, Thread.currentThread() + " user class is |" - + Configuration.MAIN_CLASS_NAME+ "|."); - } - return appArgs; - } - - /** - * Return an array of (option,description) pairs. - */ - public static String[][] options() { - return options(Configuration.class); - } - - static { - String cfg = getConfigurationResource(); - ConfigurationError loadError = null; - try { - readConfiguration(Configuration.class, cfg); - } catch (ConfigurationError err) { - System.err.println("Failed to read configuration file " + cfg + ": " + err); - System.err.println("Using defaults"); - loadError = err; - } - LOAD_ERROR = loadError; - } -} - Deleted: trunk/x10.runtime.17/src-java/x10/runtime/JavaRuntime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/JavaRuntime.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/JavaRuntime.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,70 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.util.logging.Level; -import java.util.logging.Logger; -import java.lang.System; - - -/** - * "Native" functions mapped through to Java. In the long run the - * idea is that this becomes the "X10 native interface" (akin to JNI, - * but of course better). For the prototype, this interface contains - * the few native functions that we just feel like we have to provide. - * - * In principle, this class can be subclassed, but since it is - * unlikely that we will have multiple implementations of any of these - * functions other than the default, we currently do without. - * - * I'm not sure that this class should live in this package -- maybe - * the code can live here (JavaRuntime_c), but the current situation - * where x10.runtime.Runtime directly refers to a class in x10.runtime - * is definitively bad. - * - * @author Christian Grothoff, Christoph von Praun - */ -public class JavaRuntime { - - private final Logger logger_ - = Logger.getAnonymousLogger(); - - public long currentTimeMillis() { - return System.currentTimeMillis(); - } - - public void log(Level l, - String message, - Object param1) { - logger_.log(l, message, param1); - } - - public void log(Level l, - String message, - Object[] params) { - logger_.log(l, message, params); - } - - public void log(Level l, - String message, - Throwable thrown) { - logger_.log(l, message, thrown); - } - - public void error(String message, Throwable thrown) { - Error tmp = new Error("Unexpected runtime error, see log for details."); - if (thrown != null) - thrown.printStackTrace(); - else - tmp.printStackTrace(); - logger_.log(Level.SEVERE, message, (Object) null); - throw tmp; - } - -} // end of Native - Deleted: trunk/x10.runtime.17/src-java/x10/runtime/NativeHashMap.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/NativeHashMap.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/NativeHashMap.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,13 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -public class NativeHashMap<K,V> extends java.util.HashMap<K,V> { - // HACK discard type parameters - public NativeHashMap(Object typeK, Object typeV) { super(); } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/NativeStack.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/NativeStack.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/NativeStack.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,13 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -public class NativeStack<T> extends java.util.Stack<T> { - // HACK discard type parameter - public NativeStack(Object typeT) { super(); } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/PreLoader.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/PreLoader.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/PreLoader.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,303 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.io.*; -import java.util.*; - -/** - * A utility for pre-loading a given class and all non-system classes that - * it references. - * The entrypoint is a static <code>preLoad()</code> method. Calling - * <code>preLoad(c, true)</code> will also intern all strings in the - * classes' constant pool. - * - * @author Igor Peshansky - */ -public class PreLoader { - public static void main(String[] args) { -// try { -// String name = getClassFile(PreLoader.class); -// if (args.length > 0) -// name = args[0]; -// InputStream in = getClassAsStream(name, PreLoader.class); -// byte[][] cp = getConstantPool(in); -// String[] ref_classes = getReferencedClasses(name, cp); -// for (int i = 0; i < ref_classes.length; i++) -// System.err.println(i+": "+ref_classes[i]); -// } catch (IOException e) { e.printStackTrace(); } - if (args.length > 0) - preLoad(args[0], PreLoader.class); - else - preLoad(PreLoader.class); - } - private static final String TRUE = "true"; - private static final Map inited = new HashMap(); - private static final ClassLoader bootstrap = Object.class.getClassLoader(); - /** - * Recursively pre-load the given class and all the classes it statically - * references. - * @param c the class to pre-load - */ - public static void preLoad(Class c) { - preLoad(getClassFile(c), c); - } - /** - * Recursively pre-load the given class and all the classes it statically - * references, optionally interning string constants. - * @param c the class to pre-load - * @param intern whether to intern string constants - */ - public static void preLoad(Class c, boolean intern) { - if (c.getClassLoader() == bootstrap) return; - preLoad(getClassFile(c), c, intern); - } - private static void preLoad(String name, Class c) { - preLoad(name, c, true); - } - private static void preLoad(String name, Class c, boolean intern) { - if (inited.get(name) != null) return; - inited.put(name, TRUE); -// System.err.println("Pre-loading '"+name+"'"); - try { - InputStream in = getClassAsStream(name, c); - byte[][] cp = getConstantPool(name, in); -// for (int j = 1; j < cp.length; j++) -// printConstantPoolEntry(cp, j, System.err); - if (intern) internStrings(cp); - String[] ref_classes = getReferencedClasses(name, cp); - for (int i = 0; i < ref_classes.length; i++) { - String nm = toClassName(ref_classes[i]); - try { - Class u = Class.forName(nm); -// System.err.println(i+": "+nm+" -> "+u); - // Skip arrays - if (nm.charAt(0) == '[') continue; - // Skip system classes - if (u.getClassLoader() == bootstrap) continue; - preLoad(toFileName(nm), c, intern); - } catch (ClassNotFoundException e) { -// System.err.println(i+": "+nm+" not found"); - } - } - } catch (IOException e) { e.printStackTrace(System.err); assert false; } - } - private static InputStream getClassAsStream(Class c) throws IOException { - return getClassAsStream(getClassFile(c), c); - } - private static InputStream getClassAsStream(String name, Class c) throws IOException { - InputStream cin = c.getClassLoader().getResourceAsStream(name); - if (cin == null) - throw new IOException("Class file "+name+" cannot be found"); - return cin; - } - private static String toClassName(String n) { - return n.replace('/','.'); - } - private static String toFileName(String n) { - return n.replace('.','/')+".class"; - } - private static String getClassFile(Class c) { - return toFileName(c.getName()); - } - private static byte[] getClassBytes(String name, Class c) throws IOException { - InputStream cin = getClassAsStream(name, c); - byte[] classbytes = new byte[cin.available()]; - if (cin.read(classbytes) != classbytes.length) - throw new IOException("Could not read class"); - return classbytes; - } - private static void internStrings(byte[][] cp) { - for (int i = 1; i < cp.length; i++) { - if (cp[i][0] != CONSTANT_Utf8) continue; - int len = (cp[i][1] & 0xFF) << 8 | (cp[i][2] & 0xFF); - try { - String s = new String(cp[i], 3, len, "UTF-8").intern(); -// System.err.println("Interned '"+s+"'"); - } catch (UnsupportedEncodingException e) { } - } - } - private static String[] getReferencedClasses(String name, byte[][] cp) { - int num_classes = 0; - for (int i = 1; i < cp.length; i++) - if (cp[i][0] == CONSTANT_Class) - num_classes++; - String[] ref_classes = new String[num_classes]; - int j = 0; - for (int i = 1; i < cp.length; i++) { - if (cp[i][0] != CONSTANT_Class) continue; - int name_idx = (cp[i][1] & 0xFF) << 8 | (cp[i][2] & 0xFF); - if (cp[name_idx][0] != CONSTANT_Utf8) - throw new Error("Class entry "+i+" refers to non-utf ("+cp[name_idx][0]+") entry "+name_idx+" in "+name); - int name_len = (cp[name_idx][1] & 0xFF) << 8 | (cp[name_idx][2] & 0xFF); - try { - ref_classes[j++] = new String(cp[name_idx], 3, name_len, "UTF-8").intern(); - } catch (UnsupportedEncodingException e) { } - } - return ref_classes; - } - private static byte[][] getConstantPool(String name, byte[] classbytes) { - try { - return getConstantPool(name, new ByteArrayInputStream(classbytes)); - } catch (IOException e) { - throw new Error("Unable to read from an array of bytes"); - } - } - private static final int CONSTANT_Empty = 0; - private static final int CONSTANT_Class = 7; - private static final int CONSTANT_Fieldref = 9; - private static final int CONSTANT_Methodref = 10; - private static final int CONSTANT_InterfaceMethodref = 11; - private static final int CONSTANT_String = 8; - private static final int CONSTANT_Integer = 3; - private static final int CONSTANT_Float = 4; - private static final int CONSTANT_Long = 5; - private static final int CONSTANT_Double = 6; - private static final int CONSTANT_NameAndType = 12; - private static final int CONSTANT_Utf8 = 1; - private static final byte[] EMPTY = new byte[] { CONSTANT_Empty }; - private static byte[][] getConstantPool(String name, InputStream in) throws IOException { - for (int i = 0; i < 8; i++) in.read(); - int cp_size = ((in.read() & 0xFF) << 8 | (in.read() & 0xFF)); - byte[][] cp = new byte[cp_size][]; - cp[0] = EMPTY; - for (int i = 1; i < cp_size; i++) { - byte tag = (byte)in.read(); - switch (tag) { - case CONSTANT_Class: - case CONSTANT_String: - cp[i] = new byte[] { tag, (byte)in.read(), (byte)in.read() }; - break; - case CONSTANT_Fieldref: - case CONSTANT_Methodref: - case CONSTANT_InterfaceMethodref: - cp[i] = new byte[] { tag, (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read() }; - break; - case CONSTANT_Integer: - case CONSTANT_Float: - cp[i] = new byte[] { tag, (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read() }; - break; - case CONSTANT_Long: - case CONSTANT_Double: - cp[i] = new byte[] { tag, (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read() }; - cp[++i] = EMPTY; - break; - case CONSTANT_NameAndType: - cp[i] = new byte[] { tag, (byte)in.read(), (byte)in.read(), - (byte)in.read(), (byte)in.read() }; - break; - case CONSTANT_Utf8: - { - byte l_h = (byte)in.read(); - byte l_l = (byte)in.read(); - int len = (l_h & 0xFF) << 8 | (l_l & 0xFF); - cp[i] = new byte[len+3]; - cp[i][0] = tag; cp[i][1] = l_h; cp[i][2] = l_l; - int off = 3; - int n; - while ((n = in.read(cp[i], off, len)) != len) { - len -= n; - off += n; - } - } - break; - default: - throw new Error("Unknown constant pool tag ("+tag+") at entry "+i+" in "+name); - } -// printConstantPoolEntry(cp, i-1, System.err); -// printConstantPoolEntry(cp, i, System.err); - } - return cp; - } - private static final String[] TAGS = { "EMPTY", "UTF8", null, "INTEGER", - "FLOAT", "LONG", "DOUBLE", "CLASS", "STRING", "FIELDREF", "METHODREF", - "IMETHOD", "NAME/TYPE" }; - private static void printConstantPoolEntry(byte[][] cp, int i, PrintStream out) { - byte[] entry = cp[i]; - byte tag = entry[0]; - int tmp1, tmp2; - out.print(i+": "+TAGS[tag]); - switch (tag) { - case CONSTANT_Empty: - out.println(); - break; - case CONSTANT_Class: - case CONSTANT_String: - tmp1 = (entry[1] & 0xFF) << 8 | (entry[2] & 0xFF); - out.println("["+tmp1+"]"); -// out.print(" -> "); -// printConstantPoolEntry(cp, tmp1, out); - break; - case CONSTANT_Fieldref: - case CONSTANT_Methodref: - case CONSTANT_InterfaceMethodref: - tmp1 = (entry[1] & 0xFF) << 8 | (entry[2] & 0xFF); - tmp2 = (entry[3] & 0xFF) << 8 | (entry[4] & 0xFF); - out.println("["+tmp1+","+tmp2+"]"); -// out.print(" -> "); -// printConstantPoolEntry(cp, tmp1, out); -// out.print(" -> "); -// printConstantPoolEntry(cp, tmp2, out); - break; - case CONSTANT_Integer: - case CONSTANT_Float: - tmp1 = ((entry[1] & 0xFF) << 8 | (entry[2] & 0xFF)) << 16 | - ((entry[3] & 0xFF) << 8 | (entry[4] & 0xFF)); - if (tag == CONSTANT_Float) - out.println(" = "+toFloat(tmp1)); - else - out.println(" = "+tmp1); - break; - case CONSTANT_Long: - case CONSTANT_Double: - tmp1 = ((entry[1] & 0xFF) << 8 | (entry[2] & 0xFF)) << 16 | - ((entry[3] & 0xFF) << 8 | (entry[4] & 0xFF)); - tmp2 = ((entry[5] & 0xFF) << 8 | (entry[6] & 0xFF)) << 16 | - ((entry[7] & 0xFF) << 8 | (entry[8] & 0xFF)); - if (tag == CONSTANT_Double) - out.println(" = "+toDouble(tmp1,tmp2)); - else - out.println(" = "+toLong(tmp1,tmp2)); - break; - case CONSTANT_NameAndType: - tmp1 = (entry[1] & 0xFF) << 8 | (entry[2] & 0xFF); - tmp2 = (entry[3] & 0xFF) << 8 | (entry[4] & 0xFF); - out.println("["+tmp1+","+tmp2+"]"); -// out.print(" -> "); -// printConstantPoolEntry(cp, tmp1, out); -// out.print(" -> "); -// printConstantPoolEntry(cp, tmp2, out); - break; - case CONSTANT_Utf8: - tmp1 = (entry[1] & 0xFF) << 8 | (entry[2] & 0xFF); - try { - out.println(" = \""+new String(entry, 3, tmp1, "UTF-8")+"\""); - } catch (UnsupportedEncodingException e) { } - break; - default: - throw new Error("Unknown constant pool tag ("+tag+") at entry "+i); - } - } - private static float toFloat(int v) { - return Float.intBitsToFloat(v); - } - private static long toLong(int h, int l) { - long r = h; - return r << 32 + l; - } - private static double toDouble(int h, int l) { - long r = h; - return Double.longBitsToDouble(r << 32 + l); - } -} - Deleted: trunk/x10.runtime.17/src-java/x10/runtime/Report.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/Report.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/Report.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,132 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Stack; - -/** Class used for reporting debug messages. Adapted from polyglot.main.Report - * @author vj - * */ -public class Report { - - public static final String ACTIVITY = "activity"; - - public static final String CLOCK = "clock"; - - /** A collection of string names of topics which can be used with the - -report command-line switch */ - public static Collection topics = new HashSet(); - - /** A collection of string names of topics which we should always check - if we should report. */ - public static Stack should_report = new Stack(); - - /** - * The topics that the user has selected to report, mapped to the level - * they want to report them to. - */ - protected static Map reportTopics = new HashMap(); // Map[String, Integer] - - /** - * Indicates if there is no reporting at all. - * The normal case is that we do not report anything, so for efficiency - * reasons, since <code>should_report</code> is called so often, we'll use - * this flag to bypass a lot of the checking. When the options are processed, - * this flag should be changed. - */ - // Replaced by a VMInterface ENABLE_REPORTING - protected static boolean noReporting = true; - - /** Report topics understood by the runtime system. */ - - // This topic is the level of detail that should be in messages. - public static String debug = "debug"; - public static String verbose="verbose"; - static { - - topics.add(Report.CLOCK); - topics.add(Report.ACTIVITY); - - should_report.push(verbose); - } - - /** - * Return whether a message on <code>topic</code> of obscurity - * <code>level</code> should be reported, based on use of the - * -report command-line switches given by the user. - */ - public static boolean should_report(String topic, int level) { - if (noReporting) - return false; - return should_report(Collections.singletonList(topic), level); - } - - /** - * Return whether a message on <code>topics</code> of obscurity - * <code>level</code> should be reported, based on use of the - * -report command-line switches given by the user. - */ - public static boolean should_report(String[] topics, int level) { - if (noReporting) - return false; - return should_report(Arrays.asList(topics), level); - } - - /** - * Return whether a message on <code>topics</code> of obscurity - * <code>level</code> should be reported, based on use of the - * -report command-line switches given by the user. - */ - public static boolean should_report(Collection topics, int level) { - if (noReporting) - return false; - for (Iterator i = should_report.iterator(); i.hasNext();) { - String topic = (String) i.next(); - if (level(topic) >= level) return true; - } - if (topics != null) { - for (Iterator i = topics.iterator(); i.hasNext();) { - String topic = (String) i.next(); - if (level(topic) >= level) return true; - } - } - return false; - } - - public static void addTopic(String topic, int level) { - Integer i = (Integer)reportTopics.get(topic); - if (i == null || i.intValue() < level) { - reportTopics.put(topic, new Integer(level)); - } - } - - protected static int level(String name) { - Object i = reportTopics.get(name); - if (i == null) return 0; - return ((Integer)i).intValue(); - } - - /** This is the standard way to report debugging information in the - * RTS. It reports a message of the specified level (which - * controls the presentation of the message. To test whether such - * message should be reported, use "should_report" - * - */ - public static void report(int level, String message) { - for (int j = 1; j < level; j++) System.err.print(" "); - System.err.println(message); - } - -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/Runtime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/Runtime.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/Runtime.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,88 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import x10.config.ConfigurationError; -import x10.runtime.util.ShowUsageNotification; - -public class Runtime { - public static JavaRuntime java; - - /* Pre-load the VMInterface class */ - static { VMInterface foo = null; } - - public static void main(String[] args) { - if (args.length == 0) { - System.err.println("usage: java x10.runtime.Runtime MainClass [args]"); - System.exit(1); - } - try { - String[] strippedArgs = Configuration.parseCommandLine(args); - java = new JavaRuntime(); - loadAndInitLibs(); - run(strippedArgs); - } catch (ShowUsageNotification e) { - Usage.usage(System.out, null); - } catch (ConfigurationError e) { - Usage.usage(System.err, e); - } catch (Exception e) { - Runtime.java.error("Unexpected Exception in X10 runtime.", e); - } - } - - /** - * Load and init shared library - */ - private static void loadAndInitLibs() { - if (null != Configuration.LOAD) { - String[] libs = Configuration.LOAD.split(":"); - for (int i=libs.length-1;i>=0;i--) - System.loadLibrary(libs[i]); - } - } - - public static final int MAX_PLACES = Configuration.NUMBER_OF_LOCAL_PLACES; - - private static final Class[] STRING_ARRAYS = new Class[] { String[].class }; - - /** - * Instantiate and run the main activity - */ - private static void run(String[] strippedArgs) { - java.lang.Object[] args = { strippedArgs }; - try { - // instantiation using reflection - Class main = Class.forName(Configuration.MAIN_CLASS_NAME + "$Main"); - Runnable r = (Runnable) main.getDeclaredConstructor(STRING_ARRAYS).newInstance(args); - if (Configuration.PRELOAD_CLASSES) - PreLoader.preLoad(main, Configuration.PRELOAD_STRINGS); - // run the main activity - r.run(); - } catch (Exception e) { - System.err.println("Could not find default constructor of main class '" - + Configuration.MAIN_CLASS_NAME + "$Main" + "'!"); - throw new Error(e); - } - exit(); - } - - private static int exitCode = 0; - - public static void setExitCode(int code) { - exitCode = code; - } - - public static void exit() { - System.exit(exitCode); - } - - public static void exit(int code) { - setExitCode(code); - exit(); - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/Usage.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/Usage.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/Usage.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,122 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.io.PrintStream; -import java.util.StringTokenizer; - -import x10.config.ConfigurationError; - -/** - * Code for outputting usage information for the X10 runtime. - */ -public abstract class Usage { - /** - * The name of the language this runtime represents. - */ - public static final String LANGUAGE = "x10"; - - /** - * Print usage information - */ - public static void usage(PrintStream out, ConfigurationError err) { - if (err != null) - out.println("Error: "+err.getMessage()); - out.println("Usage: " + LANGUAGE + " [options] " + - "<main-class> [arg0 arg1 ...]"); - out.println("where [options] includes:"); - String[][] options = Configuration.options(); - for (int i = 0; i < options.length; i++) { - String[] optinfo = options[i]; - String optflag = "-"+optinfo[0]+"="+optinfo[1]; - String optdesc = optinfo[2]+"(default = "+optinfo[3]+")"; - usageForFlag(out, optflag, optdesc); - } - } - - /* The following code was borrowed from Polyglot's Options.java */ - /** - * The maximum width of a line when printing usage information. Used - * by <code>usageForFlag</code> and <code>usageSubsection</code>. - */ - protected static final int USAGE_SCREEN_WIDTH = 76; - - /** - * The number of spaces from the left that the descriptions for flags will - * be displayed. Used by <code>usageForFlag</code>. - */ - private static final int USAGE_FLAG_WIDTH = 34; - - /** - * The number of spaces from the left that the flag names will be - * indented. Used by <code>usageForFlag</code>. - */ - private static final int USAGE_FLAG_INDENT = 4; - - /** - * Utility method to print a number of spaces to a PrintStream. - * @param out output PrintStream - * @param n number of spaces to print. - */ - protected static void printSpaces(PrintStream out, int n) { - while (n-- > 0) { - out.print(' '); - } - } - - /** - * Output a flag and a description of its usage in a nice format. - * - * @param out output PrintStream - * @param flag - * @param description description of the flag. - */ - protected static void usageForFlag(PrintStream out, String flag, String description) { - printSpaces(out, USAGE_FLAG_INDENT); - out.print(flag); - // cur is where the cursor is on the screen. - int cur = flag.length() + USAGE_FLAG_INDENT; - - // print space to get up to indentation level - if (cur < USAGE_FLAG_WIDTH) { - printSpaces(out, USAGE_FLAG_WIDTH - cur); - } - else { - // the flag is long. Get a new line before printing the - // description. - out.println(); - printSpaces(out, USAGE_FLAG_WIDTH); - } - cur = USAGE_FLAG_WIDTH; - - // break up the description. - StringTokenizer st = new StringTokenizer(description); - while (st.hasMoreTokens()) { - String s = st.nextToken(); - if (cur + s.length() > USAGE_SCREEN_WIDTH) { - out.println(); - printSpaces(out, USAGE_FLAG_WIDTH); - cur = USAGE_FLAG_WIDTH; - } - out.print(s); - cur += s.length(); - if (st.hasMoreTokens()) { - if (cur + 1 > USAGE_SCREEN_WIDTH) { - out.println(); - printSpaces(out, USAGE_FLAG_WIDTH); - cur = USAGE_FLAG_WIDTH; - } - else { - out.print(" "); - cur++; - } - } - } - out.println(); - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/VMInterface.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/VMInterface.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/VMInterface.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,121 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -/* - * Created on Sep 28, 2004 - */ -package x10.runtime; - -import java.util.concurrent.atomic.*; - -/** - * This class introduces static final fields that are initialized with values provided by other classes. - * Any references to these fields should be recognized as constants by a JIT compiler compiling code that - * references any of these fields. (It is important to ensure that classes that reference these fields - * do not introduce a cycle in class loading dependences.) - * - * @author Vivek Sarkar (based on ideas suggested by Allan Kielstra, Igor Peshansky, Chris Donawa, Raj Barik) - */ -public final class VMInterface { - - public static final int NUMBER_OF_LOCAL_PLACES = Configuration.NUMBER_OF_LOCAL_PLACES; - - public static final boolean ABSTRACT_EXECUTION_STATS = Configuration.ABSTRACT_EXECUTION_STATS; - - public static final boolean ABSTRACT_EXECUTION_TIMES = Configuration.ABSTRACT_EXECUTION_TIMES; - - // Set to true if individual PoolRunners should be pre-assigned to - // CPUs on an SMP system. - public static final boolean BIND_THREADS = Configuration.BIND_THREADS; - public static final boolean BIND_THREADS_DIAGNOSTICS = Configuration.BIND_THREADS_DIAGNOSTICS; - - // The following methods are all specially treated by the Testarossa - // JIT and may be specially treated by any JIT. - // call this method early so that Helpers will be loaded before - // we attempt to JIT compile any calls to methods below - public static final void loadMeInMain() { } - - // The Testarossa JIT (in J9) will use this to allow - // speculative loads of array elements beyond the end of - // the array without bounds check violations - public static final int speculateIndex(int index,int upperBound) { - if(index >=upperBound) return 0; - return index; - } - // The Testarossa JIT (in J9) will turn this into a direct - // call to the appropriate system routine on AIX - public static final int getCPU() { return -1; } - - // When the Testarossa JIT (in J9) sees something like: - // arr[x10JITHelpers.Helpers.noBoundsCheck(x)] - // it will treat it as: - // arr[(x)] only with no bounds check - public static final int noBoundsCheck(int i) { return i; } - - // When the JIT sees something like: - // checkLowBound(i,low) - // it can inline the following method body, and treat this method as an intrinsic that is a candidate for redundancy optimizations - public static int checkLowBound(int i, int low) { if (i < low) throw new ArrayIndexOutOfBoundsException(); return i; } - - // When the JIT sees something like: - // checkHighBound(i,high) - // it can inline the following method body, and treat this method as an intrinsic that is a candidate for redundancy optimizations - public static int checkHighBound(int i, int high) { if (i > high) throw new ArrayIndexOutOfBoundsException(); return i; } - - // NOTE: we can later evaluate if we want to also create an optimized combined call for low and high bounds, as Igor suggested - - // When the Testarossa JIT (in J9) sees something like: - // noNullCheck(x) - // it will treat it as: - // (x) only with no null reference check - public static final Object noNullCheck(Object o) { return o; } - - // When the Testarossa JIT (in J9) sees something like: - // noCastCheck(x) - // it will treat it as: - // (x) only with no type cast check - public static final Object noCastCheck(Object o) { return o; } - - // Given a j.u.c Worker Runnable, construct a Runnable that will first - // ensure that the Worker thread runs on "the right" CPU - static final Runnable mapPoolThreadToCPU(final Runnable workerRunnable, final int placeNumber, final int workerWithinPool, String threadName) { - if (BIND_THREADS && (numCPUs != 0)) { - final int CPUsPerPlace = numCPUs / Configuration.NUMBER_OF_LOCAL_PLACES; - final int firstCPUInThisPlace = CPUsPerPlace * placeNumber; - final int numCPUsInThisPlace = (placeNumber == Configuration.NUMBER_OF_LOCAL_PLACES - 1) ? (numCPUs - firstCPUInThisPlace) : CPUsPerPlace; - final int myCPU = (firstCPUInThisPlace + workerWithinPool % numCPUsInThisPlace) % numCPUs ; - if ( BIND_THREADS_DIAGNOSTICS ) System.err.println("BIND_THREADS: Mapping thread " + threadName + " to CPU " + myCPU); - return new Runnable() { - public void run() { - putMeOnCPU(myCPU); - workerRunnable.run(); - } - }; - } else { - return workerRunnable; - } - } - - private final static AtomicInteger globalThreadNumber = new AtomicInteger(0); - private final native static int getNumCPUs(); - private final static int numCPUs; - private final static String thrdSuppLib = "X10ThreadSupp"; - private final native static void putMeOnCPU(int i); - static { - int n = 0; - try { - System.loadLibrary(thrdSuppLib); - n = getNumCPUs(); - } catch (java.lang.UnsatisfiedLinkError ule) { - if ( BIND_THREADS_DIAGNOSTICS ) System.err.println("BIND_THREADS: Library " + thrdSuppLib + " not found???"); - } finally { - numCPUs = n; - } - } - -} - Deleted: trunk/x10.runtime.17/src-java/x10/runtime/X10Thread.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/X10Thread.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/X10Thread.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,46 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -/** - * Thread in the thread pool that can be used to run multiple - * activities over time. - * - * @author Christian Grothoff - * @author vj - * @author Raj Barik, Vivek Sarkar - * 3/6/2006: replaced original PoolRunner by JCU implementation - * @author tardieu - */ -public class X10Thread extends Thread { - public static X10Thread currentThread() { - Thread t = Thread.currentThread(); - if (t instanceof X10Thread) return (X10Thread) t; - return null; // happens before main activity is spawned - } - - private final int placeId; - private Runnable runnable; // the activity currently executed - - X10Thread(ThreadGroup group, Runnable r, String name, int id) { - super(group, r, name, 0); - placeId = id; - } - - public void setRunnable(Runnable r) { - runnable = r; - } - - public Runnable getRunnable() { - return runnable; - } - - public int getPlaceId() { - return placeId; - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadFactory.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadFactory.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadFactory.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,40 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -/** - * X10 thread factory for JCU implementation. - * @author Raj Barik, Vivek Sarkar -- 3/6/2006 - * @tardieu - */ -public class X10ThreadFactory implements ThreadFactory { - private final int placeId; - private final ThreadGroup group; - private final AtomicInteger threadNumber = new AtomicInteger(0); - private final String namePrefix; - - public X10ThreadFactory(int placeId) { - SecurityManager s = System.getSecurityManager(); - group = (s != null)? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); - namePrefix = "pool-" + placeId + "-thread-"; - this.placeId = placeId; - } - - public Thread newThread(final Runnable workerRunnable) { - final int x = threadNumber.getAndIncrement(); - String threadName = namePrefix + x; - Runnable r = VMInterface.mapPoolThreadToCPU(workerRunnable, placeId, x, threadName); - Thread t = new X10Thread(group, r, threadName, placeId); - if (t.isDaemon()) t.setDaemon(false); - if (t.getPriority() != Thread.NORM_PRIORITY) t.setPriority(Thread.NORM_PRIORITY); - return t; - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadPoolExecutor.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadPoolExecutor.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/X10ThreadPoolExecutor.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -1,71 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime; - -import java.util.concurrent.*; - -/** - * @author Raj Barik, Vivek Sarkar - * 3/6/2006: extension of JCU ThreadPoolExecutor to allow for adding threads to the pool based on the - * number of X10 activities that are blocked. - * @tardieu - */ - -public class X10ThreadPoolExecutor extends ThreadPoolExecutor { - - private int nbThreadBlocked = 0; - - public X10ThreadPoolExecutor ( int placeId ) { - super ( Configuration.INIT_THREADS_PER_PLACE, - Configuration.INIT_THREADS_PER_PLACE, - 1000L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<Runnable> (), - new X10ThreadFactory (placeId)); - prestartAllCoreThreads(); - } - - /** Should it be atomic? - * Call this method when you are blocked on finish, force, next*/ - - public synchronized void increasePoolSize () { - if(++nbThreadBlocked >= getCorePoolSize()) { - setCorePoolSize ( getCorePoolSize() + 1 ); - setMaximumPoolSize ( getMaximumPoolSize () + 1); - } - } - - - /** - * Call this method when you are out of the blocked operation - */ - - public synchronized void decreasePoolSize () { - --nbThreadBlocked; - // TODO this code is likely to crash some non regression test - // setCorePoolSize ( getCorePoolSize () - 1 ); - // setMaximumPoolSize ( getMaximumPoolSize () - 1); - } - - - /** - * Call this method to check the size of the queue - */ - public int queueSize() { - return getQueue().size(); - } - - /** TODO */ - public void beforeExecute (Thread t, Runnable r) { - super.beforeExecute(t,r); - } - - /** TODO */ - public void afterExecute (Runnable r, Throwable t) { - super.afterExecute(r,t); - } -} Modified: trunk/x10.runtime.17/src-java/x10/runtime/abstractmetrics/AbstractMetricsFactory.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/abstractmetrics/AbstractMetricsFactory.java 2008-10-31 19:27:46 UTC (rev 6589) +++ trunk/x10.runtime.17/src-java/x10/runtime/abstractmetrics/AbstractMetricsFactory.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -7,7 +7,7 @@ */ package x10.runtime.abstractmetrics; -import x10.runtime.VMInterface; +import x10.runtime.impl.java.VMInterface; /** * The default implementation of the AbstractMetrics interface Property changes on: trunk/x10.runtime.17/src-java/x10/runtime/impl/java ___________________________________________________________________ Added: svn:mergeinfo + Added: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Configuration.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Configuration.java (rev 0) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Configuration.java 2008-10-31 20:54:49 UTC (rev 6590) @@ -0,0 +1,216 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008 + * + * This file is part of X10 Language. + * + */ +/* + * Created on Sep 28, 2004 + */ +package x10.runtime.impl.java; + +import x10.config.ConfigurationError; +import x10.config.OptionError; +import x10.runtime.util.ShowUsageNotification; + +import java.util.StringTokenizer; + +/** + * This class provides the configuration for the X10 runtime. + * The configuration is a set of values that can be used to + * configure the runtime, for example in order to tune performance. + * + * @see x10.config.Configuration + * + * @author Christian Grothoff + * + * Extensions for JUC implementation + * @author Raj Barik, Vivek Sarkar + */ +public final class Configuration extends x10.config.Configuration { + + /** + * The error received when attempting to load the configuration from + * the specified resource, or null if successful. + */ + public static final ConfigurationError LOAD_ERROR; + + public static int NUMBER_OF_LOCAL_PLACES = 4; + private static final String NUMBER_OF_LOCAL_PLACES_desc = "The number of places"; + + public static boolean NULL_DEFAULT_VALUE = true; + private static final String NULL_DEFAULT_VALUE_desc = "Value types have a null default value"; + + public static int INIT_THREADS_PER_PLACE = 3; + private static final String INIT_THREADS_PER_PLACE_desc = "Initial number of Java threads allocated to thread pool for a single place"; + + /** + * Perform additional instrumentation in the X10 runtime to dump out + * abstract parallel execution statistics for the X10 program. + * Default is false. + */ + public static boolean ABSTRACT_EXECUTION_STATS = false; + private static final String ABSTRACT_EXECUTION_STATS_desc = "Dump out parallel execution statistics"; + + /** + * Dump out unblocked execution times in each place. The time that an + * activity spent blocked in the X10 runtime is not counted. However, + * this is still an approximate estimate because it does account for time + * that an activity is not executing because its Java thread in the thread + * pool does not have an available processor. + * + * NOTE: this option is only enabled when ABSTRACT_EXECUTION_STATS==true; + */ + public static boolean ABSTRACT_EXECUTION_TIMES = false; + private static final String ABSTRACT_EXECUTION_TIMES_desc = "If dumping out statistics, also dump out unblocked execution times"; + + public static boolean BIND_THREADS = false; + private static final String BIND_THREADS_desc = "Use platform-specific calls to bind Java threads to CPUs"; + + public static boolean BIND_THREADS_DIAGNOSTICS = false; + private static final String BIND_THREADS_DIAGNOSTICS_desc = "Print diagnostics related to platform-specific calls to bind Java threads to CPUs"; + + // Set Bad_PLACE_RUNTIME_CHECK = false as the default value in support of implicit-place syntax + public static boolean BAD_PLACE_RUNTIME_CHECK = false; + private static final String BAD_PLACE_RUNTIME_CHECK_desc = "Perform runtime place checks"; + + /** + * The name of the main class of the application. + * TODO: Move this to Runtime.main(). + */ + public static String MAIN_CLASS_NAME = null; + private static final String MAIN_CLASS_NAME_desc = "The name of the main class"; + + /** + * Enables new (experimental) ateach and foreach optimization (code by + * Christian Grothoff and Raj Barik). Default to off until that code is + * sufficiently tested... + */ + public static boolean OPTIMIZE_FOREACH = false; + private static final String OPTIMIZE_FOREACH_desc = "Experimental: Enable runtime loop optimizations"; + + /** + * Pre-load all classes recursively on startup. This is needed for JIT + * optimizations. Default to off until the initialization sequence is + * sufficiently tested... + */ + public static boolean PRELOAD_CLASSES = false; + private static final String PRELOAD_CLASSES_desc = "Pre-load all classes on recursively startup"; + + /** + * Pre-load all strings in all classes on startup. This is needed for + * JIT optimizations. This option only takes effect if PRELOAD_CLASSES + * is also on. Default to off until the JIT can actually take advantage + * of it. + */ + public static boolean PRELOAD_STRINGS = false; + private static final String PRELOAD_STRINGS_desc = "If pre-loading classes, also pre-load all strings"; + + /** + * Which shared libraries should be loaded? The format + * is libraryname[:libraryname]*. Null or "" are valid + * entries (for not loading any libraries). + */ + public static String LOAD = null; + private static final String LOAD_desc = "Load specified shared library"; + + /** + * Parses the command line. This allows the user to specify + * options also on the command line (in addition to the + * configuration file and the defaults). The name of the + * main class is the first argument that does not start with + * a "-". All arguments after the main class are returned + * and should be passed to the application. + * + * @param args arguments. Example: -BAD_PLACE_RUNTIME_CHECK=true + * @return the arguments for the application + */ + public static String[] parseCommandLine(String[] args) throws ConfigurationError { + if (args == null) + return new String[0]; + + int pos = 0; + while (pos < args.length && args[pos].length() > 0 && args[pos].charAt(0) == '-') { + if (args[pos].equals("-h") || + args[pos].equals("-help") || + args[pos].equals("--help")) + throw new ShowUsageNotification(); + // vj: added to allow the runtime to use Polyglot's report mechanism + if (args[pos].equals("-report")) { + pos++; + StringTokenizer st = new StringTokenizer(args[pos], "="); + String topic = ""; int level = 0; + if (st.hasMoreTokens()) topic = st.nextToken(); + if (st.hasMoreTokens()) { + try { + level = Integer.parseInt(st.nextToken()); + } + ... [truncated message content] |
From: <ta...@us...> - 2008-11-03 00:26:54
|
Revision: 6611 http://x10.svn.sourceforge.net/x10/?rev=6611&view=rev Author: tardieu Date: 2008-11-03 00:26:46 +0000 (Mon, 03 Nov 2008) Log Message: ----------- implemented thread pool in x10. implemented synchronized/wait/notify using locks and park/unpark. moved classes from x10.lang to x10.runtime and x10.util. fixed visibility of runtime classes and methods. revised boot sequence and compiler templates. Modified Paths: -------------- trunk/x10.compiler.p3/data/Async.xcd trunk/x10.compiler.p3/data/Atomic.xcd trunk/x10.compiler.p3/data/Future.xcd trunk/x10.compiler.p3/data/Main.xcd trunk/x10.compiler.p3/data/Now.xcd trunk/x10.compiler.p3/data/ateach.xcd trunk/x10.compiler.p3/data/await.xcd trunk/x10.compiler.p3/data/cast_place.xcd trunk/x10.compiler.p3/data/clock.xcd trunk/x10.compiler.p3/data/clocked-loop.xcd trunk/x10.compiler.p3/data/clocked.xcd trunk/x10.compiler.p3/data/finish.xcd trunk/x10.compiler.p3/data/foreach.xcd trunk/x10.compiler.p3/data/forloop.xcd trunk/x10.compiler.p3/data/here.xcd trunk/x10.compiler.p3/data/next.xcd trunk/x10.compiler.p3/data/place-check.xcd trunk/x10.compiler.p3/data/when-branch.xcd trunk/x10.compiler.p3/data/when.xcd trunk/x10.runtime.17/src-java/x10/core/Ref.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime.17/src-x10/x10/lang/Clock.x10 trunk/x10.runtime.17/src-x10/x10/lang/MultipleExceptions.x10 trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 trunk/x10.runtime.17/src-x10/x10/lang/Runtime.x10 Added Paths: ----------- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Job.x10 trunk/x10.runtime.17/src-x10/x10/runtime/ModCountDownLatch.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Worker.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 trunk/x10.runtime.17/src-x10/x10/util/HashMap.x10 trunk/x10.runtime.17/src-x10/x10/util/List.x10 trunk/x10.runtime.17/src-x10/x10/util/Map.x10 trunk/x10.runtime.17/src-x10/x10/util/Stack.x10 Removed Paths: ------------- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadFactory.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadPoolExecutor.java trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 trunk/x10.runtime.17/src-x10/x10/lang/ClockState.x10 trunk/x10.runtime.17/src-x10/x10/lang/Clocks.x10 trunk/x10.runtime.17/src-x10/x10/lang/FinishState.x10 trunk/x10.runtime.17/src-x10/x10/lang/Future_c.x10 trunk/x10.runtime.17/src-x10/x10/lang/HashMap.x10 trunk/x10.runtime.17/src-x10/x10/lang/List.x10 trunk/x10.runtime.17/src-x10/x10/lang/Map.x10 trunk/x10.runtime.17/src-x10/x10/lang/ModCountDownLatch.x10 trunk/x10.runtime.17/src-x10/x10/lang/Stack.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/NativeThread.x10 trunk/x10.runtime.17/src-x10/x10/util/Iterator.x10 trunk/x10.runtime.17/src-x10/x10/util/Stack.x10 Modified: trunk/x10.compiler.p3/data/Async.xcd =================================================================== --- trunk/x10.compiler.p3/data/Async.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/Async.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,7 +1,7 @@ // SYNOPSIS: async(#0) clocked(#1) #2 -x10.lang.Place.asPlace(#0).runAsync - (new x10.lang.Activity(#1) { +x10.runtime.Runtime.runAsync( + new x10.runtime.Activity(#1) { public void runX10Task$() { #2 } - }); + }, #0); Modified: trunk/x10.compiler.p3/data/Atomic.xcd =================================================================== --- trunk/x10.compiler.p3/data/Atomic.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/Atomic.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,9 +1,7 @@ // SYNOPSIS: atomic #0 - -synchronized (x10.lang.Activity.here()) { - try { - #0 - } finally { - x10.lang.Activity.here().notifyAll(); - } +x10.runtime.Runtime.lock(); +try { + #0 +} finally { + x10.runtime.Runtime.release(); // unlock and notify } Modified: trunk/x10.compiler.p3/data/Future.xcd =================================================================== --- trunk/x10.compiler.p3/data/Future.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/Future.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,6 +1,7 @@ // SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 -(x10.lang.Activity.here()).<#1>runFuture(#3, x10.lang.Place.asPlace(#0), new x10.lang.Future_c<#1>(#3) { - public #1 eval$() { - #2 - } -}) +x10.runtime.Runtime.runFuture(#3, + new x10.runtime.Future_c<#1>(#3) { + public #1 eval$() { + #2 + } + }, #0) Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,24 +1,23 @@ // SYNOPSIS: main(#0) #1 public static class Main implements java.lang.Runnable { - private final java.lang.String[] args; + private final x10.core.Rail<java.lang.String> rail; + public Main(java.lang.String[] args) { - this.args = args; + rail = x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args); } + public void run() { - x10.lang.Place.runMain(new MainActivity(args)); - } -} + // initialize places and attach current thread to first place + x10.runtime.impl.java.Thread.currentThread().place(x10.lang.Place.FIRST_PLACE); -public static class MainActivity extends x10.lang.Activity { - private final x10.core.Rail<java.lang.String> form; - public MainActivity(java.lang.String[] args) { - super("Main Activity"); - this.form = x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args); + // run main activity + x10.runtime.Runtime.runMain(new x10.runtime.Activity() { + public void runX10Task$() { + main(rail); + } + }); } - public void runX10Task$() { - main(form); - } } public static void main(java.lang.String[] args) { Modified: trunk/x10.compiler.p3/data/Now.xcd =================================================================== --- trunk/x10.compiler.p3/data/Now.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/Now.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,8 +1,7 @@ // SYNOPSIS: now(#0) #1 - -(#0.now(new x10.lang.Activity() { - public void runX10Task$() { - #1 - } -}); - +x10.runtime.Runtime.runNow( + new x10.runtime.Activity() { + public void runX10Task$() { + #1 + } + }, #0); Modified: trunk/x10.compiler.p3/data/ateach.xcd =================================================================== --- trunk/x10.compiler.p3/data/ateach.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/ateach.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,18 +1,14 @@ -// SYNOPSIS: ateach (#0 #1 #2 : #3) clocked(#5) {#4} #6=locals #0=modifiers #1=type #2=var #7=unboxed type - +// SYNOPSIS: ateach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type { x10.lang.Dist #2__distCopy = #3; // make copy to avoid recomputation - for (java.util.Iterator<#7> #2__ = #2__distCopy.iterator(); - #2__.hasNext(); ) - { + for (java.util.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 - ((x10.lang.Place) #2__distCopy.apply$(#2)).runAsync - (new x10.lang.Activity(#5) { + x10.runtime.Runtime.runAsync( + new x10.runtime.Activity(#5) { public void runX10Task$() { #4 } - }); + }, #2__distCopy.apply$(#2)); } } - Modified: trunk/x10.compiler.p3/data/await.xcd =================================================================== --- trunk/x10.compiler.p3/data/await.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/await.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,22 +1,9 @@ -// SYNOPSIS: await (#0) #1=unique_id - -{ - - synchronized (x10.lang.Activity.here()) { - try { - x10.lang.Activity.here().threadBlockedNotification(); // Add a thread for current activity if needed - while (!(#0)) { - x10.lang.Activity.here().wait(); - } - } catch (java.lang.Throwable tmp#1) { - tmp#1.printStackTrace(); - x10.runtime.impl.java.Runtime.java.log(java.util.logging.Level.SEVERE, - "Unexpected exception during conditional atomic.", tmp#1); - throw new java.lang.RuntimeException(tmp#1); - } finally { - x10.lang.Activity.here().threadUnblockedNotification(); // Allow current thread to be used for other activities if needed - x10.lang.Activity.here().notifyAll(); - } +// SYNOPSIS: await (#0) #1=unique_id +x10.runtime.Runtime.lock(); +try { + while (!(#0)) { + x10.runtime.Runtime.await(); } +} finally { + x10.runtime.Runtime.release(); // unlock and notify } - Modified: trunk/x10.compiler.p3/data/cast_place.xcd =================================================================== --- trunk/x10.compiler.p3/data/cast_place.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/cast_place.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,2 +1,2 @@ // SYNOPSIS: (#2)((#0)@#1) #0=object #1=place #2=type -((#2) #1.placeCheck(#0)) +((#2) x10.runtime.Runtime.placeCheck(#1, #0)) \ No newline at end of file Modified: trunk/x10.compiler.p3/data/clock.xcd =================================================================== --- trunk/x10.compiler.p3/data/clock.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/clock.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,2 +1,2 @@ // SYNOPSIS: #0=clock -x10.lang.Activity.checkClockUse(#0) +#0 \ No newline at end of file Modified: trunk/x10.compiler.p3/data/clocked-loop.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,3 +1,2 @@ -// SYNOPSIS: #0=clock #1=unique_id -add(current#1.checkClockUse(#0)); - +// SYNOPSIS: #0=clock #1=unique_id +add(#0); Modified: trunk/x10.compiler.p3/data/clocked.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/clocked.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,6 +1,4 @@ -// SYNOPSIS: clocked(#0) #1=unique_id -// SYNOPSIS: Elements are added to the list in an instance initializer +// SYNOPSIS: clocked(#0) #1=unique_id new java.util.LinkedList() {{ - x10.lang.Activity current#1 = x10.lang.Activity.current(); #0 }} Modified: trunk/x10.compiler.p3/data/finish.xcd =================================================================== --- trunk/x10.compiler.p3/data/finish.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/finish.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,13 +1,9 @@ -// SYNOPSIS: finish #0 #1=unique_id - -{ - x10.lang.Activity.current().startFinish(); - try { - #0 - } catch (java.lang.Throwable tmp#1) { - x10.lang.Activity.current().pushException(tmp#1); - } finally { - x10.lang.Activity.current().stopFinish(); - } +// SYNOPSIS: finish #0 #1=unique_id +x10.runtime.Runtime.startFinish(); +try { + #0 +} catch (java.lang.Throwable tmp#1) { + x10.runtime.Runtime.pushException(tmp#1); +} finally { + x10.runtime.Runtime.stopFinish(); } - Modified: trunk/x10.compiler.p3/data/foreach.xcd =================================================================== --- trunk/x10.compiler.p3/data/foreach.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/foreach.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,13 +1,11 @@ -// SYNOPSIS: foreach (#0 #1 #2 : #3) clocked(#5) {#4} #6=locals #0=modifiers #1=type #2=var #7=unboxed type - -for (java.util.Iterator #2__ = (#3).iterator(); #2__.hasNext(); ) { - #0 #1 #2 = (#7) #2__.next(); +// SYNOPSIS: foreach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type +for (java.util.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { + #0 #1 #2 = #2__.next(); #6 - x10.lang.Activity.here().runAsync - (new x10.lang.Activity(#5) { + x10.runtime.Runtime.runAsync( + new x10.runtime.Activity(#5) { public void runX10Task$() { #4 } - }); + }, x10.runtime.Runtime.here()); } - Modified: trunk/x10.compiler.p3/data/forloop.xcd =================================================================== --- trunk/x10.compiler.p3/data/forloop.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/forloop.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,7 +1,5 @@ -// SYNOPSIS: for (#0 #1 #2 : #3) #4 #0=modifiers #1=type #2=var #5=unboxed type - +// SYNOPSIS: for (#0 #2: #1 in #3) #4 #5=unboxed type for (java.util.Iterator #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = (#5) #2__.next(); #4 } - Modified: trunk/x10.compiler.p3/data/here.xcd =================================================================== --- trunk/x10.compiler.p3/data/here.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/here.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,2 +1,2 @@ // SYNOPSIS: here -x10.lang.Activity.here() \ No newline at end of file +x10.runtime.Runtime.here() \ No newline at end of file Modified: trunk/x10.compiler.p3/data/next.xcd =================================================================== --- trunk/x10.compiler.p3/data/next.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/next.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,3 +1,2 @@ // SYNOPSIS: next; -x10.lang.Activity.current().next(); - +x10.runtime.Runtime.next(); Modified: trunk/x10.compiler.p3/data/place-check.xcd =================================================================== --- trunk/x10.compiler.p3/data/place-check.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/place-check.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,6 +1,6 @@ // SYNOPSIS: (#0)((#1)@here) #0=type #1=object -- wrap in Object to help javac new java.lang.Object() { #0 eval(#0 it) { - return (#0) x10.lang.Activity.here().placeCheck(it); + return (#0) x10.runtime.Runtime.placeCheck(x10.runtime.Runtime.here(), it); } }.eval(#1) Modified: trunk/x10.compiler.p3/data/when-branch.xcd =================================================================== --- trunk/x10.compiler.p3/data/when-branch.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/when-branch.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,8 +1,6 @@ -// SYNOPSIS: or (#0) #1 #2=optional-break - - // another when branch - if (#0) { - #1 - #2 - } - +// SYNOPSIS: or (#0) #1 #2=optional-break + // another when branch + if (#0) { + #1 + #2 + } Modified: trunk/x10.compiler.p3/data/when.xcd =================================================================== --- trunk/x10.compiler.p3/data/when.xcd 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.compiler.p3/data/when.xcd 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,25 +1,15 @@ -// SYNOPSIS: when (#0) #1 #2=optional-break #3=loop-over-branches #4=unique_id - -synchronized (x10.lang.Activity.here()) { - try { - x10.lang.Activity.here().threadBlockedNotification(); // Add a thread for current activity if needed - while (true) { - // first when branch - if (#0) { - #1 - #2 - } - #3 - x10.lang.Activity.here().wait(); +// SYNOPSIS: when (#0) #1 #2=optional-break #3=loop-over-branches #4=unique_id +x10.runtime.Runtime.lock(); +try { + while (true) { + // first when branch + if (#0) { + #1 + #2 } - } catch (java.lang.Throwable tmp#4) { - tmp#4.printStackTrace(); - x10.runtime.impl.java.Runtime.java.log(java.util.logging.Level.SEVERE, - "Unexpected exception during conditional atomic.", tmp#4); - throw new java.lang.RuntimeException(tmp#4); - } finally { - x10.lang.Activity.here().threadUnblockedNotification(); // Allow current thread to be used for other activities if needed - x10.lang.Activity.here().notifyAll(); + #3 + x10.runtime.Runtime.await(); } +} finally { + x10.runtime.Runtime.release(); // unlock and notify } - Modified: trunk/x10.runtime.17/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -8,27 +8,22 @@ package x10.core; -import x10.runtime.impl.java.X10Thread; +import x10.runtime.impl.java.Thread; // Base class of all X10 ref objects -- should be generated, but we need this class to get Box to compile. public class Ref { - public final int placeId; + public final Object place; public Ref() { - Thread t = Thread.currentThread(); - if (t instanceof X10Thread) { - placeId = ((X10Thread) t).getPlaceId(); - } else { - placeId = 0; - } + place = Thread.currentThread().place(); } - public final int placeId() { - return placeId; + public final Object place() { + return place; } - public final Integer placeId$() { - return placeId(); + public final Object place$() { + return place(); } public String toString$() { Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -11,11 +11,6 @@ import x10.runtime.util.ShowUsageNotification; public class Runtime { - public static JavaRuntime java; - - /* Pre-load the VMInterface class */ - static { VMInterface foo = null; } - public static void main(String[] args) { if (args.length == 0) { System.err.println("usage: java x10.runtime.Runtime MainClass [args]"); @@ -23,15 +18,12 @@ } try { String[] strippedArgs = Configuration.parseCommandLine(args); - java = new JavaRuntime(); loadAndInitLibs(); run(strippedArgs); } catch (ShowUsageNotification e) { Usage.usage(System.out, null); } catch (ConfigurationError e) { Usage.usage(System.err, e); - } catch (Exception e) { - Runtime.java.error("Unexpected Exception in X10 runtime.", e); } } @@ -41,48 +33,46 @@ private static void loadAndInitLibs() { if (null != Configuration.LOAD) { String[] libs = Configuration.LOAD.split(":"); - for (int i=libs.length-1;i>=0;i--) - System.loadLibrary(libs[i]); + for (int i=libs.length-1; i>=0; i--) System.loadLibrary(libs[i]); } } public static final int MAX_PLACES = Configuration.NUMBER_OF_LOCAL_PLACES; + + public static final int INIT_THREADS_PER_PLACE = Configuration.INIT_THREADS_PER_PLACE; + private static int exitCode = 0; + private static final Class[] STRING_ARRAYS = new Class[] { String[].class }; /** - * Instantiate and run the main activity + * Instantiate and run main activity */ private static void run(String[] strippedArgs) { - java.lang.Object[] args = { strippedArgs }; + // instantiation using reflection + Runnable r; try { - // instantiation using reflection + java.lang.Object[] args = { strippedArgs }; Class main = Class.forName(Configuration.MAIN_CLASS_NAME + "$Main"); - Runnable r = (Runnable) main.getDeclaredConstructor(STRING_ARRAYS).newInstance(args); - if (Configuration.PRELOAD_CLASSES) + r = (Runnable) main.getDeclaredConstructor(STRING_ARRAYS).newInstance(args); + if (Configuration.PRELOAD_CLASSES) { PreLoader.preLoad(main, Configuration.PRELOAD_STRINGS); - // run the main activity - r.run(); + } } catch (Exception e) { System.err.println("Could not find default constructor of main class '" + Configuration.MAIN_CLASS_NAME + "$Main" + "'!"); throw new Error(e); } - exit(); - } - private static int exitCode = 0; + // run the main activity in its own thread + Thread t = new Thread(r, "main"); + t.start(); + try { t.join(); } catch (InterruptedException e) {} - public static void setExitCode(int code) { - exitCode = code; - } - - public static void exit() { System.exit(exitCode); } - public static void exit(int code) { - setExitCode(code); - exit(); + public static void setExitCode(int code) { + exitCode = code; } } Copied: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java (from rev 6596, trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java) =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java (rev 0) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -0,0 +1,47 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008 + * + * This file is part of X10 Language. + * + */ +package x10.runtime.impl.java; + +/** + * @author Christian Grothoff + * @author vj + * @author Raj Barik, Vivek Sarkar + * @author tardieu + */ +public class Thread extends java.lang.Thread { + public static Thread currentThread() { + return (Thread) java.lang.Thread.currentThread(); + } + + private Object place; // the current place + private Object activity; // the current activity + + public Thread(Runnable r) { + super(r); + } + + public Thread(Runnable r, String name) { + super(r, name); + } + + public void activity(Object activity) { + this.activity = activity; + } + + public Object activity() { + return activity; + } + + public void place(Object place) { + this.place = place; + } + + public Object place() { + return place; + } +} Property changes on: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10Thread.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,46 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime.impl.java; - -/** - * Thread in the thread pool that can be used to run multiple - * activities over time. - * - * @author Christian Grothoff - * @author vj - * @author Raj Barik, Vivek Sarkar - * 3/6/2006: replaced original PoolRunner by JCU implementation - * @author tardieu - */ -public class X10Thread extends Thread { - public static X10Thread currentThread() { - Thread t = Thread.currentThread(); - if (t instanceof X10Thread) return (X10Thread) t; - return null; // happens before main activity is spawned - } - - private final int placeId; - private Runnable runnable; // the activity currently executed - - X10Thread(ThreadGroup group, Runnable r, String name, int id) { - super(group, r, name, 0); - placeId = id; - } - - public void setRunnable(Runnable r) { - runnable = r; - } - - public Runnable getRunnable() { - return runnable; - } - - public int getPlaceId() { - return placeId; - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadFactory.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadFactory.java 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadFactory.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,40 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime.impl.java; - -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -/** - * X10 thread factory for JCU implementation. - * @author Raj Barik, Vivek Sarkar -- 3/6/2006 - * @tardieu - */ -public class X10ThreadFactory implements ThreadFactory { - private final int placeId; - private final ThreadGroup group; - private final AtomicInteger threadNumber = new AtomicInteger(0); - private final String namePrefix; - - public X10ThreadFactory(int placeId) { - SecurityManager s = System.getSecurityManager(); - group = (s != null)? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); - namePrefix = "pool-" + placeId + "-thread-"; - this.placeId = placeId; - } - - public Thread newThread(final Runnable workerRunnable) { - final int x = threadNumber.getAndIncrement(); - String threadName = namePrefix + x; - Runnable r = VMInterface.mapPoolThreadToCPU(workerRunnable, placeId, x, threadName); - Thread t = new X10Thread(group, r, threadName, placeId); - if (t.isDaemon()) t.setDaemon(false); - if (t.getPriority() != Thread.NORM_PRIORITY) t.setPriority(Thread.NORM_PRIORITY); - return t; - } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadPoolExecutor.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadPoolExecutor.java 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/X10ThreadPoolExecutor.java 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,71 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime.impl.java; - -import java.util.concurrent.*; - -/** - * @author Raj Barik, Vivek Sarkar - * 3/6/2006: extension of JCU ThreadPoolExecutor to allow for adding threads to the pool based on the - * number of X10 activities that are blocked. - * @tardieu - */ - -public class X10ThreadPoolExecutor extends ThreadPoolExecutor { - - private int nbThreadBlocked = 0; - - public X10ThreadPoolExecutor ( int placeId ) { - super ( Configuration.INIT_THREADS_PER_PLACE, - Configuration.INIT_THREADS_PER_PLACE, - 1000L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<Runnable> (), - new X10ThreadFactory (placeId)); - prestartAllCoreThreads(); - } - - /** Should it be atomic? - * Call this method when you are blocked on finish, force, next*/ - - public synchronized void increasePoolSize () { - if(++nbThreadBlocked >= getCorePoolSize()) { - setCorePoolSize ( getCorePoolSize() + 1 ); - setMaximumPoolSize ( getMaximumPoolSize () + 1); - } - } - - - /** - * Call this method when you are out of the blocked operation - */ - - public synchronized void decreasePoolSize () { - --nbThreadBlocked; - // TODO this code is likely to crash some non regression test - // setCorePoolSize ( getCorePoolSize () - 1 ); - // setMaximumPoolSize ( getMaximumPoolSize () - 1); - } - - - /** - * Call this method to check the size of the queue - */ - public int queueSize() { - return getQueue().size(); - } - - /** TODO */ - public void beforeExecute (Thread t, Runnable r) { - super.beforeExecute(t,r); - } - - /** TODO */ - public void afterExecute (Runnable r, Throwable t) { - super.afterExecute(r,t); - } -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,226 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -import x10.compiler.Native; -import x10.compiler.NativeRep; - -import x10.runtime.kernel.InterruptedException; -import x10.runtime.kernel.Runnable; - -/** - * The representation of an X10 async activity. - * Note that an Activity object is created by a different thread than the one that executes it. - * @author Christian Grothoff, Christoph von Praun, vj - * @author Raj Barik, Vivek Sarkar - * @author tardieu - */ -public abstract class Activity(name: String) implements Runnable { - /** - * The FinishState of this activity. - */ - private var finishState: FinishState; - - /** - * The finishStack is lazily created. - */ - private var finishStack: Stack[FinishState]; - - /** - * The clock phases of this activity. Lazily created. - */ - private var clocks: Clocks; - - // native threads - - @NativeRep("java", "x10.runtime.impl.java.X10Thread") - private static class Thread { - @Native("java", "java.lang.Thread.sleep(#1)") - native static def sleep(millis: long): void throws InterruptedException; - - @Native("java", "x10.runtime.impl.java.X10Thread.currentThread()") - native static def currentThread(): Thread; - - @Native("java", "#0.getRunnable()") - native def getRunnable(): Runnable; - - @Native("java", "#0.getPlaceId()") - native def getPlaceId(): nat; - - @Native("java", "#0.setRunnable(#1)") - native def setRunnable(r: Runnable): void; - } - - /** - * Return the activity being executed by the current thread. - */ - public static def current(): Activity { - return Thread.currentThread().getRunnable() as Activity; - } - - /** - * The place at which the current activity is running. - */ - public static def here(): Place { - val th = Thread.currentThread(); - if (null == th) return Place.place(0); - return Place.place(th.getPlaceId()); - } - - // clocks - - /** - * The clocks of the current activity. - */ - def clocks(): Clocks { - if (null == clocks) clocks = new Clocks(); - return clocks; - } - - /** - * Next statement = next on all clocks in parallel. - */ - public def next(): void { - if (null != clocks) clocks.next(); - } - - /** - * @deprecated - */ - public static def checkClockUse(c: Clock): Clock { - return c; - } - - // constructors - - /** - * Create an activity. - */ - public def this(name: String) { - property(name); - } - - public def this() { - this(""); - } - - /** - * Create an activity with the given list of clocks. - */ - public def this(list: x10.lang.List[Clock], name: String) { - this(name); - clocks = new Clocks(); - clocks.register(list); - } - - public def this(list: x10.lang.List[Clock]) { - this(list, ""); - } - - /** - * Create an activity with the given clock. - */ - public def this(clock: Clock, name: String) { - this(name); - clocks = new Clocks(); - clocks.register(clock); - } - - public def this(clock: Clock) { - this(clock, ""); - } - - // runnable - - /** - * Implemented by X10 activities, actual activity "user" code - * generated by xcd templates. - */ - public abstract def runX10Task(): void throws Throwable; - - /** - * Default implementation of the Runnable interface. - * An Activity executing in a place should always be invoked using it's runnable interface, - * and not directly by calling it's runX10Task method; which is an abstract method in this class. - * This run method allows performing actions before and after activity execution allowing - * to submit the activity safely as regard to runtime and pool thread. - */ - public def run(): void { - // Binding current thread to this activity - Thread.currentThread().setRunnable(this); - try { - runX10Task(); - } catch (t: Throwable) { - pushException(t); - } - if (null != clocks) clocks.drop(); - finishState.notifySubActivityTermination(); - } - - // finish state - - public def finishState(): FinishState { - return finishState; - } - - public def finishState(state: FinishState): void { - finishState = state; - state.notifySubActivitySpawn(); - } - - /** - * Start executing this activity synchronously - * (i.e. within a finish statement). - */ - public def startFinish(): void { - if (null == finishStack) finishStack = new Stack[FinishState](); - finishStack.push(finishState); - finishState = new FinishState(); - } - - /** - * Suspend until all activities spawned during this finish - * operation have terminated. Throw an exception if any - * async terminated abruptly. Otherwise continue normally. - * Should only be called by the thread executing the current activity. - */ - public def stopFinish(): void { - val state = finishState; - finishState = finishStack.pop(); - state.waitForFinish(); - } - - /** - * Push the exception thrown while executing s in a finish s, - * onto the finish state. - */ - public def pushException(t: Throwable): void { - finishState.pushException(t); - } - - // utilities - - /** - * Sleep for the specified number of milliseconds. - * [IP] NOTE: Unlike Java, x10 sleep() simply exits when interrupted. - * @param millis the number of milliseconds to sleep - * @return true if completed normally, false if interrupted - */ - public static def sleep(millis: long): boolean { - try { - here().threadBlockedNotification(); - Thread.sleep(millis); - return true; - } catch (e: InterruptedException) { - return false; - } finally { - here().threadUnblockedNotification(); - } - } -} Modified: trunk/x10.runtime.17/src-x10/x10/lang/Clock.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Clock.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Clock.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -11,86 +11,22 @@ /** * @author tardieu */ -public value Clock(name: String) { - private val state = new ClockState(); - - private static def abs(z: int): int { - return (z<0) ? -z : z; - } +public abstract value Clock(name: String) { + public static def make(): Clock = make(""); - public static def make(): Clock { - return make(""); - } - - public static def make(name: String): Clock { - return new Clock(name); - } + public static def make(name: String): Clock = new x10.runtime.Clock_c(name); - private def this(name: String): Clock { - property(name); - Activity.current().clocks().put(this, ClockState.FIRST_PHASE); - } + protected def this(name: String) = property(name); - public def registered(): boolean { - return Activity.current().clocks().containsKey(this); - } + public abstract def registered(): boolean; - public def dropped(): boolean { - return !registered(); - } + public abstract def dropped(): boolean; - public def resume(): void { - if (dropped()) throw new ClockUseException(); - val ph = Activity.current().clocks()(this); - if (ph < 0) throw new ClockUseException(); - finish async (state) state.resume(); - Activity.current().clocks().put(this, -ph); - } + public abstract def resume(): void; - public def next(): void { - if (dropped()) throw new ClockUseException(); - _next(); - } + public abstract def next(): void; - public def phase(): int { - if (dropped()) throw new ClockUseException(); - return abs(Activity.current().clocks()(this)); - } - - public def drop(): void { - if (dropped()) throw new ClockUseException(); - val ph = Activity.current().clocks().remove(this); - async (state) state.drop(ph); - } - - public def hashCode(): int { - return state.hashCode(); - } - - // methods called by the Activity object - - def _register(clocks: Clocks): void { - if (dropped()) throw new ClockUseException(); - val ph = Activity.current().clocks()(this); - finish async (state) state.register(ph); - clocks.put(this, ph); - } + public abstract def phase(): int; - def _resume(): void { - val ph = Activity.current().clocks()(this); - if (ph < 0) return; - finish async (state) state.resume(); - Activity.current().clocks().put(this, -ph); - } - - def _next(): void { - val ph = Activity.current().clocks()(this); - finish async (state) state.next(ph); - Activity.current().clocks().put(this, abs(ph) + 1); - } - - def _drop(): void { - val ph = Activity.current().clocks()(this); - async (state) state.drop(ph); - } -} \ No newline at end of file + public abstract def drop(): void; +} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/ClockState.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/ClockState.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/ClockState.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,48 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -/** - * @author tardieu - */ -class ClockState { - static val FIRST_PHASE = 1; - - private var count: int = 1; - private var alive: int = 1; - private var phase: int = FIRST_PHASE; - - atomic def register(ph: int): void { - ++count; - if (-ph != phase) ++alive; - } - - atomic def resume(): void { - if (--alive == 0) { - alive = count; - ++phase; - } - } - - def next(ph: int): void { - val abs: int; - if (ph < 0) { - abs = -ph; - } else { - resume(); - abs = ph; - } - await (abs < phase); - } - - atomic def drop(ph: int): void { - --count; - if (-ph != phase) resume(); - } -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/Clocks.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Clocks.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Clocks.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,31 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -/** - * @author tardieu - */ -class Clocks extends HashMap[Clock,int] { - def register(clock: Clock): void { - clock._register(this); - } - - def register(list: x10.lang.List[Clock]): void { - for(clock: Clock in list) register(clock); - } - - def next(): void { - for(clock: Clock in keySet()) clock._resume(); - for(clock: Clock in keySet()) clock._next(); - } - - def drop(): void { - for(clock: Clock in keySet()) clock._drop(); - } -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/FinishState.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/FinishState.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/FinishState.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,79 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -/** The state associated with a finish operation. Records the count of - * active activities associated with this finish, and the stack - * of exceptions thrown by activities associated with this finish that - * have already terminated abruptly. An activity maintains a stack of FinishStates. - * - * @author vj May 17, 2005 - * @author Raj Barik, Vivek Sarkar - * 3/6/2006: use ModCountDownLatch (modified version of JCU CountDownLatch) instead of synchronized updates to finishCount. - * @author tardieu - */ -public class FinishState { - - /** - * The Exception Stack is used to collect exceptions - * issued when activities associated with this finish state terminate abruptly. - * This Object is lazily created - **/ - private var exceptions: Stack[Throwable]; - - /** Keep track of current number of activities associated with this finish state **/ - private val latch = new ModCountDownLatch(0); - - /** - * This method returns only when all spawned activity registered with this - * FinishState have terminated either normally or abruptly. - */ - public def waitForFinish(): void { - latch.await(); - if ((null != exceptions) && !exceptions.empty()) { - if (exceptions.size() == 1) { - val t = exceptions.pop(); - if (t instanceof Error) { - throw t as Error; - } - if (t instanceof RuntimeException) { - throw t as RuntimeException; - } - assert false as boolean; - } - throw new MultipleExceptions(exceptions); - } - } - - /** - * An activity created under this finish has been created. Increment the count - * associated with the finish. - */ - public def notifySubActivitySpawn(): void { - latch.updateCount(); - } - - /** - * An activity created under this finish has terminated. Decrement the count - * associated with the finish and notify the parent activity if it is waiting. - */ - public def notifySubActivityTermination(): void { - latch.countDown(); - } - - /** - * Push an exception onto the stack. Do not decrement - * finishCount --- this exception was thrown by - * inline code, not a spawned activity. - */ - public atomic def pushException(t: Throwable): void { - if (null == exceptions) exceptions = new Stack[Throwable](); - exceptions.push(t); - } -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/Future_c.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Future_c.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Future_c.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,76 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -/** - * This class encapsulates the return value of a local async - * call and allows the client to wait for the completion of the - * async call (force future). - * - * @author Christian Grothoff - * @author Christoph von Praun - * @author vj - * @author Raj Barik, Vivek Sarkar - * @author tardieu - */ -public abstract class Future_c[T] extends Activity implements Future[T] { - /** - * Set if the activity terminated with an exception. - * Can only be of type Error or RuntimeException - * (since X10 only has unchecked exceptions). - */ - private var exception: Box[Throwable]; - - private var result: T; - - /** - * CountDownLatch for signaling and wait -- can be replaced by a boolean latch - */ - private val cdl = new ModCountDownLatch(1); - - public def apply(): T { - return force(); - } - - public def force(): T { - cdl.await(); - if (exception !=null) { - val e = exception to Throwable; - if (e instanceof Error) - throw e as Error; - if (e instanceof RuntimeException) - throw e as RuntimeException; - assert false as boolean; - } - return result; - } - - public def forced(): boolean { - return cdl.getCount() == 0; - } - - public abstract def eval(): T; - - public def runX10Task(): void { - try { - startFinish(); - try { - result = eval(); - } catch (t: Throwable) { - pushException(t); - } - stopFinish(); - } catch (t: Throwable) { - // Now nested asyncs have terminated. - exception = t to Box[Throwable]; - } finally { - cdl.countDown(); - } - } -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/HashMap.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/HashMap.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/HashMap.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,38 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -import x10.compiler.Native; -import x10.compiler.NativeRep; - -@NativeRep("java", "x10.runtime.impl.java.NativeHashMap<#1,#2>") -public class HashMap[K,V] implements Map[K,V] { - public native def this(); - - @Native("java", "#0.containsKey(#1)") - public native def containsKey(k: K): boolean; - - @Native("java", "#0.get(#1)") - public native def apply(k: K): V; - - @Native("java", "#0.get(#1)") - public native def get(k: K): V; - - @Native("java", "#0.put(#1, #2)") - public native def put(k: K, v: V): void; - - @Native("java", "#0.remove(#1)") - public native def remove(k: K): V; - - @Native("java", "#0.keySet()") - public native def keySet(): Set[K]; - - @Native("java", "#0.clear()") - public native def clear(): void; -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/List.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/List.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/List.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,14 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -import x10.compiler.NativeRep; - -@NativeRep("java", "java.util.List<#1>") -public interface List[T] {} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/Map.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Map.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Map.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,18 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -public interface Map[K,V] extends (K)=>V { - public def containsKey(k: K): boolean; - public def get(k: K): V; - public def put(k: K, v: V): void; - public def remove(k: K): V; - public def keySet(): Set[K]; - public def clear(): void; -} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/ModCountDownLatch.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/ModCountDownLatch.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/ModCountDownLatch.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,58 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -import x10.runtime.kernel.Lock; -import x10.runtime.kernel.NativeThread; - -public class ModCountDownLatch { - private var count: nat; - private val lock = new Lock(); - private val stack = new Stack[NativeThread](); - - public def this(count: nat) { - if (count < 0) throw new IllegalArgumentException("count < 0 in ModCountDownLatch"); - this.count = count; - } - - public def updateCount(): void { - lock.lock(); - count += 1; - lock.unlock(); - } - - public def countDown(): void { - lock.lock(); - if (count > 0) { - --count; - if (count == 0) { - for(th: NativeThread in stack) NativeThread.unpark(th); - // no need to clear the stack; the latch is now dead. - } - } - lock.unlock(); - } - - public def await(): void { - lock.lock(); - if (count > 0) { - stack.push(NativeThread.currentThread()); - lock.unlock(); - here.threadBlockedNotification(); - while (count > 0) NativeThread.park(); - here.threadUnblockedNotification(); - } else { - lock.unlock(); - } - } - - public def getCount(): nat { - return count; - } -} Modified: trunk/x10.runtime.17/src-x10/x10/lang/MultipleExceptions.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/MultipleExceptions.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/MultipleExceptions.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -8,6 +8,8 @@ package x10.lang; +import x10.util.Stack; + /** * @author Christian Grothoff * @author tardieu Modified: trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -8,126 +8,33 @@ package x10.lang; -import x10.compiler.Native; -import x10.compiler.NativeRep; - -import x10.runtime.kernel.Runnable; - /** * @author Christian Grothoff * @author Raj Barik, Vivek Sarkar * @author tardieu */ -public value Place(id: nat) { - //TODO hashCode and equals methods - //TODO place check/place-cast of null? - - public const MAX_PLACES = Runtime.MAX_PLACES; +public final value Place(id: nat) { + public const MAX_PLACES = x10.runtime.kernel.Runtime.MAX_PLACES; public const places = Rail.makeVal[Place](MAX_PLACES, ((id: nat) => new Place(id))); public const FIRST_PLACE = place(0); - // native thread pools + private def this(id: nat) = property(id); - @NativeRep("java", "x10.runtime.impl.java.X10ThreadPoolExecutor") - private static class Executor { - native def this(placeId: int); - - @Native("java", "#0.increasePoolSize()") - native def increasePoolSize(): void; - - @Native("java", "#0.decreasePoolSize()") - native def decreasePoolSize(): void; - - @Native("java", "#0.execute(#1)") - native def execute(r: Runnable): void; - } - - /** - * Executor Service which provides the thread pool - */ - private val executor: Executor; + public static def place(id: nat): Place = places(id); - public def threadBlockedNotification(): void { - executor.increasePoolSize(); - } + public def next(): Place = next(1); - public def threadUnblockedNotification(): void { - executor.decreasePoolSize(); - } + public def prev(): Place = next(-1); - // constructor - - private def this(id: nat) { - property(id); - executor = new Executor(id); - } - - // running activities - - public static def runMain(activity: Activity): void { - try { - val state = new FinishState(); - activity.finishState(state); - FIRST_PLACE.executor.execute(activity); - state.waitForFinish(); - } catch (t: Throwable) { - t.printStackTrace(); - } - } - - public def runAsync(activity: Activity): void { - activity.finishState(Activity.current().finishState()); - executor.execute(activity); - } - - //HACK code generation fails if method is not static - public static def runFuture[T](place: Place, future_c: Future_c[T]): Future[T] { - place.runAsync(future_c); - return future_c; - } - - // place arithmetics - - public static def place(id: nat): Place { - return Place.places(id); - } - - public def next(): Place { return next(1); } - - public def prev(): Place { return next(-1); } - - public def prev(i: int): Place { return next(-i); } + public def prev(i: int): Place = next(-i); public def next(i: int): Place { // -1 % n == -1, not n-1, so need to add n val k = (id + i % MAX_PLACES + MAX_PLACES) % MAX_PLACES; - return Place.place(k); + return place(k); } - public def isFirst(): boolean { - return id == 0; - } + public def isFirst(): boolean = id == 0; - public def isLast(): boolean { - return id == MAX_PLACES - 1; - } - - // locations - - private static def location(o: Object): Place { - if (o instanceof Ref) return (o as Ref).location; - return here; - } - - public static def asPlace(o: Object): Place { - if (o instanceof Place) return o as Place; - return location(o); - } - - public def placeCheck(o: Object): Object { -// if (null != o && location(o) != this) { -// throw new BadPlaceException("object=" + o + " access at place=" + this); -// } - return o; - } + public def isLast(): boolean = id == MAX_PLACES - 1; } Modified: trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -16,7 +16,7 @@ */ @NativeRep("java", "x10.core.Ref") public class Ref( - @Native("java", "x10.lang.Place.place(#0.placeId())") + @Native("java", "(x10.lang.Place) #0.place()") location: Place) { public native def this(); Modified: trunk/x10.runtime.17/src-x10/x10/lang/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Runtime.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Runtime.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -8,23 +8,21 @@ package x10.lang; -import x10.compiler.Native; -import x10.compiler.NativeRep; - -@NativeRep("java", "x10.runtime.impl.java.Runtime") +/** + * @author tardieu + */ public value Runtime { - // HACK to handle sleep calls - @Native("java", "x10.lang.Activity.sleep(#1)") - public native static def sleep(millis: long): boolean; + /** + * Sleep for the specified number of milliseconds. + * [IP] NOTE: Unlike Java, x10 sleep() simply exits when interrupted. + * @param millis the number of milliseconds to sleep + * @return true if completed normally, false if interrupted + */ + public static def sleep(millis: long): boolean { + return x10.runtime.Runtime.sleep(millis); + } - @Native("java", "x10.runtime.impl.java.Runtime.exit(#1)") - public native static def exit(code: int): void; - - @Native("java", "x10.runtime.impl.java.Runtime.setExitCode(#1)") - public native static def setExitCode(code: int): void; - - @Native("java", "x10.runtime.impl.java.Runtime.MAX_PLACES") - public const MAX_PLACES: int = dummy(); - - private incomplete static def dummy(): int; -} + public static def setExitCode(code: int): void { + x10.runtime.kernel.Runtime.setExitCode(code); + } +} Deleted: trunk/x10.runtime.17/src-x10/x10/lang/Stack.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Stack.x10 2008-11-02 16:29:44 UTC (rev 6610) +++ trunk/x10.runtime.17/src-x10/x10/lang/Stack.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -1,29 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.lang; - -import x10.compiler.Native; -import x10.compiler.NativeRep; - -@NativeRep("java", "x10.runtime.impl.java.NativeStack<#1>") -public class Stack[T] { - public native def this(); - - @Native("java", "#0.push(#1)") - public native def push(t: T): void; - - @Native("java", "#0.pop()") - public native def pop(): T; - - @Native("java", "#0.isEmpty()") - public native def empty(): boolean; - - @Native("java", "#0.size()") - public native def size(): int; -} Copied: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 (from rev 6596, trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10) =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 (rev 0) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -0,0 +1,163 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008. + * + * This file is part of X10 Language. + * + */ + +package x10.runtime; + +import x10.util.List; +import x10.util.Stack; + +/** + * The representation of an X10 async activity. + * Note that an Activity object is created by a different thread than the one that executes it. + * @author Christian Grothoff, Christoph von Praun, vj + * @author Raj Barik, Vivek Sarkar + * @author tardieu + */ +public abstract class Activity(name: String) { + /** + * The FinishState of this activity. + */ + private var finishState: FinishState; + + /** + * The finishStack is lazily created. + */ + private var finishStack: Stack[FinishState]; + + /** + * The clock phases of this activity. Lazily created. + */ + private var clocks: Clocks; + + /** + * The clocks of the current activity. + */ + def clocks(): Clocks { + if (null == clocks) clocks = new Clocks(); + return clocks; + } + + /** + * Next statement = next on all clocks in parallel. + */ + def next(): void { + if (null != clocks) clocks.next(); + } + + // public constructors + + /** + * Create an activity. + */ + public def this(name: String) { + property(name); + } + + public def this() { + this(""); + } + + /** + * Create an activity with the given list of clocks. + */ + public def this(list: List[Clock], name: String) { + this(name); + clocks = new Clocks(); + clocks.register(list); + } + + public def this(list: List[Clock]) { + this(list, ""); + } + + /** + * Create an activity with the given clock. + */ + public def this(clock: Clock, name: String) { + this(name); + clocks = new Clocks(); + clocks.register(clock); + } + + public def this(clock: Clock) { + this(clock, ""); + } + + // runnable + + /** + * Implemented by X10 activities, actual activity "user" code + * generated by xcd templates. + */ + public abstract def runX10Task(): void throws Throwable; + + /** + * Default implementation of the Runnable interface. + * An Activity executing in a place should always be invoked using it's runnable interface, + * and not directly by calling it's runX10Task method; which is an abstract method in this class. + * This run method allows performing actions before and after activity execution allowing + * to submit the activity safely as regard to runtime and pool thread. + */ + def run(): void { + try { + runX10Task(); + } catch (t: Throwable) { + pushException(t); + } + if (null != clocks) clocks.drop(); + finishState.notifySubActivityTermination(); + } + + // finish state + + /** + * Return the finish state of the current activity + */ + def finishState(): FinishState { + return finishState; + } + + /** + * Set the root finish state of the current activity + * Notify the finish state of a spawned activity + */ + def finishState(state: FinishState): void { + finishState = state; + state.notifySubActivitySpawn(); + } + + /** + * Start executing this activity synchronously + * (i.e. within a finish statement). + */ + def startFinish(): void { + if (null == finishStack) finishStack = new Stack[FinishState](); + finishStack.push(finishState); + finishState = new FinishState(); + } + + /** + * Suspend until all activities spawned during this finish + * operation have terminated. Throw an exception if any + * async terminated abruptly. Otherwise continue normally. + * Should only be called by the thread executing the current activity. + */ + def stopFinish(): void { + val state = finishState; + finishState = finishStack.pop(); + state.waitForFinish(); + } + + /** + * Push the exception thrown while executing s in a finish s, + * onto the finish state. + */ + def pushException(t: Throwable): void { + finishState.pushException(t); + } +} Property changes on: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + native Copied: trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 (from rev 6596, trunk/x10.runtime.17/src-x10/x10/lang/ClockState.x10) =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 (rev 0) +++ trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 2008-11-03 00:26:46 UTC (rev 6611) @@ -0,0 +1,48 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008. + * + * This file is part of X10 Language. + * + */ + +package x10.runtime; + +/** + * @author tardieu + */ +class ClockState { + static val FIRST_PHASE = 1; + + private var count: int = 1; + private var alive: int = 1; + private var phase: int = FIRST_PHASE; + + atomic def register(ph: int): void { + ++count; + if (-ph != phase) ++alive; + } + + atomic def resume(): void { + if (--alive == 0) { + alive = count; + ++phase; + } + } + + def next(ph: int): void { + val abs: int; + if (ph < 0) { + abs = -ph; + } else { + resume(); + abs = ph; + } + await (abs... [truncated message content] |
From: <njn...@us...> - 2008-11-05 20:00:55
|
Revision: 6636 http://x10.svn.sourceforge.net/x10/?rev=6636&view=rev Author: njnystrom Date: 2008-11-05 20:00:48 +0000 (Wed, 05 Nov 2008) Log Message: ----------- Fixed bug in code generation for Box[T]. Now, a Java class is generated for every Box[T] where T is a Value. Added Boxed versions to the Java native code. Added boxed class and RTT class to NativeRep annotation. boxed class can be null for Ref classes. Removed '$' methods from Java classes. Started implementation of collections: ArrayList, Iterator, HashMap, HashSet. Native version of Random. Modified Paths: -------------- trunk/x10.compiler.p3/data/Async.xcd trunk/x10.compiler.p3/data/Future.xcd trunk/x10.compiler.p3/data/Main.xcd trunk/x10.compiler.p3/data/Now.xcd trunk/x10.compiler.p3/data/array_get.xcd trunk/x10.compiler.p3/data/array_get_noplacecheck.xcd trunk/x10.compiler.p3/data/ateach.xcd trunk/x10.compiler.p3/data/foreach.xcd trunk/x10.compiler.p3/data/forloop.xcd trunk/x10.compiler.p3/data/rail_set.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/CheckNativeAnnotationsVisitor.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime.17/src-java/x10/core/AnyRail.java trunk/x10.runtime.17/src-java/x10/core/Box.java trunk/x10.runtime.17/src-java/x10/core/Rail.java trunk/x10.runtime.17/src-java/x10/core/RailFactory.java trunk/x10.runtime.17/src-java/x10/core/Ref.java trunk/x10.runtime.17/src-java/x10/core/Settable.java trunk/x10.runtime.17/src-java/x10/core/ValRail.java trunk/x10.runtime.17/src-java/x10/core/Value.java trunk/x10.runtime.17/src-java/x10/core/fun/Fun_0_0.java trunk/x10.runtime.17/src-java/x10/core/fun/Fun_0_1.java trunk/x10.runtime.17/src-java/x10/core/fun/Fun_0_2.java trunk/x10.runtime.17/src-java/x10/core/fun/Fun_0_3.java trunk/x10.runtime.17/src-java/x10/core/fun/VoidFun_0_0.java trunk/x10.runtime.17/src-java/x10/core/fun/VoidFun_0_1.java trunk/x10.runtime.17/src-java/x10/core/fun/VoidFun_0_2.java trunk/x10.runtime.17/src-java/x10/core/fun/VoidFun_0_3.java trunk/x10.runtime.17/src-java/x10/types/BooleanType.java trunk/x10.runtime.17/src-java/x10/types/ByteType.java trunk/x10.runtime.17/src-java/x10/types/CharType.java trunk/x10.runtime.17/src-java/x10/types/ConstrainedType.java trunk/x10.runtime.17/src-java/x10/types/DoubleType.java trunk/x10.runtime.17/src-java/x10/types/FloatType.java trunk/x10.runtime.17/src-java/x10/types/IntType.java trunk/x10.runtime.17/src-java/x10/types/LongType.java trunk/x10.runtime.17/src-java/x10/types/RuntimeType.java trunk/x10.runtime.17/src-java/x10/types/ShortType.java trunk/x10.runtime.17/src-java/x10/types/Type.java trunk/x10.runtime.17/src-x10/x10/compiler/NativeRep.x10 trunk/x10.runtime.17/src-x10/x10/lang/ArithmeticException.x10 trunk/x10.runtime.17/src-x10/x10/lang/ArrayIndexOutOfBoundsException.x10 trunk/x10.runtime.17/src-x10/x10/lang/Boolean.x10 trunk/x10.runtime.17/src-x10/x10/lang/Byte.x10 trunk/x10.runtime.17/src-x10/x10/lang/Char.x10 trunk/x10.runtime.17/src-x10/x10/lang/ClassCastException.x10 trunk/x10.runtime.17/src-x10/x10/lang/Dist.x10 trunk/x10.runtime.17/src-x10/x10/lang/Double.x10 trunk/x10.runtime.17/src-x10/x10/lang/Error.x10 trunk/x10.runtime.17/src-x10/x10/lang/Exception.x10 trunk/x10.runtime.17/src-x10/x10/lang/Float.x10 trunk/x10.runtime.17/src-x10/x10/lang/IllegalArgumentException.x10 trunk/x10.runtime.17/src-x10/x10/lang/Indexable.x10 trunk/x10.runtime.17/src-x10/x10/lang/Int.x10 trunk/x10.runtime.17/src-x10/x10/lang/Iterable.x10 trunk/x10.runtime.17/src-x10/x10/lang/Iterator.x10 trunk/x10.runtime.17/src-x10/x10/lang/Long.x10 trunk/x10.runtime.17/src-x10/x10/lang/Math.x10 trunk/x10.runtime.17/src-x10/x10/lang/MultipleExceptions.x10 trunk/x10.runtime.17/src-x10/x10/lang/NullPointerException.x10 trunk/x10.runtime.17/src-x10/x10/lang/NumberFormatException.x10 trunk/x10.runtime.17/src-x10/x10/lang/Object.x10 trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 trunk/x10.runtime.17/src-x10/x10/lang/RuntimeException.x10 trunk/x10.runtime.17/src-x10/x10/lang/Settable.x10 trunk/x10.runtime.17/src-x10/x10/lang/Short.x10 trunk/x10.runtime.17/src-x10/x10/lang/String.x10 trunk/x10.runtime.17/src-x10/x10/lang/System.x10 trunk/x10.runtime.17/src-x10/x10/lang/Throwable.x10 trunk/x10.runtime.17/src-x10/x10/lang/ValRail.x10 trunk/x10.runtime.17/src-x10/x10/lang/Value.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/InterruptedException.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Lock.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runnable.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicBoolean.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicInteger.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicIntegerFieldUpdater.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicLong.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicLongFieldUpdater.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicReference.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/atomics/AtomicReferenceFieldUpdater.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/Closure.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/Frame.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/Job.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/StealAbort.x10 trunk/x10.runtime.17/src-x10/x10/runtime/xws/XWSWorker.x10 trunk/x10.runtime.17/src-x10/x10/util/ArrayList.x10 trunk/x10.runtime.17/src-x10/x10/util/HashMap.x10 trunk/x10.runtime.17/src-x10/x10/util/List.x10 trunk/x10.runtime.17/src-x10/x10/util/Map.x10 trunk/x10.runtime.17/src-x10/x10/util/Random.x10 trunk/x10.runtime.17/src-x10/x10/util/Set.x10 trunk/x10.runtime.17/src-x10/x10/util/Stack.x10 Added Paths: ----------- trunk/x10.runtime.17/src-java/x10/core/BoxInt.java trunk/x10.runtime.17/src-java/x10/core/BoxedBoolean.java trunk/x10.runtime.17/src-java/x10/core/BoxedByte.java trunk/x10.runtime.17/src-java/x10/core/BoxedChar.java trunk/x10.runtime.17/src-java/x10/core/BoxedDouble.java trunk/x10.runtime.17/src-java/x10/core/BoxedFloat.java trunk/x10.runtime.17/src-java/x10/core/BoxedInt.java trunk/x10.runtime.17/src-java/x10/core/BoxedLong.java trunk/x10.runtime.17/src-java/x10/core/BoxedShort.java trunk/x10.runtime.17/src-java/x10/core/BoxedString.java trunk/x10.runtime.17/src-java/x10/core/GrowableRail.java trunk/x10.runtime.17/src-java/x10/core/Iterable.java trunk/x10.runtime.17/src-java/x10/core/Iterator.java trunk/x10.runtime.17/src-java/x10/core/MultipleExceptions.java trunk/x10.runtime.17/src-java/x10/core/RailIterator.java trunk/x10.runtime.17/src-x10/x10/lang/Activity.x10 trunk/x10.runtime.17/src-x10/x10/lang/FinishState.x10 trunk/x10.runtime.17/src-x10/x10/lang/ModCountDownLatch.x10 trunk/x10.runtime.17/src-x10/x10/util/AbstractCollection.x10 trunk/x10.runtime.17/src-x10/x10/util/AbstractContainer.x10 trunk/x10.runtime.17/src-x10/x10/util/Builder.x10 trunk/x10.runtime.17/src-x10/x10/util/Collection.x10 trunk/x10.runtime.17/src-x10/x10/util/CollectionIterator.x10 trunk/x10.runtime.17/src-x10/x10/util/Container.x10 trunk/x10.runtime.17/src-x10/x10/util/GrowableRail.x10 trunk/x10.runtime.17/src-x10/x10/util/HashSet.x10 trunk/x10.runtime.17/src-x10/x10/util/Indexed.x10 trunk/x10.runtime.17/src-x10/x10/util/ListIterator.x10 trunk/x10.runtime.17/src-x10/x10/util/MapIterator.x10 trunk/x10.runtime.17/src-x10/x10/util/MapSet.x10 trunk/x10.runtime.17/src-x10/x10/util/RailBuilder.x10 trunk/x10.runtime.17/src-x10/x10/util/StringBuilder.x10 trunk/x10.runtime.17/src-x10/x10/util/ValRailBuilder.x10 Property Changed: ---------------- trunk/x10.runtime.17/src-x10/x10/util/ Modified: trunk/x10.compiler.p3/data/Async.xcd =================================================================== --- trunk/x10.compiler.p3/data/Async.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/Async.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,7 +1,7 @@ // SYNOPSIS: async(#0) clocked(#1) #2 x10.runtime.Runtime.runAsync( new x10.runtime.Activity(#1) { - public void runX10Task$() { + public void runX10Task() { #2 } }, #0); Modified: trunk/x10.compiler.p3/data/Future.xcd =================================================================== --- trunk/x10.compiler.p3/data/Future.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/Future.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,7 +1,7 @@ // SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 x10.runtime.Runtime.runFuture(#3, new x10.runtime.Future_c<#1>(#3) { - public #1 eval$() { + public #1 eval() { #2 } }, #0) Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -13,7 +13,7 @@ // run main activity x10.runtime.Runtime.runMain(new x10.runtime.Activity() { - public void runX10Task$() { + public void runX10Task() { main(rail); } }); Modified: trunk/x10.compiler.p3/data/Now.xcd =================================================================== --- trunk/x10.compiler.p3/data/Now.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/Now.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,7 +1,7 @@ // SYNOPSIS: now(#0) #1 x10.runtime.Runtime.runNow( new x10.runtime.Activity() { - public void runX10Task$() { + public void runX10Task() { #1 } }, #0); Modified: trunk/x10.compiler.p3/data/array_get.xcd =================================================================== --- trunk/x10.compiler.p3/data/array_get.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/array_get.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,2 +1,2 @@ // SYNOPSIS: #0[#1] : #2 -(#0).get$(#1) +(#0).get(#1) Modified: trunk/x10.compiler.p3/data/array_get_noplacecheck.xcd =================================================================== --- trunk/x10.compiler.p3/data/array_get_noplacecheck.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/array_get_noplacecheck.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,2 +1,2 @@ // SYNOPSIS: #0[#1] : #2 -(#0).get$(#1,false,true) +(#0).get(#1,false,true) Modified: trunk/x10.compiler.p3/data/ateach.xcd =================================================================== --- trunk/x10.compiler.p3/data/ateach.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/ateach.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,14 +1,14 @@ // SYNOPSIS: ateach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type { x10.lang.Dist #2__distCopy = #3; // make copy to avoid recomputation - for (java.util.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { + for (x10.core.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 x10.runtime.Runtime.runAsync( new x10.runtime.Activity(#5) { - public void runX10Task$() { + public void runX10Task() { #4 } - }, #2__distCopy.apply$(#2)); + }, #2__distCopy.apply(#2)); } } Modified: trunk/x10.compiler.p3/data/foreach.xcd =================================================================== --- trunk/x10.compiler.p3/data/foreach.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/foreach.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,10 +1,10 @@ // SYNOPSIS: foreach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type -for (java.util.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { +for (x10.core.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 x10.runtime.Runtime.runAsync( new x10.runtime.Activity(#5) { - public void runX10Task$() { + public void runX10Task() { #4 } }, x10.runtime.Runtime.here()); Modified: trunk/x10.compiler.p3/data/forloop.xcd =================================================================== --- trunk/x10.compiler.p3/data/forloop.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/forloop.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,5 +1,5 @@ // SYNOPSIS: for (#0 #2: #1 in #3) #4 #5=unboxed type -for (java.util.Iterator #2__ = (#3).iterator(); #2__.hasNext(); ) { +for (x10.core.Iterator #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = (#5) #2__.next(); #4 } Modified: trunk/x10.compiler.p3/data/rail_set.xcd =================================================================== --- trunk/x10.compiler.p3/data/rail_set.xcd 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/data/rail_set.xcd 2008-11-05 20:00:48 UTC (rev 6636) @@ -1,2 +1,2 @@ // SYNOPSIS: #0[#1] op= #2 #3=opString -(#0).set$((int) (#1), #2) +(#0).set((int) (#1), #2) Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/CheckNativeAnnotationsVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/CheckNativeAnnotationsVisitor.java 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/CheckNativeAnnotationsVisitor.java 2008-11-05 20:00:48 UTC (rev 6636) @@ -41,17 +41,17 @@ super(job, ts, nf); } - public Map<String, String> getNativeRep(X10ClassDef def) { + public Map<String, String> getNativeRepParam(X10ClassDef def, int i) { Map<String,String> map = new HashMap<String, String>(); try { X10TypeSystem xts = (X10TypeSystem) this.typeSystem(); Type rep = (Type) xts.systemResolver().find(QName.make("x10.compiler.NativeRep")); List<Type> as = def.annotationsMatching(rep); for (Type at : as) { - assertNumberOfInitializers(at, 2); + assertNumberOfInitializers(at, 4); String lang = getPropertyInit(at, 0); if (lang != null) { - String lit = getPropertyInit(at, 1); + String lit = getPropertyInit(at, i); map.put(lang, lit); } } @@ -60,6 +60,18 @@ return map; } + public Map<String, String> getNativeRep(X10ClassDef def) { + return getNativeRepParam(def, 1); + } + + public Map<String, String> getNativeBoxedRep(X10ClassDef def) { + return getNativeRepParam(def, 2); + } + + public Map<String, String> getNativeRTTRep(X10ClassDef def) { + return getNativeRepParam(def, 3); + } + String getPropertyInit(Type at, int index) throws SemanticException { at = X10TypeMixin.baseType(at); if (at instanceof X10ClassType) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-05 19:17:08 UTC (rev 6635) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-05 20:00:48 UTC (rev 6636) @@ -14,7 +14,9 @@ import java.io.InputStream; import java.util.AbstractList; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -371,8 +373,8 @@ public void getInheritedVirtualMethods(X10ClassType ct, List<MethodInstance> methods) { for (MethodInstance mi : ct.methods()) { - if (mi.flags().isStatic()) continue; - methods.add(mi); + if (! mi.flags().isStatic()) + methods.add(mi); } Type sup = ct.superClass(); if (sup instanceof X10ClassType) { @@ -412,7 +414,6 @@ printType(md.returnType(), PRINT_TYPE_PARAMS | BOX_PRIMITIVES); w.allowBreak(2, 2, " ", 1); w.write(md.name().toString()); - w.write("$"); w.write("("); @@ -452,7 +453,7 @@ Name name = Name.make("a" + (i+1)); w.write(name.toString()); - dispatchArgs.add(new Join("", CollectionUtil.list("(", new TypeExpander(f, true, true, false), ") ", name.toString()))); + dispatchArgs.add(new Join("", CollectionUtil.list("(", new TypeExpander(f, true, true, false, false), ") ", name.toString()))); } w.end(); @@ -490,8 +491,6 @@ w.write("this"); w.write("."); w.write(md.name().toString()); -// if (usesClassParam) -// w.write("$"); w.write("("); w.begin(0); @@ -539,13 +538,16 @@ X10MethodInstance mi = (X10MethodInstance) n.methodDef().asInstance(); - if (! isAbstract(mi)) - generateMethodDecl(n, false); + boolean boxPrimitives = true; - // If method overrides method with class type parameters, generate m$() that dispatches to m(). - assert ! ( mi.returnType() instanceof UnknownType); - if (! mi.flags().isStatic()) - generateDispatcher(mi, true); + if (mi.name() == Name.make("hashCode") && mi.formalTypes().size() == 0) + boxPrimitives = false; + if (mi.name() == Name.make("equals") && mi.formalTypes().size() == 1) + boxPrimitives = false; + if (mi.name() == Name.make("hasNext") && mi.formalTypes().size() == 0) + boxPrimitives = false; + + generateMethodDecl(n, boxPrimitives); } private boolean overridesMethodThatUsesClassParameter(MethodInstance mi) { @@ -596,7 +598,7 @@ return false; } - private void generateMethodDecl(X10MethodDecl_c n, boolean box) { + private void generateMethodDecl(X10MethodDecl_c n, boolean boxPrimitives) { X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); Flags flags = n.flags().flags(); @@ -626,7 +628,7 @@ w.write("> "); } - printType(n.returnType().type(), PRINT_TYPE_PARAMS | (box ? BOX_PRIMITIVES : 0)); + printType(n.returnType().type(), PRINT_TYPE_PARAMS | (boxPrimitives ? BOX_PRIMITIVES : 0)); w.allowBreak(2, 2, " ", 1); tr.print(n, n.name(), w); @@ -659,7 +661,7 @@ first = false; tr.print(n, f.flags(), w); - printType(f.type().type(), PRINT_TYPE_PARAMS | (box ? BOX_PRIMITIVES : 0)); + printType(f.type().type(), PRINT_TYPE_PARAMS | (boxPrimitives ? BOX_PRIMITIVES : 0)); w.write(" "); Name name = f.name().id(); @@ -729,6 +731,8 @@ X10ClassType ct = (X10ClassType) Types.get(ci.container()); List<String> typeAssignments = new ArrayList<String>(); + + for (Iterator i = ct.x10Def().typeParameters().iterator(); i.hasNext(); ) { ParameterType p = (ParameterType) i.next(); w.write("final "); @@ -780,8 +784,11 @@ w.begin(4); if (n.body().statements().size() > 0) { if (n.body().statements().get(0) instanceof ConstructorCall) { - n.printSubStmt(n.body().statements().get(0), w, tr); + ConstructorCall cc = (ConstructorCall) n.body().statements().get(0); + n.printSubStmt(cc, w, tr); w.allowBreak(0, " "); + if (cc.kind() == ConstructorCall.THIS) + typeAssignments.clear(); } } for (String s : typeAssignments) { @@ -819,24 +826,36 @@ } public String getJavaRep(X10ClassDef def) { - try { - X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); - Type rep = (Type) xts.systemResolver().find(QName.make("x10.compiler.NativeRep")); - List<Type> as = def.annotationsMatching(rep); - for (Type at : as) { - assertNumberOfInitializers(at, 2); - String lang = getPropertyInit(at, 0); - if (lang != null && lang.equals("java")) { - return getPropertyInit(at, 1); - } - } - } - catch (SemanticException e) {} - return null; + return getJavaRepParam(def, 1); } + public String getJavaBoxRep(X10ClassDef def) { + return getJavaRepParam(def, 2); + } + public String getJavaRTTRep(X10ClassDef def) { + return getJavaRepParam(def, 3); + } + + public String getJavaRepParam(X10ClassDef def, int i) { + try { + X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); + Type rep = (Type) xts.systemResolver().find(QName.make("x10.compiler.NativeRep")); + List<Type> as = def.annotationsMatching(rep); + for (Type at : as) { + assertNumberOfInitializers(at, 4); + String lang = getPropertyInit(at, 0); + if (lang != null && lang.equals("java")) { + return getPropertyInit(at, i); + } + } + } + catch (SemanticException e) {} + return null; + } public void visit(X10ClassDecl_c n) { - X10ClassDef def = (X10ClassDef) n.classDef(); + X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); + + X10ClassDef def = (X10ClassDef) n.classDef(); // Do not generate code if the class is represented natively. if (getJavaRep(def) != null) { @@ -845,22 +864,22 @@ return; } - StringBuilder sb = new StringBuilder(); - for (TypeParamNode t : n.typeParameters()) { - if (sb.length() > 0) { - sb.append(", "); - } - sb.append("\""); - sb.append(t.name().id()); - sb.append("\""); - } +// StringBuilder sb = new StringBuilder(); +// for (TypeParamNode t : n.typeParameters()) { +// if (sb.length() > 0) { +// sb.append(", "); +// } +// sb.append("\""); +// sb.append(t.name().id()); +// sb.append("\""); +// } - if (sb.length() > 0) { - w.write("@x10.generics.Parameters({"); - w.write(sb.toString()); - w.write("})"); - w.allowBreak(0); - } +// if (sb.length() > 0) { +// w.write("@x10.generics.Parameters({"); +// w.write(sb.toString()); +// w.write("})"); +// w.allowBreak(0); +// } // @Parameters({"T"}) // public class List implements Runnable { @@ -872,7 +891,7 @@ // public static Object cast$(Object o, String constraint) { /*check constraint*/; return (List)o; } // T x; - Flags flags = n.flags().flags(); + X10Flags flags = X10Flags.toX10Flags( n.flags().flags()); w.begin(0); if (flags.isInterface()) { @@ -949,11 +968,20 @@ // Generate the run-time type. We have to wrap in a class since n might be an interface // and interfaces can't have static methods. - if (def.isTopLevel()) - generateRTType(def); + generateRTTMethods(def); - generateRTTMethods(def); + boolean isValueType = xts.isValueType(def.asType()); + if (isValueType) { + generateBoxMethod( def); + } + if (def.isTopLevel()) { + generateRTType(def); + if (isValueType) { + generateBoxType(def); + } + } + // Generate dispatcher methods. generateDispatchers(def); @@ -1018,10 +1046,272 @@ w.write("}"); w.newline(0); - if (def.isLocal()) - generateRTType(def); + if (def.isLocal()) { + generateRTType(def); + if (isValueType) { + generateBoxType(def); + } + } } + private void generateBoxMethod(X10ClassDef def) { + w.write("public x10.core.Ref box$() { return new "); + printType(def.asType(), PRINT_TYPE_PARAMS | BOX_TYPE); + w.write("("); + + if (def.typeParameters().size() > 0) { + for (ParameterType tp : def.typeParameters()) { + w.write("this."); + w.write(tp.name().toString()); + w.write(", "); + } + } + + w.write("this); }"); + w.newline(); + } + + private void generateBoxType(X10ClassDef def) { + w.newline(); + + String mangle = mangle(def.fullName()); + + if (def.asType().isGloballyAccessible()) { + w.write("public static "); + } + String boxShortName = boxShortName(def); + w.write("class " + boxShortName); + + if (USE_JAVA_GENERICS) { + if (def.typeParameters().size() > 0) { + w.write("<"); + w.begin(0); + String sep = ""; + for (ParameterType tp : def.typeParameters()) { + w.write(sep); + printType(tp, 0); + sep = ", "; + } + w.end(); + w.write(">"); + } + } + + if (def.asType().superClass() != null) { + w.write(" extends "); + w.write("x10.core.Box<"); + printType(def.asType(), PRINT_TYPE_PARAMS | NO_VARIANCE | BOX_PRIMITIVES); + w.write(">"); +// X10ClassType sup = (X10ClassType) X10TypeMixin.baseType(def.asType().superClass()); +// printBoxType(sup, true, true); + } + + if (! def.asType().interfaces().isEmpty()) { + w.write(" implements "); + String sep = ""; + for (Type it : def.asType().interfaces()) { + w.write(sep); + sep = ", "; + printType(it, PRINT_TYPE_PARAMS | NO_VARIANCE); + } + } + + w.write("{"); + + w.write("public "); + w.write(boxShortName(def)); + w.write("("); + + if (USE_JAVA_GENERICS) { + if (def.typeParameters().size() > 0) { + for (ParameterType tp : def.typeParameters()) { + w.write("x10.types.Type<?> "); + w.write(tp.name().toString()); + w.write(", "); + } + } + } + + w.write(def.name().toString()); + w.write(" v"); + w.write(") { super("); + new RuntimeTypeExpander(def.asType()).expand(tr); + w.write(", v); }"); + w.newline(); + + generateRTTMethods(def, true); + + List<MethodInstance> methods = new ArrayList<MethodInstance>(); + getInheritedVirtualMethods((X10ClassType) def.asType(), methods); + + // Remove abstract or overridden methods. + for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { + MethodInstance mi = i.next(); + X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); + MethodInstance mj = ts.findImplementingMethod(def.asType(), mi); + if (mj != null && mj.def() != mi.def()) + i.remove(); + } + + Collection<MethodInstance> seen = new HashSet<MethodInstance>(); + + // Remove duplicates. + for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { + MethodInstance mi = i.next(); + if (seen(seen, mi)) + i.remove(); + } + + for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { + X10MethodInstance mi = (X10MethodInstance) i.next(); + generateBoxDispatcher(mi); + } + + w.write("}"); + w.newline(); + + } + + public void generateBoxDispatcher(X10MethodInstance md) { + boolean boxPrimitives = true; + + X10MethodInstance mi = md; + + if (mi.name() == Name.make("hashCode") && mi.formalTypes().size() == 0) + return; + if (mi.name() == Name.make("equals") && mi.formalTypes().size() == 1) + return; + if (mi.name() == Name.make("toString") && mi.formalTypes().size() == 0) + return; + if (mi.name() == Name.make("className") && mi.formalTypes().size() == 0) + return; + + + + if (mi.name() == Name.make("hashCode") && mi.formalTypes().size() == 0) + boxPrimitives = false; + if (mi.name() == Name.make("equals") && mi.formalTypes().size() == 1) + boxPrimitives = false; + if (mi.name() == Name.make("hasNext") && mi.formalTypes().size() == 0) + boxPrimitives = false; + + X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); + + Flags flags = md.flags(); + flags = flags.clearNative(); + flags = flags.clearAbstract(); + flags = flags.Final(); + + // Hack to ensure that X10Flags are not printed out .. javac will + // not know what to do with them. + flags = X10Flags.toX10Flags(flags); + + w.begin(0); + w.write(flags.translate()); + + if (USE_JAVA_GENERICS) { + String sep = "<"; + for (int i = 0; i < md.typeParameters().size(); i++) { + w.write(sep); + sep = ", "; + printType(md.typeParameters().get(i), BOX_PRIMITIVES); + } + if (md.typeParameters().size() > 0) + w.write("> "); + } + + printType(md.returnType(), PRINT_TYPE_PARAMS | (boxPrimitives ? BOX_PRIMITIVES : 0)); + w.allowBreak(2, 2, " ", 1); + w.write(md.name().toString()); + + w.write("("); + + w.allowBreak(2, 2, "", 0); + w.begin(0); + boolean first = true; + + // Add a formal parameter of type Type for each type parameters. + for (Type p : md.typeParameters()) { + if (! first) { + w.write(","); + w.allowBreak(0, " "); + } + first = false; + w.write("final "); + w.write(X10_RUNTIME_TYPE_CLASS); + w.write(" "); + Type pt = p; + assert pt instanceof ParameterType; + w.write(((ParameterType) pt).name().toString()); + } + + List<Expander> dispatchArgs = new ArrayList<Expander>(); + + for (int i = 0; i < md.formalTypes().size(); i++) { + Type f = md.formalTypes().get(i); + if (! first) { + w.write(","); + w.allowBreak(0, " "); + } + first = false; + + w.write(Flags.FINAL.translate()); + printType(f, PRINT_TYPE_PARAMS | (boxPrimitives ? BOX_PRIMITIVES : 0)); + w.write(" "); + + Name name = Name.make("a" + (i+1)); + w.write(name.toString()); + + dispatchArgs.add(new Join("", CollectionUtil.list("(", new TypeExpander(f, true, true, false, false), ") ", name.toString()))); + } + + w.end(); + w.write(")"); + + if (! md.throwTypes().isEmpty()) { + w.allowBreak(6); + w.write("throws "); + + for (Iterator<Type> i = md.throwTypes().iterator(); i.hasNext(); ) { + Type t = i.next(); + printType(t, PRINT_TYPE_PARAMS); + if (i.hasNext()) { + w.write(","); + w.allowBreak(4, " "); + } + } + } + + w.end(); + + w.write(" "); + w.write("{"); + w.allowBreak(4); + + if (! md.returnType().isVoid()) { + w.write(" return "); + } + + w.write("this.value"); + w.write("."); + w.write(md.name().toString()); + w.write("("); + w.begin(0); + + for (int i = 0; i < dispatchArgs.size(); i++) { + if (i != 0) { + w.write(","); + w.allowBreak(0, " "); + } + dispatchArgs.get(i).expand(tr); + } + + w.end(); + w.write(");"); + w.allowBreak(0, " "); + w.write("}"); + } + private String mangle(QName name) { String mangle = name.toString().replace(".", "$"); return mangle; @@ -1064,13 +1354,39 @@ if (def.asType().isGloballyAccessible()) { w.write("public static "); } - w.write("class " + rttShortName(def) + " extends "+superClass+"<"); - printType(def.asType(), BOX_PRIMITIVES); + w.write("class "); + + Expander rttShortName; + + if (def.typeParameters().size() == 0) { + rttShortName = new Join("", rttShortName(def), ""); + } + else { + X10ClassType ct = (X10ClassType) def.asType(); + rttShortName = new Join(", ", ct.typeArguments()); + List args = new ArrayList(); + for (int i = 0; i < ct.typeArguments().size(); i++) { + Type a = ct.typeArguments().get(i); + args.add(new TypeExpander(a, PRINT_TYPE_PARAMS | BOX_PRIMITIVES)); + } + rttShortName = new Join("", rttShortName(def), "<", new Join(", ", args), ">"); + } + + rttShortName.expand(tr); + + w.write(" extends "); + w.write(superClass); + w.write("<"); + printType(def.asType(), BOX_PRIMITIVES | PRINT_TYPE_PARAMS | NO_VARIANCE); w.write("> {"); w.newline(); w.begin(4); if (def.asType().isGloballyAccessible() && def.typeParameters().size() == 0) { - w.write("public static final " + rttShortName(def) + " it = new " + rttShortName(def) + "();"); + w.write("public static final "); + rttShortName.expand(tr); + w.write(" it = new "); + rttShortName.expand(tr); + w.write("();"); w.newline(); w.newline(); } @@ -1449,28 +1765,38 @@ } void generateRTTMethods(X10ClassDef def) { - // Generate RTTI methods, one for each parameter. + generateRTTMethods(def, false); + } + + void generateRTTMethods(X10ClassDef def, boolean boxed) { + Set<ClassDef> visited = new HashSet<ClassDef>(); + visited.add(def); + + // Generate RTTI methods, one for each parameter. for (int i = 0; i < def.typeParameters().size(); i++) { ParameterType pt = def.typeParameters().get(i); TypeProperty.Variance var = def.variances().get(i); - + w.write("public x10.types.Type<?> " + "rtt_" + mangle(def.fullName()) + "_"); w.write(pt.name().toString()); + w.write("()"); if (def.flags().isInterface()) { - w.write("();"); + w.write(";"); } - else { - w.write("() { return this."); + else if (! boxed) { + w.write(" { return this."); w.write(pt.name().toString()); w.write("; }"); } + else { + w.write(" { throw new java.lang.RuntimeException(); }"); + } w.newline(); } // Generate RTTI methods for each interface instantiation. if (! def.flags().isInterface()) { - Set<Type> visited = new HashSet<Type>(); LinkedList<Type> worklist = new LinkedList<Type>(); for (Type t : def.asType().interfaces()) { @@ -1481,14 +1807,14 @@ while (! worklist.isEmpty()) { Type it = worklist.removeFirst(); - if (visited.contains(it)) - continue; - visited.add(it); - if (it instanceof X10ClassType) { X10ClassType ct = (X10ClassType) it; X10ClassDef idef = ct.x10Def(); + if (visited.contains(idef)) + continue; + visited.add(idef); + for (Type t : ct.interfaces()) { Type it2 = X10TypeMixin.baseType(t); worklist.add(it2); @@ -1498,16 +1824,17 @@ ParameterType pt = idef.typeParameters().get(i); w.write("public x10.types.Type<?> " + "rtt_" + mangle(idef.fullName()) + "_"); w.write(pt.name().toString()); - w.write("() { return "); - Type at = ct.typeArguments().get(i); -// if (at instanceof ParameterType) { -// ParameterType pat = (ParameterType) at; -// w.write("this."); -// w.write(pat.name().toString()); -// } -// else { - new RuntimeTypeExpander(at).expand(); -// } + w.write("() { "); + + if (! boxed) { + w.write("return "); + Type at = ct.typeArguments().get(i); + new RuntimeTypeExpander(at).expand(); + } + else { + w.write("throw new java.lang.RuntimeException()"); + } + w.write("; }"); w.newline(); } @@ -1529,8 +1856,8 @@ X10CanonicalTypeNode xtn = (X10CanonicalTypeNode) tn; Type t = X10TypeMixin.baseType(xtn.type()); - boolean box = ! (c.expr().type().isBoolean() || c.expr().type().isNumeric()); - Expander ex = new TypeExpander(t, PRINT_TYPE_PARAMS | (box ? BOX_PRIMITIVES : 0)); + boolean boxPrimitives = ! (c.expr().type().isBoolean() || c.expr().type().isNumeric()); + Expander ex = new TypeExpander(t, PRINT_TYPE_PARAMS | (boxPrimitives ? BOX_PRIMITIVES : 0)); Expander rt = new RuntimeTypeExpander(t); DepParameterExpr dep = xtn.constraintExpr(); @@ -1765,7 +2092,7 @@ c.printSubExpr(target, w, tr); w.write("."); - w.write("apply$"); + w.write("apply"); w.write("("); w.begin(0); @@ -1794,9 +2121,9 @@ public void visit(Tuple_c c) { Type t = X10TypeMixin.getParameterType(c.type(), 0); new Template("tuple", - new TypeExpander(t, true, true, false), + new TypeExpander(t, true, true, false, false), new RuntimeTypeExpander(t), - new TypeExpander(t, true, false, false), + new TypeExpander(t, true, false, false, false), new Join(",", c.arguments())).expand(); } @@ -1822,8 +2149,8 @@ int i = 0; components[i++] = target; for (Type at : types) { - components[i++] = new TypeExpander(at, true, false, false); - components[i++] = new TypeExpander(at, true, true, false); + components[i++] = new TypeExpander(at, true, false, false, false); + components[i++] = new TypeExpander(at, true, true, false, false); components[i++] = new RuntimeTypeExpander(at); } for (Expr e : args) { @@ -1877,7 +2204,7 @@ if (needsHereCheck) { // don't annotate calls with implicit target, or this and super // the template file only emits the target - new Template("place-check", new TypeExpander(t, true, false, false), target).expand(); + new Template("place-check", new TypeExpander(t, true, false, false, false), target).expand(); } else { tr.print(c, target, w); @@ -1891,36 +2218,7 @@ w.write("."); - // Call the unboxed version of the method if we know it exists. - boolean callUnboxedMethod = false; - -// if (! USE_JAVA_GENERICS) { -// for (MethodInstance mj : mi.overrides()) { -// Type container = mj.container(); -// container = X10TypeMixin.baseType(container); -// if (container instanceof X10ClassType) { -// X10ClassType ct = (X10ClassType) container; -// if (! ct.flags().isInterface() -// && ct.x10Def().typeParameters().size() == 0) { -// callUnboxedMethod = true; -// } -// } -// } -// } - - if (USE_JAVA_GENERICS) { - boolean superUsesClassParameter = ! mi.flags().isStatic() ; // && overridesMethodThatUsesClassParameter(mi); - // FIXME: this test is too imprecise. - callUnboxedMethod = superUsesClassParameter; - } - - if (callUnboxedMethod) { - w.write(c.name().id().toString()); - w.write("$"); - } - else { - w.write(c.name().id().toString()); - } + w.write(c.name().id().toString()); } w.write("("); @@ -1968,7 +2266,7 @@ List<Expander> formals = new ArrayList(); List<Expander> typeArgs = new ArrayList(); for (final Formal f : n.formals()) { - TypeExpander ft = new TypeExpander(f.type().type(), true, true, false); + TypeExpander ft = new TypeExpander(f.type().type(), true, true, false, false); typeArgs.add(ft); // must box formals formals.add(new Expander() { public void expand(Translator tr) { @@ -1977,7 +2275,7 @@ }); } - TypeExpander ret = new TypeExpander(n.returnType().type(), true, true, false); + TypeExpander ret = new TypeExpander(n.returnType().type(), true, true, false, false); if (!n.returnType().type().isVoid()) { typeArgs.add(ret); w.write("new x10.core.fun.Fun_0_" + n.formals().size()); @@ -1995,7 +2293,7 @@ w.write("() {"); w.write("public "); ret.expand(tr2); - w.write(" apply$("); + w.write(" apply("); new Join(", ", formals).expand(tr2); w.write(") { "); tr2.print(n, n.body(), w); @@ -2100,7 +2398,7 @@ public void visit(Future_c f) { Translator tr2 = ((X10Translator) tr).inInnerClass(true); - new Template("Future", f.place(), new TypeExpander(f.returnType().type(), true, true, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); + new Template("Future", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); } public void visit(Formal_c f) { @@ -2263,7 +2561,7 @@ if (needsHereCheck) { // no check required for implicit targets, this and super // the template file only emits the target - new Template("place-check", new TypeExpander(t, true, false, false), target).expand(); + new Template("place-check", new TypeExpander(t, true, false, false, false), target).expand(); // then emit '.' and name of the field. w.write("."); w.write(n.name().id().toString()); @@ -2411,8 +2709,6 @@ // otherwise emit the hardwired code. tr.print(n, array, w); w.write(".set"); - if (superUsesClassParameter) - w.write("$"); w.write("("); tr.print(n, n.right(), w); if (index.size() > 0) @@ -2426,11 +2722,9 @@ Name methodName = X10Binary_c.binaryMethodName(op); tr.print(n, array, w); w.write(".set"); - if (superUsesClassParameter) - w.write("$"); w.write("(("); tr.print(n, array, w); - w.write(").apply$("); + w.write(").apply("); new Join(", ", index).expand(tr); w.write(")"); if (nativeop) { @@ -2477,11 +2771,9 @@ w.write("return "); } w.write("array.set"); - if (superUsesClassParameter) - w.write("$"); w.write("("); - w.write(" array.apply$("); + w.write(" array.apply("); { int i = 0; for (Expr e : index) { @@ -2527,19 +2819,20 @@ } String getPropertyInit(Type at, int index) { - at = X10TypeMixin.baseType(at); - if (at instanceof X10ClassType) { - X10ClassType act = (X10ClassType) at; - if (index < act.propertyInitializers().size()) { - Expr e = act.propertyInitializer(index); - if (e instanceof StringLit) { - StringLit lit = (StringLit) e; - String s = lit.value(); - return s; - } + at = X10TypeMixin.baseType(at); + if (at instanceof X10ClassType) { + X10ClassType act = (X10ClassType) at; + if (index < act.propertyInitializers().size()) { + Expr e = act.propertyInitializer(index); + if (e.isConstant()) { + Object v = e.constantValue(); + if (v instanceof String) { + return (String) v; + } + } + } } - } - return null; + return null; } void assertNumberOfInitializers(Type at, int len) { @@ -2550,19 +2843,34 @@ } } - boolean printRepType(Type type, boolean printGenerics, boolean box, boolean inSuper) { + boolean printRepType(Type type, boolean printGenerics, boolean boxPrimitives, boolean inSuper, boolean boxType) { + if (type.isVoid()) { + w.write("void"); + return true; + } + // If the type has a native representation, use that. if (type instanceof X10ClassType) { X10ClassDef cd = ((X10ClassType) type).x10Def(); - String pat = getJavaRep(cd); + String pat = boxType ? getJavaBoxRep(cd) : getJavaRep(cd); if (pat != null) { + if (boxPrimitives) { + String[] s = new String[] { "boolean", "byte", "char", "short", "int", "long", "float", "double" }; + String[] w = new String[] { "java.lang.Boolean", "java.lang.Byte", "java.lang.Character", "java.lang.Short", "java.lang.Integer", "java.lang.Long", "java.lang.Float", "java.lang.Double" }; + for (int i = 0; i < s.length; i++) { + if (pat.equals(s[i])) { + pat = w[i]; + break; + } + } + } List<Type> typeArguments = ((X10ClassType) type).typeArguments(); Object[] o = new Object[typeArguments.size()+1]; int i = 0; NodeFactory nf = tr.nodeFactory(); - o[i++] = new TypeExpander(type, printGenerics, box, inSuper); + o[i++] = new TypeExpander(type, printGenerics, boxPrimitives, inSuper, false); for (Type a : typeArguments) { - o[i++] = new TypeExpander(a, printGenerics, true, inSuper); + o[i++] = new TypeExpander(a, printGenerics, true, inSuper, false); } if (! printGenerics) { pat = pat.replaceAll("<.*>", ""); @@ -2571,6 +2879,7 @@ return true; } } + return false; } @@ -2578,20 +2887,14 @@ public static final int BOX_PRIMITIVES = 2; public static final int NO_VARIANCE = 4; public static final int NO_QUALIFIER = 8; + public static final int BOX_TYPE = 16; - private void printType(Type type, boolean printTypeParams, boolean box, boolean inSuper, boolean ignoreQual) { - printType(type, - (printTypeParams ? PRINT_TYPE_PARAMS : 0) | - (box ? BOX_PRIMITIVES : 0) | - (inSuper ? NO_VARIANCE : 0) | - (ignoreQual ? NO_QUALIFIER : 0)); - } - private void printType(Type type, int flags) { boolean printTypeParams = (flags & PRINT_TYPE_PARAMS) != 0; - boolean box = (flags & BOX_PRIMITIVES) != 0; + boolean boxPrimitives = (flags & BOX_PRIMITIVES) != 0; boolean inSuper = (flags & NO_VARIANCE) != 0; boolean ignoreQual = (flags & NO_QUALIFIER) != 0; + boolean boxType = (flags & BOX_TYPE) != 0; X10TypeSystem xts = (X10TypeSystem) type.typeSystem(); @@ -2628,58 +2931,23 @@ w.write(">"); return; } + +// else { +// printType(arg, PRINT_TYPE_PARAMS | BOX_PRIMITIVES | BOX_TYPE); +// return; +// } } - if (type.isBoolean() || type.isNumeric() || type.isVoid()) { - String s = null; - - if (box && ! type.isVoid()) { - s = tr.typeSystem().wrapperTypeString(type); - } - else { - if (type.isBoolean()) { - s = "boolean"; - } else if (type.isByte()) { - s = "byte"; - } else if (type.isShort()) { - s = "short"; - } else if (type.isChar()) { - s = "char"; - } else if (type.isInt()) { - s = "int"; - } else if (type.isLong()) { - s = "long"; - } else if (type.isFloat()) { - s = "float"; - } else if (type.isDouble()) { - s = "double"; - } else if (type.isVoid()) { - s = "void"; - } - - if (X10TypeSystem_c.SUPPORT_UNSIGNED) { - if (xts.isUByte(type)) { - s = "byte"; - } else if (xts.isUShort(type)) { - s = "short"; - } else if (xts.isUInt(type)) { - s = "int"; - } else if (xts.isULong(type)) { - s = "long"; - } - } - } - - if (s != null) { - w.write(s); - return; - } - } - - if (printRepType(type, printTypeParams, box, inSuper)) + if (printRepType(type, printTypeParams, boxPrimitives, inSuper, boxType)) return; if (type instanceof ParameterType) { + if (boxType) { + w.write("x10.core.Box<? extends "); + printType(type, PRINT_TYPE_PARAMS | BOX_PRIMITIVES); + w.write(">"); + return; + } if (USE_JAVA_GENERICS) { w.write(((ParameterType) type).name().toString()); } @@ -2690,6 +2958,13 @@ } if (type instanceof ClosureType) { + if (boxType) { + w.write("x10.core.Box<? extends "); + printType(type, PRINT_TYPE_PARAMS | BOX_PRIMITIVES); + w.write(">"); + return; + } + ClosureType ct = (ClosureType) type; List<Type> args = ct.argumentTypes(); Type ret = ct.returnType(); @@ -2719,6 +2994,13 @@ } if (type instanceof PathType) { + if (boxType) { + w.write("x10.core.Box<? extends "); + printType(type, PRINT_TYPE_PARAMS | BOX_PRIMITIVES); + w.write(">"); + return; + } + PathType pt = (PathType) type; Type t = pt.baseType(); w.write("java.lang.Object"); @@ -2731,64 +3013,56 @@ printType(mt.definedType(), PRINT_TYPE_PARAMS); return; } - - // This should be covered by X10ClassType. - if (xts.isRail(type) || xts.isValRail(type)) { - Type T = X10TypeMixin.getParameterType((X10Type) type, 0); - if (T == null) { - w.write("java.lang.Object"); - } - else { - printType(T, PRINT_TYPE_PARAMS); - } - w.write("[]"); - return; - } - + // Print the class name if (ignoreQual) { if (type instanceof X10ClassType) { - w.write(((X10ClassType) type).name().toString()); + w.write(((X10ClassType) type).name().toString()); } else { type.print(w); } } else { - type.print(w); + if (type instanceof X10ClassType && boxType) { + printBoxType((X10ClassType) type, true, false); + return; + } + type.print(w); } - if (printTypeParams && USE_JAVA_GENERICS) { - if (type instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) type; - String sep = "<"; - for (int i = 0; i < ct.typeArguments().size(); i++) { - w.write(sep); - sep = ", "; + if (printTypeParams && USE_JAVA_GENERICS) { + if (type instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) type; + String sep = "<"; + for (int i = 0; i < ct.typeArguments().size(); i++) { + w.write(sep); + sep = ", "; - Type a = ct.typeArguments().get(i); - - if (! inSuper) { - TypeProperty.Variance v = ct.x10Def().variances().get(i); - switch (v) { - case CONTRAVARIANT: - w.write("? super "); - break; - case COVARIANT: - w.write("? extends "); - break; - case INVARIANT: - break; - } - } - printType(a, (printTypeParams ? PRINT_TYPE_PARAMS : 0) | BOX_PRIMITIVES); - } - if (ct.typeArguments().size() > 0) - w.write(">"); - } - } + Type a = ct.typeArguments().get(i); + + final boolean variance = false; + if (! inSuper && variance) { + TypeProperty.Variance v = ct.x10Def().variances().get(i); + switch (v) { + case CONTRAVARIANT: + w.write("? super "); + break; + case COVARIANT: + w.write("? extends "); + break; + case INVARIANT: + break; + } + } + printType(a, (printTypeParams ? PRINT_TYPE_PARAMS : 0) | BOX_PRIMITIVES); + } + if (ct.typeArguments().size() > 0) + w.write(">"); + } + } } - + public void visit(CanonicalTypeNode_c n) { Type t = n.type(); if (t != null) @@ -2884,7 +3158,7 @@ dumpRegex("Native", components, tr, pat); } else { - w.write("target.apply$("); + w.write("target.apply("); {int i = 0; for (Expr e : args) { if (i > 0) w.write(", "); @@ -2902,7 +3176,7 @@ w.write((op == Unary.POST_INC || op == Unary.PRE_INC ? "+" : "-") + "1"); w.write(";"); w.allowBreak(0, " "); - w.write("target.set$(neu"); + w.write("target.set(neu"); {int i = 0; for (Expr e : args) { w.write(", "); @@ -2974,6 +3248,17 @@ NodeFactory nf = tr.nodeFactory(); Binary.Operator op = n.operator(); + + if (op == Binary.EQ) { + new Template("equalsequals", left, right).expand(); + return; + } + + if (op == Binary.NE) { + new Template("notequalsequals", left, right).expand(); + return; + } + if (l.isNumeric() && r.isNumeric()) { visit((Binary_c)n); return; @@ -2988,17 +3273,6 @@ visit((Binary_c)n); return; } - - if (op == Binary.EQ) { - new Template("equalsequals", left, right).expand(); - return; - } - - if (op == Binary.NE) { - new Template("notequalsequals", left, right).expand(); - return; - } - if (n.invert()) { Name methodName = X10Binary_c.invBinaryMethodName(op); if (methodName != null) { @@ -3106,25 +3380,64 @@ } String rttShortName(X10ClassDef cd) { + if (cd.isMember() || cd.isLocal()) + return cd.name() + "$RTT"; + else + return "RTT"; + } + + String rttName(X10ClassDef cd) { + if (cd.isTopLevel()) + return cd.fullName() + "." + rttShortName(cd); + if (cd.isLocal()) + return rttShortName(cd); + if (cd.isMember()) { + X10ClassType container = (X10ClassType) Types.get(cd.container()); + return rttName(container.x10Def()) + "." + rttShortName(cd); + } + assert false : "unexpected class " + cd; + return ""; + } + + String boxShortName(X10ClassDef cd) { if (cd.isMember() || cd.isLocal()) - return cd.name() + "$RTT"; + return cd.name() + "$Box"; else - return "RTT"; + return "Box"; } - String rttName(X10ClassDef cd) { + String boxName(X10ClassDef cd) { if (cd.isTopLevel()) - return cd.fullName() + "." + rttShortName(cd); + return cd.fullName() + "." + boxShortName(cd); if (cd.isLocal()) - return rttShortName(cd); + return boxShortName(cd); if (cd.isMember()) { X10ClassType container = (X10ClassType) Types.get(cd.container()); - return rttName(container.x10Def()) + "." + rttShortName(cd); + return boxName(container.x10Def()) + "." + boxShortName(cd); } assert false : "unexpected class " + cd; return ""; } + + void printBoxType(X10ClassType ct, boolean printTypeParams, boolean inSuper) { + if (printRepType(ct, printTypeParams, false, inSuper, true)) + return; + w.write(boxType(ct)); + } + String boxType(X10ClassType ct) { + if (ct.isTopLevel()) + return ct.fullName() + "." + boxShortName(ct.x10Def()); + if (ct.isLocal()) + return boxShortName(ct.x10Def()); + if (ct.isMember()) { + X10ClassType container = (X10ClassType) ct.container(); + return boxName(container.x10Def()) + "." + boxShortName(ct.x10Def()); + } + assert false : "unexpected class " + ct; + return ""; + } + private final class RuntimeTypeExpander extends Expander { private final Type at; @@ -3176,12 +3489,21 @@ if (at instanceof X10ClassType) { X10ClassType ct = (X10ClassType) at; X10ClassDef cd = ct.x10Def(); - String pat = getJavaRep(cd); + String pat = getJavaRTTRep(cd); if (at instanceof BoxType && pat == null) { - pat = "x10.core.Box<#1>"; + pat = "new x10.core.Box.RTT<#1>(#2)"; } + // Check for @NativeRep with null RTT class + if (pat == null && getJavaRep(cd) != null) { + w.write("x10.types.Types.runtimeType("); + printType(at, 0); + w.write(".class"); + w.write(")"); + return; + } + if (pat == null) { if (ct.isGloballyAccessible() && ct.typeArguments().size() == 0) { w.write(rttName(cd)); @@ -3190,6 +3512,15 @@ else { w.write("new "); w.write(rttName(cd)); + + w.write("<"); + for (int i = 0; i < ct.typeArguments().size(); i++) { + if (i != 0) + w.write(", "); + new TypeExpander(ct.typeArguments().get(i), PRINT_TYPE_PARAMS | BOX_PRIMITIVES).expand(tr); + } + w.write(">"); + w.write("("); for (int i = 0; i < ct.typeArguments().size(); i++) { if (i != 0) @@ -3201,23 +3532,15 @@ return; } else { - if (ct.isGloballyAccessible() && ct.typeArguments().size() == 0) { - } - else { - // HACK: remove parameters so we can do a static method call - pat = pat.replaceAll("<.*>", ""); - w.write("new "); - w.write(pat); - w.write(".RTT"); - w.write("("); - for (int i = 0; i < ct.typeArguments().size(); i++) { - if (i != 0) - w.write(", "); - new RuntimeTypeExpander(ct.typeArguments().get(i)).expand(tr); - } - w.write(")"); - return; - } + Object[] components = new Object[1 + ct.typeArguments().size() * 2]; + int i = 0; + components[i++] = new TypeExpander(ct, PRINT_TYPE_PARAMS | BOX_PRIMITIVES); + for (Type at : ct.typeArguments()) { + components[i++] = new TypeExpander(at, PRINT_TYPE_PARAMS | BOX_PRIMITIVES); + components[i++] = new RuntimeTypeExpander(at); + } + dumpRegex("Native", components, tr, pat); + return; } } @@ -3376,... [truncated message content] |
From: <ta...@us...> - 2008-11-07 02:22:15
|
Revision: 6679 http://x10.svn.sourceforge.net/x10/?rev=6679&view=rev Author: tardieu Date: 2008-11-07 01:35:42 +0000 (Fri, 07 Nov 2008) Log Message: ----------- revised x10 app startup code Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.dist/bin/x10.in trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 Removed Paths: ------------- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeHashMap.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeStack.java Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-07 01:35:42 UTC (rev 6679) @@ -1,36 +1,24 @@ // SYNOPSIS: main(#0) #1 -public static class Main implements java.lang.Runnable { - private final x10.core.Rail<java.lang.String> rail; - - public Main(java.lang.String[] args) { - rail = x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args); - } +public static void main(final java.lang.String[] args) { - public void run() { - // initialize places and attach current thread to first place - x10.runtime.impl.java.Thread.currentThread().place(x10.lang.Place.FIRST_PLACE); + // create places; start native runtime; start main x10 thread + x10.runtime.impl.java.Runtime.start(x10.lang.Place.FIRST_PLACE, new java.lang.Runnable() { + public void run() { - // run main activity - x10.runtime.Runtime.runMain(new x10.runtime.Activity() { - public void runX10Task() { - main(rail); - } - }); - } + // start XRX in main x10 thread + x10.runtime.Runtime.start(new x10.runtime.Activity() { + public void runX10Task() { + + // run main + main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); + } + }); + } + }); } -public static void main(java.lang.String[] args) { - java.lang.System.err.println("Please use the 'x10' script to invoke X10 programs, or see the generated"); - java.lang.System.err.println("Java code for alternate invocation instructions."); - java.lang.System.exit(128); -} - // the original app-main method public static void main(#0) { #1 } - -// How to invoke? Use the following general command: -// java $(javaArgs) x10.runtime.impl.java.Runtime $(x10Args) ClassName $(x10AppArgs) - Modified: trunk/x10.dist/bin/x10.in =================================================================== --- trunk/x10.dist/bin/x10.in 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.dist/bin/x10.in 2008-11-07 01:35:42 UTC (rev 6679) @@ -9,13 +9,7 @@ java_args="" args="" -parse=true while [ -n "$1" ]; do - if [ -z "$parse" ]; then - args="$args '$1'" - shift - continue - fi case "$1" in -h|-help|--help) help="1"; break;; -v|-verbose|--verbose) verbose="1";; @@ -32,8 +26,9 @@ -config) shift; config="$1.cfg";; -dev) dev="true";; -J*) java_args="${java_args} '${1##-J}'";; - --) parse=;; - *) args="$args '$1'";; + -*) java_args="${java_args} -Dx10.${1##-}";; + *.x10) args="$args ${1%%.x10}";; + *) args="$args $*"; break;; esac shift done @@ -49,12 +44,10 @@ -D<name>=<value> set system property <name> to <value> -classpath <path> search path for class files -libpath <path> search path for native libraries - -config <conf> read configuration <conf> from etc${FILE_SEP}<conf>.cfg + -config <conf> (IGNORED) read configuration from etc${FILE_SEP}<conf>.cfg -dev developer mode (use unpackaged X10 libraries) -J<arg> [USE WITH CAUTION] pass <arg> directly to java. e.g., use -J-verbose to make java execution verbose. - - Use "x10 -- -help" to get help on X10 runtime configuration options EOF exit 1 fi @@ -85,7 +78,7 @@ fi java_args="${java_args} ${defs}" -command="\"$JAVA\" $java_args $config x10.runtime.impl.java.Runtime $args" +command="\"$JAVA\" $java_args $config $args" [ -n "$verbose" ] && echo "$command" Deleted: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeHashMap.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeHashMap.java 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeHashMap.java 2008-11-07 01:35:42 UTC (rev 6679) @@ -1,13 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime.impl.java; - -public class NativeHashMap<K,V> extends java.util.HashMap<K,V> { - // HACK discard type parameters - public NativeHashMap(Object typeK, Object typeV) { super(); } -} Deleted: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeStack.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeStack.java 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/NativeStack.java 2008-11-07 01:35:42 UTC (rev 6679) @@ -1,13 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008 - * - * This file is part of X10 Language. - * - */ -package x10.runtime.impl.java; - -public class NativeStack<T> extends java.util.Stack<T> { - // HACK discard type parameter - public NativeStack(Object typeT) { super(); } -} Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-07 01:35:42 UTC (rev 6679) @@ -7,78 +7,38 @@ */ package x10.runtime.impl.java; -import java.lang.reflect.Constructor; - -import x10.config.ConfigurationError; -import x10.runtime.util.ShowUsageNotification; - public class Runtime { - public static void main(String[] args) { - if (args.length == 0) { - System.err.println("usage: java x10.runtime.Runtime MainClass [args]"); - System.exit(1); - } - try { - String[] strippedArgs = Configuration.parseCommandLine(args); - loadAndInitLibs(); - run(strippedArgs); - } catch (ShowUsageNotification e) { - Usage.usage(System.out, null); - } catch (ConfigurationError e) { - Usage.usage(System.err, e); - } - } - /** - * Load and init shared library + * Execute main x10 thread */ - private static void loadAndInitLibs() { - if (null != Configuration.LOAD) { - String[] libs = Configuration.LOAD.split(":"); - for (int i=libs.length-1; i>=0; i--) System.loadLibrary(libs[i]); + public static void start(final Object place, final Runnable runnable) { + // load libraries + String property = System.getProperty("x10.LOAD"); + if (null != property) { + String[] libs = property.split(":"); + for (int i = libs.length-1; i>=0; i--) System.loadLibrary(libs[i]); } - } - public static final int MAX_PLACES = Configuration.NUMBER_OF_LOCAL_PLACES; - - public static final int INIT_THREADS_PER_PLACE = Configuration.INIT_THREADS_PER_PLACE; - - private static int exitCode = 0; - - private static final Class[] STRING_ARRAYS = new Class[] { String[].class }; - - /** - * Instantiate and run main activity - */ - private static void run(String[] strippedArgs) { - // instantiation using reflection - Runnable r; - try { - java.lang.Object[] args = { strippedArgs }; - Class main = Class.forName(Configuration.MAIN_CLASS_NAME + "$Main"); - Constructor ctor = main.getDeclaredConstructor(STRING_ARRAYS); - r = (Runnable) ctor.newInstance(args); - if (Configuration.PRELOAD_CLASSES) { - PreLoader.preLoad(main, Configuration.PRELOAD_STRINGS); + Runnable r = new Runnable() { + public void run() { + // preload classes + if (Boolean.getBoolean("x10.PRELOAD_CLASSES")) { + PreLoader.preLoad(runnable.getClass().getEnclosingClass(), + Boolean.getBoolean("x10.PRELOAD_STRINGS")); + } + // execute thread body + runnable.run(); } - } catch (ClassNotFoundException e) { - System.err.println("Could not find main class '" - + Configuration.MAIN_CLASS_NAME + "$Main" + "'!"); - throw new Error(e); - } catch (Exception e) { - System.err.println("Could not find constructor of main class '" - + Configuration.MAIN_CLASS_NAME + "$Main" + "'!"); - throw new Error(e); - } - // run the main activity in its own thread - Thread t = new Thread(r, "main"); - t.start(); - try { t.join(); } catch (InterruptedException e) {} - + }; + Thread thread = new Thread(place, r, "thread-main"); + thread.start(); + try { thread.join(); } catch (InterruptedException e) {} System.exit(exitCode); } + private static int exitCode = 0; + public static void setExitCode(int code) { exitCode = code; } Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java 2008-11-07 01:35:42 UTC (rev 6679) @@ -21,14 +21,11 @@ private Object place; // the current place private Object activity; // the current activity - public Thread(Runnable r) { - super(r); + public Thread(Object place, Runnable runnable, String name) { + super(runnable, name); + this.place = place; } - public Thread(Runnable r, String name) { - super(r, name); - } - public void activity(Object activity) { this.activity = activity; } Modified: trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-07 01:35:42 UTC (rev 6679) @@ -14,7 +14,7 @@ * @author tardieu */ public final value Place(id: nat) { - public const MAX_PLACES = x10.runtime.kernel.Runtime.MAX_PLACES; + public const MAX_PLACES = Int.getInteger("x10.NUMBER_OF_LOCAL_PLACES", 4); public const places = Rail.makeVal[Place](MAX_PLACES, ((id: nat) => new Place(id))); public const FIRST_PLACE = place(0); Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-07 01:35:42 UTC (rev 6679) @@ -31,7 +31,7 @@ /** * Pool size */ - private var size: int; + private var count: int; /** * Number of blocked activities in the pool @@ -39,11 +39,11 @@ private var busy: int = 0; /** - * Start nb threads + * Start count threads */ - def this(nb: nat) { - size = nb; - for(var i: int = 0; i<nb; i++) allocate(); + def this(count: nat) { + this.count = count; + for(var i: int = 0; i<count; i++) allocate(i); } /** @@ -76,13 +76,8 @@ /** * Start a new thread */ - def allocate(): void { - val thread = new Thread(new Worker(this)); - - // must attach the thread to a place here! - thread.place(Place.FIRST_PLACE); - - thread.start(); + def allocate(id: int): void { + new Thread(Place.FIRST_PLACE, new Worker(this), "thread-" + id.toString()).start(); } /** @@ -90,12 +85,7 @@ */ def increase(): void { monitor.lock(); - if (++busy >= size) { - - // enlarge pool - size++; - allocate(); - } + if (++busy >= count) allocate(count++); monitor.unlock(); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-07 01:35:42 UTC (rev 6679) @@ -29,7 +29,7 @@ /** * The common thread pool */ - private const pool = new Pool(x10.runtime.kernel.Runtime.INIT_THREADS_PER_PLACE); + private const pool = new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)); /** * Notify the thread pool that one activity is about to block @@ -69,15 +69,12 @@ /** * Run the main activity in a finish */ - public static def runMain(activity: Activity): void { - try { - val state = new FinishState(); - activity.finishState(state); - pool.execute(new Job(activity, Place.FIRST_PLACE)); - state.waitForFinish(); - } catch (t: Throwable) { - t.printStackTrace(); - } + public static def start(activity: Activity): void { + Thread.currentThread().activity(activity); + val state = new FinishState(); + activity.finishState(state); + activity.run(); + state.waitForFinish(); } /** Modified: trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-06 22:53:56 UTC (rev 6678) +++ trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-07 01:35:42 UTC (rev 6679) @@ -28,10 +28,8 @@ @NativeRep("java", "x10.runtime.impl.java.Thread", null, null) public class Thread { - public native def this(task:Runnable):Thread; + public native def this(place:Object, runnable:Runnable, name:String):Thread; - public native def this(task:Runnable, name:String):Thread; - @Native("java", "#0.currentThread()") public static native def currentThread():Thread; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-07 13:22:49
|
Revision: 6681 http://x10.svn.sourceforge.net/x10/?rev=6681&view=rev Author: tardieu Date: 2008-11-07 13:22:44 +0000 (Fri, 07 Nov 2008) Log Message: ----------- revised clocks to use new collection classes Modified Paths: -------------- trunk/x10.compiler.p3/data/clock.xcd trunk/x10.compiler.p3/data/clocked-loop.xcd trunk/x10.compiler.p3/data/clocked.xcd trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 Modified: trunk/x10.compiler.p3/data/clock.xcd =================================================================== --- trunk/x10.compiler.p3/data/clock.xcd 2008-11-07 01:40:38 UTC (rev 6680) +++ trunk/x10.compiler.p3/data/clock.xcd 2008-11-07 13:22:44 UTC (rev 6681) @@ -1,2 +1,2 @@ // SYNOPSIS: #0=clock -#0 \ No newline at end of file +(x10.runtime.Clock_c) #0 \ No newline at end of file Modified: trunk/x10.compiler.p3/data/clocked-loop.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-07 01:40:38 UTC (rev 6680) +++ trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-07 13:22:44 UTC (rev 6681) @@ -1,2 +1,2 @@ // SYNOPSIS: #0=clock #1=unique_id -add(#0); +add((x10.runtime.Clock_c) #0); Modified: trunk/x10.compiler.p3/data/clocked.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked.xcd 2008-11-07 01:40:38 UTC (rev 6680) +++ trunk/x10.compiler.p3/data/clocked.xcd 2008-11-07 13:22:44 UTC (rev 6681) @@ -1,4 +1,4 @@ // SYNOPSIS: clocked(#0) #1=unique_id -new java.util.LinkedList() {{ +x10.core.RailFactory.<x10.runtime.Clock_c>makeRailFromJavaArray(new java.util.LinkedList() {{ #0 -}} +}}.toArray()) Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-07 01:40:38 UTC (rev 6680) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-07 13:22:44 UTC (rev 6681) @@ -8,7 +8,6 @@ package x10.runtime; -import x10.util.List; import x10.util.Stack; /** @@ -63,28 +62,28 @@ } /** - * Create an activity with the given list of clocks. + * Create an activity with the given rail of clocks. */ - public def this(list: List[Clock], name: String) { + public def this(rail: Rail[Clock_c], name: String) { this(name); clocks = new Clocks(); - clocks.register(list); + clocks.register(rail); } - public def this(list: List[Clock]) { - this(list, ""); + public def this(rail: Rail[Clock_c]) { + this(rail, ""); } /** * Create an activity with the given clock. */ - public def this(clock: Clock, name: String) { + public def this(clock: Clock_c, name: String) { this(name); clocks = new Clocks(); clocks.register(clock); } - public def this(clock: Clock) { + public def this(clock: Clock_c) { this(clock, ""); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 2008-11-07 01:40:38 UTC (rev 6680) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 2008-11-07 13:22:44 UTC (rev 6681) @@ -8,19 +8,18 @@ package x10.runtime; -import x10.util.List; import x10.util.HashMap; /** * @author tardieu */ -class Clocks extends HashMap[Clock_c,int] { - def register(clock: Clock): void { - (clock as Clock_c).register_c(this); +class Clocks extends HashMap[Clock_c,Int] { + def register(clock: Clock_c): void { + clock.register_c(this); } - def register(list: List[Clock]): void { - for(clock: Clock in list) register(clock); + def register(rail: Rail[Clock_c]): void { + for(clock: Clock_c in rail) register(clock); } def next(): void { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-07 16:35:30
|
Revision: 6687 http://x10.svn.sourceforge.net/x10/?rev=6687&view=rev Author: tardieu Date: 2008-11-07 16:35:14 +0000 (Fri, 07 Nov 2008) Log Message: ----------- revised "at (p)" implementation Modified Paths: -------------- trunk/x10.compiler.p3/data/At.xcd trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/data/At.xcd =================================================================== --- trunk/x10.compiler.p3/data/At.xcd 2008-11-07 16:33:12 UTC (rev 6686) +++ trunk/x10.compiler.p3/data/At.xcd 2008-11-07 16:35:14 UTC (rev 6687) @@ -1,14 +1,10 @@ // SYNOPSIS: at(#0) #1 #2=unique_id -x10.runtime.Runtime.startFinish(); -try { - x10.runtime.Runtime.runAsync( - new x10.runtime.Activity() { - public void runX10Task() { - #1 - } - }, #0); -} catch (java.lang.Throwable tmp#2) { - x10.runtime.Runtime.pushException(tmp#2); -} finally { - x10.runtime.Runtime.stopFinish(); +{ + x10.lang.Place tmp#2 = x10.runtime.Runtime.here(#0); + new java.lang.Runnable() { + public void run() { + #1 + } + }.run(); + x10.runtime.Runtime.here(tmp#2); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-07 16:33:12 UTC (rev 6686) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-07 16:35:14 UTC (rev 6687) @@ -60,6 +60,17 @@ } /** + * Set the place of the current activity + * Return the old place + */ + public static def here(place: Place): Place { + val thread = Thread.currentThread(); + val h = thread.place() as Place; + thread.place(place); + return h; + } + + /** * Return the clock phases of the current activity */ static def clocks(): Clocks { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-07 19:30:31
|
Revision: 6689 http://x10.svn.sourceforge.net/x10/?rev=6689&view=rev Author: tardieu Date: 2008-11-07 19:30:28 +0000 (Fri, 07 Nov 2008) Log Message: ----------- fixed statics (XTENLANG-14) Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.dist/bin/x10.in Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-07 19:01:28 UTC (rev 6688) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-07 19:30:28 UTC (rev 6689) @@ -1,23 +1,34 @@ // SYNOPSIS: main(#0) #1 -public static void main(final java.lang.String[] args) { +public static class Activity extends x10.runtime.Activity { + private final String[] args; - // create places; start native runtime; start main x10 thread - x10.runtime.impl.java.Runtime.start(x10.lang.Place.FIRST_PLACE, new java.lang.Runnable() { - public void run() { + public Activity(String[] args) { + this.args = args; + } - // start XRX in main x10 thread - x10.runtime.Runtime.start(new x10.runtime.Activity() { - public void runX10Task() { - - // run main - main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); - } - }); - } - }); + public void runX10Task() { + main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); + } } +public static class Main { + public static void main(final java.lang.String[] args) { + // main java thread + + // create places; start native runtime; start main x10 thread + x10.runtime.impl.java.Runtime.start(x10.lang.Place.FIRST_PLACE, new Runnable() { + + public void run() { + // main x10 thread + + // start xrx; execute main activity + x10.runtime.Runtime.start(new Activity(args)); + } + }); + } +} + // the original app-main method public static void main(#0) { #1 Modified: trunk/x10.dist/bin/x10.in =================================================================== --- trunk/x10.dist/bin/x10.in 2008-11-07 19:01:28 UTC (rev 6688) +++ trunk/x10.dist/bin/x10.in 2008-11-07 19:30:28 UTC (rev 6689) @@ -27,8 +27,8 @@ -dev) dev="true";; -J*) java_args="${java_args} '${1##-J}'";; -*) java_args="${java_args} -Dx10.${1##-}";; - *.x10) args="$args ${1%%.x10}";; - *) args="$args $*"; break;; + *.x10) args="$args '${1%%.x10}\$Main'";; + *) args="$args '$1\$Main'"; shift; args="$args $*"; break;; esac shift done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-10 00:51:55
|
Revision: 6695 http://x10.svn.sourceforge.net/x10/?rev=6695&view=rev Author: tardieu Date: 2008-11-10 00:51:50 +0000 (Mon, 10 Nov 2008) Log Message: ----------- revised app startup code Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-09 02:22:02 UTC (rev 6694) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-10 00:51:50 UTC (rev 6695) @@ -1,35 +1,19 @@ -// SYNOPSIS: main(#0) #1 +// SYNOPSIS: main(#0) #1 #2 = class name -public static class Activity extends x10.runtime.Activity { - private final String[] args; - - public Activity(String[] args) { - this.args = args; +public static class Main extends x10.runtime.impl.java.Runtime { + public static void main(java.lang.String[] args) { + new Main().start(x10.lang.Place.FIRST_PLACE, args); } - - public void runX10Task() { - main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); - } -} - -public static class Main { - public static void main(final java.lang.String[] args) { - // main java thread - - // create places; start native runtime; start main x10 thread - x10.runtime.impl.java.Runtime.start(x10.lang.Place.FIRST_PLACE, new Runnable() { - public void run() { - // main x10 thread - - // start xrx; execute main activity - x10.runtime.Runtime.start(new Activity(args)); - } - }); + public void main(final x10.core.Rail<java.lang.String> args) { + x10.runtime.Runtime.start( + new x10.runtime.Activity() { + public void runX10Task() { + #2.main(args); + } + }); } } // the original app-main method -public static void main(#0) { -#1 -} +public static void main(#0) #1 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-09 02:22:02 UTC (rev 6694) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-10 00:51:50 UTC (rev 6695) @@ -541,7 +541,7 @@ n.formals().size() == 1 && n.formals().get(0).declType().typeEquals(ts.Rail(ts.String()))) { - new Template("Main", n.formals().get(0), n.body()).expand(); + new Template("Main", n.formals().get(0), n.body(), tr.context().currentClass().name()).expand(); return; } Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-09 02:22:02 UTC (rev 6694) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-10 00:51:50 UTC (rev 6695) @@ -7,11 +7,13 @@ */ package x10.runtime.impl.java; -public class Runtime { - /** - * Execute main x10 thread - */ - public static void start(final Object place, final Runnable runnable) { +public abstract class Runtime implements Runnable { + private String[] args; + + // main java thread + protected void start(final Object place, final String[] args) { + this.args = args; + // load libraries String property = System.getProperty("x10.LOAD"); if (null != property) { @@ -19,24 +21,29 @@ for (int i = libs.length-1; i>=0; i--) System.loadLibrary(libs[i]); } - Runnable r = new Runnable() { - public void run() { - // preload classes - if (Boolean.getBoolean("x10.PRELOAD_CLASSES")) { - PreLoader.preLoad(runnable.getClass().getEnclosingClass(), - Boolean.getBoolean("x10.PRELOAD_STRINGS")); - } - // execute thread body - runnable.run(); - } - - }; - Thread thread = new Thread(place, r, "thread-main"); + // start and join main x10 thread + Thread thread = new Thread(place, this, "thread-main"); thread.start(); try { thread.join(); } catch (InterruptedException e) {} + + // shutdown System.exit(exitCode); } + // main x10 thread + public void run() { + // preload classes + if (Boolean.getBoolean("x10.PRELOAD_CLASSES")) { + PreLoader.preLoad(this.getClass().getEnclosingClass(), Boolean.getBoolean("x10.PRELOAD_STRINGS")); + } + + // execute root x10 activity + main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); + } + + // root x10 activity + public abstract void main(x10.core.Rail<java.lang.String> args); + private static int exitCode = 0; public static void setExitCode(int code) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <njn...@us...> - 2008-11-10 19:18:05
|
Revision: 6704 http://x10.svn.sourceforge.net/x10/?rev=6704&view=rev Author: njnystrom Date: 2008-11-10 19:18:02 +0000 (Mon, 10 Nov 2008) Log Message: ----------- Removed static list of solvers in XTerms. Moved them to instance fields of XTerm. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeSolver.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerm_c.java trunk/x10.constraints/src/x10/constraint/XTerms.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeSolver.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeSolver.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/SubtypeSolver.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -40,15 +40,20 @@ public SubtypeSolver(X10TypeSystem ts) { this.ts = ts; - // FIXME: should not be static - XTerms.addExternalSolvers(this); } public static class XSubtype_c extends XFormula_c { - public XSubtype_c(XTerm left, XTerm right) { + SubtypeSolver solver; + + public XSubtype_c(XTerm left, XTerm right, SubtypeSolver solver) { super(XTerms.makeName("<:"), left, right); markAsAtomicFormula(); + this.solver = solver; } + + public Solver solver() { + return solver; + } public Type subtype() { return getType(left()); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -333,4 +333,6 @@ /** Return true if constraints in the type are all consistent. */ boolean consistent(Type t); + SubtypeSolver subtypeSolver(); + } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -2474,10 +2474,16 @@ return xtt; } + SubtypeSolver subtypeSolver; + + public SubtypeSolver subtypeSolver() { + return subtypeSolver; + } + @Override public void initialize(TopLevelResolver loadedResolver, ExtensionInfo extInfo) throws SemanticException { super.initialize(loadedResolver, extInfo); - XTerms.addExternalSolvers(new SubtypeSolver(this)); + this.subtypeSolver = new SubtypeSolver(this); } public boolean equivClause(Type me, Type other) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -446,7 +446,7 @@ } public XTerm transSubtype(Type ltype, Type rtype) { - return new SubtypeSolver.XSubtype_c(trans(ltype), trans(rtype)); + return new SubtypeSolver.XSubtype_c(trans(ltype), trans(rtype), ts.subtypeSolver()); } public XTerm trans(XConstraint c, Variable term) throws SemanticException { Modified: trunk/x10.constraints/src/x10/constraint/XConstraint_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -134,11 +134,14 @@ if (atoms.size() == 0) { consistent = true; } - else { - for (Solver solver : XTerms.externalSolvers()) { - if (! consistent) - break; - consistent &= solver.isConsistent(atoms); + else { + for (XTerm t : atoms) { + if (! consistent) + break; + Solver solver = t.solver(); + if (solver != null) { + consistent &= solver.isConsistent(atoms); + } } } } @@ -153,18 +156,7 @@ if (! consistent) return false; List<XTerm> atoms = constraints(); - if (atoms.size() == 0) { - valid = true; - } - else { - if (XTerms.externalSolvers().size() == 0) - valid = false; - for (Solver solver : XTerms.externalSolvers()) { - if (! valid) - break; - valid &= solver.isValid(atoms); - } - } + valid = atoms.size() == 0; } return valid; } @@ -317,7 +309,8 @@ } public void addDerivedEqualities(XTerm t) throws XFailure { - for (Solver solver : XTerms.externalSolvers()) { + Solver solver = t.solver(); + if (solver != null) { solver.addDerivedEqualitiesInvolving(this, t); } } @@ -583,16 +576,22 @@ if (entails(left, right)) { return true; } - } List<XTerm> atoms = constraints(); - for (Solver solver : XTerms.externalSolvers()) { - if (solver.entails(atoms, t)) - return true; + if (t.solver() != null) { + if (t.solver().entails(atoms, t)) + return true; } + for (XTerm ta : atoms) { + if (ta.solver() != null && ta.solver() != t.solver()) { + if (ta.solver().entails(atoms, t)) + return true; + } + } + return false; } Modified: trunk/x10.constraints/src/x10/constraint/XTerm.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerm.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.constraints/src/x10/constraint/XTerm.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -22,6 +22,8 @@ public XTerm clone(); List<XEQV> eqvs(); + Solver solver(); + /** * Returns true if the variable v occurs in this term. * @param v -- the variable being checked. Modified: trunk/x10.constraints/src/x10/constraint/XTerm_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerm_c.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.constraints/src/x10/constraint/XTerm_c.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -16,6 +16,10 @@ super(); } + public Solver solver() { + return null; + } + public final XTerm subst(XTerm y, XRoot x) { return subst(y, x, true); } Modified: trunk/x10.constraints/src/x10/constraint/XTerms.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XTerms.java 2008-11-10 19:15:34 UTC (rev 6703) +++ trunk/x10.constraints/src/x10/constraint/XTerms.java 2008-11-10 19:18:02 UTC (rev 6704) @@ -121,18 +121,4 @@ assert arg != null; return new XNot_c(arg); } - - // HACK: should be non-static - public static List<Solver> externalSolvers; - public static List<Solver> externalSolvers() { - if (externalSolvers == null) - return Collections.EMPTY_LIST; - return externalSolvers; - } - public static void addExternalSolvers(Solver s) { - if (externalSolvers == null) - externalSolvers = new ArrayList<Solver>(); - externalSolvers.add(s); - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-11 21:54:34
|
Revision: 6710 http://x10.svn.sourceforge.net/x10/?rev=6710&view=rev Author: tardieu Date: 2008-11-11 21:54:27 +0000 (Tue, 11 Nov 2008) Log Message: ----------- implemented and activated place checks. disable with -NO_PLACE_CHECKS option. Modified Paths: -------------- trunk/x10.compiler.p3/data/Async.xcd trunk/x10.compiler.p3/data/At.xcd trunk/x10.compiler.p3/data/Future.xcd trunk/x10.compiler.p3/data/Main.xcd trunk/x10.compiler.p3/data/Now.xcd trunk/x10.compiler.p3/data/ateach.xcd trunk/x10.compiler.p3/data/clock.xcd trunk/x10.compiler.p3/data/clocked-loop.xcd trunk/x10.compiler.p3/data/clocked.xcd trunk/x10.compiler.p3/data/foreach.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.dist/bin/x10.in trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Added Paths: ----------- trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 Removed Paths: ------------- trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Job.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Worker.x10 Modified: trunk/x10.compiler.p3/data/Async.xcd =================================================================== --- trunk/x10.compiler.p3/data/Async.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/Async.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,7 +1,7 @@ // SYNOPSIS: async(#0) clocked(#1) #2 -x10.runtime.Runtime.runAsync( - new x10.runtime.Activity(#1) { - public void runX10Task() { +x10.runtime.Runtime.runAsync(#1, + new x10.core.fun.VoidFun_0_0() { + public void apply() { #2 } }, #0); Modified: trunk/x10.compiler.p3/data/At.xcd =================================================================== --- trunk/x10.compiler.p3/data/At.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/At.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,10 +1,13 @@ -// SYNOPSIS: at(#0) #1 #2=unique_id +// SYNOPSIS: at(#0) #1 #2=unique_id { x10.lang.Place tmp#2 = x10.runtime.Runtime.here(#0); - new java.lang.Runnable() { - public void run() { - #1 - } - }.run(); - x10.runtime.Runtime.here(tmp#2); + try { + new x10.core.fun.VoidFun_0_0() { + public void apply() { + #1 + } + }.apply(); + } finally { + x10.runtime.Runtime.here(tmp#2); + } } Modified: trunk/x10.compiler.p3/data/Future.xcd =================================================================== --- trunk/x10.compiler.p3/data/Future.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/Future.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,7 +1,10 @@ // SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 x10.runtime.Runtime.runFuture(#3, - new x10.runtime.Future_c<#1>(#3) { - public #1 eval() { + new x10.core.fun.Fun_0_0<#1>() { + public #1 apply() { #2 } + public x10.types.Type<#1> rtt_x10$lang$Fun_0_0_U() { + return #3; + } }, #0) Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -7,9 +7,17 @@ public void main(final x10.core.Rail<java.lang.String> args) { x10.runtime.Runtime.start( - new x10.runtime.Activity() { - public void runX10Task() throws java.lang.Throwable { - #2.main(args); + new x10.core.fun.VoidFun_0_0() { + public void apply() { + try { + #2.main(args); + } catch (java.lang.RuntimeException e) { + throw e; + } catch (java.lang.Error e) { + throw e; + } catch (java.lang.Throwable t) { + throw new x10.lang.MultipleExceptions(t); + } } }); } Modified: trunk/x10.compiler.p3/data/Now.xcd =================================================================== --- trunk/x10.compiler.p3/data/Now.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/Now.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,7 +1,7 @@ // SYNOPSIS: now(#0) #1 -x10.runtime.Runtime.runNow( - new x10.runtime.Activity() { - public void runX10Task() { - #1 +x10.runtime.Runtime.runNow(#0, + new x10.core.fun.VoidFun_0_0() { + public void apply() { + #2 } - }, #0); + }); Modified: trunk/x10.compiler.p3/data/ateach.xcd =================================================================== --- trunk/x10.compiler.p3/data/ateach.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/ateach.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -4,9 +4,9 @@ for (x10.core.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 - x10.runtime.Runtime.runAsync( - new x10.runtime.Activity(#5) { - public void runX10Task() { + x10.runtime.Runtime.runAsync(#5, + new x10.core.fun.VoidFun_0_0() { + public void apply() { #4 } }, #2__distCopy.apply(#2)); Modified: trunk/x10.compiler.p3/data/clock.xcd =================================================================== --- trunk/x10.compiler.p3/data/clock.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/clock.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,2 +1,2 @@ // SYNOPSIS: #0=clock -(x10.runtime.Clock_c) #0 \ No newline at end of file +// NOT USED!!! \ No newline at end of file Modified: trunk/x10.compiler.p3/data/clocked-loop.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/clocked-loop.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,2 +1,2 @@ // SYNOPSIS: #0=clock #1=unique_id -add((x10.runtime.Clock_c) #0); +(x10.runtime.Clock_c) #0, \ No newline at end of file Modified: trunk/x10.compiler.p3/data/clocked.xcd =================================================================== --- trunk/x10.compiler.p3/data/clocked.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/clocked.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,4 +1,3 @@ // SYNOPSIS: clocked(#0) #1=unique_id -x10.core.RailFactory.<x10.runtime.Clock_c>makeRailFromJavaArray(new java.util.LinkedList() {{ - #0 -}}.toArray()) +x10.core.RailFactory.<x10.runtime.Clock_c>makeValRailFromJavaArray( + new x10.runtime.Clock_c[] { #0 }) Modified: trunk/x10.compiler.p3/data/foreach.xcd =================================================================== --- trunk/x10.compiler.p3/data/foreach.xcd 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/data/foreach.xcd 2008-11-11 21:54:27 UTC (rev 6710) @@ -2,9 +2,9 @@ for (x10.core.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 - x10.runtime.Runtime.runAsync( - new x10.runtime.Activity(#5) { - public void runX10Task() { + x10.runtime.Runtime.runAsync(#5, + new x10.core.fun.VoidFun_0_0() { + public void apply() { #4 } }, x10.runtime.Runtime.here()); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-11 21:54:27 UTC (rev 6710) @@ -2395,16 +2395,16 @@ private Template processClocks(Clocked c) { assert (null != c.clocks()); Template clocks = null; - if (c.clocks().isEmpty()) - clocks = null; - else if (c.clocks().size() == 1) - clocks = new Template("clock", c.clocks().get(0)); - else { +// if (c.clocks().isEmpty()) +// clocks = null; +// else if (c.clocks().size() == 1) +// clocks = new Template("clock", c.clocks().get(0)); +// else { Integer id = getUniqueId_(); clocks = new Template("clocked", new Loop("clocked-loop", c.clocks(), new CircularList(id)), id); - } +// } return clocks; } Modified: trunk/x10.dist/bin/x10.in =================================================================== --- trunk/x10.dist/bin/x10.in 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.dist/bin/x10.in 2008-11-11 21:54:27 UTC (rev 6710) @@ -26,7 +26,8 @@ -config) shift; config="$1.cfg";; -dev) dev="true";; -J*) java_args="${java_args} '${1##-J}'";; - -*) java_args="${java_args} -Dx10.${1##-}";; + -*=*) java_args="${java_args} -Dx10.${1##-}";; + -*) java_args="${java_args} -Dx10.${1##-}=true";; *.x10) args="$args '${1%%.x10}\$Main'";; *) args="$args '$1\$Main'"; shift; args="$args $*"; break;; esac Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -11,152 +11,37 @@ import x10.util.Stack; /** - * The representation of an X10 async activity. - * Note that an Activity object is created by a different thread than the one that executes it. - * @author Christian Grothoff, Christoph von Praun, vj - * @author Raj Barik, Vivek Sarkar * @author tardieu */ -public abstract class Activity(name: String) { - /** - * The FinishState of this activity. - */ - private var finishState: FinishState; - - /** - * The finishStack is lazily created. - */ - private var finishStack: Stack[FinishState]; - - /** - * The clock phases of this activity. Lazily created. - */ - private var clocks: Clocks; +class Activity(clockPhases:ClockPhases, finishStack:Stack[FinishState]) { + private val body:()=>Void; /** - * The clocks of the current activity. - */ - def clocks(): Clocks { - if (null == clocks) clocks = new Clocks(); - return clocks; - } - - /** - * Next statement = next on all clocks in parallel. - */ - def next(): void { - if (null != clocks) clocks.next(); - } - - // public constructors - - /** * Create an activity. */ - public def this(name: String) { - property(name); + def this(body:()=>Void) { + property(new ClockPhases(), new Stack[FinishState]()); + this.body = body; } - public def this() { - this(""); - } - /** - * Create an activity with the given rail of clocks. + * Create a clocked activity. */ - public def this(rail: Rail[Clock_c], name: String) { - this(name); - clocks = new Clocks(); - clocks.register(rail); + def this(body:()=>Void, clocks:ValRail[Clock_c], phases:ValRail[Int]) { + this(body); + clockPhases.register(clocks, phases); } - public def this(rail: Rail[Clock_c]) { - this(rail, ""); - } - /** - * Create an activity with the given clock. + * Run the activity. */ - public def this(clock: Clock_c, name: String) { - this(name); - clocks = new Clocks(); - clocks.register(clock); - } - - public def this(clock: Clock_c) { - this(clock, ""); - } - - // runnable - - /** - * Implemented by X10 activities, actual activity "user" code - * generated by xcd templates. - */ - public abstract def runX10Task(): void throws Throwable; - - /** - * Default implementation of the Runnable interface. - * An Activity executing in a place should always be invoked using it's runnable interface, - * and not directly by calling it's runX10Task method; which is an abstract method in this class. - * This run method allows performing actions before and after activity execution allowing - * to submit the activity safely as regard to runtime and pool thread. - */ - def run(): void { + def run():Void { try { - runX10Task(); - } catch (t: Throwable) { - pushException(t); + body(); + } catch (t:Throwable) { + finishStack.peek().pushException(t); } - if (null != clocks) clocks.drop(); - finishState.notifySubActivityTermination(); + clockPhases.drop(); + finishStack.peek().notifySubActivityTermination(); } - - // finish state - - /** - * Return the finish state of the current activity - */ - def finishState(): FinishState { - return finishState; - } - - /** - * Set the root finish state of the current activity - * Notify the finish state of a spawned activity - */ - def finishState(state: FinishState): void { - finishState = state; - state.notifySubActivitySpawn(); - } - - /** - * Start executing this activity synchronously - * (i.e. within a finish statement). - */ - def startFinish(): void { - if (null == finishStack) finishStack = new Stack[FinishState](); - finishStack.push(finishState); - finishState = new FinishState(); - } - - /** - * Suspend until all activities spawned during this finish - * operation have terminated. Throw an exception if any - * async terminated abruptly. Otherwise continue normally. - * Should only be called by the thread executing the current activity. - */ - def stopFinish(): void { - val state = finishState; - finishState = finishStack.pop(); - state.waitForFinish(); - } - - /** - * Push the exception thrown while executing s in a finish s, - * onto the finish state. - */ - def pushException(t: Throwable): void { - finishState.pushException(t); - } } Copied: trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 (from rev 6709, trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10) =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 (rev 0) +++ trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -0,0 +1,33 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008. + * + * This file is part of X10 Language. + * + */ + +package x10.runtime; + +import x10.util.HashMap; + +/** + * @author tardieu + */ +class ClockPhases extends HashMap[Clock_c,Int] { + def register(clock:Clock_c, phase:Int):Void { + clock.register_c(this, phase); + } + + def register(clocks:ValRail[Clock_c], phases:ValRail[Int]):Void { + for(var i:Int = 0; i < clocks.length; i++) register(clocks(i), phases(i)); + } + + def next():Void { + for(clock:Clock_c in keySet()) clock.resume_c(); + for(clock:Clock_c in keySet()) clock.next_c(); + } + + def drop():Void { + for(clock:Clock_c in keySet()) clock.drop_c(); + } +} Modified: trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/ClockState.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -12,26 +12,26 @@ * @author tardieu */ class ClockState { - static val FIRST_PHASE = 1; + const FIRST_PHASE = 1; - private var count: int = 1; - private var alive: int = 1; - private var phase: int = FIRST_PHASE; + private var count:Int = 1; + private var alive:Int = 1; + private var phase:Int = FIRST_PHASE; - atomic def register(ph: int): void { + atomic def register(ph:Int):Void { ++count; if (-ph != phase) ++alive; } - atomic def resume(): void { + atomic def resume():Void { if (--alive == 0) { alive = count; ++phase; } } - def next(ph: int): void { - val abs: int; + def next(ph:Int):Void { + val abs:Int; if (ph < 0) { abs = -ph; } else { @@ -41,7 +41,7 @@ await (abs < phase); } - atomic def drop(ph: int): void { + atomic def drop(ph:Int):Void { --count; if (-ph != phase) resume(); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Clock_c.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -14,77 +14,71 @@ public value Clock_c extends Clock { private val state = new ClockState(); - private static def abs(z: int): int { - return (z<0) ? -z : z; - } + private static def abs(z:Int):Int = z < 0 ? -z : z; - public def this(name: String) { + public def this(name:String) { super(name); - Runtime.clocks().put(this, ClockState.FIRST_PHASE); + Runtime.clockPhases().put(this, ClockState.FIRST_PHASE); } - public def registered(): boolean { - return Runtime.clocks().containsKey(this); - } + public def registered():boolean = Runtime.clockPhases().containsKey(this); - public def dropped(): boolean { - return !registered(); - } + public def dropped():boolean = !registered(); - public def resume(): void { + public def resume():Void { if (dropped()) throw new ClockUseException(); val ph = ph_c(); if (ph < 0) throw new ClockUseException(); finish async (state) state.resume(); - Runtime.clocks().put(this, -ph); + Runtime.clockPhases().put(this, -ph); } - public def next(): void { + public def next():Void { if (dropped()) throw new ClockUseException(); next_c(); } - public def phase(): int { - if (dropped()) throw new ClockUseException(); - return abs(ph_c()); - } + public def phase():Int = abs(phase_c()); - public def drop(): void { + public def drop():Void { if (dropped()) throw new ClockUseException(); - val ph = Runtime.clocks().remove(this) to Int; + val ph = Runtime.clockPhases().remove(this) to Int; async (state) state.drop(ph); } - public def hashCode(): int { + public def hashCode():Int { return state.hashCode(); } - def register_c(clocks: Clocks): void { - if (dropped()) throw new ClockUseException(); - val ph = ph_c(); + def register_c(clockPhases:ClockPhases, ph:Int):Void { finish async (state) state.register(ph); - clocks.put(this, ph); + clockPhases.put(this, ph); } - def resume_c(): void { + def resume_c():Void { val ph = ph_c(); if (ph < 0) return; finish async (state) state.resume(); - Runtime.clocks().put(this, -ph); + Runtime.clockPhases().put(this, -ph); } - def next_c(): void { + def next_c():Void { val ph = ph_c(); finish async (state) state.next(ph); - Runtime.clocks().put(this, abs(ph) + 1); + Runtime.clockPhases().put(this, abs(ph) + 1); } - def drop_c(): void { + def phase_c():Int { + if (dropped()) throw new ClockUseException(); + return ph_c(); + } + + def drop_c():Void { val ph = ph_c(); async (state) state.drop(ph); } - def ph_c(): int { - return Runtime.clocks()(this) to Int; + def ph_c():Int { + return Runtime.clockPhases()(this) to Int; } } Deleted: trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Clocks.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,33 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.runtime; - -import x10.util.HashMap; - -/** - * @author tardieu - */ -class Clocks extends HashMap[Clock_c,Int] { - def register(clock: Clock_c): void { - clock.register_c(this); - } - - def register(rail: Rail[Clock_c]): void { - for(clock: Clock_c in rail) register(clock); - } - - def next(): void { - for(clock: Clock_c in keySet()) clock.resume_c(); - for(clock: Clock_c in keySet()) clock.next_c(); - } - - def drop(): void { - for(clock: Clock_c in keySet()) clock.drop_c(); - } -} Modified: trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/FinishState.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -19,16 +19,19 @@ * @author Raj Barik, Vivek Sarkar * @author tardieu */ -class FinishState { - +value FinishState { /** * The Exception Stack is used to collect exceptions * issued when activities associated with this finish state terminate abruptly. - * This Object is lazily created */ - private var exceptions: Stack[Throwable]; + private val exceptions = new Stack[Throwable](); /** + * The monitor is used to serialize insertions into the Exception Stack. + */ + private val monitor = new Monitor(); + + /** * Keep track of current number of activities associated with this finish state */ private val latch = new ModCountDownLatch(0); @@ -37,9 +40,9 @@ * This method returns only when all spawned activity registered with this * FinishState have terminated either normally or abruptly. */ - def waitForFinish(): void { + def waitForFinish():Void { latch.await(); - if ((null != exceptions) && !exceptions.isEmpty()) { + if (!exceptions.isEmpty()) { if (exceptions.size() == 1) { val t = exceptions.pop(); if (t instanceof Error) { @@ -58,23 +61,26 @@ * An activity created under this finish has been created. Increment the count * associated with the finish. */ - def notifySubActivitySpawn(): void { - latch.updateCount(); + def notifySubActivitySpawn():Void { + at (latch) latch.updateCount(); } /** * An activity created under this finish has terminated. Decrement the count * associated with the finish and notify the parent activity if it is waiting. */ - def notifySubActivityTermination(): void { - latch.countDown(); + def notifySubActivityTermination():Void { + at (latch) latch.countDown(); } /** * Push an exception onto the stack. */ - atomic def pushException(t: Throwable): void { - if (null == exceptions) exceptions = new Stack[Throwable](); - exceptions.push(t); + def pushException(t:Throwable):Void { + at (exceptions) { + monitor.lock(); + exceptions.push(t); + monitor.unlock(); + } } } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -8,68 +8,68 @@ package x10.runtime; +import x10.util.Stack; + /** - * This class encapsulates the return value of a local async - * call and allows the client to wait for the completion of the - * async call (force future). - * @author Christian Grothoff - * @author Christoph von Praun - * @author vj - * @author Raj Barik, Vivek Sarkar + * The representation of an X10 future expression. * @author tardieu */ -public abstract class Future_c[T] extends Activity implements Future[T] { +public value Future_c[T] implements Future[T] { /** + * CountDownLatch for signaling and wait -- can be replaced by a boolean latch + */ + private val cdl = new ModCountDownLatch(1); + + /** * Set if the activity terminated with an exception. * Can only be of type Error or RuntimeException - * (since X10 only has unchecked exceptions). */ - private var exception: Box[Throwable]; + private val exception = new Stack[Throwable](); + + private val result:Rail[T]; + + private val eval:()=>T; + + public def this(eval:()=>T) { + this.eval = eval; + result = Rail.makeVar[T](1); + } + + public def forced():boolean = Runtime.remote[boolean](cdl, ()=>forced_c()); + + private def forced_c():boolean = cdl.getCount() == 0; - private var result: T; + public def apply():T = force(); - /** - * CountDownLatch for signaling and wait -- can be replaced by a boolean latch - */ - private val cdl = new ModCountDownLatch(1); + public def force():T = Runtime.remote[T](cdl, ()=>force_c()); - public def apply(): T { - return force(); - } - - public def force(): T { + private def force_c():T { cdl.await(); - if (exception !=null) { - val e = exception to Throwable; + if (!exception.isEmpty()) { + val e = exception.peek(); if (e instanceof Error) throw e as Error; if (e instanceof RuntimeException) throw e as RuntimeException; assert false as boolean; } - return result; + return result(0); } - public def forced(): boolean { - return cdl.getCount() == 0; - } - - public abstract def eval(): T; - - public def runX10Task(): void { + def run():Void { try { - startFinish(); + Runtime.startFinish(); try { - result = eval(); - } catch (t: Throwable) { - pushException(t); + result(0) = eval(); + } catch (t:Throwable) { + Runtime.pushException(t); } - stopFinish(); - } catch (t: Throwable) { + Runtime.stopFinish(); + } catch (t:Throwable) { // Now nested asyncs have terminated. - exception = t to Box[Throwable]; + exception.push(t); } finally { cdl.countDown(); - } - } + } + } } Deleted: trunk/x10.runtime.17/src-x10/x10/runtime/Job.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Job.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Job.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,17 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.runtime; - -/** - * Job submitted to thread pool - * @author tardieu - */ -value Job(activity: Activity, place: Place) { - def this(activity: Activity, place: Place) = property(activity, place); -} Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -8,82 +8,66 @@ package x10.runtime; +import x10.runtime.kernel.Runnable; import x10.runtime.kernel.Thread; import x10.util.Stack; /** - * Thread pool * @author tardieu */ -class Pool { - // TODO convert to value type - +class Pool implements Runnable { /** * Instance lock */ private val monitor = new Monitor(); /** - * Jobs not yet assigned to a worker + * Activities not yet assigned to a worker */ - private val jobs = new Stack[Job](); + private val activities = new Stack[Activity](); /** * Pool size */ - private var count: int; + private var count:Int; /** * Number of blocked activities in the pool */ - private var busy: int = 0; + private var busy:Int = 0; /** * Start count threads */ - def this(count: nat) { + def this(count:Int) { this.count = count; - for(var i: int = 0; i<count; i++) allocate(i); + for(var i:Int = 0; i < count; i++) allocate(i); } /** - * Submit a new job to the pool + * Submit a new activity to the pool */ - def execute(job: Job): void { + def execute(activity:Activity):Void { monitor.lock(); - jobs.push(job); + activities.push(activity); - // wake up available worker thread if any + // wake up available worker if any monitor.unpark(); monitor.unlock(); } - + /** - * Assign a job to calling worker - */ - def job(thread: Thread): Job { - monitor.lock(); - - // park worker thread - while (jobs.isEmpty()) monitor.park(); - - val job = jobs.pop(); - monitor.unlock(); - return job; - } - - /** * Start a new thread */ - def allocate(id: int): void { - new Thread(Place.FIRST_PLACE, new Worker(this), "thread-" + id.toString()).start(); + def allocate(id:Int):Void { + new Thread(location, this, "thread-" + id.toString()).start(); } /** * Increment number of blocked activities */ - def increase(): void { + def increase():Void { monitor.lock(); if (++busy >= count) allocate(count++); monitor.unlock(); @@ -92,9 +76,35 @@ /** * Decrement number of blocked activities */ - def decrease(): void { + def decrease():Void { monitor.lock(); --busy; monitor.unlock(); } + + /** + * Worker body + */ + public def run():Void { + val thread = Thread.currentThread(); + + // no need for termination condition + // termination of main activity governs program termination + while (true) { + monitor.lock(); + + // park worker until one activity can be executed + while (activities.isEmpty()) monitor.park(); + + // pop activity + val activity = activities.pop(); + monitor.unlock(); + + // attach thread to activity + thread.activity(activity); + + // run activity + at (activity) activity.run(); + } + } } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -9,113 +9,118 @@ package x10.runtime; import x10.runtime.kernel.InterruptedException; -import x10.runtime.kernel.Lock; -import x10.runtime.kernel.Runnable; import x10.runtime.kernel.Thread; /** * @author tardieu */ public value Runtime { - // TODO place check/place-cast of null? + // TODO place-cast of null? // TODO runNow // TODO configurable pools /** * One monitor per place */ - private const monitors = Rail.makeVal[Monitor](Place.MAX_PLACES, (id:nat)=>new Monitor()); - + private const monitors = Rail.makeVal[Monitor](Place.MAX_PLACES, + (id:Nat)=>Runtime.remote[Monitor](Place.place(id), ()=>new Monitor())); + /** * The common thread pool */ private const pool = new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)); +// private const pools = Rail.makeVal[Pool](Place.MAX_PLACES, +// (id:Nat)=>Runtime.remote[Pool](Place.place(id), ()=>new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)))); + /** * Notify the thread pool that one activity is about to block */ - static def threadBlockedNotification(): void { - pool.increase(); + static def threadBlockedNotification():Void { + at (Place.FIRST_PLACE) pool.increase(); } /** * Notify the thread pool that one activity has unblocked */ - static def threadUnblockedNotification(): void { - pool.decrease(); + static def threadUnblockedNotification():Void { + at (Place.FIRST_PLACE) pool.decrease(); } /** * Return the current activity */ - private static def current(): Activity { - return Thread.currentThread().activity() as Activity; - } + static def current():Activity = Thread.currentThread().activity() as Activity; + + /** + * Return the clock phases of the current activity + */ + static def clockPhases():ClockPhases = current().clockPhases(); /** - * Return the place of the current activity + * Return the current place */ - public static def here(): Place { - return Thread.currentThread().place() as Place; - } + public static def here():Place = Thread.currentThread().place() as Place; /** - * Set the place of the current activity - * Return the old place + * Set the current place + * Return the former place */ - public static def here(place: Place): Place { + public static def here(place:Place):Place { val thread = Thread.currentThread(); - val h = thread.place() as Place; + val p = thread.place() as Place; thread.place(place); - return h; + return p; } /** - * Return the clock phases of the current activity - */ - static def clocks(): Clocks { - return current().clocks(); - } - - /** * Run the main activity in a finish */ - public static def start(activity: Activity): void { - Thread.currentThread().activity(activity); - val state = new FinishState(); - activity.finishState(state); - activity.run(); - state.waitForFinish(); + public static def start(body:()=>Void):Void { + try { + val activity = new Activity(body); + Thread.currentThread().activity(activity); + val state = new FinishState(); + state.notifySubActivitySpawn(); + activity.finishStack.push(state); + activity.run(); + state.waitForFinish(); + } catch (t:Throwable) { + t.printStackTrace(); + } } /** * Run an async */ - public static def runAsync(activity: Activity, o: Object): void { - activity.finishState(current().finishState()); - val place = o instanceof Place ? o as Place : location(o); - pool.execute(new Job(activity, place)); + public static def runAsync(clocks:ValRail[Clock_c], body:()=>Void, place:Place):Void { + at (current()) { + val state = current().finishStack.peek(); + val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>clocks(i).phase_c()); + state.notifySubActivitySpawn(); + at (place) { + val activity = new Activity(body, clocks, phases); + activity.finishStack.push(state); + at (Place.FIRST_PLACE) pool.execute(activity); + } + } } /** * Run a future */ - public static def runFuture[T](future_c: Future_c[T], o: Object): Future[T] { - runAsync(future_c, o); - return future_c; + public static def runFuture[T](eval:()=>T, place:Place):Future[T] { + val futur = Runtime.remote[Future_c[T]](place, ()=>new Future_c[T](eval)); + runAsync(Rail.makeVal[Clock_c](0), ()=>futur.run(), place); + return futur; } - /** - * Now - */ - public static def runNow(activity: Activity, o: Object): void { - throw new RuntimeException("now not implemented"); - } + const PLACE_CHECKS = !Boolean.getBoolean("x10.NO_PLACE_CHECKS"); /** * Compute location */ - private static def location(o: Object): Place { + private static def location(o:Object):Place { if (o instanceof Ref) return (o as Ref).location; return here; } @@ -123,17 +128,30 @@ /** * Place check */ - public static def placeCheck(p: Place, o: Object): Object { -// if (null != o && location(o) != p) { -// throw new BadPlaceException("object=" + o + " access at place=" + p); -// } + public static def placeCheck(p:Place, o:Object):Object { + if (PLACE_CHECKS && null != o && location(o) != p) { + throw new BadPlaceException("object=" + o + " access at place=" + p); + } return o; } /** + * Remote computation + */ + static def remote[T](location:Object, eval:()=>T):T { + val ret = here; + val box = Rail.makeVar[T](1); + at (location instanceof Place ? location as Place :(location as Ref).location) { + val result = eval(); + at (ret) box(0) = result; + } + return box(0); + } + + /** * Lock current place */ - public static def lock(): void { + public static def lock():Void { monitors(here().id).lock(); } @@ -141,7 +159,7 @@ * Wait on current place lock * Must be called while holding the place lock */ - public static def await(): void { + public static def await():Void { monitors(here().id).await(); } @@ -149,9 +167,9 @@ * Unlock current place * Notify all */ - public static def release(): void { - monitors(here().id).unparkAll(); - monitors(here().id).unlock(); + public static def release():Void { + monitors(here().id).unparkAll(); + monitors(here().id).unlock(); } /** @@ -160,12 +178,12 @@ * @param millis the number of milliseconds to sleep * @return true if completed normally, false if interrupted */ - public static def sleep(millis: long): boolean { + public static def sleep(millis:long):Boolean { try { threadBlockedNotification(); Thread.sleep(millis); return true; - } catch (e: InterruptedException) { + } catch (e:InterruptedException) { return false; } finally { threadUnblockedNotification(); @@ -175,16 +193,16 @@ /** * Next statement = next on all clocks in parallel. */ - public static def next(): void { - current().next(); + public static def next():Void { + at (current()) current().clockPhases.next(); } /** * Start executing current activity synchronously * (i.e. within a finish statement). */ - public static def startFinish(): void { - current().startFinish(); + public static def startFinish():Void { + at (current()) current().finishStack.push(new FinishState()); } /** @@ -193,15 +211,15 @@ * async terminated abruptly. Otherwise continue normally. * Should only be called by the thread executing the current activity. */ - public static def stopFinish(): void { - current().stopFinish(); + public static def stopFinish():Void { + at (current()) current().finishStack.pop().waitForFinish(); } /** * Push the exception thrown while executing s in a finish s, * onto the finish state. */ - public static def pushException(t: Throwable): void { - current().pushException(t); + public static def pushException(t:Throwable):Void { + at (current()) current().finishStack.peek().pushException(t); } } Deleted: trunk/x10.runtime.17/src-x10/x10/runtime/Worker.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Worker.x10 2008-11-11 15:47:09 UTC (rev 6709) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Worker.x10 2008-11-11 21:54:27 UTC (rev 6710) @@ -1,42 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.runtime; - -import x10.runtime.kernel.Runnable; -import x10.runtime.kernel.Thread; - -/** - * Worker thread in thread pool - * @author tardieu - */ -value Worker(pool: Pool) implements Runnable { - def this(pool: Pool) = property(pool); - - /** - * Main loop - */ - public def run(): void { - val thread = Thread.currentThread(); - - // no need for termination condition - // termination of main activity governs program termination - while (true) { - - // request new job from pool - val job = pool.job(thread); - - // attach thread to place and activity - thread.place(job.place); - thread.activity(job.activity); - - // run activity - job.activity.run(); - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-14 04:58:06
|
Revision: 6766 http://x10.svn.sourceforge.net/x10/?rev=6766&view=rev Author: tardieu Date: 2008-11-14 04:58:01 +0000 (Fri, 14 Nov 2008) Log Message: ----------- added missing place checks in generated code Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-14 04:56:37 UTC (rev 6765) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-14 04:58:01 UTC (rev 6766) @@ -2194,7 +2194,12 @@ String pat = getJavaImplForDef(mi.x10Def()); if (pat != null) { - emitNativeAnnotation(pat, target, mi.typeParameters(), c.arguments()); + boolean needsHereCheck = needsHereCheck(target); + Template tmp = null; + if (needsHereCheck && ! (target instanceof TypeNode || target instanceof New)) { + tmp = new Template("place-check", new TypeExpander(target.type(), true, false, false, false), target); + } + emitNativeAnnotation(pat, null == tmp ? target : tmp, mi.typeParameters(), c.arguments()); return; } @@ -2541,7 +2546,7 @@ new Template("Now", n.clock(), n.body()).expand(tr2); } - boolean needsHereCheck( Expr target) { + boolean needsHereCheck( Receiver target) { boolean needsHereCheck = true; // calls on future literals needsHereCheck &= ! (target instanceof Future); @@ -2713,6 +2718,17 @@ return true; } + public void arrayPrint(Node n, Node array, CodeWriter w, Template tmp ) { + if (null == tmp) { + tr.print(n, array, w); + } else { + w.write("("); + tmp.expand(); + w.write(")"); + } + + } + public void visit(SettableAssign_c n) { SettableAssign_c a = n; Expr array = a.array(); @@ -2729,6 +2745,12 @@ TypeSystem ts = tr.typeSystem(); Type t = n.leftType(); + boolean needsHereCheck = needsHereCheck(array); + Template tmp = null; + if (needsHereCheck) { + tmp = new Template("place-check", new TypeExpander(array.type(), true, false, false, false), array); + } + boolean nativeop = false; if (t.isNumeric() || t.isBoolean() || t.isSubtype(ts.String())) { nativeop = true; @@ -2747,11 +2769,11 @@ String pat = getJavaImplForDef(mi.x10Def()); if (pat != null) { - emitNativeAnnotation(pat, array, mi.typeParameters(), args); + emitNativeAnnotation(pat, null == tmp ? array : tmp, mi.typeParameters(), args); return; } else { // otherwise emit the hardwired code. - tr.print(n, array, w); + arrayPrint(n, array, w, tmp); w.write(".set"); w.write("("); tr.print(n, n.right(), w); @@ -2764,7 +2786,7 @@ else if (! effects) { Binary.Operator op = SettableAssign_c.binaryOp(n.operator()); Name methodName = X10Binary_c.binaryMethodName(op); - tr.print(n, array, w); + arrayPrint(n, array, w, tmp); w.write(".set"); w.write("(("); tr.print(n, array, w); @@ -2852,7 +2874,7 @@ w.write(");"); w.newline(); w.write("} }.eval("); - tr.print(n, array, w); + arrayPrint(n, array, w, tmp); if (index.size() > 0) w.write(", "); new Join(", ", index).expand(); Modified: trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-14 04:56:37 UTC (rev 6765) +++ trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-14 04:58:01 UTC (rev 6766) @@ -26,7 +26,7 @@ */ @NativeRep("java", "x10.runtime.impl.java.Thread", null, null) -public class Thread { +public value Thread { public native def this(place:Object, runnable:Runnable, name:String):Thread; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-15 17:54:23
|
Revision: 6798 http://x10.svn.sourceforge.net/x10/?rev=6798&view=rev Author: tardieu Date: 2008-11-15 17:54:21 +0000 (Sat, 15 Nov 2008) Log Message: ----------- implemented at (p) expr Modified Paths: -------------- trunk/x10.compiler.p3/data/Async.xcd trunk/x10.compiler.p3/data/At.xcd trunk/x10.compiler.p3/data/Future.xcd trunk/x10.compiler.p3/data/ateach.xcd trunk/x10.compiler.p3/data/foreach.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10DelegatingVisitor.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler.p3/src/x10/parser/X10Parser.java trunk/x10.compiler.p3/src/x10/parser/x10.g trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Added Paths: ----------- trunk/x10.compiler.p3/data/AtExpr.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java Modified: trunk/x10.compiler.p3/data/Async.xcd =================================================================== --- trunk/x10.compiler.p3/data/Async.xcd 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/data/Async.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -1,7 +1,7 @@ // SYNOPSIS: async(#0) clocked(#1) #2 -x10.runtime.Runtime.runAsync(#1, +x10.runtime.Runtime.runAsync(#0, #1, new x10.core.fun.VoidFun_0_0() { public void apply() { #2 } - }, #0); + }); Modified: trunk/x10.compiler.p3/data/At.xcd =================================================================== --- trunk/x10.compiler.p3/data/At.xcd 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/data/At.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -1,13 +1,7 @@ // SYNOPSIS: at(#0) #1 #2=unique_id -{ - x10.lang.Place tmp#2 = x10.runtime.Runtime.here(#0); - try { - new x10.core.fun.VoidFun_0_0() { - public void apply() { - #1 - } - }.apply(); - } finally { - x10.runtime.Runtime.here(tmp#2); - } -} +x10.runtime.Runtime.runAt(#0, + new x10.core.fun.VoidFun_0_0() { + public void apply() { + #1 + } + }); Added: trunk/x10.compiler.p3/data/AtExpr.xcd =================================================================== --- trunk/x10.compiler.p3/data/AtExpr.xcd (rev 0) +++ trunk/x10.compiler.p3/data/AtExpr.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -0,0 +1,10 @@ +// SYNOPSIS: at[#1](#0) #2 #3=run-time type for #1 +x10.runtime.Runtime.evalAt(#3, #0, + new x10.core.fun.Fun_0_0<#1>() { + public #1 apply() { + #2 + } + public x10.types.Type<?> rtt_x10$lang$Fun_0_0_U() { + return #3; + } + }) Modified: trunk/x10.compiler.p3/data/Future.xcd =================================================================== --- trunk/x10.compiler.p3/data/Future.xcd 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/data/Future.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -1,5 +1,5 @@ // SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 -x10.runtime.Runtime.runFuture(#3, +x10.runtime.Runtime.evalFuture(#3, #0, new x10.core.fun.Fun_0_0<#1>() { public #1 apply() { #2 @@ -7,4 +7,4 @@ public x10.types.Type<?> rtt_x10$lang$Fun_0_0_U() { return #3; } - }, #0) + }) Modified: trunk/x10.compiler.p3/data/ateach.xcd =================================================================== --- trunk/x10.compiler.p3/data/ateach.xcd 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/data/ateach.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -4,11 +4,11 @@ for (x10.core.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 - x10.runtime.Runtime.runAsync(#5, + x10.runtime.Runtime.runAsync(#2__distCopy.apply(#2), #5, new x10.core.fun.VoidFun_0_0() { public void apply() { #4 } - }, #2__distCopy.apply(#2)); + }); } } Modified: trunk/x10.compiler.p3/data/foreach.xcd =================================================================== --- trunk/x10.compiler.p3/data/foreach.xcd 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/data/foreach.xcd 2008-11-15 17:54:21 UTC (rev 6798) @@ -2,10 +2,10 @@ for (x10.core.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 - x10.runtime.Runtime.runAsync(#5, + x10.runtime.Runtime.runAsync(x10.runtime.Runtime.here(), #5, new x10.core.fun.VoidFun_0_0() { public void apply() { #4 } - }, x10.runtime.Runtime.here()); + }); } Added: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr.java (rev 0) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -0,0 +1,21 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008 + * + * This file is part of X10 Language. + * + */ +/* + * + */ +package polyglot.ext.x10.ast; + +import polyglot.ast.Expr; +import polyglot.ext.x10.visit.ExprFlattener; +import polyglot.types.Type; + +/** The AST node for the X10 construct at (P) {e} + * + */ +public interface AtExpr extends Closure, RemoteActivityInvocation { +} Added: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java (rev 0) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtExpr_c.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -0,0 +1,163 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008 + * + * This file is part of X10 Language. + * + */ +/* + * @author Philippe Charles + * @author vj + */ +package polyglot.ext.x10.ast; + +import java.util.Collections; +import java.util.List; + +import polyglot.ast.Block; +import polyglot.ast.Expr; +import polyglot.ast.Expr_c; +import polyglot.ast.Node; +import polyglot.ast.Term; +import polyglot.ast.TypeNode; +import polyglot.ext.x10.types.ClosureDef; +import polyglot.ext.x10.types.X10Context; +import polyglot.ext.x10.types.X10NamedType; +import polyglot.ext.x10.types.X10TypeMixin; +import polyglot.ext.x10.types.X10TypeSystem; +import polyglot.ext.x10.visit.ExprFlattener; +import polyglot.ext.x10.visit.ExprFlattener.Flattener; +import polyglot.types.SemanticException; +import polyglot.types.Type; +import polyglot.types.Types; +import polyglot.util.CodeWriter; +import polyglot.util.Position; +import polyglot.visit.AscriptionVisitor; +import polyglot.visit.CFGBuilder; +import polyglot.visit.ContextVisitor; +import polyglot.visit.NodeVisitor; +import polyglot.visit.PrettyPrinter; +import polyglot.visit.ReachChecker; + + +/** A <code>AtExp </code> is a representation of the X10 at construct: + * <code>at (place) { expression }<code> + * stmts are used to represent the fully exploded version of the expression + * as might be needed in order to inline array expressions. + */ +public class AtExpr_c extends Closure_c + implements AtExpr { + + public Expr place; + + public AtExpr_c(Position p, Expr place, TypeNode returnType, Block body) { + super(p, Collections.EMPTY_LIST, Collections.EMPTY_LIST, returnType, null, Collections.EMPTY_LIST, body); + this.place = place; + } + + /** Get the RemoteActivity's place. */ + public Expr place() { + return place; + } + + /** Set the RemoteActivity's place. */ + public RemoteActivityInvocation place(Expr place) { + this.place = place; + return this; + } + + /** Visit the children of the expression. + * vj: TODO: I use a hack below to bypass + * visiting the embedded stmt if the visitor is a ReachChecker. + * Otherwise a reach error is generated that is in fact spurious. + * There must be a way to convince the ReachChecker legitimately that this statement + * is reachable if the future is reachable. + * */ + public Node visitChildren( NodeVisitor v ) { + Expr place = (Expr) visitChild( this.place, v ); + AtExpr_c n = (AtExpr_c) super.visitChildren(v); + if (n.place != place) { + if (n == this) n = (AtExpr_c) copy(); + n.place = place; + } + return n; + } + + /** Type check the expression. */ + public Node typeCheck( ContextVisitor tc ) throws SemanticException { + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); + + Type placeType = place.type(); + Expr newPlace = place; + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place()); + if ( ! placeIsPlace ) { + if (! placeIsPlace) { + throw new SemanticException( + "Place expression of at must be of type \"" + + place.type() + "\".", place.position()); + } + } + AtExpr_c n = (AtExpr_c) place(newPlace); + n = (AtExpr_c) super.typeCheck(tc); + + Type t = n.returnType().type(); + + return n.type(t); + } + 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 " at[" + returnType + "](" + place + ") " + body; + } + + /** Write the expression to an output file. */ + + public void prettyPrint(CodeWriter w, PrettyPrinter tr) { + w.write("at["); + printBlock(returnType, w, tr); + w.write("]("); + printSubExpr(place, false, w, tr); + w.write(") "); + printBlock(body, w, tr); + } + + /** + * Return the first (sub)term performed when evaluating this + * term. + */ + public Term firstChild() { + return returnType; + } + + /** + * Visit this term in evaluation order. + */ + public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { + v.visitCFG(returnType, place, ENTRY); + + // If building the CFG for the enclosing code, don't thread + // in the closure body. Otherwise, we're building the CFG + // for the closure itself. + if (! succs.isEmpty()) { + v.visitCFG(place, this, EXIT); + } + else { + v.visitCFG(place, body, ENTRY); + v.visitCFG(body, this, EXIT); + } + + /* + v.visitCFG(returnType, FlowGraph.EDGE_KEY_TRUE, body, ENTRY, + FlowGraph.EDGE_KEY_FALSE, this, EXIT); + */ + return succs; + } + +} Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory.java 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -55,6 +55,7 @@ ExtensionInfo extensionInfo(); AtStmt AtStmt(Position pos, Expr place, Stmt body); + AtExpr AtExpr(Position pos, Expr place, TypeNode returnType, Block body); X10AmbQualifierNode X10AmbQualifierNode(Position pos, Prefix prefix, Id name); X10AmbTypeNode X10AmbTypeNode(Position pos, Prefix prefix, Id name); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory_c.java 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10NodeFactory_c.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -276,6 +276,13 @@ return (Future) f.del(delFactory().delStmt()); } + public AtExpr AtExpr(Position pos, Expr place, TypeNode returnType, Block body) { + AtExpr f = new AtExpr_c(pos, place, returnType, body); + X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); + f = (AtExpr) f.ext(ext_fac.extFutureImpl()); + return (AtExpr) f.del(delFactory().delStmt()); + } + public Here Here(Position pos) { Here f = new Here_c(pos); f = (Here) f.ext(extFactory().extStmt()); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10DelegatingVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10DelegatingVisitor.java 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10DelegatingVisitor.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -92,6 +92,7 @@ import polyglot.ext.x10.ast.AssignPropertyCall_c; import polyglot.ext.x10.ast.Async_c; import polyglot.ext.x10.ast.AtEach_c; +import polyglot.ext.x10.ast.AtExpr_c; import polyglot.ext.x10.ast.AtStmt_c; import polyglot.ext.x10.ast.Atomic_c; import polyglot.ext.x10.ast.Await_c; @@ -253,6 +254,7 @@ if (n instanceof Instanceof_c) { visit((Instanceof_c)n); return; } if (n instanceof Here_c) { visit((Here_c)n); return; } if (n instanceof Future_c) { visit((Future_c)n); return; } + if (n instanceof AtExpr_c) { visit((AtExpr_c)n); return; } if (n instanceof X10Field_c) { visit((X10Field_c)n); return; } if (n instanceof Field_c) { visit((Field_c)n); return; } if (n instanceof DepParameterExpr_c) { visit((DepParameterExpr_c)n); return; } @@ -345,6 +347,7 @@ public void visit(Field_c n) { visit((Expr_c)n); } public void visit(X10Field_c n) { visit((Field_c)n); } public void visit(Future_c n) { visit((Expr_c)n); } + public void visit(AtExpr_c n) { visit((Expr_c)n); } public void visit(Here_c n) { visit((Expr_c)n); } public void visit(Instanceof_c n) { visit((Expr_c)n); } public void visit(X10Instanceof_c n) { visit((Instanceof_c)n); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -60,6 +60,7 @@ import polyglot.ext.x10.Configuration; import polyglot.ext.x10.ast.Async_c; import polyglot.ext.x10.ast.AtEach_c; +import polyglot.ext.x10.ast.AtExpr_c; import polyglot.ext.x10.ast.AtStmt_c; import polyglot.ext.x10.ast.Atomic_c; import polyglot.ext.x10.ast.Await_c; @@ -2501,6 +2502,11 @@ new Template("Future", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); } + public void visit(AtExpr_c f) { + Translator tr2 = ((X10Translator) tr).inInnerClass(true); + new Template("AtExpr", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); + } + public void visit(Formal_c f) { if (f.name().id().toString().equals("")) f = (Formal_c) f.name(f.name().id(Name.makeFresh("a"))); Modified: trunk/x10.compiler.p3/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/X10Parser.java 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/x10/parser/X10Parser.java 2008-11-15 17:54:21 UTC (rev 6798) @@ -2948,9 +2948,7 @@ //#line 1894 "/Users/nystrom/work/x10/1.7rel2/x10.compiler.p3/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(3); //#line 1896 "/Users/nystrom/work/x10/cvs/org.eclipse.imp.lpg.metatooling/templates/btParserTemplate.gi" - Block body = nf.Block(pos(), nf.AtStmt(pos(), PlaceExpressionSingleList, ClosureBody)); - Closure c = nf.Closure(pos(), Collections.EMPTY_LIST, Collections.EMPTY_LIST, (DepParameterExpr) null, nf.UnknownTypeNode(pos()), Collections.EMPTY_LIST, body); - setResult(nf.ClosureCall(pos(), c, Collections.EMPTY_LIST, Collections.EMPTY_LIST)); + setResult(nf.AtExpr(pos(), PlaceExpressionSingleList, nf.UnknownTypeNode(pos()), ClosureBody)); break; } Modified: trunk/x10.compiler.p3/src/x10/parser/x10.g =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/x10.g 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.compiler.p3/src/x10/parser/x10.g 2008-11-15 17:54:21 UTC (rev 6798) @@ -1893,9 +1893,7 @@ AtExpression ::= at PlaceExpressionSingleList ClosureBody /.$BeginJava - Block body = nf.Block(pos(), nf.AtStmt(pos(), PlaceExpressionSingleList, ClosureBody)); - Closure c = nf.Closure(pos(), Collections.EMPTY_LIST, Collections.EMPTY_LIST, (DepParameterExpr) null, nf.UnknownTypeNode(pos()), Collections.EMPTY_LIST, body); - setResult(nf.ClosureCall(pos(), c, Collections.EMPTY_LIST, Collections.EMPTY_LIST)); + setResult(nf.AtExpr(pos(), PlaceExpressionSingleList, nf.UnknownTypeNode(pos()), ClosureBody)); $EndJava ./ @@ -4516,6 +4514,7 @@ Now ::= NowStatement Async ::= AsyncStatement AtStmt ::= AtStatement + AtExpr ::= AtExpression Atomic ::= AtomicStatement When ::= WhenStatement ForEach ::= ForEachStatement @@ -4534,7 +4533,6 @@ Stmt ::= AssignPropertyCall Future ::= FutureExpression Expr ::= AsyncExpression - Expr ::= AtExpression DepParameterExpr ::= DepParametersopt | DepParameters List ::= Properties | Propertiesopt Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-15 17:54:21 UTC (rev 6798) @@ -35,13 +35,13 @@ result = Rail.makeVar[T](1); } - public def forced():boolean = Runtime.remote[boolean](cdl, ()=>forced_c()); + public def forced():boolean = at (cdl.location) forced_c(); private def forced_c():boolean = cdl.getCount() == 0; public def apply():T = force(); - public def force():T = Runtime.remote[T](cdl, ()=>force_c()); + public def force():T = at (cdl.location) force_c(); private def force_c():T { cdl.await(); Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-15 17:33:01 UTC (rev 6797) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-15 17:54:21 UTC (rev 6798) @@ -23,7 +23,7 @@ * One monitor per place */ private const monitors = Rail.makeVal[Monitor](Place.MAX_PLACES, - (id:Nat)=>Runtime.remote[Monitor](Place.place(id), ()=>new Monitor())); + (id:Nat)=>at (Place.place(id)) new Monitor()); /** * The common thread pool @@ -31,7 +31,7 @@ private const pool = new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)); // private const pools = Rail.makeVal[Pool](Place.MAX_PLACES, -// (id:Nat)=>Runtime.remote[Pool](Place.place(id), ()=>new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)))); +// (id:Nat)=>at (Place.place(id)) new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3))); /** * Notify the thread pool that one activity is about to block @@ -68,19 +68,8 @@ public static def here():Place = Thread.currentThread().place() as Place; /** - * Set the current place - * Return the former place + * Run main activity in a finish */ - public static def here(place:Place):Place { - val thread = Thread.currentThread(); - val p = thread.place() as Place; - thread.place(place); - return p; - } - - /** - * Run the main activity in a finish - */ public static def start(body:()=>Void):Void { try { val activity = new Activity(body); @@ -96,9 +85,9 @@ } /** - * Run an async + * Run async */ - public static def runAsync(clocks:ValRail[Clock_c], body:()=>Void, place:Place):Void { + public static def runAsync(place:Place, clocks:ValRail[Clock_c], body:()=>Void):Void { at (currentPlace()) { val state = current().finishStack.peek(); val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>clocks(i).phase_c()); @@ -112,14 +101,41 @@ } /** - * Run a future + * Run at statement */ - public static def runFuture[T](eval:()=>T, place:Place):Future[T] { - val futur = Runtime.remote[Future_c[T]](place, ()=>new Future_c[T](eval)); - runAsync(Rail.makeVal[Clock_c](0), ()=>futur.run(), place); + public static def runAt(place:Place, body:()=>Void):Void { + val thread = Thread.currentThread(); + val ret = thread.place() as Place; + thread.place(place); + try { + body(); + } finally { + thread.place(ret); + } + } + + /** + * Eval future expression + */ + public static def evalFuture[T](place:Place, eval:()=>T):Future[T] { + val futur = at (place) new Future_c[T](eval); + runAsync(place, Rail.makeVal[Clock_c](0), ()=>futur.run()); return futur; } + /** + * Eval at expression + */ + public static def evalAt[T](place:Place, eval:()=>T):T { + val ret = here; + val box = Rail.makeVar[T](1); + at (place) { + val result = eval(); + at (ret) box(0) = result; + } + return box(0); + } + const PLACE_CHECKS = !Boolean.getBoolean("x10.NO_PLACE_CHECKS"); /** @@ -141,19 +157,6 @@ } /** - * Remote computation - */ - static def remote[T](location:Object, eval:()=>T):T { - val ret = here; - val box = Rail.makeVar[T](1); - at (location instanceof Place ? location as Place :(location as Ref).location) { - val result = eval(); - at (ret) box(0) = result; - } - return box(0); - } - - /** * Lock current place */ public static def lock():Void { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-15 21:40:41
|
Revision: 6802 http://x10.svn.sourceforge.net/x10/?rev=6802&view=rev Author: tardieu Date: 2008-11-15 21:37:49 +0000 (Sat, 15 Nov 2008) Log Message: ----------- tweaked place checks Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/query/QueryEngine.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/query/QueryEngine.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/query/QueryEngine.java 2008-11-15 21:37:06 UTC (rev 6801) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/query/QueryEngine.java 2008-11-15 21:37:49 UTC (rev 6802) @@ -65,7 +65,6 @@ if (!Configuration.BAD_PLACE_RUNTIME_CHECK) return false; X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - if (ts.isPoint(t)) return true; if (ts.isValueType(t)) return false; return true; } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-15 21:37:06 UTC (rev 6801) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-15 21:37:49 UTC (rev 6802) @@ -2605,10 +2605,6 @@ boolean needsHereCheck( Receiver target) { boolean needsHereCheck = true; - // calls on future literals - needsHereCheck &= ! (target instanceof Future); - // calls on this - needsHereCheck &= ! (target instanceof Special); // calls on new objects needsHereCheck &= ! (target instanceof New); // others... Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-15 21:37:06 UTC (rev 6801) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-15 21:37:49 UTC (rev 6802) @@ -119,7 +119,7 @@ */ public static def evalFuture[T](place:Place, eval:()=>T):Future[T] { val futur = at (place) new Future_c[T](eval); - runAsync(place, Rail.makeVal[Clock_c](0), ()=>futur.run()); + async (place) futur.run(); return futur; } @@ -139,18 +139,10 @@ const PLACE_CHECKS = !Boolean.getBoolean("x10.NO_PLACE_CHECKS"); /** - * Compute location - */ - private static def location(o:Object):Place { - if (o instanceof Ref) return (o as Ref).location; - return here; - } - - /** * Place check */ public static def placeCheck(p:Place, o:Object):Object { - if (PLACE_CHECKS && null != o && location(o) != p) { + if (PLACE_CHECKS && null != o && o instanceof Ref && (o to Ref).location != p) { throw new BadPlaceException("object=" + o + " access at place=" + p); } return o; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-16 18:15:02
|
Revision: 6812 http://x10.svn.sourceforge.net/x10/?rev=6812&view=rev Author: tardieu Date: 2008-11-16 18:14:59 +0000 (Sun, 16 Nov 2008) Log Message: ----------- moved at (p) s implementation to native runtime. revised thread/pool implementation. Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.runtime.17/src-java/x10/core/Ref.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 Removed Paths: ------------- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runnable.x10 Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-16 18:14:59 UTC (rev 6812) @@ -2,14 +2,21 @@ public static class Main extends x10.runtime.impl.java.Runtime { public static void main(java.lang.String[] args) { - new Main().start(x10.lang.Place.FIRST_PLACE, args); + // start native runtime + new Main().start(args); } - + + // called by native runtime inside main x10 thread public void main(final x10.core.Rail<java.lang.String> args) { + // start xrx x10.runtime.Runtime.start( + // body of main activity new x10.core.fun.VoidFun_0_0() { public void apply() { + // catch and rethrow checked exceptions + // (closures cannot throw checked exceptions) try { + // call the original app-main method #2.main(args); } catch (java.lang.RuntimeException e) { throw e; Modified: trunk/x10.runtime.17/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-java/x10/core/Ref.java 2008-11-16 18:14:59 UTC (rev 6812) @@ -13,14 +13,14 @@ // Base class of all X10 ref objects -- should be generated, but we need this class to get Box to compile. public class Ref { - public final Object location; + public final int location; public Ref() { location = Thread.currentThread().place(); } /** Note: since this is final, it's important that the method name not conflict with any methods introduced by subclasses of Ref in X10 code. */ - public final Object location() { + public final int location() { return location; } Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Runtime.java 2008-11-16 18:14:59 UTC (rev 6812) @@ -10,10 +10,12 @@ public abstract class Runtime implements Runnable { private String[] args; - // main java thread - protected void start(final Object place, final String[] args) { + /** + * Body of main java thread + */ + protected void start(final String[] args) { this.args = args; - + // load libraries String property = System.getProperty("x10.LOAD"); if (null != property) { @@ -21,32 +23,80 @@ for (int i = libs.length-1; i>=0; i--) System.loadLibrary(libs[i]); } - // start and join main x10 thread - Thread thread = new Thread(place, this, "thread-main"); + // start and join main x10 thread in place 0 + Thread thread = new Thread(0, this, "thread-main"); thread.start(); try { thread.join(); } catch (InterruptedException e) {} - + // shutdown System.exit(exitCode); } - // main x10 thread + /** + * Body of main x10 thread + */ public void run() { // preload classes if (Boolean.getBoolean("x10.PRELOAD_CLASSES")) { PreLoader.preLoad(this.getClass().getEnclosingClass(), Boolean.getBoolean("x10.PRELOAD_STRINGS")); } - + // execute root x10 activity main(x10.core.RailFactory.<java.lang.String>makeRailFromJavaArray(args)); } - // root x10 activity + /** + * User code provided by Main template + * - start xrx runtime + * - run main activity + */ public abstract void main(x10.core.Rail<java.lang.String> args); - + + /** + * Application exit code + */ private static int exitCode = 0; + /** + * Set the application exit code + */ public static void setExitCode(int code) { exitCode = code; } + + /** + * Process place checks? + */ + public static final boolean PLACE_CHECKS = !Boolean.getBoolean("x10.NO_PLACE_CHECKS"); + + /** + * The number of places in the system + */ + public static final int MAX_PLACES = Integer.getInteger("x10.NUMBER_OF_LOCAL_PLACES", 4); + + /** + * The number of threads to allocate in the thread pool + */ + public static final int INIT_THREADS = Integer.getInteger("x10.INIT_THREADS_PER_PLACE", 3); + + /** + * Synchronously executes body at place(id) + */ + public static void runAt(int id, x10.core.fun.VoidFun_0_0 body) { + final Thread thread = Thread.currentThread(); + final int ret = thread.place(); + thread.place(id); // update thread place + try { + body.apply(); + } finally { + thread.place(ret); // restore thread place + } + } + + /** + * Return true if place(id) is local to this node + */ + public static boolean local(int id) { + return true; // single process implementation + } } Modified: trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java =================================================================== --- trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-java/x10/runtime/impl/java/Thread.java 2008-11-16 18:14:59 UTC (rev 6812) @@ -18,27 +18,50 @@ return (Thread) java.lang.Thread.currentThread(); } - private Object place; // the current place + private int place; // the current place private Object activity; // the current activity - public Thread(Object place, Runnable runnable, String name) { + /** + * Create main x10 thread (called by native runtime only ) + */ + Thread(int place, Runnable runnable, String name) { super(runnable, name); this.place = place; } + /** + * Create additional x10 threads (called by xrx only) + */ + public Thread(final x10.core.fun.VoidFun_0_0 body, String name) { + super(new Runnable() { public void run() { body.apply(); } }, name); + this.place = currentThread().place; + } + + /** + * Attach activity to thread + */ public void activity(Object activity) { this.activity = activity; } + /** + * Return current activity + */ public Object activity() { return activity; } - public void place(Object place) { + /** + * Update thread place (called by native runtime only) + */ + void place(int place) { this.place = place; } - public Object place() { + /** + * Return current place + */ + public int place() { return place; } } Modified: trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/lang/Place.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -14,7 +14,7 @@ * @author tardieu */ public final value Place(id: nat) { - public const MAX_PLACES = Int.getInteger("x10.NUMBER_OF_LOCAL_PLACES", 4); + public const MAX_PLACES = x10.runtime.kernel.Runtime.MAX_PLACES; public const places = Rail.makeVal[Place](MAX_PLACES, ((id: nat) => new Place(id))); public const FIRST_PLACE = place(0); Modified: trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/lang/Ref.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -20,7 +20,7 @@ @NativeRep("java", "x10.core.Ref", null, null) @NativeRep("c++", "x10aux::ref<x10::lang::Ref>", "x10::lang::Ref", null) public class Ref( - @Native("java", "(x10.lang.Place) #0.location()") + @Native("java", "x10.lang.Place.place(#0.location())") @Native("c++", "/*TODO: PLACES_NOT_IMPLEMENTED*/0") location: Place) { Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Monitor.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -16,7 +16,7 @@ * Lock with wait/notify capability implemented using park/unpark * @author tardieu */ -value Monitor { +class Monitor { /** * Instance lock */ Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Pool.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -8,16 +8,17 @@ package x10.runtime; -import x10.runtime.kernel.Runnable; import x10.runtime.kernel.Thread; import x10.util.Stack; /** * @author tardieu */ -class Pool implements Runnable { +value Pool { + // at statements in this class are guaranteed to be local to the node + /** - * Instance lock + * Pool lock */ private val monitor = new Monitor(); @@ -27,20 +28,16 @@ private val activities = new Stack[Activity](); /** - * Pool size + * counters(0) = pool size, counters(1) = nb of blocked threads + * invariant: counters(0) > counters(1) */ - private var count:Int; + private val counters = Rail.makeVar[Int](2, (nat)=>0); /** - * Number of blocked activities in the pool - */ - private var busy:Int = 0; - - /** * Start count threads */ def this(count:Int) { - this.count = count; + counters(0) = count; for(var i:Int = 0; i < count; i++) allocate(i); } @@ -48,44 +45,50 @@ * Submit a new activity to the pool */ def execute(activity:Activity):Void { - monitor.lock(); - activities.push(activity); - - // wake up available worker if any - monitor.unpark(); - - monitor.unlock(); + at (activities.location) { + monitor.lock(); + activities.push(activity); + + // wake up available worker if any + monitor.unpark(); + + monitor.unlock(); + } } /** * Start a new thread */ - def allocate(id:Int):Void { - new Thread(location, this, "thread-" + id.toString()).start(); + private def allocate(id:Int):Void { + new Thread(()=>this.run(), "thread-" + id.toString()).start(); } /** * Increment number of blocked activities */ def increase():Void { - monitor.lock(); - if (++busy >= count) allocate(count++); - monitor.unlock(); + at (activities.location) { + monitor.lock(); + if (++counters(1) >= counters(0)) allocate(counters(0)++); + monitor.unlock(); + } } /** * Decrement number of blocked activities */ def decrease():Void { - monitor.lock(); - --busy; - monitor.unlock(); + at (activities.location) { + monitor.lock(); + --counters(1); + monitor.unlock(); + } } /** * Worker body */ - public def run():Void { + private def run():Void { val thread = Thread.currentThread(); // no need for termination condition Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -10,38 +10,34 @@ import x10.runtime.kernel.InterruptedException; import x10.runtime.kernel.Thread; - +import x10.util.GrowableRail; /** * @author tardieu */ public value Runtime { // TODO place-cast of null? // TODO runNow - // TODO configurable pools // thread pool /** - * The common thread pool + * One thread pool per node */ - private const pool = new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3)); + private const pool = new Pool(x10.runtime.kernel.Runtime.INIT_THREADS); -// private const pools = Rail.makeVal[Pool](Place.MAX_PLACES, -// (id:Nat)=>at (Place.place(id)) new Pool(Int.getInteger("x10.INIT_THREADS_PER_PLACE", 3))); - /** * Notify the thread pool that one activity is about to block */ static def threadBlockedNotification():Void { - at (Place.FIRST_PLACE) pool.increase(); + pool.increase(); } /** * Notify the thread pool that one activity has unblocked */ static def threadUnblockedNotification():Void { - at (Place.FIRST_PLACE) pool.decrease(); + pool.decrease(); } @@ -55,7 +51,7 @@ /** * Return the current place */ - public static def here():Place = Thread.currentThread().place() as Place; + public static def here():Place = Place.place(Thread.currentThread().place()); // main @@ -75,8 +71,8 @@ t.printStackTrace(); } } - - + + // at statement -> at expression -> async -> future // do not introduce cycles!!! @@ -84,14 +80,7 @@ * Run at statement */ public static def runAt(place:Place, body:()=>Void):Void { - val thread = Thread.currentThread(); - val ret = thread.place() as Place; - thread.place(place); - try { - body(); - } finally { - thread.place(ret); - } + x10.runtime.kernel.Runtime.runAt(place.id, body); } /** @@ -99,7 +88,7 @@ */ public static def evalAt[T](place:Place, eval:()=>T):T { val ret = here; - val box = Rail.makeVar[T](1); + val box = new GrowableRail[T](); at (place) { val result = eval(); at (ret) box(0) = result; @@ -115,8 +104,7 @@ val state = current().finishStack.peek(); val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>clocks(i).phase_c()); state.notifySubActivitySpawn(); - val activity = at (place) new Activity(body, state, clocks, phases); - at (Place.FIRST_PLACE) pool.execute(activity); + at (place) pool.execute(new Activity(body, state, clocks, phases)); } } @@ -124,21 +112,22 @@ * Eval future expression */ public static def evalFuture[T](place:Place, eval:()=>T):Future[T] { - val futur = at (place) new Future_c[T](eval); - async (place) futur.run(); - return futur; + return at (place) { + val futur = new Future_c[T](eval); + async futur.run(); + futur + }; } // place checks - const PLACE_CHECKS = !Boolean.getBoolean("x10.NO_PLACE_CHECKS"); - /** * Place check */ public static def placeCheck(p:Place, o:Object):Object { - if (PLACE_CHECKS && null != o && o instanceof Ref && (o to Ref).location != p) { + if (x10.runtime.kernel.Runtime.PLACE_CHECKS && + null != o && o instanceof Ref && (o to Ref).location != p) { throw new BadPlaceException("object=" + o + " access at place=" + p); } return o; @@ -148,13 +137,14 @@ // atomic, await, when /** - * One monitor per place + * One monitor per place in the current node */ - private const monitors = Rail.makeVal[Monitor](Place.MAX_PLACES, - (id:Nat)=>at (Place.place(id)) new Monitor()); - + private const monitors = Rail.makeVal[Monitor](Place.MAX_PLACES, + (id:Nat)=> x10.runtime.kernel.Runtime.local(id) ? at (Place.place(id)) new Monitor() : null); + /** * Lock current place + * not reentrant! */ public static def lock():Void { monitors(here().id).lock(); Deleted: trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runnable.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runnable.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runnable.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -1,25 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2008 - * - * This file is part of X10 runtime. It is - * governed by the licence under which - * X10 is released. - * - */ -package x10.runtime.kernel; - -import x10.compiler.Native; -import x10.compiler.NativeRep; - -/** - * Runnable interface - */ -@NativeRep("java", "java.lang.Runnable", null, null) -public interface Runnable { - - @Native("java", "#0.run()") - public def run():void; - -} - Modified: trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Runtime.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -17,6 +17,35 @@ */ @NativeRep("java", "x10.runtime.impl.java.Runtime", null, null) public value Runtime { - @Native("java", "x10.runtime.impl.java.Runtime.setExitCode(#1)") + + /** + * Set system exit code + */ + @Native("java", "#0.setExitCode(#1)") public native static def setExitCode(code: int): void; + + // Configuration options + + @Native("java", "#0.PLACE_CHECKS") + public const PLACE_CHECKS = true; + + @Native("java", "#0.MAX_PLACES") + public const MAX_PLACES = 4; + + @Native("java", "#0.INIT_THREADS") + public const INIT_THREADS = 3; + + /** + * Run body at place(id). + * Wait for body to terminate. + * Must use current thread if in the same node!!! + */ + @Native("java", "#0.runAt(#1, #2)") + public native static def runAt(id:Int, body:()=>Void):Void; + + /** + * Return true if place(id) is in the current node. + */ + @Native("java", "#0.local(#1)") + public native static def local(id:Int):Boolean; } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-16 10:02:09 UTC (rev 6811) +++ trunk/x10.runtime.17/src-x10/x10/runtime/kernel/Thread.x10 2008-11-16 18:14:59 UTC (rev 6812) @@ -11,7 +11,6 @@ import x10.compiler.Native; import x10.compiler.NativeRep; -import x10.runtime.kernel.Runnable; import x10.runtime.kernel.InterruptedException; /** @@ -28,7 +27,10 @@ @NativeRep("java", "x10.runtime.impl.java.Thread", null, null) public value Thread { - public native def this(place:Object, runnable:Runnable, name:String):Thread; + /** + * Allocates new thread in current place + */ + public native def this(body:()=>Void, name:String):Thread; @Native("java", "#0.currentThread()") public static native def currentThread():Thread; @@ -58,11 +60,8 @@ public native def activity(activity:Object):void; @Native("java", "#0.place()") - public native def place():Object; + public native def place():Int; - @Native("java", "#0.place(#1)") - public native def place(place:Object):void; - @Native("java", "#0.getName()") public native def name():String; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-18 16:12:00
|
Revision: 6835 http://x10.svn.sourceforge.net/x10/?rev=6835&view=rev Author: tardieu Date: 2008-11-18 16:11:57 +0000 (Tue, 18 Nov 2008) Log Message: ----------- print stack trace from native runtime Modified Paths: -------------- trunk/x10.compiler.p3/data/Main.xcd trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/data/Main.xcd =================================================================== --- trunk/x10.compiler.p3/data/Main.xcd 2008-11-18 14:19:59 UTC (rev 6834) +++ trunk/x10.compiler.p3/data/Main.xcd 2008-11-18 16:11:57 UTC (rev 6835) @@ -8,25 +8,37 @@ // called by native runtime inside main x10 thread public void main(final x10.core.Rail<java.lang.String> args) { - // start xrx - x10.runtime.Runtime.start( - // body of main activity - new x10.core.fun.VoidFun_0_0() { - public void apply() { - // catch and rethrow checked exceptions - // (closures cannot throw checked exceptions) - try { - // call the original app-main method - #2.main(args); - } catch (java.lang.RuntimeException e) { - throw e; - } catch (java.lang.Error e) { - throw e; - } catch (java.lang.Throwable t) { - throw new x10.lang.MultipleExceptions(t); - } + try { + + // start xrx + x10.runtime.Runtime.start( + // body of main activity + new x10.core.fun.VoidFun_0_0() { + public void apply() { + // catch and rethrow checked exceptions + // (closures cannot throw checked exceptions) + try { + // call the original app-main method + #2.main(args); + } catch (java.lang.RuntimeException e) { + throw e; + } catch (java.lang.Error e) { + throw e; + } catch (java.lang.Throwable t) { + throw new x10.lang.MultipleExceptions(t); + } + } + }); + + } catch (java.lang.Throwable t) { + t.printStackTrace(); + if (t instanceof x10.lang.MultipleExceptions) { + x10.core.ValRail<Throwable> exceptions = ((x10.lang.MultipleExceptions) t).exceptions; + for(int i = 0; i < exceptions.length; i++) { + exceptions.get(i).printStackTrace(); } - }); + } + } } } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 14:19:59 UTC (rev 6834) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 16:11:57 UTC (rev 6835) @@ -63,18 +63,17 @@ * Run main activity in a finish */ public static def start(body:()=>Void):Void { - try { +// temporary: printStackTrace call moved to Main template (native code) +// try { val state = new FinishState(); val activity = new Activity(body, state); Thread.currentThread().activity(activity); state.notifySubActivitySpawn(); activity.run(); state.waitForFinish(); - } catch (t:Throwable) { - // temporary measure until we have a new stacktrace mechanism - Console.OUT.println("The activity did not catch: "+t); - //t.printStackTrace(); - } +// } catch (t:Throwable) { +// t.printStackTrace(); +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-18 21:51:53
|
Revision: 6842 http://x10.svn.sourceforge.net/x10/?rev=6842&view=rev Author: tardieu Date: 2008-11-18 21:51:49 +0000 (Tue, 18 Nov 2008) Log Message: ----------- implemented simple compiler-generated names for activities and futures Modified Paths: -------------- trunk/x10.compiler.p3/data/Async.xcd trunk/x10.compiler.p3/data/Future.xcd trunk/x10.compiler.p3/data/ateach.xcd trunk/x10.compiler.p3/data/foreach.xcd trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/data/Async.xcd =================================================================== --- trunk/x10.compiler.p3/data/Async.xcd 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.compiler.p3/data/Async.xcd 2008-11-18 21:51:49 UTC (rev 6842) @@ -1,7 +1,7 @@ -// SYNOPSIS: async(#0) clocked(#1) #2 +// SYNOPSIS: async(#0) clocked(#1) #2 #3=position x10.runtime.Runtime.runAsync(#0, #1, new x10.core.fun.VoidFun_0_0() { public void apply() { #2 } - }); + }, "async-#3"); Modified: trunk/x10.compiler.p3/data/Future.xcd =================================================================== --- trunk/x10.compiler.p3/data/Future.xcd 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.compiler.p3/data/Future.xcd 2008-11-18 21:51:49 UTC (rev 6842) @@ -1,4 +1,4 @@ -// SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 +// SYNOPSIS: future[#1](#0) #2 #3=run-time type for #1 #4=position x10.runtime.Runtime.evalFuture(#3, #0, new x10.core.fun.Fun_0_0<#1>() { public #1 apply() { @@ -7,4 +7,4 @@ public x10.types.Type<?> rtt_x10$lang$Fun_0_0_U() { return #3; } - }) + }, "future-#4") Modified: trunk/x10.compiler.p3/data/ateach.xcd =================================================================== --- trunk/x10.compiler.p3/data/ateach.xcd 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.compiler.p3/data/ateach.xcd 2008-11-18 21:51:49 UTC (rev 6842) @@ -1,4 +1,4 @@ -// SYNOPSIS: ateach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type +// SYNOPSIS: ateach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type #8=position { x10.lang.Dist #2__distCopy = #3; // make copy to avoid recomputation for (x10.core.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { @@ -9,6 +9,6 @@ public void apply() { #4 } - }); + }, "ateach-#8"); } } Modified: trunk/x10.compiler.p3/data/foreach.xcd =================================================================== --- trunk/x10.compiler.p3/data/foreach.xcd 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.compiler.p3/data/foreach.xcd 2008-11-18 21:51:49 UTC (rev 6842) @@ -1,4 +1,4 @@ -// SYNOPSIS: foreach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type +// SYNOPSIS: foreach (#0 #2: #1 in #3) clocked(#5) {#4} #6=locals #7=boxed type #8=position for (x10.core.Iterator<#7> #2__ = (#3).iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 @@ -7,5 +7,5 @@ public void apply() { #4 } - }); + }, "foreach-#8"); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/X10PrettyPrinterVisitor.java 2008-11-18 21:51:49 UTC (rev 6842) @@ -2470,7 +2470,8 @@ new Template("Async", a.place(), processClocks(a), - a.body()).expand(tr2); + a.body(), + a.position().nameAndLineString()).expand(tr2); } public void visit(AtStmt_c a) { @@ -2478,7 +2479,8 @@ new Template("At", a.place(), a.body(), - getUniqueId_()).expand(tr2); + getUniqueId_(), + a.position().nameAndLineString()).expand(tr2); } public void visit(Atomic_c a) { @@ -2499,12 +2501,12 @@ public void visit(Future_c f) { Translator tr2 = ((X10Translator) tr).inInnerClass(true); - new Template("Future", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); + new Template("Future", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type()), f.position().nameAndLineString()).expand(tr2); } public void visit(AtExpr_c f) { Translator tr2 = ((X10Translator) tr).inInnerClass(true); - new Template("AtExpr", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type())).expand(tr2); + new Template("AtExpr", f.place(), new TypeExpander(f.returnType().type(), true, true, false, false), f.body(), new RuntimeTypeExpander(f.returnType().type()), f.position().nameAndLineString()).expand(tr2); } public void visit(Formal_c f) { @@ -2585,7 +2587,8 @@ new Join("\n", new Join("\n", l.locals()), l.body()), processClocks(l), new Join("\n", l.locals()), - new TypeExpander(l.formal().type().type(), PRINT_TYPE_PARAMS | BOX_PRIMITIVES) + new TypeExpander(l.formal().type().type(), PRINT_TYPE_PARAMS | BOX_PRIMITIVES), + l.position().nameAndLineString() ).expand(tr2); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-18 21:51:49 UTC (rev 6842) @@ -13,14 +13,14 @@ /** * @author tardieu */ -class Activity(clockPhases:ClockPhases, finishStack:Stack[FinishState]) { +class Activity(clockPhases:ClockPhases, finishStack:Stack[FinishState], name:String) { private val body:()=>Void; /** * Create an activity. */ - def this(body:()=>Void, state:FinishState) { - property(new ClockPhases(), new Stack[FinishState]()); + def this(body:()=>Void, state:FinishState, name:String) { + property(new ClockPhases(), new Stack[FinishState](), name); this.body = body; finishStack.push(state); } @@ -28,8 +28,8 @@ /** * Create a clocked activity. */ - def this(body:()=>Void, state:FinishState, clocks:ValRail[Clock_c], phases:ValRail[Int]) { - this(body, state); + def this(body:()=>Void, state:FinishState, clocks:ValRail[Clock_c], phases:ValRail[Int], name:String) { + this(body, state, name); clockPhases.register(clocks, phases); } @@ -45,4 +45,6 @@ clockPhases.drop(); finishStack.peek().notifySubActivityTermination(); } + + public def toString():String = name; } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Future_c.x10 2008-11-18 21:51:49 UTC (rev 6842) @@ -15,7 +15,7 @@ * The representation of an X10 future expression. * @author tardieu */ -public value Future_c[T] extends Future[T] { +public value Future_c[T](name:String) extends Future[T] { /** * CountDownLatch for signaling and wait -- can be replaced by a boolean latch */ @@ -31,7 +31,8 @@ private val eval:()=>T; - public def this(eval:()=>T) { + public def this(eval:()=>T, name:String) { + property(name); this.eval = eval; result = new GrowableRail[T](); } @@ -63,5 +64,7 @@ } finally { cdl.countDown(); } - } + } + + public def toString():String = name; } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 21:28:23 UTC (rev 6841) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-18 21:51:49 UTC (rev 6842) @@ -66,7 +66,7 @@ // temporary: printStackTrace call moved to Main template (native code) // try { val state = new FinishState(); - val activity = new Activity(body, state); + val activity = new Activity(body, state, "root"); Thread.currentThread().activity(activity); state.notifySubActivitySpawn(); activity.run(); @@ -103,21 +103,21 @@ /** * Run async */ - public static def runAsync(place:Place, clocks:ValRail[Clock_c], body:()=>Void):Void { + public static def runAsync(place:Place, clocks:ValRail[Clock_c], body:()=>Void, name:String):Void { at (current().location) { val state = current().finishStack.peek(); val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>clocks(i).phase_c()); state.notifySubActivitySpawn(); - at (place) pool.execute(new Activity(body, state, clocks, phases)); + at (place) pool.execute(new Activity(body, state, clocks, phases, name)); } } /** * Eval future expression */ - public static def evalFuture[T](place:Place, eval:()=>T):Future[T] { + public static def evalFuture[T](place:Place, eval:()=>T, name:String):Future[T] { return at (place) { - val futur = new Future_c[T](eval); + val futur = new Future_c[T](eval, name); async futur.run(); futur }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2008-11-23 00:07:07
|
Revision: 6943 http://x10.svn.sourceforge.net/x10/?rev=6943&view=rev Author: sparksparkspark Date: 2008-11-23 00:06:58 +0000 (Sun, 23 Nov 2008) Log Message: ----------- Tweak @Native for arrays to generate prettier code Modified FRASimple.x10: -- renabled cmdline arguments (they work now) Modified Paths: -------------- trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 trunk/x10.runtime.17/src-x10/x10/lang/ValRail.x10 trunk/x10.tests/examples/Misc/FRASimple.x10 Modified: trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 2008-11-22 23:58:46 UTC (rev 6942) +++ trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 2008-11-23 00:06:58 UTC (rev 6943) @@ -45,15 +45,15 @@ public native static def $convert[U](r: ValRail[U]): Rail[U]{self.length==r.length}; @Native("java", "#0.get(#1)") - @Native("c++", "(#0)[#1]") + @Native("c++", "(*#0)[#1]") public native def get(i: nat): T; @Native("java", "#0.apply(#1)") - @Native("c++", "(#0)->operator[](#1)") + @Native("c++", "(*#0)[#1]") public native def apply(i: nat): T; @Native("java", "#0.set(#1, #2)") - @Native("c++", "(#0)->operator[](#2) = #1") + @Native("c++", "(*#0)[#2] = #1") public native def set(v: T, i: nat): T; @Native("java", "#0.iterator()") Modified: trunk/x10.runtime.17/src-x10/x10/lang/ValRail.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/ValRail.x10 2008-11-22 23:58:46 UTC (rev 6942) +++ trunk/x10.runtime.17/src-x10/x10/lang/ValRail.x10 2008-11-23 00:06:58 UTC (rev 6943) @@ -32,7 +32,7 @@ public native def get(i: nat): T; @Native("java", "#0.apply(#1)") - @Native("c++", "(#0)->operator[](#1)") + @Native("c++", "(*#0)[#1]") public native def apply(i: nat): T; @Native("java", "#0.iterator()") Modified: trunk/x10.tests/examples/Misc/FRASimple.x10 =================================================================== --- trunk/x10.tests/examples/Misc/FRASimple.x10 2008-11-22 23:58:46 UTC (rev 6942) +++ trunk/x10.tests/examples/Misc/FRASimple.x10 2008-11-23 00:06:58 UTC (rev 6943) @@ -35,7 +35,7 @@ const POLY = 0x0000000000000007L; const PERIOD = 1317624576693539401L; - const NUM_PLACES = Place.MAX_PLACES; + const NUM_PLACES = 4; //Place.MAX_PLACES; const PLACE_ID_MASK = NUM_PLACES-1; // Utility routine to start random number generator at Nth step @@ -82,14 +82,16 @@ public static def main(args:Rail[String]) { + val NUM_PLACES = 4; // hack until static init order is resolved + if ((NUM_PLACES & (NUM_PLACES-1)) > 0) { println("The number of places must be a power of 2."); return; } // calculate the size of update array (must be a power of 2) - val logLocalTableSize = /*args.length > 1 && args(0).equals("-m")? - int.parseInt(args(1)) :*/ 10; + val logLocalTableSize = args.length > 1 && args(0).equals("-m")? + int.parseInt(args(1)) : 10; val localTableSize = 1<<logLocalTableSize; val tableSize = localTableSize*NUM_PLACES; val NUM_UPDATES = 4*tableSize; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-11-25 16:24:48
|
Revision: 6995 http://x10.svn.sourceforge.net/x10/?rev=6995&view=rev Author: tardieu Date: 2008-11-25 16:24:44 +0000 (Tue, 25 Nov 2008) Log Message: ----------- fixed desugaring of *clocked* activities Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2008-11-25 15:31:56 UTC (rev 6994) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2008-11-25 16:24:44 UTC (rev 6995) @@ -47,7 +47,7 @@ super(job, ts, nf); } - private static QName CLOCK_CLASSNAME = QName.make("x10.runtime.Clock_c"); + private static QName CLOCK_CLASSNAME = QName.make("x10.lang.Clock"); private static QName RUNTIME_CLASSNAME = QName.make("x10.runtime.Runtime"); private static final String EVAL_AT = "evalAt"; private static final String EVAL_FUTURE = "evalFuture"; Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-25 15:31:56 UTC (rev 6994) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-25 16:24:44 UTC (rev 6995) @@ -27,7 +27,7 @@ /** * Create a clocked activity. */ - def this(body:()=>Void, state:FinishState, clocks:ValRail[Clock_c], phases:ValRail[Int], name:String) { + def this(body:()=>Void, state:FinishState, clocks:ValRail[Clock], phases:ValRail[Int], name:String) { this(body, name); finishStack.push(state); clockPhases.register(clocks, phases); Modified: trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 2008-11-25 15:31:56 UTC (rev 6994) +++ trunk/x10.runtime.17/src-x10/x10/runtime/ClockPhases.x10 2008-11-25 16:24:44 UTC (rev 6995) @@ -14,8 +14,8 @@ * @author tardieu */ class ClockPhases extends HashMap[Clock_c,Int] { - def register(clocks:ValRail[Clock_c], phases:ValRail[Int]):Void { - for(var i:Int = 0; i < clocks.length; i++) this.put(clocks(i), phases(i)); + def register(clocks:ValRail[Clock], phases:ValRail[Int]):Void { + for(var i:Int = 0; i < clocks.length; i++) this.put(clocks(i) as Clock_c, phases(i)); } def next():Void { Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-25 15:31:56 UTC (rev 6994) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-11-25 16:24:44 UTC (rev 6995) @@ -85,9 +85,9 @@ /** * Run async */ - public static def runAsync(place:Place, clocks:ValRail[Clock_c], body:()=>Void, name:String):Void { + public static def runAsync(place:Place, clocks:ValRail[Clock], body:()=>Void, name:String):Void { val state = current().finishStack.peek(); - val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>clocks(i).register_c()); + val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>(clocks(i) as Clock_c).register_c()); state.notifySubActivitySpawn(); NativeRuntime.runAt(place.id, ()=>pool.execute(new Activity(body, state, clocks, phases, name))); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2008-11-26 12:16:04
|
Revision: 7024 http://x10.svn.sourceforge.net/x10/?rev=7024&view=rev Author: dgrove-oss Date: 2008-11-26 12:15:54 +0000 (Wed, 26 Nov 2008) Log Message: ----------- In x10.dist/build.xml there are now three top-level dist targets: dist-java -- builds Java only dist-cpp -- builds C++ (also build Java because of dependencies) dist -- builds both Java and C++ Modified Paths: -------------- trunk/x10.dist/build.xml trunk/x10.runtime.17/build.xml Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2008-11-26 05:05:47 UTC (rev 7023) +++ trunk/x10.dist/build.xml 2008-11-26 12:15:54 UTC (rev 7024) @@ -70,7 +70,9 @@ <ant antfile="${x10.compiler.location}/build.xml" target="clean" inheritAll="false" dir="${x10.compiler.location}"/> </target> - <target name="dist" depends="init,build,common-jar,constraints-jar,runtime,compiler-jar"/> + <target name="dist-java" depends="init,build,common-jar,constraints-jar,runtime-java,compiler-jar"/> + <target name="dist-cpp" depends="dist-java,runtime-cpp"/> + <target name="dist" depends="dist-java,dist-cpp"/> <target name="lpg-jar" depends="init,lpg-local-jar" unless="local.lpg.jar"> <mkdir dir="${lib}"/> @@ -101,14 +103,18 @@ <echo message="${ant.project.name}: ${ant.file}"/> </target> - <target name="runtime" depends="init,common-jar,constraints-jar"> - <ant antfile="${x10.runtime.location}/build.xml" target="dist" inheritAll="false" dir="${x10.runtime.location}"/> + <target name="runtime-java" depends="init,common-jar,constraints-jar"> + <ant antfile="${x10.runtime.location}/build.xml" target="dist-java" inheritAll="false" dir="${x10.runtime.location}"/> <mkdir dir="${lib}"/> <copy todir="${lib}"> <fileset dir="${x10.runtime.location}/${builddir}" includes="${runtime.jar}"/> </copy> </target> + <target name="runtime-cpp" depends="init"> + <ant antfile="${x10.runtime.location}/build.xml" target="dist-cpp" inheritAll="false" dir="${x10.runtime.location}"/> + </target> + <target name="constraints-jar" depends="init"> <ant antfile="${x10.constraints.location}/build.xml" target="build" inheritAll="false" dir="${x10.constraints.location}"/> <!-- Modified: trunk/x10.runtime.17/build.xml =================================================================== --- trunk/x10.runtime.17/build.xml 2008-11-26 05:05:47 UTC (rev 7023) +++ trunk/x10.runtime.17/build.xml 2008-11-26 12:15:54 UTC (rev 7024) @@ -50,12 +50,16 @@ <arg value="distclean"/> </exec> </target> - <target name="dist" depends="jar,build-cpp" description="generate part of the distribution"> + <target name="dist-java" depends="jar"> <mkdir dir="${lib}"/> <copy todir="${lib}"> <fileset dir="${build}" includes="${jar}"/> </copy> </target> + <target name="dist-cpp" depends="build-cpp"> + </target> + <target name="dist" depends="dist-java,dist-cpp" description="generate part of the distribution"> + </target> <target name="jar" depends="build-java"> <jar jarfile="${build}/${jar}"> <fileset dir="${build}" includes="x10/**/*.class" excludes="${jar}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2008-11-26 14:14:21
|
Revision: 7026 http://x10.svn.sourceforge.net/x10/?rev=7026&view=rev Author: sparksparkspark Date: 2008-11-26 14:14:16 +0000 (Wed, 26 Nov 2008) Log Message: ----------- Made assert more verbose in Closure_c Had to comment out finish because it doesn't work in c++ (olivier: sorry) Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java 2008-11-26 14:13:42 UTC (rev 7025) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/Closure_c.java 2008-11-26 14:14:16 UTC (rev 7026) @@ -284,7 +284,7 @@ @Override public Context enterChildScope(Node child, Context c) { // We should have entered the method scope already. - assert c.currentCode() == this.closureDef(); + assert c.currentCode() == this.closureDef() : child.position().nameAndLineString(); if (child != body()) { // Push formals so they're in scope in the types of the other formals. Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-26 14:13:42 UTC (rev 7025) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2008-11-26 14:14:16 UTC (rev 7026) @@ -41,7 +41,9 @@ if (location == state.location) { // local async try { - try { body(); } finally { clockPhases.drop(); } + // [DC] FIXME: sorry but finally doesn't work in c++ + //try { body(); } finally { clockPhases.drop(); } + body(); clockPhases.drop(); state.notifySubActivityTermination(); } catch (t:Throwable) { state.notifySubActivityTermination(t); @@ -49,7 +51,9 @@ } else { // remote async try { - finish try { body(); } finally { clockPhases.drop(); } + // [DC] FIXME: sorry but finally doesn't work in c++ + //finish try { body(); } finally { clockPhases.drop(); } + body(); clockPhases.drop(); val c = () => state.notifySubActivityTermination(); NativeRuntime.runAt(state.location.id, c); } catch (t:Throwable) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2008-12-08 20:21:25
|
Revision: 7202 http://x10.svn.sourceforge.net/x10/?rev=7202&view=rev Author: tardieu Date: 2008-12-08 20:21:22 +0000 (Mon, 08 Dec 2008) Log Message: ----------- reenabled at statement implemented as finish async Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java 2008-12-08 20:02:07 UTC (rev 7201) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AtStmt_c.java 2008-12-08 20:21:22 UTC (rev 7202) @@ -21,9 +21,11 @@ import polyglot.ast.TypeNode; import polyglot.ast.Stmt_c; import polyglot.ext.x10.types.X10Context; +import polyglot.ext.x10.types.X10MethodDef; import polyglot.ext.x10.types.X10TypeSystem; import polyglot.main.Report; import polyglot.types.Context; +import polyglot.types.Ref; import polyglot.types.SemanticException; import polyglot.types.Type; import polyglot.types.TypeSystem; @@ -115,9 +117,18 @@ public Context enterScope(Context c) { if (Report.should_report(TOPICS, 5)) Report.report(5, "enter at scope"); - X10TypeSystem ts = (X10TypeSystem) c.typeSystem(); - c = c.pushCode(ts.asyncCodeInstance(c.inStaticContext())); - return c; + X10TypeSystem ts = (X10TypeSystem) c.typeSystem(); + X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); + if (c.currentCode() instanceof X10MethodDef) { + X10MethodDef outer = (X10MethodDef) c.currentCode(); + List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); + if (!capturedTypes.isEmpty()) { + asyncInstance = ((X10MethodDef) asyncInstance.copy()); + asyncInstance.setTypeParameters(capturedTypes); + } + } + c = c.pushCode(asyncInstance); + return c; } public Context enterChildScope(Node child, Context c) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2008-12-08 20:02:07 UTC (rev 7201) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2008-12-08 20:21:22 UTC (rev 7202) @@ -78,6 +78,7 @@ return Name.make("__desugarer__var__" + (count++) + "__"); } + private static final Name RUN_AT = Name.make("runAt"); private static final Name EVAL_AT = Name.make("evalAt"); private static final Name EVAL_FUTURE = Name.make("evalFuture"); private static final Name RUN_ASYNC = Name.make("runAsync"); @@ -98,10 +99,8 @@ return visitFuture((Future) n); if (n instanceof Async) return visitAsync((Async) n); - if (n instanceof AtStmt) { - assert (false) : ("At statements are deprecated"); - return n; - } + if (n instanceof AtStmt) + return visitAtStmt((AtStmt) n); if (n instanceof AtExpr) return visitAtExpr((AtExpr) n); if (n instanceof Here) @@ -158,6 +157,31 @@ xnf.Id(pos, implName), typeArgs, args).methodInstance(implMI).type(c.type()); } + private Stmt atStmt(Position pos, Stmt body, Expr place) throws SemanticException { + ClosureDef cDef = xts.closureDef(body.position(), Types.ref(context.currentClass()), + Types.ref(context.currentCode().asInstance()), + Types.ref(xts.Void()), Collections.EMPTY_LIST, + Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, + Collections.EMPTY_LIST); + Block block = body instanceof Block ? (Block) body : xnf.Block(body.position(), body); + Closure closure = (Closure_c) ((Closure_c) xnf.Closure(body.position(), Collections.EMPTY_LIST, + Collections.EMPTY_LIST, null, xnf.CanonicalTypeNode(pos, xts.Void()), + Collections.EMPTY_LIST, block)).closureDef(cDef).type(xts.closureAnonymousClassDef(cDef).asType()); + List<Expr> args = Arrays.asList(new Expr[] { place, closure }); + List<Type> mArgs = Arrays.asList(new Type[] { xts.Place(), cDef.asType() }); + MethodInstance implMI = xts.findMethod(xts.Runtime(), + xts.MethodMatcher(xts.Runtime(), RUN_AT, mArgs), + context.currentClassDef()); + return xnf.Eval(pos, xnf.X10Call(pos, xnf.CanonicalTypeNode(pos, xts.Runtime()), + xnf.Id(pos, RUN_AT), Collections.EMPTY_LIST, + args).methodInstance(implMI).type(xts.Void())); + } + + private Stmt visitAtStmt(AtStmt a) throws SemanticException { + Position pos = a.position(); + return atStmt(pos, a.body(), a.place()); + } + private Stmt async(Position pos, Stmt body, List clocks, Expr place, String prefix) throws SemanticException { ClosureDef cDef = xts.closureDef(body.position(), Types.ref(context.currentClass()), Types.ref(context.currentCode().asInstance()), Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-12-08 20:02:07 UTC (rev 7201) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2008-12-08 20:21:22 UTC (rev 7202) @@ -91,17 +91,10 @@ } - // async -> at expression -> future + // async -> at statement -> at expression -> future // do not introduce cycles!!! /** - * Run at statement - */ - public static def runAt(place:Place, body:()=>Void):Void { - throw new RuntimeException("at statement is deprecated"); - } - - /** * Run async */ public static def runAsync(place:Place, clocks:ValRail[Clock], body:()=>Void, name:String):Void { @@ -122,14 +115,21 @@ } /** + * Run at statement + */ + public static def runAt(place:Place, body:()=>Void):Void { + finish async (place) body(); + } + + /** * Eval at expression */ public static def evalAt[T](place:Place, eval:()=>T):T { val ret = here; val box = new GrowableRail[T](); - finish async (place) { + at (place) { val result = eval(); - async (ret) box.add(result); + at (ret) box.add(result); } return box(0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2008-12-11 04:03:29
|
Revision: 7220 http://x10.svn.sourceforge.net/x10/?rev=7220&view=rev Author: sparksparkspark Date: 2008-12-11 04:03:20 +0000 (Thu, 11 Dec 2008) Log Message: ----------- changed primitive toString() to use snprintf added x10aux::main which is templated over "Runtime" (one should usually give it x10::runtime::Runtime) and "T" which is the class containing the static main method we will invoke. Uncommented some code from StringBuilder that ought to now work (code gen bug fixed some time ago) Refactored NQueensPar to not depend on DistUtil Removed (broken) use of printf from FRASimpleDist.x10 (native printf does not understand boxes) Modified Paths: -------------- trunk/x10.runtime.17/src-cpp/Makefile trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.cc trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.h trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h trunk/x10.runtime.17/src-cpp/x10aux/config.h trunk/x10.runtime.17/src-cpp/x10aux/string_utils.cc trunk/x10.runtime.17/src-cpp/x10aux/string_utils.h trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 trunk/x10.runtime.17/src-x10/x10/util/StringBuilder.x10 trunk/x10.tests/examples/Misc/FRASimpleDist.x10 trunk/x10.tests/examples/Misc/NQueensPar.x10 Modified: trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.cc 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.cc 2008-12-11 04:03:20 UTC (rev 7220) @@ -1,4 +1,6 @@ +#include <x10aux/config.h> #include <x10aux/boolean_utils.h> +#include <x10aux/string_utils.h> #include <x10/lang/String.h> \ @@ -11,11 +13,8 @@ using namespace std; using namespace x10aux; -ref<String> x10aux::boolean_utils::_trueString = String::Lit("true"); -ref<String> x10aux::boolean_utils::_falseString = String::Lit("false"); - const ref<String> x10aux::boolean_utils::toString(x10_boolean value) { - return value ? _trueString : _falseString; + return x10aux::to_string(value); } x10_boolean x10aux::boolean_utils::parseBoolean(const ref<String>& s) { Modified: trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.h 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/boolean_utils.h 2008-12-11 04:03:20 UTC (rev 7220) @@ -17,9 +17,6 @@ static const ref<x10::lang::String> toString(x10_boolean value); static x10_boolean parseBoolean(const ref<x10::lang::String>& s); - private: - static ref<x10::lang::String> _trueString; - static ref<x10::lang::String> _falseString; }; } Modified: trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/bootstrap.h 2008-12-11 04:03:20 UTC (rev 7220) @@ -2,14 +2,24 @@ #define X10AUX_BOOTSTRAP_H #include <x10aux/config.h> +#include <x10aux/pgas.h> +#include <x10aux/alloc.h> +#include <x10aux/string_utils.h> +#include <x10aux/init_dispatcher.h> #include <x10/lang/VoidFun_0_0.h> #include <x10/lang/String.h> +#include <x10/lang/Rail.h> +#include <x10/lang/Iterator.h> +#include <x10/runtime/Thread.h> + namespace x10 { namespace lang { template<class T> class Rail; } } namespace x10aux { + extern x10_int exitCode; + typedef void (*ApplicationMainFunction)(ref<x10::lang::Rail<ref<x10::lang::String> > >); class BootStrapClosure : public x10::lang::Value, @@ -40,8 +50,85 @@ }; + template<class Runtime, class T> int main(int ac, char **av) { + + x10aux::ref<x10::lang::Rail<x10aux::ref<x10::lang::String> > > args = + x10aux::convert_args(ac, av); - extern x10_int exitCode; +#ifndef NO_EXCEPTIONS + try { +#endif + x10aux::barrier(); + + // Initialise enough state to make this 'main' thread look like a normal x10 thread + // (e.g. make Thread::CurrentThread work properly). + x10::runtime::Thread::_make(x10aux::null, x10::lang::String::Lit("thread-main")); + + // Initialise the static fields of x10 classes. + x10aux::InitDispatcher::runInitializers(); + + // Construct closure to invoke the user's "public static def main(Rail[String]) : Void" + // if at place 0 otherwise wait for asyncs. + x10aux::ref<x10::lang::VoidFun_0_0> main_closure = + new (x10aux::alloc<x10::lang::VoidFun_0_0>(sizeof(x10aux::BootStrapClosure))) + x10aux::BootStrapClosure(T::main,args); + + Runtime::start(main_closure); // use XRX + //main_closure->apply(); // bypass XRX + //sleep(3); + +#ifndef NO_EXCEPTIONS + } catch(int exitCode) { + + x10aux::exitCode = exitCode; + + } catch(x10aux::__ref& e) { + + // Assume that only throwables can be thrown + // and things are never thrown by interface (always cast to a value/object class) + x10aux::ref<x10::lang::Throwable> &e_ = + static_cast<x10aux::ref<x10::lang::Throwable>&>(e); + + fprintf(stderr, "Uncaught exception at place %d of type: %s\n", + (int)x10_here(), e_->_type()->name().c_str()); + fprintf(stderr, "%s\n", e_->toString()->c_str()); + + x10aux::ref<x10::lang::ValRail<x10aux::ref<x10::lang::String> > > trace = + e_->getStackTrace(); + + x10aux::ref<x10::lang::Iterator<x10aux::ref<x10::lang::String> > > it = + trace->iterator(); + + while (it->hasNext()) { + fprintf(stderr, " at %s\n", it->next()->c_str()); + } + + x10aux::exitCode = 1; + + } catch(...) { + + fprintf(stderr, "Caught unrecognised exception at place %d\n", (int)x10_here()); + x10aux::exitCode = 1; + + } +#endif + + //fprintf(stderr, "Done with main in place %d", (int)x10_here()); + + x10aux::free_args(args); + + x10aux::shutdown(); + + if (getenv("X10_RXTX")!=NULL) + fprintf(stderr, "Place: %d rx: %lld tx: %lld\n", + (int)x10_here(), + (long long)x10aux::deserialized_bytes, + (long long)x10aux::serialized_bytes); + + return x10aux::exitCode; + } + + } #endif Modified: trunk/x10.runtime.17/src-cpp/x10aux/config.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/config.h 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/config.h 2008-12-11 04:03:20 UTC (rev 7220) @@ -161,6 +161,7 @@ typedef float x10_float; typedef double x10_double; + // We must use the same mangling rules as the compiler backend uses. // The c++ target has to mangle fields because c++ does not allow fields // and methods to have the same name. Modified: trunk/x10.runtime.17/src-cpp/x10aux/string_utils.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/string_utils.cc 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/string_utils.cc 2008-12-11 04:03:20 UTC (rev 7220) @@ -1,3 +1,6 @@ +#include <cmath> + +#include <x10aux/config.h> #include <x10aux/string_utils.h> #include <x10aux/rail_utils.h> #include <x10aux/alloc.h> @@ -27,7 +30,9 @@ //cerr << "free_args: freed array " << arr << endl; } + // [DC] I'm sure Igor will hate this but it will do for now. +/* template<class T> T x10aux::from_string(const ref<String> &s) { std::istringstream ss(*s); T x; @@ -36,7 +41,9 @@ } return x; } +*/ + // [DC] I'm sure Igor will hate this but it will do for now. template<class T> String to_string_general(T v) { std::ostringstream ss; @@ -46,45 +53,96 @@ return r; } -String x10aux::to_string(x10_boolean v) { +#define TO_STRING(SZ,T,FMT) \ +String x10aux::to_string(T v) { \ + char buf[SZ]; \ + int amt = ::snprintf(buf, sizeof buf, FMT, v); \ + assert((size_t)amt<sizeof buf && "buf too small "__TOKEN_STRING(SZ)" for "__TOKEN_STRING(T)); \ + String r; \ + r._constructor(buf); \ + return r; \ +} + +// hh is C99, not ansi c, so we use h instead. +// This is fine as va_args turns everything to int anyway +TO_STRING(4, unsigned char, "%hu") +TO_STRING(5, signed char, "%hd") + +//TO_STRING(6, unsigned short, "%hu") +TO_STRING(7, signed short, "%hd") + +TO_STRING(11, unsigned int, "%u") +TO_STRING(12, signed int, "%d") +TO_STRING(11, unsigned long, "%lu") +TO_STRING(12, signed long, "%ld") +TO_STRING(20, unsigned long long, "%llu") +TO_STRING(21, signed long long, "%lld") + +String x10aux::to_string(float v) { + return x10aux::to_string((double)v); +} + +// precondition: buf contains decimal point +void kill_excess_zeroes(char *buf, size_t sz) { + for(int i=sz-1 ; i>0 && (buf[i]=='0' || buf[i]=='\0') ; --i) { + if (buf[i-1]=='.') break; + buf[i] = '\0'; + } +} + + +String x10aux::to_string(double v) { + char buf[120] = ""; + if (::isnan(v)) { + ::snprintf(buf, sizeof buf, "NaN"); + } else if (v==INFINITY) { + ::snprintf(buf, sizeof buf, "Infinity"); + } else if (v==-INFINITY) { + ::snprintf(buf, sizeof buf, "-Infinity"); + } else if (fabs(v)>=1E-3 && fabs(v)<1E7) { + ::snprintf(buf, sizeof buf, "%.15f", v); + kill_excess_zeroes(buf, sizeof buf); + } else if (v==0) { + ::snprintf(buf, sizeof buf, "%.1f", v); + } else { + // scientific notation + int e = ::floor(::log(::fabs(v))/::log(10)); //exponent + // volatile because reordering could change computed floating point value + volatile double m = v / pow(10,e); //mantissa + if (e<-10) { + // avoid touching -Infinity + m = v * 1E10; + m /= pow(10,e+10); + } + if (e<0) { + ::snprintf(buf, sizeof buf, "%.1f", m); + } else { + ::snprintf(buf, sizeof buf, "%.16f", m); + } + kill_excess_zeroes(buf, sizeof buf); + char *rest = buf + strlen(buf); + ::snprintf(rest, sizeof(buf) + buf - rest, "E%d", e); + } String r; - r._constructor(v?"true":"false"); + r._constructor(buf); return r; } -String x10aux::to_string(x10_byte v) { - return to_string_general((int)v); +String x10aux::to_string(bool v) { + String r; + r._constructor(v?"true":"false"); + return r; } String x10aux::to_string(x10_char v) { - return to_string_general((char)v); + char v_[] = {(char)v,'\0'}; + String r; + r._constructor(v_); + return r; } - -String x10aux::to_string(x10_short v) { - return to_string_general((short)v); -} - -String x10aux::to_string(x10_int v) { - return to_string_general((int)v); -} - -String x10aux::to_string(x10_long v) { - return to_string_general((int64_t)v); -} - -String x10aux::to_string(x10_float v) { - return to_string_general((float)v); -} -String x10aux::to_string(x10_double v) { - return to_string_general((double)v); -} -String x10aux::to_string(const char *v) { - return to_string_general(std::string(v)); -} - -String x10aux::to_string(ref<ValRail<x10_char> > v) { +String x10aux::vrc_to_string(ref<ValRail<x10_char> > v) { std::string str(v->FMGL(length), '\0'); for (int i = 0; i < v->FMGL(length); ++i) str[i] = (*v)[i]; Modified: trunk/x10.runtime.17/src-cpp/x10aux/string_utils.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/string_utils.h 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-cpp/x10aux/string_utils.h 2008-12-11 04:03:20 UTC (rev 7220) @@ -18,27 +18,39 @@ void free_args(const ref<x10::lang::Rail<ref<x10::lang::String> > > &arr); - // these need to use the x10_ primitive typedefs, because otherwise they - // are not found. [DC] found by whom and by what mechanism? overload - // resolution respects typedefs... + // [DC] importing the old code requires me to put these back to what they + // were. Please add more options if types are not found, but do not use + // the x10_ typedefs since this will break the implementation in unpleasant + // ways. - x10::lang::String to_string(x10_boolean v); - x10::lang::String to_string(x10_byte v); + x10::lang::String to_string(bool v); + x10::lang::String to_string(unsigned char v); + x10::lang::String to_string(signed char v); + x10::lang::String to_string(unsigned short v); + x10::lang::String to_string(signed short v); + x10::lang::String to_string(unsigned int v); + x10::lang::String to_string(signed int v); + x10::lang::String to_string(unsigned long v); + x10::lang::String to_string(signed long v); + x10::lang::String to_string(unsigned long long v); + x10::lang::String to_string(signed long long v); + + x10::lang::String to_string(float v); + x10::lang::String to_string(double v); + + // special case -- we want a static error if it conflicts with any of the above x10::lang::String to_string(x10_char v); - x10::lang::String to_string(x10_short v); - x10::lang::String to_string(x10_int v); - x10::lang::String to_string(x10_long v); - x10::lang::String to_string(x10_float v); - x10::lang::String to_string(x10_double v); - x10::lang::String to_string(const char *v); - x10::lang::String to_string(x10aux::ref<x10::lang::ValRail<x10_char> > v); + // Used by x10/util/StringBuilder.x10 + x10::lang::String vrc_to_string(x10aux::ref<x10::lang::ValRail<x10_char> > v); +/* template<class T> ref<x10::lang::String> to_stringp(T v) { return to_string(v); } +*/ - template<class T> T from_string(const ref<x10::lang::String> &s); + //template<class T> T from_string(const ref<x10::lang::String> &s); } Modified: trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-x10/x10/lang/Rail.x10 2008-12-11 04:03:20 UTC (rev 7220) @@ -37,11 +37,11 @@ public native static def makeVar[S](length: nat): Rail[S]{self.length==length}; @Native("java", "x10.core.RailFactory.<#2>makeRailFromValRail(#3, #4)") - @Native("c++", "x10::lang::Rail<#2 >::make(#4)") + @Native("c++", "x10::lang::Rail<#1 >::make(#4)") public native static def make[U](r: ValRail[U]): Rail[U]{self.length==r.length}; @Native("java", "x10.core.RailFactory.<#2>makeRailFromValRail(#3, #4)") - @Native("c++", "x10::lang::Rail<#2 >::make(#4)") + @Native("c++", "x10::lang::Rail<#1 >::make(#4)") public native static def $convert[U](r: ValRail[U]): Rail[U]{self.length==r.length}; @Native("java", "#0.get(#1)") Modified: trunk/x10.runtime.17/src-x10/x10/util/StringBuilder.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/util/StringBuilder.x10 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.runtime.17/src-x10/x10/util/StringBuilder.x10 2008-12-11 04:03:20 UTC (rev 7220) @@ -17,16 +17,9 @@ } protected def addString(s: String): Builder[Object,String] { - for (var i: int = 0; i < s.length(); i++) { - val ch = s(i); - buf.add(ch); - } - // BROKEN code gen - /* for (ch in s.chars()) { buf.add(ch); } - */ return this; } @@ -35,7 +28,7 @@ } @Native("java", "new String(#1.getCharArray())") - @Native("c++", "x10aux::to_string(#1)") + @Native("c++", "x10aux::vrc_to_string(#1)") private static native def makeString(ValRail[Char]): String; public def result(): String { Modified: trunk/x10.tests/examples/Misc/FRASimpleDist.x10 =================================================================== --- trunk/x10.tests/examples/Misc/FRASimpleDist.x10 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.tests/examples/Misc/FRASimpleDist.x10 2008-12-11 04:03:20 UTC (rev 7220) @@ -118,8 +118,8 @@ // print statistics val GUPs = (cpuTime > 0.0 ? 1.0 / cpuTime : -1.0) * NUM_UPDATES / 1e9; - printf("CPU time used = %.2f seconds\n", cpuTime); - printf("%.6f Billion(10^9) Updates per second (GUP/s)\n", GUPs); + println("CPU time used = "+cpuTime+" seconds"); + println(GUPs+" Billion(10^9) Updates per second (GUP/s)"); // repeat for testing. randomAccessUpdate(NUM_UPDATES, logLocalTableSize, tables); @@ -138,7 +138,4 @@ static def println(s:String) = Console.OUT.println(s); - @Native("java", "System.out.printf(#1,#2)") - @Native("c++", "printf((#1)->c_str(), #2); fflush(stdout)") - public static native def printf(x:String, o:Object):void; } Modified: trunk/x10.tests/examples/Misc/NQueensPar.x10 =================================================================== --- trunk/x10.tests/examples/Misc/NQueensPar.x10 2008-12-10 19:15:51 UTC (rev 7219) +++ trunk/x10.tests/examples/Misc/NQueensPar.x10 2008-12-11 04:03:20 UTC (rev 7220) @@ -15,6 +15,16 @@ new Board().search(); } + public static def block(R: Region(1), P:Int):ValRail[Region(1)](P) = { + assert P >=0; + val low = R.min()(0), high = R.max()(0), count = high-low+1; + val baseSize = count/P, extra = count - baseSize*P; + ValRail.make[Region(1)](P, (i:Nat):Region(1) => { + val start = low+i*baseSize+ (i < extra? i:extra); + start..start+baseSize+(i < extra?0:-1) + }) + } + class Board { val q: Rail[Int]; @@ -52,7 +62,7 @@ return; } if (q.length==0) { - val R = DistUtil.block(0..N-1, P); + val R = block(0..N-1, P); //foreach ((q) in 0..P-1) // search(R(q)); for (var q:Int=0; q < P; ++q) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2009-01-27 04:35:27
|
Revision: 7310 http://x10.svn.sourceforge.net/x10/?rev=7310&view=rev Author: tardieu Date: 2009-01-27 04:35:23 +0000 (Tue, 27 Jan 2009) Log Message: ----------- improved xrx performance Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2009-01-26 15:11:50 UTC (rev 7309) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2009-01-27 04:35:23 UTC (rev 7310) @@ -108,7 +108,7 @@ if (n instanceof Future) return visitFuture((Future) n); if (n instanceof Async) - return visitAsync((Async) n); + return visitAsync(old, (Async) n); if (n instanceof AtStmt) return visitAtStmt((AtStmt) n); if (n instanceof AtExpr) @@ -217,6 +217,7 @@ } private Stmt async(Position pos, Stmt body, List clocks, Expr place, String prefix) throws SemanticException { + if (clocks.size() == 0) return async(pos, body, place, prefix); Type clockRailType = xts.ValRail(xts.Clock()); Tuple clockRail = (Tuple) xnf.Tuple(pos, clocks).type(clockRailType); Block block = body instanceof Block ? (Block) body : xnf.Block(body.position(), body); @@ -235,8 +236,64 @@ args).methodInstance(implMI).type(xts.Void())); } - private Stmt visitAsync(Async a) throws SemanticException { + private Stmt async(Position pos, Stmt body, Expr place, String prefix) throws SemanticException { + Block block = body instanceof Block ? (Block) body : xnf.Block(body.position(), body); + Closure closure = closure(body.position(), xts.Void(), Collections.EMPTY_LIST, block); + StringLit pString = xnf.StringLit(pos, prefix + pos.nameAndLineString()); + List<Expr> args = Arrays.asList(new Expr[] { place, closure, pString }); + List<Type> mArgs = Arrays.asList(new Type[] { + xts.Place(), closure.closureDef().asType(), xts.String() + }); + // TODO: merge with the call() function + MethodInstance implMI = xts.findMethod(xts.Runtime(), + xts.MethodMatcher(xts.Runtime(), RUN_ASYNC, mArgs), + context.currentClassDef()); + return xnf.Eval(pos, xnf.X10Call(pos, xnf.CanonicalTypeNode(pos, xts.Runtime()), + xnf.Id(pos, RUN_ASYNC), Collections.EMPTY_LIST, + args).methodInstance(implMI).type(xts.Void())); + } + + private Stmt async(Position pos, Stmt body, List clocks, String prefix) throws SemanticException { + if (clocks.size() == 0) return async(pos, body, prefix); + Type clockRailType = xts.ValRail(xts.Clock()); + Tuple clockRail = (Tuple) xnf.Tuple(pos, clocks).type(clockRailType); + Block block = body instanceof Block ? (Block) body : xnf.Block(body.position(), body); + Closure closure = closure(body.position(), xts.Void(), Collections.EMPTY_LIST, block); + StringLit pString = xnf.StringLit(pos, prefix + pos.nameAndLineString()); + List<Expr> args = Arrays.asList(new Expr[] { clockRail, closure, pString }); + List<Type> mArgs = Arrays.asList(new Type[] { + clockRailType, closure.closureDef().asType(), xts.String() + }); + // TODO: merge with the call() function + MethodInstance implMI = xts.findMethod(xts.Runtime(), + xts.MethodMatcher(xts.Runtime(), RUN_ASYNC, mArgs), + context.currentClassDef()); + return xnf.Eval(pos, xnf.X10Call(pos, xnf.CanonicalTypeNode(pos, xts.Runtime()), + xnf.Id(pos, RUN_ASYNC), Collections.EMPTY_LIST, + args).methodInstance(implMI).type(xts.Void())); + } + + private Stmt async(Position pos, Stmt body, String prefix) throws SemanticException { + Block block = body instanceof Block ? (Block) body : xnf.Block(body.position(), body); + Closure closure = closure(body.position(), xts.Void(), Collections.EMPTY_LIST, block); + StringLit pString = xnf.StringLit(pos, prefix + pos.nameAndLineString()); + List<Expr> args = Arrays.asList(new Expr[] { closure, pString }); + List<Type> mArgs = Arrays.asList(new Type[] { + closure.closureDef().asType(), xts.String() + }); + // TODO: merge with the call() function + MethodInstance implMI = xts.findMethod(xts.Runtime(), + xts.MethodMatcher(xts.Runtime(), RUN_ASYNC, mArgs), + context.currentClassDef()); + return xnf.Eval(pos, xnf.X10Call(pos, xnf.CanonicalTypeNode(pos, xts.Runtime()), + xnf.Id(pos, RUN_ASYNC), Collections.EMPTY_LIST, + args).methodInstance(implMI).type(xts.Void())); + } + + private Stmt visitAsync(Node old, Async a) throws SemanticException { Position pos = a.position(); + if (old instanceof Async && ((Async) old).place() instanceof Here) + return async(pos, a.body(), a.clocks(), "async-"); return async(pos, a.body(), a.clocks(), a.place(), "async-"); } Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2009-01-26 15:11:50 UTC (rev 7309) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Activity.x10 2009-01-27 04:35:23 UTC (rev 7310) @@ -17,7 +17,7 @@ private val body:()=>Void; /** - * Create an activity. + * Create root activity. */ def this(body:()=>Void, name:String) { property(new ClockPhases(), new Stack[FinishState](), name); @@ -25,8 +25,16 @@ } /** - * Create a clocked activity. + * Create spawned activity. */ + def this(body:()=>Void, state:FinishState, name:String) { + this(body, name); + finishStack.push(state); + } + + /** + * Create clocked spawned activity. + */ def this(body:()=>Void, state:FinishState, clocks:ValRail[Clock], phases:ValRail[Int], name:String) { this(body, name); finishStack.push(state); @@ -38,7 +46,7 @@ */ def run():Void { val state = finishStack.peek(); - if (location == state.location) { + if (location.id == state.location.id) { // local async try { body(); Modified: trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2009-01-26 15:11:50 UTC (rev 7309) +++ trunk/x10.runtime.17/src-x10/x10/runtime/Runtime.x10 2009-01-27 04:35:23 UTC (rev 7310) @@ -71,7 +71,7 @@ public static def start(body:()=>Void):Void { // temporary: printStackTrace call moved to Main template (native code) // try { - if (here.id == 0) { + if (Thread.currentThread().loc() == 0) { val activity = new Activity(body, "root"); Thread.currentThread().activity(activity); finish { @@ -98,22 +98,41 @@ * Run async */ public static def runAsync(place:Place, clocks:ValRail[Clock], body:()=>Void, name:String):Void { -// NativeRuntime.println("Runtime.runAsync place:"+place+" clocks:"+clocks+ -// " body:"+body+" name:"+name); val state = current().finishStack.peek(); val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>(clocks(i) as Clock_c).register_c()); state.notifySubActivitySpawn(); - if (place == here) { + if (place.id == Thread.currentThread().loc()) { pool.execute(new Activity(body, state, clocks, phases, name)); } else { - val c = ()=>{ -// NativeRuntime.println("pool: "+pool); - pool.execute(new Activity(body, state, clocks, phases, name)); - }; + val c = ()=>pool.execute(new Activity(body, state, clocks, phases, name)); NativeRuntime.runAt(place.id, c); } } + public static def runAsync(place:Place, body:()=>Void, name:String):Void { + val state = current().finishStack.peek(); + state.notifySubActivitySpawn(); + if (place.id == Thread.currentThread().loc()) { + pool.execute(new Activity(body, state, name)); + } else { + val c = ()=>pool.execute(new Activity(body, state, name)); + NativeRuntime.runAt(place.id, c); + } + } + + public static def runAsync(clocks:ValRail[Clock], body:()=>Void, name:String):Void { + val state = current().finishStack.peek(); + val phases = Rail.makeVal[Int](clocks.length, (i:Nat)=>(clocks(i) as Clock_c).register_c()); + state.notifySubActivitySpawn(); + pool.execute(new Activity(body, state, clocks, phases, name)); + } + + public static def runAsync(body:()=>Void, name:String):Void { + val state = current().finishStack.peek(); + state.notifySubActivitySpawn(); + pool.execute(new Activity(body, state, name)); + } + /** * Run at statement */ @@ -182,7 +201,7 @@ * not reentrant! */ public static def lock():Void { - monitors(here().id).lock(); + monitors(Thread.currentThread().loc()).lock(); } /** @@ -190,7 +209,7 @@ * Must be called while holding the place lock */ public static def await():Void { - monitors(here().id).await(); + monitors(Thread.currentThread().loc()).await(); } /** @@ -198,8 +217,9 @@ * Notify all */ public static def release():Void { - monitors(here().id).unparkAll(); - monitors(here().id).unlock(); + val loc = Thread.currentThread().loc(); + monitors(loc).unparkAll(); + monitors(loc).unlock(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-02-19 18:15:00
|
Revision: 7812 http://x10.svn.sourceforge.net/x10/?rev=7812&view=rev Author: dgrove-oss Date: 2009-02-19 18:14:57 +0000 (Thu, 19 Feb 2009) Log Message: ----------- Move README-c++, INSTALL-c++, and RELEASE.NOTES-c++ to x10.dist directory. Modified Paths: -------------- trunk/x10.cppbackend.17/build.xml Added Paths: ----------- trunk/x10.dist/INSTALL-c++ trunk/x10.dist/README-c++ trunk/x10.dist/RELEASE.NOTES-c++ Removed Paths: ------------- trunk/x10.cppbackend.17/INSTALL-c++ trunk/x10.cppbackend.17/README-c++ trunk/x10.cppbackend.17/RELEASE.NOTES-c++ Property Changed: ---------------- trunk/x10.dist/ Deleted: trunk/x10.cppbackend.17/INSTALL-c++ =================================================================== --- trunk/x10.cppbackend.17/INSTALL-c++ 2009-02-19 18:05:07 UTC (rev 7811) +++ trunk/x10.cppbackend.17/INSTALL-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -1,55 +0,0 @@ -(c) IBM Corporation - -This program is controlled by the Eclipse Public Licence v1.0. - -This is a distribution of the 1.7.2 release of the X10 Programming Language. -http://x10-lang.org/ -http://x10.sf.net/ - -To complete the installation, the scripts in bin/ may need to be made -executable. - -Set the JAVA_HOME environment variable to point to the -directory where you find bin/java. - -Java backend instructions -------------------------- -To compile an X10 source program using the Java backend, invoke -"bin/x10c <class_name>.x10". -See "bin/x10c --help" for command-line help. - -To run the compiled X10 class, invoke "bin/x10 <class_name>". -See "bin/x10 --help" for command-line help. - -C++ backend instructions ------------------------- -Make sure the X10LIB environment variable points to an installation -of the PGAS common runtime. - -To compile an X10 source program using the C++ backend, invoke -"bin/x10c++ -MAIN_CLASS=<class_name> <class_name>.x10". This will -produce an executable named "<class_name>" in the current -directory[*]. - -To run the compiled X10 executable in one place, invoke -"bin/runx10 ./<class_name>". -- To run in multiple places on Linux, run "bin/manager", and then - invoke "bin/launcher -t <nplaces> ./<class_name>". -- To run in multiple places on AIX, run - "LAPI_USE_SHMEM=yes poe ./<class_name> -procs <nplaces> -hostfile HOSTFILE". - See "man poe" for additional options and the format of HOSTFILE. - -[*] On Cygwin, the name will be "<class_name>.exe". If there is -only one class with a "main" method, the -MAIN_CLASS argument may -be omitted, but the compiler will then produce an executable with -the default name ("a.out" on Unix, "a.exe" on Cygwin). - -To speed up C++ compilation, use the -commandlineonly flag to make -the compiler only generate C++ code for the exact files specified -on the command line. Note that this will cause the code for user -files not specified on the command line to not be generated, even -if they are in the sourcepath and are used to validate the files -that are specified. - -December 2, 2008 - Deleted: trunk/x10.cppbackend.17/README-c++ =================================================================== --- trunk/x10.cppbackend.17/README-c++ 2009-02-19 18:05:07 UTC (rev 7811) +++ trunk/x10.cppbackend.17/README-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -1,18 +0,0 @@ -(c) IBM Corporation - -This program is controlled by the Eclipse Public Licence v1.0. - -This directory contains the 1.7.2 release of X10, including -the X10 C++ code generation backend. - -Prerequisites: -Set the JAVA_HOME environment variable to point to the -directory where you find bin/java. - -Prerequisites for the C++ backend: -Download and install the PGAS common runtime tarball. -Set the X10LIB environment variable to point to the -PGAS installation location. - -December 2, 2008 - Deleted: trunk/x10.cppbackend.17/RELEASE.NOTES-c++ =================================================================== --- trunk/x10.cppbackend.17/RELEASE.NOTES-c++ 2009-02-19 18:05:07 UTC (rev 7811) +++ trunk/x10.cppbackend.17/RELEASE.NOTES-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -1,59 +0,0 @@ -Tue Dec 2 10:12:04 EST 2008 - -Release 1.7.2 - -This release is the first to include the C++ code generation backend. -The C++ backend is not as mature as the Java backend, so expect some -rough edges. Your patience is appreciated. We will be working to -fix the known issues in the subsequent releases. Please use JIRA -(link at the bottom) to report bugs, after ensuring the problem is -not already reported. - -This release of the Experimental Concurrent Programming Language (X10) -supports the following additional features (since Release 1.5): - -- Generic classes and interfaces -- Function types and closures including methods with type parameters -- Type definitions -- Local type inference -- Scala-like syntax - -Additionally, bug fixes have been made throughout the system. - -The following features described in the 1.7 language manual do not -currently work with the Java backend and will be fixed in the subsequent -releases: - -- Type parameters on closures -- Non-static type definitions as class or interface members - (static type defs do work) -- Type definitions as package members (i.e., in the outermost scope of - a compilation unit) -- AST externalization to XML -- Shared local variables -- Extern methods - -Additionally, the following features described in the 1.7 language -manual do not currently work with the C++ backend and will be fixed in -the subsequent releases: - -- Garbage collection -- Generic virtual methods -- Invocation of virtual methods from constructors -- Finally blocks that modify or access local variables -- Exception stack traces on Cygwin and AIX - -Here's a list of known issues with the C++ backend: - -- Default values are not assigned to some value types -- Static initialization is sometimes incorrectly ordered (at the moment - it's very brittle, though somewhat controllable by the link order of - files) -- Operator overloading does not work correctly sometimes -- Hash codes are not computed correctly for some classes -- Out of memory errors not thrown (an assertion is tripped instead) -- Code generation errors for value assignments and closures in generics - -For a current list of issues, see the X10 JIRA: -http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&&pid=11812&resolution=-1 - Modified: trunk/x10.cppbackend.17/build.xml =================================================================== --- trunk/x10.cppbackend.17/build.xml 2009-02-19 18:05:07 UTC (rev 7811) +++ trunk/x10.cppbackend.17/build.xml 2009-02-19 18:14:57 UTC (rev 7812) @@ -46,9 +46,6 @@ </copy> <chmod perm="+x" file="${bin}/x10c++"/> <chmod perm="+x" file="${bin}/runx10"/> - <copy todir="${x10.dist.location}"> - <fileset dir="${basedir}" includes="INSTALL-c++,README-c++,RELEASE.NOTES-c++" /> - </copy> </target> <target name="jar" depends="build"> <jar jarfile="${build}/${jar}"> Property changes on: trunk/x10.dist ___________________________________________________________________ Modified: svn:ignore - etc gen include lib INSTALL-c++ README-c++ RELEASE.NOTES-c++ + etc gen include lib Copied: trunk/x10.dist/INSTALL-c++ (from rev 7811, trunk/x10.cppbackend.17/INSTALL-c++) =================================================================== --- trunk/x10.dist/INSTALL-c++ (rev 0) +++ trunk/x10.dist/INSTALL-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -0,0 +1,55 @@ +(c) IBM Corporation + +This program is controlled by the Eclipse Public Licence v1.0. + +This is a distribution of the 1.7.2 release of the X10 Programming Language. +http://x10-lang.org/ +http://x10.sf.net/ + +To complete the installation, the scripts in bin/ may need to be made +executable. + +Set the JAVA_HOME environment variable to point to the +directory where you find bin/java. + +Java backend instructions +------------------------- +To compile an X10 source program using the Java backend, invoke +"bin/x10c <class_name>.x10". +See "bin/x10c --help" for command-line help. + +To run the compiled X10 class, invoke "bin/x10 <class_name>". +See "bin/x10 --help" for command-line help. + +C++ backend instructions +------------------------ +Make sure the X10LIB environment variable points to an installation +of the PGAS common runtime. + +To compile an X10 source program using the C++ backend, invoke +"bin/x10c++ -MAIN_CLASS=<class_name> <class_name>.x10". This will +produce an executable named "<class_name>" in the current +directory[*]. + +To run the compiled X10 executable in one place, invoke +"bin/runx10 ./<class_name>". +- To run in multiple places on Linux, run "bin/manager", and then + invoke "bin/launcher -t <nplaces> ./<class_name>". +- To run in multiple places on AIX, run + "LAPI_USE_SHMEM=yes poe ./<class_name> -procs <nplaces> -hostfile HOSTFILE". + See "man poe" for additional options and the format of HOSTFILE. + +[*] On Cygwin, the name will be "<class_name>.exe". If there is +only one class with a "main" method, the -MAIN_CLASS argument may +be omitted, but the compiler will then produce an executable with +the default name ("a.out" on Unix, "a.exe" on Cygwin). + +To speed up C++ compilation, use the -commandlineonly flag to make +the compiler only generate C++ code for the exact files specified +on the command line. Note that this will cause the code for user +files not specified on the command line to not be generated, even +if they are in the sourcepath and are used to validate the files +that are specified. + +December 2, 2008 + Copied: trunk/x10.dist/README-c++ (from rev 7811, trunk/x10.cppbackend.17/README-c++) =================================================================== --- trunk/x10.dist/README-c++ (rev 0) +++ trunk/x10.dist/README-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -0,0 +1,18 @@ +(c) IBM Corporation + +This program is controlled by the Eclipse Public Licence v1.0. + +This directory contains the 1.7.2 release of X10, including +the X10 C++ code generation backend. + +Prerequisites: +Set the JAVA_HOME environment variable to point to the +directory where you find bin/java. + +Prerequisites for the C++ backend: +Download and install the PGAS common runtime tarball. +Set the X10LIB environment variable to point to the +PGAS installation location. + +December 2, 2008 + Copied: trunk/x10.dist/RELEASE.NOTES-c++ (from rev 7811, trunk/x10.cppbackend.17/RELEASE.NOTES-c++) =================================================================== --- trunk/x10.dist/RELEASE.NOTES-c++ (rev 0) +++ trunk/x10.dist/RELEASE.NOTES-c++ 2009-02-19 18:14:57 UTC (rev 7812) @@ -0,0 +1,59 @@ +Tue Dec 2 10:12:04 EST 2008 + +Release 1.7.2 + +This release is the first to include the C++ code generation backend. +The C++ backend is not as mature as the Java backend, so expect some +rough edges. Your patience is appreciated. We will be working to +fix the known issues in the subsequent releases. Please use JIRA +(link at the bottom) to report bugs, after ensuring the problem is +not already reported. + +This release of the Experimental Concurrent Programming Language (X10) +supports the following additional features (since Release 1.5): + +- Generic classes and interfaces +- Function types and closures including methods with type parameters +- Type definitions +- Local type inference +- Scala-like syntax + +Additionally, bug fixes have been made throughout the system. + +The following features described in the 1.7 language manual do not +currently work with the Java backend and will be fixed in the subsequent +releases: + +- Type parameters on closures +- Non-static type definitions as class or interface members + (static type defs do work) +- Type definitions as package members (i.e., in the outermost scope of + a compilation unit) +- AST externalization to XML +- Shared local variables +- Extern methods + +Additionally, the following features described in the 1.7 language +manual do not currently work with the C++ backend and will be fixed in +the subsequent releases: + +- Garbage collection +- Generic virtual methods +- Invocation of virtual methods from constructors +- Finally blocks that modify or access local variables +- Exception stack traces on Cygwin and AIX + +Here's a list of known issues with the C++ backend: + +- Default values are not assigned to some value types +- Static initialization is sometimes incorrectly ordered (at the moment + it's very brittle, though somewhat controllable by the link order of + files) +- Operator overloading does not work correctly sometimes +- Hash codes are not computed correctly for some classes +- Out of memory errors not thrown (an assertion is tripped instead) +- Code generation errors for value assignments and closures in generics + +For a current list of issues, see the X10 JIRA: +http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&&pid=11812&resolution=-1 + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |