From: <ta...@us...> - 2010-03-22 20:54:52
|
Revision: 13487 http://x10.svn.sourceforge.net/x10/?rev=13487&view=rev Author: tardieu Date: 2010-03-22 20:54:45 +0000 (Mon, 22 Mar 2010) Log Message: ----------- Darwin: added support for USE_32BIT and USE_64BIT. Both variables can be set to true at the same time to trigger an universal build. If neither variable is set, the default gcc architecture is used. These variables control both the behavior of the X10 build scripts (including GC build) and the behavior of the postcompiler. Prerequisites (e.g. PGAS) have to be built accordingly. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java trunk/x10.runtime/Make.rules trunk/x10.runtime/build.xml Modified: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-03-22 20:50:34 UTC (rev 13486) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-03-22 20:54:45 UTC (rev 13487) @@ -17,6 +17,8 @@ import polyglot.util.ErrorQueue; public class MacOSX_CXXCommandBuilder extends CXXCommandBuilder { + public static final boolean USE_32BIT = System.getenv("USE_32BIT")!=null; + public static final boolean USE_64BIT = System.getenv("USE_64BIT")!=null; public MacOSX_CXXCommandBuilder(Options options, ErrorQueue eq) { super(options,eq); @@ -27,6 +29,14 @@ protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); + if (USE_32BIT) { + cxxCmd.add("-arch"); + cxxCmd.add("i386"); + } + if (USE_64BIT) { + cxxCmd.add("-arch"); + cxxCmd.add("x86_64"); + } } protected void addPostArgs(ArrayList<String> cxxCmd) { Modified: trunk/x10.runtime/Make.rules =================================================================== --- trunk/x10.runtime/Make.rules 2010-03-22 20:50:34 UTC (rev 13486) +++ trunk/x10.runtime/Make.rules 2010-03-22 20:54:45 UTC (rev 13487) @@ -154,6 +154,12 @@ override CXXFLAGS_SHARED += -shared -undefined dynamic_lookup -fPIC override LDFLAGS_SHARED += -Wl,-install_name,'@rpath/$@' export X10RT_TEST_LDFLAGS = -Wl,-rpath -Wl,$(X10_HOME)/x10.runtime/x10rt/lib -Wl,-rpath -Wl,$(X10_HOME)/x10.runtime/x10rt + ifdef USE_32BIT + override CXXFLAGS += -arch i386 + endif + ifdef USE_64BIT + override CXXFLAGS += -arch x86_64 + endif AR = libtool ARFLAGS = -static -o else Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-03-22 20:50:34 UTC (rev 13486) +++ trunk/x10.runtime/build.xml 2010-03-22 20:54:45 UTC (rev 13487) @@ -78,10 +78,13 @@ </or> </and> </condition> - <!-- prepare for extra CFLAGS (darwin) --> - <condition property="bdwgc.CFLAGS" value="${env.CFLAGS}" else=""> - <isset property="env.CFLAGS" /> + <!-- darwin architectures --> + <condition property="darwin.32" value="-arch i386 " else=""> + <istrue value="${env.USE_32BIT}" /> </condition> + <condition property="darwin.64" value="-arch x86_64 " else=""> + <istrue value="${env.USE_64BIT}" /> + </condition> <condition property="cppmake.gcarg" value="ENABLE_GC=1" else="DISABLE_GC=1"> <isset property="bdwgc.enabled" /> </condition> @@ -321,7 +324,7 @@ <arg value="-enable-threads=posix" /> <arg value="-enable-thread-local-alloc" /> <arg value="--disable-dependency-tracking" /> - <env key="CFLAGS" value="${bdwgc.CFLAGS} -D_XOPEN_SOURCE" /> + <env key="CFLAGS" value="${darwin.32}${darwin.64}-D_XOPEN_SOURCE" /> <arg value="--prefix=${bdwgc.platform.dir}/install" /> </exec> </sequential> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2010-03-23 19:12:47
|
Revision: 13510 http://x10.svn.sourceforge.net/x10/?rev=13510&view=rev Author: sparksparkspark Date: 2010-03-23 19:12:33 +0000 (Tue, 23 Mar 2010) Log Message: ----------- Implement XTENLANG-1007, currently selected by user via @CUDADirectParams Modified Paths: -------------- trunk/x10.compiler/src/x10cuda/types/X10CUDAContext_c.java trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java trunk/x10.runtime/x10rt/common/x10rt_cuda.cc Modified: trunk/x10.compiler/src/x10cuda/types/X10CUDAContext_c.java =================================================================== --- trunk/x10.compiler/src/x10cuda/types/X10CUDAContext_c.java 2010-03-23 19:04:36 UTC (rev 13509) +++ trunk/x10.compiler/src/x10cuda/types/X10CUDAContext_c.java 2010-03-23 19:12:33 UTC (rev 13510) @@ -55,14 +55,16 @@ private Name blocksVar; public Name blocksVar() { return blocksVar; } private Name threadsVar; public Name threadsVar() { return threadsVar; } private SharedMem shm; public SharedMem shm() { return shm; } + private boolean directParams; public boolean directParams() { return directParams; } private ArrayList<VarInstance> kernelParams; public ArrayList<VarInstance> kernelParams() { return kernelParams; } - public void setCUDAKernelCFG(Expr blocks, Name blocksVar, Expr threads, Name threadsVar, SharedMem shm) { + public void setCUDAKernelCFG(Expr blocks, Name blocksVar, Expr threads, Name threadsVar, SharedMem shm, boolean directParams) { this.blocks = blocks; this.blocksVar = blocksVar; this.threads = threads; this.threadsVar = threadsVar; this.shm = shm; this.kernelParams = variables(); + this.directParams = directParams; if (autoBlocks!=null) this.kernelParams.add(autoBlocks.localDef().asInstance()); if (autoThreads!=null) Modified: trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java 2010-03-23 19:04:36 UTC (rev 13509) +++ trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java 2010-03-23 19:12:33 UTC (rev 13510) @@ -154,7 +154,8 @@ public class CUDACodeGenerator extends MessagePassingCodeGenerator { - private static final String CUDA_ANNOTATION = "x10.compiler.CUDA"; + private static final String ANN_KERNEL = "x10.compiler.CUDA"; + private static final String ANN_DIRECT_PARAMS = "x10.compiler.CUDADirectParams"; public CUDACodeGenerator(StreamWrapper sw, Translator tr) { super(sw, tr); @@ -193,11 +194,21 @@ // does the block have the annotation that denotes that it should be // split-compiled to cuda? - private boolean nodeHasCUDAAnnotation(Node n) { + private boolean blockIsKernel(Node n) { + return nodeHasAnnotation(n, ANN_KERNEL); + } + + // does the block have the annotation that denotes that it should be + // compiled to use conventional cuda kernel params + private boolean kernelWantsDirectParams(Node n) { + return nodeHasAnnotation(n, ANN_DIRECT_PARAMS); + } + + // does the block have the given annotation + private boolean nodeHasAnnotation(Node n, String ann) { X10Ext ext = (X10Ext) n.ext(); try { - Type cudable = getType(CUDA_ANNOTATION); - return !ext.annotationMatching(cudable).isEmpty(); + return !ext.annotationMatching(getType(ann)).isEmpty(); } catch (SemanticException e) { assert false : e; return false; // in case asserts are off @@ -253,36 +264,39 @@ out.forceNewline(); + boolean ptr = !context().directParams(); // kernel (extern "C" to disable name-mangling which seems to be // inconsistent across cuda versions) out.write("extern \"C\" __global__ void " + kernel_name + "(" - + kernel_name + "_env *" + env + ") {"); + + kernel_name + "_env "+(ptr?"*":"") + env + ") {"); out.newline(4); out.begin(0); - for (VarInstance var : context().kernelParams()) { - String name = var.name().toString(); - if (name.equals(THIS)) { - name = SAVED_THIS; - } else { - name = Emitter.mangled_non_method_name(name); - } - out.write("__shared__ "+prependCUDAType(var.type(),name) + ";"); out.newline(); + if (ptr) { + for (VarInstance var : context().kernelParams()) { + String name = var.name().toString(); + if (name.equals(THIS)) { + name = SAVED_THIS; + } else { + name = Emitter.mangled_non_method_name(name); + } + out.write("__shared__ "+prependCUDAType(var.type(),name) + ";"); out.newline(); + } + out.write("if (threadIdx.x==0) {"); out.newline(4); out.begin(0); + for (VarInstance var : context().kernelParams()) { + String name = var.name().toString(); + if (name.equals(THIS)) { + name = SAVED_THIS; + } else { + name = Emitter.mangled_non_method_name(name); + } + out.write(name+" = "+env+"->"+name+";"); out.newline(); + } + out.end(); out.newline(); + out.write("}"); out.newline(); + out.write("__syncthreads();"); out.newline(); + out.forceNewline(); } - out.write("if (threadIdx.x==0) {"); out.newline(4); out.begin(0); - for (VarInstance var : context().kernelParams()) { - String name = var.name().toString(); - if (name.equals(THIS)) { - name = SAVED_THIS; - } else { - name = Emitter.mangled_non_method_name(name); - } - out.write(name+" = "+env+"->"+name+";"); out.newline(); - } - out.end(); out.newline(); - out.write("}"); out.newline(); - out.write("__syncthreads();"); out.newline(); - out.forceNewline(); sw.pushCurrentStream(out); @@ -442,7 +456,8 @@ public void visit(Block_c b) { super.visit(b); - if (nodeHasCUDAAnnotation(b)) { + if (blockIsKernel(b)) { + Block_c closure_body = b; assert !generatingKernel() : "Nesting of cuda annotation makes no sense."; // TODO: assert the block is the body of an async @@ -525,13 +540,13 @@ assert async_closure.formals().size() == 0; Block async_body = async_closure.body(); - b = (Block_c) async_body; + //b = (Block_c) async_body; context().setCUDAKernelCFG(outer.max, outer.var, - inner.max, inner.var, shm); + inner.max, inner.var, shm, kernelWantsDirectParams(closure_body)); context().established().setCUDAKernelCFG(outer.max, outer.var, - inner.max, inner.var, shm); + inner.max, inner.var, shm, kernelWantsDirectParams(closure_body)); generatingKernel(true); - handleKernel(b); + handleKernel((Block_c)async_body); generatingKernel(false); } } @@ -554,7 +569,7 @@ protected void generateClosureDeserializationIdDef(StreamWrapper inc, String cnamet, List<Type> freeTypeParams, String hostClassName, Block block) { - if (nodeHasCUDAAnnotation(block)) { + if (blockIsKernel(block)) { X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); boolean in_template_closure = freeTypeParams.size()>0; @@ -577,7 +592,7 @@ protected void generateClosureSerializationFunctions(X10CPPContext_c c, String cnamet, StreamWrapper inc, Block block) { super.generateClosureSerializationFunctions(c, cnamet, inc, block); - if (nodeHasCUDAAnnotation(block)) { + if (blockIsKernel(block)) { inc.write("static void "+SharedVarsMethods.DESERIALIZE_CUDA_METHOD+"("+DESERIALIZATION_BUFFER+" &__buf, x10aux::place __gpu, size_t &__blocks, size_t &__threads, size_t &__shm, size_t &argc, char *&argv, size_t &cmemc, char *&cmemv) {"); inc.newline(4); inc.begin(0); @@ -647,14 +662,19 @@ inc.write(";"); inc.newline(); } - if (true) { - inc.write("x10_ulong __remote_env = x10aux::remote_alloc(__gpu, sizeof(__env));"); inc.newline(); - inc.write("x10aux::cuda_put(__gpu, __remote_env, &__env, sizeof(__env));"); inc.newline(); - inc.write("::memcpy(argv, &__remote_env, sizeof (void*));"); inc.newline(); - inc.write("argc = sizeof(void*);"); inc.end(); inc.newline(); + + if (env.isEmpty()) { + inc.write("argc = 0;"); inc.end(); inc.newline(); } else { - inc.write("memcpy(argv, __env, sizeof(__env));"); inc.newline(); - inc.write("argc = sizeof(__env);"); inc.end(); inc.newline(); + if (kernelWantsDirectParams(block)) { + inc.write("memcpy(argv, &__env, sizeof(__env));"); inc.newline(); + inc.write("argc = sizeof(__env);"); inc.end(); inc.newline(); + } else { + inc.write("x10_ulong __remote_env = x10aux::remote_alloc(__gpu, sizeof(__env));"); inc.newline(); + inc.write("x10aux::cuda_put(__gpu, __remote_env, &__env, sizeof(__env));"); inc.newline(); + inc.write("::memcpy(argv, &__remote_env, sizeof (void*));"); inc.newline(); + inc.write("argc = sizeof(void*);"); inc.end(); inc.newline(); + } } inc.write("}"); inc.newline(); inc.forceNewline(); } @@ -828,8 +848,11 @@ out.write(ln.toString()); } else if (context().isKernelParam(ln)) { //it seems the post-compiler is not good at hoisting these accesses so we do it ourselves - //out.write(env + "->" + ln); - out.write(ln.toString()); + if (context().directParams()) { + out.write(env + "." + ln); + } else { + out.write(ln.toString()); + } } else { super.visit(n); } Modified: trunk/x10.runtime/x10rt/common/x10rt_cuda.cc =================================================================== --- trunk/x10.runtime/x10rt/common/x10rt_cuda.cc 2010-03-23 19:04:36 UTC (rev 13509) +++ trunk/x10.runtime/x10rt/common/x10rt_cuda.cc 2010-03-23 19:12:33 UTC (rev 13510) @@ -22,12 +22,12 @@ // TODO: fine grained synchronisation, lock free datastructures pthread_mutex_t big_lock_of_doom; - inline void DEBUG(const char *fmt, ...) { + inline void DEBUG(int level, const char *fmt, ...) { (void) fmt; va_list ap; va_start(ap, fmt); #ifdef TRACE - vfprintf(stderr, fmt, ap); + if (level<=TRACE) vfprintf(stderr, fmt, ap); #endif va_end(ap); } @@ -442,7 +442,7 @@ CU_SAFE(cuCtxPushCurrent(ctx->ctx)); CUdeviceptr ptr; ctx->commit += len; - //fprintf(stderr,"CUDA committed memory: %llu bytes\n", (unsigned long long)ctx->commit); + DEBUG(2,"CUDA committed memory: %llu bytes\n", (unsigned long long)ctx->commit); CU_SAFE(cuMemAlloc(&ptr, len)); CU_SAFE(cuCtxPopCurrent(NULL)); pthread_mutex_unlock(&big_lock_of_doom); @@ -476,14 +476,14 @@ { x10rt_msg_type type = p->type; x10rt_finder *hh = ctx->cbs[type].copy_cbs.hh; - DEBUG("probe: finder callback begins\n"); + DEBUG(2,"probe: finder callback begins\n"); void *remote = hh(p, len); /****CALLBACK****/ - DEBUG("probe: finder callback ends\n"); + DEBUG(2,"probe: finder callback ends\n"); if (remote==NULL) { x10rt_notifier *ch = ctx->cbs[type].copy_cbs.ch; - DEBUG("probe: finder callback returned NULL, running notifier\n"); + DEBUG(2,"probe: finder callback returned NULL, running notifier\n"); ch(p, len); /****CALLBACK****/ - DEBUG("probe: notifier callback ends\n"); + DEBUG(2,"probe: notifier callback ends\n"); } return remote; } @@ -585,10 +585,10 @@ x10rt_cuda_kernel *op = new (safe_malloc<x10rt_cuda_kernel>()) x10rt_cuda_kernel(*p); x10rt_cuda_pre *pre = ctx->cbs[p->type].kernel_cbs.pre; - DEBUG("x10rt_cuda_send_msg: pre callback begins\n"); + DEBUG(2,"x10rt_cuda_send_msg: pre callback begins\n"); pre(p, &op->blocks, &op->threads, &op->shm, &op->argc, &op->argv, &op->cmemc, &op->cmemv); /****CALLBACK****/ - DEBUG("x10rt_cuda_send_msg: pre callback ends\n"); + DEBUG(2,"x10rt_cuda_send_msg: pre callback ends\n"); pthread_mutex_lock(&big_lock_of_doom); ctx->kernel_q.push_back(op); @@ -681,12 +681,11 @@ if (kop != NULL) { assert(kop->is_kernel()); assert(!kop->begun); - DEBUG("probe: kernel invoke\n"); x10rt_msg_type type = kop->p.type; CUfunction k = ctx->cbs[type].kernel_cbs.kernel; // y and z params we leave as 1, as threads can vary from 1 to 512 CU_SAFE(cuFuncSetBlockShape(k, kop->threads, 1, 1)); - //fprintf(stderr,"%p<<<%d,%d,%d>>> argc: %d argv: %p\n", (void*)k, kop->blocks, kop->threads, kop->shm, kop->argc, *(void**)kop->argv); + DEBUG(1,"%p<<<%d,%d,%d>>> argc: %d argv: %p\n", (void*)k, kop->blocks, kop->threads, kop->shm, kop->argc, (void*)kop->argv); CU_SAFE(cuParamSetv(k, 0, &kop->argv[0], kop->argc)); CU_SAFE(cuParamSetSize(k, kop->argc)); CU_SAFE(cuFuncSetSharedSize(k, kop->shm)); @@ -700,16 +699,16 @@ ctx->kernel_q.current = NULL; assert(kop->is_kernel()); assert(kop->begun); - DEBUG("probe: kernel complete\n"); + DEBUG(2,"probe: kernel complete\n"); x10rt_msg_type type = kop->p.type; x10rt_cuda_post *fptr = ctx->cbs[type].kernel_cbs.post; - DEBUG("probe: post callback begins\n"); + DEBUG(2,"probe: post callback begins\n"); CU_SAFE(cuCtxPopCurrent(NULL)); pthread_mutex_unlock(&big_lock_of_doom); fptr(&kop->p, &kop->argv); /****CALLBACK****/ pthread_mutex_lock(&big_lock_of_doom); CU_SAFE(cuCtxPushCurrent(ctx->ctx)); - DEBUG("probe: post callback ends\n"); + DEBUG(2,"probe: post callback ends\n"); kop->~x10rt_cuda_kernel(); free(kop); } @@ -744,7 +743,7 @@ assert(dma_sz <= dma_slice_sz()); if (cop->is_get()) { - DEBUG("get(%p,%p,%llu,%llu,%llu)\n", src, dst, (unsigned long long)len, (unsigned long long)started, (unsigned long long)finished); + DEBUG(1,"get(%p,%p,%llu,%llu,%llu)\n", src, dst, (unsigned long long)len, (unsigned long long)started, (unsigned long long)finished); // front buffer handled last tick... available for re-use if (started > 0) ctx->swapBuffers(); // invoke async copy into back buffer @@ -755,13 +754,13 @@ ctx->dma_q.stream)); } if (started > 0) { - DEBUG("memcpy(%p,%p,%d)\n", dst+finished, ctx->front, started-finished); + DEBUG(2,"memcpy(%p,%p,%d)\n", dst+finished, ctx->front, started-finished); ::memcpy(dst+finished, ctx->front, started-finished); finished = started; } started += dma_sz; } else if (cop->is_put()) { - DEBUG("put(%p,%p,%llu,%llu,%llu)\n", src, dst, (unsigned long long)len, (unsigned long long)started, (unsigned long long)finished); + DEBUG(1,"put(%p,%p,%llu,%llu,%llu)\n", src, dst, (unsigned long long)len, (unsigned long long)started, (unsigned long long)finished); // back buffer has now been copied to device... available for re-use if (started > 0) { ctx->swapBuffers(); @@ -772,7 +771,7 @@ finished = started; } if (dma_sz > 0) { - DEBUG("memcpy(%p,%p,%d)\n", ctx->front, src+started, dma_sz); + DEBUG(2,"memcpy(%p,%p,%d)\n", ctx->front, src+started, dma_sz); ::memcpy(ctx->front, src+started, dma_sz); started += dma_sz; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-03-24 20:26:23
|
Revision: 13525 http://x10.svn.sourceforge.net/x10/?rev=13525&view=rev Author: dgrove-oss Date: 2010-03-24 20:26:16 +0000 (Wed, 24 Mar 2010) Log Message: ----------- Initial prototype of LocalRectArray created by "clone and own" of LocalArray. For the next month or so, I don't want to commit to actually implementing the current x10.lang.Array APIs or changing the "real" Array API to match the new code, so building out some unrelated prototype code for experimentation. Added Paths: ----------- trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 Copied: trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 (from rev 13499, trunk/x10.runtime/src-x10/x10/array/LocalArray.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 2010-03-24 20:26:16 UTC (rev 13525) @@ -0,0 +1,297 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +/** + * This class represents an array whose data is in a single place, + * which is the same place as the LocalRectArray's home. + * <p> + * Warning: This class is part of an initial prototyping + * of the array library redesign targeted for + * completion in X10 2.1. It's API is not + * likely to be stable from one release to another + * until after X10 2.1. + * <p> + * Intended API. Eventually this class will be a subtype of + * Array[T], but for now it isn't because that + * forces a variety of API choices that are wrong + * for a high-performance local rectangular array. + * To be fixed for X10 2.1. + * + */ +public final class LocalRectArray[T](region:RectRegion) implements (Point(region.rank))=>T, + Iterable[Point(region.rank)] { + + private val raw:Rail[T]!; + private val layout:RectLayout!; + private val checkBounds:boolean; + + // TODO: XTENLANG-1188 this should be a const (static) field, but working around C++ backend bug + private val bounds = (pt:Point):RuntimeException => new ArrayIndexOutOfBoundsException("point " + pt + " not contained in array"); + + /** + * The rank of this array. + */ + public global property rank:int = region.rank; + + /** + * Is this array defined over a rectangular region? + */ + public global property rect:boolean = true; + + /** + * Is this array's region zero-based? + */ + public global property zeroBased:boolean = region.zeroBased; + + /** + * TEMP: Impedance matching with the C++ backend's loop optimizer. + * Once the API stabilizes a little more, we should think about + * a better way to encode this. + */ + private def max(x:int) = region.max(x); + + + /** + * TEMP: Impedance matching with the C++ backend's loop optimizer. + * Once the API stabilizes a little more, we should think about + * a better way to encode this. + */ + private def min(x:int) = region.min(x); + + /** + * Construct an uninitialized LocalRectArray over the region reg. + * + * @param reg The region over which to construct the array. + */ + public def this(reg:Region{rect}):LocalRectArray[T]{self.rank==reg.rank} { + property(reg as RectRegion); + + layout = new RectLayout(reg.min(), reg.max()); + val n = layout.size(); + raw = Rail.make[T](n); + checkBounds = BaseArray.checkBounds; + } + + + /** + * Construct LocalRectArray over the region reg whose + * values are initialized as specified by the init function. + * + * @param reg The region over which to construct the array. + * @param init The function to use to initialize the array. + */ + public def this(reg:Region{rect}, init:(Point(reg.rank))=>T):LocalRectArray[T]{self.rank==reg.rank} { + property(reg as RectRegion); + + layout = new RectLayout(reg.min(), reg.max()); + val n = layout.size(); + val r = Rail.make[T](n); + for (p:Point(reg.rank) in reg) { + r(layout.offset(p))= init(p); + } + raw = r; + checkBounds = BaseArray.checkBounds; + } + + + /** + * Return an iterator over the points in the region of this array. + * + * @return an iterator over the points in the region of this array. + * @see x10.lang.Iterable[T]#iterator() + */ + public global def iterator():Iterator[Point(rank)] = region.iterator() as Iterator[Point(rank)]; + + + /** + * Return the element of this array corresponding to the given index. + * Only applies to one-dimensional arrays. + * Functionally equivalent to indexing the array via a one-dimensional point. + * + * @param i0 the given index in the first dimension + * @return the element of this array corresponding to the given index. + * @see #apply(Point) + * @see #set(T, Int) + */ + public safe def apply(i0:int){this.rank==1}:T { + if (checkBounds) region.check(bounds, i0); + return raw(layout.offset(i0)); + } + + /** + * Return the element of this array corresponding to the given pair of indices. + * Only applies to two-dimensional arrays. + * Functionally equivalent to indexing the array via a two-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the element of this array corresponding to the given pair of indices. + * @see #apply(Point) + * @see #set(T, Int, Int) + */ + public safe def apply(i0:int, i1:int){this.rank==2}:T { + if (checkBounds) region.check(bounds, i0, i1); + return raw(layout.offset(i0,i1)); + } + + /** + * Return the element of this array corresponding to the given triple of indices. + * Only applies to three-dimensional arrays. + * Functionally equivalent to indexing the array via a three-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the element of this array corresponding to the given triple of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int) + */ + public safe def apply(i0:int, i1:int, i2:int){this.rank==3}:T { + if (checkBounds) region.check(bounds, i0, i1, i2); + return raw(layout.offset(i0, i1, i2)); + } + + /** + * Return the element of this array corresponding to the given quartet of indices. + * Only applies to four-dimensional arrays. + * Functionally equivalent to indexing the array via a four-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the element of this array corresponding to the given quartet of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int, Int) + */ + public safe def apply(i0:int, i1:int, i2:int, i3:int){this.rank==4}:T { + if (checkBounds) region.check(bounds, i0, i1, i2, i3); + return raw(layout.offset(i0, i1, i2, i3)); + } + + /** + * Return the element of this array corresponding to the given point. + * The rank of the given point has to be the same as the rank of this array. + * + * @param pt the given point + * @return the element of this array corresponding to the given point. + * @see #apply(Int) + * @see #set(T, Point) + */ + public safe def apply(pt:Point{self.rank==this.rank}):T { + if (checkBounds) { + throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on LocalRectArray"); + // TODO: SHOULD BE: region.check(pt); + } + return raw(layout.offset(pt)); + } + + + /** + * Set the element of this array corresponding to the given index to the given value. + * Return the new value of the element. + * Only applies to one-dimensional arrays. + * Functionally equivalent to setting the array via a one-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @return the new value of the element of this array corresponding to the given index. + * @see #apply(Int) + * @see #set(T, Point) + */ + public safe def set(v:T, i0:int){this.rank==1}:T { + if (checkBounds) region.check(bounds, i0); + raw(layout.offset(i0)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given pair of indices to the given value. + * Return the new value of the element. + * Only applies to two-dimensional arrays. + * Functionally equivalent to setting the array via a two-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the new value of the element of this array corresponding to the given pair of indices. + * @see #apply(Int, Int) + * @see #set(T, Point) + */ + public safe def set(v:T, i0:int, i1:int){this.rank==2}:T { + if (checkBounds) region.check(bounds, i0, i1); + raw(layout.offset(i0,i1)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given triple of indices to the given value. + * Return the new value of the element. + * Only applies to three-dimensional arrays. + * Functionally equivalent to setting the array via a three-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the new value of the element of this array corresponding to the given triple of indices. + * @see #apply(Int, Int, Int) + * @see #set(T, Point) + */ + public safe def set(v:T, i0:int, i1:int, i2:int){this.rank==3}:T { + if (checkBounds) region.check(bounds, i0, i1, i2); + raw(layout.offset(i0, i1, i2)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given quartet of indices to the given value. + * Return the new value of the element. + * Only applies to four-dimensional arrays. + * Functionally equivalent to setting the array via a four-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the new value of the element of this array corresponding to the given quartet of indices. + * @see #apply(Int, Int, Int, Int) + * @see #set(T, Point) + */ + public safe def set(v:T, i0:int, i1:int, i2:int, i3:int){this.rank==4}:T { + if (checkBounds) region.check(bounds, i0, i1, i2, i3); + raw(layout.offset(i0, i1, i2, i3)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given point to the given value. + * Return the new value of the element. + * The rank of the given point has to be the same as the rank of this array. + * + * @param v the given value + * @param pt the given point + * @return the new value of the element of this array corresponding to the given point. + * @see #apply(Point) + * @see #set(T, Int) + */ + public safe def set(v:T, p:Point{self.rank==this.region.rank}):T { + if (checkBounds) { + throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on LocalRectArray"); + // TODO: SHOULD BE: region.check(p); + } + raw(layout.offset(p)) = v; + return v; + } +} Added: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 (rev 0) +++ trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 2010-03-24 20:26:16 UTC (rev 13525) @@ -0,0 +1,54 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.array.LocalRectArray; + +/** + * Basic array, c-style loop. + * + * @author bdlucas + */ + +public class SeqLocalArray2a extends Benchmark { + + // + // parameters + // + + val N = 2000; + def expected() = 1.0*N*N*(N-1); + def operations() = 2.0*N*N; + + // + // the benchmark + // + + val a = new LocalRectArray[double]([0..N-1, 0..N-1] as Region(2){rect}, (Point(2))=>0.0); + + def once() { + for (var i:int=0; i<N; i++) + for (var j:int=0; j<N; j++) + a(i,j) = (i+j) as double; + var sum:double = 0.0; + for (var i:int=0; i<N; i++) + for (var j:int=0; j<N; j++) + sum += a(i,j); + return sum; + } + + // + // boilerplate + // + + public static def main(Rail[String]) { + new SeqLocalArray2a().execute(); + } +} Property changes on: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 (rev 0) +++ trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 2010-03-24 20:26:16 UTC (rev 13525) @@ -0,0 +1,51 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import x10.array.LocalRectArray; + +/** + * Basic array, X10-style loop + * + * @author bdlucas + */ +public class SeqLocalArray2b extends Benchmark { + + // + // parameters + // + + val N = 2000; + def expected() = 1.0*N*N*(N-1); + def operations() = 2.0*N*N; + + // + // the benchmark + // + + val a = new LocalRectArray[double]([0..N-1, 0..N-1] as Region(2){rect}, (Point(2))=>0.0); + + def once() { + for ((i,j):Point(2) in a) + a(i,j) = (i+j) as double; + var sum:double = 0.0; + for ((i,j):Point(2) in a) + sum += a(i,j); + return sum; + } + + // + // boilerplate + // + + public static def main(Rail[String]) { + new SeqLocalArray2b().execute(); + } +} Property changes on: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2010-03-26 17:19:02
|
Revision: 13555 http://x10.svn.sourceforge.net/x10/?rev=13555&view=rev Author: sparksparkspark Date: 2010-03-26 17:18:52 +0000 (Fri, 26 Mar 2010) Log Message: ----------- Add a set of new class annotations that make it easier to link X10 code to native C++ code Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/X10CPPCompilerOptions.java trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 Modified: trunk/x10.compiler/src/x10cpp/X10CPPCompilerOptions.java =================================================================== --- trunk/x10.compiler/src/x10cpp/X10CPPCompilerOptions.java 2010-03-26 16:37:30 UTC (rev 13554) +++ trunk/x10.compiler/src/x10cpp/X10CPPCompilerOptions.java 2010-03-26 17:18:52 UTC (rev 13555) @@ -13,6 +13,9 @@ import java.io.File; import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; import java.util.Set; import polyglot.frontend.ExtensionInfo; @@ -84,4 +87,10 @@ } super.usageForFlag(out, flag, description); } + + private List<String> extraLibOpts = new ArrayList<String>(); + private List<String> extraIncOpts = new ArrayList<String>(); + + public List<String> extraLibOpts() { return extraLibOpts; } + public List<String> extraIncOpts() { return extraIncOpts; } } Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-26 16:37:30 UTC (rev 13554) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-26 17:18:52 UTC (rev 13555) @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Properties; +import java.util.Set; import polyglot.main.Options; import polyglot.util.ErrorInfo; @@ -53,9 +54,10 @@ properties.load(new FileInputStream(filename)); } catch(IOException e) { eq.enqueue(ErrorInfo.IO_ERROR, "Error finding X10RT properties file: "+ e.getMessage()); + System.exit(1); // [DC] proceeding from here will just yield a load of incomprehensible postcompile errors } String s = properties.getProperty("CXX"); - cxx = s==null ? "g++" : s; //fallback if above error occured or CXX not given in properties file + cxx = s==null ? "g++" : s; //fallback if CXX not given in properties file String regex = " +"; cxxFlags = split(properties.getProperty("CXXFLAGS")); libs = split(properties.getProperty("LDLIBS")); @@ -77,6 +79,8 @@ protected X10RTPostCompileOptions x10rtOpts; + protected Set<String> extraLibOpts, extraIncOpts; + public CXXCommandBuilder(Options options, ErrorQueue eq) { assert (options != null); assert (options.post_compiler != null); @@ -95,6 +99,9 @@ rtimpl = X10_DIST + "/etc/x10rt_"+rtimpl+".properties"; } x10rtOpts = new X10RTPostCompileOptions(eq, rtimpl); + X10CPPCompilerOptions opts = (X10CPPCompilerOptions) options; + this.extraLibOpts = opts.extraLibOpts(); + this.extraIncOpts = opts.extraIncOpts(); } /** Is GC enabled on this platform? */ @@ -129,6 +136,10 @@ } } + for (String opt : extraIncOpts) { + cxxCmd.add(opt); + } + if (x10.Configuration.NO_CHECKS) { cxxCmd.add("-DNO_CHECKS"); } @@ -150,6 +161,10 @@ cxxCmd.addAll(x10rtOpts.ldFlags); cxxCmd.addAll(x10rtOpts.libs); + + for (String opt : extraLibOpts) { + cxxCmd.add(opt); + } cxxCmd.add("-ldl"); cxxCmd.add("-lm"); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-03-26 16:37:30 UTC (rev 13554) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-03-26 17:18:52 UTC (rev 13555) @@ -224,6 +224,7 @@ import x10.util.ClosureSynthesizer; import x10.util.StreamWrapper; import x10.util.Synthesizer; +import x10cpp.X10CPPCompilerOptions; import x10cpp.extension.X10ClassBodyExt_c; import x10cpp.types.X10CPPContext_c; import x10cpp.visit.X10CPPTranslator.DelegateTargetFactory; @@ -686,6 +687,38 @@ h.forceNewline(0); h.write("#include <x10rt.h>"); h.newline(); h.forceNewline(0); + // process annotations relating to additional h/c++ files + X10Ext ext = (X10Ext) n.ext(); + try { + List<X10ClassType> as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPInclude"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String include = getStringPropertyInit(at, 0); + h.write("#include <"+include+">"); h.newline(); + } + as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPCompilationUnit"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String compilation_unit = getStringPropertyInit(at, 0); + tr.job().compiler().outputFiles().add(compilation_unit); + } + X10CPPCompilerOptions opts = (X10CPPCompilerOptions) tr.job().extensionInfo().getOptions(); + as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPIncludeOpt"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String str = getStringPropertyInit(at, 0); + opts.extraIncOpts().add(str); + } + as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPLibOpt"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String str = getStringPropertyInit(at, 0); + opts.extraLibOpts().add(str); + } + } catch (SemanticException e) { + assert false : e; + } + h.forceNewline(0); g.write("#ifndef "+cguard+"_GENERICS"); g.newline(); g.write("#define "+cguard+"_GENERICS"); g.newline(); Modified: trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-03-26 16:37:30 UTC (rev 13554) +++ trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-03-26 17:18:52 UTC (rev 13555) @@ -19,10 +19,14 @@ import java.io.PrintWriter; import java.io.Writer; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import polyglot.ast.Block; import polyglot.ast.ClassDecl; @@ -66,6 +70,7 @@ import x10.util.ClassifiedStream; import x10.util.StreamWrapper; import x10.util.WriterStreams; +import x10cpp.X10CPPCompilerOptions; import x10cpp.debug.LineNumberMap; import x10cpp.postcompiler.AIX_CXXCommandBuilder; import x10cpp.postcompiler.CXXCommandBuilder; @@ -500,6 +505,7 @@ public static final String postcompile = "postcompile"; + /** * The post-compiler option has the following structure: * "[pre-command with options (usually g++)] [(#|%) [post-options (usually extra files)] [(#|%) [library options]]]". @@ -510,7 +516,8 @@ return false; if (options.post_compiler != null && !options.output_stdout) { - Collection<String> outputFiles = compiler.outputFiles(); + // use set to avoid duplicates + Set<String> outputFiles = new HashSet<String>(compiler.outputFiles()); CXXCommandBuilder ccb = CXXCommandBuilder.getCXXCommandBuilder(options, eq); String[] cxxCmd = ccb.buildCXXCommandLine(outputFiles); Added: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPCompilationUnit.x10 2010-03-26 17:18:52 UTC (rev 13555) @@ -0,0 +1,22 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.ClassAnnotation; + +/** Annotation on a class that causes an additional C++ source file to be + * postcompiled. This is useful to support @Native code snippets that may + * require additional code. Multiple annotations can be given on a + class and each will be included as postcompiler commandline arguments. Has no +effect in the Java backend. + */ +public interface NativeCPPCompilationUnit(unit: String) extends ClassAnnotation { } Added: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPInclude.x10 2010-03-26 17:18:52 UTC (rev 13555) @@ -0,0 +1,22 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.ClassAnnotation; + +/** Annotation on a class that adds an C++ level #include to the generated + * code. This is useful to support @Native code snippets that may require a + * system or other third party header. Multiple annotations can be given on a + * class and each will be included in order, in the generated code. Has no + * effect in the Java backend. + */ +public interface NativeCPPInclude(include: String) extends ClassAnnotation { } Added: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 2010-03-26 17:18:52 UTC (rev 13555) @@ -0,0 +1,19 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.ClassAnnotation; + +/** Annotation on a class that adds an extra commandline option to the post + * compiler invocation. Does nothing for the Java backend. + */ +public interface NativeCPPIncludeOpt(include: String) extends ClassAnnotation { } Added: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 2010-03-26 17:18:52 UTC (rev 13555) @@ -0,0 +1,19 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.ClassAnnotation; + +/** Annotation on a class that adds an extra commandline option to the post + * compiler invocation. Does nothing for the Java backend. + */ +public interface NativeCPPLibOpt(include: String) extends ClassAnnotation { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-03-26 19:36:39
|
Revision: 13563 http://x10.svn.sourceforge.net/x10/?rev=13563&view=rev Author: dgrove-oss Date: 2010-03-26 19:36:33 +0000 (Fri, 26 Mar 2010) Log Message: ----------- WIP on faster local rectangular arrays. Teach compiler/typesystem about new array variant as a staging mechanism. Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-03-26 19:13:08 UTC (rev 13562) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-03-26 19:36:33 UTC (rev 13563) @@ -1053,7 +1053,7 @@ public static Type arrayElementType(Type t) { t = baseType(t); X10TypeSystem xt = (X10TypeSystem) t.typeSystem(); - if (xt.isX10Array(t) || xt.isRail(t)) { + if (xt.isX10Array(t) || xt.isRail(t) || xt.isX10ArrayV2(t)) { if (t instanceof X10ParsedClassType) { Type result = ((X10ParsedClassType) t).typeArguments().get(0); return result; Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-03-26 19:13:08 UTC (rev 13562) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-03-26 19:36:33 UTC (rev 13563) @@ -400,6 +400,8 @@ boolean isX10Array(Type me); + boolean isX10ArrayV2(Type me); + Context emptyContext(); Type Struct(); boolean isExactlyFunctionType(Type t); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-03-26 19:13:08 UTC (rev 13562) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-03-26 19:36:33 UTC (rev 13563) @@ -1427,6 +1427,15 @@ return arrayType_; } + // TODO: Staging while working on array library redesign. + protected ClassType localRectArrayType_ = null; + + public Type LocalRectArray() { + if (localRectArrayType_ == null) + localRectArrayType_ = load("x10.array.LocalRectArray"); + return localRectArrayType_; + } + // RMF 11/1/2005 - Not having the "static" qualifier on interfaces causes // problems, // e.g. for New_c.disambiguate(AmbiguityRemover), which assumes that @@ -1613,6 +1622,10 @@ return hasSameClassDef(me, Array()); } + public boolean isX10ArrayV2(Type me) { + return hasSameClassDef(me, LocalRectArray()); + } + public boolean isTypeConstrained(Type me) { return me instanceof ConstrainedType; } Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-03-26 19:13:08 UTC (rev 13562) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-03-26 19:36:33 UTC (rev 13563) @@ -3760,14 +3760,13 @@ Type dType = domain.type(); if (Configuration.LOOP_OPTIMIZATIONS && form.hasExplodedVars() && form.isUnnamed() && xts.isPoint(form.type().type()) && - (X10TypeMixin.isRect(dType, context))) + (X10TypeMixin.isRect(dType, context)) && + (xts.isX10Array(dType) || xts.isX10ArrayV2(dType) || xts.isDistribution(dType) || xts.isRegion(dType))) + { - assert (xts.isPoint(form.type().type())); - assert (xts.isX10Array(dType) || xts.isDistribution(dType) || xts.isRegion(dType)); - // TODO: move this to the Desugarer X10NodeFactory xnf = (X10NodeFactory) tr.nodeFactory(); - if (xts.isX10Array(dType)) { + if (xts.isX10Array(dType) || xts.isX10ArrayV2(dType)) { Position pos = domain.position(); FieldInstance fDist = dType.toClass().fieldNamed(Name.make("dist")); dType = fDist.type(); Modified: trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 2010-03-26 19:13:08 UTC (rev 13562) +++ trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 2010-03-26 19:36:33 UTC (rev 13563) @@ -14,74 +14,110 @@ import x10.compiler.Inline; /** - * This class represents an array whose data is in a single place, - * which is the same place as the LocalRectArray's home. - * <p> + * This class represents a k-dimensional dense array whose + * data is in a single place, which is the same place + * as the LocalRectArray's home.</p> + * * Warning: This class is part of an initial prototyping * of the array library redesign targeted for * completion in X10 2.1. It's API is not * likely to be stable from one release to another - * until after X10 2.1. - * <p> - * Intended API. Eventually this class will be a subtype of - * Array[T], but for now it isn't because that - * forces a variety of API choices that are wrong - * for a high-performance local rectangular array. - * To be fixed for X10 2.1. - * + * until after X10 2.1.</p> + * + * Warning: Eventually the operations implemented by + * this class will match those promised by + * x10.lang.Array, but for now some of the API + * is stubbed out here (and may eventually + * by removed from x10.lang.Array). This + * will be resolved by X10 2.1<p> + * + * TODO: I refuse to make the methods of LocalRectArray global so + * that this class could be a subclass of x10.lang.Array. + * Migration plan. We introduce a DistributedArray + * abstract sub-class of Array, make it's apply/set methods + * global and people simply have to either be working with + * Array! types, or with distrbuted arrays. + * I see no reasonable alternative to this. */ -public final class LocalRectArray[T](region:RectRegion) implements (Point(region.rank))=>T, - Iterable[Point(region.rank)] { +public final class LocalRectArray[T](dist:Dist) + implements (Point(dist.rank))=>T, + Iterable[Point(dist.rank)] { private val raw:Rail[T]!; private val layout:RectLayout!; private val checkBounds:boolean; + // TODO: This is a hack around the way regions are currently defined. + // Even when we compile with NO_CHECKS, we still have to have + // the checking code inlined. or the presence of the call in a loop + // blows register allocation and we get lousy performance. + private val baseRegion:BaseRegion(rank); + // TODO: XTENLANG-1188 this should be a const (static) field, but working around C++ backend bug private val bounds = (pt:Point):RuntimeException => new ArrayIndexOutOfBoundsException("point " + pt + " not contained in array"); + // XTENLANG-49 + static type BaseRegion(rank:int) = BaseRegion{self.rank==rank}; + + // BEGIN CODE COPIED FROM ARRAY. WILL EVENTUALLY BE INHERITED FROM ARRAY /** + * The region this array is defined over. + */ + public property region:Region(rank) = dist.region; + + /** * The rank of this array. */ - public global property rank:int = region.rank; + public property rank:int = dist.rank; /** * Is this array defined over a rectangular region? */ - public global property rect:boolean = true; + public property rect:boolean = dist.rect; /** * Is this array's region zero-based? */ - public global property zeroBased:boolean = region.zeroBased; + public property zeroBased:boolean = dist.zeroBased; /** - * TEMP: Impedance matching with the C++ backend's loop optimizer. - * Once the API stabilizes a little more, we should think about - * a better way to encode this. + * Is this array's region a "rail" (one-dimensional contiguous zero-based)? */ - private def max(x:int) = region.max(x); + public property rail:boolean = dist.rail; + /** + * Is this array's distribution "unique" (at most one point per place)? + */ + public property unique:boolean = false; /** - * TEMP: Impedance matching with the C++ backend's loop optimizer. - * Once the API stabilizes a little more, we should think about - * a better way to encode this. + * Is this array's distribution "constant" (all points map to the same place)? */ - private def min(x:int) = region.min(x); + public property constant:boolean = true; /** + * If this array's distribution is "constant", the place all points map to (or null). + */ + public property onePlace:Place = home; + + + // END CODE COPIED FROM ARRAY. WILL EVENTUALLY BE INHERITED FROM ARRAY + + + + /** * Construct an uninitialized LocalRectArray over the region reg. * * @param reg The region over which to construct the array. */ - public def this(reg:Region{rect}):LocalRectArray[T]{self.rank==reg.rank} { - property(reg as RectRegion); + public def this(reg:Region):LocalRectArray{self.dist.region==reg} { + property(Dist.makeConstant(reg)); layout = new RectLayout(reg.min(), reg.max()); val n = layout.size(); raw = Rail.make[T](n); checkBounds = BaseArray.checkBounds; + baseRegion = reg as BaseRegion(rank); } @@ -92,8 +128,8 @@ * @param reg The region over which to construct the array. * @param init The function to use to initialize the array. */ - public def this(reg:Region{rect}, init:(Point(reg.rank))=>T):LocalRectArray[T]{self.rank==reg.rank} { - property(reg as RectRegion); + public def this(reg:Region, init:(Point(reg.rank))=>T):LocalRectArray{self.dist.region==reg} { + property(Dist.makeConstant(reg)); layout = new RectLayout(reg.min(), reg.max()); val n = layout.size(); @@ -103,6 +139,7 @@ } raw = r; checkBounds = BaseArray.checkBounds; + baseRegion = reg as BaseRegion(rank); } @@ -125,8 +162,8 @@ * @see #apply(Point) * @see #set(T, Int) */ - public safe @Inline def apply(i0:int){this.rank==1}:T { - if (checkBounds) region.check(bounds, i0); + public safe @Inline def apply(i0:int){dist.region.rank==1}:T { + if (checkBounds) baseRegion.check(bounds, i0); return raw(layout.offset(i0)); } @@ -141,8 +178,8 @@ * @see #apply(Point) * @see #set(T, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int){this.rank==2}:T { - if (checkBounds) region.check(bounds, i0, i1); + public safe @Inline def apply(i0:int, i1:int){region.rank==2}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1); return raw(layout.offset(i0,i1)); } @@ -158,8 +195,8 @@ * @see #apply(Point) * @see #set(T, Int, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int, i2:int){this.rank==3}:T { - if (checkBounds) region.check(bounds, i0, i1, i2); + public safe @Inline def apply(i0:int, i1:int, i2:int){region.rank==3}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1, i2); return raw(layout.offset(i0, i1, i2)); } @@ -176,8 +213,8 @@ * @see #apply(Point) * @see #set(T, Int, Int, Int, Int) */ - public safe @Inline def apply(i0:int, i1:int, i2:int, i3:int){this.rank==4}:T { - if (checkBounds) region.check(bounds, i0, i1, i2, i3); + public safe @Inline def apply(i0:int, i1:int, i2:int, i3:int){region.rank==4}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1, i2, i3); return raw(layout.offset(i0, i1, i2, i3)); } @@ -190,7 +227,7 @@ * @see #apply(Int) * @see #set(T, Point) */ - public safe @Inline def apply(pt:Point{self.rank==this.rank}):T { + public safe @Inline def apply(pt:Point{self.rank==dist.region.rank}):T { if (checkBounds) { throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on LocalRectArray"); // TODO: SHOULD BE: region.check(pt); @@ -211,8 +248,8 @@ * @see #apply(Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int){this.rank==1}:T { - if (checkBounds) region.check(bounds, i0); + public safe @Inline def set(v:T, i0:int){region.rank==1}:T { + if (checkBounds) baseRegion.check(bounds, i0); raw(layout.offset(i0)) = v; return v; } @@ -230,8 +267,8 @@ * @see #apply(Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int){this.rank==2}:T { - if (checkBounds) region.check(bounds, i0, i1); + public safe @Inline def set(v:T, i0:int, i1:int){region.rank==2}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1); raw(layout.offset(i0,i1)) = v; return v; } @@ -250,8 +287,8 @@ * @see #apply(Int, Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int, i2:int){this.rank==3}:T { - if (checkBounds) region.check(bounds, i0, i1, i2); + public safe @Inline def set(v:T, i0:int, i1:int, i2:int){region.rank==3}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1, i2); raw(layout.offset(i0, i1, i2)) = v; return v; } @@ -271,8 +308,8 @@ * @see #apply(Int, Int, Int, Int) * @see #set(T, Point) */ - public safe @Inline def set(v:T, i0:int, i1:int, i2:int, i3:int){this.rank==4}:T { - if (checkBounds) region.check(bounds, i0, i1, i2, i3); + public safe @Inline def set(v:T, i0:int, i1:int, i2:int, i3:int){region.rank==4}:T { + if (checkBounds) baseRegion.check(bounds, i0, i1, i2, i3); raw(layout.offset(i0, i1, i2, i3)) = v; return v; } @@ -288,7 +325,7 @@ * @see #apply(Point) * @see #set(T, Int) */ - public safe @Inline def set(v:T, p:Point{self.rank==this.region.rank}):T { + public safe @Inline def set(v:T, p:Point{self.rank==region.rank}):T { if (checkBounds) { throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on LocalRectArray"); // TODO: SHOULD BE: region.check(p); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-03-30 20:11:51
|
Revision: 13591 http://x10.svn.sourceforge.net/x10/?rev=13591&view=rev Author: tardieu Date: 2010-03-30 20:11:45 +0000 (Tue, 30 Mar 2010) Log Message: ----------- now embedding libgc into libx10 got rid of X10GC env variable Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.dist/bin/x10bc trunk/x10.dist/bin/x10c++ trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/Makefile Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-30 19:37:13 UTC (rev 13590) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-30 20:11:45 UTC (rev 13591) @@ -69,7 +69,6 @@ protected static final String PLATFORM = System.getenv("X10_PLATFORM")==null?"unknown":System.getenv("X10_PLATFORM"); public static final String X10_DIST = System.getenv("X10_DIST"); - protected static final String X10GC = System.getenv("X10GC")==null?null:System.getenv("X10GC").replace(File.separatorChar, '/'); protected static final boolean USE_XLC = PLATFORM.startsWith("aix_") && System.getenv("USE_GCC")==null; protected static final boolean ENABLE_PROFLIB = System.getenv("X10_ENABLE_PROFLIB") != null; @@ -121,7 +120,6 @@ if (!Configuration.DISABLE_GC && gcEnabled()) { cxxCmd.add("-DX10_USE_BDWGC"); - cxxCmd.add("-I"+X10GC+"/include"); } if (x10.Configuration.OPTIMIZE) { @@ -152,11 +150,6 @@ cxxCmd.add("-L"+X10_DIST+"/lib"); cxxCmd.add("-lx10"); - if (!Configuration.DISABLE_GC && gcEnabled()) { - cxxCmd.add("-L"+X10GC+"/lib"); - cxxCmd.add("-lgc"); - } - cxxCmd.addAll(x10rtOpts.ldFlags); cxxCmd.addAll(x10rtOpts.libs); Modified: trunk/x10.dist/bin/x10bc =================================================================== --- trunk/x10.dist/bin/x10bc 2010-03-30 19:37:13 UTC (rev 13590) +++ trunk/x10.dist/bin/x10bc 2010-03-30 20:11:45 UTC (rev 13591) @@ -15,7 +15,6 @@ export X10_DIST="$(cd "$(dirname "$prog")/.." && pwd)" if [[ "$UNAME" = CYGWIN* ]]; then X10_DIST="$(cygpath -aw "$X10_DIST")"; fi -[ -z "$X10GC" ] && export X10GC="$X10_DIST" [ -z "$X10SOURCES" ] && export X10SOURCES="${X10_DIST}/lib/x10.jar" export CP_OVERRIDE="${X10_DIST}${FILE_SEP}lib${FILE_SEP}x10c.jar${PATH_SEP}${X10_DIST}${FILE_SEP}classes${PATH_SEP}" Modified: trunk/x10.dist/bin/x10c++ =================================================================== --- trunk/x10.dist/bin/x10c++ 2010-03-30 19:37:13 UTC (rev 13590) +++ trunk/x10.dist/bin/x10c++ 2010-03-30 20:11:45 UTC (rev 13591) @@ -15,7 +15,6 @@ export X10_DIST="$(cd "$(dirname "$prog")/.." && pwd)" if [[ "$UNAME" = CYGWIN* ]]; then X10_DIST="$(cygpath -aw "$X10_DIST")"; fi -[ -z "$X10GC" ] && export X10GC="$X10_DIST" [ -z "$X10SOURCES" ] && export X10SOURCES="${X10_DIST}/lib/x10.jar" export CP_OVERRIDE="${X10_DIST}${FILE_SEP}lib${FILE_SEP}x10c.jar${PATH_SEP}${X10_DIST}${FILE_SEP}classes${PATH_SEP}" Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-03-30 19:37:13 UTC (rev 13590) +++ trunk/x10.runtime/build.xml 2010-03-30 20:11:45 UTC (rev 13591) @@ -324,6 +324,7 @@ <arg value="-enable-threads=posix" /> <arg value="-enable-thread-local-alloc" /> <arg value="--disable-dependency-tracking" /> + <arg value="--disable-shared" /> <env key="CFLAGS" value="${darwin.32}${darwin.64}-D_XOPEN_SOURCE" /> <arg value="--prefix=${bdwgc.platform.dir}/install" /> </exec> @@ -372,11 +373,6 @@ <target name="dist-bdwgc" depends="build-bdwgc" if="bdwgc.enabled"> <sequential> <mkdir dir="${lib}"/> - <copy todir="${lib}" preservelastmodified="true" flatten="true" > - <!--<fileset dir="${bdwgc.dir}/install/lib" includes="libgc.a"/>--> - <fileset dir="${bdwgc.dir}/install" includes="lib/*gc*.a,lib/*gc*.so,lib/*gc*.so.*,lib/*gc*.dylib"/> - <fileset dir="${bdwgc.dir}/install" includes="bin/*.dll"/> <!-- Cygwin --> - </copy> <copy todir="${inc}"> <fileset dir="${bdwgc.dir}/install/include" includes="**/*.h"/> </copy> Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-03-30 19:37:13 UTC (rev 13590) +++ trunk/x10.runtime/src-cpp/Makefile 2010-03-30 20:11:45 UTC (rev 13591) @@ -146,8 +146,10 @@ x10/util/concurrent/atomic/AtomicReference.o ALL_MANUAL_OBJECTS=$(ALL_XRCPP_OBJECTS) +ifdef ENABLE_GC + ALL_MANUAL_OBJECTS+=bdwgc/install/lib/libgc.a +endif - # This target will build the XRX cc files into object files gen/all-o-generated: gen/all-cpp-generated $(XRX_MANIFEST) $(MAKE) $(shell sed -e 's@^\(.*\)\.cc$$@gen/\1.o@' -e '/\.x10$$/d' -e '/\.jar$$/d' $(XRX_MANIFEST)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-03-30 20:58:19
|
Revision: 13593 http://x10.svn.sourceforge.net/x10/?rev=13593&view=rev Author: tardieu Date: 2010-03-30 20:58:10 +0000 (Tue, 30 Mar 2010) Log Message: ----------- removed -DISABLE_GC switch on x10c++ include files now are different for GC vs no-GC builds of the runtime Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/Configuration.java trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10aux/config.h Added Paths: ----------- trunk/x10.runtime/src-cpp/x10aux/bdwgc.h trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h Modified: trunk/x10.compiler/src/x10cpp/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10cpp/Configuration.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/Configuration.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -39,9 +39,6 @@ public static boolean VIM_MODELINE = true; private static final String VIM_MODELINE_desc = "Generate a modeline (formatting instructions) for VIm"; - public static boolean DISABLE_GC = false; - private static final String DISABLE_GC_desc = "Disable the linking in of the BDW conservative garbage collector"; - /** * Parses one argument from the command line. This allows the user * to specify options also on the command line (in addition to the Modified: trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -27,8 +27,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("aix_")); } - protected boolean gcEnabled() { return false; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -100,9 +100,6 @@ x10rtOpts = new X10RTPostCompileOptions(rtimpl); } - /** Is GC enabled on this platform? */ - protected boolean gcEnabled() { return false; } - protected String defaultPostCompiler() { return x10rtOpts.cxx; } @@ -117,10 +114,6 @@ // headers generated from user input cxxCmd.add("-I"+options.output_directory); cxxCmd.add("-I."); - - if (!Configuration.DISABLE_GC && gcEnabled()) { - cxxCmd.add("-DX10_USE_BDWGC"); - } if (x10.Configuration.OPTIMIZE) { cxxCmd.add(USE_XLC ? "-O3" : "-O2"); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -23,8 +23,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("win32_")); } - protected boolean gcEnabled() { return true; } - protected String defaultPostCompiler() { return "g++-4"; } Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -25,8 +25,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("linux_")); } - protected boolean gcEnabled() { return true; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -25,8 +25,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); } - protected boolean gcEnabled() { return true; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); if (USE_32BIT) { Modified: trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-03-30 20:58:10 UTC (rev 13593) @@ -23,8 +23,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("sunos_")); } - protected boolean gcEnabled() { return false; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.runtime/src-cpp/Makefile 2010-03-30 20:58:10 UTC (rev 13593) @@ -6,10 +6,13 @@ INCLUDE_DIRS += -I. -I../x10rt/include +BDWGC_CONFIG=bdwgc_off.h + ifdef ENABLE_GC override CXXFLAGS += -DX10_USE_BDWGC BDWGC_INCLUDE_DIR= ./bdwgc/install/include INCLUDE_DIRS += -I$(BDWGC_INCLUDE_DIR) + BDWGC_CONFIG=bdwgc_on.h endif override CXXFLAGS += $(INCLUDE_DIRS) -Igen @@ -199,6 +202,7 @@ @cp -p x10rt.h $(INSTDIR)/include @cp -p $(XRX_ARCHIVE) $(INSTDIR)/lib @cp -p $(XRX_MANIFEST) $(INSTDIR)/lib + @cp -p $(INSTDIR)/include/x10aux/$(BDWGC_CONFIG) $(INSTDIR)/include/x10aux/bdwgc.h .PHONY: install Added: trunk/x10.runtime/src-cpp/x10aux/bdwgc.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc.h 2010-03-30 20:58:10 UTC (rev 13593) @@ -0,0 +1,11 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + Added: trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h 2010-03-30 20:58:10 UTC (rev 13593) @@ -0,0 +1,10 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ Added: trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h 2010-03-30 20:58:10 UTC (rev 13593) @@ -0,0 +1,12 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +#define X10_USE_BDWGC Modified: trunk/x10.runtime/src-cpp/x10aux/config.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/config.h 2010-03-30 20:37:10 UTC (rev 13592) +++ trunk/x10.runtime/src-cpp/x10aux/config.h 2010-03-30 20:58:10 UTC (rev 13593) @@ -12,6 +12,8 @@ #ifndef X10AUX_CONFIG_H #define X10AUX_CONFIG_H +#include <x10aux/bdwgc.h> + /* * The following performance macros are supported: * NO_EXCEPTIONS - remove all exception-related code This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-03-31 21:51:54
|
Revision: 13606 http://x10.svn.sourceforge.net/x10/?rev=13606&view=rev Author: vj0 Date: 2010-03-31 21:51:43 +0000 (Wed, 31 Mar 2010) Log Message: ----------- WIP for call conversion support for X10 (supporting "weak calls", i.e. calls not strong enough to entail the constraints in the definition). Arguments in calls to methods and constructor invocations will now be dynamically converted to the type specified by the formal parameter of the matching method/constructor definition (through the invocation of a cast), provided the actual type and the formal type are compatible. (If they are not compatible, a type check error will continue to be asserted.) TODO: Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/types/checker/Converter.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.runtime/src-x10/x10/lang/Array.x10 Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -66,6 +66,7 @@ import x10.constraint.XLocal; import x10.constraint.XRoot; import x10.errors.Errors; +import x10.errors.Errors.PlaceTypeErrorMethodShouldBeLocalOrGlobal; import x10.parser.X10ParsedName; import x10.types.ParameterType; import x10.types.X10ClassType; @@ -82,6 +83,7 @@ import x10.types.checker.PlaceChecker; import x10.types.constraints.XConstrainedTerm; import x10.types.matcher.DumbMethodMatcher; +import x10cpp.postcompiler.CXXCommandBuilder; /** @@ -295,7 +297,10 @@ if (n != null) return n; // Otherwise try and find the usual null target method. - return typeCheckNullTargetForMethod(tc, typeArgs, argTypes); + + n = typeCheckNullTargetForMethod(tc, typeArgs, argTypes); + return n; + } @@ -456,30 +461,64 @@ Type et = e.type(); argTypes.add(et); } - + // TODO: Need to try struct call with implicit conversions as well. if (this.target == null) { Node n = null; + // First try to find the method without implicit conversions. try { n=this.typeCheckNullTarget(tc, typeArgs, argTypes, arguments); - + // Success! n has the answer. } catch (SemanticException e) { - if (cc != null) { - Node result = cc.typeCheck(tc); - if (result instanceof Expr) { - X10TypeMixin.checkMissingParameters(((Expr) result).type()); + // OK that didnt work. Try implicit conversions. + X10MethodInstance mi = null; + List<Expr> args = null; + // Now, try to find the method with implicit conversions, making them explicit. + try { + Pair<MethodInstance,List<Expr>> p = tryImplicitConversions(this, tc, null, typeArgs, argTypes); + mi = (X10MethodInstance) p.fst(); + args = p.snd(); + } catch (SemanticException e2) { + // Nothing worked. If you have a cc, thats the one. Exit with cc. + if (cc != null) { + Node result = cc.typeCheck(tc); + if (result instanceof Expr) { + X10TypeMixin.checkMissingParameters(((Expr) result).type()); + } + return result; + } + // otherwise error. + MethodMatcher matcher = ((X10TypeSystem) tc.typeSystem()).MethodMatcher(null, name.id(), typeArgs, argTypes, c); + throw new Errors.MethodOrStaticConstructorNotFound(matcher, position()); + } + + // OK so now we have mi and args that correspond to a success. + // Copy the method instance so we can modify it. + assert mi != null && args != null; + Type rt = mi.rightType(); // X10Field_c.rightType(mi.rightType(), mi.x10Def(), n.target, c); + X10Call_c result = (X10Call_c) methodInstance(mi).type(rt); + // Set up n with the answer. + n = result.arguments(args); + } + + if (n instanceof X10Call_c) { + try { + PlaceChecker.checkLocalReceiver((Call) n, tc); + } catch (PlaceTypeErrorMethodShouldBeLocalOrGlobal z) { + // ok, compensate by generating a dynamic cast. + X10Call_c result = (X10Call_c) n; + Receiver r = result.target(); + if (r instanceof Expr) { + Expr target = (Expr) r; + Type type = PlaceChecker.AddIsHereClause(target.type(), tc.context()); + target = Converter.attemptCoercion(tc, target, type); + n = result.reconstruct(target, result.name(), result.arguments()); } - return result; + } - MethodMatcher matcher = ((X10TypeSystem) tc.typeSystem()).MethodMatcher(null, name.id(), typeArgs, argTypes, c); - throw new Errors.MethodOrStaticConstructorNotFound(matcher, position()); - } - if (n instanceof X10Call_c) - PlaceChecker.checkLocalReceiver((Call) n, tc); - // We have both! if (cc != null) { throw new Errors.AmbiguousCall(((n instanceof X10New) @@ -494,16 +533,16 @@ } Node structCall = null; - if (target instanceof TypeNode) { - Type t = ((TypeNode) target).type(); - t = X10TypeMixin.baseType(t); - if (t instanceof ParameterType) { - throw new SemanticException("Cannot invoke a static method of a type parameter.", position()); - } - structCall = tryStructConstructor(tc, target, typeArgs, argTypes, arguments); - if (structCall != null) - return structCall; - } + if (target instanceof TypeNode) { + Type t = ((TypeNode) target).type(); + t = X10TypeMixin.baseType(t); + if (t instanceof ParameterType) { + throw new SemanticException("Cannot invoke a static method of a type parameter.", position()); + } + structCall = tryStructConstructor(tc, target, typeArgs, argTypes, arguments); + if (structCall != null) + return structCall; + } X10Call_c n = this; Modified: trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -19,6 +19,8 @@ import polyglot.ast.Expr; import polyglot.ast.Node; import polyglot.ast.TypeCheckTypeGoal; +import polyglot.ast.TypeNode; +import polyglot.frontend.Globals; import polyglot.frontend.SetResolverGoal; import polyglot.types.ClassDef; import polyglot.types.CodeDef; @@ -47,13 +49,25 @@ import x10.types.X10ClassType; import x10.types.X10Context; import x10.types.X10Flags; +import x10.types.XTypeTranslator; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; import x10.visit.X10TypeChecker; +/** + * The X10 version of a CanonicalTypeNode. + * Has an associated DepParameterExpr. + * @author vj + * + */ public class X10CanonicalTypeNode_c extends CanonicalTypeNode_c implements X10CanonicalTypeNode, AddFlags { + + public X10CanonicalTypeNode_c(Position pos, Type type) { + this(pos, Types.<Type>ref(type)); + } public X10CanonicalTypeNode_c(Position pos, Ref<? extends Type> type) { super(pos, type); } @@ -99,6 +113,7 @@ } + @Override public Node typeCheck(ContextVisitor tc) throws SemanticException { X10Context c = (X10Context) tc.context(); @@ -213,13 +228,16 @@ X10ClassType ct = (X10ClassType) t; X10ClassDef def = ct.x10Def(); if (ct.typeArguments().size() != def.typeParameters().size()) - throw new SemanticException("Invalid type; parameterized class " + def.fullName() + " instantiated with incorrect number of arguments.", position()); + throw new SemanticException("Invalid type; parameterized class " + + def.fullName() + + " instantiated with incorrect number of arguments.", position()); for (int j = 0; j < ct.typeArguments().size(); j++) { Type actualType = ct.typeArguments().get(j); ParameterType correspondingParam = def.typeParameters().get(j); if (actualType.isVoid()) { - throw new SemanticException("Cannot instantiate invariant parameter " + correspondingParam + " of " + def + " with type " + actualType + ".", position()); + throw new SemanticException("Cannot instantiate invariant parameter " + + correspondingParam + " of " + def + " with type " + actualType + ".", position()); } } Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -73,7 +73,7 @@ ConstructorCall X10SuperCall(Position pos, Expr outer, List<TypeNode> typeArgs, List<Expr> args); ConstructorCall X10SuperCall(Position pos, List<TypeNode> typeArgs, List<Expr> args); - X10CanonicalTypeNode X10CanonicalTypeNode(Position pos, Type t, DepParameterExpr e); + X10CanonicalTypeNode X10CanonicalTypeNode(Position pos, Type t); X10CanonicalTypeNode X10CanonicalTypeNode(Position pos, Ref<? extends Type> t, DepParameterExpr e); X10Cast X10Cast(Position pos, TypeNode castType, Expr expr); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -556,7 +556,7 @@ return n; } - public X10CanonicalTypeNode X10CanonicalTypeNode(Position pos, Type type, DepParameterExpr e) { + public X10CanonicalTypeNode X10CanonicalTypeNode(Position pos, Type type) { X10CanonicalTypeNode tn = (X10CanonicalTypeNode) CanonicalTypeNode(pos, type); return tn; } Modified: trunk/x10.compiler/src/x10/types/checker/Converter.java =================================================================== --- trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -20,6 +20,7 @@ import java.util.Map; import polyglot.ast.Call; +import polyglot.ast.CanonicalTypeNode; import polyglot.ast.ConstructorCall; import polyglot.ast.Expr; import polyglot.ast.New; @@ -43,6 +44,8 @@ import polyglot.util.Position; import polyglot.visit.ContextVisitor; import x10.ast.SemanticError; +import x10.ast.X10CanonicalTypeNode; +import x10.ast.X10CanonicalTypeNode_c; import x10.ast.X10Cast; import x10.ast.X10Cast_c; import x10.ast.X10New_c; @@ -60,6 +63,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.util.Synthesizer; /** * A set of static methods used to convert an AST representing an X10 expressions of a given type @@ -73,6 +77,7 @@ public static enum ConversionType { UNKNOWN_CONVERSION, UNKNOWN_IMPLICIT_CONVERSION, + CALL_CONVERSION, // vj: Introduced 3/28/10 to implement cast-as-needed call semantics PRIMITIVE, CHECKED, SUBTYPE, @@ -98,11 +103,23 @@ ConversionType ct = ts.numericConversionValid(toType, e.type(), e.constantValue(), tc.context()) ? ConversionType.UNKNOWN_CONVERSION - : ConversionType.UNKNOWN_IMPLICIT_CONVERSION; + : ConversionType.CALL_CONVERSION; // ConversionType.UNKNOWN_IMPLICIT_CONVERSION; X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - Expr result = check(nf.X10Cast(e.position(), nf.CanonicalTypeNode(e.position(), toType), e, ct),tc); + X10CanonicalTypeNode tn = (X10CanonicalTypeNode) nf.CanonicalTypeNode(e.position(), toType); + Expr result = check(nf.X10Cast(e.position(), tn, e, ct),tc); + + if (result instanceof X10Cast && ((X10Cast) result).conversionType()==ConversionType.CHECKED) { + // OK that succeeded. Now ensure that there is a depexpr created for the check. + tn = new Synthesizer().makeCanonicalTypeNodeWithDepExpr(e.position(), toType, tc); + if (tn.type() != toType) { + // alright, now we actually synthesized a new depexpr. + // lets splice it in. + result = check(nf.X10Cast(e.position(), tn, e, ct),tc); + System.out.println("[" + e.position() + "] Synthesized " + tn + " for " + e + "."); + } + } return result; } @@ -381,7 +398,8 @@ XConstraint cFrom = X10TypeMixin.xclause(fromType); XConstraint cTo = X10TypeMixin.xclause(toType); - if (cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION) { + if (cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION + && cast.conversionType() != ConversionType.CALL_CONVERSION) { if (! ts.isParameterType(fromType) && ! ts.isParameterType(toType) && ts.isCastValid(fromType, toType, context)) { @@ -405,7 +423,8 @@ Expr e = cast.expr(); // Can convert if there is a static method toType.$convert(fromType) - if (converter == null && cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION) { + if (converter == null && cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION + && cast.conversionType() != ConversionType.CALL_CONVERSION) { try { mi = ts.findMethod(toType, ts.MethodMatcher(toType, Converter.operator_as, Collections.singletonList(fromType), context)); @@ -466,12 +485,13 @@ } } - l: if (cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION) { + l: if (cast.conversionType() != ConversionType.UNKNOWN_IMPLICIT_CONVERSION + && cast.conversionType() != ConversionType.CALL_CONVERSION) { if (ts.isParameterType(toType)) { // Now get the upper bound. List<Type> upper = ts.env(context).upperBounds(toType, false); if (upper.isEmpty()) { - // No upper bound. Now a hecked conversion is permitted only + // No upper bound. Now a checked conversion is permitted only // if fromType is not Null. if (! fromType.isNull()) return checkedConversionForTypeParameter(cast, fromType, toType); @@ -490,6 +510,19 @@ } } + // Added 03/28/10 to support new call conversion semantics. + if (cast.conversionType() == ConversionType.CALL_CONVERSION + && ts.isCastValid(fromType, toType, context)) { + X10Cast n = cast.conversionType(ConversionType.CHECKED); + XVar sv = X10TypeMixin.selfVarBinding(fromType); + if (sv != null) + try { + toType = X10TypeMixin.addSelfBinding((Type) toType.copy(), sv); + } catch (XFailure f) { + throw new SemanticError("Inconsistent type: " + toType + " {self==" + sv+"}", cast.position()); + } + return n.type(toType); + } throw new Errors.CannotConvertExprToType(cast.expr(), cast.conversionType(), toType, cast.position()); } Modified: trunk/x10.compiler/src/x10/util/Synthesizer.java =================================================================== --- trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.compiler/src/x10/util/Synthesizer.java 2010-03-31 21:51:43 UTC (rev 13606) @@ -27,11 +27,13 @@ import polyglot.ast.Field; import polyglot.ast.FieldDecl; import polyglot.ast.FlagsNode; +import polyglot.ast.FloatLit; import polyglot.ast.For; import polyglot.ast.ForInit; import polyglot.ast.ForUpdate; import polyglot.ast.Formal; import polyglot.ast.Id; +import polyglot.ast.IntLit; import polyglot.ast.Local; import polyglot.ast.LocalDecl; import polyglot.ast.MethodDecl; @@ -40,6 +42,7 @@ import polyglot.ast.Stmt; import polyglot.ast.TypeNode; import polyglot.ast.Unary; +import polyglot.frontend.Globals; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.ConstructorDef; @@ -58,15 +61,27 @@ import polyglot.types.Types; import polyglot.util.Pair; import polyglot.util.Position; +import polyglot.visit.ContextVisitor; +import polyglot.visit.TypeBuilder; import x10.ast.AnnotationNode; import x10.ast.Closure; +import x10.ast.DepParameterExpr; +import x10.ast.X10CanonicalTypeNode; import x10.ast.X10ClassDecl; import x10.ast.X10ClassDecl_c; import x10.ast.X10ConstructorDecl; import x10.ast.X10Formal; import x10.ast.X10NodeFactory; +import x10.ast.X10Special; +import x10.constraint.XDisEquals; +import x10.constraint.XEQV_c; +import x10.constraint.XEquals; import x10.constraint.XFailure; +import x10.constraint.XField; +import x10.constraint.XLit; +import x10.constraint.XLocal_c; import x10.constraint.XName; +import x10.constraint.XNot; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -82,6 +97,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.types.XTypeTranslator; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; import x10.types.constraints.CConstraint_c; @@ -101,6 +117,10 @@ xts=ts; xnf=nf; } + public Synthesizer() { + xts=(X10TypeSystem) Globals.TS(); + xnf=(X10NodeFactory) Globals.NF(); + } /** * Create a synthetic MethodDecl from the given data and return @@ -1273,5 +1293,168 @@ return (X10ClassDecl) cDecl.body(cb.members(cm)); } - + + /** + * Create a synthetic X10CanonicalTypeNode from the given Type. This node must have the property that if the type has a + * constraints clause c, then the depParameterExpr associated with the node must represent an AST that when translated to + * a constraint would yield c. + * @param pos + * @param type + * @param tc + * @return + * @throws SemanticException + */ + public X10CanonicalTypeNode makeCanonicalTypeNodeWithDepExpr(Position pos, Type type, ContextVisitor tc) throws SemanticException { + X10NodeFactory nf = ((X10NodeFactory) Globals.NF()); + CConstraint c = X10TypeMixin.xclause(type); + if (c == null || c.valid()) + return nf.X10CanonicalTypeNode(pos, type); + Type base = X10TypeMixin.baseType(type); + String typeName = base.toString(); + List<Type> types = Collections.EMPTY_LIST; + List<TypeNode> typeArgs = Collections.EMPTY_LIST; + if (base instanceof X10ClassType) { + X10ClassType xc = (X10ClassType) base; + types = xc.typeArguments(); + if (! types.isEmpty()) { + typeName = xc.def().toString(); + typeArgs = new ArrayList<TypeNode>(types.size()); + } + } + + if (!types.isEmpty()) { + for (Type t : types) + typeArgs.add(nf.X10CanonicalTypeNode(pos, t)); + } + + DepParameterExpr dep = nf.DepParameterExpr(pos, makeExpr(c, pos)); + + QName qName = QName.make(typeName); + QName qual = qName.qualifier(); + TypeNode tn = nf.AmbDepTypeNode(pos, qual==null ? null : nf.PrefixFromQualifiedName(pos, qual), + nf.Id(pos, qName.name()), typeArgs, Collections.EMPTY_LIST, dep); + TypeBuilder tb = new TypeBuilder(tc.job(), tc.typeSystem(), nf); + tn = (TypeNode) tn.visit(tb); + tn = (X10CanonicalTypeNode) tn.visit(tc); + if (! (tn instanceof X10CanonicalTypeNode)) + assert tn instanceof X10CanonicalTypeNode; + return (X10CanonicalTypeNode) tn; + + } + /** + * Return a synthesized AST for a constraint. Used when generating code from implicit casts. + * @param c -- the constraint + * @return -- the expr corresponding to the constraint + * @seeAlso -- X10TypeTransltor.constraint(...): it generates a constraint from an AST. + */ + Expr makeExpr(XTerm t, Position pos) { + if (t instanceof XField) + return makeExpr((XField) t, pos); + if (t instanceof XLit) + return makeExpr((XLit) t, pos); + if (t instanceof XEquals) + return makeExpr((XEquals) t, pos); + if (t instanceof XDisEquals) + return makeExpr((XDisEquals) t, pos); + if (t instanceof XEQV_c) + return makeExpr((XEQV_c) t, pos); // this must occur before XLocal_c + if (t instanceof XLocal_c) + return makeExpr((XLocal_c) t, pos); + if (t instanceof XNot) + return makeExpr((XNot) t, pos); + return null; + } + Expr makeExpr(XField t, Position pos) { + Expr r = makeExpr(t.receiver(), pos); + Name n = Name.make(t.field().toString()); + return xnf.Field(pos, r, xnf.Id(pos, n)); + } + Expr makeExpr(XEQV_c t, Position pos) { + String str = t.toString(); + //if (str.startsWith("_place")) + // assert ! str.startsWith("_place"); + int i = str.indexOf("#"); + TypeNode tn = null; + if (i > 0) { + String typeName = str.substring(0, i); + tn = xnf.TypeNodeFromQualifiedName(pos, QName.make(typeName)); + str = str.substring(i+1); + } + if (str.equals("self")) + return tn == null ? xnf.Special(pos, X10Special.SELF) : xnf.Special(pos, X10Special.SELF, tn); + if (str.equals("this")) + return tn == null ? xnf.Special(pos, X10Special.THIS) : xnf.Special(pos, X10Special.THIS, tn); + + return xnf.AmbExpr(pos, xnf.Id(pos,Name.make(str))); + } + Expr makeExpr(XLocal_c t, Position pos) { + String str = t.name().toString(); + //if (str.startsWith("_place")) + // assert ! str.startsWith("_place"); + if (str.equals("here")) + return xnf.Here(pos); + int i = str.indexOf("#"); + TypeNode tn = null; + if (i > 0) { + String typeName = str.substring(0, i); + tn = xnf.TypeNodeFromQualifiedName(pos, QName.make(typeName)); + str = str.substring(i+1); + } + if (str.equals("self")) + return tn == null ? xnf.Special(pos, X10Special.SELF) : xnf.Special(pos, X10Special.SELF, tn); + if (str.equals("this")) + return tn == null ? xnf.Special(pos, X10Special.THIS) : xnf.Special(pos, X10Special.THIS, tn); + return xnf.AmbExpr(pos, xnf.Id(pos,Name.make(str))); + } + + Expr makeExpr(XNot t, Position pos) { + return xnf.Unary(pos, makeExpr(t.arguments().get(0), pos), Unary.NOT); + } + + Expr makeExpr(XLit t, Position pos) { + Object val = t.val(); + if (val== null) + return xnf.NullLit(pos); + if (val instanceof String) + return xnf.StringLit(pos, (String) val); + if (val instanceof Integer) + return xnf.IntLit(pos, IntLit.INT, ((Integer) val).intValue()); + if (val instanceof Long) + return xnf.IntLit(pos, IntLit.LONG, ((Long) val).longValue()); + if (val instanceof Boolean) + return xnf.BooleanLit(pos, ((Boolean) val).booleanValue()); + if (val instanceof Character) + return xnf.CharLit(pos, ((Character) val).charValue()); + if (val instanceof Float) + return xnf.FloatLit(pos, FloatLit.DOUBLE, ((Double) val).doubleValue()); + return null; + } + Expr makeExpr(XEquals t, Position pos) { + Expr left = makeExpr(t.arguments().get(0), pos); + Expr right = makeExpr(t.arguments().get(1), pos); + if (left == null) + assert left != null; + if (right == null) + assert right != null; + return xnf.Binary(pos, left, Binary.EQ, right); + } + Expr makeExpr(XDisEquals t, Position pos) { + Expr left = makeExpr(t.arguments().get(0), pos); + Expr right = makeExpr(t.arguments().get(1), pos); + return xnf.Binary(pos, left, Binary.NE, right); + } + + + + public List<Expr> makeExpr(CConstraint c, Position pos) { + List<Expr> es = new ArrayList<Expr>(); + if (c==null) + return es; + List<XTerm> terms = c.extConstraints(); + + for (XTerm term : terms) { + es.add(makeExpr(term, pos)); + } + return es; + } } Modified: trunk/x10.runtime/src-x10/x10/lang/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Array.x10 2010-03-31 21:45:10 UTC (rev 13605) +++ trunk/x10.runtime/src-x10/x10/lang/Array.x10 2010-03-31 21:51:43 UTC (rev 13606) @@ -173,7 +173,7 @@ * @see #make[T](ValRail[T]) * @see #make[T](Region, (Point)=>T) */ - public static def make[T](rail: Rail[T]): Array[T]{rank==1&&rect&&zeroBased} + public static def make[T](rail: Rail[T]!): Array[T]{rank==1&&rect&&zeroBased} = BaseArray.makeVar1[T](rail); /** @@ -633,7 +633,7 @@ * to 'here' and the values from the corresponding elements of r. * @see #make[T](Rail[T]) */ - public static operator [T](r: Rail[T]): Array[T](1) = make(r); + public static operator [T](r: Rail[T]!): Array[T](1) = make(r); /** * Convert the given ValRail to an array. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-04-01 13:09:53
|
Revision: 13608 http://x10.svn.sourceforge.net/x10/?rev=13608&view=rev Author: tardieu Date: 2010-04-01 12:57:36 +0000 (Thu, 01 Apr 2010) Log Message: ----------- reverting part of r13591 restoring separate gc and 10 libs restoring -DISABLE_GC option in x10c++ to fix shared lib build on linux (until a better solution is implemented) Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/Configuration.java trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/Makefile Modified: trunk/x10.compiler/src/x10cpp/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10cpp/Configuration.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/Configuration.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -39,6 +39,9 @@ public static boolean VIM_MODELINE = true; private static final String VIM_MODELINE_desc = "Generate a modeline (formatting instructions) for VIm"; + public static boolean DISABLE_GC = false; + private static final String DISABLE_GC_desc = "Disable the linking in of the BDW conservative garbage collector"; + /** * Parses one argument from the command line. This allows the user * to specify options also on the command line (in addition to the Modified: trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -27,6 +27,8 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("aix_")); } + protected boolean gcEnabled() { return false; } + protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -100,6 +100,9 @@ x10rtOpts = new X10RTPostCompileOptions(rtimpl); } + /** Is GC enabled on this platform? */ + protected boolean gcEnabled() { return false; } + protected String defaultPostCompiler() { return x10rtOpts.cxx; } @@ -114,7 +117,7 @@ // headers generated from user input cxxCmd.add("-I"+options.output_directory); cxxCmd.add("-I."); - + if (x10.Configuration.OPTIMIZE) { cxxCmd.add(USE_XLC ? "-O3" : "-O2"); cxxCmd.add("-DNDEBUG"); @@ -143,6 +146,10 @@ cxxCmd.add("-L"+X10_DIST+"/lib"); cxxCmd.add("-lx10"); + if (!Configuration.DISABLE_GC && gcEnabled()) { + cxxCmd.add("-lgc"); + } + cxxCmd.addAll(x10rtOpts.ldFlags); cxxCmd.addAll(x10rtOpts.libs); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -23,6 +23,8 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("win32_")); } + protected boolean gcEnabled() { return true; } + protected String defaultPostCompiler() { return "g++-4"; } Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -25,6 +25,8 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("linux_")); } + protected boolean gcEnabled() { return true; } + protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -25,6 +25,8 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); } + protected boolean gcEnabled() { return true; } + protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); if (USE_32BIT) { Modified: trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-04-01 12:57:36 UTC (rev 13608) @@ -23,6 +23,8 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("sunos_")); } + protected boolean gcEnabled() { return false; } + protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.runtime/build.xml 2010-04-01 12:57:36 UTC (rev 13608) @@ -373,6 +373,11 @@ <target name="dist-bdwgc" depends="build-bdwgc" if="bdwgc.enabled"> <sequential> <mkdir dir="${lib}"/> + <copy todir="${lib}" preservelastmodified="true" flatten="true" > + <!--<fileset dir="${bdwgc.dir}/install/lib" includes="libgc.a"/>--> + <fileset dir="${bdwgc.dir}/install" includes="lib/*gc*.a,lib/*gc*.so,lib/*gc*.so.*,lib/*gc*.dylib"/> + <fileset dir="${bdwgc.dir}/install" includes="bin/*.dll"/> <!-- Cygwin --> + </copy> <copy todir="${inc}"> <fileset dir="${bdwgc.dir}/install/include" includes="**/*.h"/> </copy> Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-03-31 21:55:59 UTC (rev 13607) +++ trunk/x10.runtime/src-cpp/Makefile 2010-04-01 12:57:36 UTC (rev 13608) @@ -150,9 +150,6 @@ x10/util/concurrent/atomic/AtomicReference.o ALL_MANUAL_OBJECTS=$(ALL_XRCPP_OBJECTS) -ifdef ENABLE_GC - ALL_MANUAL_OBJECTS+=bdwgc/install/lib/libgc.a -endif # This target will build the XRX cc files into object files gen/all-o-generated: gen/all-cpp-generated $(XRX_MANIFEST) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-04-02 14:39:46
|
Revision: 13618 http://x10.svn.sourceforge.net/x10/?rev=13618&view=rev Author: tardieu Date: 2010-04-02 14:39:39 +0000 (Fri, 02 Apr 2010) Log Message: ----------- implemented bdgwc property file to remove the need for -DISABLE_GC option when invoking x10c++ if X10 was built with -DDISABLE_GC option Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/Configuration.java trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java trunk/x10.runtime/build.xml trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10aux/config.h Added Paths: ----------- trunk/x10.runtime/src-cpp/bdwgc_off.properties trunk/x10.runtime/src-cpp/bdwgc_on.properties Removed Paths: ------------- trunk/x10.runtime/src-cpp/x10aux/bdwgc.h trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h Modified: trunk/x10.compiler/src/x10cpp/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10cpp/Configuration.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/Configuration.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -39,9 +39,6 @@ public static boolean VIM_MODELINE = true; private static final String VIM_MODELINE_desc = "Generate a modeline (formatting instructions) for VIm"; - public static boolean DISABLE_GC = false; - private static final String DISABLE_GC_desc = "Disable the linking in of the BDW conservative garbage collector"; - /** * Parses one argument from the command line. This allows the user * to specify options also on the command line (in addition to the Modified: trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -27,8 +27,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("aix_")); } - protected boolean gcEnabled() { return false; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -67,6 +67,33 @@ } } + protected class BDWGCPostCompileOptions { + + public final Collection<? extends String> cxxFlags; + public final Collection<? extends String> libs; + + private Collection<? extends String> split(String s) { + ArrayList<String> l = new ArrayList<String>(); + if (s==null) return l; + QuotedStringTokenizer q = new QuotedStringTokenizer(s); + while (q.hasMoreTokens()) l.add(q.nextToken()); + return l; + } + + public BDWGCPostCompileOptions(String filename) { + Properties properties = new Properties(); + try { + properties.load(new FileInputStream(filename)); + } catch(IOException e) { + // [DC] proceeding from here will just yield a load of incomprehensible postcompile errors + throw new InternalCompilerError( + "Error finding BDWGC property file: "+ e.getMessage(), e); + } + cxxFlags = split(properties.getProperty("CXXFLAGS")); + libs = split(properties.getProperty("LDLIBS")); + } + } + protected static final String PLATFORM = System.getenv("X10_PLATFORM")==null?"unknown":System.getenv("X10_PLATFORM"); public static final String X10_DIST = System.getenv("X10_DIST"); protected static final boolean USE_XLC = PLATFORM.startsWith("aix_") && System.getenv("USE_GCC")==null; @@ -80,6 +107,8 @@ protected X10RTPostCompileOptions x10rtOpts; + protected BDWGCPostCompileOptions bdwgcOpts; + public CXXCommandBuilder(Options options, ErrorQueue eq) { assert (options != null); assert (options.post_compiler != null); @@ -98,11 +127,9 @@ rtimpl = X10_DIST + "/etc/x10rt_"+rtimpl+".properties"; } x10rtOpts = new X10RTPostCompileOptions(rtimpl); + bdwgcOpts = new BDWGCPostCompileOptions(X10_DIST + "/etc/bdwgc.properties"); } - /** Is GC enabled on this platform? */ - protected boolean gcEnabled() { return false; } - protected String defaultPostCompiler() { return x10rtOpts.cxx; } @@ -146,9 +173,8 @@ cxxCmd.add("-L"+X10_DIST+"/lib"); cxxCmd.add("-lx10"); - if (!Configuration.DISABLE_GC && gcEnabled()) { - cxxCmd.add("-lgc"); - } + cxxCmd.addAll(bdwgcOpts.cxxFlags); + cxxCmd.addAll(bdwgcOpts.libs); cxxCmd.addAll(x10rtOpts.ldFlags); cxxCmd.addAll(x10rtOpts.libs); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Cygwin_CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -23,8 +23,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("win32_")); } - protected boolean gcEnabled() { return true; } - protected String defaultPostCompiler() { return "g++-4"; } Modified: trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/Linux_CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -25,8 +25,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("linux_")); } - protected boolean gcEnabled() { return true; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/MacOSX_CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -25,8 +25,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("macosx_")); } - protected boolean gcEnabled() { return true; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); if (USE_32BIT) { Modified: trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.compiler/src/x10cpp/postcompiler/SunOS_CXXCommandBuilder.java 2010-04-02 14:39:39 UTC (rev 13618) @@ -23,8 +23,6 @@ assert (CXXCommandBuilder.PLATFORM.startsWith("sunos_")); } - protected boolean gcEnabled() { return false; } - protected void addPreArgs(ArrayList<String> cxxCmd) { super.addPreArgs(cxxCmd); cxxCmd.add("-Wno-long-long"); Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime/build.xml 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/build.xml 2010-04-02 14:39:39 UTC (rev 13618) @@ -324,6 +324,7 @@ <arg value="-enable-threads=posix" /> <arg value="-enable-thread-local-alloc" /> <arg value="--disable-dependency-tracking" /> + <!-- there is no good way to make an @rpath shared gc lib --> <arg value="--disable-shared" /> <env key="CFLAGS" value="${darwin.32}${darwin.64}-D_XOPEN_SOURCE" /> <arg value="--prefix=${bdwgc.platform.dir}/install" /> Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/src-cpp/Makefile 2010-04-02 14:39:39 UTC (rev 13618) @@ -6,13 +6,13 @@ INCLUDE_DIRS += -I. -I../x10rt/include -BDWGC_CONFIG=bdwgc_off.h +BDWGC_PROPERTIES=bdwgc_off.properties ifdef ENABLE_GC override CXXFLAGS += -DX10_USE_BDWGC BDWGC_INCLUDE_DIR= ./bdwgc/install/include INCLUDE_DIRS += -I$(BDWGC_INCLUDE_DIR) - BDWGC_CONFIG=bdwgc_on.h + BDWGC_PROPERTIES=bdwgc_on.properties endif override CXXFLAGS += $(INCLUDE_DIRS) -Igen @@ -200,7 +200,7 @@ @cp -p x10rt.h $(INSTDIR)/include @cp -p $(XRX_ARCHIVE) $(INSTDIR)/lib @cp -p $(XRX_MANIFEST) $(INSTDIR)/lib - @cp -p $(INSTDIR)/include/x10aux/$(BDWGC_CONFIG) $(INSTDIR)/include/x10aux/bdwgc.h + @cp -p $(BDWGC_PROPERTIES) $(INSTDIR)/etc/bdwgc.properties .PHONY: install Added: trunk/x10.runtime/src-cpp/bdwgc_off.properties =================================================================== --- trunk/x10.runtime/src-cpp/bdwgc_off.properties (rev 0) +++ trunk/x10.runtime/src-cpp/bdwgc_off.properties 2010-04-02 14:39:39 UTC (rev 13618) @@ -0,0 +1,2 @@ +CXXFLAGS= +LDLIBS= Added: trunk/x10.runtime/src-cpp/bdwgc_on.properties =================================================================== --- trunk/x10.runtime/src-cpp/bdwgc_on.properties (rev 0) +++ trunk/x10.runtime/src-cpp/bdwgc_on.properties 2010-04-02 14:39:39 UTC (rev 13618) @@ -0,0 +1,2 @@ +CXXFLAGS=-DX10_USE_BDWGC +LDLIBS=-lgc Deleted: trunk/x10.runtime/src-cpp/x10aux/bdwgc.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc.h 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc.h 2010-04-02 14:39:39 UTC (rev 13618) @@ -1,11 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - Deleted: trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc_off.h 2010-04-02 14:39:39 UTC (rev 13618) @@ -1,10 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ Deleted: trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/src-cpp/x10aux/bdwgc_on.h 2010-04-02 14:39:39 UTC (rev 13618) @@ -1,12 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -#define X10_USE_BDWGC Modified: trunk/x10.runtime/src-cpp/x10aux/config.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/config.h 2010-04-02 14:26:42 UTC (rev 13617) +++ trunk/x10.runtime/src-cpp/x10aux/config.h 2010-04-02 14:39:39 UTC (rev 13618) @@ -12,8 +12,6 @@ #ifndef X10AUX_CONFIG_H #define X10AUX_CONFIG_H -#include <x10aux/bdwgc.h> - /* * The following performance macros are supported: * NO_EXCEPTIONS - remove all exception-related code This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-04-02 15:43:04
|
Revision: 13620 http://x10.svn.sourceforge.net/x10/?rev=13620&view=rev Author: dgrove-oss Date: 2010-04-02 15:42:56 +0000 (Fri, 02 Apr 2010) Log Message: ----------- Move Array, Dist, and Region from x10.lang to x10.array packages. Patch up import statements in x10.dist/samples. Still a fair amount of import patching to do in the test suites; will do that next. Modified Paths: -------------- trunk/x10.compiler/data/ateach.xcd trunk/x10.compiler/data/forloop-mult.xcd trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/optimizations/LoopUnroller.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.dist/samples/ArraySum.x10 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/FSSimpleDist.x10 trunk/x10.dist/samples/HelloWholeWorld.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/MontyPi.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/NQueensPar.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/lang/_.x10 trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/array/Array.x10 trunk/x10.runtime/src-x10/x10/array/Dist.x10 trunk/x10.runtime/src-x10/x10/array/Region.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/lang/Array.x10 trunk/x10.runtime/src-x10/x10/lang/Dist.x10 trunk/x10.runtime/src-x10/x10/lang/RankMismatchException.x10 trunk/x10.runtime/src-x10/x10/lang/Region.x10 Modified: trunk/x10.compiler/data/ateach.xcd =================================================================== --- trunk/x10.compiler/data/ateach.xcd 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/data/ateach.xcd 2010-04-02 15:42:56 UTC (rev 13620) @@ -1,6 +1,6 @@ // 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 + x10.array.Dist #2__distCopy = #3; // make copy to avoid recomputation for (x10.core.Iterator<#7> #2__ = #2__distCopy.iterator(); #2__.hasNext(); ) { #0 #1 #2 = #2__.next(); #6 Modified: trunk/x10.compiler/data/forloop-mult.xcd =================================================================== --- trunk/x10.compiler/data/forloop-mult.xcd 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/data/forloop-mult.xcd 2010-04-02 15:42:56 UTC (rev 13620) @@ -1,7 +1,7 @@ // SYNOPSIS: #0=region_expr #1=region_var #2=rect_for_header #3=rect_for_body #4=regular_for_iterator { - x10.lang.Region #1 = (#0).region(); + x10.array.Region #1 = (#0).region(); if (#1.rect()) { #2 { #3 Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2010-04-02 15:42:56 UTC (rev 13620) @@ -409,7 +409,7 @@ public Expr ConstantDistMaker(Position pos, Expr e1, Expr e2) { NodeFactory nf = this; TypeSystem ts = this.extensionInfo().typeSystem(); - Receiver x10LangDistributionFactory = ReceiverFromQualifiedName(pos, QName.make("x10.lang.Dist")); + Receiver x10LangDistributionFactory = ReceiverFromQualifiedName(pos, QName.make("x10.array.Dist")); List<Expr> l = new TypedList<Expr>(new LinkedList<Expr>(), Expr.class, false); l.add(e1); l.add(e2); @@ -738,7 +738,7 @@ l.add(e1); l.add(e2); - Call n = new RegionMaker_c(pos, nf.TypeNodeFromQualifiedName(pos, QName.make("x10.lang.Region")), nf.Id(pos, "makeRectangular"), l); + Call n = new RegionMaker_c(pos, nf.TypeNodeFromQualifiedName(pos, QName.make("x10.array.Region")), nf.Id(pos, "makeRectangular"), l); n = (Call) n.ext(extFactory().extExpr()); n = (Call) n.del(delFactory().delExpr()); return n; Modified: trunk/x10.compiler/src/x10/optimizations/LoopUnroller.java =================================================================== --- trunk/x10.compiler/src/x10/optimizations/LoopUnroller.java 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/src/x10/optimizations/LoopUnroller.java 2010-04-02 15:42:56 UTC (rev 13620) @@ -347,7 +347,7 @@ fLoopParams.fMaxSymbolic= hi; fLoopParams.fStride= 1; } - } else if (mi.container() instanceof ClassType && ((ClassType) mi.container()).fullName().toString().equals("x10.lang.Region") && + } else if (mi.container() instanceof ClassType && ((ClassType) mi.container()).fullName().toString().equals("x10.array.Region") && mi.name().toString().equals("makeRectangular")) { Expr low, hi; low= args.get(0); @@ -378,7 +378,7 @@ } private boolean isRegionConvertCall(MethodInstance mi) { - return mi.container() instanceof ClassType && ((ClassType) mi.container()).fullName().toString().equals("x10.lang.Region") && + return mi.container() instanceof ClassType && ((ClassType) mi.container()).fullName().toString().equals("x10.array.Region") && mi.name().toString().equals("$convert"); } @@ -496,7 +496,7 @@ // that its name looks like "_selfNNNN" boolean isSelf= typeCons.entails(typeCons.self(), leftRcvr); //leftRcvr instanceof XLocal && ((XLocal) leftRcvr).name().toString().contains("self"); - boolean isRank= getFQN(leftName).equals("x10.lang.Region#rank"); + boolean isRank= getFQN(leftName).equals("x10.array.Region#rank"); if (isSelf && isRank) { return term; } Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-02 15:42:56 UTC (rev 13620) @@ -181,7 +181,7 @@ Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, List<Ref<? extends Type>> excTypes, Ref<XTerm> body); /** - * Return the ClassType object for the x10.lang.Array interface. + * Return the ClassType object for the x10.array.Array class. */ Type Array(); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-02 15:42:56 UTC (rev 13620) @@ -1383,7 +1383,7 @@ public Type Region() { if (regionType_ == null) - regionType_ = load("x10.lang.Region"); // java file + regionType_ = load("x10.array.Region"); // java file return regionType_; } @@ -1399,7 +1399,7 @@ public Type Dist() { if (distributionType_ == null) - distributionType_ = load("x10.lang.Dist"); // java file + distributionType_ = load("x10.array.Dist"); // java file return distributionType_; } @@ -1423,7 +1423,7 @@ public Type Array() { if (arrayType_ == null) - arrayType_ = load("x10.lang.Array"); + arrayType_ = load("x10.array.Array"); return arrayType_; } Modified: trunk/x10.dist/samples/ArraySum.x10 =================================================================== --- trunk/x10.dist/samples/ArraySum.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/ArraySum.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Region; import x10.io.Console; /** Modified: trunk/x10.dist/samples/FRASimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FRASimpleDist.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/FRASimpleDist.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Dist; import x10.io.Console; - import x10.util.Timer; class LocalTable { Modified: trunk/x10.dist/samples/FSSimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FSSimpleDist.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/FSSimpleDist.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,7 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Dist; import x10.util.Timer; import x10.io.Console; Modified: trunk/x10.dist/samples/HelloWholeWorld.x10 =================================================================== --- trunk/x10.dist/samples/HelloWholeWorld.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/HelloWholeWorld.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,7 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Dist; import x10.io.Console; /** Modified: trunk/x10.dist/samples/Histogram.x10 =================================================================== --- trunk/x10.dist/samples/Histogram.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/Histogram.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,7 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; import x10.util.Random; import x10.io.Console; Modified: trunk/x10.dist/samples/KMeansDist.x10 =================================================================== --- trunk/x10.dist/samples/KMeansDist.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/KMeansDist.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; import x10.io.Console; import x10.util.Random; Modified: trunk/x10.dist/samples/MontyPi.x10 =================================================================== --- trunk/x10.dist/samples/MontyPi.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/MontyPi.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; import x10.util.Random; import x10.io.Console; Modified: trunk/x10.dist/samples/NQueensDist.x10 =================================================================== --- trunk/x10.dist/samples/NQueensDist.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/NQueensDist.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,9 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Region; +import x10.array.Dist; import x10.io.Console; /** Modified: trunk/x10.dist/samples/NQueensPar.x10 =================================================================== --- trunk/x10.dist/samples/NQueensPar.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/NQueensPar.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -10,6 +10,7 @@ */ import x10.io.Console; +import x10.array.Region; public class NQueensPar { Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,10 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; +import x10.array.Region; + /** * This is one of a series of programs showing how to express * different forms of parallelism in X10.</p> Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,10 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; +import x10.array.Region; + /** * This is one of a series of programs showing how to express * different forms of parallelism in X10.</p> Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,10 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; +import x10.array.Region; + /** * This is one of a series of programs showing how to express * different forms of parallelism in X10.</p> Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,10 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; +import x10.array.Region; + /** * This is one of a series of programs showing how to express * different forms of parallelism in X10.</p> Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-02 14:44:58 UTC (rev 13619) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -9,6 +9,10 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Array; +import x10.array.Dist; +import x10.array.Region; + /** * This is one of a series of programs showing how to express * different forms of parallelism in X10.</p> Copied: trunk/x10.runtime/src-x10/x10/array/Array.x10 (from rev 13616, trunk/x10.runtime/src-x10/x10/lang/Array.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -0,0 +1,489 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +/** + * An array defines a mapping from points to data of some type T. An + * array is defined over a particular region. Distributed arrays are + * supported by defining an array over a distribution; the + * distribution determines at what place each array data item is + * stored. Arrays may be accessed using a(p) because arrays implement + * (Point)=>T. + * TODO Array views are supported via the restriction function. + * + * @param T the element type of the array + * + * @author bdlucas + */ +public abstract class Array[T]( + /** + * The distribution of this array. + */ + dist:Dist +) implements (Point(dist.region.rank))=>T, + Iterable[Point(dist.region.rank)] +{ + // + // properties + // + + // region via dist + /** + * The region this array is defined over. + */ + public global property region: Region(rank) = dist.region; + + /** + * The rank of this array. + */ + public global property rank: int = dist.rank; + + /** + * Is this array defined over a rectangular region? + */ + public global property rect: boolean = dist.rect; + + /** + * Is this array's region zero-based? + */ + public global property zeroBased: boolean = dist.zeroBased; + + // dist + /** + * Is this array's region a "rail" (one-dimensional contiguous zero-based)? + */ + public global property rail: boolean = dist.rail; + + /** + * Is this array's distribution "unique" (at most one point per place)? + */ + public global property unique: boolean = dist.unique; + + /** + * Is this array's distribution "constant" (all points map to the same place)? + */ + public global property constant: boolean = dist.constant; + + /** + * If this array's distribution is "constant", the place all points map to (or null). + */ + public global property onePlace: Place = dist.onePlace; + + + // + // factories + // + + /** + * Create a mutable local array over the given region and default initial values for elements. + * + * @param T the element type + * @param region the given region + * @return a mutable array with a constant distribution mapping all points in the given region to 'here'. + * @see #make[T](Dist) + * @see #make[T](Region, (Point)=>T) + */ + public static def make[T](region:Region)= BaseArray.makeVar1[T](region); + + /** + * Create a mutable array over the given distribution and default initial values for elements. + * + * @param T the element type + * @param dist the given distribution + * @return a mutable array with the given distribution. + * @see #make[T](Region) + * @see #make[T](Dist, (Point)=>T) + */ + public static def make[T](dist: Dist)= BaseArray.makeVar1[T](dist); + + /** + * Create a mutable local array over the given region. + * Executes the given initializer function for each element of the array. + * + * @param T the element type + * @param region the given region + * @param init the initializer function + * @return a mutable array with a constant distribution mapping all points in the given region to 'here'. + * @see #make[T](Region) + * @see #make[T](Dist, (Point)=>T) + */ + public static def make[T](region:Region, init: (Point(region.rank))=>T)= BaseArray.makeVar1[T](region, init); + + /** + * Create a mutable array over the given distribution. + * Executes the given initializer function for each element of the array. + * + * @param T the element type + * @param dist the given distribution + * @param init the initializer function + * @return a mutable array with the given distribution. + * @see #make[T](Dist) + * @see #make[T](Region, (Point)=>T) + */ + public static def make[T](dist: Dist, init: (Point(dist.rank))=>T)= BaseArray.makeVar1[T](dist, init); + + /** + * Create a mutable local array with the shape and values of the given Rail. + * + * @param T the element type + * @param rail the given Rail + * @return a mutable array with a constant distribution mapping all points in the region + * 0..rail.length-1 to 'here' and the values from the corresponding elements of rail. + * @see #make[T](ValRail[T]) + * @see #make[T](Region, (Point)=>T) + */ + public static def make[T](rail: Rail[T]!): Array[T]{rank==1&&rect&&zeroBased} + = BaseArray.makeVar1[T](rail); + + /** + * Create a mutable local array with the shape and values of the given ValRail. + * + * @param T the element type + * @param rail the given ValRail + * @return a mutable array with a constant distribution mapping all points in the region + * 0..rail.length-1 to 'here' and the values from the corresponding elements of rail. + * @see #make[T](Rail[T]) + * @see #make[T](Region, (Point)=>T) + */ + public static def make[T](rail: ValRail[T]): Array[T]{rank==1&&rect&&zeroBased} + = BaseArray.makeVar1[T](rail); + + /** + * Create a mutable local one-dimensional zero-based array of the given size. + * Executes the given initializer function for each element of the array. + * + * @param T the element type + * @param size the size of the array + * @param init the initializer function + * @return a mutable array with a constant distribution mapping all points in the + * region 0..size-1 to 'here'. + * @see #make[T](Rail[T]) + * @see #make[T](ValRail[T]) + * @see #make[T](Region, (Point)=>T) + */ + public static def make[T](size: Int, init: (Point(1))=>T): Array[T](1) + = BaseArray.makeVar1[T](0..size-1, init); + + + // + // operations + // + + /** + * Return the element of this array corresponding to the given point. + * The rank of the given point has to be the same as the rank of this array. + * + * @param pt the given point + * @return the element of this array corresponding to the given point. + * @see #apply(Int) + * @see #set(T, Point) + */ + public abstract safe global def apply(pt: Point(rank)): T; + + /** + * Return the element of this array corresponding to the given index. + * Only applies to one-dimensional arrays. + * Functionally equivalent to indexing the array via a one-dimensional point. + * + * @param i0 the given index in the first dimension + * @return the element of this array corresponding to the given index. + * @see #apply(Point) + * @see #set(T, Int) + */ + public abstract safe global def apply(i0: int) {rank==1}: T; + + /** + * Return the element of this array corresponding to the given pair of indices. + * Only applies to two-dimensional arrays. + * Functionally equivalent to indexing the array via a two-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the element of this array corresponding to the given pair of indices. + * @see #apply(Point) + * @see #set(T, Int, Int) + */ + public abstract safe global def apply(i0: int, i1: int) {rank==2}: T; + + /** + * Return the element of this array corresponding to the given triple of indices. + * Only applies to three-dimensional arrays. + * Functionally equivalent to indexing the array via a three-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the element of this array corresponding to the given triple of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int) + */ + public abstract safe global def apply(i0: int, i1: int, i2: int) {rank==3}: T; + + /** + * Return the element of this array corresponding to the given quartet of indices. + * Only applies to four-dimensional arrays. + * Functionally equivalent to indexing the array via a four-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the element of this array corresponding to the given quartet of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int, Int) + */ + public abstract safe global def apply(i0: int, i1: int, i2: int, i3:int) {rank==4}: T; + + + /** + * Set the element of this array corresponding to the given point to the given value. + * Return the new value of the element. + * The rank of the given point has to be the same as the rank of this array. + * + * @param v the given value + * @param pt the given point + * @return the new value of the element of this array corresponding to the given point. + * @see #apply(Point) + * @see #set(T, Int) + */ + public abstract safe global def set(v:T, pt: Point(rank)): T; + + /** + * Set the element of this array corresponding to the given index to the given value. + * Return the new value of the element. + * Only applies to one-dimensional arrays. + * Functionally equivalent to setting the array via a one-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @return the new value of the element of this array corresponding to the given index. + * @see #apply(Int) + * @see #set(T, Point) + */ + public abstract safe global def set(v:T, i0: int) {rank==1}: T; + + /** + * Set the element of this array corresponding to the given pair of indices to the given value. + * Return the new value of the element. + * Only applies to two-dimensional arrays. + * Functionally equivalent to setting the array via a two-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the new value of the element of this array corresponding to the given pair of indices. + * @see #apply(Int, Int) + * @see #set(T, Point) + */ + public abstract safe global def set(v:T, i0: int, i1: int) {rank==2}: T; + + /** + * Set the element of this array corresponding to the given triple of indices to the given value. + * Return the new value of the element. + * Only applies to three-dimensional arrays. + * Functionally equivalent to setting the array via a three-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the new value of the element of this array corresponding to the given triple of indices. + * @see #apply(Int, Int, Int) + * @see #set(T, Point) + */ + public abstract safe global def set(v:T, i0: int, i1: int, i2: int) {rank==3}: T; + + /** + * Set the element of this array corresponding to the given quartet of indices to the given value. + * Return the new value of the element. + * Only applies to four-dimensional arrays. + * Functionally equivalent to setting the array via a four-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the new value of the element of this array corresponding to the given quartet of indices. + * @see #apply(Int, Int, Int, Int) + * @see #set(T, Point) + */ + public abstract safe global def set(v:T, i0: int, i1: int, i2: int, i3:int) {rank==4}: T; + + + /** + * Restrict this array to the given region. + * The rank of the given region has to be the same as the rank of this array. + * Return a copy of this array whose region is the intersection of the given region and the + * region of this array. + * Also available as operator '|'. + * TODO: create an array view instead. + * + * @param r the given region + * @return a copy of this array whose region is the intersection of the given region and the + * region of this array. + * @see #restriction(Place) + */ + public abstract safe global def restriction(r: Region(rank)): Array[T](rank); + + /** + * Restrict this array to the given place. + * Return a copy of the portion of this array that resides in the given place. + * Also available as operator '|'. + * TODO: create an array view instead. + * + * @param p the given place + * @return a copy of the portion of this array that resides in the given place. + * @see #restriction(Region) + */ + public abstract safe global def restriction(p: Place): Array[T](rank); + + + /** + * Restrict this array to the given region. + * The rank of the given region has to be the same as the rank of this array. + * Return a copy of this array whose region is the intersection of the given region and the + * region of this array. + * TODO: create an array view instead. + * + * @param r the given region + * @return a copy of this array whose region is the intersection of the given region and the + * region of this array. + * @see #restriction(Region) + */ + public abstract safe global operator this | (r: Region(rank)): Array[T](rank); + + /** + * Restrict this array to the given place. + * Return a copy of the portion of this array that resides in the given place. + * TODO: create an array view instead. + * + * @param p the given place + * @return a copy of the portion of this array that resides in the given place. + * @see #restriction(Place) + */ + public abstract safe global operator this | (p: Place): Array[T](rank); + + + // + // array operations + // + + /** + * Lift this array using the given unary operation. + * Apply the operation pointwise to the elements of this array. + * Return a new array with the same distribution as this array. + * Each element of the new array is the result of applying the given operation to the + * corresponding element of this array. + * + * @param op the given unary operation + * @return a new array with the same distribution as this array. + * @see #reduce((T,T)=>T,T) + * @see #scan((T,T)=>T,T) + */ + public abstract global def lift(op:(T)=>T): Array[T](dist); + + /** + * Reduce this array using the given binary operation and the given initial value. + * Starting with the initial value, apply the operation pointwise to the current running value + * and each element of this array. + * Return the final result of the reduction. + * + * @param op the given binary operation + * @param unit the given initial value + * @return the final result of the reduction. + * @see #lift((T)=>T) + * @see #scan((T,T)=>T,T) + */ + public abstract global def reduce(op:(T,T)=>T, unit:T): T; + + /** + * Scan this array using the given binary operation and the given initial value. + * Starting with the initial value, apply the operation pointwise to the current running value + * and each element of this array. + * Return a new array with the same distribution as this array. + * Each element of the new array is the result of applying the given operation to the + * current running value and the corresponding element of this array. + * + * @param op the given binary operation + * @param unit the given initial value + * @return the final result of the reduction. + * @see #lift((T)=>T) + * @see #reduce((T,T)=>T,T) + */ + public abstract global def scan(op:(T,T)=>T, unit:T): Array[T](dist); + + + // + // further generalizations TBD: + // - extra array arg to contain result + // - op takes current Point + // + // also TBD: + // public abstract global def lift[U](op:(T)=>U): Array[U](dist); + // public abstract global def lift[U,V](op:(T,U)=>V, that:Array[U](dist)): Array[V](dist); + // public abstract global def overlay(that:Array[T](rank)): Array[T](rank); + // public abstract global def update(that:Array[T](rank)): Array[T](rank); + // + + + // + // + // + + /** + * Convert the given Rail to an array. + * @deprecated Use {@link x10.lang.Array#make[T](Rail[T])} instead. + * + * @param T the element type + * @param r the given Rail + * @return a mutable array with a constant distribution mapping all points in the region 0..r.length-1 + * to 'here' and the values from the corresponding elements of r. + * @see #make[T](Rail[T]) + */ + public static operator [T](r: Rail[T]!): Array[T](1) = make(r); + + /** + * Convert the given ValRail to an array. + * @deprecated Use {@link x10.lang.Array#make[T](ValRail[T])} instead. + * + * @param T the element type + * @param r the given ValRail + * @return a mutable array with a constant distribution mapping all points in the region 0..r.length-1 + * to 'here' and the values from the corresponding elements of r. + * @see #make[T](ValRail[T]) + */ + public static operator [T](r: ValRail[T]): Array[T](1) = make(r); + + + /** + * Return an iterator over the points in the region of this array. + * + * @return an iterator over the points in the region of this array. + * @see x10.lang.Iterable[T]#iterator() + */ + public global def iterator(): Iterator[Point(rank)] = region.iterator() as Iterator[Point(rank)]; + + + // + // + // + + /** + * Construct an Array with the given distribution. + * + * @param dist the given distribution + */ + protected def this(dist: Dist) = property(dist); +} + +// vim:tabstop=4:shiftwidth=4:expandtab Copied: trunk/x10.runtime/src-x10/x10/array/Dist.x10 (from rev 13616, trunk/x10.runtime/src-x10/x10/lang/Dist.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Dist.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/Dist.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -0,0 +1,544 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +import x10.util.Set; + +/** + * A distributution supports distributed arrays by providing a mapping + * from Points to Places. Equivalently, a distribution may be defined + * as a mapping from Places to Regions. The Dist class provides a set + * of factory methods for constructing various distributions. There + * are a set of methods supporting algebraic operations on + * distributions, such as union, intersection, difference, and so on. + */ +public abstract class Dist( + /** + * The region this distribution is defined over. + */ + region: Region, + /** + * Is this distribution "unique" (at most one point per place)? + */ + unique: boolean, + /** + * Is this distribution "constant" (all points map to the same place)? + */ + constant: boolean, + /** + * If this distribution is "constant", the place all points map to (or null). + */ + onePlace: Place +) implements + (Point/*(region.rank)*/)=>Place + // (Place)=>Region XTENLANG-60 + , Iterable[Point(region.rank)] +{ + + /** + * The rank of this distribution. + */ + property rank: Int = region.rank; + /** + * Is this distribution defined over a rectangular region? + */ + property rect: boolean = region.rect; + /** + * Is this distribution's region zero-based? + */ + property zeroBased: boolean = region.zeroBased; + /** + * Is this distribution's region a "rail" (one-dimensional contiguous zero-based)? + */ + property rail: boolean = region.rail; + + // XTENLANG-50: workaround requires explicit return type decls here + // XTENLANG-4: workaround requires BaseDist methods to be named differently from these methods + + // + // factories - place is all applicable places + // + + /** + * Create a distribution over a rank-1 region that maps every + * point in the region to a distinct place, and which maps some + * point in the region to every place. + * + * @return a "unique" distribution over all places. + */ + // TODO: [IP] return Dist(1){rect&&unique} + public static def makeUnique(): Dist(1){rect} = BaseDist.makeUnique1(); + + /** + * Create a distribution over the specified region that maps + * every point in the region to here. + * + * @param r the given region + * @return a "constant" distribution over r. + */ + // TODO: [IP] return Dist(r){constant&&onePlace==here} + public static def makeConstant(r: Region): Dist(r) = BaseDist.makeConstant1(r); + + /** + * Create a distribution over the specified region that maps + * every point in the region to here. + * + * @param r the given region + * @return a "constant" distribution over r. + * @see #makeConstant(Region) + */ + public static def make(r: Region): Dist(r) = makeConstant(r); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis, and maps the ith + * coordinate along that axis to place i%Place.NUM_PLACES. + * + * @param r the given region + * @param axis the dimension to cycle over + * @return a "cyclic" distribution over r. + */ + public static def makeCyclic(r: Region, axis: int): Dist(r) + = BaseDist.makeBlockCyclic1(r, axis, 1); + + /** + * Create a distribution over the specified region that varies in + * place only along the zeroth axis, and maps the ith + * coordinate along that axis to place i%Place.NUM_PLACES. + * + * @param r the given region + * @return a "cyclic" distribution over r, cycling over the zeroth axis. + */ + public static def makeCyclic(r: Region): Dist(r) + = BaseDist.makeBlockCyclic1(r, 0, 1); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis. It divides the coordinates + * along that axis into Place.MAX_PLACES blocks, and assigns + * successive blocks to successive places. + * + * @param r the given region + * @param axis the dimension to block over + * @return a "block" distribution over r. + */ + public static def makeBlock(r: Region, axis: int): Dist(r) { + val n = r.max()(axis) - r.min()(axis) + 1; + val bs = (n + Place.MAX_PLACES - 1) / Place.MAX_PLACES; + return BaseDist.makeBlockCyclic1(r, axis, bs); + } + + /** + * Create a distribution over the specified region that varies in + * place only the zeroth axis. It divides the coordinates + * along that axis into Place.MAX_PLACES blocks, and assigns + * successive blocks to successive places. + * + * @param r the given region + * @return a "block" distribution over r, blocked over the zeroth axis. + */ + public static def makeBlock(r:Region) = makeBlock(r, 0); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis. It divides the coordinates + * along that axis into blocks of the specified size, and assigns + * block i to place i%Place.MAX_PLACES. + * + * @param r the given region + * @param axis the dimension to block over + * @param blockSize the size of the block + * @return a "block-cyclic" distribution over r. + */ + public static def makeBlockCyclic(r: Region, axis: int, blockSize: int): Dist(r) + = BaseDist.makeBlockCyclic1(r, axis, blockSize); + + // + // factories - place is a parameter + // + + /** + * Create a distribution over a rank-1 region that maps every + * point in the region to a place in ps, and which maps some + * point in the region to every place in ps. + * + * @param ps the rail of places + * @return a "unique" distribution over the places in ps + */ + public static def makeUnique(ps:Rail[Place]): Dist(1) + = BaseDist.makeUnique1(ps); + + /** + * Create a distribution over a rank-1 region that maps every + * point in the region to a place in ps, and which maps some + * point in the region to every place in ps. + * + * @param ps the set of places + * @return a "unique" distribution over the places in ps + */ + public static def makeUnique(ps: Set[Place]): Dist(1) + = BaseDist.makeUnique1(ps); + + /** + * Create a distribution over the specified region that maps + * every point in the region to the specified place. + * + * @param r the given region + * @param p the given place + * @return a "constant" distribution over r that maps to p. + */ + public static def makeConstant(r: Region, p: Place): Dist(r) + = BaseDist.makeConstant1(r, p); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis, and maps the ith + * coordinate along that axis to place ps(i%ps.length). + * + * @param r the given region + * @param axis the dimension to cycle over + * @param ps the set of places + * @return a "cyclic" distribution over r, cycling over the places in ps. + */ + public static def makeCyclic(r: Region, axis: int, ps: Set[Place]): Dist(r) + = BaseDist.makeCyclic1(r, axis, ps); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis. It divides the coordinates + * along that axis into ps.length blocks, and assigns successive + * blocks to successive places in ps. + * + * @param r the given region + * @param axis the dimension to block over + * @param ps the set of places + * @return a "block" distribution over r, blocking over the places in ps. + */ + public static def makeBlock(r: Region, axis: int, ps: Set[Place]): Dist(r) + = BaseDist.makeBlock1(r, axis, ps); + + /** + * Create a distribution over the specified region that varies in + * place only along the specified axis. It divides the coordinates + * along that axis into blocks of the specified size, and assigns + * block i to place ps(i%ps.length). + * + * @param r the given region + * @param axis the dimension to block over + * @param blockSize the size of the block + * @param ps the set of places + * @return a "block-cyclic" distribution over r, cycling over the places in ps. + */ + public static def makeBlockCyclic(r: Region, axis: int, blockSize: int, ps: Set[Place]) + = BaseDist.makeBlockCyclic1(r, axis, blockSize, ps); + + + // + // mapping places to regions + // + + /** + * Return the set of places that this distribution maps some point to. + */ + abstract public global def places(): ValRail[Place]; + + /** + * Return the set of regions that this distribution maps some place to. + */ + abstract public global def regions(): ValRail[Region(rank)]; // essentially regionMap().values() + + /** + * Return the region consisting of points which this distribution + * maps to the specified place. + * + * @param p the given place + * @return the points that this distribution maps to p. + */ + abstract public global def get(p: Place): Region(rank); + + + + // + // mapping points to places + // + + /** + * Return the place which this distribution maps the specified point to. + * + * @param pt the given point + * @return the place that this distribution maps pt to. + */ + abstract public global def apply(pt: Point/*(rank)*/): Place; + + /** + * Return the place which this distribution maps the specified index to. + * Only applies to one-dimensional distributions. + * Functionally equivalent to indexing the distribution via a one-dimensional point. + * + * @param i0 the given index in the first dimension + * @return the place that this distribution maps the given index to. + * @see #apply(Point) + */ + abstract public global def apply(i0: int): Place; + + /** + * Return the place which this distribution maps the specified pair of indices to. + * Only applies to two-dimensional distributions. + * Functionally equivalent to indexing the distribution via a two-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the place that this distribution maps the given pair of indices to. + * @see #apply(Point) + */ + abstract public global def apply(i0: int, i1: int): Place; + + /** + * Return the place which this distribution maps the specified triple of indices to. + * Only applies to three-dimensional distributions. + * Functionally equivalent to indexing the distribution via a three-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the place that this distribution maps the given triple of indices to. + * @see #apply(Point) + */ + abstract public global def apply(i0: int, i1: int, i2: int): Place; + + /** + * Return the place which this distribution maps the specified quartet of indices to. + * Only applies to four-dimensional distributions. + * Functionally equivalent to indexing the distribution via a four-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the place that this distribution maps the given quartet of indices to. + * @see #apply(Point) + */ + abstract public global def apply(i0: int, i1: int, i2: int, i3: int): Place; + + + // + // + // + + /** + * Return an iterator for the underlying region of this distribution. + * Supports the syntax + * + * (for p:Point in d) + * ... p ... + * + * @return an iterator over the points in the region of this distribution. + * @see x10.lang.Iterable[T]#iterator() + */ + public global def iterator(): Iterator[Point{self.rank==region.rank}] = region.iterator() as Iterator[Point{self.rank==region.rank}]; + + + // + // geometric ops with region + // + + /** + * Return the distribution defined over this.region&&that.region, + * and which maps every point in its region to the same place as + * this distribution. + * + * @param r the given region + * @return the intersection of this distribution with r. + */ + abstract public global def intersection(r: Region(rank)): Dist(rank); + + /** + * Return the distribution defined over this.region-that.region, + * and which maps every point in its region to the same place as + * this distribution. + * + * @param r the given region + * @return the difference of this distribution and r. + */ + abstract public global def difference(r: Region(rank)): Dist(rank); + + /** + * Return the distribution defined over r, which must be + * contained in this.region, and which maps every point in its + * region to the same place as this distribution. + * Functionally equivalent to {@link #intersection(Region)}. + * + * @param r the given region + * @return the restriction of this distribution to r. + */ + abstract public global def restriction(r: Region(rank)): Dist(rank); + + + // + // geometric ops with distribution + // + + /** + * Return true iff that.region is contained in this.region, and + * that distribution maps every point to the same place as this + * distribution. + * + * @param that the given distribution + * @return true if that is a sub-distribution of this distribution. + */ + abstract public global def isSubdistribution(that: Dist(rank)): boolean; + + /** + * Return a distribution containing only points that are + * contained in both this distribution and that distribution, + * and which the two distributions map to the same place. + * + * @param that the given distribution + * @return the intersection of this distribution with that. + */ + abstract public global def intersection(that: Dist(rank)): Dist(rank); + + /** + * Return the distribution that contains every point in this + * distribution, except for those points which are also contained + * in that distribution and which that distribution maps to the + * same place as this distribution. + * + * @param that the given distribution + * @return the difference of this distribution and that. + */ + abstract public global def difference(that: Dist(rank)): Dist(rank); + + /** + * If this distribution and that distribution are disjoint, + * return the distribution that contains all points p that are in + * either distribution, and which map p to the same place as the + * distribution that contains p. Otherwise throws an exception. + * + * @param that the given distribution + * @return the disjoint union of this distribution and that. + */ + abstract public global def union(that: Dist(rank)): Dist(rank); + + /** + * Return a distribution whose region is the union of the regions + * of the two distributions, and which maps each point p to + * this(p) if p is contained in this, otherwise maps p to that(p). + * + * @param that the given distribution + * @return the union of this distribution and that. + */ + abstract public global def overlay(that: Dist(rank)): Dist(rank); + + /** + * Return true iff that is a distribution and both distributions are defined + * over the same regions, and map every point in that region to the same place. + * + * @param that the given distribution + * @return true if that is equal to this distribution. + */ + abstract public global safe def equals(that:Any):boolean; + + // + // other geometric ops + // + + /** + * Return the distribution restricted to those points which it + * maps to the specified place. + * + * @param p the given place + * @return the portion of this distribution that maps to p. + */ + abstract public global def restriction(p: Place): Dist(rank); + + /** + * Return true iff this.region contains p. + * + * @param p the given point + * @return true if this distribution contains p. + */ + abstract public global def contains(p: Point): boolean; + + + // + // ops + // + + /** + * Restrict this distribution to the specified region. + * + * @param r the given region + * @return the restriction of this distribution to r. + */ + public global operator this | (r: Region(this.rank)): Dist(this.rank) + = restriction(r); + + /** + * Restrict this distribution to the specified place. + * + * @param p the given place + * @return the restriction of this distribution to p. + */ + public global operator this | (p: Place): Dist(rank) = restriction(p); + + /** + * Intersect this distribution with the specified distribution. + * + * @param d the given distribution + * @return the intersection of this distribution and d. + */ + public global operator this && (d: Dist(rank)): Dist(rank) = intersection(d); + + /** + * Union this distribution with the specified distribution. + * + * @param d the given distribution + * @return the disjoint union of this distribution and d. + */ + public global operator this || (d: Dist(rank)): Dist(rank) = union(d); + + /** + * Subtract the specified distribution from this distribution. + * + * @param d the given distribution + * @return the difference of this distribution and d. + */ + public global operator this - (d: Dist(rank)): Dist(rank) = difference(d); + + /** + * Subtract the specified region from this distribution. + * + * @param r the given region + * @return the difference of this distribution and r. + */ + public global operator this - (r: Region(rank)): Dist(rank) = difference(r); + + + // + // + // + + /** + * Construct a distribution over the specified region. + * + * @param region the given region + * @param unique whether to construct a "unique" distribution + * @param constant whether to construct a "constant" distribution + * @param onePlace the place all points map to (if "constant") or null + */ + protected def this(region: Region, unique: boolean, constant: boolean, onePlace: Place) = { + property(region, unique, constant, onePlace); + } +} + +// vim:shiftwidth=4:tabstop=4:expandtab Copied: trunk/x10.runtime/src-x10/x10/array/Region.x10 (from rev 13616, trunk/x10.runtime/src-x10/x10/lang/Region.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Region.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/Region.x10 2010-04-02 15:42:56 UTC (rev 13620) @@ -0,0 +1,421 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +/** + * A Region(rank) represents a set of points of class Point(rank). The + * Region class defines a set of static factory methods for + * constructing regions. There are properties and methods for + * accessing basic information about of a region, such as its bounding + * box, its size, whether or not it is convex, whether or not it is + * empty. There are a set of methods for supporting algebraic + * operations on regions, such as intersection, union, difference, and + * so on. The set of points in a region may be iterated over. + * + * @author bdlucas + */ + +public abstract class Region( + rank: int, + rect: boolean, + zeroBased: boolean +) implements Iterable[Point(rank)] { + + property rail = rank==1 && rect && zeroBased; + property region = this; // structural affinity w/ Dist, Array for compiler + + // + // factories + // + + /** + * Construct an empty region of the specified rank. + */ + + public static def makeEmpty(rank: int): Region(rank) = BaseRegion.makeEmpty1(rank); + + /** + * Construct an unbounded region of a given rank that contains all + * points of that rank. + */ + + public static def makeFull(rank: int): Region(rank) = BaseRegion.makeFull1(rank); + + /** + * Construct a region of rank 0 that contains the single point of + * rank 0. Useful as the identity region under Cartesian product. + */ + + public static def makeUnit(): Region(0) = BaseRegion.makeUnit1(); + + + /** + * Construct an unbounded halfspace region of rank normal.rank + * that consists of all points p satisfying dot(p,normal) + k <= 0. + */ + + public static def makeHalfspace(normal:Point, k:int): Region(normal.rank) + = BaseRegion.makeHalfspace1(normal, k); + + + // + // rectangular factories + // + + /** + * Construct a rectangular region whose bounds are specified as + * rails of ints. + */ + + public static def makeRectangular(min: Rail[int]!, max: Rail[int]!): RectRegion(min.length) + = BaseRegion.makeRectangular1(min, max); + + /** + * Construct a rank-1 rectangular region with the specified bounds. + */ + + // XTENLANG-109 prevents zeroBased==(min==0) + // Changed RegionMaker_c to add clause explicitly. + public static def makeRectangular(min: int, max: int) + : Region{self.rank==1 && /*self.zeroBased==(min==0) &&*/ self.rect} + = BaseRegion.makeRectangular1(min, max); + + /** + * Construct a rank-1 rectangular region with the specified bounds. + */ + + public static def make(min: int, max: int): RectRegion(1) + = BaseRegion.makeRectangular1(min, max); + + /** + * Construct a rank-n rectangular region that is the Cartesian + * product of the specified rank-1 regions. + */ + + public static def make(regions: ValRail[Region]): RectRegion(regions.length) + = BaseRegion.make1(regions as Rail[Region]); + + + // + // non-rectangular factories + // + + /** + * Construct a banded region of the given size, with the specified + * number of diagonals above and below the main diagonal + * (inclusive of the main diagonal). + */ + + public static def makeBanded(size: int, upper: int, lower: int): Region(2) + = BaseRegion.makeBanded1(size, upper, lower); + + /** + * Construct a banded region of the given size that includes only + * the main diagonal. + */ + + public static def makeBanded(size: int): Region(2) + = BaseRegion.makeBanded1(size); + + /** + * Construct an upper triangular region of the given size. + */ + + public static def makeUpperTriangular(size: int): Region(2) + = BaseRegion.makeUpperTriangular1(0, 0, size); + + /** + * Construct an upper triangular region of the given size with the + * given lower bounds. + */ + + public static def makeUpperTriangular(rowMin: int, colMin: int, size: int): Region(2) + = BaseRegion.makeUpperTriangular1(rowMin, colMin, size); + + /** + * Construct a lower triangular region of the given size. + */ + + public static def makeLowerTriangular(size: int): Region(2) + = BaseRegion.makeLowerTriangular1(0, 0, size); + + /** + * Construct an lower triangular region of the given size with the + * given lower bounds. + */ + + public static def makeLowerTriangular(rowMin: int, colMin: int, size: int): Region(2) + = BaseRegion.makeLowerTriangular1(rowMin, colMin, size); + + + // + // Basic non-property information. + // + + /** + * Returns the number of points in this region. + */ + + public abstract global def size(): int; + + /** + * Returns true iff this region is convex. + */ + + public abstract global def isConvex(): boolean; + + /** + * Returns true iff this region is empty. + */ + + public abstract global def isEmpty(): boolean; + + + + // + // bounding box + // + + /** + * The bounding box of a region r is the smallest rectangular region + * that contains all the points of r. + */ + + abstract public global def boundingBox(): Region(rank); + + /** + * Returns the lower bounds of the bounding box of the region as a + * Rail[int]. + */ + + abstract public global def min(): ValRail[int]; + + /** + * Returns the upper bounds of the bounding box of the region as a + * Rail[int]. + */ + + abstract public global def max(): ValRail[int]; + + /** + * Returns the lower bound of the bounding box of the region along + * the ith axis. + */ + + public global def min(i:Int) = min()(i); + + /** + * Returns the upper bound of the bounding box of the region along + * the ith axis. + */ + + public global def max(i:Int) = max()(i); + + + // + // geometric ops + // + + /** + * Returns the complement of a region. The complement of a bounded + * region will be unbounded. + */ + + abstract public global def complement(): Region(rank); + + /** + * Returns the union of two regions: a region that contains all + * points that are in either this region or that region. + */ + + abstract public global def union(that: Region(rank)): Region(rank); + + /** ... [truncated message content] |
From: <dgr...@us...> - 2010-04-02 21:37:10
|
Revision: 13624 http://x10.svn.sourceforge.net/x10/?rev=13624&view=rev Author: dgrove-oss Date: 2010-04-02 21:37:03 +0000 (Fri, 02 Apr 2010) Log Message: ----------- Final step in splitting local and distributed arrays into separate user-level concepts. x10.array.LocalRectArray is renamed as x10.array.Array and it's methods are changed to be local. It no longer has a distribution, but is a simple mapping of the points in a Region to values of type T. x10.lang.Array does not have factory methods, instead user code should simply use "new" in the standard way. There is a constructor that matches each of the old make factory methods, so the transformation should be simple. x10.array.DistArray becomes the top-level type for distributed (global) arrays. It still has factory methods, since I want to keep open the option of having multiple DistArray implementation subclasses if it turns out that is useful for efficient implementation of different styles of distributions. Port the code in x10.dist/samples to the new APIs. Still significant work to do in updating the test suite. I will continue to work on that over the weekend, but wanted to get the API changes in before the end of the day. Expect many Array/Dist test failures until the test suite is updated. There is also still significant code cleanup, organization, and x10doc to do to reflect the changes in the array library. Will continue on that after working through test case changes. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/SettableAssign_c.java trunk/x10.compiler/src/x10/query/QueryEngine.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/MontyPi.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/lang/_.x10 trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/array/Array.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/array/Array.x10 trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10 Modified: trunk/x10.compiler/src/x10/ast/SettableAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/SettableAssign_c.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/ast/SettableAssign_c.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -222,7 +222,8 @@ n = (X10Call_c) n.del().disambiguate(tc).typeCheck(tc).checkConstants(tc); } catch (SemanticException e) { - boolean arrayP = xts.isX10Array(X10TypeMixin.baseType(array.type())); + Type bt = X10TypeMixin.baseType(array.type()); + boolean arrayP = xts.isX10Array(bt) || xts.isX10DistArray(bt); throw new Errors.CannotAssignToElement(leftToString(), arrayP, right, X10TypeMixin.arrayElementType(array.type()), position()); } } @@ -238,8 +239,9 @@ n = (X10Call_c) n.del().disambiguate(tc).typeCheck(tc).checkConstants(tc); } catch (SemanticException e) { - boolean arrayP = xts.isX10Array(X10TypeMixin.baseType(array.type())); - throw new Errors.CannotAssignToElement(leftToString(), arrayP, right, X10TypeMixin.arrayElementType(array.type()), position()); + Type bt = X10TypeMixin.baseType(array.type()); + boolean arrayP = xts.isX10Array(bt) || xts.isX10DistArray(bt); + throw new Errors.CannotAssignToElement(leftToString(), arrayP, right, X10TypeMixin.arrayElementType(array.type()), position()); } X10MethodInstance mi = (X10MethodInstance) n.methodInstance(); Modified: trunk/x10.compiler/src/x10/query/QueryEngine.java =================================================================== --- trunk/x10.compiler/src/x10/query/QueryEngine.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/query/QueryEngine.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -82,7 +82,7 @@ public boolean needsHereCheck(SettableAssign a, X10Context context) { Type lt = a.leftType(); X10TypeSystem ts = (X10TypeSystem) lt.typeSystem(); - if (X10TypeMixin.isX10Array(lt)) { + if (X10TypeMixin.isX10Array(lt) || X10TypeMixin.isX10DistArray(lt)) { return needsHereCheck(X10TypeMixin.arrayBaseType(lt), context); } return false; Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -854,7 +854,8 @@ X10ClassType ct = (X10ClassType) t; X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); ClassType a = (ClassType) ts.Array(); - if (ct.def() == a.def()) + ClassType da = (ClassType) ts.Array(); + if (ct.def() == a.def() || ct.def() == da.def()) return ct.typeArguments().get(0); else arrayBaseType(ct.superClass()); @@ -862,22 +863,31 @@ return null; } - public static boolean isVarArray(Type t) { - X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - Type tt = baseType(t); - Type at = baseType(ts.Array()); - if (tt instanceof ClassType && at instanceof ClassType) { - ClassDef tdef = ((ClassType) tt).def(); - ClassDef adef = ((ClassType) at).def(); - return ts.descendsFrom(tdef, adef); - } - return false; - } - public static boolean isX10Array(Type t) { - return isVarArray(t); + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + Type tt = baseType(t); + Type at = baseType(ts.Array()); + if (tt instanceof ClassType && at instanceof ClassType) { + ClassDef tdef = ((ClassType) tt).def(); + ClassDef adef = ((ClassType) at).def(); + return ts.descendsFrom(tdef, adef); + } + return false; } + + public static boolean isX10DistArray(Type t) { + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + Type tt = baseType(t); + Type at = baseType(ts.DistArray()); + if (tt instanceof ClassType && at instanceof ClassType) { + ClassDef tdef = ((ClassType) tt).def(); + ClassDef adef = ((ClassType) at).def(); + return ts.descendsFrom(tdef, adef); + } + return false; + } + static XTerm findOrSythesize(Type t, Name propName) { return find(t, propName); } @@ -1053,7 +1063,7 @@ public static Type arrayElementType(Type t) { t = baseType(t); X10TypeSystem xt = (X10TypeSystem) t.typeSystem(); - if (xt.isX10Array(t) || xt.isRail(t)) { + if (xt.isX10Array(t) || xt.isX10DistArray(t) || xt.isRail(t)) { if (t instanceof X10ParsedClassType) { Type result = ((X10ParsedClassType) t).typeArguments().get(0); return result; Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -185,7 +185,13 @@ */ Type Array(); + /** + * Return the ClassType object for the x10.array.DistArray class. + */ + Type DistArray(); + + /** * Return the ClassType object for the x10.lang.Rail interface. * * @return @@ -397,7 +403,9 @@ void existsStructWithName(Id name, ContextVisitor tc) throws SemanticException; boolean isX10Array(Type me); - + + boolean isX10DistArray(Type me); + Context emptyContext(); Type Struct(); boolean isExactlyFunctionType(Type t); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -1427,6 +1427,15 @@ return arrayType_; } + protected ClassType distArrayType_ = null; + + public Type DistArray() { + if (distArrayType_ == null) + distArrayType_ = load("x10.array.DistArray"); + return distArrayType_; + } + + // RMF 11/1/2005 - Not having the "static" qualifier on interfaces causes // problems, // e.g. for New_c.disambiguate(AmbiguityRemover), which assumes that @@ -1620,6 +1629,17 @@ } } + public boolean isX10DistArray(Type me) { + if (hasSameClassDef(me, DistArray())) { + return true; + } else if (me.isClass()) { + Type parent = me.toClass().superClass(); + return parent != null && isX10DistArray(parent); + } else { + return false; + } + } + public boolean isTypeConstrained(Type me) { return me instanceof ConstrainedType; } @@ -1653,7 +1673,7 @@ } public boolean isDistributedArray(Type me) { - return isX10Array(me); + return isX10DistArray(me); } public boolean isComparable(Type me) { Modified: trunk/x10.compiler/src/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -538,7 +538,7 @@ Expr domain = a.domain(); Type dType = domain.type(); - if (((X10TypeSystem_c) xts).isX10Array(dType)) { + if (((X10TypeSystem_c) xts).isX10DistArray(dType)) { FieldInstance fDist = dType.toClass().fieldNamed(DIST); dType = fDist.type(); domain = xnf.Field(pos, domain, xnf.Id(pos, DIST)).fieldInstance(fDist).type(dType); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-02 21:37:03 UTC (rev 13624) @@ -3766,11 +3766,11 @@ if (Configuration.LOOP_OPTIMIZATIONS && form.hasExplodedVars() && form.isUnnamed() && xts.isPoint(form.type().type()) && (X10TypeMixin.isRect(dType, context)) && - (xts.isX10Array(dType) || xts.isDistribution(dType) || xts.isRegion(dType))) + (xts.isX10Array(dType) || xts.isX10DistArray(dType) || xts.isDistribution(dType) || xts.isRegion(dType))) { // TODO: move this to the Desugarer X10NodeFactory xnf = (X10NodeFactory) tr.nodeFactory(); - if (xts.isX10Array(dType)) { + if (xts.isX10DistArray(dType)) { Position pos = domain.position(); FieldInstance fDist = null; while (true) { Modified: trunk/x10.dist/samples/Histogram.x10 =================================================================== --- trunk/x10.dist/samples/Histogram.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/Histogram.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -33,7 +33,7 @@ } val N = int.parse(args(0)); val S = int.parse(args(1)); - val a = Array.make[int](0..N-1, ((i):Point)=> i); + val a = new Array[int](0..N-1, ((i):Point)=> i); val b = Rail.make[int](S); run(a, b); val v = b(0); Modified: trunk/x10.dist/samples/KMeansDist.x10 =================================================================== --- trunk/x10.dist/samples/KMeansDist.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/KMeansDist.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,7 +9,7 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; +import x10.array.DistArray; import x10.array.Dist; import x10.io.Console; import x10.util.Random; @@ -30,7 +30,7 @@ ()=> Rail.make[Int](CLUSTERS, (i:Int) => 0)); val points_dist = Dist.makeBlock(points_region, 0); - val points = Array.make[Float](points_dist, (p:Point)=>rnd().nextFloat()); + val points = DistArray.make[Float](points_dist, (p:Point)=>rnd().nextFloat()); val central_clusters = Rail.make[Float](CLUSTERS*DIM, (i:Int) => { val p = Point.make([i/DIM, i%DIM]); Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,6 +9,9 @@ * (C) Copyright IBM Corporation 2006-2010. */ +import x10.array.Dist; +import x10.array.DistArray; + import x10.io.Console; import x10.io.File; import x10.io.Marshal; @@ -54,7 +57,7 @@ val m = Marshal.INT; val init_points = (Int) => Float.fromIntBits(m.read(fr).reverseBytes()); val points_cache = ValRail.make[Float](POINTS*DIM, init_points); - val points = Array.make[Float](points_dist, (p:Point)=>points_cache(p(0)*DIM+p(1))); + val points = DistArray.make[Float](points_dist, (p:Point)=>points_cache(p(0)*DIM+p(1))); val central_clusters = Rail.make[Float](CLUSTERS*DIM, (i:Int) => points_cache(i)); // used to measure convergence at each iteration: @@ -71,7 +74,7 @@ finish { val closure = () => { - val local_points = points.restriction(here) as Array[Float](2); + val local_points = points.restriction(here) as DistArray[Float](2); val clusters = Rail.make[Float](CLUSTERS*DIM, (i:Int) => 0.0f); val new_clusters = Rail.make[Float](CLUSTERS*DIM, (i:Int) => 0.0f); Modified: trunk/x10.dist/samples/MontyPi.x10 =================================================================== --- trunk/x10.dist/samples/MontyPi.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/MontyPi.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.util.Random; import x10.io.Console; @@ -31,7 +31,7 @@ } result }; - val result = Array.make[Double](Dist.makeUnique(), initializer); + val result = DistArray.make[Double](Dist.makeUnique(), initializer); val pi = 4*result.reduce(Double.+,0)/(N*Place.MAX_PLACES); Console.OUT.println("The value of pi is " + pi); } Modified: trunk/x10.dist/samples/NQueensDist.x10 =================================================================== --- trunk/x10.dist/samples/NQueensDist.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/NQueensDist.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,7 +9,7 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; +import x10.array.DistArray; import x10.array.Region; import x10.array.Dist; import x10.io.Console; @@ -26,12 +26,12 @@ global val N:Int; global val P:Int; - global val results:Array[Int](1); + global val results:DistArray[Int](1); def this(N:Int, P:Int) { this.N=N; this.P=P; - this.results = Array.make[Int](Dist.makeUnique(), (Point)=>0); + this.results = DistArray.make[Int](Dist.makeUnique(), (Point)=>0); } def start() { new Board().search(); Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.array.Region; /** @@ -34,12 +34,12 @@ const BigD = Dist.makeBlock([0..n+1, 0..n+1], 0); const D = BigD | ([1..n, 1..n] as Region); const LastRow = [0..0, 1..n] as Region; - const A = Array.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); - const Temp = Array.make[Real](BigD); + const A = DistArray.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); + const Temp = DistArray.make[Real](BigD); static def stencil_1((x,y):Point(2)) = (([x-1..x+1,y..y] as Region(2)) || [x..x,y-1..y+1]) - [x..x,y..y]; - static def subtract(a:Array[Real],b:Array[Real]) = Array.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); + static def subtract(a:DistArray[Real],b:DistArray[Real]) = DistArray.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); def run() { var delta:Real = 1.0; Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.array.Region; /** @@ -34,12 +34,12 @@ const BigD = Dist.makeBlock([0..n+1, 0..n+1], 0); const D = BigD | ([1..n, 1..n] as Region); const LastRow = [0..0, 1..n] as Region; - const A = Array.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); - const Temp = Array.make[Real](BigD); + const A = DistArray.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); + const Temp = DistArray.make[Real](BigD); static def stencil_1((x,y):Point(2)) = (([x-1..x+1,y..y] as Region(2)) || [x..x,y-1..y+1]) - [x..x,y..y]; - static def subtract(a:Array[Real],b:Array[Real]) = Array.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); + static def subtract(a:DistArray[Real],b:DistArray[Real]) = DistArray.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); def run() { val D_Base = Dist.makeUnique(D.places()); Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.array.Region; /** @@ -45,15 +45,15 @@ const BigD = Dist.makeBlock([0..n+1, 0..n+1], 0); const D = BigD | ([1..n, 1..n] as Region); const LastRow = [0..0, 1..n] as Region; - const A = Array.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); - const Temp = Array.make[Real](BigD); + const A = DistArray.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); + const Temp = DistArray.make[Real](BigD); static def stencil_1((x,y):Point(2)) = (([x-1..x+1,y..y] as Region(2)) || [x..x,y-1..y+1]) - [x..x,y..y]; - static def subtract(a:Array[Real],b:Array[Real]) = Array.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); + static def subtract(a:DistArray[Real],b:DistArray[Real]) = DistArray.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); // TODO: This is a really inefficient implementation of this abstraction. - // Needs to be done properly and integrated into the Dist/Region/Array + // Needs to be done properly and integrated into the Dist/Region/DistArray // class library in x10.array. static def blockIt(d:Dist(2), numProcs:int):ValRail[Iterable[Point(2)]] { val ans = ValRail.make(numProcs, (int) => new x10.util.ArrayList[Point{self.rank==d.rank}]()); Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.array.Region; /** @@ -33,17 +33,17 @@ const BigD = Dist.makeBlock([0..n+1, 0..n+1], 0); const D = BigD | ([1..n, 1..n] as Region); const LastRow = [0..0, 1..n] as Region; - const A = Array.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); - const Temp = Array.make[Real](BigD); + const A = DistArray.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); + const Temp = DistArray.make[Real](BigD); static def stencil_1((x,y):Point(2)) = (([x-1..x+1,y..y] as Region(2)) || [x..x,y-1..y+1]) - [x..x,y..y]; - static def subtract(a:Array[Real],b:Array[Real]) = Array.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); + static def subtract(a:DistArray[Real],b:DistArray[Real]) = DistArray.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); // TODO: The array library really should provide an efficient // all-to-all collective reduction. // This is a quick and sloppy implementation, which does way too much work. - static def reduceMax(z:Point{self.rank==diff.rank}, diff:Array[Real], scratch:Array[Real]) { + static def reduceMax(z:Point{self.rank==diff.rank}, diff:DistArray[Real], scratch:DistArray[Real]) { val max = diff.reduce(Math.max.(Double,Double), 0.0); diff(z) = max; next; @@ -53,8 +53,8 @@ finish async { val c = Clock.make(); val D_Base = Dist.makeUnique(D.places()); - val diff = Array.make[Real](D_Base); - val scratch = Array.make[Real](D_Base); + val diff = DistArray.make[Real](D_Base); + val scratch = DistArray.make[Real](D_Base); ateach (z in D_Base) clocked(c) { do { diff(z) = 0; Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -9,8 +9,8 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.array.Dist; +import x10.array.DistArray; import x10.array.Region; /** @@ -34,24 +34,24 @@ const BigD = Dist.makeBlock([0..n+1, 0..n+1], 0); const D = BigD | ([1..n, 1..n] as Region); const LastRow = [0..0, 1..n] as Region; - const A = Array.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); - const Temp = Array.make[Real](BigD); + const A = DistArray.make[Real](BigD,(p:Point)=>{ LastRow.contains(p) ? 1.0 : 0.0 }); + const Temp = DistArray.make[Real](BigD); static def stencil_1((x,y):Point(2)) = (([x-1..x+1,y..y] as Region(2)) || [x..x,y-1..y+1]) - [x..x,y..y]; - static def subtract(a:Array[Real],b:Array[Real]) = Array.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); + static def subtract(a:DistArray[Real],b:DistArray[Real]) = DistArray.make[Real](a.dist, (p:Point)=>a(p as Point(a.rank))-b(p as Point(b.rank))); // TODO: The array library really should provide an efficient // all-to-all collective reduction. // This is a quick and sloppy implementation, which does way too much work. - static def reduceMax(z:Point{self.rank==diff.rank}, diff:Array[Real], scratch:Array[Real]) { + static def reduceMax(z:Point{self.rank==diff.rank}, diff:DistArray[Real], scratch:DistArray[Real]) { val max = diff.reduce(Math.max.(Double,Double), 0.0); diff(z) = max; next; } // TODO: This is a really inefficient implementation of this abstraction. - // Needs to be done properly and integrated into the Dist/Region/Array + // Needs to be done properly and integrated into the Dist/Region/DistArray // class library in x10.array. static def blockIt(d:Dist(2), numProcs:int):ValRail[Iterable[Point(2)]] { val ans = ValRail.make(numProcs, (int) => new x10.util.ArrayList[Point{self.rank==d.rank}]()); @@ -67,8 +67,8 @@ finish async { val c = Clock.make(); val D_Base = Dist.makeUnique(D.places()); - val diff = Array.make[Real](D_Base); - val scratch = Array.make[Real](D_Base); + val diff = DistArray.make[Real](D_Base); + val scratch = DistArray.make[Real](D_Base); ateach (z in D_Base) clocked(c) { val blocks:ValRail[Iterable[Point(2)]] = blockIt(D | here, P); foreach ((q) in 0..P-1) clocked(c) { Deleted: trunk/x10.runtime/src-x10/x10/array/Array.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -1,486 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.array; - -/** - * An array defines a mapping from points to data of some type T. An - * array is defined over a particular region. Distributed arrays are - * supported by defining an array over a distribution; the - * distribution determines at what place each array data item is - * stored. Arrays may be accessed using a(p) because arrays implement - * (Point)=>T. - * - * @param T the element type of the array - * - * @author bdlucas - */ -public abstract class Array[T]( - /** - * The distribution of this array. - */ - dist:Dist -) implements (Point(dist.region.rank))=>T, - Iterable[Point(dist.region.rank)] -{ - // - // properties - // - - // region via dist - /** - * The region this array is defined over. - */ - public global property region: Region(rank) = dist.region; - - /** - * The rank of this array. - */ - public global property rank: int = dist.rank; - - /** - * Is this array defined over a rectangular region? - */ - public global property rect: boolean = dist.rect; - - /** - * Is this array's region zero-based? - */ - public global property zeroBased: boolean = dist.zeroBased; - - // dist - /** - * Is this array's region a "rail" (one-dimensional contiguous zero-based)? - */ - public global property rail: boolean = dist.rail; - - /** - * Is this array's distribution "unique" (at most one point per place)? - */ - public global property unique: boolean = dist.unique; - - /** - * Is this array's distribution "constant" (all points map to the same place)? - */ - public global property constant: boolean = dist.constant; - - /** - * If this array's distribution is "constant", the place all points map to (or null). - */ - public global property onePlace: Place = dist.onePlace; - - - // - // factories for local arrays (no distributions) - // - - /** - * Create a mutable local array over the given region and default initial values for elements. - * - * @param T the element type - * @param region the given region - * @return a mutable array with a constant distribution mapping all points in the given region to 'here'. - * @see #make[T](Dist) - * @see #make[T](Region, (Point)=>T) - */ - public static def make[T](region:Region)= new LocalRectArray[T](region); - - /** - * Create a mutable local array over the given region. - * Executes the given initializer function for each element of the array. - * - * @param T the element type - * @param region the given region - * @param init the initializer function - * @return a mutable array with a constant distribution mapping all points in the given region to 'here'. - * @see #make[T](Region) - * @see #make[T](Dist, (Point)=>T) - */ - public static def make[T](region:Region, init: (Point(region.rank))=>T)= new LocalRectArray[T](region, init); - - /** - * Create a mutable local array with the shape and values of the given Rail. - * - * @param T the element type - * @param rail the given Rail - * @return a mutable array with a constant distribution mapping all points in the region - * 0..rail.length-1 to 'here' and the values from the corresponding elements of rail. - * @see #make[T](ValRail[T]) - * @see #make[T](Region, (Point)=>T) - */ - public static def make[T](rail: Rail[T]!) = new LocalRectArray[T](rail); - - /** - * Create a mutable local array with the shape and values of the given ValRail. - * - * @param T the element type - * @param rail the given ValRail - * @return a mutable array with a constant distribution mapping all points in the region - * 0..rail.length-1 to 'here' and the values from the corresponding elements of rail. - * @see #make[T](Rail[T]) - * @see #make[T](Region, (Point)=>T) - */ - public static def make[T](rail: ValRail[T]) = new LocalRectArray[T](rail); - - /** - * Create a mutable local one-dimensional zero-based array of the given size. - * Executes the given initializer function for each element of the array. - * - * @param T the element type - * @param size the size of the array - * @param init the initializer function - * @return a mutable array with a constant distribution mapping all points in the - * region 0..size-1 to 'here'. - * @see #make[T](Rail[T]) - * @see #make[T](ValRail[T]) - * @see #make[T](Region, (Point)=>T) - */ - public static def make[T](size: Int, init: (Point(1))=>T) = new LocalRectArray[T](size-1, init); - - - - // - // factories for dist arrays - // - - /** - * Create a mutable array over the given distribution and default initial values for elements. - * - * @param T the element type - * @param dist the given distribution - * @return a mutable array with the given distribution. - * @see #make[T](Region) - * @see #make[T](Dist, (Point)=>T) - */ - public static def make[T](dist: Dist)= new DistArray[T](dist); - - /** - * Create a mutable array over the given distribution. - * Executes the given initializer function for each element of the array. - * - * @param T the element type - * @param dist the given distribution - * @param init the initializer function - * @return a mutable array with the given distribution. - * @see #make[T](Dist) - * @see #make[T](Region, (Point)=>T) - */ - public static def make[T](dist: Dist, init: (Point(dist.rank))=>T)= new DistArray[T](dist, init); - - // - // operations - // - - /** - * Return the element of this array corresponding to the given point. - * The rank of the given point has to be the same as the rank of this array. - * - * @param pt the given point - * @return the element of this array corresponding to the given point. - * @see #apply(Int) - * @see #set(T, Point) - */ - public abstract safe global def apply(pt: Point(rank)): T; - - /** - * Return the element of this array corresponding to the given index. - * Only applies to one-dimensional arrays. - * Functionally equivalent to indexing the array via a one-dimensional point. - * - * @param i0 the given index in the first dimension - * @return the element of this array corresponding to the given index. - * @see #apply(Point) - * @see #set(T, Int) - */ - public abstract safe global def apply(i0: int) {rank==1}: T; - - /** - * Return the element of this array corresponding to the given pair of indices. - * Only applies to two-dimensional arrays. - * Functionally equivalent to indexing the array via a two-dimensional point. - * - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @return the element of this array corresponding to the given pair of indices. - * @see #apply(Point) - * @see #set(T, Int, Int) - */ - public abstract safe global def apply(i0: int, i1: int) {rank==2}: T; - - /** - * Return the element of this array corresponding to the given triple of indices. - * Only applies to three-dimensional arrays. - * Functionally equivalent to indexing the array via a three-dimensional point. - * - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @param i2 the given index in the third dimension - * @return the element of this array corresponding to the given triple of indices. - * @see #apply(Point) - * @see #set(T, Int, Int, Int) - */ - public abstract safe global def apply(i0: int, i1: int, i2: int) {rank==3}: T; - - /** - * Return the element of this array corresponding to the given quartet of indices. - * Only applies to four-dimensional arrays. - * Functionally equivalent to indexing the array via a four-dimensional point. - * - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @param i2 the given index in the third dimension - * @param i3 the given index in the fourth dimension - * @return the element of this array corresponding to the given quartet of indices. - * @see #apply(Point) - * @see #set(T, Int, Int, Int, Int) - */ - public abstract safe global def apply(i0: int, i1: int, i2: int, i3:int) {rank==4}: T; - - - /** - * Set the element of this array corresponding to the given point to the given value. - * Return the new value of the element. - * The rank of the given point has to be the same as the rank of this array. - * - * @param v the given value - * @param pt the given point - * @return the new value of the element of this array corresponding to the given point. - * @see #apply(Point) - * @see #set(T, Int) - */ - public abstract safe global def set(v:T, pt: Point(rank)): T; - - /** - * Set the element of this array corresponding to the given index to the given value. - * Return the new value of the element. - * Only applies to one-dimensional arrays. - * Functionally equivalent to setting the array via a one-dimensional point. - * - * @param v the given value - * @param i0 the given index in the first dimension - * @return the new value of the element of this array corresponding to the given index. - * @see #apply(Int) - * @see #set(T, Point) - */ - public abstract safe global def set(v:T, i0: int) {rank==1}: T; - - /** - * Set the element of this array corresponding to the given pair of indices to the given value. - * Return the new value of the element. - * Only applies to two-dimensional arrays. - * Functionally equivalent to setting the array via a two-dimensional point. - * - * @param v the given value - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @return the new value of the element of this array corresponding to the given pair of indices. - * @see #apply(Int, Int) - * @see #set(T, Point) - */ - public abstract safe global def set(v:T, i0: int, i1: int) {rank==2}: T; - - /** - * Set the element of this array corresponding to the given triple of indices to the given value. - * Return the new value of the element. - * Only applies to three-dimensional arrays. - * Functionally equivalent to setting the array via a three-dimensional point. - * - * @param v the given value - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @param i2 the given index in the third dimension - * @return the new value of the element of this array corresponding to the given triple of indices. - * @see #apply(Int, Int, Int) - * @see #set(T, Point) - */ - public abstract safe global def set(v:T, i0: int, i1: int, i2: int) {rank==3}: T; - - /** - * Set the element of this array corresponding to the given quartet of indices to the given value. - * Return the new value of the element. - * Only applies to four-dimensional arrays. - * Functionally equivalent to setting the array via a four-dimensional point. - * - * @param v the given value - * @param i0 the given index in the first dimension - * @param i1 the given index in the second dimension - * @param i2 the given index in the third dimension - * @param i3 the given index in the fourth dimension - * @return the new value of the element of this array corresponding to the given quartet of indices. - * @see #apply(Int, Int, Int, Int) - * @see #set(T, Point) - */ - public abstract safe global def set(v:T, i0: int, i1: int, i2: int, i3:int) {rank==4}: T; - - - /** - * Restrict this array to the given region. - * The rank of the given region has to be the same as the rank of this array. - * Return a copy of this array whose region is the intersection of the given region and the - * region of this array. - * Also available as operator '|'. - * - * @param r the given region - * @return a view this array whose region is the intersection of the given region and the - * region of this array. - * @see #restriction(Place) - */ - public abstract safe global def restriction(r: Region(rank)): Array[T](rank); - - /** - * Restrict this array to the given place. - * Return a copy of the portion of this array that resides in the given place. - * Also available as operator '|'. - * - * @param p the given place - * @return a view of the portion of this array that resides in the given place. - * @see #restriction(Region) - */ - public abstract safe global def restriction(p: Place): Array[T](rank); - - - /** - * Restrict this array to the given region. - * The rank of the given region has to be the same as the rank of this array. - * Return a copy of this array whose region is the intersection of the given region and the - * region of this array. - * - * @param r the given region - * @return a view of this array whose region is the intersection of the given region and the - * region of this array. - * @see #restriction(Region) - */ - public abstract safe global operator this | (r: Region(rank)): Array[T](rank); - - /** - * Restrict this array to the given place. - * Return a copy of the portion of this array that resides in the given place. - * - * @param p the given place - * @return a view of the portion of this array that resides in the given place. - * @see #restriction(Place) - */ - public abstract safe global operator this | (p: Place): Array[T](rank); - - - // - // array operations - // - - /** - * Lift this array using the given unary operation. - * Apply the operation pointwise to the elements of this array. - * Return a new array with the same distribution as this array. - * Each element of the new array is the result of applying the given operation to the - * corresponding element of this array. - * - * @param op the given unary operation - * @return a new array with the same distribution as this array. - * @see #reduce((T,T)=>T,T) - * @see #scan((T,T)=>T,T) - */ - public abstract global def lift(op:(T)=>T): Array[T](dist); - - /** - * Reduce this array using the given binary operation and the given initial value. - * Starting with the initial value, apply the operation pointwise to the current running value - * and each element of this array. - * Return the final result of the reduction. - * - * @param op the given binary operation - * @param unit the given initial value - * @return the final result of the reduction. - * @see #lift((T)=>T) - * @see #scan((T,T)=>T,T) - */ - public abstract global def reduce(op:(T,T)=>T, unit:T): T; - - /** - * Scan this array using the given binary operation and the given initial value. - * Starting with the initial value, apply the operation pointwise to the current running value - * and each element of this array. - * Return a new array with the same distribution as this array. - * Each element of the new array is the result of applying the given operation to the - * current running value and the corresponding element of this array. - * - * @param op the given binary operation - * @param unit the given initial value - * @return the final result of the reduction. - * @see #lift((T)=>T) - * @see #reduce((T,T)=>T,T) - */ - public abstract global def scan(op:(T,T)=>T, unit:T): Array[T](dist); - - - // - // further generalizations TBD: - // - extra array arg to contain result - // - op takes current Point - // - // also TBD: - // public abstract global def lift[U](op:(T)=>U): Array[U](dist); - // public abstract global def lift[U,V](op:(T,U)=>V, that:Array[U](dist)): Array[V](dist); - // public abstract global def overlay(that:Array[T](rank)): Array[T](rank); - // public abstract global def update(that:Array[T](rank)): Array[T](rank); - // - - - // - // - // - - /** - * Convert the given Rail to an array. - * @deprecated Use {@link x10.lang.Array#make[T](Rail[T])} instead. - * - * @param T the element type - * @param r the given Rail - * @return a mutable array with a constant distribution mapping all points in the region 0..r.length-1 - * to 'here' and the values from the corresponding elements of r. - * @see #make[T](Rail[T]) - */ - public static operator [T](r: Rail[T]!): Array[T](1) = make(r); - - /** - * Convert the given ValRail to an array. - * @deprecated Use {@link x10.lang.Array#make[T](ValRail[T])} instead. - * - * @param T the element type - * @param r the given ValRail - * @return a mutable array with a constant distribution mapping all points in the region 0..r.length-1 - * to 'here' and the values from the corresponding elements of r. - * @see #make[T](ValRail[T]) - */ - public static operator [T](r: ValRail[T]): Array[T](1) = make(r); - - - /** - * Return an iterator over the points in the region of this array. - * - * @return an iterator over the points in the region of this array. - * @see x10.lang.Iterable[T]#iterator() - */ - public global def iterator(): Iterator[Point(rank)] = region.iterator() as Iterator[Point(rank)]; - - - // - // - // - - /** - * Construct an Array with the given distribution. - * - * @param dist the given distribution - */ - protected def this(dist: Dist) = property(dist); -} - -// vim:tabstop=4:shiftwidth=4:expandtab Copied: trunk/x10.runtime/src-x10/x10/array/Array.x10 (from rev 13623, trunk/x10.runtime/src-x10/x10/array/LocalRectArray.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Array.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/Array.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -0,0 +1,392 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +import x10.compiler.Inline; +import x10.compiler.Native; + +/** + * This class represents a k-dimensional dense array whose + * data is in a single place, which is the same place + * as the Array's home.</p> + * + * Warning: This class is part of an initial prototyping + * of the array library redesign targeted for + * completion in X10 2.1. It's API is not + * likely to be stable from one release to another + * until after X10 2.1.</p> + * + * Warning: Eventually the operations implemented by + * this class will match those promised by + * x10.lang.Array, but for now some of the API + * is stubbed out here (and may eventually + * by removed from x10.lang.Array). This + * will be resolved by X10 2.1<p> + */ +public final class Array[T]( + /** + * The region of this array. + */ + region:Region +) implements (Point(region.rank))=>T, + Iterable[Point(region.rank)] { + + // + // properties + // + + /** + * The rank of this array. + */ + public property rank: int = region.rank; + + /** + * Is this array defined over a rectangular region? + */ + public property rect: boolean = region.rect; + + /** + * Is this array's region zero-based? + */ + public property zeroBased: boolean = region.zeroBased; + + /** + * Is this array's region a "rail" (one-dimensional contiguous zero-based)? + */ + public property rail: boolean = region.rail; + + + + + private val raw:Rail[T]!; + private val layout:RectLayout!; + + @Native("java", "true") // TODO: optimize this for Java as well. + @Native("c++", "BOUNDS_CHECK_BOOL") + private native def checkBounds():boolean; + + // TODO: made public for experimentation in ANU code until proper copyTo is implemented. + public @Inline def raw():Rail[T]! = raw; + + + // TODO: This is a hack around the way regions are currently defined. + // Even when we compile with NO_CHECKS, we still have to have + // the checking code inlined. or the presence of the call in a loop + // blows register allocation significantly impacts performance. + private val baseRegion:BaseRegion{self.rank==this.rank}; + + // TODO: XTENLANG-1188 this should be a const (static) field, but working around C++ backend bug + private val bounds = (pt:Point):RuntimeException => new ArrayIndexOutOfBoundsException("point " + pt + " not contained in array"); + + + /** + * Construct an uninitialized Array over the region reg. + * + * @param reg The region over which to construct the array. + */ + public def this(reg:Region):Array[T]{self.region==reg} { + property(reg); + + layout = new RectLayout(reg.min(), reg.max()); + val n = layout.size(); + raw = Rail.make[T](n); + baseRegion = reg as BaseRegion{self.rank==this.rank}; + } + + + /** + * Construct Array over the region reg whose + * values are initialized as specified by the init function. + * + * @param reg The region over which to construct the array. + * @param init The function to use to initialize the array. + */ + public def this(reg:Region, init:(Point(reg.rank))=>T):Array[T]{self.region==reg} { + property(reg); + + layout = new RectLayout(reg.min(), reg.max()); + val n = layout.size(); + val r = Rail.make[T](n); + for (p:Point(reg.rank) in reg) { + r(layout.offset(p))= init(p); + } + raw = r; + baseRegion = reg as BaseRegion{self.rank==this.rank}; + } + + /** + * Construct Array over the region 0..rail.length-1 whose + * values are initialized to the corresponding values in the + * argument Rail. + * + */ + public def this(rail:Rail[T]!):Array[T]{self.rank==1,rect,zeroBased} { + // TODO: could make this more efficient by optimizing rail copy. + this(Region.makeRectangular(0, rail.length-1), ((i):Point(1)) => rail(i)); + } + + + /** + * Construct Array over the region 0..rail.length-1 whose + * values are initialized to the corresponding values in the + * argument ValRail. + * + * TODO: rail is declared to be a ValRail[T]! as a hack around + * a compiler bug. Without the !, the front-end complains that you + * can't refer to "T" in a static context, which is complete nonsense + * since this is a constructor. + */ + public def this(rail:ValRail[T]!):Array[T]{self.rank==1,rect,zeroBased} { + // TODO: could make this more efficient by optimizing rail copy. + this(Region.makeRectangular(0, rail.length-1), ((i):Point(1)) => rail(i)); + } + + + /** + * Construct Array over the region 0..rail.length-1 whose + * values are uninitialized + */ + public def this(size:int):Array[T]{self.rank==1,rect,zeroBased} { + this(Region.makeRectangular(0, size-1)); + } + + + /** + * Construct Array over the region reg whose + * values are initialized as specified by the init function. + * + * @param reg The region over which to construct the array. + * @param init The function to use to initialize the array. + */ + public def this(size:int, init:(Point(1))=>T):Array[T]{self.rank==1,rect,zeroBased} { + this(Region.makeRectangular(0, size-1), init); + } + + + + + + + + /** + * Return an iterator over the points in the region of this array. + * + * @return an iterator over the points in the region of this array. + * @see x10.lang.Iterable[T]#iterator() + */ + public def iterator():Iterator[Point(rank)] = region.iterator() as Iterator[Point(rank)]; + + + /** + * Return the element of this array corresponding to the given index. + * Only applies to one-dimensional arrays. + * Functionally equivalent to indexing the array via a one-dimensional point. + * + * @param i0 the given index in the first dimension + * @return the element of this array corresponding to the given index. + * @see #apply(Point) + * @see #set(T, Int) + */ + public safe @Inline def apply(i0:int){rank==1}:T { + if (checkBounds()) baseRegion.check(bounds, i0); + return raw(layout.offset(i0)); + } + + /** + * Return the element of this array corresponding to the given pair of indices. + * Only applies to two-dimensional arrays. + * Functionally equivalent to indexing the array via a two-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the element of this array corresponding to the given pair of indices. + * @see #apply(Point) + * @see #set(T, Int, Int) + */ + public safe @Inline def apply(i0:int, i1:int){rank==2}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1); + return raw(layout.offset(i0,i1)); + } + + /** + * Return the element of this array corresponding to the given triple of indices. + * Only applies to three-dimensional arrays. + * Functionally equivalent to indexing the array via a three-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the element of this array corresponding to the given triple of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int) + */ + public safe @Inline def apply(i0:int, i1:int, i2:int){rank==3}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1, i2); + return raw(layout.offset(i0, i1, i2)); + } + + /** + * Return the element of this array corresponding to the given quartet of indices. + * Only applies to four-dimensional arrays. + * Functionally equivalent to indexing the array via a four-dimensional point. + * + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the element of this array corresponding to the given quartet of indices. + * @see #apply(Point) + * @see #set(T, Int, Int, Int, Int) + */ + public safe @Inline def apply(i0:int, i1:int, i2:int, i3:int){rank==4}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1, i2, i3); + return raw(layout.offset(i0, i1, i2, i3)); + } + + /** + * Return the element of this array corresponding to the given point. + * The rank of the given point has to be the same as the rank of this array. + * + * @param pt the given point + * @return the element of this array corresponding to the given point. + * @see #apply(Int) + * @see #set(T, Point) + */ + public safe @Inline def apply(pt:Point{self.rank==this.rank}):T { + if (checkBounds()) { + throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on Array"); + // TODO: SHOULD BE: region.check(pt); + } + return raw(layout.offset(pt)); + } + + + /** + * Set the element of this array corresponding to the given index to the given value. + * Return the new value of the element. + * Only applies to one-dimensional arrays. + * Functionally equivalent to setting the array via a one-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @return the new value of the element of this array corresponding to the given index. + * @see #apply(Int) + * @see #set(T, Point) + */ + public safe @Inline def set(v:T, i0:int){rank==1}:T { + if (checkBounds()) baseRegion.check(bounds, i0); + raw(layout.offset(i0)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given pair of indices to the given value. + * Return the new value of the element. + * Only applies to two-dimensional arrays. + * Functionally equivalent to setting the array via a two-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @return the new value of the element of this array corresponding to the given pair of indices. + * @see #apply(Int, Int) + * @see #set(T, Point) + */ + public safe @Inline def set(v:T, i0:int, i1:int){rank==2}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1); + raw(layout.offset(i0,i1)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given triple of indices to the given value. + * Return the new value of the element. + * Only applies to three-dimensional arrays. + * Functionally equivalent to setting the array via a three-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @return the new value of the element of this array corresponding to the given triple of indices. + * @see #apply(Int, Int, Int) + * @see #set(T, Point) + */ + public safe @Inline def set(v:T, i0:int, i1:int, i2:int){rank==3}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1, i2); + raw(layout.offset(i0, i1, i2)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given quartet of indices to the given value. + * Return the new value of the element. + * Only applies to four-dimensional arrays. + * Functionally equivalent to setting the array via a four-dimensional point. + * + * @param v the given value + * @param i0 the given index in the first dimension + * @param i1 the given index in the second dimension + * @param i2 the given index in the third dimension + * @param i3 the given index in the fourth dimension + * @return the new value of the element of this array corresponding to the given quartet of indices. + * @see #apply(Int, Int, Int, Int) + * @see #set(T, Point) + */ + public safe @Inline def set(v:T, i0:int, i1:int, i2:int, i3:int){rank==4}:T { + if (checkBounds()) baseRegion.check(bounds, i0, i1, i2, i3); + raw(layout.offset(i0, i1, i2, i3)) = v; + return v; + } + + /** + * Set the element of this array corresponding to the given point to the given value. + * Return the new value of the element. + * The rank of the given point has to be the same as the rank of this array. + * + * @param v the given value + * @param pt the given point + * @return the new value of the element of this array corresponding to the given point. + * @see #apply(Point) + * @see #set(T, Int) + */ + public safe @Inline def set(v:T, p:Point{self.rank==this.rank}):T { + if (checkBounds()) { + throw new UnsupportedOperationException("Haven't implemented bounds checking for general Points on Array"); + // TODO: SHOULD BE: region.check(p); + } + raw(layout.offset(p)) = v; + return v; + } + + /* + * TODO: Cruft inherited from Array but not yet implemented. + * Some of this will get implemented, other parts will + * get removed from Array. + */ + + public incomplete safe def restriction(r: Region(rank)): Array[T](rank); + + public incomplete safe def restriction(p: Place): Array[T](rank); + + public incomplete safe operator this | (r: Region(rank)): Array[T](rank); + + public incomplete safe operator this | (p: Place): Array[T](rank); + + public incomplete def lift(op:(T)=>T): Array[T](region); + + public incomplete def reduce(op:(T,T)=>T, unit:T): T; + + public incomplete def scan(op:(T,T)=>T, unit:T): Array[T](region); +} + +// vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime/src-x10/x10/array/DistArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-04-02 18:53:30 UTC (rev 13623) +++ trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2010-04-02 21:37:03 UTC (rev 13624) @@ -19,9 +19,15 @@ * * @author bdlucas */ +public class DistArray[T] ( + /** + * The distribution of this array. + */ + dist:Dist +) implements (Point(dist.region.rank))=>T, + Iterable[Point(dist.region.rank)] +{ -public class DistArray[T] extends Array[T] { - // XTENLANG-49 static type BaseRegion(rank:int) = BaseRegion{self.rank==rank}; @@ -35,6 +41,87 @@ } }; + + // + // properties + // + + // region via dist + /** + ... [truncated message content] |
From: <dgr...@us...> - 2010-04-04 01:29:15
|
Revision: 13629 http://x10.svn.sourceforge.net/x10/?rev=13629&view=rev Author: dgrove-oss Date: 2010-04-04 01:29:05 +0000 (Sun, 04 Apr 2010) Log Message: ----------- Make x10.array be autoimported (same as x10.lang). Strip all import statements of x10.array Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.dist/samples/ArraySum.x10 trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/FSSimpleDist.x10 trunk/x10.dist/samples/HelloWholeWorld.x10 trunk/x10.dist/samples/Histogram.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.dist/samples/MontyPi.x10 trunk/x10.dist/samples/NQueensDist.x10 trunk/x10.dist/samples/NQueensPar.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/lang/_.x10 trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 trunk/x10.tests/examples/Benchmarks/SeqArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqArray1b.x10 trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 trunk/x10.tests/examples/Constructs/Array/Array1.x10 trunk/x10.tests/examples/Constructs/Array/Array1DCodeGen.x10 trunk/x10.tests/examples/Constructs/Array/Array1Exploded.x10 trunk/x10.tests/examples/Constructs/Array/Array1b.x10 trunk/x10.tests/examples/Constructs/Array/Array1c.x10 trunk/x10.tests/examples/Constructs/Array/Array2v.x10 trunk/x10.tests/examples/Constructs/Array/Array3.x10 trunk/x10.tests/examples/Constructs/Array/Array31.x10 trunk/x10.tests/examples/Constructs/Array/Array3Boolean.x10 trunk/x10.tests/examples/Constructs/Array/Array3Byte.x10 trunk/x10.tests/examples/Constructs/Array/Array3Char.x10 trunk/x10.tests/examples/Constructs/Array/Array3Double.x10 trunk/x10.tests/examples/Constructs/Array/Array3DoubleSwapped.x10 trunk/x10.tests/examples/Constructs/Array/Array3Float.x10 trunk/x10.tests/examples/Constructs/Array/Array3Long.x10 trunk/x10.tests/examples/Constructs/Array/Array3Short.x10 trunk/x10.tests/examples/Constructs/Array/Array4.x10 trunk/x10.tests/examples/Constructs/Array/Array5.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3a.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank4.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank5.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithPoint.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10 trunk/x10.tests/examples/Constructs/Array/ArrayArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds2D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/ArrayConstructor.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 trunk/x10.tests/examples/Constructs/Array/ArrayFuture.x10 trunk/x10.tests/examples/Constructs/Array/ArrayFutureFlatten.x10 trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1a.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1b.x10 trunk/x10.tests/examples/Constructs/Array/ArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayOverRegion.x10 trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 trunk/x10.tests/examples/Constructs/Array/ArraySubtypeCheck_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck2.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D.x10 trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D.x10 trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/BoxArrayAssign.x10 trunk/x10.tests/examples/Constructs/Array/ConstructDist2D.x10 trunk/x10.tests/examples/Constructs/Array/DimCheck.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN2.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN3.x10 trunk/x10.tests/examples/Constructs/Array/DimCheckN4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/DimCheck_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray1D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray2D.x10 trunk/x10.tests/examples/Constructs/Array/EncapsulatedArray2D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenArray4.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenAsyncExpr2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondAndAnd.x10 trunk/x10.tests/examples/Constructs/Array/FlattenCondOr.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional2.x10 trunk/x10.tests/examples/Constructs/Array/FlattenConditional3.x10 trunk/x10.tests/examples/Constructs/Array/FlattenFutureCall.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInVoid.x10 trunk/x10.tests/examples/Constructs/Array/FlattenInitFor.x10 trunk/x10.tests/examples/Constructs/Array/FlattenPlaceCast.x10 trunk/x10.tests/examples/Constructs/Array/FlattenValForce.x10 trunk/x10.tests/examples/Constructs/Array/FlattenVarInit.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/IntArrayMaxAbs.x10 trunk/x10.tests/examples/Constructs/Array/IntValueArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayNotInitialized_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Array/JavaArrayWithInitializer.x10 trunk/x10.tests/examples/Constructs/Array/MiscTest1.x10 trunk/x10.tests/examples/Constructs/Array/MultiDimensionalJavaArray.x10 trunk/x10.tests/examples/Constructs/Array/ObjectArrayInitializerShorthand.x10 trunk/x10.tests/examples/Constructs/Array/StencilFor2D.x10 trunk/x10.tests/examples/Constructs/Array/StencilForeach2D.x10 trunk/x10.tests/examples/Constructs/Array/StencilForeach2D_Dep.x10 trunk/x10.tests/examples/Constructs/Array/TestArray.x10 trunk/x10.tests/examples/Constructs/Array/TestSimpleArrayMult.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds1D.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds2D.x10 trunk/x10.tests/examples/Constructs/Array/UserArrayBounds3D.x10 trunk/x10.tests/examples/Constructs/Array/UserDefinedArray.x10 trunk/x10.tests/examples/Constructs/Async/AsyncFieldAccess.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest2.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest3.x10 trunk/x10.tests/examples/Constructs/Async/AsyncTest5.x10 trunk/x10.tests/examples/Constructs/Async/ClockAsyncTest.x10 trunk/x10.tests/examples/Constructs/At/AtFieldAccess.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEach2.x10 trunk/x10.tests/examples/Constructs/AtEach/AtEachLoopOnArray.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicContainingWhen_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicNonLocal_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Atomic/AtomicOrdered.x10 trunk/x10.tests/examples/Constructs/Atomic/ConditionalAtomicQueue.x10 trunk/x10.tests/examples/Constructs/Call/Block.x10 trunk/x10.tests/examples/Constructs/Call/Block2.x10 trunk/x10.tests/examples/Constructs/Cast/InlineConstraint.x10 trunk/x10.tests/examples/Constructs/Cast/MacroConstraint.x10 trunk/x10.tests/examples/Constructs/Clock/ClockPascal.x10 trunk/x10.tests/examples/Constructs/Clock/ClockPascal2.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest16a.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest17_MustFailTimeout.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest18.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample1.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureExample2.x10 trunk/x10.tests/examples/Constructs/DepType/CallLaterMethod.x10 trunk/x10.tests/examples/Constructs/DepType/CallMethodTest.x10 trunk/x10.tests/examples/Constructs/DepType/CallMethodTest_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeInMethodArgDependsOnArg.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeRef.x10 trunk/x10.tests/examples/Constructs/DepType/FieldDepType.x10 trunk/x10.tests/examples/Constructs/DepType/MethodArgDepTypes2.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyPropagationTest.x10 trunk/x10.tests/examples/Constructs/DepType/PropertyPropagationTest2.x10 trunk/x10.tests/examples/Constructs/DepType/RailAlias.x10 trunk/x10.tests/examples/Constructs/DepType/RailTest.x10 trunk/x10.tests/examples/Constructs/DepType/ReferenceConsistencyCheck.x10 trunk/x10.tests/examples/Constructs/DepType/StaticReturn.x10 trunk/x10.tests/examples/Constructs/DepType/ThisInConstructorReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/Transitive.x10 trunk/x10.tests/examples/Constructs/DepType/Transitivity.x10 trunk/x10.tests/examples/Constructs/Distribution/ArrayToDist.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockCyclicDistWithPlaceSet.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDist.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDist2.x10 trunk/x10.tests/examples/Constructs/Distribution/BlockDistWithPlaceSet.x10 trunk/x10.tests/examples/Constructs/Distribution/ConstDist.x10 trunk/x10.tests/examples/Constructs/Distribution/CyclicDistWithPlaceSet.x10 trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra.x10 trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra2.x10 trunk/x10.tests/examples/Constructs/Distribution/DistAlgebra3.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds1D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds2D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistBounds3D.x10 trunk/x10.tests/examples/Constructs/Distribution/DistributionTest.x10 trunk/x10.tests/examples/Constructs/Distribution/DistributionTest1.x10 trunk/x10.tests/examples/Constructs/Distribution/Restrict.x10 trunk/x10.tests/examples/Constructs/Distribution/TestDist.x10 trunk/x10.tests/examples/Constructs/Final/ImplicitFinal.x10 trunk/x10.tests/examples/Constructs/Final/ImplicitFinal2.x10 trunk/x10.tests/examples/Constructs/For/ForLoop.x10 trunk/x10.tests/examples/Constructs/For/ForLoop2.x10 trunk/x10.tests/examples/Constructs/For/ForLoopOnArray.x10 trunk/x10.tests/examples/Constructs/ForEach/Foreach1.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest3.x10 trunk/x10.tests/examples/Constructs/Future/FutureTest4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing1.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing2.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing3.x10 trunk/x10.tests/examples/Constructs/Generics/Subclassing4.x10 trunk/x10.tests/examples/Constructs/Generics/Variance1.x10 trunk/x10.tests/examples/Constructs/Generics/Variance2.x10 trunk/x10.tests/examples/Constructs/Generics/Variance2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Generics/Variance3.x10 trunk/x10.tests/examples/Constructs/Generics/Variance3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Init/InitNonNullable_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckArray.x10 trunk/x10.tests/examples/Constructs/PlaceCast/PlaceCast.x10 trunk/x10.tests/examples/Constructs/PlaceCast/PlaceCast2.x10 trunk/x10.tests/examples/Constructs/PlaceCast/PlaceCheck1.x10 trunk/x10.tests/examples/Constructs/Point/ArrayPointBinding_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Point/PointArray.x10 trunk/x10.tests/examples/Constructs/Point/PointIndex.x10 trunk/x10.tests/examples/Constructs/Point/PointIndexTuple.x10 trunk/x10.tests/examples/Constructs/Rail/RailCopy.x10 trunk/x10.tests/examples/Constructs/Region/ArrayOfRegions.x10 trunk/x10.tests/examples/Constructs/Region/RegionAlgebra.x10 trunk/x10.tests/examples/Constructs/Region/RegionBanded.x10 trunk/x10.tests/examples/Constructs/Region/RegionBoundingBox.x10 trunk/x10.tests/examples/Constructs/Region/RegionDifference.x10 trunk/x10.tests/examples/Constructs/Region/RegionEquality.x10 trunk/x10.tests/examples/Constructs/Region/RegionTest1.x10 trunk/x10.tests/examples/Constructs/Region/RegionTest2.x10 trunk/x10.tests/examples/Constructs/Region/RegionTestIterator.x10 trunk/x10.tests/examples/Constructs/Region/RegionTriangular.x10 trunk/x10.tests/examples/Constructs/Region/RegionWithHoles.x10 trunk/x10.tests/examples/Constructs/Region/RegionWithHoles2.x10 trunk/x10.tests/examples/Constructs/Region/TestRegion.x10 trunk/x10.tests/examples/Constructs/Structs/StructGenericInterfaceTest.x10 trunk/x10.tests/examples/Constructs/Structs/StructTest2.x10 trunk/x10.tests/examples/Constructs/Unsafe/Unsafe.x10 trunk/x10.tests/examples/Issues/XTENLANG_118.x10 trunk/x10.tests/examples/Issues/XTENLANG_133.x10 trunk/x10.tests/examples/Issues/XTENLANG_265.x10 trunk/x10.tests/examples/Issues/XTENLANG_345.x10 trunk/x10.tests/examples/Issues/XTENLANG_51.x10 trunk/x10.tests/examples/Issues/XTENLANG_60.x10 trunk/x10.tests/examples/Misc/BreakInForTest.x10 trunk/x10.tests/examples/Misc/ObjectEquality.x10 trunk/x10.tests/examples/Misc/Overloading.x10 trunk/x10.tests/examples/Misc/Stencil1D.x10 trunk/x10.tests/examples/Misc/TypeElaborationAcrossCompilationUnits.x10 trunk/x10.tests/examples/Misc/VariableScope.x10 trunk/x10.tests/examples/Samples/ArraySumTest.x10 trunk/x10.tests/examples/Samples/FRASimpleDistTest.x10 trunk/x10.tests/examples/Samples/FSSimpleDistTest.x10 trunk/x10.tests/examples/Samples/KMeansDistTest.x10 trunk/x10.tests/examples/Samples/NQueensDistTest.x10 trunk/x10.tests/examples/Timings/ArrayIndexing.x10 trunk/x10.tests/examples/Timings/Initialization.x10 trunk/x10.tests/examples/Timings/IntArrayIndexing.x10 Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-04 01:29:05 UTC (rev 13629) @@ -373,6 +373,7 @@ List<QName> l = new ArrayList<QName>(1); l.add(QName.make("x10.lang")); l.add(QName.make("x10.lang", X10TypeSystem.DUMMY_PACKAGE_CLASS_NAME.toString())); + l.add(QName.make("x10.array")); return l; } Modified: trunk/x10.dist/samples/ArraySum.x10 =================================================================== --- trunk/x10.dist/samples/ArraySum.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/ArraySum.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,8 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; -import x10.array.Region; import x10.io.Console; /** Modified: trunk/x10.dist/samples/FRASimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FRASimpleDist.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/FRASimpleDist.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; import x10.io.Console; import x10.util.Timer; Modified: trunk/x10.dist/samples/FSSimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FSSimpleDist.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/FSSimpleDist.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; import x10.util.Timer; import x10.io.Console; Modified: trunk/x10.dist/samples/HelloWholeWorld.x10 =================================================================== --- trunk/x10.dist/samples/HelloWholeWorld.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/HelloWholeWorld.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; import x10.io.Console; /** Modified: trunk/x10.dist/samples/Histogram.x10 =================================================================== --- trunk/x10.dist/samples/Histogram.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/Histogram.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; import x10.util.Random; import x10.io.Console; @@ -25,6 +24,7 @@ atomic b(bin)++; } } + public static def main(args:Rail[String]!) { if (args.length != 2) { Console.OUT.println("Usage: Histogram SizeOfArray Buckets"); Modified: trunk/x10.dist/samples/KMeansDist.x10 =================================================================== --- trunk/x10.dist/samples/KMeansDist.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/KMeansDist.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,8 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.DistArray; -import x10.array.Dist; import x10.io.Console; import x10.util.Random; Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,8 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; import x10.io.Console; import x10.io.File; Modified: trunk/x10.dist/samples/MontyPi.x10 =================================================================== --- trunk/x10.dist/samples/MontyPi.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/MontyPi.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,8 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; import x10.util.Random; import x10.io.Console; Modified: trunk/x10.dist/samples/NQueensDist.x10 =================================================================== --- trunk/x10.dist/samples/NQueensDist.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/NQueensDist.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.DistArray; -import x10.array.Region; -import x10.array.Dist; import x10.io.Console; /** Modified: trunk/x10.dist/samples/NQueensPar.x10 =================================================================== --- trunk/x10.dist/samples/NQueensPar.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/NQueensPar.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import x10.io.Console; -import x10.array.Region; public class NQueensPar { Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v1.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; /** * This is one of a series of programs showing how to express Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; /** * This is one of a series of programs showing how to express Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v3.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; /** * This is one of a series of programs showing how to express Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v4.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; /** * This is one of a series of programs showing how to express Modified: trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 =================================================================== --- trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.dist/samples/tutorial/HeatTransfer_v5.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,9 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; /** * This is one of a series of programs showing how to express Modified: trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -13,7 +13,6 @@ import x10.compiler.NativeClass; import x10.util.Pair; -import x10.array.Dist; /** * The primary operation on a PlaceLocalHandle is to use it to access an object Modified: trunk/x10.runtime/src-x10/x10/lang/_.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/_.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.runtime/src-x10/x10/lang/_.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -11,10 +11,6 @@ package x10.lang; -import x10.array.Array; -import x10.array.Dist; -import x10.array.DistArray; -import x10.array.Region; // Members of the class x10.lang._ are imported automatically. public class _ { Modified: trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.runtime/src-x10/x10/util/DistributedRail.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -13,7 +13,6 @@ import x10.util.Pair; import x10.util.HashMap; -import x10.array.Dist; /** * @author Dave Cunningham Modified: trunk/x10.tests/examples/Benchmarks/SeqArray1.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqArray1.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Benchmarks/SeqArray1.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.LocalRectArray; /** * @author bdlucas Modified: trunk/x10.tests/examples/Benchmarks/SeqArray1b.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqArray1b.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Benchmarks/SeqArray1b.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.LocalRectArray; /** * @author bdlucas Modified: trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.Array; /** * Basic array, c-style loop. Modified: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Benchmarks/SeqLocalArray2a.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.LocalRectArray; /** * Basic array, c-style loop. Modified: trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 =================================================================== --- trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Benchmarks/SeqLocalArray2b.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -9,7 +9,6 @@ * (C) Copyright IBM Corporation 2006-2010. */ -import x10.array.LocalRectArray; /** * Basic array, X10-style loop Modified: trunk/x10.tests/examples/Constructs/Array/Array1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array1.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array1.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/Array1DCodeGen.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array1DCodeGen.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array1DCodeGen.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; public class Array1DCodeGen extends x10Test { Modified: trunk/x10.tests/examples/Constructs/Array/Array1Exploded.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array1Exploded.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array1Exploded.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Tests point (p[i,j]) notation. Modified: trunk/x10.tests/examples/Constructs/Array/Array1b.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array1b.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array1b.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/Array1c.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array1c.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array1c.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/Array2v.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array2v.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array2v.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Testing 3D arrays. Modified: trunk/x10.tests/examples/Constructs/Array/Array3.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Tests declaration of arrays, storing in local variables, accessing and Modified: trunk/x10.tests/examples/Constructs/Array/Array31.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array31.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array31.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Simple array test #3. Tests declaration of arrays, storing in local Modified: trunk/x10.tests/examples/Constructs/Array/Array3Boolean.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Boolean.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Boolean.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures boolean arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3Byte.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Byte.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Byte.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures byte arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3Char.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Char.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Char.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures char arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3Double.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Double.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Double.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures double arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3DoubleSwapped.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3DoubleSwapped.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3DoubleSwapped.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures double arrays are implemented. Tests literal occurring in RHS of an ==, with array Modified: trunk/x10.tests/examples/Constructs/Array/Array3Float.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Float.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Float.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures float arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3Long.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Long.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Long.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures long arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array3Short.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array3Short.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array3Short.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Ensures short arrays are implemented. Modified: trunk/x10.tests/examples/Constructs/Array/Array4.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array4.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array4.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Test for X10 arrays -- tests arrays passed as parameters and stored in fields. Modified: trunk/x10.tests/examples/Constructs/Array/Array5.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/Array5.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/Array5.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Testing int[] method parameters and fields. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3a.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3a.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank3a.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank4.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank4.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank4.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank5.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank5.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessEqualRank5.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Test that a can be accessed through point p if p ranges over b.dist Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithPoint.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithPoint.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithPoint.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Constant promotions to arrays: (D n) Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAlgebra2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -14,8 +14,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Constant promotions to arrays: (D n) Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAlgebraWithDType.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /* STATUS: 1/21/2010 -- this file doesn't compile, because it uses some unimplemented Array operations. */ Modified: trunk/x10.tests/examples/Constructs/Array/ArrayArrayInitializerShorthand.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayArrayInitializerShorthand.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayArrayInitializerShorthand.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Test the shorthand syntax for array of arrays initializer. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayBounds1D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -11,8 +11,6 @@ import x10.util.Random; import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Array bounds test - 1D. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayBounds2D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayBounds2D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayBounds2D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -11,8 +11,6 @@ import x10.util.Random; import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Array bounds test - 2D. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayBounds3D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -11,8 +11,6 @@ import x10.util.Random; import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Array bounds test - 3D. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayConstructor.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayConstructor.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayConstructor.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * @author vj Modified: trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayCopy1.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; import x10.io.*; /** Modified: trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayCopy2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test for arrays, regions and dists. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayCopy3.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test for arrays, regions and dists. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayDecl.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Testing miscellaneous array declarations and initializations. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayFuture.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayFuture.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayFuture.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Testing arrays of future<T>. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayFutureFlatten.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayFutureFlatten.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayFutureFlatten.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Testing arrays of future<T>. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * Simple array test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayInitializer.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayInitializer.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayInitializer.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Array Initializer test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1a.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1a.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1a.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Array Initializer test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1b.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1b.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayInitializer1b.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Array Initializer test. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayInitializerShorthand.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayInitializerShorthand.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayInitializerShorthand.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Test the shorthand syntax for an array initializer. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayOfArraysShorthand.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Test the syntax for creating an array of arrays. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Simple test for operator assignment of array elements. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayOpAssign2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** * Simple test for operator assignment of array elements. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayOverRegion.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayOverRegion.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayOverRegion.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,9 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; -import x10.array.Region; /** * Region r occuring in a distribution context is converted to r->here Modified: trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; public class ArrayPlusEqual extends x10Test { Modified: trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * @author bdlucas Modified: trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; /** * @author bdlucas Modified: trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayStaticPlusEqual.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,7 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; public class ArrayStaticPlusEqual extends x10Test { Modified: trunk/x10.tests/examples/Constructs/Array/ArraySubtypeCheck_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArraySubtypeCheck_MustFailCompile.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArraySubtypeCheck_MustFailCompile.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Array; -import x10.array.Region; /** */ Modified: trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Array operations and points must be type checked. Modified: trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck2.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck2.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck2.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * @author vj Modified: trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck3_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck3_MustFailCompile.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck3_MustFailCompile.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Modified: trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ArrayTypeCheck4_MustFailCompile.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Array operations and points must be type checked. Modified: trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Building arrays distributed accross places using the union-of-distribution approach. Modified: trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D_Dep.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D_Dep.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/BlockDistedArray1D_Dep.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Building arrays distributed accross places using the union-of-distribution approach. Modified: trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Building arrays distributed accross places using the union-of-distribution approach. Modified: trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D_Dep.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D_Dep.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/BlockDistedArray2D_Dep.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Array; /** * Building arrays distributed accross places using the union-of-distribution approach. Modified: trunk/x10.tests/examples/Constructs/Array/BoxArrayAssign.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/BoxArrayAssign.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/BoxArrayAssign.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -12,7 +12,6 @@ import x10.util.Box; import harness.x10Test; -import x10.array.Array; /** * Modified: trunk/x10.tests/examples/Constructs/Array/ConstructDist2D.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ConstructDist2D.x10 2010-04-04 01:04:07 UTC (rev 13628) +++ trunk/x10.tests/examples/Constructs/Array/ConstructDist2D.x10 2010-04-04 01:29:05 UTC (rev 13629) @@ -10,8 +10,6 @@ */ import harness.x10Test; -import x10.array.Dist; -import x10.array.Region; /** * Tests 2D distributions constructed from regions. Modified: trunk/x10.tests/examples/Constructs/Array/DimCheck.x10 ===============================================================... [truncated message content] |
From: <dgr...@us...> - 2010-04-06 01:09:14
|
Revision: 13653 http://x10.svn.sourceforge.net/x10/?rev=13653&view=rev Author: dgrove-oss Date: 2010-04-06 01:09:07 +0000 (Tue, 06 Apr 2010) Log Message: ----------- Move Point from x10.lang to x10.array. Modified Paths: -------------- trunk/x10.compiler/data/point-create.xcd trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/array/Point.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/lang/Point.x10 Modified: trunk/x10.compiler/data/point-create.xcd =================================================================== --- trunk/x10.compiler/data/point-create.xcd 2010-04-06 00:05:27 UTC (rev 13652) +++ trunk/x10.compiler/data/point-create.xcd 2010-04-06 01:09:07 UTC (rev 13653) @@ -1,3 +1,3 @@ // SYNOPSIS: #0=modifiers #1=type #2=var #3=idxs_list -#0 #1 #2 = x10.lang.Point.make(#3); +#0 #1 #2 = x10.array.Point.make(#3); Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-06 00:05:27 UTC (rev 13652) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-06 01:09:07 UTC (rev 13653) @@ -1392,7 +1392,7 @@ public Type Point() { if (pointType_ == null) - pointType_ = load("x10.lang.Point"); + pointType_ = load("x10.array.Point"); return pointType_; } Copied: trunk/x10.runtime/src-x10/x10/array/Point.x10 (from rev 13631, trunk/x10.runtime/src-x10/x10/lang/Point.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Point.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/array/Point.x10 2010-04-06 01:09:07 UTC (rev 13653) @@ -0,0 +1,266 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.array; + +import x10.util.Ordered; + +/** + * The type <code>Point(rank)</code> represents a point in a + * rank-dimensional space. The coordiIntes of a point <code>p</code> + * may be accessed individually (with zero-based indexing) using + * <code>p(i)</code> because <code>Point</code> implements + * <code>(Int)=>int</code>. The coordiIntes may also be accessed as a + * Rail[int]. Point arithmetic is supported. + * + * @author bdlucas + * @author vj + */ +final public class Point(rank: Int) implements (Int) => Int, Ordered[Point(rank)] { + + /** + * Returns the value of the ith coordiInte. + */ + public global safe def apply(i: Int): Int = coords(i); + + /** + * Returns the coordiIntes as a <code>ValRail[Int]</code>. + */ + + public global safe def coords(): ValRail[int] = coords; + + /** + * Constructs a Point from a ValRail[int]. + */ + public static global safe def make(cs: ValRail[int]): Point(cs.length)! = new Point(cs); + + /** + * Constructs a Point from a Rail[int] + */ + public static global safe def make(cs: Rail[int]!): Point(cs.length)! { + val a = ValRail.make[int](cs.length, (i:Int)=>cs(i)); + return make(a); + } + + /** + * Returns a <code>Point p</code> of rank <code>rank</code> with <code>p(i)=init(i)</code>. + */ + public static global safe def make(rank:Int, init:(i:Int)=>int):Point(rank)! { + val a = ValRail.make[int](rank, init); + return make(a); + } + + + public static global safe def make(i0:int) = make([i0]); + public static global safe def make(i0:int, i1:int) = make([i0,i1]); + public static global safe def make(i0:int, i1:int, i2:int) = make([i0,i1,i2]); + public static global safe def make(i0:int, i1:int, i2:int, i3:int) = make([i0,i1,i2,i3]); + + + /** A <code>Rail</code> <code>r</code> of size <code>k</code> can be converted to a point <code>p</code> + of the same rank with <code>p(i)=r(i)</code>. + */ + public static global safe operator (r: Rail[int]!): Point(r.length)! = make(r); + + /** A <code>ValRail</code> <code>r</code> of size <code>k</code> can be converted to a point <code>p</code> + of the same rank with <code>p(i)=r(i)</code>. + */ + public static global safe operator (r: ValRail[int]): Point(r.length)! = make(r); + + + /** The point <code>+p</code> is the same as <code>p</code>. + */ + public global safe operator + this: Point(rank) = this; + + /** The point <code>-p</code> is the same as <code>p</code> with each index negated. + */ + public global safe operator - this: Point(rank) + = Point.make(rank, (i:Int)=>-this.coords(i)); + + /** The ith coordiInte of point <code>p+q</code> is <code>p(i)+q(i)</code>. + */ + public global safe operator this + (that: Point(rank)): Point(rank) + = Point.make(rank, (i:Int)=> this.coords(i) + that.coords(i)); + + + /** The ith coordiInte of point <code>p-q</code> is <code>p(i)-q(i)</code>. + */ + public global safe operator this - (that: Point(rank)): Point(rank) + = Point.make(rank, (i:Int)=> this.coords(i) - that.coords(i)); + + /** The ith coordiInte of point <code>p*q</code> is <code>p(i)*q(i)</code>. + */ + public global safe operator this * (that: Point(rank)): Point(rank) + = Point.make(rank, (i:Int)=> this.coords(i) * that.coords(i)); + + /** The ith coordiInte of point <code>p/q</code> is <code>p(i)/q(i)</code>. + */ + public global safe operator this / (that: Point(rank)): Point(rank) + = Point.make(rank, (i:Int)=> this.coords(i) / that.coords(i)); + + /** The ith coordiInte of point <code>p+c</code> is <code>p(i)+c</code>. + */ + public global safe operator this + (c: int): Point(rank) + = Point.make(rank, (i:Int) => this.coords(i) + c); + + /** The ith coordiInte of point <code>p-c</code> is <code>p(i)-c</code>. + */ + public global safe operator this - (c: int): Point(rank) + = Point.make(rank, (i:Int) => this.coords(i) - c); + + /** The ith coordiInte of point <code>p*c</code> is <code>p(i)*c</code>. + */ + public global safe operator this * (c: int): Point(rank) + = Point.make(rank, (i:Int) => this.coords(i) * c); + + /** The ith coordiInte of point <code>p/c</code> is <code>p(i)/c</code>. + */ + public global safe operator this / (c: int): Point(rank) + = Point.make(rank, (i:Int) => this.coords(i) / c); + + /** The ith coordiInte of point <code>c+p</code> is <code>c+p(i)</code>. + */ + public global safe operator (c: int) + this: Point(rank) + = Point.make(rank, (i:Int) => c + this.coords(i)); + + /** The ith coordiInte of point <code>c-p</code> is <code>c-p(i)</code>. + */ + public global safe operator (c: int) - this: Point(rank) + = Point.make(rank, (i:Int) => c - this.coords(i)); + + /** The ith coordiInte of point <code>c*p</code> is <code>c*p(i)</code>. + */ + public global safe operator (c: int) * this: Point(rank) + = Point.make(rank, (i:Int) => c * this.coords(i)); + + /** The ith coordiInte of point <code>c/p</code> is <code>c/p(i)</code>. + */ + public global safe operator (c: int) / this: Point(rank) + = Point.make(rank, (i:Int) => c / this.coords(i)); + + /** + * Compute the hashCode of a point by combining the + * the coordinates in a multiple/xor chain. This + * should increase the randomness and overcomes the + * fact that coordinates are biased to be small + * positive numbers. + */ + public global safe def hashCode():int { + var hc:int = coords(0); + for (var i:int = 1; i<rank; i++) { + hc = (hc * 17) ^ coords(i); + } + return hc; + } + + /** Two points of the same rank are equal if and only if their + * corresponding indices are equal. + */ + public global safe def equals(other:Any):boolean { + if (!(other instanceof Point)) return false; + val otherPoint = other as Point; + if (rank != otherPoint.rank) return false; + for (var i: int = 0; i<rank; i++) + if (!(this.coords(i)==otherPoint.coords(i))) + return false; + return true; + } + + /** Two points of the same rank are equal if and only if their + * corresponding indices are equal. + */ + public global safe operator this == (that: Point(rank)): boolean { + for (var i: int = 0; i<rank; i++) + if (!(this.coords(i)==that.coords(i))) + return false; + return true; + } + + /** For points a, b, <code> a < b</code> if <code>a</code> is lexicographically smaller than <code>b</code>. + */ + public global safe operator this < (that: Point(rank)): boolean { + for (var i: int = 0; i<rank-1; i++) { + val a = this.coords(i); + val b = that.coords(i); + if (a > b) return false; + if (a < b) return true; + } + return this.coords(rank-1) < that.coords(rank-1); + } + /** For points <code>a, b</code>, <code> a > b</code> if <code>a</code> is lexicographically bigger than + <code> b</code>. + */ + public global safe operator this > (that: Point(rank)): boolean { + for (var i: int = 0; i<rank-1; i++) { + val a = this.coords(i); + val b = that.coords(i); + if (a < b) return false; + if (a > b) return true; + } + return this.coords(rank-1) > that.coords(rank-1); + } + /** For points <code>a, b</code>, <code> a ≤ b</code> if <code>a</code> is lexicographically less than + <code> b</code> or the same as <code>b</code>. + */ + public global safe operator this <= (that: Point(rank)): boolean { + for (var i: int = 0; i<rank-1; i++) { + val a = this.coords(i); + val b = that.coords(i); + if (a > b) return false; + if (a < b) return true; + } + return this.coords(rank-1) <= that.coords(rank-1); + } + /** For points <code>a, b</code>, <code> a ≥ b</code> if <code>a</code> is lexicographically greater than + <code> b</code> or the same as <code>b</code>. + */ + public global safe operator this >= (that: Point(rank)): boolean { + for (var i: int = 0; i<rank-1; i++) { + val a = this.coords(i); + val b = that.coords(i); + if (a < b) return false; + if (a > b) return true; + } + return this.coords(rank-1) >= that.coords(rank-1); + } + + /** For points <code>a, b</code>, <code> a ≠ b</code> if <code>a</code> is for some index + <code> a</code> is distinct from <code>b</code>. + */ + public global safe operator this != (that: Point(rank)): boolean { + for (var i: int = 0; i<rank; i++) { + val a = this.coords(i); + val b = that.coords(i); + if (a !=b) return true; + } + return false; + } + + /** A point with coordiIntes <code>i1,..., ik</code> is printed as <code>(i1,.., ik)</code>. + */ + public global safe def toString() { + var s:String = "("; + if (coords.length>0) s += coords(0); + for (var i:int=1; i<coords.length; i++) + s += "," + coords(i); + s += ")"; + return s; + } + + private global val coords: ValRail[int]; + private def this(cs: ValRail[int]): Point(cs.length) { + property(cs.length); + this.coords = cs; + } + + + +} Deleted: trunk/x10.runtime/src-x10/x10/lang/Point.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Point.x10 2010-04-06 00:05:27 UTC (rev 13652) +++ trunk/x10.runtime/src-x10/x10/lang/Point.x10 2010-04-06 01:09:07 UTC (rev 13653) @@ -1,266 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.lang; - -import x10.util.Ordered; - -/** - * The type <code>Point(rank)</code> represents a point in a - * rank-dimensional space. The coordiIntes of a point <code>p</code> - * may be accessed individually (with zero-based indexing) using - * <code>p(i)</code> because <code>Point</code> implements - * <code>(Int)=>int</code>. The coordiIntes may also be accessed as a - * Rail[int]. Point arithmetic is supported. - * - * @author bdlucas - * @author vj - */ -final public class Point(rank: Int) implements (Int) => Int, Ordered[Point(rank)] { - - /** - * Returns the value of the ith coordiInte. - */ - public global safe def apply(i: Int): Int = coords(i); - - /** - * Returns the coordiIntes as a <code>ValRail[Int]</code>. - */ - - public global safe def coords(): ValRail[int] = coords; - - /** - * Constructs a Point from a ValRail[int]. - */ - public static global safe def make(cs: ValRail[int]): Point(cs.length)! = new Point(cs); - - /** - * Constructs a Point from a Rail[int] - */ - public static global safe def make(cs: Rail[int]!): Point(cs.length)! { - val a = ValRail.make[int](cs.length, (i:Int)=>cs(i)); - return make(a); - } - - /** - * Returns a <code>Point p</code> of rank <code>rank</code> with <code>p(i)=init(i)</code>. - */ - public static global safe def make(rank:Int, init:(i:Int)=>int):Point(rank)! { - val a = ValRail.make[int](rank, init); - return make(a); - } - - - public static global safe def make(i0:int) = make([i0]); - public static global safe def make(i0:int, i1:int) = make([i0,i1]); - public static global safe def make(i0:int, i1:int, i2:int) = make([i0,i1,i2]); - public static global safe def make(i0:int, i1:int, i2:int, i3:int) = make([i0,i1,i2,i3]); - - - /** A <code>Rail</code> <code>r</code> of size <code>k</code> can be converted to a point <code>p</code> - of the same rank with <code>p(i)=r(i)</code>. - */ - public static global safe operator (r: Rail[int]!): Point(r.length)! = make(r); - - /** A <code>ValRail</code> <code>r</code> of size <code>k</code> can be converted to a point <code>p</code> - of the same rank with <code>p(i)=r(i)</code>. - */ - public static global safe operator (r: ValRail[int]): Point(r.length)! = make(r); - - - /** The point <code>+p</code> is the same as <code>p</code>. - */ - public global safe operator + this: Point(rank) = this; - - /** The point <code>-p</code> is the same as <code>p</code> with each index negated. - */ - public global safe operator - this: Point(rank) - = Point.make(rank, (i:Int)=>-this.coords(i)); - - /** The ith coordiInte of point <code>p+q</code> is <code>p(i)+q(i)</code>. - */ - public global safe operator this + (that: Point(rank)): Point(rank) - = Point.make(rank, (i:Int)=> this.coords(i) + that.coords(i)); - - - /** The ith coordiInte of point <code>p-q</code> is <code>p(i)-q(i)</code>. - */ - public global safe operator this - (that: Point(rank)): Point(rank) - = Point.make(rank, (i:Int)=> this.coords(i) - that.coords(i)); - - /** The ith coordiInte of point <code>p*q</code> is <code>p(i)*q(i)</code>. - */ - public global safe operator this * (that: Point(rank)): Point(rank) - = Point.make(rank, (i:Int)=> this.coords(i) * that.coords(i)); - - /** The ith coordiInte of point <code>p/q</code> is <code>p(i)/q(i)</code>. - */ - public global safe operator this / (that: Point(rank)): Point(rank) - = Point.make(rank, (i:Int)=> this.coords(i) / that.coords(i)); - - /** The ith coordiInte of point <code>p+c</code> is <code>p(i)+c</code>. - */ - public global safe operator this + (c: int): Point(rank) - = Point.make(rank, (i:Int) => this.coords(i) + c); - - /** The ith coordiInte of point <code>p-c</code> is <code>p(i)-c</code>. - */ - public global safe operator this - (c: int): Point(rank) - = Point.make(rank, (i:Int) => this.coords(i) - c); - - /** The ith coordiInte of point <code>p*c</code> is <code>p(i)*c</code>. - */ - public global safe operator this * (c: int): Point(rank) - = Point.make(rank, (i:Int) => this.coords(i) * c); - - /** The ith coordiInte of point <code>p/c</code> is <code>p(i)/c</code>. - */ - public global safe operator this / (c: int): Point(rank) - = Point.make(rank, (i:Int) => this.coords(i) / c); - - /** The ith coordiInte of point <code>c+p</code> is <code>c+p(i)</code>. - */ - public global safe operator (c: int) + this: Point(rank) - = Point.make(rank, (i:Int) => c + this.coords(i)); - - /** The ith coordiInte of point <code>c-p</code> is <code>c-p(i)</code>. - */ - public global safe operator (c: int) - this: Point(rank) - = Point.make(rank, (i:Int) => c - this.coords(i)); - - /** The ith coordiInte of point <code>c*p</code> is <code>c*p(i)</code>. - */ - public global safe operator (c: int) * this: Point(rank) - = Point.make(rank, (i:Int) => c * this.coords(i)); - - /** The ith coordiInte of point <code>c/p</code> is <code>c/p(i)</code>. - */ - public global safe operator (c: int) / this: Point(rank) - = Point.make(rank, (i:Int) => c / this.coords(i)); - - /** - * Compute the hashCode of a point by combining the - * the coordinates in a multiple/xor chain. This - * should increase the randomness and overcomes the - * fact that coordinates are biased to be small - * positive numbers. - */ - public global safe def hashCode():int { - var hc:int = coords(0); - for (var i:int = 1; i<rank; i++) { - hc = (hc * 17) ^ coords(i); - } - return hc; - } - - /** Two points of the same rank are equal if and only if their - * corresponding indices are equal. - */ - public global safe def equals(other:Any):boolean { - if (!(other instanceof Point)) return false; - val otherPoint = other as Point; - if (rank != otherPoint.rank) return false; - for (var i: int = 0; i<rank; i++) - if (!(this.coords(i)==otherPoint.coords(i))) - return false; - return true; - } - - /** Two points of the same rank are equal if and only if their - * corresponding indices are equal. - */ - public global safe operator this == (that: Point(rank)): boolean { - for (var i: int = 0; i<rank; i++) - if (!(this.coords(i)==that.coords(i))) - return false; - return true; - } - - /** For points a, b, <code> a < b</code> if <code>a</code> is lexicographically smaller than <code>b</code>. - */ - public global safe operator this < (that: Point(rank)): boolean { - for (var i: int = 0; i<rank-1; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a > b) return false; - if (a < b) return true; - } - return this.coords(rank-1) < that.coords(rank-1); - } - /** For points <code>a, b</code>, <code> a > b</code> if <code>a</code> is lexicographically bigger than - <code> b</code>. - */ - public global safe operator this > (that: Point(rank)): boolean { - for (var i: int = 0; i<rank-1; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a < b) return false; - if (a > b) return true; - } - return this.coords(rank-1) > that.coords(rank-1); - } - /** For points <code>a, b</code>, <code> a ≤ b</code> if <code>a</code> is lexicographically less than - <code> b</code> or the same as <code>b</code>. - */ - public global safe operator this <= (that: Point(rank)): boolean { - for (var i: int = 0; i<rank-1; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a > b) return false; - if (a < b) return true; - } - return this.coords(rank-1) <= that.coords(rank-1); - } - /** For points <code>a, b</code>, <code> a ≥ b</code> if <code>a</code> is lexicographically greater than - <code> b</code> or the same as <code>b</code>. - */ - public global safe operator this >= (that: Point(rank)): boolean { - for (var i: int = 0; i<rank-1; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a < b) return false; - if (a > b) return true; - } - return this.coords(rank-1) >= that.coords(rank-1); - } - - /** For points <code>a, b</code>, <code> a ≠ b</code> if <code>a</code> is for some index - <code> a</code> is distinct from <code>b</code>. - */ - public global safe operator this != (that: Point(rank)): boolean { - for (var i: int = 0; i<rank; i++) { - val a = this.coords(i); - val b = that.coords(i); - if (a !=b) return true; - } - return false; - } - - /** A point with coordiIntes <code>i1,..., ik</code> is printed as <code>(i1,.., ik)</code>. - */ - public global safe def toString() { - var s:String = "("; - if (coords.length>0) s += coords(0); - for (var i:int=1; i<coords.length; i++) - s += "," + coords(i); - s += ")"; - return s; - } - - private global val coords: ValRail[int]; - private def this(cs: ValRail[int]): Point(cs.length) { - property(cs.length); - this.coords = cs; - } - - - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2010-04-06 01:24:18
|
Revision: 13654 http://x10.svn.sourceforge.net/x10/?rev=13654&view=rev Author: sparksparkspark Date: 2010-04-06 01:24:12 +0000 (Tue, 06 Apr 2010) Log Message: ----------- Fix a bug when a native file needed to be copied but the destination directory did not exist yet Fix a bug where native files were not included in the build when the class was @NativeRepped Introduce OutputFile for files that are not compilation units or included in the current compilation unit, but are still needed by hte post compiler Remove IncludeOpt / LibOpt Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-06 01:09:07 UTC (rev 13653) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-06 01:24:12 UTC (rev 13654) @@ -640,30 +640,12 @@ return classHeader+StreamWrapper.Struct; } - private static void maybeCopyTo (String file, String src_path_, String dest_path_) { - { - File src_path = new File(src_path_); - File dest_path = new File(dest_path_); - // don't copy if the two dirs are the same... - if (src_path.equals(dest_path)) return; - } - try { - FileInputStream src = new FileInputStream(new File(src_path_+file)); - FileOutputStream dest = new FileOutputStream(new File(dest_path_+file)); - int b; - while ((b = src.read()) != -1) { - dest.write(b); - } - } catch (IOException e) { - assert false : "Could not read: \""+file+"\" from \""+src_path_+"\""; - } - } - void processClass(X10ClassDecl_c n) { X10CPPContext_c context = (X10CPPContext_c) tr.context(); X10ClassDef def = (X10ClassDef) n.classDef(); X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); boolean isStruct = xts.isStructType(def.asType()); + X10Ext ext = (X10Ext) n.ext(); if (getCppRep(def) != null) { // emit no c++ code as this is a native rep class @@ -708,30 +690,14 @@ h.write("#include <x10rt.h>"); h.newline(); h.forceNewline(0); // process annotations relating to additional h/c++ files - X10Ext ext = (X10Ext) n.ext(); try { X10CPPCompilerOptions opts = (X10CPPCompilerOptions) tr.job().extensionInfo().getOptions(); - String path = new File(n.position().file()).getParent(); - if (path==null) path = ""; else path = path + File.separator; - String out_path = opts.output_directory.toString(); - if (out_path==null) out_path = ""; else out_path = out_path + File.separator; - String pkg = X10CPPTranslator.packagePath(context.package_()==null?null:context.package_().toString()); List<X10ClassType> as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPInclude"))); for (Type at : as) { ASTQuery.assertNumberOfInitializers(at, 1); String include = getStringPropertyInit(at, 0); h.write("#include \""+include+"\""); h.newline(); - tr.job().compiler().outputFiles().add(pkg+include); - maybeCopyTo(include, path, out_path+pkg); } - as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPCompilationUnit"))); - for (Type at : as) { - ASTQuery.assertNumberOfInitializers(at, 1); - String compilation_unit = getStringPropertyInit(at, 0); - tr.job().compiler().outputFiles().add(pkg+compilation_unit); - opts.compilationUnits().add(pkg+compilation_unit); - maybeCopyTo(compilation_unit, path, out_path+pkg); - } } catch (SemanticException e) { assert false : e; } Modified: trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-04-06 01:09:07 UTC (rev 13653) +++ trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-04-06 01:24:12 UTC (rev 13654) @@ -13,6 +13,8 @@ import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; @@ -56,6 +58,8 @@ import polyglot.types.Name; import polyglot.types.Package; import polyglot.types.QName; +import polyglot.types.SemanticException; +import polyglot.types.Type; import polyglot.types.TypeSystem; import polyglot.util.CodeWriter; import polyglot.util.ErrorInfo; @@ -66,7 +70,10 @@ import polyglot.visit.Translator; import x10.ast.ForLoop; import x10.ast.X10ClassDecl; +import x10.extension.X10Ext; import x10.types.X10ClassDef; +import x10.types.X10ClassType; +import x10.types.X10TypeSystem_c; import x10.util.ClassifiedStream; import x10.util.StreamWrapper; import x10.util.WriterStreams; @@ -79,6 +86,7 @@ import x10cpp.postcompiler.SunOS_CXXCommandBuilder; import x10cpp.types.X10CPPContext_c; import static x10cpp.visit.ASTQuery.getCppRep; +import static x10cpp.visit.ASTQuery.getStringPropertyInit; import static x10cpp.visit.SharedVarsMethods.*; public class X10CPPTranslator extends Translator { @@ -199,6 +207,27 @@ context = c; } + private static void maybeCopyTo (String file, String src_path_, String dest_path_) { + File src_path = new File(src_path_); + File dest_path = new File(dest_path_); + // don't copy if the two dirs are the same... + if (src_path.equals(dest_path)) return; + assert src_path.isDirectory() : src_path_; + assert dest_path.isDirectory() : dest_path_; + if (!dest_path.exists()) dest_path.mkdir(); + try { + FileInputStream src = new FileInputStream(new File(src_path_+file)); + FileOutputStream dest = new FileOutputStream(new File(dest_path_+file)); + int b; + while ((b = src.read()) != -1) { + dest.write(b); + } + } catch (IOException e) { + System.err.println("While copying "+file + " from "+src_path_+" to "+dest_path_); + System.err.println(e); + } + } + /* (non-Javadoc) * @see polyglot.visit.Translator#translateSource(polyglot.ast.SourceFile) */ @@ -217,6 +246,7 @@ X10CPPContext_c c = (X10CPPContext_c) context; X10CPPCompilerOptions opts = (X10CPPCompilerOptions) job.extensionInfo().getOptions(); + X10TypeSystem_c xts = (X10TypeSystem_c) typeSystem(); if (x10.Configuration.DEBUG) c.addData(FILE_TO_LINE_NUMBER_MAP, new HashMap<String, LineNumberMap>()); @@ -228,7 +258,40 @@ continue; X10ClassDecl cd = (X10ClassDecl) decl; // Skip output of all files for a native rep class. - if (getCppRep((X10ClassDef)cd.classDef()) != null) { + X10Ext ext = (X10Ext) cd.ext(); + try { + String path = new File(cd.position().file()).getParent(); + if (path==null) path = ""; else path = path + '/'; + String out_path = opts.output_directory.toString(); + if (out_path==null) out_path = ""; else out_path = out_path + '/'; + String pkg_ = packagePath(pkg); + List<X10ClassType> as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPInclude"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String include = getStringPropertyInit(at, 0); + outputFiles.add(pkg_+include); + maybeCopyTo(include, path, out_path+pkg_); + } + as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPOutputFile"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String file = getStringPropertyInit(at, 0); + outputFiles.add(pkg_+file); + maybeCopyTo(file, path, out_path+pkg_); + } + as = ext.annotationMatching((Type) xts.systemResolver().find(QName.make("x10.compiler.NativeCPPCompilationUnit"))); + for (Type at : as) { + ASTQuery.assertNumberOfInitializers(at, 1); + String compilation_unit = getStringPropertyInit(at, 0); + outputFiles.add(pkg_+compilation_unit); + opts.compilationUnits().add(pkg_+compilation_unit); + maybeCopyTo(compilation_unit, path, out_path+pkg_); + } + } catch (SemanticException e) { + assert false : e; + } + + if (getCppRep((X10ClassDef)cd.classDef()) != null) { continue; } String className = cd.classDef().name().toString(); Deleted: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 2010-04-06 01:09:07 UTC (rev 13653) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPIncludeOpt.x10 2010-04-06 01:24:12 UTC (rev 13654) @@ -1,19 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.compiler; - -import x10.lang.annotations.ClassAnnotation; - -/** Annotation on a class that adds an extra commandline option to the post - * compiler invocation. Does nothing for the Java backend. - */ -public interface NativeCPPIncludeOpt(include: String) extends ClassAnnotation { } Deleted: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 2010-04-06 01:09:07 UTC (rev 13653) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPLibOpt.x10 2010-04-06 01:24:12 UTC (rev 13654) @@ -1,19 +0,0 @@ -/* - * This file is part of the X10 project (http://x10-lang.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * (C) Copyright IBM Corporation 2006-2010. - */ - -package x10.compiler; - -import x10.lang.annotations.ClassAnnotation; - -/** Annotation on a class that adds an extra commandline option to the post - * compiler invocation. Does nothing for the Java backend. - */ -public interface NativeCPPLibOpt(include: String) extends ClassAnnotation { } Added: trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/NativeCPPOutputFile.x10 2010-04-06 01:24:12 UTC (rev 13654) @@ -0,0 +1,20 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.ClassAnnotation; + +/** Annotation on a class that indicates that the post compiler will need an additional file from + * the same dir as the current x10 file. This is used e.g. for headers included by headers that are + * included using NativeCPPInclude. Does nothing for the Java backend. + */ +public interface NativeCPPOutputFile(file: String) extends ClassAnnotation { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bti...@us...> - 2010-04-07 19:31:33
|
Revision: 13703 http://x10.svn.sourceforge.net/x10/?rev=13703&view=rev Author: btibbitts Date: 2010-04-07 19:31:27 +0000 (Wed, 07 Apr 2010) Log Message: ----------- bump versions to 2.0.3 Modified Paths: -------------- trunk/x10.common/META-INF/MANIFEST.MF trunk/x10.constraints/META-INF/MANIFEST.MF trunk/x10.runtime/META-INF/MANIFEST.MF Modified: trunk/x10.common/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.common/META-INF/MANIFEST.MF 2010-04-07 19:06:52 UTC (rev 13702) +++ trunk/x10.common/META-INF/MANIFEST.MF 2010-04-07 19:31:27 UTC (rev 13703) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 Common components Bundle-SymbolicName: x10.common -Bundle-Version: 2.0.2.qualifier +Bundle-Version: 2.0.3.qualifier Export-Package: x10.config Modified: trunk/x10.constraints/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.constraints/META-INF/MANIFEST.MF 2010-04-07 19:06:52 UTC (rev 13702) +++ trunk/x10.constraints/META-INF/MANIFEST.MF 2010-04-07 19:31:27 UTC (rev 13703) @@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 Constraints Bundle-SymbolicName: x10.constraints -Bundle-Version: 2.0.2.qualifier +Bundle-Version: 2.0.3.qualifier Export-Package: x10.constraint Modified: trunk/x10.runtime/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime/META-INF/MANIFEST.MF 2010-04-07 19:06:52 UTC (rev 13702) +++ trunk/x10.runtime/META-INF/MANIFEST.MF 2010-04-07 19:31:27 UTC (rev 13703) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: X10 runtime Bundle-SymbolicName: x10.runtime -Bundle-Version: 2.0.2.qualifier +Bundle-Version: 2.0.3.qualifier Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... Require-Bundle: x10.common, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2010-04-08 17:37:50
|
Revision: 13745 http://x10.svn.sourceforge.net/x10/?rev=13745&view=rev Author: dgrove-oss Date: 2010-04-08 17:37:41 +0000 (Thu, 08 Apr 2010) Log Message: ----------- Restore support for the x10.lang.Runtime.Mortal interface. Instances of classes that implement Mortal will not be logged by the reference logger (made immortal) when they are serialized to be sent to other places. Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10/lang/Object.cc trunk/x10.runtime/src-cpp/x10/lang/Object.h Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-08 17:32:52 UTC (rev 13744) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2010-04-08 17:37:41 UTC (rev 13745) @@ -197,8 +197,14 @@ * @return */ Type Rail(); + /** + * Return the ClassType object for the x10.lang.Runtime.Mortal interface. + */ + Type Mortal(); + + /** * Return the ClassType object for the struct x10.lang.Primitive * * @return Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-08 17:32:52 UTC (rev 13744) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2010-04-08 17:37:41 UTC (rev 13745) @@ -1435,8 +1435,16 @@ distArrayType_ = load("x10.array.DistArray"); return distArrayType_; } + + protected ClassType mortalType_ = null; + + public Type Mortal() { + if (mortalType_ == null) + mortalType_ = load("x10.lang.Runtime.Mortal"); + return mortalType_; + } + - // RMF 11/1/2005 - Not having the "static" qualifier on interfaces causes // problems, // e.g. for New_c.disambiguate(AmbiguityRemover), which assumes that Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-08 17:32:52 UTC (rev 13744) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-08 17:37:41 UTC (rev 13745) @@ -1244,6 +1244,11 @@ List<ClassMember> members = n.members(); generateITablesForClass(currentClass, xts, "virtual ", h); + + if (currentClass.isSubtype(xts.Mortal(), context)) { + h.write("virtual x10_boolean _isMortal() { return true; }"); + h.newline(); h.forceNewline(); + } if (!members.isEmpty()) { String className = Emitter.translateType(currentClass); Modified: trunk/x10.runtime/src-cpp/x10/lang/Object.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Object.cc 2010-04-08 17:32:52 UTC (rev 13744) +++ trunk/x10.runtime/src-cpp/x10/lang/Object.cc 2010-04-08 17:37:41 UTC (rev 13745) @@ -87,7 +87,7 @@ " object of type "<<this_->_type()->name()); buf.write((x10_addr_t)(size_t)this_.operator->()); #if defined(X10_USE_BDWGC) || defined(X10_DEBUG_REFERENCE_LOGGER) - if (/*immortalize*/true) { // TODO: FIXME to respect the Mortal interface + if (!this_->_isMortal()) { ReferenceLogger::log(this_.operator->()); } #endif Modified: trunk/x10.runtime/src-cpp/x10/lang/Object.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Object.h 2010-04-08 17:32:52 UTC (rev 13744) +++ trunk/x10.runtime/src-cpp/x10/lang/Object.h 2010-04-08 17:37:41 UTC (rev 13745) @@ -96,6 +96,10 @@ template<class T> friend class x10aux::ref; + // Will be overriden by classes that implement x10.lang.Runtime.Mortal to return true. + // Used in _serialize_reference to disable reference logging for specific classes. + virtual x10_boolean _isMortal() { return false; } + virtual x10_int hashCode(); virtual x10aux::ref<String> toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-04-08 23:32:18
|
Revision: 13762 http://x10.svn.sourceforge.net/x10/?rev=13762&view=rev Author: vj0 Date: 2010-04-08 23:32:11 +0000 (Thu, 08 Apr 2010) Log Message: ----------- Ensure that casts are generated for weak closure calls. Added -VERBOSE_CALLS compiler option. This prints out a warning for each weak call, together with the type the expression was cast to. Added -STRONG_CALLS compiler option. This causes the compiler to give an error when it encounters a weak call, instead of generating a cast. The default (no -VERBOSE_CALLS, no -STRONG_CALLS) is to print out a count of weak calls. Modified Paths: -------------- trunk/x10.compiler/src/x10/Configuration.java trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/types/checker/Converter.java trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 Modified: trunk/x10.compiler/src/x10/Configuration.java =================================================================== --- trunk/x10.compiler/src/x10/Configuration.java 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.compiler/src/x10/Configuration.java 2010-04-08 23:32:11 UTC (rev 13762) @@ -79,6 +79,12 @@ public static boolean WORK_STEALING = false; private static final String WORK_STEALING_desc = "Code generation for work-stealing scheduling"; + + public static boolean VERBOSE_CALLS = false; + private static final String VERBOSE_CALLS_desc = "Print details of casts introduced for weak calls."; + + public static boolean STRONG_CALLS = false; + private static final String STRONG_CALLS_desc = "Treat weak calls as errors."; /** * Parses one argument from the command line. This allows the user Modified: trunk/x10.compiler/src/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-04-08 23:32:11 UTC (rev 13762) @@ -56,10 +56,12 @@ import polyglot.types.SemanticException; import polyglot.types.TopLevelResolver; import polyglot.types.TypeSystem; +import polyglot.util.ErrorInfo; import polyglot.util.ErrorQueue; import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; +import polyglot.visit.PostCompiled; import polyglot.visit.PruningVisitor; import polyglot.visit.TypeChecker; import x10.ast.X10NodeFactory_c; @@ -223,6 +225,14 @@ return errors; } + private static int weakCallsCount = 0; + public void incrWeakCallsCount() { + weakCallsCount++; + } + public int weakCallsCount() { + return weakCallsCount; + } + protected void initTypeSystem() { try { TopLevelResolver r = new X10SourceClassResolver(compiler, this, getOptions().constructFullClasspath(), @@ -356,11 +366,53 @@ // the barrier will handle prereqs on its own CodeGenerated(job).addPrereq(CodeGenBarrier()); - + return goals; } - public Goal CodeGenBarrier() { + Goal PrintWeakCallsCount; + @Override + protected Goal PostCompiled() { + if (PrintWeakCallsCount == null) { + PrintWeakCallsCount = new PrintWeakCallsCount((ExtensionInfo) extInfo); + Goal oldPost = super.PostCompiled(); + PrintWeakCallsCount.addPrereq(oldPost); + } + return PrintWeakCallsCount; + } + + static class PrintWeakCallsCount extends AllBarrierGoal { + ExtensionInfo ext; + public PrintWeakCallsCount(ExtensionInfo extInfo) { + super("PrintWeakCallsCount",extInfo.scheduler()); + this.ext = extInfo; + } + public Goal prereqForJob(Job job) { + if (scheduler.shouldCompile(job)) { + return scheduler.End(job); + } + else { + return new SourceGoal_c("WCCDummyEnd", job) { + public boolean runTask() { return true; } + }.intern(scheduler); + } + } + public boolean runTask() { + Compiler compiler = ext.compiler(); + + if (! Configuration.VERBOSE_CALLS) { + int count = ext.weakCallsCount; + if (count > 0) { + compiler.errorQueue().enqueue(ErrorInfo.WARNING, count + " weak calls."); + } + } + return true; + + } + + } + + public Goal CodeGenBarrier() { if (Globals.Options().compile_command_line_only) { return new BarrierGoal("CodeGenBarrier", commandLineJobs()) { @Override @@ -383,6 +435,7 @@ }; } } + public Goal Serialized(Job job) { Compiler compiler = job.extensionInfo().compiler(); Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-04-08 23:32:11 UTC (rev 13762) @@ -110,7 +110,9 @@ n.arguments = new ArrayList<Expr>(args); return n; } - + public Call_c reconstruct(Receiver target, Id name, List<Expr> arguments) { + return super.reconstruct(target, name, arguments); + } @Override public Node visitChildren(NodeVisitor v) { @@ -502,20 +504,7 @@ } if (n instanceof X10Call_c) { - try { - PlaceChecker.checkLocalReceiver((Call) n, tc); - } catch (PlaceTypeErrorMethodShouldBeLocalOrGlobal z) { - // ok, compensate by generating a dynamic cast. - X10Call_c result = (X10Call_c) n; - Receiver r = result.target(); - if (r instanceof Expr) { - Expr target = (Expr) r; - Type type = PlaceChecker.AddIsHereClause(target.type(), tc.context()); - target = Converter.attemptCoercion(tc, target, type); - n = result.reconstruct(target, result.name(), result.arguments()); - } - - } + n = PlaceChecker.makeReceiverLocalIfNecessary((X10Call) n, tc); } @@ -614,7 +603,7 @@ ///////////////////////////////////////////////////////////////////// result.checkProtoMethod(); - PlaceChecker.checkLocalReceiver(result, tc); + result = (X10Call_c) PlaceChecker.makeReceiverLocalIfNecessary(result, tc); // the arguments here. result.checkConsistency(c); // result = result.adjustMI(tc); Modified: trunk/x10.compiler/src/x10/types/checker/Converter.java =================================================================== --- trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.compiler/src/x10/types/checker/Converter.java 2010-04-08 23:32:11 UTC (rev 13762) @@ -26,6 +26,7 @@ import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.TypeNode; +import polyglot.frontend.Globals; import polyglot.main.Report; import polyglot.types.ClassDef; import polyglot.types.Context; @@ -43,6 +44,8 @@ import polyglot.util.Pair; import polyglot.util.Position; import polyglot.visit.ContextVisitor; +import x10.Configuration; +import x10.ExtensionInfo; import x10.ast.SemanticError; import x10.ast.X10CanonicalTypeNode; import x10.ast.X10CanonicalTypeNode_c; @@ -117,7 +120,11 @@ // alright, now we actually synthesized a new depexpr. // lets splice it in. result = check(nf.X10Cast(e.position(), tn, e, ct),tc); - System.out.println("[" + e.position() + "] Synthesized " + tn + " for " + e + "."); + if (Configuration.VERBOSE_CALLS) + System.out.println("[" + e.position() + "] Synthesized " + tn + " for " + e + "."); + else { + ((ExtensionInfo) Globals.Extension()).incrWeakCallsCount(); + } } } return result; @@ -511,18 +518,19 @@ } // Added 03/28/10 to support new call conversion semantics. - if (cast.conversionType() == ConversionType.CALL_CONVERSION - && ts.isCastValid(fromType, toType, context)) { + if (! Configuration.STRONG_CALLS) + if (cast.conversionType() == ConversionType.CALL_CONVERSION + && ts.isCastValid(fromType, toType, context)) { X10Cast n = cast.conversionType(ConversionType.CHECKED); XVar sv = X10TypeMixin.selfVarBinding(fromType); if (sv != null) - try { - toType = X10TypeMixin.addSelfBinding((Type) toType.copy(), sv); - } catch (XFailure f) { - throw new SemanticError("Inconsistent type: " + toType + " {self==" + sv+"}", cast.position()); - } - return n.type(toType); - } + try { + toType = X10TypeMixin.addSelfBinding((Type) toType.copy(), sv); + } catch (XFailure f) { + throw new SemanticError("Inconsistent type: " + toType + " {self==" + sv+"}", cast.position()); + } + return n.type(toType); + } throw new Errors.CannotConvertExprToType(cast.expr(), cast.conversionType(), toType, cast.position()); } Modified: trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java =================================================================== --- trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java 2010-04-08 23:32:11 UTC (rev 13762) @@ -20,6 +20,9 @@ import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.visit.ContextVisitor; +import x10.Configuration; +import x10.ast.X10Call; +import x10.ast.X10Call_c; import x10.ast.X10CanonicalTypeNode_c; import x10.constraint.XEQV_c; import x10.constraint.XFailure; @@ -31,6 +34,7 @@ import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.errors.Errors; +import x10.errors.Errors.PlaceTypeErrorMethodShouldBeLocalOrGlobal; import x10.types.ClosureType_c; import x10.types.X10ClassDef; import x10.types.X10Context; @@ -479,6 +483,25 @@ } */ + public static Call makeReceiverLocalIfNecessary(X10Call n, ContextVisitor tc) throws SemanticException { + try { + checkLocalReceiver(n, tc); + } catch (PlaceTypeErrorMethodShouldBeLocalOrGlobal z) { + // ok, compensate by generating a dynamic cast. + if (Configuration.STRONG_CALLS) + throw z; + X10Call_c result = (X10Call_c) n; + Receiver r = result.target(); + if (r instanceof Expr) { + Expr target = (Expr) r; + Type type = PlaceChecker.AddIsHereClause(target.type(), tc.context()); + target = Converter.attemptCoercion(tc, target, type); + n = (X10Call) result.reconstruct(target, result.name(), result.arguments()); + } + + } + return n; + } /** * Check that this method call is place safe (throwing an error if it isnt, i.e. * if the call is to a method that is not global, and the receiver Modified: trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 2010-04-08 21:52:49 UTC (rev 13761) +++ trunk/x10.runtime/src-x10/x10/array/FullRegion.x10 2010-04-08 23:32:11 UTC (rev 13762) @@ -19,7 +19,7 @@ * @author bdlucas */ -class FullRegion extends PolyRegion { +class FullRegion {rect} extends PolyRegion { def this(val rank: int): FullRegion{self.rank==rank} { super((new PolyMatBuilder(rank)).toSortedPolyMat(false), true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-04-11 00:31:43
|
Revision: 13813 http://x10.svn.sourceforge.net/x10/?rev=13813&view=rev Author: ipeshansky Date: 2010-04-11 00:31:34 +0000 (Sun, 11 Apr 2010) Log Message: ----------- Fix XTENLANG-569. Re-enable checks for generic type parameters. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10aux/ref.h Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-10 22:48:30 UTC (rev 13812) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2010-04-11 00:31:34 UTC (rev 13813) @@ -3064,7 +3064,7 @@ if (mi.container().isClass() && mi.container().toClass().flags().isInterface()) { // FIXME: need some template magic to define a placeCheck/nullCheck that is a no-op on structs, // but does something on ref. Defer to 2.0.1. - invokeInterface(n, (Expr) target, args, Emitter.translateType(t), mi.container(), mi, false, false); + invokeInterface(n, (Expr) target, args, Emitter.translateType(t), mi.container(), mi, true, true); sw.end(); return; } Modified: trunk/x10.runtime/src-cpp/x10aux/ref.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/ref.h 2010-04-10 22:48:30 UTC (rev 13812) +++ trunk/x10.runtime/src-cpp/x10aux/ref.h 2010-04-11 00:31:34 UTC (rev 13813) @@ -187,6 +187,11 @@ return obj; } + // A no-op for non-refs + template <class T> inline T nullCheck(T str) { + return str; + } + template <class T> inline ref<T> placeCheck(ref<T> obj) { #if !defined(NO_PLACE_CHECKS) && !defined(NO_EXCEPTIONS) //if (remote_ref::is_remote(obj.operator->())) throwBPE(); @@ -195,6 +200,11 @@ return obj; } + // A no-op for non-refs + template <class T> inline T placeCheck(T str) { + return str; + } + // will be initialised to NULL static ref<x10::lang::NullType> null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ta...@us...> - 2010-04-14 01:38:14
|
Revision: 13852 http://x10.svn.sourceforge.net/x10/?rev=13852&view=rev Author: tardieu Date: 2010-04-14 01:38:07 +0000 (Wed, 14 Apr 2010) Log Message: ----------- implemented @Uncounted async Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.runtime/src-x10/x10/lang/Activity.x10 trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 Modified: trunk/x10.compiler/src/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-04-13 16:09:44 UTC (rev 13851) +++ trunk/x10.compiler/src/x10/visit/Desugarer.java 2010-04-14 01:38:07 UTC (rev 13852) @@ -128,6 +128,7 @@ 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"); + private static final Name RUN_UNCOUNTED_ASYNC = Name.make("runUncountedAsync"); private static final Name HERE = Name.make("here"); private static final Name NEXT = Name.make("next"); private static final Name LOCK = Name.make("lock"); @@ -260,6 +261,11 @@ // Begin asyncs private Stmt visitAsync(Node old, Async a) throws SemanticException { Position pos = a.position(); + if (hasAnnotation(a, UNCOUNTED)) { + if (old instanceof Async && ((Async) old).place() instanceof Here) + return uncountedAsync(pos, a.body()); + return uncountedAsync(pos, a.body(), a.place()); + } if (old instanceof Async && ((Async) old).place() instanceof Here) return async(pos, a.body(), a.clocks()); Stmt specializedAsync = specializeAsync(old, a); @@ -293,6 +299,7 @@ private static final Name XOR = Name.make("xor"); private static final Name FENCE = Name.make("fence"); private static final QName IMMEDIATE = QName.make("x10.compiler.Immediate"); + private static final QName UNCOUNTED = QName.make("x10.compiler.Uncounted"); private static final QName REMOTE_OPERATION = QName.make("x10.compiler.RemoteOperation"); /** @@ -310,7 +317,7 @@ * TODO: move into a separate pass! */ private Stmt specializeAsync(Node old, Async a) throws SemanticException { - if (!hasAnnotation(a, QName.make("x10.compiler.Immediate"))) + if (!hasAnnotation(a, IMMEDIATE)) return null; if (a.clocks().size() != 0) return null; @@ -405,6 +412,30 @@ xts.Void(), types, xContext())); return result; } + + private Stmt uncountedAsync(Position pos, Stmt body, Expr place) throws SemanticException { + List<Expr> l = new ArrayList<Expr>(1); + l.add(place); + List<Type> t = new ArrayList<Type>(1); + t.add(xts.Place()); + return makeUncountedAsyncBody(pos, l, t, body); + } + + private Stmt uncountedAsync(Position pos, Stmt body) throws SemanticException { + return makeUncountedAsyncBody(pos, new LinkedList<Expr>(), + new LinkedList<Type>(), body); + } + + private Stmt makeUncountedAsyncBody(Position pos, List<Expr> exprs, List<Type> types, Stmt body) throws SemanticException { + Closure closure = synth.makeClosure(body.position(), xts.Void(), + synth.toBlock(body), xContext()); + exprs.add(closure); + types.add(closure.closureDef().asType()); + Stmt result = xnf.Eval(pos, + synth.makeStaticCall(pos, xts.Runtime(), RUN_UNCOUNTED_ASYNC, exprs, + xts.Void(), types, xContext())); + return result; + } // end Async @@ -481,7 +512,7 @@ * TODO: move into a separate pass! */ private Stmt specializeFinish(Finish f) throws SemanticException { - if (!hasAnnotation(f, QName.make("x10.compiler.Immediate"))) + if (!hasAnnotation(f, IMMEDIATE)) return null; Position pos = f.position(); ClassType target = (ClassType) xts.typeForName(REMOTE_OPERATION); Added: trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/compiler/Uncounted.x10 2010-04-14 01:38:07 UTC (rev 13852) @@ -0,0 +1,55 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +package x10.compiler; + +import x10.lang.annotations.StatementAnnotation; + +/** + * @Uncounted may be used to annotate a non-clocked async. + * The body of an @Uncounted async may only contain @Uncounted asyncs. + * The body of an @Uncounted async may contain a finish, which in turn can contain both regular and @Uncounted asyncs. + * @Uncounted asyncs are not accounted for by the enclosing finish. + * That is, the enclosing finish may complete before the async completes. + * + * CURRENT LIMITATIONS: + * The compiler does not enforce any of the above restrictions. + * If the main method return before all of the uncounted asyncs have completed + * then the application may exit without waiting for the uncounted asyncs to complete. + * Exceptions in uncounted asyncs are discarded (but the runtime prints debug a message to the error console). + * + * EXAMPLE: + * + * import x10.compiler.Uncounted; + * + * class Box[T] { + * var t:T; + * + * def this(init:T) { t = init; } + * } + * + * public class Foo { + * public static def main(args:Rail[String]!) { + * val box = new Box[Boolean](false); + * @Uncounted async (here.next()) { + * Runtime.println("HELLO"); + * @Uncounted async (here.prev()) { + * atomic box.t = true; + * } + * } + * await box.t; + * } + * } + * + */ +public interface Uncounted + extends StatementAnnotation { +} Modified: trunk/x10.runtime/src-x10/x10/lang/Activity.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Activity.x10 2010-04-13 16:09:44 UTC (rev 13851) +++ trunk/x10.runtime/src-x10/x10/lang/Activity.x10 2010-04-14 01:38:07 UTC (rev 13852) @@ -84,16 +84,30 @@ } /** + * Create uncounted activity. + */ + def this(body:()=>Void, safe:Boolean) { + this.finishState = null; + this.safe = safe; + this.body = body; + } + + /** * Run activity. */ def run():Void { - try { - body(); - } catch (t:Throwable) { - finishState.pushException(t); - } - if (null != clockPhases) clockPhases.drop(); - finishState.notifyActivityTermination(); + try { + body(); + } catch (t:Throwable) { + if (null != finishState) { + finishState.pushException(t); + } else { + Runtime.println("Uncaught exception in uncounted activity"); + t.printStackTrace(); + } + } + if (null != clockPhases) clockPhases.drop(); + if (null != finishState) finishState.notifyActivityTermination(); Runtime.dealloc(body); } Modified: trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 2010-04-13 16:09:44 UTC (rev 13851) +++ trunk/x10.runtime/src-x10/x10/lang/Runtime.x10 2010-04-14 01:38:07 UTC (rev 13852) @@ -27,15 +27,15 @@ */ public final class Runtime { - @Native("java", "java.lang.System.out.println(#1)") + @Native("java", "java.lang.System.err.println(#1)") @Native("c++", "x10aux::system_utils::println((#1)->toString()->c_str())") public native static def println(o:Object) : Void; - @Native("java", "java.lang.System.out.println()") + @Native("java", "java.lang.System.err.println()") @Native("c++", "x10aux::system_utils::println(\"\")") public native static def println() : Void; - @Native("java", "java.lang.System.out.printf(#4, #5)") + @Native("java", "java.lang.System.err.printf(#4, #5)") @Native("c++", "x10aux::system_utils::printf(#4, #5)") public native static def printf[T](fmt:String, t:T) : Void; @@ -1020,6 +1020,27 @@ execute(new Activity(body, state, safe())); } + public static def runUncountedAsync(place:Place, body:()=>Void):Void { + val ok = safe(); + if (place.id == hereInt()) { + execute(new Activity(body, ok)); + } else { + var closure:()=>Void; + // Workaround for XTENLANG_614 + if (ok) { + closure = ()=>execute(new Activity(body, true)); + } else { + closure = ()=>execute(new Activity(body, false)); + } + runAtNative(place.id, closure); + dealloc(closure); + } + } + + public static def runUncountedAsync(body:()=>Void):Void { + execute(new Activity(body, safe())); + } + /** * Run at statement */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-04-15 01:28:02
|
Revision: 13880 http://x10.svn.sourceforge.net/x10/?rev=13880&view=rev Author: makinoy Date: 2010-04-15 01:27:54 +0000 (Thu, 15 Apr 2010) Log Message: ----------- Change the runtime type information infrastructure in Java back-end. Related Issue: XTENLANG-1102 Modified Paths: -------------- trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-java/x10/core/Any.java trunk/x10.runtime/src-java/x10/core/AnyRail.java trunk/x10.runtime/src-java/x10/core/GrowableRail.java trunk/x10.runtime/src-java/x10/core/Rail.java trunk/x10.runtime/src-java/x10/core/RailFactory.java trunk/x10.runtime/src-java/x10/core/Ref.java trunk/x10.runtime/src-java/x10/core/Settable.java trunk/x10.runtime/src-java/x10/core/Struct.java trunk/x10.runtime/src-java/x10/core/ValRail.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java trunk/x10.runtime/src-java/x10/core/fun/Fun_0_9.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_0.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_1.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_2.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_3.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_4.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_5.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_6.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_7.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_8.java trunk/x10.runtime/src-java/x10/core/fun/VoidFun_0_9.java trunk/x10.runtime/src-java/x10/rtt/BooleanType.java trunk/x10.runtime/src-java/x10/rtt/ByteType.java trunk/x10.runtime/src-java/x10/rtt/CharType.java trunk/x10.runtime/src-java/x10/rtt/DoubleType.java trunk/x10.runtime/src-java/x10/rtt/FloatType.java trunk/x10.runtime/src-java/x10/rtt/IntType.java trunk/x10.runtime/src-java/x10/rtt/LongType.java trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java trunk/x10.runtime/src-java/x10/rtt/ShortType.java trunk/x10.runtime/src-java/x10/rtt/Type.java trunk/x10.runtime/src-java/x10/rtt/UByteType.java trunk/x10.runtime/src-java/x10/rtt/UIntType.java trunk/x10.runtime/src-java/x10/rtt/ULongType.java trunk/x10.runtime/src-java/x10/rtt/UShortType.java trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 Added Paths: ----------- trunk/x10.runtime/src-java/x10/rtt/ParameterizedType.java trunk/x10.runtime/src-java/x10/rtt/UnresolvedType.java Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -37,7 +37,6 @@ import polyglot.ast.Instanceof; import polyglot.ast.Lit; import polyglot.ast.Local; -import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; import polyglot.ast.Receiver; @@ -72,8 +71,6 @@ import x10.ast.ClosureCall; import x10.ast.ParExpr_c; import x10.ast.TypeParamNode; -import x10.ast.X10Cast; -import x10.ast.X10Cast_c; import x10.ast.X10ClockedLoop; import x10.ast.X10MethodDecl_c; import x10.constraint.XAnd_c; @@ -127,7 +124,10 @@ "class", "float", "native", "super", "while", "const", "for", "new", "switch", "continue", "goto", "package", "synchronized", - "null", "true", "false" + "null", "true", "false", + + // X10 implementation names + "getRTT", "_RTT", "getParam" } ) ); @@ -1927,4 +1927,156 @@ s.append("]"); return s.toString(); } + + public void generateRTTInstance(X10ClassDef def) { + + w.write("public static final x10.rtt.RuntimeType<"); + printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); + w.write(">"); + w.write("_RTT = new x10.rtt.RuntimeType<"); + printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); + w.write(">("); + w.newline(); + w.write("/* base class */"); + printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); + w.write(".class"); + + for (int i = 0; i < def.variances().size(); i ++) { + w.write(", "); + w.newline(); + if (i == 0) w.write("/* variances */ new x10.rtt.RuntimeType.Variance[] {"); + ParameterType.Variance v = def.variances().get(i); + switch (v) { + case INVARIANT: + w.write("x10.rtt.RuntimeType.Variance.INVARIANT"); + break; + case COVARIANT: + w.write("x10.rtt.RuntimeType.Variance.COVARIANT"); + break; + case CONTRAVARIANT: + w.write("x10.rtt.RuntimeType.Variance.CONTRAVARIANT"); + break; + } + if (i == def.variances().size() - 1) w.write("}"); + } + w.newline(); + + if (def.interfaces().size() > 0 || def.superType() != null) { + w.write(", "); + w.write("/* parents */ new x10.rtt.Type[] {"); + for (int i = 0 ; i < def.interfaces().size(); i ++) { + if (i != 0) w.write(", "); + Type type = def.interfaces().get(i).get(); + printParents(def, type); + } + if (def.superType() != null) { + if (def.interfaces().size() != 0) w.write(", "); + printParents(def, def.superType().get()); + } + w.write("}"); + } + w.newline(); + + w.write(");"); + w.newline(); + + + if (!def.flags().isInterface()) { + + w.write("public x10.rtt.RuntimeType getRTT() {"); + w.write("return _RTT;"); + w.write("}"); + w.newline(); + w.newline(); + + if (!def.typeParameters().isEmpty()) { + w.write("public x10.rtt.Type getParam(int i) {"); + for (int i = 0; i < def.typeParameters().size(); i++) { + ParameterType pt = def.typeParameters().get(i); + w.write("if (i ==" + i + ")"); + w.write("return "); + w.write(Emitter.mangleToJava(pt.name())); + w.write(";"); + } + w.write("return null;"); + w.write("}"); + } + w.newline(); + } + } + + private void printParents(X10ClassDef def, Type type) { + if (type instanceof ConstrainedType_c) { + type = ((ConstrainedType_c) type).baseType().get(); + } + if (type instanceof X10ClassType) { + X10ClassType x10Type = (X10ClassType) type; + if (x10Type.typeArguments().size() > 0) { + for (int i = 0; i < x10Type.typeArguments().size(); i++) { + if (i == 0) { + w.write("new x10.rtt.ParameterizedType("); + if (x10Type instanceof FunctionType) { + FunctionType ft = (FunctionType) x10Type; + List<Type> args = ft.argumentTypes(); + Type ret = ft.returnType(); + if (ret.isVoid()) { + w.write("x10.core.fun.VoidFun"); + } else { + w.write("x10.core.fun.Fun"); + } + w.write("_" + ft.typeParameters().size()); + w.write("_" + args.size()); + w.write("._RTT"); + } + else { + X10ClassDef cd = x10Type.x10Def(); + String pat = getJavaRTTRep(cd); + if (pat != null) { + // Check for @NativeRep with null RTT class + Object[] components = new Object[1 + x10Type.typeArguments().size() * 2]; + int j = 0; + components[j++] = new TypeExpander(this, x10Type, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); + for (Type at : x10Type.typeArguments()) { + components[j++] = new TypeExpander(this, at, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); + components[j++] = new RuntimeTypeExpander(this, at); + } + dumpRegex("Native", components, tr, pat); + } + else if (getJavaRep(cd) != null) { + w.write("(x10.rtt.RuntimeType) "); + w.write("x10.rtt.Types.runtimeType("); + printType(x10Type, 0); + w.write(".class"); + w.write(")"); + } + else { + w.write(x10Type.def().fullName() + "._RTT"); + } + } + } + w.write(", "); + Type ta = x10Type.typeArguments().get(i); + if (ta instanceof ParameterType) { + w.write("new x10.rtt.UnresolvedType("); + w.write("" + getIndex(def.typeParameters(), (ParameterType) ta)); + w.write(")"); + } else { + printParents(def, ta); + } + if (i == x10Type.typeArguments().size() - 1) w.write(")"); + } + } else { + new RuntimeTypeExpander(this, x10Type).expand(tr); + } + } + } + + private int getIndex(List<ParameterType> pts, ParameterType t) { + for (int i = 0; i < pts.size(); i ++) { + if (pts.get(i).name().equals(t.name())) { + return i; + } + } + throw new InternalCompilerError(""); // TODO + } } Modified: trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -15,9 +15,8 @@ import polyglot.types.Type; import polyglot.visit.Translator; -import x10.constraint.XConstraint; -import x10.types.FunctionType; import x10.types.ConstrainedType; +import x10.types.FunctionType; import x10.types.ParameterType; import x10.types.X10ClassDef; import x10.types.X10ClassType; @@ -25,14 +24,12 @@ import x10.visit.X10PrettyPrinterVisitor; final public class RuntimeTypeExpander extends Expander { - /** - * - */ - private final Type at; + private final Type at; + public RuntimeTypeExpander(Emitter er, Type at) { - super(er); - if (at instanceof X10ClassType) { + super(er); + if (at instanceof X10ClassType) { X10ClassType ct = (X10ClassType) at; if (ct.isAnonymous()) { @@ -70,27 +67,24 @@ FunctionType ct = (FunctionType) at; List<Type> args = ct.argumentTypes(); Type ret = ct.returnType(); - er.w.write("new "); - if (ret.isVoid()) { - er.w.write("x10.core.fun.VoidFun"); + + // XTENLANG-1102 + if (args.size() > 0) { + er.w.write("new x10.rtt.ParameterizedType("); + printFunRTT(ct, args, ret); + for (Type a:args) { + er.w.write(","); + new RuntimeTypeExpander(er, a).expand(tr); + } + if (!ret.isVoid()) { + er.w.write(","); + new RuntimeTypeExpander(er, ret).expand(tr); + } + er.w.write(")"); } else { - er.w.write("x10.core.fun.Fun"); + printFunRTT(ct, args, ret); } - er.w.write("_" + ct.typeParameters().size()); - er.w.write("_" + args.size()); - er.w.write(".RTT("); - String sep = ""; - for (Type a : args) { - er.w.write(sep); - sep = ","; - new RuntimeTypeExpander(er, a).expand(tr); - } - if (! ret.isVoid()) { - er.w.write(sep); - new RuntimeTypeExpander(er, ret).expand(tr); - } - er.w.write(")"); return; } @@ -109,26 +103,14 @@ } if (pat == null) { + // XTENLANG-1102 if (ct.isGloballyAccessible() && ct.typeArguments().size() == 0) { - er.w.write(er.rttName(cd)); - er.w.write(".it"); - } - else { - er.w.write("new "); - er.w.write(er.rttName(cd)); - - er.w.write("<"); + er.w.write(cd.fullName().toString() + "." + "_RTT"); + } else { + er.w.write("new x10.rtt.ParameterizedType("); + er.w.write(cd.fullName().toString() + "." + "_RTT"); for (int i = 0; i < ct.typeArguments().size(); i++) { - if (i != 0) - er.w.write(", "); - new TypeExpander(er, ct.typeArguments().get(i), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES).expand(tr); - } - er.w.write(">"); - - er.w.write("("); - for (int i = 0; i < ct.typeArguments().size(); i++) { - if (i != 0) - er.w.write(", "); + er.w.write(", "); new RuntimeTypeExpander(er, ct.typeArguments().get(i)).expand(tr); } er.w.write(")"); @@ -172,6 +154,17 @@ er.w.write(")"); } + private void printFunRTT(FunctionType ct, List<Type> args, Type ret) { + if (ret.isVoid()) { + er.w.write("x10.core.fun.VoidFun"); + } else { + er.w.write("x10.core.fun.Fun"); + } + er.w.write("_" + ct.typeParameters().size()); + er.w.write("_" + args.size()); + er.w.write("._RTT"); + } + String typeof(Type t) { if (t.isBoolean()) return "x10.rtt.Types.BOOLEAN"; Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -14,8 +14,11 @@ import java.util.AbstractList; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; +import java.util.Set; import polyglot.ast.Assign; import polyglot.ast.Binary; @@ -47,6 +50,7 @@ import polyglot.ast.TypeNode; import polyglot.ast.Unary; import polyglot.ast.Unary_c; +import polyglot.types.ClassDef; import polyglot.types.FieldDef; import polyglot.types.Flags; import polyglot.types.LocalDef; @@ -117,6 +121,7 @@ import x10.emitter.Template; import x10.emitter.TryCatchExpander; import x10.emitter.TypeExpander; +import x10.types.FunctionType; import x10.types.ParameterType; import x10.types.X10ClassDef; import x10.types.X10ClassType; @@ -569,13 +574,16 @@ // 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. - er.generateRTTMethods(def); +// er.generateRTTMethods(def); // boolean isValueType = xts.isValueType(def.asType(), (X10Context) tr.context()); - if (def.isTopLevel()) { - er.generateRTType(def); - } - +// if (def.isTopLevel()) { +// er.generateRTType(def); +// } + + // XTENLANG-1102 + er.generateRTTInstance(def); + // Generate dispatcher methods. er.generateDispatchers(def); @@ -854,10 +862,51 @@ return; } - new RuntimeTypeExpander(er, t).expand(tr); - w.write("."); + // XTENLANG-1102 + if (t instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) t; + X10ClassDef cd = ct.x10Def(); + String pat = er.getJavaRTTRep(cd); + + if (t instanceof FunctionType) { + FunctionType ft = (FunctionType) t; + List<Type> args = ft.argumentTypes(); + Type ret = ft.returnType(); + if (ret.isVoid()) { + w.write("x10.core.fun.VoidFun"); + } else { + w.write("x10.core.fun.Fun"); + } + w.write("_" + ft.typeParameters().size()); + w.write("_" + args.size()); + w.write("._RTT"); + } + else if (pat == null && er.getJavaRep(cd) == null && ct.isGloballyAccessible() && ct.typeArguments().size() != 0) { + w.write(cd.fullName().toString() + "." + "_RTT"); + } + else { + new RuntimeTypeExpander(er, t).expand(tr); + } + } else { + new RuntimeTypeExpander(er, t).expand(tr); + } + + w.write("."); w.write("instanceof$("); tr.print(c, c.expr(), w); + + if (t instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) t; + X10ClassDef cd = ct.x10Def(); + String pat = er.getJavaRTTRep(cd); + + for (int i = 0; i < ct.typeArguments().size(); i++) { + w.write(", "); +// if (i == 0) w.write("new x10.rtt.Type[] {"); + new RuntimeTypeExpander(er, ct.typeArguments().get(i)).expand(tr); +// if (i == ct.typeArguments().size() - 1 ) w.write("}"); + } + } w.write(")"); } @@ -1302,11 +1351,60 @@ w.write("}"); w.newline(); - Type t = n.type(); - t = X10TypeMixin.baseType(t); - if (t instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) t; - er.generateRTTMethods(ct.x10Def()); + Type type = n.type(); + type = X10TypeMixin.baseType(type); + if (type instanceof X10ClassType) { + X10ClassType ct = (X10ClassType) type; + X10ClassDef def = ct.x10Def(); + + // XTENLANG-1102 + Set<ClassDef> visited = new HashSet<ClassDef>(); + + visited = new HashSet<ClassDef>(); + visited.add(def); + if (!def.flags().isInterface()) { + List<Type> types = new ArrayList<Type>(); + LinkedList<Type> worklist = new LinkedList<Type>(); + for (Type t : def.asType().interfaces()) { + Type it = X10TypeMixin.baseType(t); + worklist.add(it); + } + while (!worklist.isEmpty()) { + Type it = worklist.removeFirst(); + if (it instanceof X10ClassType) { + X10ClassType ct2 = (X10ClassType) it; + X10ClassDef idef = ct2.x10Def(); + + if (visited.contains(idef)) + continue; + visited.add(idef); + + for (Type t : ct2.interfaces()) { + Type it2 = X10TypeMixin.baseType(t); + worklist.add(it2); + } + + types.addAll(ct2.typeArguments()); + } + } + if (types.size() > 0) { + w.write("public x10.rtt.RuntimeType<?> getRTT() { return _RTT;}"); + w.write("public x10.rtt.Type<?> getParam(int i) {"); + for (int i = 0; i < types.size(); i++) { + w.write("if (i ==" + i + ")"); + Type t = types.get(i); + w.write(" return "); + new RuntimeTypeExpander(er, t).expand(); + w.write(";"); + } + w.write("return null;"); + w.newline(); + w.write("}"); + w.newline(); + } else { + + } + } } w.write("}"); Modified: trunk/x10.runtime/src-java/x10/core/Any.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Any.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/Any.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -16,16 +16,7 @@ // Base interface of all X10 entities. public interface Any { - public static class RTT extends RuntimeType<Any> { - public static final RTT it = new RTT(); - - public RTT() { - super(Any.class); - } - - @Override - public boolean instanceof$(Object o) { - return true; - } - } + public static RuntimeType<Any> _RTT = new RuntimeType<Any>(Any.class); + public RuntimeType<?> getRTT(); + public Type<?> getParam(int i); } Modified: trunk/x10.runtime/src-java/x10/core/AnyRail.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/AnyRail.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/AnyRail.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,17 +11,11 @@ package x10.core; -import x10.core.Iterator; -import x10.core.Iterable; import x10.core.fun.Fun_0_1; -import x10.rtt.Type; public interface AnyRail<T> extends Indexable<Integer,T>, Fun_0_1<Integer,T>, Iterable<T> { - public Iterator<T> iterator(); + public Iterator<T> iterator(); - public Type<?> rtt_x10$lang$Fun_0_1_Z1(); - public Type<?> rtt_x10$lang$Fun_0_1_U(); - // Methods to get the backing array. May be called by generated code. public Object getBackingArray(); Modified: trunk/x10.runtime/src-java/x10/core/GrowableRail.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/GrowableRail.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/GrowableRail.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -13,10 +13,10 @@ import x10.core.fun.Fun_0_1; +import x10.rtt.RuntimeType; import x10.rtt.Type; import x10.rtt.Types; -import x10.core.Iterable; -import x10.core.Iterator; +import x10.rtt.RuntimeType.Variance; public class GrowableRail<T> extends Ref implements Fun_0_1<Integer,T>, Settable<Integer, T>, Iterable<T> { private Type<T> elementType; @@ -145,35 +145,9 @@ // // Runtime type information // - - static public class RTT extends x10.rtt.RuntimeType<GrowableRail<?>> { - Type<?> type; - - public RTT(Type<?> type) { - super(GrowableRail.class); - this.type = type; - } - - public boolean instanceof$(java.lang.Object o) { - if (!(o instanceof GrowableRail)) - return false; - GrowableRail r = (GrowableRail) o; - if (! r.elementType.equals(type)) // covariant - return false; - return true; - } - - - public boolean isSubtype(Type<?> type) { - if (type instanceof GrowableRail.RTT) { - GrowableRail.RTT r = (GrowableRail.RTT) type; - return r.type.equals(this.type); - } -// if (type instanceof Fun_0_1.RTT) { -// Fun_0_1.RTT r = (Fun_0_1.RTT) type; -// return r.I.equals(Types.INT) && r.V.equals(this.type); -// } - return false; - } + public static final RuntimeType<GrowableRail<?>> _RTT = new RuntimeType(GrowableRail.class, Variance.INVARIANT); + public RuntimeType<GrowableRail<?>> getRTT() {return _RTT;} + public Type<?> getParam(int i) { + return i == 0 ? elementType : null; } } Modified: trunk/x10.runtime/src-java/x10/core/Rail.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Rail.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/Rail.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -12,8 +12,12 @@ package x10.core; import x10.core.fun.Fun_0_1; +import x10.rtt.ParameterizedType; +import x10.rtt.RuntimeType; import x10.rtt.Type; import x10.rtt.Types; +import x10.rtt.UnresolvedType; +import x10.rtt.RuntimeType.Variance; public final class Rail<T> extends Ref implements AnyRail<T>, Settable<Integer,T> { public final int length; @@ -155,51 +159,23 @@ // + public ValRail<T> view() { + return new ValRail<T>(type, this); + } // // Runtime type information // - - static public class RTT<T> extends x10.rtt.RuntimeType<Rail<T>> { - Type<T> type; - - public RTT(Type<T> type) { - super(Rail.class); - this.type = type; + public static final RuntimeType<Rail> _RTT = new RuntimeType<Rail>( + Rail.class, + new Variance[] {Variance.INVARIANT}, + new Type<?>[] { + new ParameterizedType(Fun_0_1._RTT, Types.INT, new UnresolvedType(0)), + new ParameterizedType(Settable._RTT, Types.INT, new UnresolvedType(0)) } - - public boolean instanceof$(java.lang.Object o) { - if (!(o instanceof Rail)) - return false; - Rail r = (Rail) o; - if (! r.type.equals(type)) // invariant - return false; - return true; - } - - public boolean isSubtype(Type<?> type) { - if (type instanceof Rail.RTT) { - Rail.RTT r = (Rail.RTT) type; - return r.type.equals(this.type); - } -// if (type instanceof Fun_0_1.RTT) { -// Fun_0_1.RTT r = (Fun_0_1.RTT) type; -// return r.I.equals(Types.INT) && r.V.equals(this.type); -// } -// if (type instanceof Settable.RTT) { -// Settable.RTT r = (Settable.RTT) type; -// return r.I.equals(Types.INT) && r.V.equals(this.type); -// } - return false; - } + ); + public RuntimeType<Rail> getRTT() {return _RTT;} + public Type<?> getParam(int i) { + return i == 0 ? type : null; } - - public Type<?> rtt_x10$lang$Fun_0_1_Z1() { return Types.INT; } - public Type<?> rtt_x10$lang$Fun_0_1_U() { return type; } - public Type<?> rtt_x10$lang$Settable_I() { return Types.INT; } - public Type<?> rtt_x10$lang$Settable_V() { return type; } - - public ValRail<T> view() { - return new ValRail<T>(type, this); - } } Modified: trunk/x10.runtime/src-java/x10/core/RailFactory.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/RailFactory.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/RailFactory.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -17,7 +17,7 @@ import x10.rtt.Types; public class RailFactory { - public static <T> ValRail<T> makeValRail(Type<T> type, int length, Fun_0_1<Integer,T> init) { + public static <T> ValRail<T> makeValRail(Type type, int length, Fun_0_1<Integer,T> init) { Object o = type.makeArray(length); for (int i = 0; i < length; i++) { type.setArray(o, i, init.apply(i)); @@ -26,7 +26,7 @@ return array; } - public static <T> Rail<T> makeVarRail(Type<T> type, int length, Fun_0_1<Integer,T> init) { + public static <T> Rail<T> makeVarRail(Type type, int length, Fun_0_1<Integer,T> init) { Rail<T> array = new Rail<T>(type, length); for (int i = 0; i < length; i++) { array.set(init.apply(i), i); @@ -34,19 +34,19 @@ return array; } - public static <T> ValRail<T> makeValRail(Type<T> type, int length) { + public static <T> ValRail<T> makeValRail(Type type, int length) { Object o = type.makeArray(length); ValRail<T> array = new ValRail<T>(type, length, o); - T zero = type.zeroValue(); + T zero = (T) type.zeroValue(); for (int i = 0; i < length; i++) { type.setArray(o, i, zero); } return array; } - public static <T> Rail<T> makeVarRail(Type<T> type, int length) { + public static <T> Rail<T> makeVarRail(Type type, int length) { Rail<T> array = new Rail<T>(type, length); - T zero = type.zeroValue(); + T zero = (T) type.zeroValue(); for (int i = 0; i < length; i++) { array.set(zero, i); } Modified: trunk/x10.runtime/src-java/x10/core/Ref.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Ref.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/Ref.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -12,6 +12,7 @@ package x10.core; import x10.rtt.RuntimeType; +import x10.rtt.Type; import x10.runtime.impl.java.Thread; @@ -31,22 +32,7 @@ public boolean equals(Object o) { return this == o; } - - - public static class RTT extends RuntimeType<Ref> { - public static final RTT it = new RTT(); - - public RTT() { - super(Ref.class); - } - - @Override - public boolean instanceof$(Object o) { - return o instanceof Ref; - } - } - public Ref box$() { return this; } @@ -88,8 +74,18 @@ return Thread.currentThread().home(); } } + public static String typeName(Object obj) { - String s = obj.getClass().toString().substring(6); // drop the beginning "class " + String s; + if (obj instanceof Any) { + s = ((Any) obj).getRTT().typeName(obj); + } else { + s = obj.getClass().toString().substring(6); + } return s.equals("java.lang.Object") ? "x10.lang.Object" : s; } + + public static RuntimeType<Ref> _RTT = new RuntimeType<Ref>(Ref.class); + public RuntimeType getRTT() {return _RTT;} + public Type<?> getParam(int i) {return null;} } Modified: trunk/x10.runtime/src-java/x10/core/Settable.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Settable.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/Settable.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,6 +11,10 @@ package x10.core; +import x10.rtt.RuntimeType; +import x10.rtt.RuntimeType.Variance; + public interface Settable<D,R> { + public static RuntimeType _RTT = new RuntimeType(Settable.class, new Variance[]{Variance.CONTRAVARIANT, Variance.INVARIANT}); R set(R v, D i); } Modified: trunk/x10.runtime/src-java/x10/core/Struct.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/Struct.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/Struct.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -22,20 +22,6 @@ // Base class for all X10 structs public abstract class Struct implements Any { - public static class RTT extends RuntimeType<Struct> { - public static final RTT it = new RTT(); - - public RTT() { - super(Struct.class); - } - - @Override - public boolean instanceof$(Object o) { - return o instanceof Struct; - } - - } - public Struct() {} public final boolean structEquals(Object o) { @@ -87,4 +73,8 @@ } return true; } + + public static final RuntimeType<Struct> _RTT = new RuntimeType<Struct>(Struct.class); + public RuntimeType getRTT() {return _RTT;} + public Type<?> getParam(int i) {return null;} } Modified: trunk/x10.runtime/src-java/x10/core/ValRail.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/ValRail.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/ValRail.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -12,8 +12,12 @@ package x10.core; import x10.core.fun.Fun_0_1; +import x10.rtt.ParameterizedType; +import x10.rtt.RuntimeType; import x10.rtt.Type; import x10.rtt.Types; +import x10.rtt.UnresolvedType; +import x10.rtt.RuntimeType.Variance; public final class ValRail<T> implements AnyRail<T> { public final int length; @@ -163,38 +167,17 @@ // // Runtime type information // - - static public class RTT<T> extends x10.rtt.RuntimeType<ValRail<T>> { - Type<T> type; - - public RTT(Type<T> type) { - super(ValRail.class); - this.type = type; - } - public boolean instanceof$(java.lang.Object o) { - if (!(o instanceof ValRail)) - return false; - ValRail r = (ValRail) o; - if (! r.type.isSubtype(type)) // covariant - return false; - return true; - } - - - public boolean isSubtype(Type<?> type) { - if (type instanceof ValRail.RTT) { - ValRail.RTT r = (ValRail.RTT) type; - return r.type.equals(this.type); - } -// if (type instanceof Fun_0_1.RTT) { -// Fun_0_1.RTT r = (Fun_0_1.RTT) type; -// return r.I.equals(Types.INT) && r.V.equals(this.type); -// } - return false; - } + public static final RuntimeType _RTT = new RuntimeType( + ValRail.class, + new Variance[] {Variance.COVARIANT}, + new Type<?>[] {new ParameterizedType(Fun_0_1._RTT, Types.INT, new UnresolvedType(0))} + ); + + public RuntimeType<?> getRTT() { + return _RTT; } - - public Type<?> rtt_x10$lang$Fun_0_1_Z1() { return Types.INT; } - public Type<?> rtt_x10$lang$Fun_0_1_U() { return type; } + public Type<?> getParam(int i) { + return i == 0 ? type : null; + } } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_0.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,40 +11,16 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_0<U> { +public interface Fun_0_0<U> extends Any { U apply(); - Type<?> rtt_x10$lang$Fun_0_0_U(); - - public static class RTT extends RuntimeType<Fun_0_0<?>>{ - Type<?> U; - - public RTT(Type<?> U) { - super(Fun_0_0.class); - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_0<?>) { - Fun_0_0<?> v = (Fun_0_0<?>) o; - return v.rtt_x10$lang$Fun_0_0_U().isSubtype(U); // covariant - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_0.RTT) { - Fun_0_0.RTT t = (RTT) o; - return U.isSubtype(t.U); - } - return false; - } - } + + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_0.class, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_1.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,44 +11,17 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_1<T1,U> { +public interface Fun_0_1<T1,U> extends Any { U apply(T1 o); - Type<?> rtt_x10$lang$Fun_0_1_Z1(); - Type<?> rtt_x10$lang$Fun_0_1_U(); - - public static class RTT extends RuntimeType<Fun_0_1<?,?>>{ - Type<?> T1; - Type<?> U; - - public RTT(Type<?> T1, Type<?> U) { - super(Fun_0_1.class); - this.T1 = T1; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_1<?,?>) { - Fun_0_1<?,?> v = (Fun_0_1<?,?>) o; - if (! v.rtt_x10$lang$Fun_0_1_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_1_Z1())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_1.RTT) { - Fun_0_1.RTT t = (RTT) o; - return U.isSubtype(t.U) && t.T1.isSubtype(T1); - } - return false; - } - } + + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_1.class, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_2.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,48 +11,17 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_2<T1,T2,U> { +public interface Fun_0_2<T1,T2,U> extends Any { U apply(T1 o1, T2 o2); - Type<?> rtt_x10$lang$Fun_0_2_Z1(); - Type<?> rtt_x10$lang$Fun_0_2_Z2(); - Type<?> rtt_x10$lang$Fun_0_2_U(); - - public static class RTT extends RuntimeType<Fun_0_2<?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> U) { - super(Fun_0_2.class); - this.T1 = T1; - this.T2 = T2; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_2) { - Fun_0_2<?,?,?> v = (Fun_0_2<?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_2_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_2_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_2_Z2())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_2.RTT) { - Fun_0_2.RTT t = (RTT) o; - return U.isSubtype(t.U) && t.T1.isSubtype(T1) && t.T2.isSubtype(T2); - } - return false; - } - } + + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_2.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_3.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,52 +11,18 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_3<T1,T2,T3,U> { +public interface Fun_0_3<T1,T2,T3,U> extends Any { U apply(T1 o1, T2 o2, T3 o3); - Type<?> rtt_x10$lang$Fun_0_3_Z1(); - Type<?> rtt_x10$lang$Fun_0_3_Z2(); - Type<?> rtt_x10$lang$Fun_0_3_Z3(); - Type<?> rtt_x10$lang$Fun_0_3_U(); - - public static class RTT extends RuntimeType<Fun_0_3<?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> U) { - super(Fun_0_3.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_3) { - Fun_0_3<?,?,?,?> v = (Fun_0_3<?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_3_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_3_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_3_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_3_Z3())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_3.RTT) { - Fun_0_3.RTT t = (RTT) o; - return U.isSubtype(t.U) && t.T1.isSubtype(T1) && t.T2.isSubtype(T2) && t.T3.isSubtype(T3); - } - return false; - } - } + + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_3.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_4.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,60 +11,19 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_4<T1,T2,T3,T4,U> { +public interface Fun_0_4<T1,T2,T3,T4,U> extends Any { U apply(T1 o1, T2 o2, T3 o3, T4 o4); - Type<?> rtt_x10$lang$Fun_0_4_Z1(); - Type<?> rtt_x10$lang$Fun_0_4_Z2(); - Type<?> rtt_x10$lang$Fun_0_4_Z3(); - Type<?> rtt_x10$lang$Fun_0_4_Z4(); - Type<?> rtt_x10$lang$Fun_0_4_U(); - - public static class RTT extends RuntimeType<Fun_0_4<?,?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> T4; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> T4, Type<?> U) { - super(Fun_0_4.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.T4 = T4; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_4) { - Fun_0_4<?,?,?,?,?> v = (Fun_0_4<?,?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_4_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_4_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_4_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_4_Z3())) return false; // contravariant - if (! T4.isSubtype(v.rtt_x10$lang$Fun_0_4_Z4())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_4.RTT) { - Fun_0_4.RTT t = (RTT) o; - return U.isSubtype(t.U) - && t.T1.isSubtype(T1) - && t.T2.isSubtype(T2) - && t.T3.isSubtype(T3) - && t.T4.isSubtype(T4); - } - return false; - } - } + + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_4.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_5.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,65 +11,21 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_5<T1,T2,T3,T4,T5,U> { +public interface Fun_0_5<T1,T2,T3,T4,T5,U> extends Any { U apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5); - Type<?> rtt_x10$lang$Fun_0_5_Z1(); - Type<?> rtt_x10$lang$Fun_0_5_Z2(); - Type<?> rtt_x10$lang$Fun_0_5_Z3(); - Type<?> rtt_x10$lang$Fun_0_5_Z4(); - Type<?> rtt_x10$lang$Fun_0_5_Z5(); - Type<?> rtt_x10$lang$Fun_0_5_U(); - public static class RTT extends RuntimeType<Fun_0_5<?,?,?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> T4; - Type<?> T5; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> T4, Type<?> T5, Type<?> U) { - super(Fun_0_5.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.T4 = T4; - this.T5 = T5; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_5) { - Fun_0_5<?,?,?,?,?,?> v = (Fun_0_5<?,?,?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_5_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_5_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_5_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_5_Z3())) return false; // contravariant - if (! T4.isSubtype(v.rtt_x10$lang$Fun_0_5_Z4())) return false; // contravariant - if (! T5.isSubtype(v.rtt_x10$lang$Fun_0_5_Z5())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_5.RTT) { - Fun_0_5.RTT t = (RTT) o; - return U.isSubtype(t.U) - && t.T1.isSubtype(T1) - && t.T2.isSubtype(T2) - && t.T3.isSubtype(T3) - && t.T4.isSubtype(T4) - && t.T5.isSubtype(T5); - } - return false; - } - } + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_5.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_6.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,70 +11,21 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_6<T1,T2,T3,T4,T5,T6,U> { +public interface Fun_0_6<T1,T2,T3,T4,T5,T6,U> extends Any { U apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6); - Type<?> rtt_x10$lang$Fun_0_6_Z1(); - Type<?> rtt_x10$lang$Fun_0_6_Z2(); - Type<?> rtt_x10$lang$Fun_0_6_Z3(); - Type<?> rtt_x10$lang$Fun_0_6_Z4(); - Type<?> rtt_x10$lang$Fun_0_6_Z5(); - Type<?> rtt_x10$lang$Fun_0_6_Z6(); - Type<?> rtt_x10$lang$Fun_0_6_U(); - public static class RTT extends RuntimeType<Fun_0_6<?,?,?,?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> T4; - Type<?> T5; - Type<?> T6; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> T4, Type<?> T5, Type<?> T6, Type<?> U) { - super(Fun_0_6.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.T4 = T4; - this.T5 = T5; - this.T6 = T6; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_6) { - Fun_0_6<?,?,?,?,?,?,?> v = (Fun_0_6<?,?,?,?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_6_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_6_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_6_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_6_Z3())) return false; // contravariant - if (! T4.isSubtype(v.rtt_x10$lang$Fun_0_6_Z4())) return false; // contravariant - if (! T5.isSubtype(v.rtt_x10$lang$Fun_0_6_Z5())) return false; // contravariant - if (! T6.isSubtype(v.rtt_x10$lang$Fun_0_6_Z6())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_6.RTT) { - Fun_0_6.RTT t = (RTT) o; - return U.isSubtype(t.U) - && t.T1.isSubtype(T1) - && t.T2.isSubtype(T2) - && t.T3.isSubtype(T3) - && t.T4.isSubtype(T4) - && t.T5.isSubtype(T5) - && t.T6.isSubtype(T6); - } - return false; - } - } + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_6.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_7.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,75 +11,21 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_7<T1,T2,T3,T4,T5,T6,T7,U> { +public interface Fun_0_7<T1,T2,T3,T4,T5,T6,T7,U> extends Any { U apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6, T7 o7); - Type<?> rtt_x10$lang$Fun_0_7_Z1(); - Type<?> rtt_x10$lang$Fun_0_7_Z2(); - Type<?> rtt_x10$lang$Fun_0_7_Z3(); - Type<?> rtt_x10$lang$Fun_0_7_Z4(); - Type<?> rtt_x10$lang$Fun_0_7_Z5(); - Type<?> rtt_x10$lang$Fun_0_7_Z6(); - Type<?> rtt_x10$lang$Fun_0_7_Z7(); - Type<?> rtt_x10$lang$Fun_0_7_U(); - - public static class RTT extends RuntimeType<Fun_0_7<?,?,?,?,?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> T4; - Type<?> T5; - Type<?> T6; - Type<?> T7; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> T4, Type<?> T5, Type<?> T6, Type<?> T7, Type<?> U) { - super(Fun_0_7.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.T4 = T4; - this.T5 = T5; - this.T6 = T6; - this.T7 = T7; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_7) { - Fun_0_7<?,?,?,?,?,?,?,?> v = (Fun_0_7<?,?,?,?,?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_7_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_7_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_7_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_7_Z3())) return false; // contravariant - if (! T4.isSubtype(v.rtt_x10$lang$Fun_0_7_Z4())) return false; // contravariant - if (! T5.isSubtype(v.rtt_x10$lang$Fun_0_7_Z5())) return false; // contravariant - if (! T6.isSubtype(v.rtt_x10$lang$Fun_0_7_Z6())) return false; // contravariant - if (! T7.isSubtype(v.rtt_x10$lang$Fun_0_7_Z7())) return false; // contravariant - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_7.RTT) { - Fun_0_7.RTT t = (RTT) o; - return U.isSubtype(t.U) - && t.T1.isSubtype(T1) - && t.T2.isSubtype(T2) - && t.T3.isSubtype(T3) - && t.T4.isSubtype(T4) - && t.T5.isSubtype(T5) - && t.T6.isSubtype(T6) - && t.T7.isSubtype(T7); - } - return false; - } - } + public static final RuntimeType _RTT = new RuntimeType( + Fun_0_7.class, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.CONTRAVARIANT, + Variance.COVARIANT + ); } Modified: trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java =================================================================== --- trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java 2010-04-15 00:57:16 UTC (rev 13879) +++ trunk/x10.runtime/src-java/x10/core/fun/Fun_0_8.java 2010-04-15 01:27:54 UTC (rev 13880) @@ -11,80 +11,23 @@ package x10.core.fun; +import x10.core.Any; import x10.rtt.RuntimeType; -import x10.rtt.Type; +import x10.rtt.RuntimeType.Variance; -public interface Fun_0_8<T1,T2,T3,T4,T5,T6,T7,T8,U> { +public interface Fun_0_8<T1,T2,T3,T4,T5,T6,T7,T8,U> extends Any { U apply(T1 o1, T2 o2, T3 o3, T4 o4, T5 o5, T6 o6, T7 o7, T8 o8); - Type<?> rtt_x10$lang$Fun_0_8_Z1(); - Type<?> rtt_x10$lang$Fun_0_8_Z2(); - Type<?> rtt_x10$lang$Fun_0_8_Z3(); - Type<?> rtt_x10$lang$Fun_0_8_Z4(); - Type<?> rtt_x10$lang$Fun_0_8_Z5(); - Type<?> rtt_x10$lang$Fun_0_8_Z6(); - Type<?> rtt_x10$lang$Fun_0_8_Z7(); - Type<?> rtt_x10$lang$Fun_0_8_Z8(); - Type<?> rtt_x10$lang$Fun_0_8_U(); - - public static class RTT extends RuntimeType<Fun_0_8<?,?,?,?,?,?,?,?,?>>{ - Type<?> T1; - Type<?> T2; - Type<?> T3; - Type<?> T4; - Type<?> T5; - Type<?> T6; - Type<?> T7; - Type<?> T8; - Type<?> U; - - public RTT(Type<?> T1, Type<?> T2, Type<?> T3, Type<?> T4, Type<?> T5, Type<?> T6, Type<?> T7, Type<?> T8, Type<?> U) { - super(Fun_0_8.class); - this.T1 = T1; - this.T2 = T2; - this.T3 = T3; - this.T4 = T4; - this.T5 = T5; - this.T6 = T6; - this.T7 = T7; - this.T8 = T8; - this.U = U; - } - - @Override - public boolean instanceof$(Object o) { - if (o instanceof Fun_0_8) { - Fun_0_8<?,?,?,?,?,?,?,?,?> v = (Fun_0_8<?,?,?,?,?,?,?,?,?>) o; - if (! v.rtt_x10$lang$Fun_0_8_U().isSubtype(U)) return false; // covariant - if (! T1.isSubtype(v.rtt_x10$lang$Fun_0_8_Z1())) return false; // contravariant - if (! T2.isSubtype(v.rtt_x10$lang$Fun_0_8_Z2())) return false; // contravariant - if (! T3.isSubtype(v.rtt_x10$lang$Fun_0_8_Z3())) return false; // contravariant - if (! T4.isSubtype(v.rtt_x10$lang$Fun_0_8_Z4())) return false; // contravariant - if (! T5.isSubtype(v.rtt_x10$lang$Fun_0_8_Z5())) return false; // contravariant - if (! T6.isSubtype(v.rtt_x10$lang$Fun_0_8_Z6())) return false; // contravariant - if (! T7.isSubtype(v.rtt_x10$lang$Fun_0_8_Z7())) return false; // contravariant - if (! T8.isSubtype(v.rtt_x10$lang$Fun_0_8_Z8())) return false; // contravarian/ - return true; - } - return false; - } - - @Override - public boolean isSubtype(Type<?> o) { - if (! super.isSubtype(o)) - return false; - if (o instanceof Fun_0_8.RTT) { - Fun_0_8.RTT t = (RTT) o; - return U.isSubtype(t.U) - ... [truncated message content] |
From: <ma...@us...> - 2010-04-24 09:43:17
|
Revision: 14015 http://x10.svn.sourceforge.net/x10/?rev=14015&view=rev Author: makinoy Date: 2010-04-24 09:43:11 +0000 (Sat, 24 Apr 2010) Log Message: ----------- Add some fixes for new Java RTT. Related: XTENLANG-1287, XTENLANG-1288 Modified Paths: -------------- trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-04-23 21:51:47 UTC (rev 14014) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-04-24 09:43:11 UTC (rev 14015) @@ -2050,21 +2050,8 @@ } else { X10ClassDef cd = x10Type.x10Def(); - String pat = getJavaRTTRep(cd); - if (pat != null) { - // Check for @NativeRep with null RTT class - Object[] components = new Object[1 + x10Type.typeArguments().size() * 2]; - int j = 0; - components[j++] = new TypeExpander(this, x10Type, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - for (Type at : x10Type.typeArguments()) { - components[j++] = new TypeExpander(this, at, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - components[j++] = new RuntimeTypeExpander(this, at); - } - dumpRegex("Native", components, tr, pat); - } - else if (getJavaRep(cd) != null) { - w.write("(x10.rtt.RuntimeType) "); - w.write("x10.rtt.Types.runtimeType("); + if (getJavaRep(cd) != null) { + w.write("new x10.rtt.RuntimeType("); printType(x10Type, 0); w.write(".class"); w.write(")"); @@ -2076,8 +2063,13 @@ } w.write(", "); Type ta = x10Type.typeArguments().get(i); - if (ta instanceof ParameterType) { + if (ta.typeEquals(def.asType(), tr.context())) { w.write("new x10.rtt.UnresolvedType("); + w.write("-1"); + w.write(")"); + } + else if (ta instanceof ParameterType) { + w.write("new x10.rtt.UnresolvedType("); w.write("" + getIndex(def.typeParameters(), (ParameterType) ta)); w.write(")"); } else { Modified: trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-04-23 21:51:47 UTC (rev 14014) +++ trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java 2010-04-24 09:43:11 UTC (rev 14015) @@ -916,11 +916,11 @@ X10ClassDef cd = ct.x10Def(); String pat = er.getJavaRTTRep(cd); - for (int i = 0; i < ct.typeArguments().size(); i++) { - w.write(", "); -// if (i == 0) w.write("new x10.rtt.Type[] {"); - new RuntimeTypeExpander(er, ct.typeArguments().get(i)).expand(tr); -// if (i == ct.typeArguments().size() - 1 ) w.write("}"); + if (pat == null && er.getJavaRep(cd) == null) { + for (int i = 0; i < ct.typeArguments().size(); i++) { + w.write(", "); + new RuntimeTypeExpander(er, ct.typeArguments().get(i)).expand(tr); + } } } w.write(")"); Modified: trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-04-23 21:51:47 UTC (rev 14014) +++ trunk/x10.runtime/src-java/x10/rtt/RuntimeType.java 2010-04-24 09:43:11 UTC (rev 14015) @@ -143,7 +143,8 @@ Type<?>[] newParamsT = new Type<?>[paramsT.length]; for (int i = 0; i < paramsT.length; i ++ ) { if (paramsT[i] != null && paramsT[i] instanceof UnresolvedType) { - newParamsT[i] = any.getParam(((UnresolvedType) paramsT[i]).index); + int index = ((UnresolvedType) paramsT[i]).index; + newParamsT[i]= index == -1 ? rtt : any.getParam(index); } else { newParamsT[i] = paramsT[i]; @@ -168,7 +169,8 @@ Type<?>[] newParamsT = new Type<?>[paramsT.length]; for (int i = 0; i < paramsT.length; i ++ ) { if (paramsT[i] != null && paramsT[i] instanceof UnresolvedType) { - newParamsT[i] = paramsRTT[((UnresolvedType) paramsT[i]).index]; + int index = ((UnresolvedType) paramsT[i]).index; + newParamsT[i] = index == -1 ? rtt : paramsRTT[index]; } else { newParamsT[i] = paramsT[i]; Modified: trunk/x10.runtime/src-x10/x10/lang/Rail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2010-04-23 21:51:47 UTC (rev 14014) +++ trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2010-04-24 09:43:11 UTC (rev 14015) @@ -23,7 +23,7 @@ * future Rail may be deprecated in favor of single-place, zero-based linear * specialization of the array library. */ -@NativeRep("java", "x10.core.Rail<#1>", "x10.core.Rail.BoxedRail", "x10.core.Rail._RTT") +@NativeRep("java", "x10.core.Rail<#1>", "x10.core.Rail.BoxedRail", "new x10.rtt.ParameterizedType(x10.core.Rail._RTT, #2)") @NativeRep("c++", "x10aux::ref<x10::lang::Rail<#1 > >", "x10::lang::Rail<#1 >", null) public final class Rail[T](length: Int) implements Settable[Int,T], Iterable[T] Modified: trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 2010-04-23 21:51:47 UTC (rev 14014) +++ trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 2010-04-24 09:43:11 UTC (rev 14015) @@ -19,7 +19,7 @@ * supporting constant-time access by integer index. See x10.lang.Rail for a comparison with * arrays in X10 and other languages. */ -@NativeRep("java", "x10.core.ValRail<#1>", "x10.core.ValRail.BoxedValRail", "x10.core.ValRail._RTT") +@NativeRep("java", "x10.core.ValRail<#1>", "x10.core.ValRail.BoxedValRail", "new x10.rtt.ParameterizedType(x10.core.ValRail._RTT, #2)") @NativeRep("c++", "x10aux::ref<x10::lang::ValRail<#1 > >", "x10::lang::ValRail<#1 >", null) public final class ValRail[+T](length: Int) implements (Int) => T, Iterable[T] { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-04-26 23:01:51
|
Revision: 14029 http://x10.svn.sourceforge.net/x10/?rev=14029&view=rev Author: ipeshansky Date: 2010-04-26 23:01:45 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Put X10 MetaDebugInfo into the _X10_DEBUG section. Put other X10 debug data structures (except _X10methodNameList -- see code comment) into the _X10_DEBUG_DATA section. Generate line number information for blocks. Minor fix to the API spec. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/debug/LineNumberMap.java trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java trunk/x10.runtime/src-cpp/x10aux/debug.h Modified: trunk/x10.compiler/src/x10cpp/debug/LineNumberMap.java =================================================================== --- trunk/x10.compiler/src/x10cpp/debug/LineNumberMap.java 2010-04-26 20:44:26 UTC (rev 14028) +++ trunk/x10.compiler/src/x10cpp/debug/LineNumberMap.java 2010-04-26 23:01:45 UTC (rev 14029) @@ -489,6 +489,9 @@ } } + private static final String _X10_DEBUG = "_X10_DEBUG"; + private static final String _X10_DEBUG_DATA = "_X10_DEBUG_DATA"; + /** * Generates code for the line number map as required by the Toronto C++ * Debugger backend into the specified stream. @@ -496,11 +499,13 @@ * @param m the map to export */ public static void exportForCPPDebugger(ClassifiedStream w, LineNumberMap m) { + String debugSectionAttr = "__attribute__((section(\""+_X10_DEBUG+"\")))"; + String debugDataSectionAttr = "__attribute__((section(\""+_X10_DEBUG_DATA+"\")))"; int size = m.size(); int offset = 0; int[] offsets = new int[size]; // All strings, concatenated, with intervening nulls. - w.writeln("static const char _X10strings[] __attribute__((used)) ="); + w.writeln("static const char _X10strings[] __attribute__((used)) "+debugDataSectionAttr+" ="); for (int i = 0; i < size; i++) { offsets[i] = offset; String s = m.lookupString(i); @@ -513,7 +518,7 @@ if (!m.isEmpty()) { String[] files = m.allFiles(); // A list of X10 source files that contributed to the generation of the current C++ file. - w.writeln("static const struct _X10sourceFile _X10sourceList[] __attribute__((used)) = {"); + w.writeln("static const struct _X10sourceFile _X10sourceList[] __attribute__((used)) "+debugDataSectionAttr+" = {"); for (int i = 0; i < files.length; i++) { w.write(" { "); w.write(""+0+", "); // FIXME: _numLines @@ -536,7 +541,7 @@ // p.start_line)); // _CPPline // } // Collections.sort(x10toCPPlist, CPPLineInfo.byX10info()); -// w.writeln("static const struct _X10toCPPxref _X10toCPPlist[] __attribute__((used)) = {"); +// w.writeln("static const struct _X10toCPPxref _X10toCPPlist[] __attribute__((used)) "+debugDataSectionAttr+" = {"); // for (CPPLineInfo cppDebugInfo : x10toCPPlist) { // w.write(" { "); // w.write(""+cppDebugInfo.x10index+", "); // _X10index @@ -564,7 +569,7 @@ p.end_line)); // _CPPtoline } Collections.sort(cpptoX10xrefList, CPPLineInfo.byCPPinfo()); - w.writeln("static const struct _CPPtoX10xref _CPPtoX10xrefList[] = {"); + w.writeln("static const struct _CPPtoX10xref _CPPtoX10xrefList[] __attribute__((used)) "+debugDataSectionAttr+" = {"); for (CPPLineInfo cppDebugInfo : cpptoX10xrefList) { w.write(" { "); w.write(""+cppDebugInfo.x10index+", "); // _X10index @@ -594,6 +599,8 @@ 0)); // FIXME: _lineIndex } Collections.sort(x10MethodList); + // FIXME: Cannot put _X10methodNameList in debugDataSectionAttr, because it's not constant + // (the strings cause static initialization for some reason) w.writeln("static const struct _X10methodName _X10methodNameList[] __attribute__((used)) = {"); for (CPPMethodInfo cppMethodInfo : x10MethodList) { w.write(" { "); @@ -615,7 +622,7 @@ } // A meta-structure that refers to all of the above - w.write("static const struct _MetaDebugInfo_t _MetaDebugInfo __attribute__((used)) = {"); + w.write("static const struct _MetaDebugInfo_t _MetaDebugInfo __attribute__((used)) "+debugSectionAttr+" = {"); w.newline(4); w.begin(0); w.writeln("sizeof(struct _MetaDebugInfo_t),"); w.writeln("X10_META_LANG,"); Modified: trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-04-26 20:44:26 UTC (rev 14028) +++ trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java 2010-04-26 23:01:45 UTC (rev 14029) @@ -46,6 +46,7 @@ import polyglot.ast.SourceCollection; import polyglot.ast.SourceFile; import polyglot.ast.Stmt; +import polyglot.ast.SwitchBlock; import polyglot.ast.TopLevelDecl; import polyglot.ast.Try; @@ -134,6 +135,8 @@ return outputLine; if (n instanceof Eval || n instanceof Branch || n instanceof Try) return outputLine; + if (n instanceof Block) + return outputLine; return outputLine - 1; } @@ -166,7 +169,7 @@ final int endLine = w.currentStream().getStreamLineNumber(); // for debug info if (x10.Configuration.DEBUG && line > 0 && - ((n instanceof Stmt && !(n instanceof Block) && !(n instanceof Catch)) || + ((n instanceof Stmt && !(n instanceof SwitchBlock) && !(n instanceof Catch)) || (n instanceof ClassMember))) { final String cppFile = w.getStreamName(w.currentStream().ext); Modified: trunk/x10.runtime/src-cpp/x10aux/debug.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/debug.h 2010-04-26 20:44:26 UTC (rev 14028) +++ trunk/x10.runtime/src-cpp/x10aux/debug.h 2010-04-26 23:01:45 UTC (rev 14029) @@ -26,11 +26,8 @@ // static const char _X10strings[] = {}; // // All strings, concatenated, with intervening nulls. // // e.g., for the strings "aa", "bb", and "cc" , this variable would contain "aa\0bb\0ccc". -// static const struct _X10sourceFile _X10sourceList[]; +// static const struct _X10sourceFile _X10sourceList[] = {}; // // A list of X10 source files that contributed to the generation of the current C++ file. -// static const struct _X10toCPPxref _X10toCPPlist[] = {}; -// // A cross reference of X10 statements to the first C++ statement. -// // Sorted by X10 file index and X10 source file line. // static const struct _CPPtoX10xref _CPPtoX10xrefList[] = {}; // // A cross reference of C++ statements to X10 statements. // // Sorted by C++ file index and C++ source file line. @@ -43,12 +40,12 @@ // X10_META_LANG, // sizeof(_X10strings), // sizeof(_X10sourceList), -// sizeof(_X10toCPPlist), +// 0, // sizeof(_CPPtoX10xrefList), // sizeof(_X10methodNameList), // _X10strings, // _X10sourceList, -// _X10toCPPlist, +// NULL, // _CPPtoX10xrefList, // _X10methodNameList // }; @@ -89,7 +86,7 @@ // of the corresponding argument in _X10strings uint32_t _cppClass; // Index of the C++ class name in _X10strings uint16_t _x10argCount; // The number of X10 arguments - uint16_t _lineIndex; // Index into _X10toCPPlist of the first line of the method + uint16_t _lineIndex; // Index into _CPPtoX10xrefList of the first line of the method }; enum _MetaLanguage { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ipe...@us...> - 2010-05-05 15:47:20
|
Revision: 14081 http://x10.svn.sourceforge.net/x10/?rev=14081&view=rev Author: ipeshansky Date: 2010-05-05 15:47:14 +0000 (Wed, 05 May 2010) Log Message: ----------- Sreedhar's patches to enable shared library build on AIX with xlC. Enable shared libs on AIX by default. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java trunk/x10.runtime/Make.rules Modified: trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-05-04 17:46:15 UTC (rev 14080) +++ trunk/x10.compiler/src/x10cpp/postcompiler/AIX_CXXCommandBuilder.java 2010-05-05 15:47:14 UTC (rev 14081) @@ -26,8 +26,11 @@ super.addPreArgs(cxxCmd); if (USE_XLC) { - cxxCmd.add("-qrtti=all"); // AIX specific. - cxxCmd.add("-bmaxdata:0x80000000"); + cxxCmd.add("-qrtti=all"); // AIX specific. + if (USE_32BIT) { + cxxCmd.add("-bmaxdata:0x80000000"); + } + cxxCmd.add("-brtl"); // AIX specific. } else { cxxCmd.add("-Wno-long-long"); cxxCmd.add("-Wno-unused-parameter"); Modified: trunk/x10.runtime/Make.rules =================================================================== --- trunk/x10.runtime/Make.rules 2010-05-04 17:46:15 UTC (rev 14080) +++ trunk/x10.runtime/Make.rules 2010-05-05 15:47:14 UTC (rev 14081) @@ -75,16 +75,14 @@ else ifeq ($(shell uname -s),AIX) - ifndef X10_SHARED_LIB_DEFAULT_OVERRIDE - export X10_STATIC_LIB=1 - endif - ifdef USE_GCC export X10RT_PLATFORM=aix_gcc ifdef OPTIMIZE override CXXFLAGS += -O2 -finline-functions endif override CXXFLAGS += -maix64 + override CXXFLAGS_SHARED += -shared -fPIC -Wl,-bexpall -Wl,-berok -Wl,-bnoentry + override LDFLAGS += -Wl,-brtl MPICXX ?= mpicxx else export X10RT_PLATFORM=aix_xlc @@ -96,6 +94,9 @@ else override CXXFLAGS += -q32 endif + override CXXFLAGS_SHARED += -G -bbigtoc +# override CXXFLAGS_SHARED += -qmkshrobj -berok -brtl -bnortllib -bnosymbolic -bnoautoexp -bM:SRE -bnoentry + override LDFLAGS += -brtl ifdef OPTIMIZE override CXXFLAGS += -O3 -qinline -qarch=pwr5 -qtune=pwr5 -qhot endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2010-05-09 16:54:07
|
Revision: 14110 http://x10.svn.sourceforge.net/x10/?rev=14110&view=rev Author: vj0 Date: 2010-05-09 16:53:51 +0000 (Sun, 09 May 2010) Log Message: ----------- Merged Interface.java and Interface_c.java files in the constraint system, thus undoing a Polyglot inspired pattern. Hopefully this will make the code simpler to understand and maintain Modified Paths: -------------- trunk/x10.compiler/.classpath trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode_c.java trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/AtEach_c.java trunk/x10.compiler/src/x10/ast/AtExpr_c.java trunk/x10.compiler/src/x10/ast/AtStmt_c.java trunk/x10.compiler/src/x10/ast/Closure_c.java trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java trunk/x10.compiler/src/x10/ast/Here_c.java trunk/x10.compiler/src/x10/ast/Tuple_c.java trunk/x10.compiler/src/x10/ast/TypeDecl_c.java trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10CharLit_c.java trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java trunk/x10.compiler/src/x10/ast/X10IntLit_c.java trunk/x10.compiler/src/x10/ast/X10Local_c.java trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/ast/X10StringLit_c.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/types/ClosureDef_c.java trunk/x10.compiler/src/x10/types/ConstrainedType_c.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/TypeDef_c.java trunk/x10.compiler/src/x10/types/TypeParamSubst.java trunk/x10.compiler/src/x10/types/X10ClassDef_c.java trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java trunk/x10.compiler/src/x10/types/X10Context.java trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10FieldDef_c.java trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java trunk/x10.compiler/src/x10/types/X10InitializerDef_c.java trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java trunk/x10.compiler/src/x10/types/X10MemberDef.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/X10XLocal_c.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.compiler/src/x10/types/checker/PlaceChecker.java trunk/x10.compiler/src/x10/types/constraints/CConstraint.java trunk/x10.compiler/src/x10/types/constraints/SubtypeConstraint.java trunk/x10.compiler/src/x10/types/constraints/TypeConstraint.java trunk/x10.compiler/src/x10/types/constraints/XConstrainedTerm.java trunk/x10.compiler/src/x10/types/matcher/Matcher.java trunk/x10.compiler/src/x10/types/matcher/Subst.java trunk/x10.compiler/src/x10/types/matcher/X10FieldMatcher.java trunk/x10.compiler/src/x10/util/ClosureSynthesizer.java trunk/x10.compiler/src/x10/util/Struct.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/ConstantPropagator.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.constraints/src/x10/constraint/XAnd.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XDisEquals.java trunk/x10.constraints/src/x10/constraint/XEQV.java trunk/x10.constraints/src/x10/constraint/XEquals.java trunk/x10.constraints/src/x10/constraint/XField.java trunk/x10.constraints/src/x10/constraint/XFormula.java trunk/x10.constraints/src/x10/constraint/XLit.java trunk/x10.constraints/src/x10/constraint/XLocal.java trunk/x10.constraints/src/x10/constraint/XNot.java trunk/x10.constraints/src/x10/constraint/XPromise_c.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerms.java trunk/x10.constraints/src/x10/constraint/XVar.java trunk/x10.runtime/src-java/x10/rtt/ConstrainedType.java Added Paths: ----------- trunk/x10.constraints/src/x10/constraint/XArrayElement.java.aside trunk/x10.constraints/src/x10/constraint/XArrayElement_c.java.aside trunk/x10.constraints/src/x10/constraint/XMinus.java trunk/x10.constraints/src/x10/constraint/XMod.java trunk/x10.constraints/src/x10/constraint/XPlus.java trunk/x10.constraints/src/x10/constraint/XRef.java trunk/x10.constraints/src/x10/constraint/XSubst.java Removed Paths: ------------- trunk/x10.compiler/src/x10/types/constraints/CConstraint_c.java trunk/x10.compiler/src/x10/types/constraints/SubtypeConstraint_c.java trunk/x10.compiler/src/x10/types/constraints/TypeConstraint_c.java trunk/x10.constraints/src/x10/constraint/ThisVar.java trunk/x10.constraints/src/x10/constraint/XAnd_c.java trunk/x10.constraints/src/x10/constraint/XArray.java trunk/x10.constraints/src/x10/constraint/XArrayElement.java trunk/x10.constraints/src/x10/constraint/XArrayElement_c.java trunk/x10.constraints/src/x10/constraint/XArray_c.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XDisEquals_c.java trunk/x10.constraints/src/x10/constraint/XEQV_c.java trunk/x10.constraints/src/x10/constraint/XEquals_c.java trunk/x10.constraints/src/x10/constraint/XField_c.java trunk/x10.constraints/src/x10/constraint/XFormula_c.java trunk/x10.constraints/src/x10/constraint/XLit_c.java trunk/x10.constraints/src/x10/constraint/XLocal_c.java trunk/x10.constraints/src/x10/constraint/XMinus_c.java trunk/x10.constraints/src/x10/constraint/XMod_c.java trunk/x10.constraints/src/x10/constraint/XNot_c.java trunk/x10.constraints/src/x10/constraint/XPlus_c.java trunk/x10.constraints/src/x10/constraint/XRef_c.java trunk/x10.constraints/src/x10/constraint/XRoot.java trunk/x10.constraints/src/x10/constraint/XSubst_c.java trunk/x10.constraints/src/x10/constraint/XTerm_c.java trunk/x10.constraints/src/x10/constraint/XVar_c.java Modified: trunk/x10.compiler/.classpath =================================================================== --- trunk/x10.compiler/.classpath 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/.classpath 2010-05-09 16:53:51 UTC (rev 14110) @@ -4,5 +4,11 @@ <classpathentry excluding="src/" including="data/**" kind="src" path=""/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry combineaccessrules="false" kind="src" path="/polyglot"/> + <classpathentry combineaccessrules="false" kind="src" path="/polyglot.bytecode"/> + <classpathentry combineaccessrules="false" kind="src" path="/x10.common"/> + <classpathentry combineaccessrules="false" kind="src" path="/x10.constraints"/> + <classpathentry combineaccessrules="false" kind="src" path="/lpg.generator.macosx_x86_64"/> + <classpathentry combineaccessrules="false" kind="src" path="/lpg.runtime.java"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -54,7 +54,6 @@ import polyglot.visit.PrettyPrinter; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; -import x10.constraint.XRoot; import x10.constraint.XTerms; import x10.constraint.XVar; import x10.errors.Errors; @@ -235,7 +234,7 @@ X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10Context c = (X10Context) tc.context(); - XRoot thisVar = c.thisVar(); + XVar thisVar = c.thisVar(); List<Type> typeArgs = new ArrayList<Type>(this.typeArgs.size()); Modified: trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -38,8 +38,8 @@ import polyglot.visit.NodeVisitor; import x10.constraint.XFailure; -import x10.constraint.XRef_c; -import x10.constraint.XRoot; +import x10.constraint.XRef; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XVar; import x10.errors.Errors; @@ -50,7 +50,7 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; /** * @author vj @@ -199,11 +199,11 @@ { CConstraint known = Types.get(thisConstructor.supClause()); - known = (known==null ? new CConstraint_c() : known.copy()); + known = (known==null ? new CConstraint() : known.copy()); try { known.addIn(Types.get(thisConstructor.guard())); - XRoot thisVar = thisConstructor.thisVar(); + XVar thisVar = thisConstructor.thisVar(); for (int i = 0; i < arguments.size(); i++) { Expr initializer = arguments.get(i); Modified: trunk/x10.compiler/src/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/Async_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -37,7 +37,6 @@ import polyglot.visit.PrettyPrinter; import polyglot.visit.PruningVisitor; import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.constraint.XTerms; Modified: trunk/x10.compiler/src/x10/ast/AtEach_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -34,7 +34,7 @@ import x10.types.X10Context; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.XConstrainedTerm; /** @@ -78,7 +78,7 @@ // FIXME: this creates a new place term; ideally, it should be the place associated with each // point in the ateach distribution if (placeTerm == null) { - CConstraint d = new CConstraint_c(); + CConstraint d = new CConstraint(); XTerm term = PlaceChecker.makePlace(); placeTerm = XConstrainedTerm.instantiate(d, term); } Modified: trunk/x10.compiler/src/x10/ast/AtExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtExpr_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/AtExpr_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -33,7 +33,6 @@ import polyglot.visit.PrettyPrinter; import polyglot.visit.PruningVisitor; import polyglot.visit.ReachChecker; -import x10.constraint.XConstraint_c; import x10.constraint.XTerm; import x10.types.ClosureDef; import x10.types.X10Context; Modified: trunk/x10.compiler/src/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -42,9 +42,8 @@ import polyglot.visit.PrettyPrinter; import polyglot.visit.PruningVisitor; import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.types.ClosureDef; import x10.types.X10Context; @@ -156,7 +155,7 @@ if (c.currentCode() instanceof X10MethodDef) { X10MethodDef outer = (X10MethodDef) c.currentCode(); - XRoot thisVar = outer.thisVar(); + XVar thisVar = outer.thisVar(); asyncInstance.setThisVar(thisVar); List<Ref<? extends Type>> capturedTypes = outer.typeParameters(); if (!capturedTypes.isEmpty()) { Modified: trunk/x10.compiler/src/x10/ast/Closure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Closure_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/Closure_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -56,7 +56,7 @@ import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; import x10.constraint.XConstraint; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerms; import x10.types.ClosureDef; import x10.types.X10ClassDef; @@ -268,7 +268,7 @@ CodeDef code = (CodeDef) def; // Get the enclosing this variable. - XRoot thisVar; // = XTerms.makeLocal(XTerms.makeFreshName("this")); + XVar thisVar; // = XTerms.makeLocal(XTerms.makeFreshName("this")); if (code instanceof X10MemberDef) { thisVar = ((X10MemberDef) code).thisVar(); Modified: trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -42,9 +42,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.TypeConstraint_c; import x10.visit.X10TypeChecker; /** An immutable representation of a dependent type constraint. @@ -159,8 +158,8 @@ public Node buildTypes(TypeBuilder tb) throws SemanticException { DepParameterExpr_c n = (DepParameterExpr_c) copy(); - n.valueConstraint = Types.<CConstraint>lazyRef(new CConstraint_c(), new SetResolverGoal(tb.job())); - n.typeConstraint = Types.<TypeConstraint>lazyRef(new TypeConstraint_c(), new SetResolverGoal(tb.job())); + n.valueConstraint = Types.<CConstraint>lazyRef(new CConstraint(), new SetResolverGoal(tb.job())); + n.typeConstraint = Types.<TypeConstraint>lazyRef(new TypeConstraint(), new SetResolverGoal(tb.job())); return n; } Modified: trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -49,7 +49,7 @@ import x10.types.X10ClassType; import x10.types.X10TypeSystem; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.visit.X10TypeChecker; public class FunctionTypeNode_c extends TypeNode_c implements FunctionTypeNode { @@ -102,7 +102,7 @@ // typeParams, formalTypes, formalNames, guard != null ? guard.valueConstraint() - : Types.<CConstraint>lazyRef(new CConstraint_c()), + : Types.<CConstraint>lazyRef(new CConstraint()), // guard != null ? guard.typeConstraint() : null, throwTypes); Modified: trunk/x10.compiler/src/x10/ast/Here_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Here_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/Here_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -32,7 +32,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.XConstrainedTerm; @@ -80,7 +80,7 @@ Type tt = ts.Place(); XConstrainedTerm h = xc.currentPlaceTerm(); if (h != null) { - CConstraint cc = new CConstraint_c(); + CConstraint cc = new CConstraint(); try { cc.addSelfBinding(xc.currentPlaceTerm()); } Modified: trunk/x10.compiler/src/x10/ast/Tuple_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Tuple_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/Tuple_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -41,7 +41,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; /** * An immutable representation of the X10 rail constructor [e1, ..., ek]. @@ -173,7 +173,7 @@ Type r = ts.ValRail(); Type t = (X10ClassType) X10TypeMixin.instantiate(r, type); - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); FieldInstance lengthField = ((X10ClassType) t).fieldNamed(Name.make("length")); if (lengthField == null) throw new InternalCompilerError("Could not find length field of " + t, position()); Modified: trunk/x10.compiler/src/x10/ast/TypeDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -44,7 +44,7 @@ import polyglot.visit.TypeBuilder; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.extension.X10Del_c; import x10.types.AnnotatedType; import x10.types.ConstrainedType; @@ -56,7 +56,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; public class TypeDecl_c extends Term_c implements TypeDecl { private TypeNode type; @@ -230,7 +230,7 @@ */ TypeDef typeDef; - XRoot thisVar = ct != null ? ct.thisVar() : null; + XVar thisVar = ct != null ? ct.thisVar() : null; if (local) { typeDef = new TypeDef_c(ts, position(), Flags.NONE, name.id(), null, @@ -267,11 +267,11 @@ List<LocalDef> formalNames = new ArrayList<LocalDef>(); for (Formal f : n.formals()) { final Formal f2 = f; - final LazyRef<CConstraint> cref = Types.<CConstraint>lazyRef(new CConstraint_c()); + final LazyRef<CConstraint> cref = Types.<CConstraint>lazyRef(new CConstraint()); Type t = X10TypeMixin.xclause(f.type().typeRef(), cref); cref.setResolver(new Runnable() { public void run() { - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); try { c.addSelfBinding(ts.xtypeTranslator().trans(f2.localDef().asInstance())); } Modified: trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -25,7 +25,6 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; /** * @author vj @@ -46,7 +45,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type Boolean = xts.Boolean(); - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Boolean), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -64,7 +64,7 @@ import polyglot.visit.TypeChecker; import x10.constraint.XConstraint; import x10.constraint.XLocal; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.errors.Errors; import x10.errors.Errors.PlaceTypeErrorMethodShouldBeLocalOrGlobal; import x10.parser.X10ParsedName; @@ -152,7 +152,7 @@ // Override to change the type from C to C{self==this}. Type t = currentClass; X10TypeSystem xts = (X10TypeSystem) ts; - XRoot thisVar = null; + XVar thisVar = null; if (XTypeTranslator.THIS_VAR) { CodeDef cd = xc.currentCode(); if (cd instanceof X10MemberDef) { @@ -324,7 +324,7 @@ Receiver r; if (mi.flags().isStatic()) { Type container = findContainer(ts, mi); - XRoot this_ = getThis(container); + XVar this_ = getThis(container); if (this_ != null) container = X10TypeMixin.setSelfVar(container, this_); r = nf.CanonicalTypeNode(position().startOf(), container).typeRef(Types.ref(container)); @@ -338,7 +338,7 @@ if (! ts.typeEquals(scope, c.currentClass(), c)) { - XRoot this_ = getThis(scope); + XVar this_ = getThis(scope); if (this_ != null) scope = X10TypeMixin.setSelfVar(scope, this_); r = (Special) nf.This(position().startOf(), @@ -366,7 +366,7 @@ + " must be declared as a proto method since it is called on a receiver " + target() + " with a proto type."); } - XRoot getThis(Type t) { + XVar getThis(Type t) { t = X10TypeMixin.baseType(t); if (t instanceof X10ClassType) { return ((X10ClassType) t).x10Def().thisVar(); Modified: trunk/x10.compiler/src/x10/ast/X10CharLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10CharLit_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10CharLit_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -24,8 +24,8 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; + /** * An immutable representation of a char lit, modified from JL * to support a self-clause in the dep type. @@ -45,7 +45,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type charType = xts.Char(); - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); XTerm term = xts.xtypeTranslator().trans(c, this.type(charType), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -43,7 +43,7 @@ import polyglot.util.TypedList; import polyglot.visit.ContextVisitor; import polyglot.ast.ClassBody_c; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.types.ClosureDef; import x10.types.MacroType; import x10.types.ParameterType; Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -86,7 +86,7 @@ import polyglot.visit.TypeChecker; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.errors.Errors; import x10.extension.X10Del; @@ -110,9 +110,8 @@ import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.TypeConstraint_c; import x10.types.constraints.XConstrainedTerm; import x10.util.Synthesizer; /** @@ -451,14 +450,14 @@ final DepParameterExpr ci = (DepParameterExpr) n.visitChild(n.classInvariant, childTb); n = (X10ClassDecl_c) n.classInvariant(ci); - final LazyRef<CConstraint> c = new LazyRef_c<CConstraint>(new CConstraint_c()); + final LazyRef<CConstraint> c = new LazyRef_c<CConstraint>(new CConstraint()); final X10ClassDecl_c nn = n; // Add all the constraints on the supertypes into the invariant. c.setResolver(new Runnable() { public void run() { - CConstraint x = new CConstraint_c(); + CConstraint x = new CConstraint(); try { if (ci != null) { CConstraint xi = ci.valueConstraint().get(); @@ -497,13 +496,13 @@ def.setClassInvariant(c); - final LazyRef<TypeConstraint> tc = new LazyRef_c<TypeConstraint>(new TypeConstraint_c()); + final LazyRef<TypeConstraint> tc = new LazyRef_c<TypeConstraint>(new TypeConstraint()); // Set the type bounds for the def. tc.setResolver(new Runnable() { public void run() { - TypeConstraint x = new TypeConstraint_c(); + TypeConstraint x = new TypeConstraint(); if (ci != null) { Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -48,8 +48,8 @@ import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRef_c; -import x10.constraint.XRoot; +import x10.constraint.XRef; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -375,7 +375,7 @@ Type t = tc.context().currentClass(); CConstraint dep = X10TypeMixin.xclause(t); if (c != null && dep != null) { - XRoot thisVar = ((X10MemberDef) constructorDef()).thisVar(); + XVar thisVar = ((X10MemberDef) constructorDef()).thisVar(); if (thisVar != null) dep = dep.substitute(thisVar, c.self()); // dep = dep.copy(); Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -39,7 +39,7 @@ import polyglot.visit.ContextVisitor; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -57,7 +57,7 @@ import x10.types.X10TypeSystem; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.matcher.Subst; import x10.errors.Errors; @@ -177,10 +177,10 @@ // therefore we temporarily replace this.home with a new UQV, currentPlace, and then on // return from the matcher, substitute it back in. XTerm placeTerm = c.currentPlaceTerm()==null ? null: c.currentPlaceTerm().term(); - XRoot currentPlace = XTerms.makeUQV("place"); + XVar currentPlace = XTerms.makeUQV("place"); try { - Type tType2 = placeTerm==null ? tType : Subst.subst(tType, currentPlace, (XRoot) placeTerm); + Type tType2 = placeTerm==null ? tType : Subst.subst(tType, currentPlace, (XVar) placeTerm); X10FieldInstance fi = (X10FieldInstance) ts.findField(tType, ts.FieldMatcher(tType2, X10TypeMixin.contextKnowsType(target), name.id(), c)); if (fi == null) { @@ -221,7 +221,7 @@ // Check the guard CConstraint guard = ((X10FieldInstance) result.fieldInstance()).guard(); - if (guard != null && ! new CConstraint_c().entails(guard, + if (guard != null && ! new CConstraint().entails(guard, c.constraintProjection(guard))) { throw new SemanticException("Cannot access field. Field guard not satisfied.", position()); } @@ -275,7 +275,7 @@ if (receiver == null) receiver = XTerms.makeEQV(); - t = Subst.subst(t, (new XVar[] { receiver }), (new XRoot[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); + t = Subst.subst(t, (new XVar[] { receiver }), (new XVar[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); } } return t; @@ -294,7 +294,7 @@ try { XVar receiver = X10TypeMixin.selfVarBinding(target.type()); //assert receiver != null; - XRoot root = null; + XVar root = null; if (receiver == null) { receiver = root = XTerms.makeUQV(); Modified: trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -25,8 +25,8 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; + /** * An immutable representation of a float lit, modified from JL * to support a self-clause in the dep type. @@ -48,7 +48,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type Type = (kind==FLOAT ? xts.Float() : xts.Double()); - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10IntLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10IntLit_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10IntLit_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -26,7 +26,7 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import polyglot.ast.IntLit; import polyglot.ast.IntLit.Kind; @@ -87,7 +87,7 @@ else { throw new InternalCompilerError("bad integer literal kind", position()); } - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10Local_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Local_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10Local_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -44,7 +44,7 @@ import x10.types.X10TypeSystem; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; public class X10Local_c extends Local_c { @@ -105,7 +105,7 @@ Type t = result.type(); CConstraint dep = X10TypeMixin.xclause(t); - if (dep == null) dep = new CConstraint_c(); + if (dep == null) dep = new CConstraint(); else dep = dep.copy(); // XTerm resultTerm = xts.xtypeTranslator().trans(result); // dep.addSelfBinding((XVar) resultTerm); Modified: trunk/x10.compiler/src/x10/ast/X10Loop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -45,7 +45,7 @@ import polyglot.visit.TypeChecker; import x10.constraint.XFailure; import x10.constraint.XName; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -403,7 +403,7 @@ XVar selfValue = X10TypeMixin.selfVarBinding(domainType); XVar selfVar = c != null ? c.self() : null; - XRoot thisVar = base instanceof X10ClassType ? + XVar thisVar = base instanceof X10ClassType ? ((X10ClassType) base).x10Def().thisVar() :null; if (thisVar != null && selfVar != null) Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -84,8 +84,8 @@ import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRef_c; -import x10.constraint.XRoot; +import x10.constraint.XRef; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; @@ -863,7 +863,7 @@ Type t = tc.context().currentClass(); CConstraint dep = X10TypeMixin.xclause(t); if (c != null && dep != null) { - XRoot thisVar = ((X10MemberDef) methodDef()).thisVar(); + XVar thisVar = ((X10MemberDef) methodDef()).thisVar(); if (thisVar != null) dep = dep.substitute(thisVar, c.self()); // dep = dep.copy(); Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -23,9 +23,8 @@ import polyglot.util.Position; import polyglot.visit.ContextVisitor; import x10.constraint.XFailure; -import x10.constraint.XRoot; -import x10.constraint.XTerm; import x10.constraint.XVar; +import x10.constraint.XTerm; import x10.types.X10ConstructorDef; import x10.types.X10Context; import x10.types.X10Flags; @@ -37,7 +36,7 @@ import x10.types.XTypeTranslator; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.XConstrainedTerm; public class X10Special_c extends Special_c implements X10Special { @@ -150,7 +149,7 @@ if (kind == THIS) { Type tt = X10TypeMixin.baseType(t); CConstraint cc = X10TypeMixin.xclause(t); - cc = cc == null ? new CConstraint_c() : cc.copy(); + cc = cc == null ? new CConstraint() : cc.copy(); try { XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); cc.addSelfBinding(var); @@ -168,7 +167,7 @@ Type superClass = X10TypeMixin.superClass(t); Type tt = X10TypeMixin.baseType(superClass); CConstraint cc = X10TypeMixin.xclause(superClass); - cc = cc == null ? new CConstraint_c() : cc.copy(); + cc = cc == null ? new CConstraint() : cc.copy(); try { XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); cc.addSelfBinding(var); Modified: trunk/x10.compiler/src/x10/ast/X10StringLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10StringLit_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/ast/X10StringLit_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -26,7 +26,6 @@ import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; /** * @author vj @@ -45,7 +44,7 @@ X10TypeSystem xts= (X10TypeSystem) tc.typeSystem(); Type Type = xts.String(); - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -73,16 +73,16 @@ import x10.ast.TypeParamNode; import x10.ast.X10ClockedLoop; import x10.ast.X10MethodDecl_c; -import x10.constraint.XAnd_c; -import x10.constraint.XEQV_c; -import x10.constraint.XEquals_c; -import x10.constraint.XField_c; -import x10.constraint.XFormula_c; -import x10.constraint.XLit_c; -import x10.constraint.XLocal_c; +import x10.constraint.XAnd; +import x10.constraint.XEQV; +import x10.constraint.XEquals; +import x10.constraint.XField; +import x10.constraint.XFormula; +import x10.constraint.XLit; +import x10.constraint.XLocal; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XNot_c; +import x10.constraint.XNot; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.extension.X10Ext; @@ -682,38 +682,38 @@ w.write("self()"); } else if (term == XTerms.OPERATOR) { w.write(XTERMS + ".OPERATOR"); - } else if (term instanceof XAnd_c) { + } else if (term instanceof XAnd) { w.write(XTERMS + ".makeAnd("); w.begin(0); - serializeTerm(((XAnd_c) term).left(), parent); + serializeTerm(((XAnd) term).left(), parent); w.write(","); w.allowBreak(0, " "); - serializeTerm(((XAnd_c) term).right(), parent); + serializeTerm(((XAnd) term).right(), parent); w.end(); w.write(")"); - } else if (term instanceof XEquals_c) { + } else if (term instanceof XEquals) { w.write(XTERMS + ".makeEquals("); w.begin(0); - serializeTerm(((XEquals_c) term).left(), parent); + serializeTerm(((XEquals) term).left(), parent); w.write(","); w.allowBreak(0, " "); - serializeTerm(((XEquals_c) term).right(), parent); + serializeTerm(((XEquals) term).right(), parent); w.end(); w.write(")"); - } else if (term instanceof XNot_c) { + } else if (term instanceof XNot) { w.write(XTERMS + ".makeNot("); w.begin(0); - serializeTerm(((XNot_c) term).unaryArg(), parent); + serializeTerm(((XNot) term).unaryArg(), parent); w.end(); w.write(")"); - } else if (term instanceof XFormula_c) { - if (!((XFormula_c) term).isAtomicFormula()) + } else if (term instanceof XFormula) { + if (!((XFormula) term).isAtomicFormula()) throw new RuntimeException("Non-atomic formula encountered: " + term); w.write(XTERMS + ".makeAtom("); w.begin(0); - serializeName(((XFormula_c) term).operator()); - List<XTerm> arguments = ((XFormula_c) term).arguments(); + serializeName(((XFormula) term).operator()); + List<XTerm> arguments = ((XFormula) term).arguments(); for (XTerm arg : arguments) { w.write(","); w.allowBreak(0, " "); @@ -728,8 +728,8 @@ .expand(tr); w.end(); w.write(")"); - } else if (term instanceof XLit_c) { - Object val = ((XLit_c) term).val(); + } else if (term instanceof XLit) { + Object val = ((XLit) term).val(); w.write(XTERMS + ".makeLit("); w.begin(0); if (val == null) { @@ -761,28 +761,28 @@ } w.end(); w.write(")"); - } else if (term instanceof XField_c) { + } else if (term instanceof XField) { w.write(XTERMS + ".makeField((x10.constraint.XVar)"); w.begin(0); - serializeTerm(((XField_c) term).receiver(), parent); + serializeTerm(((XField) term).receiver(), parent); w.write(","); w.allowBreak(0, " "); - serializeName(((XField_c) term).field()); + serializeName(((XField) term).field()); w.end(); w.write(")"); - } else if (term instanceof XEQV_c) { + } else if (term instanceof XEQV) { w.write("genEQV("); w.begin(0); - serializeName(((XEQV_c) term).name()); + serializeName(((XEQV) term).name()); w.write(","); w.allowBreak(0, " "); - w.write("" + ((XEQV_c) term).isEQV()); + w.write("" + ((XEQV) term).isEQV()); w.end(); w.write(")"); - } else if (term instanceof XLocal_c) { + } else if (term instanceof XLocal) { w.write(XTERMS + ".makeLocal("); w.begin(0); - serializeName(((XLocal_c) term).name()); + serializeName(((XLocal) term).name()); w.end(); w.write(")"); } else { Modified: trunk/x10.compiler/src/x10/types/ClosureDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/ClosureDef_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/ClosureDef_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -26,7 +26,7 @@ import polyglot.util.CollectionUtil; import polyglot.util.Position; import polyglot.util.TypedList; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; @@ -54,7 +54,7 @@ Ref<? extends Type> returnType, // List<Ref<? extends Type>> typeParams, List<Ref<? extends Type>> formalTypes, - XRoot thisVar, + XVar thisVar, List<LocalDef> formalNames, Ref<CConstraint> guard, // Ref<TypeConstraint> typeGuard, @@ -140,12 +140,12 @@ // this.typeParameters = TypedList.copyAndCheck(typeParameters, Ref.class, true); } - XRoot thisVar; - public XRoot thisVar() { + XVar thisVar; + public XVar thisVar() { return this.thisVar; } - public void setThisVar(XRoot thisVar) { + public void setThisVar(XVar thisVar) { this.thisVar = thisVar; } Modified: trunk/x10.compiler/src/x10/types/ConstrainedType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/ConstrainedType_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -39,12 +39,11 @@ import polyglot.util.Transformation; import polyglot.util.TransformingList; import x10.constraint.XFailure; -import x10.constraint.XRoot; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; /** * 09/11/09 @@ -205,7 +204,7 @@ try { realClause.addIn(depClause); - realClause.setThisVar(CConstraint_c.getThisVar(rootClause, depClause)); + realClause.setThisVar(CConstraint.getThisVar(rootClause, depClause)); } catch (XFailure f) { realClause.setInconsistent(); @@ -325,7 +324,7 @@ public Type transform(Type o) { X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); CConstraint c2 = X10TypeMixin.xclause(o); - c2 = c2 != null ? c2.copy() : new CConstraint_c(); + c2 = c2 != null ? c2.copy() : new CConstraint(); try { if (c2.thisVar() != null) c2.addBinding(c2.thisVar(), tt); @@ -359,7 +358,7 @@ final XTerm t = c.bindingForVar(c.self()); if (t != null) { CConstraint c2 = X10TypeMixin.xclause(o); - c2 = c2 != null ? c2.copy() : new CConstraint_c(); + c2 = c2 != null ? c2.copy() : new CConstraint(); try { X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); c2.addSelfBinding(t); Modified: trunk/x10.compiler/src/x10/types/MacroType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/MacroType_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -45,7 +45,7 @@ import polyglot.util.TransformingList; import polyglot.util.TypedList; import x10.constraint.XNameWrapper; -import x10.constraint.XRef_c; +import x10.constraint.XRef; import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.constraints.CConstraint; Modified: trunk/x10.compiler/src/x10/types/TypeDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/TypeDef_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/TypeDef_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -29,7 +29,7 @@ import polyglot.util.CollectionUtil; import polyglot.util.Position; import polyglot.util.TypedList; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; @@ -52,7 +52,7 @@ public polyglot.ast.TypeNode astNode() { return astNode; } public TypeDef_c(TypeSystem ts, Position pos, Flags flags, Name name, Ref<? extends StructType> container, List<Ref<? extends Type>> typeParams, - XRoot thisVar, List<LocalDef> formalNames, List<Ref<? extends Type>> formalTypes, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, Ref<? extends Type> type) { + XVar thisVar, List<LocalDef> formalNames, List<Ref<? extends Type>> formalTypes, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, Ref<? extends Type> type) { super(ts, pos); this.container = container; @@ -175,12 +175,12 @@ this.type = type; } - XRoot thisVar; - public XRoot thisVar() { + XVar thisVar; + public XVar thisVar() { return this.thisVar; } - public void setThisVar(XRoot thisVar) { + public void setThisVar(XVar thisVar) { this.thisVar = thisVar; } Modified: trunk/x10.compiler/src/x10/types/TypeParamSubst.java =================================================================== --- trunk/x10.compiler/src/x10/types/TypeParamSubst.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/TypeParamSubst.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -26,16 +26,16 @@ import polyglot.util.Transformation; import polyglot.util.TransformingList; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.SubtypeConstraint; -import x10.types.constraints.SubtypeConstraint_c; +import x10.types.constraints.SubtypeConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.TypeConstraint_c; + /** * Comments by vj. * Implements a type substitution [ActualT1,..., ActualTn/FormalX1,..., FormalXn]. @@ -243,7 +243,7 @@ assert typeArguments.size() == n; XTerm[] ys = new XTerm[n]; - XRoot[] xs = new XRoot[n]; + XVar[] xs = new XVar[n]; for (int i = 0; i < n; i++) { ParameterType pt = typeParameters.get(i); @@ -254,8 +254,8 @@ ys[i] = a; - if (p instanceof XRoot) { - xs[i] = (XRoot) p; + if (p instanceof XVar) { + xs[i] = (XVar) p; } else { xs[i] = XTerms.makeLit(XTerms.makeName("error")); @@ -268,7 +268,7 @@ result = c.substitute(ys, xs); } catch (XFailure e) { - result = new CConstraint_c(); + result = new CConstraint(); result.setInconsistent(); } @@ -293,9 +293,9 @@ Type t2 = s.supertype(); Type t1_ = reinstantiate(t1); Type t2_ = reinstantiate(t2); - terms.add(new SubtypeConstraint_c(t1_, t2_, s.isEqualityConstraint())); + terms.add(new SubtypeConstraint(t1_, t2_, s.isEqualityConstraint())); } - TypeConstraint_c c_ = new TypeConstraint_c(); + TypeConstraint c_ = new TypeConstraint(); c_.addTerms(terms); c = c_; } @@ -318,8 +318,8 @@ XTerm p = ts.xtypeTranslator().trans(pt); XTerm a = ts.xtypeTranslator().trans(at); - if (p instanceof XRoot) { - t = t.subst(p, (XRoot) a); + if (p instanceof XVar) { + t = t.subst(p, (XVar) a); } } Modified: trunk/x10.compiler/src/x10/types/X10ClassDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ClassDef_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/X10ClassDef_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -39,16 +39,16 @@ import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; public class X10ClassDef_c extends ClassDef_c implements X10ClassDef { protected List<ParameterType.Variance> variances; - XRoot thisVar; + XVar thisVar; public X10ClassDef_c(TypeSystem ts, Source fromSource) { super(ts, fromSource); @@ -58,7 +58,7 @@ this.thisVar = null; } - public XRoot thisVar() { + public XVar thisVar() { if (thisVar == null) { String fullNameWithThis = fullName() + "#this"; XName thisName = new XNameWrapper<Object>(new Object(), fullNameWithThis); @@ -67,7 +67,7 @@ return this.thisVar; } - public void setThisVar(XRoot thisVar) { + public void setThisVar(XVar thisVar) { this.thisVar = thisVar; } @@ -152,11 +152,11 @@ public CConstraint getRootClause() { if (rootClause == null) { if (computing) { - /*this.rootClause = Types.<CConstraint>ref(new CConstraint_c()); + /*this.rootClause = Types.<CConstraint>ref(new CConstraint()); this.rootClauseInvalid = new SemanticException("The real clause of " + this + " depends upon itself.", position()); return rootClause.get();*/ - return new CConstraint_c(); + return new CConstraint(); } computing = true; @@ -166,9 +166,9 @@ X10TypeSystem xts = (X10TypeSystem) ts; - CConstraint result = new CConstraint_c(); + CConstraint result = new CConstraint(); - XRoot oldThis = xts.xtypeTranslator().transThisWithoutTypeConstraint(); + XVar oldThis = xts.xtypeTranslator().transThisWithoutTypeConstraint(); try { // Add in constraints from the supertypes. This is @@ -181,7 +181,7 @@ CConstraint rs = X10TypeMixin.realX(type); if (rs != null) { if (rs.thisVar() != null) - rs = rs.substitute(oldThis, (XRoot) rs.thisVar()); + rs = rs.substitute(oldThis, (XVar) rs.thisVar()); result.addIn(rs); } } @@ -202,7 +202,7 @@ // add in the bindings from the property declarations. for (X10FieldDef fi : properties) { Type type = fi.asInstance().type(); // ### check for recursive call here - XRoot fiThis = fi.thisVar(); + XVar fiThis = fi.thisVar(); CConstraint rs = X10TypeMixin.realX(type); if (rs != null) { // Given: C(:c) f @@ -266,13 +266,13 @@ } } catch (XFailure e) { - CConstraint result = new CConstraint_c(); + CConstraint result = new CConstraint(); result.setInconsistent(); this.rootClause = Types.ref(result); this.rootClauseInvalid = new SemanticException(e.getMessage(), position()); } catch (SemanticException e) { - CConstraint result = new CConstraint_c(); + CConstraint result = new CConstraint(); result.setInconsistent(); this.rootClause = Types.ref(result); this.rootClauseInvalid = e; Modified: trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -26,7 +26,7 @@ import polyglot.util.Position; import polyglot.util.TypedList; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; @@ -53,7 +53,7 @@ Ref<? extends ClassType> returnType, List<Ref<? extends Type>> typeParameters, List<Ref<? extends Type>> formalTypes, - XRoot thisVar, List<LocalDef> formalNames, + XVar thisVar, List<LocalDef> formalNames, Ref<CConstraint> guard, Ref<TypeConstraint> typeGuard, List<Ref<? extends Type>> throwTypes) { super(ts, pos, container, flags, formalTypes, throwTypes); @@ -98,12 +98,12 @@ this.returnType = r; } - XRoot thisVar; - public XRoot thisVar() { + XVar thisVar; + public XVar thisVar() { return this.thisVar; } - public void setThisVar(XRoot thisVar) { + public void setThisVar(XVar thisVar) { this.thisVar = thisVar; } Modified: trunk/x10.compiler/src/x10/types/X10Context.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10Context.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/X10Context.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -24,7 +24,7 @@ import polyglot.types.Type; import polyglot.types.VarDef; import x10.constraint.XFailure; -import x10.constraint.XRoot; +import x10.constraint.XVar; import x10.constraint.XTerm; import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; @@ -169,7 +169,7 @@ CodeDef definingCodeDef(Name name); - XRoot thisVar(); + XVar thisVar(); CConstraint constraintProjection(CConstraint... cs) throws XFailure; Modified: trunk/x10.compiler/src/x10/types/X10Context_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10Context_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/X10Context_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -84,15 +84,13 @@ import x10.constraint.XLocal; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XRoot; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.checker.PlaceChecker; import x10.types.constraints.CConstraint; -import x10.types.constraints.CConstraint_c; +import x10.types.constraints.CConstraint; import x10.types.constraints.TypeConstraint; -import x10.types.constraints.TypeConstraint_c; import x10.types.constraints.XConstrainedTerm; public class X10Context_c extends Context_c implements X10Context { @@ -135,7 +133,7 @@ return Collections.EMPTY_LIST; } - public XRoot thisVar() { + public XVar thisVar() { if (this.inSuperTypeDeclaration()) { X10ClassDef t = this.supertypeDeclarationType(); return t.thisVar(); @@ -179,7 +177,7 @@ } if (r == null) - r = new CConstraint_c(); + r = new CConstraint(); // fold in the current constraint addSigma(r, currentConstraint(), m); @@ -202,7 +200,7 @@ /* sigma(Gamma) restricted to the variables mentioned in c */ private CConstraint constraintProjection(CConstraint c, Map<XTerm,CConstraint> m) throws XFailure { - CConstraint r = new CConstraint_c(); + CConstraint r = new CConstraint(); if (c != null) for (XTerm t : c.constraints()) { CConstraint tc = constraintProjection(t, m); @@ -220,7 +218,7 @@ return r; // pre-fill the cache to avoid infinite recursion - m.put(t, new CConstraint_c()); + m.put(t, new CConstraint()); if (t instanceof XLocal) { XLocal v = (XLocal) t; @@ -233,7 +231,7 @@ } CConstraint ci = X10TypeMixin.realX(ty); ci = ci.substitute(v, ci.self()); - r = new CConstraint_c(); + r = new CConstraint(); r.addIn(ci); r.addIn(constraintProjection(ci, m)); } @@ -253,9 +251,9 @@ Type ty = Types.get(fi.type()); ci = X10TypeMixin.realX(ty); ci = ci.substitute(f, ci.self()); - XRoot v = ((X10ClassDef) Types.get(fi.container()).toClass().def()).thisVar(); + XVar v = ((X10ClassDef) Types.get(fi.container()).toClass().def()).thisVar(); ci = ci.substitute(target, v); // xts.xtypeTranslator().transThisWithoutTypeConstraint()); - r = new CConstraint_c(); + r = new CConstraint(); r.addIn(ci); r.addIn(constraintProjection(ci, m)); if (rt != null) { @@ -272,7 +270,7 @@ CConstraint ca = constraintProjection(a, m); if (ca != null) { if (r == null) { - r = new CConstraint_c(); + r = new CConstraint(); } r.addIn(ca); } @@ -285,7 +283,7 @@ if (r != null) m.put(t, r); else - m.put(t, new CConstraint_c()); + m.put(t, new CConstraint()); return r; } @@ -314,7 +312,7 @@ protected Ref<TypeConstraint> currentTypeConstraint; public TypeConstraint currentTypeConstraint() { if (currentTypeConstraint == null) - return new TypeConstraint_c(); + return new TypeConstraint(); return currentTypeConstraint.get(); } public void setCurrentTypeConstraint(Ref<TypeConstraint> c) { currentTypeConstraint = c; @@ -324,7 +322,7 @@ protected CConstraint currentPlaceConstraint; public CConstraint currentPlaceConstraint() { if (currentPlaceConstraint == null) - return new CConstraint_c(); + return new CConstraint(); return currentPlaceConstraint; } */ @@ -363,7 +361,7 @@ // vj: TODO: check if this is the right thing to do. public CConstraint currentConstraint() { if (currentConstraint == null) { - CConstraint c = new CConstraint_c(); + CConstraint c = new CConstraint(); if (! inStaticContext()) { c.setThisVar(thisVar()); } @@ -497,7 +495,7 @@ Type t = currentClass; X10TypeSystem xts = (X10TypeSystem) ts; - XRoot thisVar = null; + XVar thisVar = null; if (XTypeTranslator.THIS_VAR) { CodeDef cd = this.currentCode(); if (cd instanceof X10MemberDef) { Modified: trunk/x10.compiler/src/x10/types/X10FieldDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10FieldDef_c.java 2010-05-09 16:52:30 UTC (rev 14109) +++ trunk/x10.compiler/src/x10/types/X10FieldDef_c.java 2010-05-09 16:53:51 UTC (rev 14110) @@ -27,7 +27,7 @@ import polyglot.types.TypeSystem; ... [truncated message content] |